@contentful/experiences-core 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/entity/EntityStore.d.ts +5 -5
- package/dist/index.cjs +18 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -9
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -949,7 +949,7 @@ const BREAKPOINT_QUERY_REGEX = /^\*$|^[<>][0-9]+px$/;
|
|
|
949
949
|
const BreakpointSchema = z
|
|
950
950
|
.object({
|
|
951
951
|
id: propertyKeySchema,
|
|
952
|
-
// Can be
|
|
952
|
+
// Can be replaced with z.templateLiteral when upgrading to zod v4
|
|
953
953
|
query: z.string().refine((s) => BREAKPOINT_QUERY_REGEX.test(s)),
|
|
954
954
|
previewSize: z.string().optional(),
|
|
955
955
|
displayName: z.string(),
|
|
@@ -988,6 +988,16 @@ const ComponentVariableSchema = z.object({
|
|
|
988
988
|
});
|
|
989
989
|
const ComponentTreeNodeSchema = BaseComponentTreeNodeSchema.extend({
|
|
990
990
|
children: z.lazy(() => ComponentTreeNodeSchema.array()),
|
|
991
|
+
}).superRefine(({ id, prebindingId, parameters }, ctx) => {
|
|
992
|
+
// We don't fail if parameters are present but prebindingId is not because
|
|
993
|
+
// older experiences (updated before 21-09-2025) always included parameters
|
|
994
|
+
// and they will start failing if we do.
|
|
995
|
+
if (prebindingId && !parameters) {
|
|
996
|
+
ctx.addIssue({
|
|
997
|
+
code: z.ZodIssueCode.custom,
|
|
998
|
+
message: `Found "prebindingId" but no "parameters" for node with id: "${id}"`,
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
991
1001
|
});
|
|
992
1002
|
const ComponentTreeSchema = z
|
|
993
1003
|
.object({
|
|
@@ -1090,8 +1100,7 @@ const ParameterDefinitionSchema = z.object({
|
|
|
1090
1100
|
contentTypes: z.array(z.string()).min(1),
|
|
1091
1101
|
passToNodes: z
|
|
1092
1102
|
.array(PassToNodeSchema)
|
|
1093
|
-
.max(1, 'At most one "passToNodes" element is allowed per parameter definition.')
|
|
1094
|
-
.optional(), // we might change this to be empty array for native parameter definitions, that's why we don't use .length(1)
|
|
1103
|
+
.max(1, 'At most one "passToNodes" element is allowed per parameter definition.'),
|
|
1095
1104
|
});
|
|
1096
1105
|
const ParameterDefinitionsSchema = z.record(propertyKeySchema, ParameterDefinitionSchema);
|
|
1097
1106
|
const VariableMappingsSchema = z.record(propertyKeySchema, VariableMappingSchema);
|
|
@@ -1193,7 +1202,7 @@ const validatePassToNodes = (rootChildren, componentSettings, ctx) => {
|
|
|
1193
1202
|
return;
|
|
1194
1203
|
}
|
|
1195
1204
|
const { parameterDefinitions } = componentSettings.prebindingDefinitions[0];
|
|
1196
|
-
|
|
1205
|
+
const nodeIds = new Set();
|
|
1197
1206
|
for (const paramDef of Object.values(parameterDefinitions || {})) {
|
|
1198
1207
|
paramDef.passToNodes?.forEach((n) => nodeIds.add(n.nodeId));
|
|
1199
1208
|
}
|
|
@@ -2217,7 +2226,7 @@ const transformTextAlign = (value) => {
|
|
|
2217
2226
|
return undefined;
|
|
2218
2227
|
const sdkOptions = getSdkOptions();
|
|
2219
2228
|
// New behavior: translate left/right to start/end
|
|
2220
|
-
// Customer can opt
|
|
2229
|
+
// Customer can opt out by activating this global option toggle
|
|
2221
2230
|
if (!sdkOptions.__disableTextAlignmentTransform) {
|
|
2222
2231
|
if (value === 'left')
|
|
2223
2232
|
return 'start';
|
|
@@ -3669,7 +3678,7 @@ const extractPrebindingDataByPatternId = (patterns) => {
|
|
|
3669
3678
|
const [prebindingDefinition] = pattern.fields.componentSettings?.prebindingDefinitions ?? [];
|
|
3670
3679
|
if (!prebindingDefinition)
|
|
3671
3680
|
continue;
|
|
3672
|
-
const [nativeParameterId] = Object.entries(prebindingDefinition.parameterDefinitions ?? {}).find(([, value]) => value.passToNodes
|
|
3681
|
+
const [nativeParameterId] = Object.entries(prebindingDefinition.parameterDefinitions ?? {}).find(([, value]) => !value.passToNodes?.length) ?? [];
|
|
3673
3682
|
const prebindingData = {
|
|
3674
3683
|
prebindingDefinitionId: prebindingDefinition.id,
|
|
3675
3684
|
parameterIds: Object.keys(prebindingDefinition.parameterDefinitions),
|
|
@@ -3717,7 +3726,7 @@ function getTargetPatternMappingsForParameter({ fetchedPatterns, prebindingDataB
|
|
|
3717
3726
|
}
|
|
3718
3727
|
else {
|
|
3719
3728
|
const parameterDefinition = patternPrebindingData.parameterDefinitions[parameterId];
|
|
3720
|
-
if (!parameterDefinition || !parameterDefinition.passToNodes)
|
|
3729
|
+
if (!parameterDefinition || !parameterDefinition.passToNodes?.length)
|
|
3721
3730
|
return undefined;
|
|
3722
3731
|
const patternEntry = fetchedPatterns.find((entry) => entry.sys.id === patternNodeDefinitionId);
|
|
3723
3732
|
if (!patternEntry)
|
|
@@ -3728,7 +3737,7 @@ function getTargetPatternMappingsForParameter({ fetchedPatterns, prebindingDataB
|
|
|
3728
3737
|
parameters: {},
|
|
3729
3738
|
children: patternEntry.fields.componentTree.children,
|
|
3730
3739
|
}, (node) => {
|
|
3731
|
-
if (node.id === parameterDefinition.passToNodes?.[0]
|
|
3740
|
+
if (node.id === parameterDefinition.passToNodes?.[0]?.nodeId) {
|
|
3732
3741
|
nestedPatternNode = node;
|
|
3733
3742
|
}
|
|
3734
3743
|
return undefined;
|
|
@@ -3740,7 +3749,7 @@ function getTargetPatternMappingsForParameter({ fetchedPatterns, prebindingDataB
|
|
|
3740
3749
|
fetchedPatterns,
|
|
3741
3750
|
prebindingDataByPatternId,
|
|
3742
3751
|
patternNodeDefinitionId: nestedPatternNode.definitionId,
|
|
3743
|
-
parameterId: parameterDefinition.passToNodes?.[0]
|
|
3752
|
+
parameterId: parameterDefinition.passToNodes?.[0]?.parameterId,
|
|
3744
3753
|
});
|
|
3745
3754
|
}
|
|
3746
3755
|
}
|