@atlaskit/react-ufo 2.9.0 → 2.11.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.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#103452](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/103452)
8
+ [`4bd40c1e5fb42`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4bd40c1e5fb42) -
9
+ Replaced feature gate for editor lazy node view with config option
10
+
11
+ ## 2.10.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [#103488](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/103488)
16
+ [`1081d09eb1d4b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1081d09eb1d4b) -
17
+ Add API to support SSR whitelist for NIN
18
+
3
19
  ## 2.9.0
4
20
 
5
21
  ### Minor Changes
@@ -15,6 +15,7 @@ exports.getRemovePageSegmentsUFOPrefixes = getRemovePageSegmentsUFOPrefixes;
15
15
  exports.getTypingPerformanceTracingMethod = getTypingPerformanceTracingMethod;
16
16
  exports.getUfoNameOverrides = getUfoNameOverrides;
17
17
  exports.setUFOConfig = setUFOConfig;
18
+ exports.shouldHandleEditorLnv = shouldHandleEditorLnv;
18
19
  var config;
19
20
 
20
21
  // Defensively typed, since this is directly user-editable
@@ -241,4 +242,12 @@ function getDoNotAbortActivePressInteractionOnTransition() {
241
242
  } catch (e) {
242
243
  return undefined;
243
244
  }
245
+ }
246
+ function shouldHandleEditorLnv() {
247
+ try {
248
+ var _config$enableEditorL, _config11;
249
+ return (_config$enableEditorL = (_config11 = config) === null || _config11 === void 0 ? void 0 : _config11.enableEditorLnvHandler) !== null && _config$enableEditorL !== void 0 ? _config$enableEditorL : false;
250
+ } catch (e) {
251
+ return false;
252
+ }
244
253
  }
@@ -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);
@@ -9,6 +9,7 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
9
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
+ var _config = require("../../../config");
12
13
  var _vcUtils = require("../media-wrapper/vc-utils");
13
14
  var _editorLnv = require("./editor-lnv");
14
15
  var _ssrPlaceholders = require("./ssr-placeholders");
@@ -140,6 +141,7 @@ var Observers = exports.Observers = /*#__PURE__*/function () {
140
141
  key: "getMutationObserver",
141
142
  value: function getMutationObserver() {
142
143
  var _this2 = this;
144
+ var shouldHandleEditorLnvLocal = (0, _config.shouldHandleEditorLnv)();
143
145
  return this.isBrowserSupported() ? new MutationObserver(function (mutations) {
144
146
  _this2.measureStart();
145
147
  mutations.forEach(function (mutation) {
@@ -185,7 +187,7 @@ var Observers = exports.Observers = /*#__PURE__*/function () {
185
187
  });
186
188
  return;
187
189
  }
188
- if ((0, _platformFeatureFlags.fg)('platform_editor_ed-25557_lnv_add_ssr_placeholder')) {
190
+ if (shouldHandleEditorLnvLocal) {
189
191
  if (_this2.editorLnvHandler.shouldHandleAddedNode(node)) {
190
192
  _this2.editorLnvHandler.handleAddedNode(node).then(function (_ref) {
191
193
  var shouldIgnore = _ref.shouldIgnore;
@@ -234,4 +234,12 @@ export function getDoNotAbortActivePressInteractionOnTransition() {
234
234
  } catch (e) {
235
235
  return undefined;
236
236
  }
237
+ }
238
+ export function shouldHandleEditorLnv() {
239
+ try {
240
+ var _config$enableEditorL, _config;
241
+ return (_config$enableEditorL = (_config = config) === null || _config === void 0 ? void 0 : _config.enableEditorLnvHandler) !== null && _config$enableEditorL !== void 0 ? _config$enableEditorL : false;
242
+ } catch (e) {
243
+ return false;
244
+ }
237
245
  }
@@ -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);
@@ -1,5 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { fg } from '@atlaskit/platform-feature-flags';
3
+ import { shouldHandleEditorLnv } from '../../../config';
3
4
  import { isContainedWithinMediaWrapper } from '../media-wrapper/vc-utils';
4
5
  import { EditorLnvHandler } from './editor-lnv';
5
6
  import { SSRPlaceholderHandlers } from './ssr-placeholders';
@@ -111,6 +112,7 @@ export class Observers {
111
112
  this.ssr.renderStop = stopTime;
112
113
  }
113
114
  getMutationObserver() {
115
+ const shouldHandleEditorLnvLocal = shouldHandleEditorLnv();
114
116
  return this.isBrowserSupported() ? new MutationObserver(mutations => {
115
117
  this.measureStart();
116
118
  mutations.forEach(mutation => {
@@ -156,7 +158,7 @@ export class Observers {
156
158
  });
157
159
  return;
158
160
  }
159
- if (fg('platform_editor_ed-25557_lnv_add_ssr_placeholder')) {
161
+ if (shouldHandleEditorLnvLocal) {
160
162
  if (this.editorLnvHandler.shouldHandleAddedNode(node)) {
161
163
  this.editorLnvHandler.handleAddedNode(node).then(({
162
164
  shouldIgnore
@@ -224,4 +224,12 @@ export function getDoNotAbortActivePressInteractionOnTransition() {
224
224
  } catch (e) {
225
225
  return undefined;
226
226
  }
227
+ }
228
+ export function shouldHandleEditorLnv() {
229
+ try {
230
+ var _config$enableEditorL, _config11;
231
+ return (_config$enableEditorL = (_config11 = config) === null || _config11 === void 0 ? void 0 : _config11.enableEditorLnvHandler) !== null && _config$enableEditorL !== void 0 ? _config$enableEditorL : false;
232
+ } catch (e) {
233
+ return false;
234
+ }
227
235
  }
@@ -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);
@@ -4,6 +4,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
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; }
5
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; }
6
6
  import { fg } from '@atlaskit/platform-feature-flags';
7
+ import { shouldHandleEditorLnv } from '../../../config';
7
8
  import { isContainedWithinMediaWrapper } from '../media-wrapper/vc-utils';
8
9
  import { EditorLnvHandler } from './editor-lnv';
9
10
  import { SSRPlaceholderHandlers } from './ssr-placeholders';
@@ -133,6 +134,7 @@ export var Observers = /*#__PURE__*/function () {
133
134
  key: "getMutationObserver",
134
135
  value: function getMutationObserver() {
135
136
  var _this2 = this;
137
+ var shouldHandleEditorLnvLocal = shouldHandleEditorLnv();
136
138
  return this.isBrowserSupported() ? new MutationObserver(function (mutations) {
137
139
  _this2.measureStart();
138
140
  mutations.forEach(function (mutation) {
@@ -178,7 +180,7 @@ export var Observers = /*#__PURE__*/function () {
178
180
  });
179
181
  return;
180
182
  }
181
- if (fg('platform_editor_ed-25557_lnv_add_ssr_placeholder')) {
183
+ if (shouldHandleEditorLnvLocal) {
182
184
  if (_this2.editorLnvHandler.shouldHandleAddedNode(node)) {
183
185
  _this2.editorLnvHandler.handleAddedNode(node).then(function (_ref) {
184
186
  var shouldIgnore = _ref.shouldIgnore;
@@ -78,6 +78,7 @@ export type Config = {
78
78
  readonly shouldCalculateLighthouseMetricsFromTTAI?: boolean;
79
79
  readonly timeWindowForLateMutationsInMilliseconds?: number;
80
80
  readonly manuallyTrackReactProfilerMounts?: boolean;
81
+ readonly enableEditorLnvHandler?: boolean;
81
82
  /**
82
83
  * @deprecated setting this will do nothing now
83
84
  */
@@ -97,4 +98,5 @@ export declare function getRemoveInteractionsUFOPrefixes(): boolean;
97
98
  export declare function getUfoNameOverrides(): UFONameOverride | undefined;
98
99
  export declare function getDoNotAbortActivePressInteraction(): string[] | undefined;
99
100
  export declare function getDoNotAbortActivePressInteractionOnTransition(): string[] | undefined;
101
+ export declare function shouldHandleEditorLnv(): boolean;
100
102
  export {};
@@ -78,6 +78,7 @@ export type Config = {
78
78
  readonly shouldCalculateLighthouseMetricsFromTTAI?: boolean;
79
79
  readonly timeWindowForLateMutationsInMilliseconds?: number;
80
80
  readonly manuallyTrackReactProfilerMounts?: boolean;
81
+ readonly enableEditorLnvHandler?: boolean;
81
82
  /**
82
83
  * @deprecated setting this will do nothing now
83
84
  */
@@ -101,4 +102,5 @@ export declare function getRemoveInteractionsUFOPrefixes(): boolean;
101
102
  export declare function getUfoNameOverrides(): UFONameOverride | undefined;
102
103
  export declare function getDoNotAbortActivePressInteraction(): string[] | undefined;
103
104
  export declare function getDoNotAbortActivePressInteractionOnTransition(): string[] | undefined;
105
+ export declare function shouldHandleEditorLnv(): boolean;
104
106
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "2.9.0",
3
+ "version": "2.11.0",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -123,9 +123,6 @@
123
123
  }
124
124
  },
125
125
  "platform-feature-flags": {
126
- "platform_editor_ed-25557_lnv_add_ssr_placeholder": {
127
- "type": "boolean"
128
- },
129
126
  "platform_editor_ed-25937_ignore_mutations_for_ttvc": {
130
127
  "type": "boolean"
131
128
  },