@contentful/experiences-core 1.31.0 → 1.31.1-prerelease-20250218T2104-febb4f2.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
@@ -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 EmptyObjectSchema = z.object({ type: z.undefined() });
1158
+ const NoValueSchema = z.object({ type: z.literal('NoValue') }).strict();
1159
1159
  const ComponentPropertyValueSchema = z.discriminatedUnion('type', [
1160
1160
  DesignValueSchema,
1161
1161
  BoundValueSchema,
1162
1162
  UnboundValueSchema,
1163
1163
  HyperlinkValueSchema,
1164
1164
  ComponentValueSchema,
1165
- EmptyObjectSchema,
1165
+ NoValueSchema,
1166
1166
  ]);
1167
1167
  // TODO: finalize schema structure before release
1168
1168
  // https://contentful.atlassian.net/browse/LUMOS-523
@@ -1175,13 +1175,12 @@ 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.union([
1179
- z.object({
1180
- path: z.string(),
1181
- type: z.literal('BoundValue'),
1182
- }),
1183
- z.null(),
1184
- ]),
1178
+ defaultValue: z
1179
+ .object({
1180
+ path: z.string(),
1181
+ type: z.literal('BoundValue'),
1182
+ })
1183
+ .optional(),
1185
1184
  contentTypes: z.record(z.string(), z.any()),
1186
1185
  });
1187
1186
  const PatternPropertyDefinitionsSchema = z.record(propertyKeySchema, PatternPropertyDefinitionSchema);
@@ -2627,7 +2626,7 @@ const builtInStylesWithDesignTokens = [
2627
2626
  const isValidBreakpointValue = (value) => {
2628
2627
  return value !== undefined && value !== null && value !== '';
2629
2628
  };
2630
- const getValueForBreakpoint = (valuesByBreakpoint, breakpoints, activeBreakpointIndex, variableName, resolveDesignTokens = true) => {
2629
+ const getValueForBreakpoint = (valuesByBreakpoint, breakpoints, activeBreakpointIndex, fallbackBreakpointIndex, variableName, resolveDesignTokens = true) => {
2631
2630
  const eventuallyResolveDesignTokens = (value) => {
2632
2631
  // For some built-in design properties, we support design tokens
2633
2632
  if (builtInStylesWithDesignTokens.includes(variableName)) {
@@ -2648,8 +2647,6 @@ const getValueForBreakpoint = (valuesByBreakpoint, breakpoints, activeBreakpoint
2648
2647
  return valuesByBreakpoint[breakpointId];
2649
2648
  }
2650
2649
  }
2651
- // If no breakpoint matched, we search and apply the fallback breakpoint
2652
- const fallbackBreakpointIndex = getFallbackBreakpointIndex(breakpoints);
2653
2650
  const fallbackBreakpointId = breakpoints[fallbackBreakpointIndex]?.id;
2654
2651
  if (isValidBreakpointValue(valuesByBreakpoint[fallbackBreakpointId])) {
2655
2652
  if (resolveDesignTokens) {