@contentful/experiences-components-react 3.7.2-dev-20250924T1519-77d453c.0 → 3.8.0-beta.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/index.js +13 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1288,7 +1288,7 @@ const BREAKPOINT_QUERY_REGEX = /^\*$|^[<>][0-9]+px$/;
|
|
|
1288
1288
|
const BreakpointSchema = z
|
|
1289
1289
|
.object({
|
|
1290
1290
|
id: propertyKeySchema,
|
|
1291
|
-
// Can be
|
|
1291
|
+
// Can be replaced with z.templateLiteral when upgrading to zod v4
|
|
1292
1292
|
query: z.string().refine((s) => BREAKPOINT_QUERY_REGEX.test(s)),
|
|
1293
1293
|
previewSize: z.string().optional(),
|
|
1294
1294
|
displayName: z.string(),
|
|
@@ -1327,6 +1327,16 @@ const ComponentVariableSchema = z.object({
|
|
|
1327
1327
|
});
|
|
1328
1328
|
const ComponentTreeNodeSchema = BaseComponentTreeNodeSchema.extend({
|
|
1329
1329
|
children: z.lazy(() => ComponentTreeNodeSchema.array()),
|
|
1330
|
+
}).superRefine(({ id, prebindingId, parameters }, ctx) => {
|
|
1331
|
+
// We don't fail if parameters are present but prebindingId is not because
|
|
1332
|
+
// older experiences (updated before 21-09-2025) always included parameters
|
|
1333
|
+
// and they will start failing if we do.
|
|
1334
|
+
if (prebindingId && !parameters) {
|
|
1335
|
+
ctx.addIssue({
|
|
1336
|
+
code: z.ZodIssueCode.custom,
|
|
1337
|
+
message: `Found "prebindingId" but no "parameters" for node with id: "${id}"`,
|
|
1338
|
+
});
|
|
1339
|
+
}
|
|
1330
1340
|
});
|
|
1331
1341
|
const ComponentTreeSchema = z
|
|
1332
1342
|
.object({
|
|
@@ -1429,8 +1439,7 @@ const ParameterDefinitionSchema = z.object({
|
|
|
1429
1439
|
contentTypes: z.array(z.string()).min(1),
|
|
1430
1440
|
passToNodes: z
|
|
1431
1441
|
.array(PassToNodeSchema)
|
|
1432
|
-
.max(1, 'At most one "passToNodes" element is allowed per parameter definition.')
|
|
1433
|
-
.optional(), // we might change this to be empty array for native parameter definitions, that's why we don't use .length(1)
|
|
1442
|
+
.max(1, 'At most one "passToNodes" element is allowed per parameter definition.'),
|
|
1434
1443
|
});
|
|
1435
1444
|
const ParameterDefinitionsSchema = z.record(propertyKeySchema, ParameterDefinitionSchema);
|
|
1436
1445
|
const VariableMappingsSchema = z.record(propertyKeySchema, VariableMappingSchema);
|
|
@@ -1532,7 +1541,7 @@ const validatePassToNodes = (rootChildren, componentSettings, ctx) => {
|
|
|
1532
1541
|
return;
|
|
1533
1542
|
}
|
|
1534
1543
|
const { parameterDefinitions } = componentSettings.prebindingDefinitions[0];
|
|
1535
|
-
|
|
1544
|
+
const nodeIds = new Set();
|
|
1536
1545
|
for (const paramDef of Object.values(parameterDefinitions || {})) {
|
|
1537
1546
|
paramDef.passToNodes?.forEach((n) => nodeIds.add(n.nodeId));
|
|
1538
1547
|
}
|