@contentful/experiences-visual-editor-react 1.16.0 → 1.16.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/dist/index.js CHANGED
@@ -86,6 +86,9 @@ const CONTENTFUL_COMPONENTS$1 = {
86
86
  name: 'Divider',
87
87
  },
88
88
  };
89
+ const ASSEMBLY_NODE_TYPE$1 = 'assembly';
90
+ const ASSEMBLY_DEFAULT_CATEGORY$1 = 'Assemblies';
91
+ const ASSEMBLY_BLOCK_NODE_TYPE$1 = 'assemblyBlock';
89
92
  const EMPTY_CONTAINER_HEIGHT$1 = '80px';
90
93
  const DEFAULT_IMAGE_WIDTH = '500px';
91
94
  var PostMessageMethods$2;
@@ -101,10 +104,15 @@ const structureComponentIds = new Set([
101
104
  CONTENTFUL_COMPONENTS$1.container.id,
102
105
  CONTENTFUL_COMPONENTS$1.singleColumn.id,
103
106
  ]);
107
+ const patternTypes = new Set([ASSEMBLY_NODE_TYPE$1, ASSEMBLY_BLOCK_NODE_TYPE$1]);
104
108
  const allContentfulComponentIds = new Set(Object.values(CONTENTFUL_COMPONENTS$1).map((component) => component.id));
109
+ const isPatternComponent = (type) => patternTypes.has(type ?? '');
105
110
  const isContentfulStructureComponent = (componentId) => structureComponentIds.has(componentId ?? '');
106
111
  const isContentfulComponent = (componentId) => allContentfulComponentIds.has(componentId ?? '');
107
- const isComponentAllowedOnRoot = (componentId) => isContentfulStructureComponent(componentId) || componentId === CONTENTFUL_COMPONENTS$1.divider.id;
112
+ const isComponentAllowedOnRoot = ({ type, category, componentId }) => isPatternComponent(type) ||
113
+ category === ASSEMBLY_DEFAULT_CATEGORY$1 ||
114
+ isContentfulStructureComponent(componentId) ||
115
+ componentId === CONTENTFUL_COMPONENTS$1.divider.id;
108
116
  const isStructureWithRelativeHeight = (componentId, height) => {
109
117
  return isContentfulStructureComponent(componentId) && !height?.toString().endsWith('px');
110
118
  };
@@ -4913,7 +4921,8 @@ function Dropzone({ node, zoneId, resolveDesignValue, className, WrapperComponen
4913
4921
  return false;
4914
4922
  }
4915
4923
  // Enable dropzone for the non-root hovered zones if component is not allowed on root
4916
- if (!isDraggingNewComponent && !isComponentAllowedOnRoot(draggedNode?.data.blockId)) {
4924
+ if (!isDraggingNewComponent &&
4925
+ !isComponentAllowedOnRoot({ type: draggedNode?.type, componentId: draggedNode?.data.blockId })) {
4917
4926
  return isHoveringZone && !isRootZone;
4918
4927
  }
4919
4928
  // Enable dropzone for the hovered zone only