@contentful/experiences-core 1.42.0-dev-20250630T1405-f8cda11.0 → 1.42.0-prerelease-20250620T0958-8e54295.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/exports.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export { ASSEMBLY_BLOCK_NODE_TYPE, ASSEMBLY_DEFAULT_CATEGORY, ASSEMBLY_NODE_TYPE, ASSEMBLY_NODE_TYPES, CF_STYLE_ATTRIBUTES, CONTENTFUL_COMPONENTS, CONTENTFUL_COMPONENT_CATEGORY, CONTENTFUL_DEFAULT_CATEGORY, DEFAULT_IMAGE_WIDTH, EMPTY_CONTAINER_HEIGHT, HYPERLINK_DEFAULT_PATTERN, INCOMING_EVENTS, INTERNAL_EVENTS, LATEST_SCHEMA_VERSION, OUTGOING_EVENTS, PATTERN_PROPERTY_DIVIDER, PostMessageMethods, SCROLL_STATES, SUPPORTED_IMAGE_FORMATS, StudioCanvasMode, VISUAL_EDITOR_CONTAINER_ID, VISUAL_EDITOR_EVENTS } from './constants.js';
2
2
  export { AssembliesAddedPayload, AssembliesRegisteredPayload, BackgroundImageAlignmentOption, BackgroundImageOptions, BackgroundImageScalingOption, Binding, BindingMap, BindingMapByBlockId, BoundComponentPropertyTypes, CSSProperties, CanvasErrorPayload, CanvasReloadPayload, CanvasResizedPayload, CanvasScrollPayload, ComponentBinding, ComponentDefinition, ComponentDefinitionVariable, ComponentDefinitionVariableBase, ComponentDefinitionVariableTypeMap, ComponentDefinitionVariableValidation, ComponentDragCanceledPayload, ComponentDragEndedPayload, ComponentDragStartedPayload, ComponentDraggingChangedPayload, ComponentDroppedPayload, ComponentMoveEndedPayload, ComponentMoveStartedPayload, ComponentMovedPayload, ComponentRegistration, ComponentRegistrationOptions, ComponentSelectedPayload, ConnectedPayload, ContainerStyleVariableName, Coordinates, DataSourceEntryValueType, DesignTokensDefinition, DesignTokensPayload, DesignVariableMap, DesignVariableTypes, DragWrapperProps, Experience, ExperienceEntry, ExperienceFields, ExperienceTree, ExperienceTreeNode, ExperienceUpdatedPayload, HoverComponentPayload, HoveredElement, ImageLoadingOption, ImageObjectFitOption, ImageObjectPositionOption, ImageOptions, IncomingComponentDragCanceledPayload, IncomingComponentMoveEndedPayload, IncomingEvent, IncomingMessage, IncomingMouseMovePayload, InternalEvent, Link, ManagementEntity, MouseMovePayload, NewHoveredElementPayload, OptimizedBackgroundImageAsset, OptimizedImageAsset, OutgoingEvent, OutgoingMessage, OutsideCanvasClickPayload, RawCoordinates, RecursiveDesignTokenDefinition, RegisteredBreakpointsPayload, RegisteredComponentsPayload, RequestComponentTreeUpdatePayload, RequestEditorModePayload, RequestEntitiesMessage, RequestEntitiesPayload, RequestReadOnlyModePayload, RequestedEntitiesMessage, RequestedEntitiesPayload, ResolveDesignValueType, SDKFeaturesPayload, ScrollState, SelectComponentPayload, SendMessageParams, StyleProps, UpdateSelectedComponentCoordinatesPayload, UpdatedEntityPayload, ValidationOption, VariableFormats, WrapperTags } from './types.js';
3
- export { BoundValue, Breakpoint, ComponentDefinitionPropertyType as ComponentDefinitionVariableType, ComponentPropertyValue, ComponentTreeNode, ComponentValue, DesignValue, ExperienceComponentSettings, ExperienceDataSource, ExperienceUnboundValues, NoValue, Parameter, ParameterDefinition, PrimitiveValue, SchemaVersions, UnboundValue, ValuesByBreakpoint, VariableMapping } from '@contentful/experiences-validators';
3
+ export { BoundValue, Breakpoint, ComponentDefinitionPropertyType as ComponentDefinitionVariableType, ComponentPropertyValue, ComponentTreeNode, ComponentValue, DesignValue, ExperienceComponentSettings, ExperienceDataSource, ExperienceUnboundValues, NoValue, PatternProperty, PatternPropertyDefinition, PrimitiveValue, SchemaVersions, UnboundValue, ValuesByBreakpoint, VariableMapping } from '@contentful/experiences-validators';
package/dist/index.js CHANGED
@@ -950,11 +950,11 @@ const ComponentPropertyValueSchema = z.discriminatedUnion('type', [
950
950
  ]);
951
951
  // TODO: finalize schema structure before release
952
952
  // https://contentful.atlassian.net/browse/LUMOS-523
953
- const ParameterSchema = z.object({
953
+ const PatternPropertySchema = z.object({
954
954
  type: z.literal('BoundValue'),
955
955
  path: z.string(),
956
956
  });
957
- const ParametersSchema = z.record(propertyKeySchema, ParameterSchema);
957
+ const ParametersSchema = z.record(propertyKeySchema, PatternPropertySchema);
958
958
  const BreakpointSchema = z
959
959
  .object({
960
960
  id: propertyKeySchema,
@@ -1040,30 +1040,21 @@ const THUMBNAIL_IDS = [
1040
1040
  // TODO: finalize schema structure before release
1041
1041
  // https://contentful.atlassian.net/browse/LUMOS-523
1042
1042
  const VariableMappingSchema = z.object({
1043
- parameterId: propertyKeySchema,
1043
+ parameterDefinitionId: propertyKeySchema,
1044
1044
  type: z.literal('ContentTypeMapping'),
1045
1045
  pathsByContentType: z.record(z.string(), z.object({ path: z.string() })),
1046
1046
  });
1047
- const PassToNodeSchema = z
1048
- .object({
1049
- nodeId: propertyKeySchema,
1050
- parameterId: propertyKeySchema,
1051
- prebindingId: propertyKeySchema,
1052
- })
1053
- .strict();
1047
+ // TODO: finalize schema structure before release
1048
+ // https://contentful.atlassian.net/browse/LUMOS-523
1054
1049
  const ParameterDefinitionSchema = z.object({
1055
- defaultSource: z
1056
- .strictObject({
1057
- type: z.enum(['Entry']),
1058
- contentTypeId: z.string(),
1059
- link: z.strictObject({
1060
- sys: z.strictObject({
1061
- type: z.literal('Link'),
1062
- id: z.string(),
1063
- linkType: z.enum(['Entry']),
1064
- }),
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']),
1065
1056
  }),
1066
- })
1057
+ }))
1067
1058
  .optional(),
1068
1059
  contentTypes: z.record(z.string(), z.object({
1069
1060
  sys: z.object({
@@ -1072,28 +1063,18 @@ const ParameterDefinitionSchema = z.object({
1072
1063
  linkType: z.enum(['ContentType']),
1073
1064
  }),
1074
1065
  })),
1075
- passToNodes: z.array(PassToNodeSchema).optional(),
1076
1066
  });
1077
1067
  const ParameterDefinitionsSchema = z.record(propertyKeySchema, ParameterDefinitionSchema);
1078
1068
  const VariableMappingsSchema = z.record(propertyKeySchema, VariableMappingSchema);
1079
1069
  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
1080
1070
  ComponentVariableSchema);
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({
1071
+ const ComponentSettingsSchema = z.object({
1091
1072
  variableDefinitions: ComponentVariablesSchema,
1092
1073
  thumbnailId: z.enum(THUMBNAIL_IDS).optional(),
1093
1074
  category: z.string().max(50, 'Category must contain at most 50 characters').optional(),
1094
- prebindingDefinitions: z.array(PrebindingDefinitionSchema).max(1).optional(),
1095
- })
1096
- .strict();
1075
+ variableMappings: VariableMappingsSchema.optional(),
1076
+ parameterDefinitions: ParameterDefinitionsSchema.optional(),
1077
+ });
1097
1078
  z.object({
1098
1079
  componentTree: localeWrapper(ComponentTreeSchema),
1099
1080
  dataSource: localeWrapper(DataSourceSchema),
@@ -4171,12 +4152,10 @@ const attachPrebindingDefaultValueAsDataSource = (experienceEntry) => {
4171
4152
  // Only supported for pattern entries since experience entries don't define pattern properties.
4172
4153
  return;
4173
4154
  }
4174
- const patternDefs = experienceEntry.fields.componentSettings?.prebindingDefinitions?.[0].parameterDefinitions ?? {};
4175
- const defaultPrebinding = Object.values(patternDefs).find((def) => def.defaultSource)?.defaultSource;
4176
- const { link, type } = defaultPrebinding ?? {};
4177
- if (!link || !type)
4178
- return;
4179
- const id = link.sys?.id;
4155
+ 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;
4180
4159
  if (!id)
4181
4160
  return;
4182
4161
  experienceEntry.fields.dataSource = {
@@ -4184,7 +4163,7 @@ const attachPrebindingDefaultValueAsDataSource = (experienceEntry) => {
4184
4163
  [id]: {
4185
4164
  sys: {
4186
4165
  type: 'Link',
4187
- linkType: type,
4166
+ linkType: 'Entry',
4188
4167
  id,
4189
4168
  },
4190
4169
  },