@contentful/experiences-core 3.6.1 → 3.6.2-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
@@ -347,7 +347,7 @@ const optionalBuiltInStyles = {
347
347
  type: 'Media',
348
348
  description: 'Image to display',
349
349
  validations: {
350
- bindingSourceType: ['entry', 'asset', 'manual'],
350
+ bindingSourceType: ['asset', 'entry', 'manual'],
351
351
  },
352
352
  },
353
353
  cfImageOptions: {
@@ -372,7 +372,7 @@ const optionalBuiltInStyles = {
372
372
  type: 'Media',
373
373
  description: 'Background image for component',
374
374
  validations: {
375
- bindingSourceType: ['entry', 'asset', 'manual'],
375
+ bindingSourceType: ['asset', 'entry', 'manual'],
376
376
  },
377
377
  },
378
378
  cfBackgroundImageOptions: {
@@ -1136,8 +1136,20 @@ z.object({
1136
1136
  componentSettings: localeWrapper(ComponentSettingsSchema),
1137
1137
  });
1138
1138
 
1139
- z.object({
1139
+ z
1140
+ .object({
1140
1141
  id: DefinitionPropertyKeySchema,
1142
+ name: z.string(),
1143
+ category: z.string().optional(),
1144
+ thumbnailUrl: z.string().optional(),
1145
+ thumbnailId: z.string().optional(),
1146
+ hyperlinkPattern: z.string().optional(),
1147
+ children: z.boolean().optional(),
1148
+ slots: z
1149
+ .record(DefinitionPropertyKeySchema, z.object({ displayName: z.string().optional() }))
1150
+ .optional(),
1151
+ builtInStyles: z.array(z.string()).optional(),
1152
+ tooltip: z.object({ imageUrl: z.string().optional(), description: z.string() }).optional(),
1141
1153
  variables: z.record(DefinitionPropertyKeySchema, ComponentVariableSchema.extend({
1142
1154
  defaultValue: PrimitiveValueSchema.optional(),
1143
1155
  }).superRefine((val, ctx) => {
@@ -1243,6 +1255,27 @@ z.object({
1243
1255
  break;
1244
1256
  }
1245
1257
  })),
1258
+ })
1259
+ .superRefine((val, ctx) => {
1260
+ if (val.children === true && (!!val.variables.children || !!val.slots?.children)) {
1261
+ ctx.addIssue({
1262
+ code: z.ZodIssueCode.custom,
1263
+ message: `Cannot activate 'children: true' and name a variable or slot 'children' at the same time`,
1264
+ fatal: false,
1265
+ });
1266
+ }
1267
+ // Ensure that slots and variables don't use the same names
1268
+ if (val.variables && val.slots) {
1269
+ Object.keys(val.variables).forEach((name) => {
1270
+ if (val.slots[name]) {
1271
+ ctx.addIssue({
1272
+ code: z.ZodIssueCode.custom,
1273
+ message: `Variable and slot cannot have the same name: ${name}`,
1274
+ fatal: false,
1275
+ });
1276
+ }
1277
+ });
1278
+ }
1246
1279
  });
1247
1280
 
1248
1281
  var CodeNames;