@contentful/experiences-core 1.42.0-prerelease-20250626T1154-6ca57b0.0 → 1.42.0-prerelease-20250627T1335-d74dad7.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
@@ -1047,14 +1047,18 @@ const VariableMappingSchema = z.object({
1047
1047
  // TODO: finalize schema structure before release
1048
1048
  // https://contentful.atlassian.net/browse/LUMOS-523
1049
1049
  const ParameterDefinitionSchema = z.object({
1050
- defaultValue: z
1051
- .record(z.string(), z.object({
1052
- sys: z.object({
1053
- type: z.literal('Link'),
1054
- id: z.string(),
1055
- linkType: z.enum(['Entry']),
1050
+ defaultSource: z
1051
+ .strictObject({
1052
+ type: z.enum(['Entry']),
1053
+ contentTypeId: z.string(),
1054
+ link: z.strictObject({
1055
+ sys: z.strictObject({
1056
+ type: z.literal('Link'),
1057
+ id: z.string(),
1058
+ linkType: z.enum(['Entry']),
1059
+ }),
1056
1060
  }),
1057
- }))
1061
+ })
1058
1062
  .optional(),
1059
1063
  contentTypes: z.record(z.string(), z.object({
1060
1064
  sys: z.object({
@@ -4153,9 +4157,11 @@ const attachPrebindingDefaultValueAsDataSource = (experienceEntry) => {
4153
4157
  return;
4154
4158
  }
4155
4159
  const patternDefs = experienceEntry.fields.componentSettings?.parameterDefinitions ?? {};
4156
- const defaultPrebinding = Object.values(patternDefs).find((def) => def.defaultValue)?.defaultValue;
4157
- const [value] = Object.values(defaultPrebinding ?? {});
4158
- const id = value?.sys?.id;
4160
+ const defaultPrebinding = Object.values(patternDefs).find((def) => def.defaultSource)?.defaultSource;
4161
+ const { link, type } = defaultPrebinding ?? {};
4162
+ if (!link || !type)
4163
+ return;
4164
+ const id = link.sys?.id;
4159
4165
  if (!id)
4160
4166
  return;
4161
4167
  experienceEntry.fields.dataSource = {
@@ -4163,7 +4169,7 @@ const attachPrebindingDefaultValueAsDataSource = (experienceEntry) => {
4163
4169
  [id]: {
4164
4170
  sys: {
4165
4171
  type: 'Link',
4166
- linkType: 'Entry',
4172
+ linkType: type,
4167
4173
  id,
4168
4174
  },
4169
4175
  },