@contentful/experiences-core 1.16.1-dev-20240923T1453-d839e4d.0 → 1.16.1-dev-20240925T1613-f291cf8.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 CHANGED
@@ -1,4 +1,4 @@
1
- export { isComponentAllowedOnRoot, isContentfulComponent, isContentfulStructureComponent, isStructureWithRelativeHeight } from './utils/components.js';
1
+ export { isComponentAllowedOnRoot, isContentfulComponent, isContentfulStructureComponent, isPatternComponent, isStructureWithRelativeHeight } from './utils/components.js';
2
2
  export { findOutermostCoordinates, getElementCoordinates } from './utils/domValues.js';
3
3
  export { doesMismatchMessageSchema, tryParseMessage, validateExperienceBuilderConfig } from './utils/validations.js';
4
4
  export { buildCfStyles, buildStyleTag, calculateNodeDefaultHeight, toCSSAttribute } from './utils/styleUtils/stylesUtils.js';
package/dist/index.js CHANGED
@@ -76,7 +76,9 @@ const CONTENTFUL_COMPONENTS = {
76
76
  name: 'Divider',
77
77
  },
78
78
  };
79
+ const ASSEMBLY_NODE_TYPE = 'assembly';
79
80
  const ASSEMBLY_DEFAULT_CATEGORY = 'Assemblies';
81
+ const ASSEMBLY_BLOCK_NODE_TYPE = 'assemblyBlock';
80
82
  const CF_STYLE_ATTRIBUTES = [
81
83
  'cfVisibility',
82
84
  'cfHorizontalAlignment',
@@ -130,10 +132,15 @@ const structureComponentIds = new Set([
130
132
  CONTENTFUL_COMPONENTS.container.id,
131
133
  CONTENTFUL_COMPONENTS.singleColumn.id,
132
134
  ]);
135
+ const patternTypes = new Set([ASSEMBLY_NODE_TYPE, ASSEMBLY_BLOCK_NODE_TYPE]);
133
136
  const allContentfulComponentIds = new Set(Object.values(CONTENTFUL_COMPONENTS).map((component) => component.id));
137
+ const isPatternComponent = (type) => patternTypes.has(type ?? '');
134
138
  const isContentfulStructureComponent = (componentId) => structureComponentIds.has(componentId ?? '');
135
139
  const isContentfulComponent = (componentId) => allContentfulComponentIds.has(componentId ?? '');
136
- const isComponentAllowedOnRoot = (componentId) => isContentfulStructureComponent(componentId) || componentId === CONTENTFUL_COMPONENTS.divider.id;
140
+ const isComponentAllowedOnRoot = ({ type, category, componentId }) => isPatternComponent(type) ||
141
+ category === ASSEMBLY_DEFAULT_CATEGORY ||
142
+ isContentfulStructureComponent(componentId) ||
143
+ componentId === CONTENTFUL_COMPONENTS.divider.id;
137
144
  const isStructureWithRelativeHeight = (componentId, height) => {
138
145
  return isContentfulStructureComponent(componentId) && !height?.toString().endsWith('px');
139
146
  };
@@ -3649,5 +3656,5 @@ async function fetchById({ client, experienceTypeId, id, localeCode, }) {
3649
3656
  }
3650
3657
  }
3651
3658
 
3652
- 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, isStructureWithRelativeHeight, isValidBreakpointValue, lastPathNamedSegmentEq, maybePopulateDesignTokenValue, mediaQueryMatcher, optionalBuiltInStyles, parseDataSourcePathIntoFieldset, parseDataSourcePathWithL1DeepBindings, resetBreakpointsRegistry, resetDesignTokenRegistry, resolveBackgroundImageBinding, resolveHyperlinkPattern, runBreakpointsValidation, sectionBuiltInStyles, sectionDefinition, sendMessage, singleColumnBuiltInStyles, singleColumnDefinition, toCSSAttribute, toCSSString, toMediaQuery, transformBoundContentValue, tryParseMessage, validateExperienceBuilderConfig };
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 };
3653
3660
  //# sourceMappingURL=index.js.map