@contentful/experiences-components-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
@@ -507,7 +507,7 @@ const ImageComponentDefinition = {
507
507
  type: 'Text',
508
508
  description: 'Alternative text for the image',
509
509
  validations: {
510
- bindingSourceType: ['entry', 'manual', 'asset'],
510
+ bindingSourceType: ['asset', 'entry', 'manual'],
511
511
  },
512
512
  },
513
513
  },
@@ -770,7 +770,7 @@ const optionalBuiltInStyles = {
770
770
  type: 'Media',
771
771
  description: 'Image to display',
772
772
  validations: {
773
- bindingSourceType: ['entry', 'asset', 'manual'],
773
+ bindingSourceType: ['asset', 'entry', 'manual'],
774
774
  },
775
775
  },
776
776
  cfImageOptions: {
@@ -795,7 +795,7 @@ const optionalBuiltInStyles = {
795
795
  type: 'Media',
796
796
  description: 'Background image for component',
797
797
  validations: {
798
- bindingSourceType: ['entry', 'asset', 'manual'],
798
+ bindingSourceType: ['asset', 'entry', 'manual'],
799
799
  },
800
800
  },
801
801
  cfBackgroundImageOptions: {
@@ -1477,8 +1477,20 @@ z.object({
1477
1477
  componentSettings: localeWrapper(ComponentSettingsSchema),
1478
1478
  });
1479
1479
 
1480
- z.object({
1480
+ z
1481
+ .object({
1481
1482
  id: DefinitionPropertyKeySchema,
1483
+ name: z.string(),
1484
+ category: z.string().optional(),
1485
+ thumbnailUrl: z.string().optional(),
1486
+ thumbnailId: z.string().optional(),
1487
+ hyperlinkPattern: z.string().optional(),
1488
+ children: z.boolean().optional(),
1489
+ slots: z
1490
+ .record(DefinitionPropertyKeySchema, z.object({ displayName: z.string().optional() }))
1491
+ .optional(),
1492
+ builtInStyles: z.array(z.string()).optional(),
1493
+ tooltip: z.object({ imageUrl: z.string().optional(), description: z.string() }).optional(),
1482
1494
  variables: z.record(DefinitionPropertyKeySchema, ComponentVariableSchema.extend({
1483
1495
  defaultValue: PrimitiveValueSchema.optional(),
1484
1496
  }).superRefine((val, ctx) => {
@@ -1584,6 +1596,27 @@ z.object({
1584
1596
  break;
1585
1597
  }
1586
1598
  })),
1599
+ })
1600
+ .superRefine((val, ctx) => {
1601
+ if (val.children === true && (!!val.variables.children || !!val.slots?.children)) {
1602
+ ctx.addIssue({
1603
+ code: z.ZodIssueCode.custom,
1604
+ message: `Cannot activate 'children: true' and name a variable or slot 'children' at the same time`,
1605
+ fatal: false,
1606
+ });
1607
+ }
1608
+ // Ensure that slots and variables don't use the same names
1609
+ if (val.variables && val.slots) {
1610
+ Object.keys(val.variables).forEach((name) => {
1611
+ if (val.slots[name]) {
1612
+ ctx.addIssue({
1613
+ code: z.ZodIssueCode.custom,
1614
+ message: `Variable and slot cannot have the same name: ${name}`,
1615
+ fatal: false,
1616
+ });
1617
+ }
1618
+ });
1619
+ }
1587
1620
  });
1588
1621
 
1589
1622
  var CodeNames;