@contentful/experiences-core 1.17.0-prerelease-20240925T1858-dad785c.0 → 1.17.1-beta.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/README.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # @contentful/experiences-core
2
2
 
3
+ ## Private Package Notice
4
+
5
+ *Note*: This package is not meant to be used directly by the end user. It is a dependency for the Studio Experiences packages. Changes to this package are not guaranteed to follow semantic versioning and may break without notice if used directly.
6
+
3
7
  ### Purpose
8
+
4
9
  - To contain shared code and utilities across the Experiences packages such as constants, types, transformers, and hooks.
5
10
  - This means additions to core should be framework agnostic. For example, code that is only compatible with React does not belong in the core package.
6
11
 
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 { deserializePatternVariables } from './utils/patternUtils.js';
15
+ export { sanitizeNodeProps } from './utils/sanitizeNodeProps.js';
15
16
  export { columnsDefinition, containerDefinition, dividerDefinition, sectionDefinition, singleColumnDefinition } from './definitions/components.js';
16
17
  export { builtInStyles, columnsBuiltInStyles, containerBuiltInStyles, dividerBuiltInStyles, optionalBuiltInStyles, sectionBuiltInStyles, singleColumnBuiltInStyles } from './definitions/styles.js';
17
18
  export { EditorModeEntityStore } from './entity/EditorModeEntityStore.js';
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import md5 from 'md5';
2
2
  import { z, ZodIssueCode } from 'zod';
3
3
  import { BLOCKS } from '@contentful/rich-text-types';
4
- import { isArray, uniqBy } from 'lodash-es';
4
+ import { isArray, omit, uniqBy } from 'lodash-es';
5
5
 
6
6
  const INCOMING_EVENTS = {
7
7
  RequestEditorMode: 'requestEditorMode',
@@ -786,7 +786,7 @@ const dividerBuiltInStyles = {
786
786
  type: 'Text',
787
787
  group: 'style',
788
788
  description: 'The height of the divider',
789
- defaultValue: '2px',
789
+ defaultValue: '1px',
790
790
  },
791
791
  cfMaxWidth: {
792
792
  displayName: 'Max width',
@@ -800,7 +800,7 @@ const dividerBuiltInStyles = {
800
800
  type: 'Text',
801
801
  group: 'style',
802
802
  description: 'The background color of the divider',
803
- defaultValue: 'rgba(0, 0, 0, 0)',
803
+ defaultValue: 'rgba(204, 204, 204, 1)',
804
804
  },
805
805
  };
806
806
  const singleColumnBuiltInStyles = {
@@ -2200,7 +2200,7 @@ const transformMedia = (asset, variables, resolveDesignValue, variableName, path
2200
2200
  return;
2201
2201
  }
2202
2202
  if (variableName === 'cfBackgroundImageUrl') {
2203
- const width = resolveDesignValue(variables['cfWidth']?.type === 'DesignValue' ? variables['cfWidth'].valuesByBreakpoint : {}, 'cfWidth');
2203
+ const width = resolveDesignValue(variables['cfWidth']?.type === 'DesignValue' ? variables['cfWidth'].valuesByBreakpoint : {}, 'cfWidth') || '100%';
2204
2204
  const optionsVariableName = 'cfBackgroundImageOptions';
2205
2205
  const options = resolveDesignValue(variables[optionsVariableName]?.type === 'DesignValue'
2206
2206
  ? variables[optionsVariableName].valuesByBreakpoint
@@ -2723,6 +2723,13 @@ const deserializePatternVariables = ({ nodeVariables, componentInstanceProps, co
2723
2723
  return { childNodeVariable, dataSource, unboundValues };
2724
2724
  };
2725
2725
 
2726
+ const stylesToKeep = ['cfImageAsset'];
2727
+ const stylesToRemove = CF_STYLE_ATTRIBUTES.filter((style) => !stylesToKeep.includes(style));
2728
+ const propsToRemove = ['cfHyperlink', 'cfOpenInNewTab', 'cfSsrClassName'];
2729
+ const sanitizeNodeProps = (nodeProps) => {
2730
+ return omit(nodeProps, stylesToRemove, propsToRemove);
2731
+ };
2732
+
2726
2733
  const sendMessage = (eventType, data) => {
2727
2734
  if (typeof window === 'undefined') {
2728
2735
  return;
@@ -3656,5 +3663,5 @@ async function fetchById({ client, experienceTypeId, id, localeCode, }) {
3656
3663
  }
3657
3664
  }
3658
3665
 
3659
- export { DeepReference, EditorModeEntityStore, EntityStore, EntityStoreBase, MEDIA_QUERY_REGEXP, VisualEditorMode, addLocale, breakpointsRegistry, buildCfStyles, buildStyleTag, buildTemplate, builtInStyles, calculateNodeDefaultHeight, checkIsAssembly, checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, columnsBuiltInStyles, columnsDefinition, containerBuiltInStyles, containerDefinition, createExperience, defineBreakpoints, defineDesignTokens, deserializePatternVariables, designTokensRegistry, detachExperienceStyles, dividerBuiltInStyles, dividerDefinition, doesMismatchMessageSchema, fetchAllAssets, fetchAllEntries, fetchById, fetchBySlug, findOutermostCoordinates, flattenDesignTokenRegistry, gatherDeepReferencesFromExperienceEntry, gatherDeepReferencesFromTree, generateRandomId, getActiveBreakpointIndex, getBreakpointRegistration, getDataFromTree, getDesignTokenRegistration, getElementCoordinates, getFallbackBreakpointIndex, getInsertionData, getTemplateValue, getValueForBreakpoint, indexByBreakpoint, isCfStyleAttribute, isComponentAllowedOnRoot, isContentfulComponent, isContentfulStructureComponent, isDeepPath, isExperienceEntry, isLink, isLinkToAsset, isPatternComponent, isStructureWithRelativeHeight, isValidBreakpointValue, lastPathNamedSegmentEq, maybePopulateDesignTokenValue, mediaQueryMatcher, optionalBuiltInStyles, parseDataSourcePathIntoFieldset, parseDataSourcePathWithL1DeepBindings, resetBreakpointsRegistry, resetDesignTokenRegistry, resolveBackgroundImageBinding, resolveHyperlinkPattern, runBreakpointsValidation, sectionBuiltInStyles, sectionDefinition, sendMessage, singleColumnBuiltInStyles, singleColumnDefinition, toCSSAttribute, toCSSString, toMediaQuery, transformBoundContentValue, tryParseMessage, validateExperienceBuilderConfig };
3666
+ export { DeepReference, EditorModeEntityStore, EntityStore, EntityStoreBase, MEDIA_QUERY_REGEXP, VisualEditorMode, addLocale, breakpointsRegistry, buildCfStyles, buildStyleTag, buildTemplate, builtInStyles, calculateNodeDefaultHeight, checkIsAssembly, checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, columnsBuiltInStyles, columnsDefinition, containerBuiltInStyles, containerDefinition, createExperience, defineBreakpoints, defineDesignTokens, deserializePatternVariables, designTokensRegistry, detachExperienceStyles, dividerBuiltInStyles, dividerDefinition, doesMismatchMessageSchema, fetchAllAssets, fetchAllEntries, fetchById, fetchBySlug, findOutermostCoordinates, flattenDesignTokenRegistry, gatherDeepReferencesFromExperienceEntry, gatherDeepReferencesFromTree, generateRandomId, getActiveBreakpointIndex, getBreakpointRegistration, getDataFromTree, getDesignTokenRegistration, getElementCoordinates, getFallbackBreakpointIndex, getInsertionData, getTemplateValue, getValueForBreakpoint, indexByBreakpoint, isCfStyleAttribute, isComponentAllowedOnRoot, isContentfulComponent, isContentfulStructureComponent, isDeepPath, isExperienceEntry, isLink, isLinkToAsset, isPatternComponent, isStructureWithRelativeHeight, isValidBreakpointValue, lastPathNamedSegmentEq, maybePopulateDesignTokenValue, mediaQueryMatcher, optionalBuiltInStyles, parseDataSourcePathIntoFieldset, parseDataSourcePathWithL1DeepBindings, resetBreakpointsRegistry, resetDesignTokenRegistry, resolveBackgroundImageBinding, resolveHyperlinkPattern, runBreakpointsValidation, sanitizeNodeProps, sectionBuiltInStyles, sectionDefinition, sendMessage, singleColumnBuiltInStyles, singleColumnDefinition, toCSSAttribute, toCSSString, toMediaQuery, transformBoundContentValue, tryParseMessage, validateExperienceBuilderConfig };
3660
3667
  //# sourceMappingURL=index.js.map