@contentful/experiences-visual-editor-react 1.39.0-dev-20250528T1423-593ccdb.0 → 1.39.0-dev-20250603T0757-ecbd0d2.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/dist/renderApp.js CHANGED
@@ -43702,6 +43702,32 @@ propertyName, resolveDesignTokens = true) => {
43702
43702
  };
43703
43703
 
43704
43704
  const CF_DEBUG_KEY$1 = 'cf_debug';
43705
+ /**
43706
+ * To ensure that the localStorage API can be used safely, we check
43707
+ * for availability (e.g. undefined in Node.js). Additionally, we
43708
+ * check if the localStorage can be used as some browsers throw a
43709
+ * SecurityError (e.g. Brave or Chromium with specific settings).
43710
+ */
43711
+ const checkLocalStorageAvailability$1 = () => {
43712
+ if (typeof localStorage === 'undefined' || localStorage === null) {
43713
+ return false;
43714
+ }
43715
+ try {
43716
+ // Attempt to set and remove an item to check if localStorage is enabled
43717
+ const TEST_KEY = 'cf_test_local_storage';
43718
+ localStorage.setItem(TEST_KEY, 'yes');
43719
+ if (localStorage.getItem(TEST_KEY) === 'yes') {
43720
+ localStorage.removeItem(TEST_KEY);
43721
+ return true;
43722
+ }
43723
+ else {
43724
+ return false;
43725
+ }
43726
+ }
43727
+ catch (_error) {
43728
+ return false;
43729
+ }
43730
+ };
43705
43731
  let DebugLogger$1 = class DebugLogger {
43706
43732
  constructor() {
43707
43733
  // Public methods for logging
@@ -43709,7 +43735,7 @@ let DebugLogger$1 = class DebugLogger {
43709
43735
  this.warn = this.logger('warn');
43710
43736
  this.log = this.logger('log');
43711
43737
  this.debug = this.logger('debug');
43712
- if (typeof localStorage === 'undefined') {
43738
+ if (!checkLocalStorageAvailability$1()) {
43713
43739
  this.enabled = false;
43714
43740
  return;
43715
43741
  }
@@ -58677,6 +58703,32 @@ var CodeNames;
58677
58703
  })(CodeNames || (CodeNames = {}));
58678
58704
 
58679
58705
  const CF_DEBUG_KEY = 'cf_debug';
58706
+ /**
58707
+ * To ensure that the localStorage API can be used safely, we check
58708
+ * for availability (e.g. undefined in Node.js). Additionally, we
58709
+ * check if the localStorage can be used as some browsers throw a
58710
+ * SecurityError (e.g. Brave or Chromium with specific settings).
58711
+ */
58712
+ const checkLocalStorageAvailability = () => {
58713
+ if (typeof localStorage === 'undefined' || localStorage === null) {
58714
+ return false;
58715
+ }
58716
+ try {
58717
+ // Attempt to set and remove an item to check if localStorage is enabled
58718
+ const TEST_KEY = 'cf_test_local_storage';
58719
+ localStorage.setItem(TEST_KEY, 'yes');
58720
+ if (localStorage.getItem(TEST_KEY) === 'yes') {
58721
+ localStorage.removeItem(TEST_KEY);
58722
+ return true;
58723
+ }
58724
+ else {
58725
+ return false;
58726
+ }
58727
+ }
58728
+ catch (_error) {
58729
+ return false;
58730
+ }
58731
+ };
58680
58732
  class DebugLogger {
58681
58733
  constructor() {
58682
58734
  // Public methods for logging
@@ -58684,7 +58736,7 @@ class DebugLogger {
58684
58736
  this.warn = this.logger('warn');
58685
58737
  this.log = this.logger('log');
58686
58738
  this.debug = this.logger('debug');
58687
- if (typeof localStorage === 'undefined') {
58739
+ if (!checkLocalStorageAvailability()) {
58688
58740
  this.enabled = false;
58689
58741
  return;
58690
58742
  }