@contentful/experiences-visual-editor-react 1.0.5-dev-20240416T0806-7c9ef4f.0 → 1.0.6-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/renderApp.js CHANGED
@@ -51673,6 +51673,23 @@ const resolveAssembly = ({ node, entityStore, }) => {
51673
51673
  return deserializedNode;
51674
51674
  };
51675
51675
 
51676
+ class ImportedComponentError extends Error {
51677
+ constructor(message) {
51678
+ super(message);
51679
+ this.name = 'ImportedComponentError';
51680
+ }
51681
+ }
51682
+ class ImportedComponentErrorBoundary extends React.Component {
51683
+ componentDidCatch(error, _errorInfo) {
51684
+ const err = new ImportedComponentError(error.message);
51685
+ err.stack = error.stack;
51686
+ throw err;
51687
+ }
51688
+ render() {
51689
+ return this.props.children;
51690
+ }
51691
+ }
51692
+
51676
51693
  const useComponent = ({ node: rawNode, resolveDesignValue, renderDropzone, userIsDragging, }) => {
51677
51694
  const areEntitiesFetched = useEntityStore((state) => state.areEntitiesFetched);
51678
51695
  const entityStore = useEntityStore((state) => state.entityStore);
@@ -51714,7 +51731,7 @@ const useComponent = ({ node: rawNode, resolveDesignValue, renderDropzone, userI
51714
51731
  : node.type === ASSEMBLY_NODE_TYPE
51715
51732
  ? // Assembly.tsx requires renderDropzone and editorMode as well
51716
51733
  () => React.createElement(componentRegistration.component, componentProps)
51717
- : () => React.createElement(componentRegistration.component, otherComponentProps);
51734
+ : () => React.createElement(ImportedComponentErrorBoundary, null, React.createElement(componentRegistration.component, otherComponentProps));
51718
51735
  return {
51719
51736
  node,
51720
51737
  componentId,
@@ -54143,8 +54160,6 @@ const RootRenderer = ({ onChange }) => {
54143
54160
  const userIsDragging = useDraggedItemStore((state) => state.isDraggingOnCanvas);
54144
54161
  const breakpoints = useTreeStore((state) => state.breakpoints);
54145
54162
  const setSelectedNodeId = useEditorStore((state) => state.setSelectedNodeId);
54146
- const draggableSourceId = useDraggedItemStore((state) => state.draggedItem?.source.droppableId);
54147
- const draggingNewComponent = !!draggableSourceId?.startsWith(COMPONENT_LIST_ID);
54148
54163
  const containerRef = reactExports.useRef(null);
54149
54164
  const { resolveDesignValue } = useBreakpoints(breakpoints);
54150
54165
  const [containerStyles, setContainerStyles] = reactExports.useState({});
@@ -54210,9 +54225,9 @@ const RootRenderer = ({ onChange }) => {
54210
54225
  return (React.createElement(DNDProvider, null,
54211
54226
  dragItem && React.createElement(DraggableContainer, { id: dragItem }),
54212
54227
  React.createElement("div", { "data-ctfl-root": true, className: styles.container, ref: containerRef, style: containerStyles },
54213
- userIsDragging && draggingNewComponent && (React.createElement("div", { className: styles.hitbox, "data-ctfl-zone-id": ROOT_ID })),
54228
+ userIsDragging && React.createElement("div", { "data-ctfl-zone-id": ROOT_ID, className: styles.hitbox }),
54214
54229
  React.createElement(Dropzone, { zoneId: ROOT_ID, resolveDesignValue: resolveDesignValue }),
54215
- userIsDragging && draggingNewComponent && (React.createElement("div", { "data-ctfl-zone-id": ROOT_ID, className: styles.hitboxLower }))),
54230
+ userIsDragging && React.createElement("div", { "data-ctfl-zone-id": ROOT_ID, className: styles.hitboxLower })),
54216
54231
  React.createElement("div", { "data-ctfl-hitboxes": true })));
54217
54232
  };
54218
54233