@contentful/experiences-visual-editor-react 1.14.0 → 1.14.1-dev-20240911T0616-ea0d046.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
@@ -42215,13 +42215,15 @@ var PostMessageMethods$2;
42215
42215
  })(PostMessageMethods$2 || (PostMessageMethods$2 = {}));
42216
42216
  const SUPPORTED_IMAGE_FORMATS = ['jpg', 'png', 'webp', 'gif', 'avif'];
42217
42217
 
42218
- const structureComponents = new Set([
42218
+ const structureComponentIds = new Set([
42219
42219
  CONTENTFUL_COMPONENTS$1.section.id,
42220
42220
  CONTENTFUL_COMPONENTS$1.columns.id,
42221
42221
  CONTENTFUL_COMPONENTS$1.container.id,
42222
42222
  CONTENTFUL_COMPONENTS$1.singleColumn.id,
42223
42223
  ]);
42224
- const isContentfulStructureComponent = (componentId) => structureComponents.has(componentId ?? '');
42224
+ const allContentfulComponentIds = new Set(Object.values(CONTENTFUL_COMPONENTS$1).map((component) => component.id));
42225
+ const isContentfulStructureComponent = (componentId) => structureComponentIds.has(componentId ?? '');
42226
+ const isContentfulComponent = (componentId) => allContentfulComponentIds.has(componentId ?? '');
42225
42227
  const isComponentAllowedOnRoot = (componentId) => isContentfulStructureComponent(componentId) || componentId === CONTENTFUL_COMPONENTS$1.divider.id;
42226
42228
  const isStructureWithRelativeHeight = (componentId, height) => {
42227
42229
  return isContentfulStructureComponent(componentId) && !height?.toString().endsWith('px');
@@ -58218,9 +58220,25 @@ class ImportedComponentError extends Error {
58218
58220
  this.name = 'ImportedComponentError';
58219
58221
  }
58220
58222
  }
58223
+ class ExperienceSDKError extends Error {
58224
+ constructor(message) {
58225
+ super(message);
58226
+ this.name = 'ExperienceSDKError';
58227
+ }
58228
+ }
58221
58229
  class ImportedComponentErrorBoundary extends React.Component {
58222
58230
  componentDidCatch(error, _errorInfo) {
58223
- const err = new ImportedComponentError(error.message);
58231
+ if (error.name === 'ImportedComponentError' || error.name === 'ExperienceSDKError') {
58232
+ // This error was already handled by a nested error boundary and should be passed upwards
58233
+ // We have to do this as we wrap every component on every layer with this error boundary and
58234
+ // thus an error deep in the tree bubbles through many layers of error boundaries.
58235
+ throw error;
58236
+ }
58237
+ // Differentiate between custom and SDK-provided components for error tracking
58238
+ const ErrorClass = isContentfulComponent(this.props.componentId)
58239
+ ? ExperienceSDKError
58240
+ : ImportedComponentError;
58241
+ const err = new ErrorClass(error.message);
58224
58242
  err.stack = error.stack;
58225
58243
  throw err;
58226
58244
  }
@@ -58285,7 +58303,7 @@ const useComponent = ({ node: rawNode, resolveDesignValue, renderDropzone, userI
58285
58303
  const isAssembly = node.type === 'assembly';
58286
58304
  const modifiedProps = isStructureComponent || isAssembly ? componentProps : customComponentProps;
58287
58305
  const requiresDragWrapper = !isStructureComponent && componentRegistration.options?.wrapComponent === false;
58288
- const element = React.createElement(ImportedComponentErrorBoundary, null, React.createElement(componentRegistration.component, {
58306
+ const element = React.createElement(ImportedComponentErrorBoundary, { componentId: node.data.blockId }, React.createElement(componentRegistration.component, {
58289
58307
  ...modifiedProps,
58290
58308
  dragProps,
58291
58309
  }));