@contentful/experiences-core 1.42.1-beta.0 → 1.42.2-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.
- package/dist/index.js +22 -7
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1044,8 +1044,13 @@ const VariableMappingSchema = z.object({
|
|
|
1044
1044
|
type: z.literal('ContentTypeMapping'),
|
|
1045
1045
|
pathsByContentType: z.record(z.string(), z.object({ path: z.string() })),
|
|
1046
1046
|
});
|
|
1047
|
-
|
|
1048
|
-
|
|
1047
|
+
const PassToNodeSchema = z
|
|
1048
|
+
.object({
|
|
1049
|
+
nodeId: propertyKeySchema,
|
|
1050
|
+
parameterId: propertyKeySchema,
|
|
1051
|
+
prebindingId: propertyKeySchema,
|
|
1052
|
+
})
|
|
1053
|
+
.strict();
|
|
1049
1054
|
const ParameterDefinitionSchema = z.object({
|
|
1050
1055
|
defaultSource: z
|
|
1051
1056
|
.strictObject({
|
|
@@ -1067,18 +1072,28 @@ const ParameterDefinitionSchema = z.object({
|
|
|
1067
1072
|
linkType: z.enum(['ContentType']),
|
|
1068
1073
|
}),
|
|
1069
1074
|
})),
|
|
1075
|
+
passToNodes: z.array(PassToNodeSchema).optional(),
|
|
1070
1076
|
});
|
|
1071
1077
|
const ParameterDefinitionsSchema = z.record(propertyKeySchema, ParameterDefinitionSchema);
|
|
1072
1078
|
const VariableMappingsSchema = z.record(propertyKeySchema, VariableMappingSchema);
|
|
1073
1079
|
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
|
|
1074
1080
|
ComponentVariableSchema);
|
|
1075
|
-
const
|
|
1081
|
+
const PrebindingDefinitionSchema = z
|
|
1082
|
+
.object({
|
|
1083
|
+
id: propertyKeySchema,
|
|
1084
|
+
parameterDefinitions: ParameterDefinitionsSchema,
|
|
1085
|
+
variableMappings: VariableMappingsSchema.optional(),
|
|
1086
|
+
allowedVariableOverrides: z.array(z.string()).optional(),
|
|
1087
|
+
})
|
|
1088
|
+
.strict();
|
|
1089
|
+
const ComponentSettingsSchema = z
|
|
1090
|
+
.object({
|
|
1076
1091
|
variableDefinitions: ComponentVariablesSchema,
|
|
1077
1092
|
thumbnailId: z.enum(THUMBNAIL_IDS).optional(),
|
|
1078
1093
|
category: z.string().max(50, 'Category must contain at most 50 characters').optional(),
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1094
|
+
prebindingDefinitions: z.array(PrebindingDefinitionSchema).max(1).optional(),
|
|
1095
|
+
})
|
|
1096
|
+
.strict();
|
|
1082
1097
|
z.object({
|
|
1083
1098
|
componentTree: localeWrapper(ComponentTreeSchema),
|
|
1084
1099
|
dataSource: localeWrapper(DataSourceSchema),
|
|
@@ -4156,7 +4171,7 @@ const attachPrebindingDefaultValueAsDataSource = (experienceEntry) => {
|
|
|
4156
4171
|
// Only supported for pattern entries since experience entries don't define pattern properties.
|
|
4157
4172
|
return;
|
|
4158
4173
|
}
|
|
4159
|
-
const patternDefs = experienceEntry.fields.componentSettings?.parameterDefinitions ?? {};
|
|
4174
|
+
const patternDefs = experienceEntry.fields.componentSettings?.prebindingDefinitions?.[0].parameterDefinitions ?? {};
|
|
4160
4175
|
const defaultPrebinding = Object.values(patternDefs).find((def) => def.defaultSource)?.defaultSource;
|
|
4161
4176
|
const { link, type } = defaultPrebinding ?? {};
|
|
4162
4177
|
if (!link || !type)
|