@contentful/experiences-visual-editor-react 1.13.0-dev-20240904T1932-dfa83dd.0 → 1.13.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
@@ -1428,7 +1428,7 @@ const getValueForBreakpoint = (valuesByBreakpoint, breakpoints, activeBreakpoint
1428
1428
  if (valuesByBreakpoint instanceof Object) {
1429
1429
  // Assume that the values are sorted by media query to apply the cascading CSS logic
1430
1430
  for (let index = activeBreakpointIndex; index >= 0; index--) {
1431
- const breakpointId = breakpoints[index].id;
1431
+ const breakpointId = breakpoints[index]?.id;
1432
1432
  if (valuesByBreakpoint[breakpointId]) {
1433
1433
  // If the value is defined, we use it and stop the breakpoints cascade
1434
1434
  return eventuallyResolveDesignTokens(valuesByBreakpoint[breakpointId]);
@@ -1436,8 +1436,10 @@ const getValueForBreakpoint = (valuesByBreakpoint, breakpoints, activeBreakpoint
1436
1436
  }
1437
1437
  // If no breakpoint matched, we search and apply the fallback breakpoint
1438
1438
  const fallbackBreakpointIndex = getFallbackBreakpointIndex(breakpoints);
1439
- const fallbackBreakpointId = breakpoints[fallbackBreakpointIndex].id;
1440
- return eventuallyResolveDesignTokens(valuesByBreakpoint[fallbackBreakpointId]);
1439
+ const fallbackBreakpointId = breakpoints[fallbackBreakpointIndex]?.id;
1440
+ if (valuesByBreakpoint[fallbackBreakpointId]) {
1441
+ return eventuallyResolveDesignTokens(valuesByBreakpoint[fallbackBreakpointId]);
1442
+ }
1441
1443
  }
1442
1444
  else {
1443
1445
  // Old design properties did not support breakpoints, keep for backward compatibility