@atlaskit/react-ufo 2.8.2 → 2.10.0

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,21 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 2.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#103488](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/103488)
8
+ [`1081d09eb1d4b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1081d09eb1d4b) -
9
+ Add API to support SSR whitelist for NIN
10
+
11
+ ## 2.9.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [#101686](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/101686)
16
+ [`e26a94f833e02`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e26a94f833e02) -
17
+ Add fallback error handling for check element visibility VC calculation logic
18
+
3
19
  ## 2.8.2
4
20
 
5
21
  ### Patch Changes
@@ -179,7 +179,7 @@ var getPaintMetrics = function getPaintMetrics(type) {
179
179
  return metrics;
180
180
  };
181
181
  var getVCMetrics = function getVCMetrics(interaction) {
182
- var _config$vc, _interaction$apdex;
182
+ var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex;
183
183
  var config = (0, _config.getConfig)();
184
184
  if (!(config !== null && config !== void 0 && (_config$vc = config.vc) !== null && _config$vc !== void 0 && _config$vc.enabled)) {
185
185
  return {};
@@ -187,7 +187,8 @@ var getVCMetrics = function getVCMetrics(interaction) {
187
187
  if (interaction.type !== 'page_load' && interaction.type !== 'transition') {
188
188
  return {};
189
189
  }
190
- var ssr = interaction.type === 'page_load' && config !== null && config !== void 0 && config.ssr ? {
190
+ var isSSREnabled = (config === null || config === void 0 ? void 0 : config.ssr) || (config === null || config === void 0 || (_config$vc$ssrWhiteli = config.vc.ssrWhitelist) === null || _config$vc$ssrWhiteli === void 0 ? void 0 : _config$vc$ssrWhiteli.includes(interaction.ufoName));
191
+ var ssr = interaction.type === 'page_load' && isSSREnabled ? {
191
192
  ssr: getSSRDoneTimeValue(config)
192
193
  } : null;
193
194
  _interactionMetrics.postInteractionLog.setVCObserverSSRConfig(ssr);
@@ -19,6 +19,17 @@ var state = {
19
19
  waitingForFirstRender: 2,
20
20
  ignoring: 3
21
21
  };
22
+ function isElementVisible(target) {
23
+ if (!target || typeof target.checkVisibility !== 'function') {
24
+ return true;
25
+ }
26
+ var isVisible = target.checkVisibility({
27
+ contentVisibilityAuto: true,
28
+ opacityProperty: true,
29
+ visibilityProperty: true
30
+ });
31
+ return isVisible;
32
+ }
22
33
  function isInsideEditorContainer(target) {
23
34
  if (!target || typeof target.closest !== 'function') {
24
35
  return false;
@@ -255,12 +266,7 @@ var Observers = exports.Observers = /*#__PURE__*/function () {
255
266
  return;
256
267
  }
257
268
  if ((0, _platformFeatureFlags.fg)('platform-ufo-invisible-element-vc-calculations')) {
258
- var isVisible = target.checkVisibility({
259
- contentVisibilityAuto: true,
260
- opacityProperty: true,
261
- visibilityProperty: true
262
- });
263
- if (!isVisible) {
269
+ if (!isElementVisible(target)) {
264
270
  data.ignoreReason = 'not-visible';
265
271
  }
266
272
  }
@@ -156,7 +156,7 @@ const getPaintMetrics = type => {
156
156
  return metrics;
157
157
  };
158
158
  const getVCMetrics = interaction => {
159
- var _config$vc, _interaction$apdex, _interaction$apdex$;
159
+ var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex, _interaction$apdex$;
160
160
  const config = getConfig();
161
161
  if (!(config !== null && config !== void 0 && (_config$vc = config.vc) !== null && _config$vc !== void 0 && _config$vc.enabled)) {
162
162
  return {};
@@ -164,7 +164,8 @@ const getVCMetrics = interaction => {
164
164
  if (interaction.type !== 'page_load' && interaction.type !== 'transition') {
165
165
  return {};
166
166
  }
167
- const ssr = interaction.type === 'page_load' && config !== null && config !== void 0 && config.ssr ? {
167
+ const isSSREnabled = (config === null || config === void 0 ? void 0 : config.ssr) || (config === null || config === void 0 ? void 0 : (_config$vc$ssrWhiteli = config.vc.ssrWhitelist) === null || _config$vc$ssrWhiteli === void 0 ? void 0 : _config$vc$ssrWhiteli.includes(interaction.ufoName));
168
+ const ssr = interaction.type === 'page_load' && isSSREnabled ? {
168
169
  ssr: getSSRDoneTimeValue(config)
169
170
  } : null;
170
171
  postInteractionLog.setVCObserverSSRConfig(ssr);
@@ -8,6 +8,17 @@ const state = {
8
8
  waitingForFirstRender: 2,
9
9
  ignoring: 3
10
10
  };
11
+ function isElementVisible(target) {
12
+ if (!target || typeof target.checkVisibility !== 'function') {
13
+ return true;
14
+ }
15
+ const isVisible = target.checkVisibility({
16
+ contentVisibilityAuto: true,
17
+ opacityProperty: true,
18
+ visibilityProperty: true
19
+ });
20
+ return isVisible;
21
+ }
11
22
  function isInsideEditorContainer(target) {
12
23
  if (!target || typeof target.closest !== 'function') {
13
24
  return false;
@@ -223,12 +234,7 @@ export class Observers {
223
234
  return;
224
235
  }
225
236
  if (fg('platform-ufo-invisible-element-vc-calculations')) {
226
- const isVisible = target.checkVisibility({
227
- contentVisibilityAuto: true,
228
- opacityProperty: true,
229
- visibilityProperty: true
230
- });
231
- if (!isVisible) {
237
+ if (!isElementVisible(target)) {
232
238
  data.ignoreReason = 'not-visible';
233
239
  }
234
240
  }
@@ -169,7 +169,7 @@ var getPaintMetrics = function getPaintMetrics(type) {
169
169
  return metrics;
170
170
  };
171
171
  var getVCMetrics = function getVCMetrics(interaction) {
172
- var _config$vc, _interaction$apdex;
172
+ var _config$vc, _config$vc$ssrWhiteli, _interaction$apdex;
173
173
  var config = getConfig();
174
174
  if (!(config !== null && config !== void 0 && (_config$vc = config.vc) !== null && _config$vc !== void 0 && _config$vc.enabled)) {
175
175
  return {};
@@ -177,7 +177,8 @@ var getVCMetrics = function getVCMetrics(interaction) {
177
177
  if (interaction.type !== 'page_load' && interaction.type !== 'transition') {
178
178
  return {};
179
179
  }
180
- var ssr = interaction.type === 'page_load' && config !== null && config !== void 0 && config.ssr ? {
180
+ var isSSREnabled = (config === null || config === void 0 ? void 0 : config.ssr) || (config === null || config === void 0 || (_config$vc$ssrWhiteli = config.vc.ssrWhitelist) === null || _config$vc$ssrWhiteli === void 0 ? void 0 : _config$vc$ssrWhiteli.includes(interaction.ufoName));
181
+ var ssr = interaction.type === 'page_load' && isSSREnabled ? {
181
182
  ssr: getSSRDoneTimeValue(config)
182
183
  } : null;
183
184
  postInteractionLog.setVCObserverSSRConfig(ssr);
@@ -12,6 +12,17 @@ var state = {
12
12
  waitingForFirstRender: 2,
13
13
  ignoring: 3
14
14
  };
15
+ function isElementVisible(target) {
16
+ if (!target || typeof target.checkVisibility !== 'function') {
17
+ return true;
18
+ }
19
+ var isVisible = target.checkVisibility({
20
+ contentVisibilityAuto: true,
21
+ opacityProperty: true,
22
+ visibilityProperty: true
23
+ });
24
+ return isVisible;
25
+ }
15
26
  function isInsideEditorContainer(target) {
16
27
  if (!target || typeof target.closest !== 'function') {
17
28
  return false;
@@ -248,12 +259,7 @@ export var Observers = /*#__PURE__*/function () {
248
259
  return;
249
260
  }
250
261
  if (fg('platform-ufo-invisible-element-vc-calculations')) {
251
- var isVisible = target.checkVisibility({
252
- contentVisibilityAuto: true,
253
- opacityProperty: true,
254
- visibilityProperty: true
255
- });
256
- if (!isVisible) {
262
+ if (!isElementVisible(target)) {
257
263
  data.ignoreReason = 'not-visible';
258
264
  }
259
265
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "2.8.2",
3
+ "version": "2.10.0",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",