@contentful/experiences-visual-editor-react 1.0.5 → 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/index.js CHANGED
@@ -2768,6 +2768,23 @@ const resolveAssembly = ({ node, entityStore, }) => {
2768
2768
  return deserializedNode;
2769
2769
  };
2770
2770
 
2771
+ class ImportedComponentError extends Error {
2772
+ constructor(message) {
2773
+ super(message);
2774
+ this.name = 'ImportedComponentError';
2775
+ }
2776
+ }
2777
+ class ImportedComponentErrorBoundary extends React.Component {
2778
+ componentDidCatch(error, _errorInfo) {
2779
+ const err = new ImportedComponentError(error.message);
2780
+ err.stack = error.stack;
2781
+ throw err;
2782
+ }
2783
+ render() {
2784
+ return this.props.children;
2785
+ }
2786
+ }
2787
+
2771
2788
  const useComponent = ({ node: rawNode, resolveDesignValue, renderDropzone, userIsDragging, }) => {
2772
2789
  const areEntitiesFetched = useEntityStore((state) => state.areEntitiesFetched);
2773
2790
  const entityStore = useEntityStore((state) => state.entityStore);
@@ -2809,7 +2826,7 @@ const useComponent = ({ node: rawNode, resolveDesignValue, renderDropzone, userI
2809
2826
  : node.type === ASSEMBLY_NODE_TYPE
2810
2827
  ? // Assembly.tsx requires renderDropzone and editorMode as well
2811
2828
  () => React.createElement(componentRegistration.component, componentProps)
2812
- : () => React.createElement(componentRegistration.component, otherComponentProps);
2829
+ : () => React.createElement(ImportedComponentErrorBoundary, null, React.createElement(componentRegistration.component, otherComponentProps));
2813
2830
  return {
2814
2831
  node,
2815
2832
  componentId,
@@ -4471,8 +4488,6 @@ const RootRenderer = ({ onChange }) => {
4471
4488
  const userIsDragging = useDraggedItemStore((state) => state.isDraggingOnCanvas);
4472
4489
  const breakpoints = useTreeStore((state) => state.breakpoints);
4473
4490
  const setSelectedNodeId = useEditorStore((state) => state.setSelectedNodeId);
4474
- const draggableSourceId = useDraggedItemStore((state) => state.draggedItem?.source.droppableId);
4475
- const draggingNewComponent = !!draggableSourceId?.startsWith(COMPONENT_LIST_ID);
4476
4491
  const containerRef = useRef(null);
4477
4492
  const { resolveDesignValue } = useBreakpoints(breakpoints);
4478
4493
  const [containerStyles, setContainerStyles] = useState({});
@@ -4538,9 +4553,9 @@ const RootRenderer = ({ onChange }) => {
4538
4553
  return (React.createElement(DNDProvider, null,
4539
4554
  dragItem && React.createElement(DraggableContainer, { id: dragItem }),
4540
4555
  React.createElement("div", { "data-ctfl-root": true, className: styles.container, ref: containerRef, style: containerStyles },
4541
- userIsDragging && draggingNewComponent && (React.createElement("div", { className: styles.hitbox, "data-ctfl-zone-id": ROOT_ID })),
4556
+ userIsDragging && React.createElement("div", { "data-ctfl-zone-id": ROOT_ID, className: styles.hitbox }),
4542
4557
  React.createElement(Dropzone, { zoneId: ROOT_ID, resolveDesignValue: resolveDesignValue }),
4543
- userIsDragging && draggingNewComponent && (React.createElement("div", { "data-ctfl-zone-id": ROOT_ID, className: styles.hitboxLower }))),
4558
+ userIsDragging && React.createElement("div", { "data-ctfl-zone-id": ROOT_ID, className: styles.hitboxLower })),
4544
4559
  React.createElement("div", { "data-ctfl-hitboxes": true })));
4545
4560
  };
4546
4561