@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.
@@ -1,5 +1,4 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import { fg } from '@atlaskit/platform-feature-flags';
3
2
  const ANCESTOR_LOOKUP_LIMIT = 10;
4
3
  const PAGE_LAYOUT_ID = 'page-layout.root';
5
4
  export class SSRPlaceholderHandlers {
@@ -247,45 +246,40 @@ export class SSRPlaceholderHandlers {
247
246
  * by collecting dimensions from their children instead
248
247
  */
249
248
  getEffectiveBoundingRect(el) {
250
- const enableDisplayContentsSupport = fg('platform_ufo_ssr_placeholders_for_display_contents');
249
+ const computedStyle = window.getComputedStyle(el);
251
250
 
252
- // Only handle display: contents if feature flag is enabled
253
- if (enableDisplayContentsSupport) {
254
- const computedStyle = window.getComputedStyle(el);
251
+ // If element has display: contents, collect bounding rect from children
252
+ if (computedStyle.display === 'contents') {
253
+ const children = Array.from(el.children);
254
+ if (children.length === 0) {
255
+ // No children, return zero rect
256
+ return new DOMRect(0, 0, 0, 0);
257
+ }
255
258
 
256
- // If element has display: contents, collect bounding rect from children
257
- if (computedStyle.display === 'contents') {
258
- const children = Array.from(el.children);
259
- if (children.length === 0) {
260
- // No children, return zero rect
261
- return new DOMRect(0, 0, 0, 0);
259
+ // Calculate union of all children's bounding rects
260
+ let minX = Infinity;
261
+ let minY = Infinity;
262
+ let maxX = -Infinity;
263
+ let maxY = -Infinity;
264
+ children.forEach(child => {
265
+ const childRect = child.getBoundingClientRect();
266
+ // Skip children with zero dimensions (likely also display: contents)
267
+ if (childRect.width > 0 || childRect.height > 0) {
268
+ minX = Math.min(minX, childRect.left);
269
+ minY = Math.min(minY, childRect.top);
270
+ maxX = Math.max(maxX, childRect.right);
271
+ maxY = Math.max(maxY, childRect.bottom);
262
272
  }
273
+ });
263
274
 
264
- // Calculate union of all children's bounding rects
265
- let minX = Infinity;
266
- let minY = Infinity;
267
- let maxX = -Infinity;
268
- let maxY = -Infinity;
269
- children.forEach(child => {
270
- const childRect = child.getBoundingClientRect();
271
- // Skip children with zero dimensions (likely also display: contents)
272
- if (childRect.width > 0 || childRect.height > 0) {
273
- minX = Math.min(minX, childRect.left);
274
- minY = Math.min(minY, childRect.top);
275
- maxX = Math.max(maxX, childRect.right);
276
- maxY = Math.max(maxY, childRect.bottom);
277
- }
278
- });
279
-
280
- // If no children with dimensions found, return zero rect
281
- if (minX === Infinity) {
282
- return new DOMRect(0, 0, 0, 0);
283
- }
284
- return new DOMRect(minX, minY, maxX - minX, maxY - minY);
275
+ // If no children with dimensions found, return zero rect
276
+ if (minX === Infinity) {
277
+ return new DOMRect(0, 0, 0, 0);
285
278
  }
279
+ return new DOMRect(minX, minY, maxX - minX, maxY - minY);
286
280
  }
287
281
 
288
- // Normal element or feature flag disabled, return its bounding rect
282
+ // Normal element, return its bounding rect
289
283
  return el.getBoundingClientRect();
290
284
  }
291
285
  isDummyRect(rect) {
@@ -1,31 +1,20 @@
1
- import { fg } from '@atlaskit/platform-feature-flags';
2
-
3
1
  // lightweight script to scan the SSR response and collect all elements with data-ssr-placeholder attribute
4
2
  // and save their size/positions in a map __SSR_PLACEHOLDERS_DIMENSIONS__ on the Window object. Each placeholderId is
5
3
  // unique and maps to its corresponding elements bounding client rectangle dimensions.
6
4
  export function collectSSRPlaceholderDimensions(document, window, enablePageLayoutPlaceholder = false) {
7
- const enableDisplayContentsSupport = fg('platform_ufo_ssr_placeholders_for_display_contents');
8
5
  const ssrPlaceholders = document === null || document === void 0 ? void 0 : document.querySelectorAll('[data-ssr-placeholder]');
9
6
  ssrPlaceholders.forEach(elem => {
10
7
  const placeholderId = elem.getAttribute('data-ssr-placeholder');
11
8
  if (placeholderId) {
12
9
  window.__SSR_PLACEHOLDERS_DIMENSIONS__ = window.__SSR_PLACEHOLDERS_DIMENSIONS__ || {};
13
- if (enableDisplayContentsSupport) {
14
- window.__SSR_PLACEHOLDERS_DIMENSIONS__[placeholderId] = getEffectiveBoundingRect(elem, window);
15
- } else {
16
- window.__SSR_PLACEHOLDERS_DIMENSIONS__[placeholderId] = elem.getBoundingClientRect();
17
- }
10
+ window.__SSR_PLACEHOLDERS_DIMENSIONS__[placeholderId] = getEffectiveBoundingRect(elem, window);
18
11
  }
19
12
  });
20
13
  if (enablePageLayoutPlaceholder) {
21
14
  const pageLayoutRoot = document === null || document === void 0 ? void 0 : document.getElementById('unsafe-design-system-page-layout-root');
22
15
  if (pageLayoutRoot) {
23
16
  window.__SSR_PLACEHOLDERS_DIMENSIONS__ = window.__SSR_PLACEHOLDERS_DIMENSIONS__ || {};
24
- if (enableDisplayContentsSupport) {
25
- window.__SSR_PLACEHOLDERS_DIMENSIONS__['page-layout.root'] = getEffectiveBoundingRect(pageLayoutRoot, window);
26
- } else {
27
- window.__SSR_PLACEHOLDERS_DIMENSIONS__['page-layout.root'] = pageLayoutRoot.getBoundingClientRect();
28
- }
17
+ window.__SSR_PLACEHOLDERS_DIMENSIONS__['page-layout.root'] = getEffectiveBoundingRect(pageLayoutRoot, window);
29
18
  }
30
19
  }
31
20
  }
@@ -80,100 +80,10 @@ export default class ViewportObserver {
80
80
  if (!addedNode) {
81
81
  continue;
82
82
  }
83
- if (fg('platform_ufo_ssr_placeholders_for_display_contents')) {
84
- for (const {
85
- isDisplayContentsElementChildren,
86
- element
87
- } of getMutatedElements(addedNode)) {
88
- // SSR hydration logic
89
- if (this.getSSRState) {
90
- const ssrState = this.getSSRState();
91
- const SSRStateEnum = {
92
- normal: 1,
93
- waitingForFirstRender: 2,
94
- ignoring: 3
95
- };
96
- if (ssrState.state === SSRStateEnum.waitingForFirstRender && timestamp > ssrState.renderStart && targetNode === ssrState.reactRootElement) {
97
- var _this$intersectionObs;
98
- ssrState.state = SSRStateEnum.ignoring;
99
- if (ssrState.renderStop === -1) {
100
- // arbitrary 500ms DOM update window
101
- ssrState.renderStop = timestamp + 500;
102
- }
103
- (_this$intersectionObs = this.intersectionObserver) === null || _this$intersectionObs === void 0 ? void 0 : _this$intersectionObs.watchAndTag(element, 'ssr-hydration');
104
- continue;
105
- }
106
- if (ssrState.state === SSRStateEnum.ignoring && timestamp > ssrState.renderStart && targetNode === ssrState.reactRootElement) {
107
- if (timestamp <= ssrState.renderStop) {
108
- var _this$intersectionObs2;
109
- (_this$intersectionObs2 = this.intersectionObserver) === null || _this$intersectionObs2 === void 0 ? void 0 : _this$intersectionObs2.watchAndTag(element, 'ssr-hydration');
110
- continue;
111
- } else {
112
- ssrState.state = SSRStateEnum.normal;
113
- }
114
- }
115
- }
116
-
117
- // SSR placeholder logic - check and handle with await
118
- if (this.getSSRPlaceholderHandler) {
119
- const ssrPlaceholderHandler = this.getSSRPlaceholderHandler();
120
- if (ssrPlaceholderHandler) {
121
- if (ssrPlaceholderHandler.isPlaceholder(element) || ssrPlaceholderHandler.isPlaceholderIgnored(element)) {
122
- if (ssrPlaceholderHandler.checkIfExistedAndSizeMatchingV3(element)) {
123
- var _this$intersectionObs3;
124
- (_this$intersectionObs3 = this.intersectionObserver) === null || _this$intersectionObs3 === void 0 ? void 0 : _this$intersectionObs3.watchAndTag(element, 'mutation:ssr-placeholder');
125
- continue;
126
- }
127
- // If result is false, continue to normal mutation logic below
128
- }
129
- if (ssrPlaceholderHandler.isPlaceholderReplacement(element) || ssrPlaceholderHandler.isPlaceholderIgnored(element)) {
130
- const result = await ssrPlaceholderHandler.validateReactComponentMatchToPlaceholder(element);
131
- if (result !== false) {
132
- var _this$intersectionObs4;
133
- (_this$intersectionObs4 = this.intersectionObserver) === null || _this$intersectionObs4 === void 0 ? void 0 : _this$intersectionObs4.watchAndTag(element, 'mutation:ssr-placeholder');
134
- continue;
135
- }
136
- // If result is false, continue to normal mutation logic below
137
- }
138
- }
139
- }
140
- const sameDeletedNode = removedNodes.find(ref => {
141
- const n = ref.deref();
142
- if (!n || !element) {
143
- return false;
144
- }
145
- return n.isEqualNode(element);
146
- });
147
- const isInIgnoreLsMarker = element instanceof HTMLElement ? isInVCIgnoreIfNoLayoutShiftMarker(element) : false;
148
- if (sameDeletedNode && isInIgnoreLsMarker) {
149
- var _this$intersectionObs5;
150
- (_this$intersectionObs5 = this.intersectionObserver) === null || _this$intersectionObs5 === void 0 ? void 0 : _this$intersectionObs5.watchAndTag(element, 'mutation:remount');
151
- continue;
152
- }
153
- if (isContainedWithinMediaWrapper(element)) {
154
- var _this$intersectionObs6;
155
- (_this$intersectionObs6 = this.intersectionObserver) === null || _this$intersectionObs6 === void 0 ? void 0 : _this$intersectionObs6.watchAndTag(element, 'mutation:media');
156
- continue;
157
- }
158
- const {
159
- isWithin: isWithinThirdPartySegment
160
- } = element instanceof HTMLElement ? checkWithinComponent(element, 'UFOThirdPartySegment', this.mapIs3pResult) : {
161
- isWithin: false
162
- };
163
- if (isWithinThirdPartySegment) {
164
- var _this$intersectionObs7;
165
- (_this$intersectionObs7 = this.intersectionObserver) === null || _this$intersectionObs7 === void 0 ? void 0 : _this$intersectionObs7.watchAndTag(element, 'mutation:third-party-element');
166
- continue;
167
- }
168
- if (isDisplayContentsElementChildren) {
169
- var _this$intersectionObs8;
170
- (_this$intersectionObs8 = this.intersectionObserver) === null || _this$intersectionObs8 === void 0 ? void 0 : _this$intersectionObs8.watchAndTag(element, 'mutation:display-contents-children-element');
171
- } else {
172
- var _this$intersectionObs9;
173
- (_this$intersectionObs9 = this.intersectionObserver) === null || _this$intersectionObs9 === void 0 ? void 0 : _this$intersectionObs9.watchAndTag(element, createElementMutationsWatcher(removedNodeRects));
174
- }
175
- }
176
- } else {
83
+ for (const {
84
+ isDisplayContentsElementChildren,
85
+ element
86
+ } of getMutatedElements(addedNode)) {
177
87
  // SSR hydration logic
178
88
  if (this.getSSRState) {
179
89
  const ssrState = this.getSSRState();
@@ -183,19 +93,19 @@ export default class ViewportObserver {
183
93
  ignoring: 3
184
94
  };
185
95
  if (ssrState.state === SSRStateEnum.waitingForFirstRender && timestamp > ssrState.renderStart && targetNode === ssrState.reactRootElement) {
186
- var _this$intersectionObs0;
96
+ var _this$intersectionObs;
187
97
  ssrState.state = SSRStateEnum.ignoring;
188
98
  if (ssrState.renderStop === -1) {
189
99
  // arbitrary 500ms DOM update window
190
100
  ssrState.renderStop = timestamp + 500;
191
101
  }
192
- (_this$intersectionObs0 = this.intersectionObserver) === null || _this$intersectionObs0 === void 0 ? void 0 : _this$intersectionObs0.watchAndTag(addedNode, 'ssr-hydration');
102
+ (_this$intersectionObs = this.intersectionObserver) === null || _this$intersectionObs === void 0 ? void 0 : _this$intersectionObs.watchAndTag(element, 'ssr-hydration');
193
103
  continue;
194
104
  }
195
105
  if (ssrState.state === SSRStateEnum.ignoring && timestamp > ssrState.renderStart && targetNode === ssrState.reactRootElement) {
196
106
  if (timestamp <= ssrState.renderStop) {
197
- var _this$intersectionObs1;
198
- (_this$intersectionObs1 = this.intersectionObserver) === null || _this$intersectionObs1 === void 0 ? void 0 : _this$intersectionObs1.watchAndTag(addedNode, 'ssr-hydration');
107
+ var _this$intersectionObs2;
108
+ (_this$intersectionObs2 = this.intersectionObserver) === null || _this$intersectionObs2 === void 0 ? void 0 : _this$intersectionObs2.watchAndTag(element, 'ssr-hydration');
199
109
  continue;
200
110
  } else {
201
111
  ssrState.state = SSRStateEnum.normal;
@@ -207,19 +117,19 @@ export default class ViewportObserver {
207
117
  if (this.getSSRPlaceholderHandler) {
208
118
  const ssrPlaceholderHandler = this.getSSRPlaceholderHandler();
209
119
  if (ssrPlaceholderHandler) {
210
- if (ssrPlaceholderHandler.isPlaceholder(addedNode) || ssrPlaceholderHandler.isPlaceholderIgnored(addedNode)) {
211
- if (ssrPlaceholderHandler.checkIfExistedAndSizeMatchingV3(addedNode)) {
212
- var _this$intersectionObs10;
213
- (_this$intersectionObs10 = this.intersectionObserver) === null || _this$intersectionObs10 === void 0 ? void 0 : _this$intersectionObs10.watchAndTag(addedNode, 'mutation:ssr-placeholder');
120
+ if (ssrPlaceholderHandler.isPlaceholder(element) || ssrPlaceholderHandler.isPlaceholderIgnored(element)) {
121
+ if (ssrPlaceholderHandler.checkIfExistedAndSizeMatchingV3(element)) {
122
+ var _this$intersectionObs3;
123
+ (_this$intersectionObs3 = this.intersectionObserver) === null || _this$intersectionObs3 === void 0 ? void 0 : _this$intersectionObs3.watchAndTag(element, 'mutation:ssr-placeholder');
214
124
  continue;
215
125
  }
216
126
  // If result is false, continue to normal mutation logic below
217
127
  }
218
- if (ssrPlaceholderHandler.isPlaceholderReplacement(addedNode) || ssrPlaceholderHandler.isPlaceholderIgnored(addedNode)) {
219
- const result = await ssrPlaceholderHandler.validateReactComponentMatchToPlaceholder(addedNode);
128
+ if (ssrPlaceholderHandler.isPlaceholderReplacement(element) || ssrPlaceholderHandler.isPlaceholderIgnored(element)) {
129
+ const result = await ssrPlaceholderHandler.validateReactComponentMatchToPlaceholder(element);
220
130
  if (result !== false) {
221
- var _this$intersectionObs11;
222
- (_this$intersectionObs11 = this.intersectionObserver) === null || _this$intersectionObs11 === void 0 ? void 0 : _this$intersectionObs11.watchAndTag(addedNode, 'mutation:ssr-placeholder');
131
+ var _this$intersectionObs4;
132
+ (_this$intersectionObs4 = this.intersectionObserver) === null || _this$intersectionObs4 === void 0 ? void 0 : _this$intersectionObs4.watchAndTag(element, 'mutation:ssr-placeholder');
223
133
  continue;
224
134
  }
225
135
  // If result is false, continue to normal mutation logic below
@@ -228,41 +138,38 @@ export default class ViewportObserver {
228
138
  }
229
139
  const sameDeletedNode = removedNodes.find(ref => {
230
140
  const n = ref.deref();
231
- if (!n || !addedNode) {
141
+ if (!n || !element) {
232
142
  return false;
233
143
  }
234
- return n.isEqualNode(addedNode);
144
+ return n.isEqualNode(element);
235
145
  });
236
- const isInIgnoreLsMarker = isInVCIgnoreIfNoLayoutShiftMarker(addedNode);
146
+ const isInIgnoreLsMarker = element instanceof HTMLElement ? isInVCIgnoreIfNoLayoutShiftMarker(element) : false;
237
147
  if (sameDeletedNode && isInIgnoreLsMarker) {
238
- var _this$intersectionObs12;
239
- (_this$intersectionObs12 = this.intersectionObserver) === null || _this$intersectionObs12 === void 0 ? void 0 : _this$intersectionObs12.watchAndTag(addedNode, 'mutation:remount');
148
+ var _this$intersectionObs5;
149
+ (_this$intersectionObs5 = this.intersectionObserver) === null || _this$intersectionObs5 === void 0 ? void 0 : _this$intersectionObs5.watchAndTag(element, 'mutation:remount');
240
150
  continue;
241
151
  }
242
- if (isContainedWithinMediaWrapper(addedNode)) {
243
- var _this$intersectionObs13;
244
- (_this$intersectionObs13 = this.intersectionObserver) === null || _this$intersectionObs13 === void 0 ? void 0 : _this$intersectionObs13.watchAndTag(addedNode, 'mutation:media');
152
+ if (isContainedWithinMediaWrapper(element)) {
153
+ var _this$intersectionObs6;
154
+ (_this$intersectionObs6 = this.intersectionObserver) === null || _this$intersectionObs6 === void 0 ? void 0 : _this$intersectionObs6.watchAndTag(element, 'mutation:media');
245
155
  continue;
246
156
  }
247
157
  const {
248
158
  isWithin: isWithinThirdPartySegment
249
- } = checkWithinComponent(addedNode, 'UFOThirdPartySegment', this.mapIs3pResult);
159
+ } = element instanceof HTMLElement ? checkWithinComponent(element, 'UFOThirdPartySegment', this.mapIs3pResult) : {
160
+ isWithin: false
161
+ };
250
162
  if (isWithinThirdPartySegment) {
251
- var _this$intersectionObs14;
252
- (_this$intersectionObs14 = this.intersectionObserver) === null || _this$intersectionObs14 === void 0 ? void 0 : _this$intersectionObs14.watchAndTag(addedNode, 'mutation:third-party-element');
163
+ var _this$intersectionObs7;
164
+ (_this$intersectionObs7 = this.intersectionObserver) === null || _this$intersectionObs7 === void 0 ? void 0 : _this$intersectionObs7.watchAndTag(element, 'mutation:third-party-element');
253
165
  continue;
254
166
  }
255
- for (const {
256
- isDisplayContentsElementChildren,
257
- element
258
- } of getMutatedElements(addedNode)) {
259
- if (isDisplayContentsElementChildren) {
260
- var _this$intersectionObs15;
261
- (_this$intersectionObs15 = this.intersectionObserver) === null || _this$intersectionObs15 === void 0 ? void 0 : _this$intersectionObs15.watchAndTag(element, 'mutation:display-contents-children-element');
262
- } else {
263
- var _this$intersectionObs16;
264
- (_this$intersectionObs16 = this.intersectionObserver) === null || _this$intersectionObs16 === void 0 ? void 0 : _this$intersectionObs16.watchAndTag(element, createElementMutationsWatcher(removedNodeRects));
265
- }
167
+ if (isDisplayContentsElementChildren) {
168
+ var _this$intersectionObs8;
169
+ (_this$intersectionObs8 = this.intersectionObserver) === null || _this$intersectionObs8 === void 0 ? void 0 : _this$intersectionObs8.watchAndTag(element, 'mutation:display-contents-children-element');
170
+ } else {
171
+ var _this$intersectionObs9;
172
+ (_this$intersectionObs9 = this.intersectionObserver) === null || _this$intersectionObs9 === void 0 ? void 0 : _this$intersectionObs9.watchAndTag(element, createElementMutationsWatcher(removedNodeRects));
266
173
  }
267
174
  }
268
175
  }
@@ -273,8 +180,8 @@ export default class ViewportObserver {
273
180
  oldValue,
274
181
  newValue
275
182
  }) => {
276
- var _this$intersectionObs17;
277
- (_this$intersectionObs17 = this.intersectionObserver) === null || _this$intersectionObs17 === void 0 ? void 0 : _this$intersectionObs17.watchAndTag(target, ({
183
+ var _this$intersectionObs0;
184
+ (_this$intersectionObs0 = this.intersectionObserver) === null || _this$intersectionObs0 === void 0 ? void 0 : _this$intersectionObs0.watchAndTag(target, ({
278
185
  target,
279
186
  rect
280
187
  }) => {
@@ -416,12 +323,12 @@ export default class ViewportObserver {
416
323
  this.isStarted = true;
417
324
  }
418
325
  stop() {
419
- var _this$mutationObserve2, _this$intersectionObs18, _this$performanceObse2;
326
+ var _this$mutationObserve2, _this$intersectionObs1, _this$performanceObse2;
420
327
  if (!this.isStarted) {
421
328
  return;
422
329
  }
423
330
  (_this$mutationObserve2 = this.mutationObserver) === null || _this$mutationObserve2 === void 0 ? void 0 : _this$mutationObserve2.disconnect();
424
- (_this$intersectionObs18 = this.intersectionObserver) === null || _this$intersectionObs18 === void 0 ? void 0 : _this$intersectionObs18.disconnect();
331
+ (_this$intersectionObs1 = this.intersectionObserver) === null || _this$intersectionObs1 === void 0 ? void 0 : _this$intersectionObs1.disconnect();
425
332
  (_this$performanceObse2 = this.performanceObserver) === null || _this$performanceObse2 === void 0 ? void 0 : _this$performanceObse2.disconnect();
426
333
  this.isStarted = false;
427
334
  // Clean up caches when stopping
@@ -849,7 +849,7 @@ export function tryComplete(interactionId, endTime) {
849
849
  if ((_getConfig1 = getConfig()) !== null && _getConfig1 !== void 0 && (_getConfig1 = _getConfig1.extraInteractionMetrics) !== null && _getConfig1 !== void 0 && _getConfig1.enabled) {
850
850
  interactionExtraMetrics.updateFinishedInteraction(interaction);
851
851
  }
852
- if ((_getConfig10 = getConfig()) !== null && _getConfig10 !== void 0 && (_getConfig10 = _getConfig10.extraSearchPageInteraction) !== null && _getConfig10 !== void 0 && _getConfig10.enabled && interaction.ufoName === ((_getConfig11 = getConfig()) === null || _getConfig11 === void 0 || (_getConfig11 = _getConfig11.extraSearchPageInteraction) === null || _getConfig11 === void 0 ? void 0 : _getConfig11.searchPageMetricName) && fg('react_ufo_unified_search_ignoring_sain_metric')) {
852
+ if ((_getConfig10 = getConfig()) !== null && _getConfig10 !== void 0 && (_getConfig10 = _getConfig10.extraSearchPageInteraction) !== null && _getConfig10 !== void 0 && _getConfig10.enabled && interaction.ufoName === ((_getConfig11 = getConfig()) === null || _getConfig11 === void 0 || (_getConfig11 = _getConfig11.extraSearchPageInteraction) === null || _getConfig11 === void 0 ? void 0 : _getConfig11.searchPageMetricName)) {
853
853
  onSearchPageInteractionComplete(interactionId, interaction);
854
854
  }
855
855
  activeSubmitted = true;
@@ -873,7 +873,7 @@ export function tryComplete(interactionId, endTime) {
873
873
  if (!activeSubmitted) {
874
874
  var _getConfig13, _getConfig14;
875
875
  finishInteraction(interactionId, interaction, endTime);
876
- if ((_getConfig13 = getConfig()) !== null && _getConfig13 !== void 0 && (_getConfig13 = _getConfig13.extraSearchPageInteraction) !== null && _getConfig13 !== void 0 && _getConfig13.enabled && interaction.ufoName === ((_getConfig14 = getConfig()) === null || _getConfig14 === void 0 || (_getConfig14 = _getConfig14.extraSearchPageInteraction) === null || _getConfig14 === void 0 ? void 0 : _getConfig14.searchPageMetricName) && fg('react_ufo_unified_search_ignoring_sain_metric')) {
876
+ if ((_getConfig13 = getConfig()) !== null && _getConfig13 !== void 0 && (_getConfig13 = _getConfig13.extraSearchPageInteraction) !== null && _getConfig13 !== void 0 && _getConfig13.enabled && interaction.ufoName === ((_getConfig14 = getConfig()) === null || _getConfig14 === void 0 || (_getConfig14 = _getConfig14.extraSearchPageInteraction) === null || _getConfig14 === void 0 ? void 0 : _getConfig14.searchPageMetricName)) {
877
877
  onSearchPageInteractionComplete(interactionId, interaction);
878
878
  }
879
879
  activeSubmitted = true;
@@ -179,7 +179,7 @@ export function init(analyticsWebClientAsync, config) {
179
179
  if (config !== null && config !== void 0 && (_config$extraInteract2 = config.extraInteractionMetrics) !== null && _config$extraInteract2 !== void 0 && _config$extraInteract2.enabled && fg('platform_ufo_enable_ttai_with_3p')) {
180
180
  sinkInteractionExtraMetrics(instance, createInteractionExtraMetricsPayloadPackage.default);
181
181
  }
182
- if (config !== null && config !== void 0 && (_config$extraSearchPa = config.extraSearchPageInteraction) !== null && _config$extraSearchPa !== void 0 && _config$extraSearchPa.enabled && fg('react_ufo_unified_search_ignoring_sain_metric')) {
182
+ if (config !== null && config !== void 0 && (_config$extraSearchPa = config.extraSearchPageInteraction) !== null && _config$extraSearchPa !== void 0 && _config$extraSearchPa.enabled) {
183
183
  sinkExtraSearchPageInteraction(instance, payloadPackage);
184
184
  }
185
185
  });
@@ -1,7 +1,6 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/createClass";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- import { fg } from '@atlaskit/platform-feature-flags';
5
4
  var ANCESTOR_LOOKUP_LIMIT = 10;
6
5
  var PAGE_LAYOUT_ID = 'page-layout.root';
7
6
  export var SSRPlaceholderHandlers = /*#__PURE__*/function () {
@@ -284,45 +283,40 @@ export var SSRPlaceholderHandlers = /*#__PURE__*/function () {
284
283
  }, {
285
284
  key: "getEffectiveBoundingRect",
286
285
  value: function getEffectiveBoundingRect(el) {
287
- var enableDisplayContentsSupport = fg('platform_ufo_ssr_placeholders_for_display_contents');
286
+ var computedStyle = window.getComputedStyle(el);
288
287
 
289
- // Only handle display: contents if feature flag is enabled
290
- if (enableDisplayContentsSupport) {
291
- var computedStyle = window.getComputedStyle(el);
288
+ // If element has display: contents, collect bounding rect from children
289
+ if (computedStyle.display === 'contents') {
290
+ var children = Array.from(el.children);
291
+ if (children.length === 0) {
292
+ // No children, return zero rect
293
+ return new DOMRect(0, 0, 0, 0);
294
+ }
292
295
 
293
- // If element has display: contents, collect bounding rect from children
294
- if (computedStyle.display === 'contents') {
295
- var children = Array.from(el.children);
296
- if (children.length === 0) {
297
- // No children, return zero rect
298
- return new DOMRect(0, 0, 0, 0);
296
+ // Calculate union of all children's bounding rects
297
+ var minX = Infinity;
298
+ var minY = Infinity;
299
+ var maxX = -Infinity;
300
+ var maxY = -Infinity;
301
+ children.forEach(function (child) {
302
+ var childRect = child.getBoundingClientRect();
303
+ // Skip children with zero dimensions (likely also display: contents)
304
+ if (childRect.width > 0 || childRect.height > 0) {
305
+ minX = Math.min(minX, childRect.left);
306
+ minY = Math.min(minY, childRect.top);
307
+ maxX = Math.max(maxX, childRect.right);
308
+ maxY = Math.max(maxY, childRect.bottom);
299
309
  }
310
+ });
300
311
 
301
- // Calculate union of all children's bounding rects
302
- var minX = Infinity;
303
- var minY = Infinity;
304
- var maxX = -Infinity;
305
- var maxY = -Infinity;
306
- children.forEach(function (child) {
307
- var childRect = child.getBoundingClientRect();
308
- // Skip children with zero dimensions (likely also display: contents)
309
- if (childRect.width > 0 || childRect.height > 0) {
310
- minX = Math.min(minX, childRect.left);
311
- minY = Math.min(minY, childRect.top);
312
- maxX = Math.max(maxX, childRect.right);
313
- maxY = Math.max(maxY, childRect.bottom);
314
- }
315
- });
316
-
317
- // If no children with dimensions found, return zero rect
318
- if (minX === Infinity) {
319
- return new DOMRect(0, 0, 0, 0);
320
- }
321
- return new DOMRect(minX, minY, maxX - minX, maxY - minY);
312
+ // If no children with dimensions found, return zero rect
313
+ if (minX === Infinity) {
314
+ return new DOMRect(0, 0, 0, 0);
322
315
  }
316
+ return new DOMRect(minX, minY, maxX - minX, maxY - minY);
323
317
  }
324
318
 
325
- // Normal element or feature flag disabled, return its bounding rect
319
+ // Normal element, return its bounding rect
326
320
  return el.getBoundingClientRect();
327
321
  }
328
322
  }, {
@@ -1,32 +1,21 @@
1
- import { fg } from '@atlaskit/platform-feature-flags';
2
-
3
1
  // lightweight script to scan the SSR response and collect all elements with data-ssr-placeholder attribute
4
2
  // and save their size/positions in a map __SSR_PLACEHOLDERS_DIMENSIONS__ on the Window object. Each placeholderId is
5
3
  // unique and maps to its corresponding elements bounding client rectangle dimensions.
6
4
  export function collectSSRPlaceholderDimensions(document, window) {
7
5
  var enablePageLayoutPlaceholder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
8
- var enableDisplayContentsSupport = fg('platform_ufo_ssr_placeholders_for_display_contents');
9
6
  var ssrPlaceholders = document === null || document === void 0 ? void 0 : document.querySelectorAll('[data-ssr-placeholder]');
10
7
  ssrPlaceholders.forEach(function (elem) {
11
8
  var placeholderId = elem.getAttribute('data-ssr-placeholder');
12
9
  if (placeholderId) {
13
10
  window.__SSR_PLACEHOLDERS_DIMENSIONS__ = window.__SSR_PLACEHOLDERS_DIMENSIONS__ || {};
14
- if (enableDisplayContentsSupport) {
15
- window.__SSR_PLACEHOLDERS_DIMENSIONS__[placeholderId] = getEffectiveBoundingRect(elem, window);
16
- } else {
17
- window.__SSR_PLACEHOLDERS_DIMENSIONS__[placeholderId] = elem.getBoundingClientRect();
18
- }
11
+ window.__SSR_PLACEHOLDERS_DIMENSIONS__[placeholderId] = getEffectiveBoundingRect(elem, window);
19
12
  }
20
13
  });
21
14
  if (enablePageLayoutPlaceholder) {
22
15
  var pageLayoutRoot = document === null || document === void 0 ? void 0 : document.getElementById('unsafe-design-system-page-layout-root');
23
16
  if (pageLayoutRoot) {
24
17
  window.__SSR_PLACEHOLDERS_DIMENSIONS__ = window.__SSR_PLACEHOLDERS_DIMENSIONS__ || {};
25
- if (enableDisplayContentsSupport) {
26
- window.__SSR_PLACEHOLDERS_DIMENSIONS__['page-layout.root'] = getEffectiveBoundingRect(pageLayoutRoot, window);
27
- } else {
28
- window.__SSR_PLACEHOLDERS_DIMENSIONS__['page-layout.root'] = pageLayoutRoot.getBoundingClientRect();
29
- }
18
+ window.__SSR_PLACEHOLDERS_DIMENSIONS__['page-layout.root'] = getEffectiveBoundingRect(pageLayoutRoot, window);
30
19
  }
31
20
  }
32
21
  }