@contentful/experiences-core 1.11.3-dev-20240808T2101-c1fe341.0 → 1.12.0-beta.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.
|
@@ -19,9 +19,9 @@ declare class EntityStore extends EntityStoreBase {
|
|
|
19
19
|
get schemaVersion(): "2023-09-28" | undefined;
|
|
20
20
|
get breakpoints(): {
|
|
21
21
|
id: string;
|
|
22
|
-
displayName: string;
|
|
23
22
|
query: string;
|
|
24
23
|
previewSize: string;
|
|
24
|
+
displayName: string;
|
|
25
25
|
displayIcon?: "desktop" | "tablet" | "mobile" | undefined;
|
|
26
26
|
}[];
|
|
27
27
|
get dataSource(): Record<string, {
|
package/dist/index.js
CHANGED
|
@@ -464,6 +464,7 @@ const builtInStyles = {
|
|
|
464
464
|
type: 'Text',
|
|
465
465
|
group: 'style',
|
|
466
466
|
description: 'The background color of the section',
|
|
467
|
+
defaultValue: 'rgba(0, 0, 0, 0)',
|
|
467
468
|
},
|
|
468
469
|
cfWidth: {
|
|
469
470
|
displayName: 'Width',
|
|
@@ -576,6 +577,13 @@ const optionalBuiltInStyles = {
|
|
|
576
577
|
targetSize: DEFAULT_IMAGE_WIDTH,
|
|
577
578
|
},
|
|
578
579
|
},
|
|
580
|
+
cfBackgroundColor: {
|
|
581
|
+
displayName: 'Background color',
|
|
582
|
+
type: 'Text',
|
|
583
|
+
group: 'style',
|
|
584
|
+
description: 'The background color of the element',
|
|
585
|
+
defaultValue: 'rgba(0, 0, 0, 0)',
|
|
586
|
+
},
|
|
579
587
|
cfBackgroundImageUrl: {
|
|
580
588
|
displayName: 'Background image',
|
|
581
589
|
type: 'Media',
|
|
@@ -745,11 +753,12 @@ const dividerBuiltInStyles = {
|
|
|
745
753
|
type: 'Text',
|
|
746
754
|
group: 'style',
|
|
747
755
|
description: 'The background color of the divider',
|
|
748
|
-
defaultValue: 'rgba(0, 0, 0,
|
|
756
|
+
defaultValue: 'rgba(0, 0, 0, 0)',
|
|
749
757
|
},
|
|
750
758
|
};
|
|
751
759
|
const singleColumnBuiltInStyles = {
|
|
752
760
|
cfBorderRadius: optionalBuiltInStyles.cfBorderRadius,
|
|
761
|
+
cfBackgroundColor: optionalBuiltInStyles.cfBackgroundColor,
|
|
753
762
|
cfBackgroundImageUrl: optionalBuiltInStyles.cfBackgroundImageUrl,
|
|
754
763
|
cfBackgroundImageOptions: optionalBuiltInStyles.cfBackgroundImageOptions,
|
|
755
764
|
cfVerticalAlignment: {
|
|
@@ -805,12 +814,6 @@ const singleColumnBuiltInStyles = {
|
|
|
805
814
|
description: 'The padding of the column',
|
|
806
815
|
defaultValue: '0 0 0 0',
|
|
807
816
|
},
|
|
808
|
-
cfBackgroundColor: {
|
|
809
|
-
displayName: 'Background color',
|
|
810
|
-
type: 'Text',
|
|
811
|
-
group: 'style',
|
|
812
|
-
description: 'The background color of the column',
|
|
813
|
-
},
|
|
814
817
|
cfFlexDirection: {
|
|
815
818
|
displayName: 'Direction',
|
|
816
819
|
type: 'Text',
|
|
@@ -852,6 +855,7 @@ const singleColumnBuiltInStyles = {
|
|
|
852
855
|
};
|
|
853
856
|
const columnsBuiltInStyles = {
|
|
854
857
|
cfBorderRadius: optionalBuiltInStyles.cfBorderRadius,
|
|
858
|
+
cfBackgroundColor: optionalBuiltInStyles.cfBackgroundColor,
|
|
855
859
|
cfBackgroundImageUrl: optionalBuiltInStyles.cfBackgroundImageUrl,
|
|
856
860
|
cfBackgroundImageOptions: optionalBuiltInStyles.cfBackgroundImageOptions,
|
|
857
861
|
cfMargin: {
|
|
@@ -882,12 +886,6 @@ const columnsBuiltInStyles = {
|
|
|
882
886
|
description: 'The padding of the columns',
|
|
883
887
|
defaultValue: '10px 10px 10px 10px',
|
|
884
888
|
},
|
|
885
|
-
cfBackgroundColor: {
|
|
886
|
-
displayName: 'Background color',
|
|
887
|
-
type: 'Text',
|
|
888
|
-
group: 'style',
|
|
889
|
-
description: 'The background color of the columns',
|
|
890
|
-
},
|
|
891
889
|
cfBorder: {
|
|
892
890
|
displayName: 'Border',
|
|
893
891
|
type: 'Text',
|
|
@@ -1071,17 +1069,13 @@ const DefinitionPropertyTypeSchema = z.enum([
|
|
|
1071
1069
|
const DefinitionPropertyKeySchema = z
|
|
1072
1070
|
.string()
|
|
1073
1071
|
.regex(/^[a-zA-Z0-9-_]{1,32}$/, { message: 'Property needs to match: /^[a-zA-Z0-9-_]{1,32}$/' });
|
|
1074
|
-
z.
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
group: z.string().optional(),
|
|
1082
|
-
})),
|
|
1083
|
-
});
|
|
1084
|
-
|
|
1072
|
+
const PrimitiveValueSchema = z.union([
|
|
1073
|
+
z.string(),
|
|
1074
|
+
z.boolean(),
|
|
1075
|
+
z.number(),
|
|
1076
|
+
z.record(z.any(), z.any()),
|
|
1077
|
+
z.undefined(),
|
|
1078
|
+
]);
|
|
1085
1079
|
const uuidKeySchema = z
|
|
1086
1080
|
.string()
|
|
1087
1081
|
.regex(/^[a-zA-Z0-9-_]{1,21}$/, { message: 'Does not match /^[a-zA-Z0-9-_]{1,21}$/' });
|
|
@@ -1100,13 +1094,6 @@ const DataSourceSchema = z.record(uuidKeySchema, z.object({
|
|
|
1100
1094
|
linkType: z.enum(['Entry', 'Asset']),
|
|
1101
1095
|
}),
|
|
1102
1096
|
}));
|
|
1103
|
-
const PrimitiveValueSchema = z.union([
|
|
1104
|
-
z.string(),
|
|
1105
|
-
z.boolean(),
|
|
1106
|
-
z.number(),
|
|
1107
|
-
z.record(z.any(), z.any()),
|
|
1108
|
-
z.undefined(),
|
|
1109
|
-
]);
|
|
1110
1097
|
const ValuesByBreakpointSchema = z.record(z.lazy(() => PrimitiveValueSchema));
|
|
1111
1098
|
const DesignValueSchema = z
|
|
1112
1099
|
.object({
|
|
@@ -1168,27 +1155,29 @@ const BaseComponentTreeNodeSchema = z.object({
|
|
|
1168
1155
|
const ComponentTreeNodeSchema = BaseComponentTreeNodeSchema.extend({
|
|
1169
1156
|
children: z.lazy(() => ComponentTreeNodeSchema.array()),
|
|
1170
1157
|
});
|
|
1171
|
-
const
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
displayName: z.string().optional(),
|
|
1187
|
-
}))
|
|
1188
|
-
.optional(),
|
|
1189
|
-
})
|
|
1158
|
+
const ComponentVariableSchema = z.object({
|
|
1159
|
+
displayName: z.string().optional(),
|
|
1160
|
+
type: DefinitionPropertyTypeSchema,
|
|
1161
|
+
description: z.string().optional(),
|
|
1162
|
+
group: z.string().optional(),
|
|
1163
|
+
defaultValue: PrimitiveValueSchema.or(ComponentPropertyValueSchema).optional(),
|
|
1164
|
+
validations: z
|
|
1165
|
+
.object({
|
|
1166
|
+
required: z.boolean().optional(),
|
|
1167
|
+
format: z.literal('URL').optional(),
|
|
1168
|
+
in: z
|
|
1169
|
+
.array(z.object({
|
|
1170
|
+
value: z.union([z.string(), z.number()]),
|
|
1171
|
+
displayName: z.string().optional(),
|
|
1172
|
+
}))
|
|
1190
1173
|
.optional(),
|
|
1191
|
-
})
|
|
1174
|
+
})
|
|
1175
|
+
.optional(),
|
|
1176
|
+
});
|
|
1177
|
+
const ComponentVariablesSchema = z.record(z.string().regex(/^[a-zA-Z0-9-_]{1,54}$/), // Here the key is <variableName>_<nanoidId> so we need to allow for a longer length
|
|
1178
|
+
ComponentVariableSchema);
|
|
1179
|
+
const ComponentSettingsSchema = z.object({
|
|
1180
|
+
variableDefinitions: ComponentVariablesSchema,
|
|
1192
1181
|
});
|
|
1193
1182
|
const UsedComponentsSchema = z.array(z.object({
|
|
1194
1183
|
sys: z.object({
|
|
@@ -1267,6 +1256,115 @@ z
|
|
|
1267
1256
|
})
|
|
1268
1257
|
.superRefine(componentSettingsRefinement);
|
|
1269
1258
|
|
|
1259
|
+
z.object({
|
|
1260
|
+
id: DefinitionPropertyKeySchema,
|
|
1261
|
+
variables: z.record(DefinitionPropertyKeySchema, ComponentVariableSchema.extend({
|
|
1262
|
+
defaultValue: PrimitiveValueSchema.optional(),
|
|
1263
|
+
}).superRefine((val, ctx) => {
|
|
1264
|
+
switch (val.type) {
|
|
1265
|
+
case 'Array':
|
|
1266
|
+
if (typeof val.defaultValue !== 'undefined') {
|
|
1267
|
+
ctx.addIssue({
|
|
1268
|
+
code: z.ZodIssueCode.custom,
|
|
1269
|
+
message: `defaultValue is not supported for "Array" type for ${ctx.path.join('.')}`,
|
|
1270
|
+
fatal: false,
|
|
1271
|
+
});
|
|
1272
|
+
}
|
|
1273
|
+
break;
|
|
1274
|
+
case 'Boolean':
|
|
1275
|
+
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'boolean') {
|
|
1276
|
+
ctx.addIssue({
|
|
1277
|
+
code: z.ZodIssueCode.custom,
|
|
1278
|
+
message: `defaultValue must be a boolean when type is "Boolean" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,
|
|
1279
|
+
fatal: false,
|
|
1280
|
+
});
|
|
1281
|
+
}
|
|
1282
|
+
break;
|
|
1283
|
+
case 'Date':
|
|
1284
|
+
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {
|
|
1285
|
+
ctx.addIssue({
|
|
1286
|
+
code: z.ZodIssueCode.custom,
|
|
1287
|
+
message: `defaultValue must be a string when type is "Date" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,
|
|
1288
|
+
fatal: false,
|
|
1289
|
+
});
|
|
1290
|
+
}
|
|
1291
|
+
break;
|
|
1292
|
+
case 'Hyperlink':
|
|
1293
|
+
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {
|
|
1294
|
+
ctx.addIssue({
|
|
1295
|
+
code: z.ZodIssueCode.custom,
|
|
1296
|
+
message: `defaultValue must be a string when type is "Hyperlink" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,
|
|
1297
|
+
fatal: false,
|
|
1298
|
+
});
|
|
1299
|
+
}
|
|
1300
|
+
break;
|
|
1301
|
+
case 'Link':
|
|
1302
|
+
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {
|
|
1303
|
+
ctx.addIssue({
|
|
1304
|
+
code: z.ZodIssueCode.custom,
|
|
1305
|
+
message: `defaultValue is not supported for "Link" type for ${ctx.path.join('.')}`,
|
|
1306
|
+
fatal: false,
|
|
1307
|
+
});
|
|
1308
|
+
}
|
|
1309
|
+
break;
|
|
1310
|
+
case 'Location':
|
|
1311
|
+
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {
|
|
1312
|
+
ctx.addIssue({
|
|
1313
|
+
code: z.ZodIssueCode.custom,
|
|
1314
|
+
message: `defaultValue must be an object when type is "Location" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,
|
|
1315
|
+
fatal: false,
|
|
1316
|
+
});
|
|
1317
|
+
}
|
|
1318
|
+
break;
|
|
1319
|
+
case 'Media':
|
|
1320
|
+
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {
|
|
1321
|
+
ctx.addIssue({
|
|
1322
|
+
code: z.ZodIssueCode.custom,
|
|
1323
|
+
message: `defaultValue must be a string when type is "Media" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,
|
|
1324
|
+
fatal: false,
|
|
1325
|
+
});
|
|
1326
|
+
}
|
|
1327
|
+
break;
|
|
1328
|
+
case 'Number':
|
|
1329
|
+
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'number') {
|
|
1330
|
+
ctx.addIssue({
|
|
1331
|
+
code: z.ZodIssueCode.custom,
|
|
1332
|
+
message: `defaultValue must be a number when type is "Number" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,
|
|
1333
|
+
fatal: false,
|
|
1334
|
+
});
|
|
1335
|
+
}
|
|
1336
|
+
break;
|
|
1337
|
+
case 'Object':
|
|
1338
|
+
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {
|
|
1339
|
+
ctx.addIssue({
|
|
1340
|
+
code: z.ZodIssueCode.custom,
|
|
1341
|
+
message: `defaultValue must be an object when type is "Object" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,
|
|
1342
|
+
fatal: false,
|
|
1343
|
+
});
|
|
1344
|
+
}
|
|
1345
|
+
break;
|
|
1346
|
+
case 'RichText':
|
|
1347
|
+
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {
|
|
1348
|
+
ctx.addIssue({
|
|
1349
|
+
code: z.ZodIssueCode.custom,
|
|
1350
|
+
message: `defaultValue must be an object when type is "RichText" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,
|
|
1351
|
+
fatal: false,
|
|
1352
|
+
});
|
|
1353
|
+
}
|
|
1354
|
+
break;
|
|
1355
|
+
case 'Text':
|
|
1356
|
+
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {
|
|
1357
|
+
ctx.addIssue({
|
|
1358
|
+
code: z.ZodIssueCode.custom,
|
|
1359
|
+
message: `defaultValue must be a string when type is "Text" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,
|
|
1360
|
+
fatal: false,
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1363
|
+
break;
|
|
1364
|
+
}
|
|
1365
|
+
})),
|
|
1366
|
+
});
|
|
1367
|
+
|
|
1270
1368
|
var CodeNames;
|
|
1271
1369
|
(function (CodeNames) {
|
|
1272
1370
|
CodeNames["Type"] = "type";
|
|
@@ -1367,6 +1465,7 @@ const zodToContentfulError = (issue) => {
|
|
|
1367
1465
|
return defaultConversion(issue);
|
|
1368
1466
|
}
|
|
1369
1467
|
};
|
|
1468
|
+
|
|
1370
1469
|
const validateBreakpointsDefinition = (breakpoints) => {
|
|
1371
1470
|
const result = z
|
|
1372
1471
|
.array(BreakpointSchema)
|