@contentful/experiences-visual-editor-react 1.8.0 → 1.8.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/renderApp.js CHANGED
@@ -41952,8 +41952,8 @@ const INCOMING_EVENTS$1 = {
41952
41952
  UpdatedEntity: 'updatedEntity',
41953
41953
  AssembliesAdded: 'assembliesAdded',
41954
41954
  AssembliesRegistered: 'assembliesRegistered',
41955
- InitEditor: 'initEditor',
41956
41955
  MouseMove: 'mouseMove',
41956
+ RequestedEntities: 'REQUESTED_ENTITIES',
41957
41957
  };
41958
41958
  const CONTENTFUL_COMPONENTS$1 = {
41959
41959
  section: {
@@ -54268,7 +54268,6 @@ const OUTGOING_EVENTS = {
54268
54268
  Connected: 'connected',
54269
54269
  DesignTokens: 'registerDesignTokens',
54270
54270
  RegisteredBreakpoints: 'registeredBreakpoints',
54271
- HoveredSection: 'hoveredSection',
54272
54271
  MouseMove: 'mouseMove',
54273
54272
  NewHoveredElement: 'newHoveredElement',
54274
54273
  ComponentSelected: 'componentSelected',
@@ -54279,13 +54278,13 @@ const OUTGOING_EVENTS = {
54279
54278
  ComponentMoved: 'componentMoved',
54280
54279
  CanvasReload: 'canvasReload',
54281
54280
  UpdateSelectedComponentCoordinates: 'updateSelectedComponentCoordinates',
54282
- UpdateHoveredComponentCoordinates: 'updateHoveredComponentCoordinates',
54283
54281
  CanvasScroll: 'canvasScrolling',
54284
54282
  CanvasError: 'canvasError',
54285
54283
  ComponentMoveStarted: 'componentMoveStarted',
54286
54284
  ComponentMoveEnded: 'componentMoveEnded',
54287
54285
  OutsideCanvasClick: 'outsideCanvasClick',
54288
54286
  SDKFeatures: 'sdkFeatures',
54287
+ RequestEntities: 'REQUEST_ENTITIES',
54289
54288
  };
54290
54289
  const INCOMING_EVENTS = {
54291
54290
  RequestEditorMode: 'requestEditorMode',
@@ -54301,8 +54300,8 @@ const INCOMING_EVENTS = {
54301
54300
  UpdatedEntity: 'updatedEntity',
54302
54301
  AssembliesAdded: 'assembliesAdded',
54303
54302
  AssembliesRegistered: 'assembliesRegistered',
54304
- InitEditor: 'initEditor',
54305
54303
  MouseMove: 'mouseMove',
54304
+ RequestedEntities: 'REQUESTED_ENTITIES',
54306
54305
  };
54307
54306
  const INTERNAL_EVENTS = {
54308
54307
  ComponentsRegistered: 'cfComponentsRegistered',
@@ -54876,8 +54875,8 @@ const sendSelectedComponentCoordinates = (instanceId) => {
54876
54875
  selectedNodeCoordinates: getElementCoordinates(selectedElement),
54877
54876
  selectedAssemblyChildCoordinates: selectedAssemblyChild
54878
54877
  ? getElementCoordinates(selectedAssemblyChild)
54879
- : null,
54880
- parentCoordinates: parent ? getElementCoordinates(parent) : null,
54878
+ : undefined,
54879
+ parentCoordinates: parent ? getElementCoordinates(parent) : undefined,
54881
54880
  });
54882
54881
  };
54883
54882
  const childImage = selectedElement.querySelector('img');
@@ -57734,7 +57733,7 @@ function useEditorSubscriber() {
57734
57733
  // TODO: As we have disabled the useEffect, we can remove these states
57735
57734
  const [, /* isFetchingEntities */ setFetchingEntities] = reactExports.useState(false);
57736
57735
  const reloadApp = () => {
57737
- sendMessage(OUTGOING_EVENTS.CanvasReload, {});
57736
+ sendMessage(OUTGOING_EVENTS.CanvasReload, undefined);
57738
57737
  // Wait a moment to ensure that the message was sent
57739
57738
  setTimeout(() => {
57740
57739
  // Received a hot reload message from webpack dev server -> reload the canvas
@@ -57742,7 +57741,7 @@ function useEditorSubscriber() {
57742
57741
  }, 50);
57743
57742
  };
57744
57743
  reactExports.useEffect(() => {
57745
- sendMessage(OUTGOING_EVENTS.RequestComponentTreeUpdate);
57744
+ sendMessage(OUTGOING_EVENTS.RequestComponentTreeUpdate, undefined);
57746
57745
  }, []);
57747
57746
  /**
57748
57747
  * Fills up entityStore with entities from newDataSource and from the tree.
@@ -57839,10 +57838,9 @@ function useEditorSubscriber() {
57839
57838
  return;
57840
57839
  }
57841
57840
  console.debug(`[experiences-sdk-react::onMessage] Received message [${eventData.eventType}]`, eventData);
57842
- const { payload } = eventData;
57843
57841
  switch (eventData.eventType) {
57844
57842
  case INCOMING_EVENTS.ExperienceUpdated: {
57845
- const { tree, locale, changedNode, changedValueType, assemblies, } = payload;
57843
+ const { tree, locale, changedNode, changedValueType, assemblies } = eventData.payload;
57846
57844
  // Make sure to first store the assemblies before setting the tree and thus triggering a rerender
57847
57845
  if (assemblies) {
57848
57846
  setAssemblies(assemblies);
@@ -57886,7 +57884,7 @@ function useEditorSubscriber() {
57886
57884
  break;
57887
57885
  }
57888
57886
  case INCOMING_EVENTS.AssembliesRegistered: {
57889
- const { assemblies } = payload;
57887
+ const { assemblies } = eventData.payload;
57890
57888
  assemblies.forEach((definition) => {
57891
57889
  addComponentRegistration({
57892
57890
  component: Assembly,
@@ -57896,7 +57894,7 @@ function useEditorSubscriber() {
57896
57894
  break;
57897
57895
  }
57898
57896
  case INCOMING_EVENTS.AssembliesAdded: {
57899
- const { assembly, assemblyDefinition, } = payload;
57897
+ const { assembly, assemblyDefinition, } = eventData.payload;
57900
57898
  entityStore.updateEntity(assembly);
57901
57899
  // Using a Map here to avoid setting state and rerending all existing assemblies when a new assembly is added
57902
57900
  // TODO: Figure out if we can extend this love to data source and unbound values. Maybe that'll solve the blink
@@ -57913,19 +57911,19 @@ function useEditorSubscriber() {
57913
57911
  break;
57914
57912
  }
57915
57913
  case INCOMING_EVENTS.CanvasResized: {
57916
- const { selectedNodeId } = payload;
57914
+ const { selectedNodeId } = eventData.payload;
57917
57915
  if (selectedNodeId) {
57918
57916
  sendSelectedComponentCoordinates(selectedNodeId);
57919
57917
  }
57920
57918
  break;
57921
57919
  }
57922
57920
  case INCOMING_EVENTS.HoverComponent: {
57923
- const { hoveredNodeId } = payload;
57921
+ const { hoveredNodeId } = eventData.payload;
57924
57922
  setHoveredComponentId(hoveredNodeId);
57925
57923
  break;
57926
57924
  }
57927
57925
  case INCOMING_EVENTS.ComponentDraggingChanged: {
57928
- const { isDragging } = payload;
57926
+ const { isDragging } = eventData.payload;
57929
57927
  if (!isDragging) {
57930
57928
  setComponentId('');
57931
57929
  setDraggingOnCanvas(false);
@@ -57934,7 +57932,7 @@ function useEditorSubscriber() {
57934
57932
  break;
57935
57933
  }
57936
57934
  case INCOMING_EVENTS.UpdatedEntity: {
57937
- const { entity: updatedEntity, shouldRerender } = payload;
57935
+ const { entity: updatedEntity, shouldRerender } = eventData.payload;
57938
57936
  if (updatedEntity) {
57939
57937
  const storedEntity = entityStore.entities.find((entity) => entity.sys.id === updatedEntity.sys.id);
57940
57938
  const didEntityChange = storedEntity?.sys.version !== updatedEntity.sys.version;
@@ -57957,8 +57955,9 @@ function useEditorSubscriber() {
57957
57955
  break;
57958
57956
  }
57959
57957
  case INCOMING_EVENTS.ComponentDragStarted: {
57958
+ const { id } = eventData.payload;
57960
57959
  SimulateDnD$1.setupDrag();
57961
- setComponentId(payload.id || '');
57960
+ setComponentId(id || '');
57962
57961
  setDraggingOnCanvas(true);
57963
57962
  sendMessage(OUTGOING_EVENTS.ComponentSelected, {
57964
57963
  nodeId: '',
@@ -57972,13 +57971,13 @@ function useEditorSubscriber() {
57972
57971
  break;
57973
57972
  }
57974
57973
  case INCOMING_EVENTS.SelectComponent: {
57975
- const { selectedNodeId: nodeId } = payload;
57974
+ const { selectedNodeId: nodeId } = eventData.payload;
57976
57975
  setSelectedNodeId(nodeId);
57977
57976
  sendSelectedComponentCoordinates(nodeId);
57978
57977
  break;
57979
57978
  }
57980
57979
  case INCOMING_EVENTS.MouseMove: {
57981
- const { mouseX, mouseY } = payload;
57980
+ const { mouseX, mouseY } = eventData.payload;
57982
57981
  setMousePosition(mouseX, mouseY);
57983
57982
  if (SimulateDnD$1.isDraggingOnParent && !SimulateDnD$1.isDragging) {
57984
57983
  SimulateDnD$1.startDrag(mouseX, mouseY);
@@ -57989,7 +57988,7 @@ function useEditorSubscriber() {
57989
57988
  break;
57990
57989
  }
57991
57990
  case INCOMING_EVENTS.ComponentMoveEnded: {
57992
- const { mouseX, mouseY } = payload;
57991
+ const { mouseX, mouseY } = eventData.payload;
57993
57992
  SimulateDnD$1.endDrag(mouseX, mouseY);
57994
57993
  break;
57995
57994
  }
@@ -58302,7 +58301,7 @@ const DNDProvider = ({ children }) => {
58302
58301
  nodeId: '',
58303
58302
  });
58304
58303
  if (source.droppableId !== COMPONENT_LIST_ID) {
58305
- sendMessage(OUTGOING_EVENTS.ComponentMoveStarted);
58304
+ sendMessage(OUTGOING_EVENTS.ComponentMoveStarted, undefined);
58306
58305
  }
58307
58306
  };
58308
58307
  const beforeCapture = ({ draggableId }) => {
@@ -58322,7 +58321,7 @@ const DNDProvider = ({ children }) => {
58322
58321
  if (!dropResult.destination) {
58323
58322
  if (!draggedItem?.destination) {
58324
58323
  // User cancel drag
58325
- sendMessage(OUTGOING_EVENTS.ComponentDragCanceled);
58324
+ sendMessage(OUTGOING_EVENTS.ComponentDragCanceled, undefined);
58326
58325
  //select the previously selected node if drag was canceled
58327
58326
  if (prevSelectedNodeId.current) {
58328
58327
  setSelectedNodeId(prevSelectedNodeId.current);
@@ -58345,7 +58344,7 @@ const DNDProvider = ({ children }) => {
58345
58344
  }
58346
58345
  // If a node was previously selected prior to dragging, re-select it
58347
58346
  setSelectedNodeId(dropResult.draggableId);
58348
- sendMessage(OUTGOING_EVENTS.ComponentMoveEnded);
58347
+ sendMessage(OUTGOING_EVENTS.ComponentMoveEnded, undefined);
58349
58348
  sendMessage(OUTGOING_EVENTS.ComponentSelected, {
58350
58349
  nodeId: dropResult.draggableId,
58351
58350
  });
@@ -58381,7 +58380,7 @@ const RootRenderer = ({ onChange }) => {
58381
58380
  outsideCanvasClick: true,
58382
58381
  });
58383
58382
  sendMessage(OUTGOING_EVENTS.ComponentSelected, {
58384
- selectedId: '',
58383
+ nodeId: '',
58385
58384
  });
58386
58385
  setSelectedNodeId('');
58387
58386
  }, [setSelectedNodeId]);