@contentful/experiences-core 1.34.1-dev-20250305T1755-8013879.0 → 1.35.0-dev-20250306T1427-f5acfab.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.d.ts +1 -0
- package/dist/index.js +57 -1
- package/dist/index.js.map +1 -1
- package/dist/utils/debugLogger.d.ts +30 -0
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export { isLink } from './utils/isLink.js';
|
|
|
12
12
|
export { Fieldset, UnresolvedFieldset, isDeepPath, lastPathNamedSegmentEq, parseDataSourcePathIntoFieldset, parseDataSourcePathWithL1DeepBindings } from './utils/pathSchema.js';
|
|
13
13
|
export { addLocale, buildTemplate, getTemplateValue, resolveHyperlinkPattern } from './utils/resolveHyperlinkPattern.js';
|
|
14
14
|
export { sanitizeNodeProps } from './utils/sanitizeNodeProps.js';
|
|
15
|
+
export { DebugLogger, debug, disableDebug, enableDebug } from './utils/debugLogger.js';
|
|
15
16
|
export { builtInStyles, columnsBuiltInStyles, containerBuiltInStyles, dividerBuiltInStyles, optionalBuiltInStyles, sectionBuiltInStyles, singleColumnBuiltInStyles } from './definitions/styles.js';
|
|
16
17
|
export { EditorModeEntityStore } from './entity/EditorModeEntityStore.js';
|
|
17
18
|
export { EntityStore } from './entity/EntityStore.js';
|
package/dist/index.js
CHANGED
|
@@ -2879,6 +2879,62 @@ const sanitizeNodeProps = (nodeProps) => {
|
|
|
2879
2879
|
return omit(nodeProps, stylesToRemove, propsToRemove);
|
|
2880
2880
|
};
|
|
2881
2881
|
|
|
2882
|
+
const CF_DEBUG_KEY = 'cf_debug';
|
|
2883
|
+
class DebugLogger {
|
|
2884
|
+
constructor() {
|
|
2885
|
+
// Public methods for logging
|
|
2886
|
+
this.error = this.logger('error');
|
|
2887
|
+
this.warn = this.logger('warn');
|
|
2888
|
+
this.log = this.logger('log');
|
|
2889
|
+
this.debug = this.logger('debug');
|
|
2890
|
+
if (typeof localStorage === 'undefined') {
|
|
2891
|
+
this.enabled = false;
|
|
2892
|
+
return;
|
|
2893
|
+
}
|
|
2894
|
+
// Default to checking localStorage for the debug mode on initialization if in browser
|
|
2895
|
+
this.enabled = localStorage.getItem(CF_DEBUG_KEY) === 'true';
|
|
2896
|
+
}
|
|
2897
|
+
static getInstance() {
|
|
2898
|
+
if (this.instance === null) {
|
|
2899
|
+
this.instance = new DebugLogger();
|
|
2900
|
+
}
|
|
2901
|
+
return this.instance;
|
|
2902
|
+
}
|
|
2903
|
+
getEnabled() {
|
|
2904
|
+
return this.enabled;
|
|
2905
|
+
}
|
|
2906
|
+
setEnabled(enabled) {
|
|
2907
|
+
this.enabled = enabled;
|
|
2908
|
+
if (typeof localStorage === 'undefined') {
|
|
2909
|
+
return;
|
|
2910
|
+
}
|
|
2911
|
+
if (enabled) {
|
|
2912
|
+
localStorage.setItem(CF_DEBUG_KEY, 'true');
|
|
2913
|
+
}
|
|
2914
|
+
else {
|
|
2915
|
+
localStorage.removeItem(CF_DEBUG_KEY);
|
|
2916
|
+
}
|
|
2917
|
+
}
|
|
2918
|
+
// Log method for different levels (error, warn, log)
|
|
2919
|
+
logger(level) {
|
|
2920
|
+
return (...args) => {
|
|
2921
|
+
if (this.enabled) {
|
|
2922
|
+
console[level]('[cf-experiences-sdk]', ...args);
|
|
2923
|
+
}
|
|
2924
|
+
};
|
|
2925
|
+
}
|
|
2926
|
+
}
|
|
2927
|
+
DebugLogger.instance = null;
|
|
2928
|
+
const debug = DebugLogger.getInstance();
|
|
2929
|
+
const enableDebug = () => {
|
|
2930
|
+
debug.setEnabled(true);
|
|
2931
|
+
console.log('Debug mode enabled');
|
|
2932
|
+
};
|
|
2933
|
+
const disableDebug = () => {
|
|
2934
|
+
debug.setEnabled(false);
|
|
2935
|
+
console.log('Debug mode disabled');
|
|
2936
|
+
};
|
|
2937
|
+
|
|
2882
2938
|
const sendMessage = (eventType, data) => {
|
|
2883
2939
|
if (typeof window === 'undefined') {
|
|
2884
2940
|
return;
|
|
@@ -3907,5 +3963,5 @@ async function fetchById({ client, experienceTypeId, id, localeCode, isEditorMod
|
|
|
3907
3963
|
}
|
|
3908
3964
|
}
|
|
3909
3965
|
|
|
3910
|
-
export { DeepReference, EditorModeEntityStore, EntityStore, EntityStoreBase, MEDIA_QUERY_REGEXP, VisualEditorMode, addLocale, addMinHeightForEmptyStructures, breakpointsRegistry, buildCfStyles, buildStyleTag, buildTemplate, builtInStyles, calculateNodeDefaultHeight, checkIsAssembly, checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, columnsBuiltInStyles, containerBuiltInStyles, createExperience, defineBreakpoints, defineDesignTokens, designTokensRegistry, detachExperienceStyles, dividerBuiltInStyles, doesMismatchMessageSchema, fetchAllAssets, fetchAllEntries, fetchById, fetchBySlug, findOutermostCoordinates, flattenDesignTokenRegistry, gatherDeepReferencesFromExperienceEntry, gatherDeepReferencesFromTree, generateRandomId, getActiveBreakpointIndex, getBreakpointRegistration, getDataFromTree, getDesignTokenRegistration, getElementCoordinates, getFallbackBreakpointIndex, getInsertionData, getTargetValueInPixels, getTemplateValue, getValueForBreakpoint, indexByBreakpoint, isCfStyleAttribute, isComponentAllowedOnRoot, isContentfulComponent, isContentfulStructureComponent, isDeepPath, isExperienceEntry, isLink, isLinkToAsset, isPatternComponent, isStructureWithRelativeHeight, isValidBreakpointValue, lastPathNamedSegmentEq, maybePopulateDesignTokenValue, mediaQueryMatcher, optionalBuiltInStyles, parseCSSValue, parseDataSourcePathIntoFieldset, parseDataSourcePathWithL1DeepBindings, resetBreakpointsRegistry, resetDesignTokenRegistry, resolveBackgroundImageBinding, resolveHyperlinkPattern, runBreakpointsValidation, sanitizeNodeProps, sectionBuiltInStyles, sendMessage, singleColumnBuiltInStyles, stringifyCssProperties, toCSSAttribute, toMediaQuery, transformBoundContentValue, tryParseMessage, validateExperienceBuilderConfig };
|
|
3966
|
+
export { DebugLogger, DeepReference, EditorModeEntityStore, EntityStore, EntityStoreBase, MEDIA_QUERY_REGEXP, VisualEditorMode, addLocale, addMinHeightForEmptyStructures, breakpointsRegistry, buildCfStyles, buildStyleTag, buildTemplate, builtInStyles, calculateNodeDefaultHeight, checkIsAssembly, checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, columnsBuiltInStyles, containerBuiltInStyles, createExperience, debug, defineBreakpoints, defineDesignTokens, designTokensRegistry, detachExperienceStyles, disableDebug, dividerBuiltInStyles, doesMismatchMessageSchema, enableDebug, fetchAllAssets, fetchAllEntries, fetchById, fetchBySlug, findOutermostCoordinates, flattenDesignTokenRegistry, gatherDeepReferencesFromExperienceEntry, gatherDeepReferencesFromTree, generateRandomId, getActiveBreakpointIndex, getBreakpointRegistration, getDataFromTree, getDesignTokenRegistration, getElementCoordinates, getFallbackBreakpointIndex, getInsertionData, getTargetValueInPixels, getTemplateValue, getValueForBreakpoint, indexByBreakpoint, isCfStyleAttribute, isComponentAllowedOnRoot, isContentfulComponent, isContentfulStructureComponent, isDeepPath, isExperienceEntry, isLink, isLinkToAsset, isPatternComponent, isStructureWithRelativeHeight, isValidBreakpointValue, lastPathNamedSegmentEq, maybePopulateDesignTokenValue, mediaQueryMatcher, optionalBuiltInStyles, parseCSSValue, parseDataSourcePathIntoFieldset, parseDataSourcePathWithL1DeepBindings, resetBreakpointsRegistry, resetDesignTokenRegistry, resolveBackgroundImageBinding, resolveHyperlinkPattern, runBreakpointsValidation, sanitizeNodeProps, sectionBuiltInStyles, sendMessage, singleColumnBuiltInStyles, stringifyCssProperties, toCSSAttribute, toMediaQuery, transformBoundContentValue, tryParseMessage, validateExperienceBuilderConfig };
|
|
3911
3967
|
//# sourceMappingURL=index.js.map
|