@contentful/experiences-core 1.31.1-prerelease-20250218T2104-febb4f2.0 → 1.31.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
|
@@ -1155,14 +1155,14 @@ const ComponentValueSchema = z
|
|
|
1155
1155
|
.strict();
|
|
1156
1156
|
// TODO: finalize schema structure before release
|
|
1157
1157
|
// https://contentful.atlassian.net/browse/LUMOS-523
|
|
1158
|
-
const
|
|
1158
|
+
const EmptyObjectSchema = z.object({ type: z.undefined() });
|
|
1159
1159
|
const ComponentPropertyValueSchema = z.discriminatedUnion('type', [
|
|
1160
1160
|
DesignValueSchema,
|
|
1161
1161
|
BoundValueSchema,
|
|
1162
1162
|
UnboundValueSchema,
|
|
1163
1163
|
HyperlinkValueSchema,
|
|
1164
1164
|
ComponentValueSchema,
|
|
1165
|
-
|
|
1165
|
+
EmptyObjectSchema,
|
|
1166
1166
|
]);
|
|
1167
1167
|
// TODO: finalize schema structure before release
|
|
1168
1168
|
// https://contentful.atlassian.net/browse/LUMOS-523
|
|
@@ -1175,12 +1175,13 @@ const VariableMappingsSchema = z.record(propertyKeySchema, VariableMappingSchema
|
|
|
1175
1175
|
// TODO: finalize schema structure before release
|
|
1176
1176
|
// https://contentful.atlassian.net/browse/LUMOS-523
|
|
1177
1177
|
const PatternPropertyDefinitionSchema = z.object({
|
|
1178
|
-
defaultValue: z
|
|
1179
|
-
.object({
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
.
|
|
1178
|
+
defaultValue: z.union([
|
|
1179
|
+
z.object({
|
|
1180
|
+
path: z.string(),
|
|
1181
|
+
type: z.literal('BoundValue'),
|
|
1182
|
+
}),
|
|
1183
|
+
z.null(),
|
|
1184
|
+
]),
|
|
1184
1185
|
contentTypes: z.record(z.string(), z.any()),
|
|
1185
1186
|
});
|
|
1186
1187
|
const PatternPropertyDefinitionsSchema = z.record(propertyKeySchema, PatternPropertyDefinitionSchema);
|
|
@@ -1243,8 +1244,33 @@ const ComponentVariableSchema = z.object({
|
|
|
1243
1244
|
});
|
|
1244
1245
|
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
|
|
1245
1246
|
ComponentVariableSchema);
|
|
1247
|
+
const THUMBNAIL_IDS = [
|
|
1248
|
+
'columns',
|
|
1249
|
+
'columnsPlusRight',
|
|
1250
|
+
'imagesSquare',
|
|
1251
|
+
'subtitles',
|
|
1252
|
+
'rowsPlusBottom',
|
|
1253
|
+
'userRectangle',
|
|
1254
|
+
'textbox',
|
|
1255
|
+
'monitorPlay',
|
|
1256
|
+
'article',
|
|
1257
|
+
'table',
|
|
1258
|
+
'star',
|
|
1259
|
+
'heartStraight',
|
|
1260
|
+
'frameCorners',
|
|
1261
|
+
'rows',
|
|
1262
|
+
'dotsThreeOutline',
|
|
1263
|
+
'listDashes',
|
|
1264
|
+
'checkerBoard',
|
|
1265
|
+
'gridFour',
|
|
1266
|
+
'slideshow',
|
|
1267
|
+
'diamondsFour',
|
|
1268
|
+
'cards',
|
|
1269
|
+
'textColumns',
|
|
1270
|
+
];
|
|
1246
1271
|
const ComponentSettingsSchema = z.object({
|
|
1247
1272
|
variableDefinitions: ComponentVariablesSchema,
|
|
1273
|
+
thumbnailId: z.enum(THUMBNAIL_IDS).optional(),
|
|
1248
1274
|
variableMappings: VariableMappingsSchema.optional(),
|
|
1249
1275
|
patternPropertyDefinitions: PatternPropertyDefinitionsSchema.optional(),
|
|
1250
1276
|
});
|
|
@@ -2412,11 +2438,11 @@ function getArrayValue(entryOrAsset, path, entityStore) {
|
|
|
2412
2438
|
return result;
|
|
2413
2439
|
}
|
|
2414
2440
|
|
|
2415
|
-
const transformBoundContentValue = (variables, entityStore, binding, resolveDesignValue, variableName,
|
|
2441
|
+
const transformBoundContentValue = (variables, entityStore, binding, resolveDesignValue, variableName, variableType, path) => {
|
|
2416
2442
|
const entityOrAsset = entityStore.getEntryOrAsset(binding, path);
|
|
2417
2443
|
if (!entityOrAsset)
|
|
2418
2444
|
return;
|
|
2419
|
-
switch (
|
|
2445
|
+
switch (variableType) {
|
|
2420
2446
|
case 'Media':
|
|
2421
2447
|
// If we bound a normal entry field to the media variable we just return the bound value
|
|
2422
2448
|
if (entityOrAsset.sys.type === 'Entry') {
|