@contentful/experiences-visual-editor-react 3.6.1 → 3.6.2-dev-20250912T1252-251a338.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
@@ -344,7 +344,7 @@ const optionalBuiltInStyles = {
344
344
  type: 'Media',
345
345
  description: 'Image to display',
346
346
  validations: {
347
- bindingSourceType: ['entry', 'asset', 'manual'],
347
+ bindingSourceType: ['asset', 'entry', 'manual'],
348
348
  },
349
349
  },
350
350
  cfImageOptions: {
@@ -369,7 +369,7 @@ const optionalBuiltInStyles = {
369
369
  type: 'Media',
370
370
  description: 'Background image for component',
371
371
  validations: {
372
- bindingSourceType: ['entry', 'asset', 'manual'],
372
+ bindingSourceType: ['asset', 'entry', 'manual'],
373
373
  },
374
374
  },
375
375
  cfBackgroundImageOptions: {
@@ -892,8 +892,20 @@ z.object({
892
892
  componentSettings: localeWrapper$1(ComponentSettingsSchema$1),
893
893
  });
894
894
 
895
- z.object({
895
+ z
896
+ .object({
896
897
  id: DefinitionPropertyKeySchema$1,
898
+ name: z.string(),
899
+ category: z.string().optional(),
900
+ thumbnailUrl: z.string().optional(),
901
+ thumbnailId: z.string().optional(),
902
+ hyperlinkPattern: z.string().optional(),
903
+ children: z.boolean().optional(),
904
+ slots: z
905
+ .record(DefinitionPropertyKeySchema$1, z.object({ displayName: z.string().optional() }))
906
+ .optional(),
907
+ builtInStyles: z.array(z.string()).optional(),
908
+ tooltip: z.object({ imageUrl: z.string().optional(), description: z.string() }).optional(),
897
909
  variables: z.record(DefinitionPropertyKeySchema$1, ComponentVariableSchema$1.extend({
898
910
  defaultValue: PrimitiveValueSchema$1.optional(),
899
911
  }).superRefine((val, ctx) => {
@@ -999,6 +1011,27 @@ z.object({
999
1011
  break;
1000
1012
  }
1001
1013
  })),
1014
+ })
1015
+ .superRefine((val, ctx) => {
1016
+ if (val.children === true && (!!val.variables.children || !!val.slots?.children)) {
1017
+ ctx.addIssue({
1018
+ code: z.ZodIssueCode.custom,
1019
+ message: `Cannot activate 'children: true' and name a variable or slot 'children' at the same time`,
1020
+ fatal: false,
1021
+ });
1022
+ }
1023
+ // Ensure that slots and variables don't use the same names
1024
+ if (val.variables && val.slots) {
1025
+ Object.keys(val.variables).forEach((name) => {
1026
+ if (val.slots[name]) {
1027
+ ctx.addIssue({
1028
+ code: z.ZodIssueCode.custom,
1029
+ message: `Variable and slot cannot have the same name: ${name}`,
1030
+ fatal: false,
1031
+ });
1032
+ }
1033
+ });
1034
+ }
1002
1035
  });
1003
1036
 
1004
1037
  var CodeNames$1;
@@ -3707,8 +3740,20 @@ z.object({
3707
3740
  componentSettings: localeWrapper(ComponentSettingsSchema),
3708
3741
  });
3709
3742
 
3710
- z.object({
3743
+ z
3744
+ .object({
3711
3745
  id: DefinitionPropertyKeySchema,
3746
+ name: z.string(),
3747
+ category: z.string().optional(),
3748
+ thumbnailUrl: z.string().optional(),
3749
+ thumbnailId: z.string().optional(),
3750
+ hyperlinkPattern: z.string().optional(),
3751
+ children: z.boolean().optional(),
3752
+ slots: z
3753
+ .record(DefinitionPropertyKeySchema, z.object({ displayName: z.string().optional() }))
3754
+ .optional(),
3755
+ builtInStyles: z.array(z.string()).optional(),
3756
+ tooltip: z.object({ imageUrl: z.string().optional(), description: z.string() }).optional(),
3712
3757
  variables: z.record(DefinitionPropertyKeySchema, ComponentVariableSchema.extend({
3713
3758
  defaultValue: PrimitiveValueSchema.optional(),
3714
3759
  }).superRefine((val, ctx) => {
@@ -3814,6 +3859,27 @@ z.object({
3814
3859
  break;
3815
3860
  }
3816
3861
  })),
3862
+ })
3863
+ .superRefine((val, ctx) => {
3864
+ if (val.children === true && (!!val.variables.children || !!val.slots?.children)) {
3865
+ ctx.addIssue({
3866
+ code: z.ZodIssueCode.custom,
3867
+ message: `Cannot activate 'children: true' and name a variable or slot 'children' at the same time`,
3868
+ fatal: false,
3869
+ });
3870
+ }
3871
+ // Ensure that slots and variables don't use the same names
3872
+ if (val.variables && val.slots) {
3873
+ Object.keys(val.variables).forEach((name) => {
3874
+ if (val.slots[name]) {
3875
+ ctx.addIssue({
3876
+ code: z.ZodIssueCode.custom,
3877
+ message: `Variable and slot cannot have the same name: ${name}`,
3878
+ fatal: false,
3879
+ });
3880
+ }
3881
+ });
3882
+ }
3817
3883
  });
3818
3884
 
3819
3885
  var CodeNames;