@contentful/experiences-visual-editor-react 3.8.0-prerelease-20250922T2329-e132272.0 → 3.8.0-prerelease-20251001T1442-021a279.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
@@ -180,7 +180,6 @@ const builtInStyles = {
180
180
  },
181
181
  type: 'Text',
182
182
  group: 'style',
183
- description: 'The vertical alignment of the section',
184
183
  defaultValue: 'center',
185
184
  displayName: 'Vertical alignment',
186
185
  },
@@ -207,7 +206,6 @@ const builtInStyles = {
207
206
  },
208
207
  type: 'Text',
209
208
  group: 'style',
210
- description: 'The horizontal alignment of the section',
211
209
  defaultValue: 'center',
212
210
  displayName: 'Horizontal alignment',
213
211
  },
@@ -216,83 +214,71 @@ const builtInStyles = {
216
214
  type: 'Boolean',
217
215
  group: 'style',
218
216
  defaultValue: true,
219
- description: 'The visibility of the component',
220
217
  },
221
218
  cfMargin: {
222
219
  displayName: 'Margin',
223
220
  type: 'Text',
224
221
  group: 'style',
225
- description: 'The margin of the section',
226
222
  defaultValue: '0 0 0 0',
227
223
  },
228
224
  cfPadding: {
229
225
  displayName: 'Padding',
230
226
  type: 'Text',
231
227
  group: 'style',
232
- description: 'The padding of the section',
233
228
  defaultValue: '0 0 0 0',
234
229
  },
235
230
  cfBackgroundColor: {
236
231
  displayName: 'Background color',
237
232
  type: 'Text',
238
233
  group: 'style',
239
- description: 'The background color of the section',
240
234
  defaultValue: 'rgba(0, 0, 0, 0)',
241
235
  },
242
236
  cfWidth: {
243
237
  displayName: 'Width',
244
238
  type: 'Text',
245
239
  group: 'style',
246
- description: 'The width of the section',
247
240
  defaultValue: '100%',
248
241
  },
249
242
  cfHeight: {
250
243
  displayName: 'Height',
251
244
  type: 'Text',
252
245
  group: 'style',
253
- description: 'The height of the section',
254
246
  defaultValue: 'fit-content',
255
247
  },
256
248
  cfMaxWidth: {
257
249
  displayName: 'Max width',
258
250
  type: 'Text',
259
251
  group: 'style',
260
- description: 'The max-width of the section',
261
252
  defaultValue: 'none',
262
253
  },
263
254
  cfFlexDirection: {
264
255
  displayName: 'Direction',
265
256
  type: 'Text',
266
257
  group: 'style',
267
- description: 'The orientation of the section',
268
258
  defaultValue: 'column',
269
259
  },
270
260
  cfFlexReverse: {
271
261
  displayName: 'Reverse Direction',
272
262
  type: 'Boolean',
273
263
  group: 'style',
274
- description: 'Toggle the flex direction to be reversed',
275
264
  defaultValue: false,
276
265
  },
277
266
  cfFlexWrap: {
278
267
  displayName: 'Wrap objects',
279
268
  type: 'Text',
280
269
  group: 'style',
281
- description: 'Wrap objects',
282
270
  defaultValue: 'nowrap',
283
271
  },
284
272
  cfBorder: {
285
273
  displayName: 'Border',
286
274
  type: 'Text',
287
275
  group: 'style',
288
- description: 'The border of the section',
289
276
  defaultValue: '0px solid rgba(0, 0, 0, 0)',
290
277
  },
291
278
  cfGap: {
292
279
  displayName: 'Gap',
293
280
  type: 'Text',
294
281
  group: 'style',
295
- description: 'The spacing between the elements of the section',
296
282
  defaultValue: '0px',
297
283
  },
298
284
  cfHyperlink: {
@@ -303,7 +289,6 @@ const builtInStyles = {
303
289
  format: 'URL',
304
290
  bindingSourceType: ['entry', 'experience', 'manual'],
305
291
  },
306
- description: 'hyperlink for section or container',
307
292
  },
308
293
  cfOpenInNewTab: {
309
294
  displayName: 'URL behaviour',
@@ -317,7 +302,6 @@ const optionalBuiltInStyles = {
317
302
  displayName: 'Font Size',
318
303
  type: 'Text',
319
304
  group: 'style',
320
- description: 'The font size of the element',
321
305
  defaultValue: '16px',
322
306
  },
323
307
  cfFontWeight: {
@@ -340,13 +324,11 @@ const optionalBuiltInStyles = {
340
324
  displayName: 'Font Weight',
341
325
  type: 'Text',
342
326
  group: 'style',
343
- description: 'The font weight of the element',
344
327
  defaultValue: '400',
345
328
  },
346
329
  cfImageAsset: {
347
330
  displayName: 'Image',
348
331
  type: 'Media',
349
- description: 'Image to display',
350
332
  validations: {
351
333
  bindingSourceType: ['asset', 'entry', 'manual'],
352
334
  },
@@ -365,13 +347,11 @@ const optionalBuiltInStyles = {
365
347
  displayName: 'Background color',
366
348
  type: 'Text',
367
349
  group: 'style',
368
- description: 'The background color of the element',
369
350
  defaultValue: 'rgba(0, 0, 0, 0)',
370
351
  },
371
352
  cfBackgroundImageUrl: {
372
353
  displayName: 'Background image',
373
354
  type: 'Media',
374
- description: 'Background image for component',
375
355
  validations: {
376
356
  bindingSourceType: ['asset', 'entry', 'manual'],
377
357
  },
@@ -390,28 +370,24 @@ const optionalBuiltInStyles = {
390
370
  displayName: 'Border Radius',
391
371
  type: 'Text',
392
372
  group: 'style',
393
- description: 'The border radius of the section',
394
373
  defaultValue: '0px',
395
374
  },
396
375
  cfLineHeight: {
397
376
  displayName: 'Line Height',
398
377
  type: 'Text',
399
378
  group: 'style',
400
- description: 'The line height of the element',
401
379
  defaultValue: '20px',
402
380
  },
403
381
  cfLetterSpacing: {
404
382
  displayName: 'Letter Spacing',
405
383
  type: 'Text',
406
384
  group: 'style',
407
- description: 'The letter spacing of the element',
408
385
  defaultValue: '0px',
409
386
  },
410
387
  cfTextColor: {
411
388
  displayName: 'Text Color',
412
389
  type: 'Text',
413
390
  group: 'style',
414
- description: 'The text color of the element',
415
391
  defaultValue: 'rgba(0, 0, 0, 1)',
416
392
  },
417
393
  cfTextAlign: {
@@ -434,7 +410,6 @@ const optionalBuiltInStyles = {
434
410
  displayName: 'Text Align',
435
411
  type: 'Text',
436
412
  group: 'style',
437
- description: 'The text alignment of the element',
438
413
  defaultValue: 'start',
439
414
  },
440
415
  cfTextTransform: {
@@ -461,28 +436,24 @@ const optionalBuiltInStyles = {
461
436
  displayName: 'Text Transform',
462
437
  type: 'Text',
463
438
  group: 'style',
464
- description: 'The text transform of the element',
465
439
  defaultValue: 'none',
466
440
  },
467
441
  cfTextBold: {
468
442
  displayName: 'Bold',
469
443
  type: 'Boolean',
470
444
  group: 'style',
471
- description: 'The text bold of the element',
472
445
  defaultValue: false,
473
446
  },
474
447
  cfTextItalic: {
475
448
  displayName: 'Italic',
476
449
  type: 'Boolean',
477
450
  group: 'style',
478
- description: 'The text italic of the element',
479
451
  defaultValue: false,
480
452
  },
481
453
  cfTextUnderline: {
482
454
  displayName: 'Underline',
483
455
  type: 'Boolean',
484
456
  group: 'style',
485
- description: 'The text underline of the element',
486
457
  defaultValue: false,
487
458
  },
488
459
  };
@@ -796,18 +767,15 @@ const ComponentVariableSchema$1 = z.object({
796
767
  const ComponentTreeNodeSchema$1 = BaseComponentTreeNodeSchema$1.extend({
797
768
  children: z.lazy(() => ComponentTreeNodeSchema$1.array()),
798
769
  }).superRefine(({ id, prebindingId, parameters }, ctx) => {
770
+ // We don't fail if parameters are present but prebindingId is not because
771
+ // older experiences (updated before 21-09-2025) always included parameters
772
+ // and they will start failing if we do.
799
773
  if (prebindingId && !parameters) {
800
774
  ctx.addIssue({
801
775
  code: z.ZodIssueCode.custom,
802
776
  message: `Found "prebindingId" but no "parameters" for node with id: "${id}"`,
803
777
  });
804
778
  }
805
- if (parameters && !prebindingId) {
806
- ctx.addIssue({
807
- code: z.ZodIssueCode.custom,
808
- message: `Found "parameters" but no "prebindingId" for node with id: "${id}"`,
809
- });
810
- }
811
779
  });
812
780
  const ComponentTreeSchema$1 = z
813
781
  .object({
@@ -911,7 +879,6 @@ const ParameterDefinitionSchema$1 = z.object({
911
879
  passToNodes: z
912
880
  .array(PassToNodeSchema$1)
913
881
  .max(1, 'At most one "passToNodes" element is allowed per parameter definition.'),
914
- // we might change this to be empty array for native parameter definitions, that's why we don't use .length(1)
915
882
  });
916
883
  const ParameterDefinitionsSchema$1 = z.record(propertyKeySchema$1, ParameterDefinitionSchema$1);
917
884
  const VariableMappingsSchema$1 = z.record(propertyKeySchema$1, VariableMappingSchema$1);
@@ -1563,6 +1530,9 @@ const getPrebindingPathBySourceEntry = (preboundValueProperty, getHeadEntityByDa
1563
1530
  return undefined;
1564
1531
  }
1565
1532
  const contentTypeId = headEntity.sys.contentType.sys.id;
1533
+ if (!preboundValueProperty.pathsByContentType?.[contentTypeId]) {
1534
+ return undefined;
1535
+ }
1566
1536
  return preboundValueProperty.pathsByContentType?.[contentTypeId]?.path;
1567
1537
  };
1568
1538
  const parseDeepPath$1 = (deepPathCandidate) => {
@@ -4047,18 +4017,15 @@ const ComponentVariableSchema = z.object({
4047
4017
  const ComponentTreeNodeSchema = BaseComponentTreeNodeSchema.extend({
4048
4018
  children: z.lazy(() => ComponentTreeNodeSchema.array()),
4049
4019
  }).superRefine(({ id, prebindingId, parameters }, ctx) => {
4020
+ // We don't fail if parameters are present but prebindingId is not because
4021
+ // older experiences (updated before 21-09-2025) always included parameters
4022
+ // and they will start failing if we do.
4050
4023
  if (prebindingId && !parameters) {
4051
4024
  ctx.addIssue({
4052
4025
  code: z.ZodIssueCode.custom,
4053
4026
  message: `Found "prebindingId" but no "parameters" for node with id: "${id}"`,
4054
4027
  });
4055
4028
  }
4056
- if (parameters && !prebindingId) {
4057
- ctx.addIssue({
4058
- code: z.ZodIssueCode.custom,
4059
- message: `Found "parameters" but no "prebindingId" for node with id: "${id}"`,
4060
- });
4061
- }
4062
4029
  });
4063
4030
  const ComponentTreeSchema = z
4064
4031
  .object({
@@ -4162,7 +4129,6 @@ const ParameterDefinitionSchema = z.object({
4162
4129
  passToNodes: z
4163
4130
  .array(PassToNodeSchema)
4164
4131
  .max(1, 'At most one "passToNodes" element is allowed per parameter definition.'),
4165
- // we might change this to be empty array for native parameter definitions, that's why we don't use .length(1)
4166
4132
  });
4167
4133
  const ParameterDefinitionsSchema = z.record(propertyKeySchema, ParameterDefinitionSchema);
4168
4134
  const VariableMappingsSchema = z.record(propertyKeySchema, VariableMappingSchema);
@@ -5140,14 +5106,28 @@ const useComponentProps = ({ node, entityStore, areEntitiesFetched, resolveDesig
5140
5106
  // eg: "/uuid" vs "/uuid/fields/[fileName]/~locale" as the regular BoundValue would have
5141
5107
  const [, uuid, maybePath] = variableMapping.path.split('/');
5142
5108
  const link = dataSource[uuid];
5143
- let boundValue;
5144
5109
  // starting from here, if the prop is of type 'BoundValue', and has prebinding
5145
5110
  // we are going to resolve the incomplete path
5111
+ let boundValue;
5112
+ // TODO: Temporary fix while we look into SPA-3212 it occurs where we have prebound props but data source link is missing
5113
+ // this only occurs after live updates of nested patterns.
5114
+ if (!link && isPreboundProp(variableMapping) && variableMapping.isPrebound) {
5115
+ return {
5116
+ ...acc,
5117
+ [variableName]: variableDefinition.defaultValue,
5118
+ };
5119
+ }
5146
5120
  if (link && isPreboundProp(variableMapping) && variableMapping.isPrebound) {
5147
5121
  const prebindingPath = getPrebindingPathBySourceEntry(variableMapping, (dataSourceKey) => {
5148
5122
  const link = dataSource[dataSourceKey];
5149
5123
  return entityStore.getEntityFromLink(link);
5150
- }) ?? variableMapping.path;
5124
+ });
5125
+ if (!prebindingPath) {
5126
+ return {
5127
+ ...acc,
5128
+ [variableName]: variableDefinition.defaultValue,
5129
+ };
5130
+ }
5151
5131
  // this allows us to resolve it regularly
5152
5132
  boundValue = transformBoundContentValue(node.data.props, entityStore, link, resolveDesignValue, variableName, variableDefinition.type, prebindingPath);
5153
5133
  }