@contentful/experiences-visual-editor-react 3.8.0-beta.0 → 3.8.0-beta.2

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
@@ -42140,6 +42140,16 @@ const ComponentVariableSchema$1 = z.object({
42140
42140
  });
42141
42141
  const ComponentTreeNodeSchema$1 = BaseComponentTreeNodeSchema$1.extend({
42142
42142
  children: z.lazy(() => ComponentTreeNodeSchema$1.array()),
42143
+ }).superRefine(({ id, prebindingId, parameters }, ctx) => {
42144
+ // We don't fail if parameters are present but prebindingId is not because
42145
+ // older experiences (updated before 21-09-2025) always included parameters
42146
+ // and they will start failing if we do.
42147
+ if (prebindingId && !parameters) {
42148
+ ctx.addIssue({
42149
+ code: z.ZodIssueCode.custom,
42150
+ message: `Found "prebindingId" but no "parameters" for node with id: "${id}"`,
42151
+ });
42152
+ }
42143
42153
  });
42144
42154
  const ComponentTreeSchema$1 = z
42145
42155
  .object({
@@ -42894,6 +42904,9 @@ const getPrebindingPathBySourceEntry = (preboundValueProperty, getHeadEntityByDa
42894
42904
  return undefined;
42895
42905
  }
42896
42906
  const contentTypeId = headEntity.sys.contentType.sys.id;
42907
+ if (!preboundValueProperty.pathsByContentType?.[contentTypeId]) {
42908
+ return undefined;
42909
+ }
42897
42910
  return preboundValueProperty.pathsByContentType?.[contentTypeId]?.path;
42898
42911
  };
42899
42912
  const parseDeepPath$1 = (deepPathCandidate) => {
@@ -49949,6 +49962,16 @@ const ComponentVariableSchema = z.object({
49949
49962
  });
49950
49963
  const ComponentTreeNodeSchema = BaseComponentTreeNodeSchema.extend({
49951
49964
  children: z.lazy(() => ComponentTreeNodeSchema.array()),
49965
+ }).superRefine(({ id, prebindingId, parameters }, ctx) => {
49966
+ // We don't fail if parameters are present but prebindingId is not because
49967
+ // older experiences (updated before 21-09-2025) always included parameters
49968
+ // and they will start failing if we do.
49969
+ if (prebindingId && !parameters) {
49970
+ ctx.addIssue({
49971
+ code: z.ZodIssueCode.custom,
49972
+ message: `Found "prebindingId" but no "parameters" for node with id: "${id}"`,
49973
+ });
49974
+ }
49952
49975
  });
49953
49976
  const ComponentTreeSchema = z
49954
49977
  .object({
@@ -51029,14 +51052,28 @@ const useComponentProps = ({ node, entityStore, areEntitiesFetched, resolveDesig
51029
51052
  // eg: "/uuid" vs "/uuid/fields/[fileName]/~locale" as the regular BoundValue would have
51030
51053
  const [, uuid, maybePath] = variableMapping.path.split('/');
51031
51054
  const link = dataSource[uuid];
51032
- let boundValue;
51033
51055
  // starting from here, if the prop is of type 'BoundValue', and has prebinding
51034
51056
  // we are going to resolve the incomplete path
51057
+ let boundValue;
51058
+ // TODO: Temporary fix while we look into SPA-3212 it occurs where we have prebound props but data source link is missing
51059
+ // this only occurs after live updates of nested patterns.
51060
+ if (!link && isPreboundProp(variableMapping) && variableMapping.isPrebound) {
51061
+ return {
51062
+ ...acc,
51063
+ [variableName]: variableDefinition.defaultValue,
51064
+ };
51065
+ }
51035
51066
  if (link && isPreboundProp(variableMapping) && variableMapping.isPrebound) {
51036
51067
  const prebindingPath = getPrebindingPathBySourceEntry(variableMapping, (dataSourceKey) => {
51037
51068
  const link = dataSource[dataSourceKey];
51038
51069
  return entityStore.getEntityFromLink(link);
51039
- }) ?? variableMapping.path;
51070
+ });
51071
+ if (!prebindingPath) {
51072
+ return {
51073
+ ...acc,
51074
+ [variableName]: variableDefinition.defaultValue,
51075
+ };
51076
+ }
51040
51077
  // this allows us to resolve it regularly
51041
51078
  boundValue = transformBoundContentValue(node.data.props, entityStore, link, resolveDesignValue, variableName, variableDefinition.type, prebindingPath);
51042
51079
  }