@contentful/experiences-visual-editor-react 3.7.2-dev-20250924T1519-77d453c.0 → 3.8.0-beta.1

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
@@ -727,7 +727,7 @@ const BREAKPOINT_QUERY_REGEX$1 = /^\*$|^[<>][0-9]+px$/;
727
727
  const BreakpointSchema$1 = z
728
728
  .object({
729
729
  id: propertyKeySchema$1,
730
- // Can be replace with z.templateLiteral when upgrading to zod v4
730
+ // Can be replaced with z.templateLiteral when upgrading to zod v4
731
731
  query: z.string().refine((s) => BREAKPOINT_QUERY_REGEX$1.test(s)),
732
732
  previewSize: z.string().optional(),
733
733
  displayName: z.string(),
@@ -766,6 +766,16 @@ const ComponentVariableSchema$1 = z.object({
766
766
  });
767
767
  const ComponentTreeNodeSchema$1 = BaseComponentTreeNodeSchema$1.extend({
768
768
  children: z.lazy(() => ComponentTreeNodeSchema$1.array()),
769
+ }).superRefine(({ id, prebindingId, parameters }, ctx) => {
770
+ // We don't fail if parameters are present but prebindingId is not because
771
+ // older experiences (updated before 21-09-2025) always included parameters
772
+ // and they will start failing if we do.
773
+ if (prebindingId && !parameters) {
774
+ ctx.addIssue({
775
+ code: z.ZodIssueCode.custom,
776
+ message: `Found "prebindingId" but no "parameters" for node with id: "${id}"`,
777
+ });
778
+ }
769
779
  });
770
780
  const ComponentTreeSchema$1 = z
771
781
  .object({
@@ -868,8 +878,7 @@ const ParameterDefinitionSchema$1 = z.object({
868
878
  contentTypes: z.array(z.string()).min(1),
869
879
  passToNodes: z
870
880
  .array(PassToNodeSchema$1)
871
- .max(1, 'At most one "passToNodes" element is allowed per parameter definition.')
872
- .optional(), // we might change this to be empty array for native parameter definitions, that's why we don't use .length(1)
881
+ .max(1, 'At most one "passToNodes" element is allowed per parameter definition.'),
873
882
  });
874
883
  const ParameterDefinitionsSchema$1 = z.record(propertyKeySchema$1, ParameterDefinitionSchema$1);
875
884
  const VariableMappingsSchema$1 = z.record(propertyKeySchema$1, VariableMappingSchema$1);
@@ -971,7 +980,7 @@ const validatePassToNodes$1 = (rootChildren, componentSettings, ctx) => {
971
980
  return;
972
981
  }
973
982
  const { parameterDefinitions } = componentSettings.prebindingDefinitions[0];
974
- let nodeIds = new Set();
983
+ const nodeIds = new Set();
975
984
  for (const paramDef of Object.values(parameterDefinitions || {})) {
976
985
  paramDef.passToNodes?.forEach((n) => nodeIds.add(n.nodeId));
977
986
  }
@@ -1749,7 +1758,7 @@ const transformTextAlign = (value) => {
1749
1758
  return undefined;
1750
1759
  const sdkOptions = getSdkOptions();
1751
1760
  // New behavior: translate left/right to start/end
1752
- // Customer can opt-out by activating this global option toggle
1761
+ // Customer can opt out by activating this global option toggle
1753
1762
  if (!sdkOptions.__disableTextAlignmentTransform) {
1754
1763
  if (value === 'left')
1755
1764
  return 'start';
@@ -3965,7 +3974,7 @@ const BREAKPOINT_QUERY_REGEX = /^\*$|^[<>][0-9]+px$/;
3965
3974
  const BreakpointSchema = z
3966
3975
  .object({
3967
3976
  id: propertyKeySchema,
3968
- // Can be replace with z.templateLiteral when upgrading to zod v4
3977
+ // Can be replaced with z.templateLiteral when upgrading to zod v4
3969
3978
  query: z.string().refine((s) => BREAKPOINT_QUERY_REGEX.test(s)),
3970
3979
  previewSize: z.string().optional(),
3971
3980
  displayName: z.string(),
@@ -4004,6 +4013,16 @@ const ComponentVariableSchema = z.object({
4004
4013
  });
4005
4014
  const ComponentTreeNodeSchema = BaseComponentTreeNodeSchema.extend({
4006
4015
  children: z.lazy(() => ComponentTreeNodeSchema.array()),
4016
+ }).superRefine(({ id, prebindingId, parameters }, ctx) => {
4017
+ // We don't fail if parameters are present but prebindingId is not because
4018
+ // older experiences (updated before 21-09-2025) always included parameters
4019
+ // and they will start failing if we do.
4020
+ if (prebindingId && !parameters) {
4021
+ ctx.addIssue({
4022
+ code: z.ZodIssueCode.custom,
4023
+ message: `Found "prebindingId" but no "parameters" for node with id: "${id}"`,
4024
+ });
4025
+ }
4007
4026
  });
4008
4027
  const ComponentTreeSchema = z
4009
4028
  .object({
@@ -4106,8 +4125,7 @@ const ParameterDefinitionSchema = z.object({
4106
4125
  contentTypes: z.array(z.string()).min(1),
4107
4126
  passToNodes: z
4108
4127
  .array(PassToNodeSchema)
4109
- .max(1, 'At most one "passToNodes" element is allowed per parameter definition.')
4110
- .optional(), // we might change this to be empty array for native parameter definitions, that's why we don't use .length(1)
4128
+ .max(1, 'At most one "passToNodes" element is allowed per parameter definition.'),
4111
4129
  });
4112
4130
  const ParameterDefinitionsSchema = z.record(propertyKeySchema, ParameterDefinitionSchema);
4113
4131
  const VariableMappingsSchema = z.record(propertyKeySchema, VariableMappingSchema);
@@ -4209,7 +4227,7 @@ const validatePassToNodes = (rootChildren, componentSettings, ctx) => {
4209
4227
  return;
4210
4228
  }
4211
4229
  const { parameterDefinitions } = componentSettings.prebindingDefinitions[0];
4212
- let nodeIds = new Set();
4230
+ const nodeIds = new Set();
4213
4231
  for (const paramDef of Object.values(parameterDefinitions || {})) {
4214
4232
  paramDef.passToNodes?.forEach((n) => nodeIds.add(n.nodeId));
4215
4233
  }