@contentful/experiences-visual-editor-react 1.34.1 → 1.35.0-dev-20250312T0852-985ba2e.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/index.js CHANGED
@@ -1943,6 +1943,54 @@ const sanitizeNodeProps = (nodeProps) => {
1943
1943
  return omit(nodeProps, stylesToRemove, propsToRemove);
1944
1944
  };
1945
1945
 
1946
+ const CF_DEBUG_KEY$1 = 'cf_debug';
1947
+ let DebugLogger$1 = class DebugLogger {
1948
+ constructor() {
1949
+ // Public methods for logging
1950
+ this.error = this.logger('error');
1951
+ this.warn = this.logger('warn');
1952
+ this.log = this.logger('log');
1953
+ this.debug = this.logger('debug');
1954
+ if (typeof localStorage === 'undefined') {
1955
+ this.enabled = false;
1956
+ return;
1957
+ }
1958
+ // Default to checking localStorage for the debug mode on initialization if in browser
1959
+ this.enabled = localStorage.getItem(CF_DEBUG_KEY$1) === 'true';
1960
+ }
1961
+ static getInstance() {
1962
+ if (this.instance === null) {
1963
+ this.instance = new DebugLogger();
1964
+ }
1965
+ return this.instance;
1966
+ }
1967
+ getEnabled() {
1968
+ return this.enabled;
1969
+ }
1970
+ setEnabled(enabled) {
1971
+ this.enabled = enabled;
1972
+ if (typeof localStorage === 'undefined') {
1973
+ return;
1974
+ }
1975
+ if (enabled) {
1976
+ localStorage.setItem(CF_DEBUG_KEY$1, 'true');
1977
+ }
1978
+ else {
1979
+ localStorage.removeItem(CF_DEBUG_KEY$1);
1980
+ }
1981
+ }
1982
+ // Log method for different levels (error, warn, log)
1983
+ logger(level) {
1984
+ return (...args) => {
1985
+ if (this.enabled) {
1986
+ console[level]('[cf-experiences-sdk]', ...args);
1987
+ }
1988
+ };
1989
+ }
1990
+ };
1991
+ DebugLogger$1.instance = null;
1992
+ DebugLogger$1.getInstance();
1993
+
1946
1994
  const sendMessage = (eventType, data) => {
1947
1995
  if (typeof window === 'undefined') {
1948
1996
  return;
@@ -3711,6 +3759,54 @@ var CodeNames;
3711
3759
  CodeNames["Custom"] = "custom";
3712
3760
  })(CodeNames || (CodeNames = {}));
3713
3761
 
3762
+ const CF_DEBUG_KEY = 'cf_debug';
3763
+ class DebugLogger {
3764
+ constructor() {
3765
+ // Public methods for logging
3766
+ this.error = this.logger('error');
3767
+ this.warn = this.logger('warn');
3768
+ this.log = this.logger('log');
3769
+ this.debug = this.logger('debug');
3770
+ if (typeof localStorage === 'undefined') {
3771
+ this.enabled = false;
3772
+ return;
3773
+ }
3774
+ // Default to checking localStorage for the debug mode on initialization if in browser
3775
+ this.enabled = localStorage.getItem(CF_DEBUG_KEY) === 'true';
3776
+ }
3777
+ static getInstance() {
3778
+ if (this.instance === null) {
3779
+ this.instance = new DebugLogger();
3780
+ }
3781
+ return this.instance;
3782
+ }
3783
+ getEnabled() {
3784
+ return this.enabled;
3785
+ }
3786
+ setEnabled(enabled) {
3787
+ this.enabled = enabled;
3788
+ if (typeof localStorage === 'undefined') {
3789
+ return;
3790
+ }
3791
+ if (enabled) {
3792
+ localStorage.setItem(CF_DEBUG_KEY, 'true');
3793
+ }
3794
+ else {
3795
+ localStorage.removeItem(CF_DEBUG_KEY);
3796
+ }
3797
+ }
3798
+ // Log method for different levels (error, warn, log)
3799
+ logger(level) {
3800
+ return (...args) => {
3801
+ if (this.enabled) {
3802
+ console[level]('[cf-experiences-sdk]', ...args);
3803
+ }
3804
+ };
3805
+ }
3806
+ }
3807
+ DebugLogger.instance = null;
3808
+ DebugLogger.getInstance();
3809
+
3714
3810
  var VisualEditorMode;
3715
3811
  (function (VisualEditorMode) {
3716
3812
  VisualEditorMode["LazyLoad"] = "lazyLoad";