@contentful/experiences-visual-editor-react 1.31.1-prerelease-20250218T2104-febb4f2.0 → 1.31.1

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/renderApp.js CHANGED
@@ -43547,14 +43547,14 @@ const ComponentValueSchema$1 = z
43547
43547
  .strict();
43548
43548
  // TODO: finalize schema structure before release
43549
43549
  // https://contentful.atlassian.net/browse/LUMOS-523
43550
- const NoValueSchema$1 = z.object({ type: z.literal('NoValue') }).strict();
43550
+ const EmptyObjectSchema$1 = z.object({ type: z.undefined() });
43551
43551
  const ComponentPropertyValueSchema$1 = z.discriminatedUnion('type', [
43552
43552
  DesignValueSchema$1,
43553
43553
  BoundValueSchema$1,
43554
43554
  UnboundValueSchema$1,
43555
43555
  HyperlinkValueSchema$1,
43556
43556
  ComponentValueSchema$1,
43557
- NoValueSchema$1,
43557
+ EmptyObjectSchema$1,
43558
43558
  ]);
43559
43559
  // TODO: finalize schema structure before release
43560
43560
  // https://contentful.atlassian.net/browse/LUMOS-523
@@ -43567,12 +43567,13 @@ const VariableMappingsSchema$1 = z.record(propertyKeySchema$1, VariableMappingSc
43567
43567
  // TODO: finalize schema structure before release
43568
43568
  // https://contentful.atlassian.net/browse/LUMOS-523
43569
43569
  const PatternPropertyDefinitionSchema$1 = z.object({
43570
- defaultValue: z
43571
- .object({
43572
- path: z.string(),
43573
- type: z.literal('BoundValue'),
43574
- })
43575
- .optional(),
43570
+ defaultValue: z.union([
43571
+ z.object({
43572
+ path: z.string(),
43573
+ type: z.literal('BoundValue'),
43574
+ }),
43575
+ z.null(),
43576
+ ]),
43576
43577
  contentTypes: z.record(z.string(), z.any()),
43577
43578
  });
43578
43579
  const PatternPropertyDefinitionsSchema$1 = z.record(propertyKeySchema$1, PatternPropertyDefinitionSchema$1);
@@ -43635,8 +43636,33 @@ const ComponentVariableSchema$1 = z.object({
43635
43636
  });
43636
43637
  const ComponentVariablesSchema$1 = 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
43637
43638
  ComponentVariableSchema$1);
43639
+ const THUMBNAIL_IDS$1 = [
43640
+ 'columns',
43641
+ 'columnsPlusRight',
43642
+ 'imagesSquare',
43643
+ 'subtitles',
43644
+ 'rowsPlusBottom',
43645
+ 'userRectangle',
43646
+ 'textbox',
43647
+ 'monitorPlay',
43648
+ 'article',
43649
+ 'table',
43650
+ 'star',
43651
+ 'heartStraight',
43652
+ 'frameCorners',
43653
+ 'rows',
43654
+ 'dotsThreeOutline',
43655
+ 'listDashes',
43656
+ 'checkerBoard',
43657
+ 'gridFour',
43658
+ 'slideshow',
43659
+ 'diamondsFour',
43660
+ 'cards',
43661
+ 'textColumns',
43662
+ ];
43638
43663
  const ComponentSettingsSchema$1 = z.object({
43639
43664
  variableDefinitions: ComponentVariablesSchema$1,
43665
+ thumbnailId: z.enum(THUMBNAIL_IDS$1).optional(),
43640
43666
  variableMappings: VariableMappingsSchema$1.optional(),
43641
43667
  patternPropertyDefinitions: PatternPropertyDefinitionsSchema$1.optional(),
43642
43668
  });
@@ -44119,11 +44145,11 @@ function getArrayValue(entryOrAsset, path, entityStore) {
44119
44145
  return result;
44120
44146
  }
44121
44147
 
44122
- const transformBoundContentValue = (variables, entityStore, binding, resolveDesignValue, variableName, variableDefinition, path) => {
44148
+ const transformBoundContentValue = (variables, entityStore, binding, resolveDesignValue, variableName, variableType, path) => {
44123
44149
  const entityOrAsset = entityStore.getEntryOrAsset(binding, path);
44124
44150
  if (!entityOrAsset)
44125
44151
  return;
44126
- switch (variableDefinition.type) {
44152
+ switch (variableType) {
44127
44153
  case 'Media':
44128
44154
  // If we bound a normal entry field to the media variable we just return the bound value
44129
44155
  if (entityOrAsset.sys.type === 'Entry') {
@@ -56681,12 +56707,11 @@ styleInject(css_248z$9);
56681
56707
  * and then decending by screen width. For mobile-first designs, the order would be ascending
56682
56708
  */
56683
56709
  const useBreakpoints = (breakpoints) => {
56684
- const [mediaQueryMatches, setMediaQueryMatches] = reactExports.useState({});
56710
+ const [, initialMediaQueryMatches] = mediaQueryMatcher(breakpoints);
56711
+ const [mediaQueryMatches, setMediaQueryMatches] = reactExports.useState(initialMediaQueryMatches);
56685
56712
  // Register event listeners to update the media query states
56686
56713
  reactExports.useEffect(() => {
56687
- const [mediaQueryMatchers, initialMediaQueryMatches] = mediaQueryMatcher(breakpoints);
56688
- // Store the media query state in the beginning to initialise the state
56689
- setMediaQueryMatches(initialMediaQueryMatches);
56714
+ const [mediaQueryMatchers] = mediaQueryMatcher(breakpoints);
56690
56715
  const eventListeners = mediaQueryMatchers.map(({ id, signal }) => {
56691
56716
  const onChange = () => setMediaQueryMatches((prev) => ({
56692
56717
  ...prev,
@@ -56700,8 +56725,6 @@ const useBreakpoints = (breakpoints) => {
56700
56725
  mediaQueryMatchers[index].signal.removeEventListener('change', eventListener);
56701
56726
  });
56702
56727
  };
56703
- // Only re-setup all listeners when the breakpoint definition changed
56704
- // eslint-disable-next-line react-hooks/exhaustive-deps
56705
56728
  }, [breakpoints]);
56706
56729
  const resolveDesignValue = reactExports.useCallback((valuesByBreakpoint, variableName) => {
56707
56730
  const fallbackBreakpointIndex = getFallbackBreakpointIndex(breakpoints);
@@ -58249,14 +58272,14 @@ const ComponentValueSchema = z
58249
58272
  .strict();
58250
58273
  // TODO: finalize schema structure before release
58251
58274
  // https://contentful.atlassian.net/browse/LUMOS-523
58252
- const NoValueSchema = z.object({ type: z.literal('NoValue') }).strict();
58275
+ const EmptyObjectSchema = z.object({ type: z.undefined() });
58253
58276
  const ComponentPropertyValueSchema = z.discriminatedUnion('type', [
58254
58277
  DesignValueSchema,
58255
58278
  BoundValueSchema,
58256
58279
  UnboundValueSchema,
58257
58280
  HyperlinkValueSchema,
58258
58281
  ComponentValueSchema,
58259
- NoValueSchema,
58282
+ EmptyObjectSchema,
58260
58283
  ]);
58261
58284
  // TODO: finalize schema structure before release
58262
58285
  // https://contentful.atlassian.net/browse/LUMOS-523
@@ -58269,12 +58292,13 @@ const VariableMappingsSchema = z.record(propertyKeySchema, VariableMappingSchema
58269
58292
  // TODO: finalize schema structure before release
58270
58293
  // https://contentful.atlassian.net/browse/LUMOS-523
58271
58294
  const PatternPropertyDefinitionSchema = z.object({
58272
- defaultValue: z
58273
- .object({
58274
- path: z.string(),
58275
- type: z.literal('BoundValue'),
58276
- })
58277
- .optional(),
58295
+ defaultValue: z.union([
58296
+ z.object({
58297
+ path: z.string(),
58298
+ type: z.literal('BoundValue'),
58299
+ }),
58300
+ z.null(),
58301
+ ]),
58278
58302
  contentTypes: z.record(z.string(), z.any()),
58279
58303
  });
58280
58304
  const PatternPropertyDefinitionsSchema = z.record(propertyKeySchema, PatternPropertyDefinitionSchema);
@@ -58337,8 +58361,33 @@ const ComponentVariableSchema = z.object({
58337
58361
  });
58338
58362
  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
58339
58363
  ComponentVariableSchema);
58364
+ const THUMBNAIL_IDS = [
58365
+ 'columns',
58366
+ 'columnsPlusRight',
58367
+ 'imagesSquare',
58368
+ 'subtitles',
58369
+ 'rowsPlusBottom',
58370
+ 'userRectangle',
58371
+ 'textbox',
58372
+ 'monitorPlay',
58373
+ 'article',
58374
+ 'table',
58375
+ 'star',
58376
+ 'heartStraight',
58377
+ 'frameCorners',
58378
+ 'rows',
58379
+ 'dotsThreeOutline',
58380
+ 'listDashes',
58381
+ 'checkerBoard',
58382
+ 'gridFour',
58383
+ 'slideshow',
58384
+ 'diamondsFour',
58385
+ 'cards',
58386
+ 'textColumns',
58387
+ ];
58340
58388
  const ComponentSettingsSchema = z.object({
58341
58389
  variableDefinitions: ComponentVariablesSchema,
58390
+ thumbnailId: z.enum(THUMBNAIL_IDS).optional(),
58342
58391
  variableMappings: VariableMappingsSchema.optional(),
58343
58392
  patternPropertyDefinitions: PatternPropertyDefinitionsSchema.optional(),
58344
58393
  });
@@ -59451,7 +59500,7 @@ const useComponentProps = ({ node, areEntitiesFetched, resolveDesignValue, rende
59451
59500
  const [, uuid, path] = variableMapping.path.split('/');
59452
59501
  const binding = dataSource[uuid];
59453
59502
  const variableDefinition = definition.variables[variableName];
59454
- let boundValue = transformBoundContentValue(node.data.props, entityStore, binding, resolveDesignValue, variableName, variableDefinition, variableMapping.path);
59503
+ let boundValue = transformBoundContentValue(node.data.props, entityStore, binding, resolveDesignValue, variableName, variableDefinition.type, variableMapping.path);
59455
59504
  // In some cases, there may be an asset linked in the path, so we need to consider this scenario:
59456
59505
  // If no 'boundValue' is found, we also attempt to extract the value associated with the second-to-last item in the path.
59457
59506
  // If successful, it means we have identified the linked asset.
@@ -60249,7 +60298,7 @@ function useSingleColumn(node, resolveDesignValue) {
60249
60298
  return { isWrapped, wrapColumnsCount };
60250
60299
  }
60251
60300
  const parentNode = getItem({ id: node.parentId }, tree);
60252
- if (!parentNode) {
60301
+ if (!parentNode || parentNode.data.blockId !== CONTENTFUL_COMPONENTS$1.columns.id) {
60253
60302
  return { isWrapped, wrapColumnsCount };
60254
60303
  }
60255
60304
  const { cfWrapColumns, cfWrapColumnsCount } = parentNode.data.props;