@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
|
@@ -30,6 +30,11 @@ declare class EntityStore extends EntityStoreBase {
|
|
|
30
30
|
}>;
|
|
31
31
|
get hoistedParameterDefinitions(): Record<string, {
|
|
32
32
|
contentTypes: string[];
|
|
33
|
+
passToNodes: {
|
|
34
|
+
prebindingId: string;
|
|
35
|
+
parameterId: string;
|
|
36
|
+
nodeId: string;
|
|
37
|
+
}[];
|
|
33
38
|
defaultSource?: {
|
|
34
39
|
type: "Entry";
|
|
35
40
|
contentTypeId: string;
|
|
@@ -41,11 +46,6 @@ declare class EntityStore extends EntityStoreBase {
|
|
|
41
46
|
};
|
|
42
47
|
};
|
|
43
48
|
} | undefined;
|
|
44
|
-
passToNodes?: {
|
|
45
|
-
prebindingId: string;
|
|
46
|
-
parameterId: string;
|
|
47
|
-
nodeId: string;
|
|
48
|
-
}[] | undefined;
|
|
49
49
|
}>;
|
|
50
50
|
get experienceEntryFields(): ExperienceFields | undefined;
|
|
51
51
|
get experienceEntryId(): string | undefined;
|
package/dist/index.cjs
CHANGED
|
@@ -951,7 +951,7 @@ const BREAKPOINT_QUERY_REGEX = /^\*$|^[<>][0-9]+px$/;
|
|
|
951
951
|
const BreakpointSchema = zod.z
|
|
952
952
|
.object({
|
|
953
953
|
id: propertyKeySchema,
|
|
954
|
-
// Can be
|
|
954
|
+
// Can be replaced with z.templateLiteral when upgrading to zod v4
|
|
955
955
|
query: zod.z.string().refine((s) => BREAKPOINT_QUERY_REGEX.test(s)),
|
|
956
956
|
previewSize: zod.z.string().optional(),
|
|
957
957
|
displayName: zod.z.string(),
|
|
@@ -990,6 +990,16 @@ const ComponentVariableSchema = zod.z.object({
|
|
|
990
990
|
});
|
|
991
991
|
const ComponentTreeNodeSchema = BaseComponentTreeNodeSchema.extend({
|
|
992
992
|
children: zod.z.lazy(() => ComponentTreeNodeSchema.array()),
|
|
993
|
+
}).superRefine(({ id, prebindingId, parameters }, ctx) => {
|
|
994
|
+
// We don't fail if parameters are present but prebindingId is not because
|
|
995
|
+
// older experiences (updated before 21-09-2025) always included parameters
|
|
996
|
+
// and they will start failing if we do.
|
|
997
|
+
if (prebindingId && !parameters) {
|
|
998
|
+
ctx.addIssue({
|
|
999
|
+
code: zod.z.ZodIssueCode.custom,
|
|
1000
|
+
message: `Found "prebindingId" but no "parameters" for node with id: "${id}"`,
|
|
1001
|
+
});
|
|
1002
|
+
}
|
|
993
1003
|
});
|
|
994
1004
|
const ComponentTreeSchema = zod.z
|
|
995
1005
|
.object({
|
|
@@ -1092,8 +1102,7 @@ const ParameterDefinitionSchema = zod.z.object({
|
|
|
1092
1102
|
contentTypes: zod.z.array(zod.z.string()).min(1),
|
|
1093
1103
|
passToNodes: zod.z
|
|
1094
1104
|
.array(PassToNodeSchema)
|
|
1095
|
-
.max(1, 'At most one "passToNodes" element is allowed per parameter definition.')
|
|
1096
|
-
.optional(), // we might change this to be empty array for native parameter definitions, that's why we don't use .length(1)
|
|
1105
|
+
.max(1, 'At most one "passToNodes" element is allowed per parameter definition.'),
|
|
1097
1106
|
});
|
|
1098
1107
|
const ParameterDefinitionsSchema = zod.z.record(propertyKeySchema, ParameterDefinitionSchema);
|
|
1099
1108
|
const VariableMappingsSchema = zod.z.record(propertyKeySchema, VariableMappingSchema);
|
|
@@ -1195,7 +1204,7 @@ const validatePassToNodes = (rootChildren, componentSettings, ctx) => {
|
|
|
1195
1204
|
return;
|
|
1196
1205
|
}
|
|
1197
1206
|
const { parameterDefinitions } = componentSettings.prebindingDefinitions[0];
|
|
1198
|
-
|
|
1207
|
+
const nodeIds = new Set();
|
|
1199
1208
|
for (const paramDef of Object.values(parameterDefinitions || {})) {
|
|
1200
1209
|
paramDef.passToNodes?.forEach((n) => nodeIds.add(n.nodeId));
|
|
1201
1210
|
}
|
|
@@ -2219,7 +2228,7 @@ const transformTextAlign = (value) => {
|
|
|
2219
2228
|
return undefined;
|
|
2220
2229
|
const sdkOptions = getSdkOptions();
|
|
2221
2230
|
// New behavior: translate left/right to start/end
|
|
2222
|
-
// Customer can opt
|
|
2231
|
+
// Customer can opt out by activating this global option toggle
|
|
2223
2232
|
if (!sdkOptions.__disableTextAlignmentTransform) {
|
|
2224
2233
|
if (value === 'left')
|
|
2225
2234
|
return 'start';
|
|
@@ -3671,7 +3680,7 @@ const extractPrebindingDataByPatternId = (patterns) => {
|
|
|
3671
3680
|
const [prebindingDefinition] = pattern.fields.componentSettings?.prebindingDefinitions ?? [];
|
|
3672
3681
|
if (!prebindingDefinition)
|
|
3673
3682
|
continue;
|
|
3674
|
-
const [nativeParameterId] = Object.entries(prebindingDefinition.parameterDefinitions ?? {}).find(([, value]) => value.passToNodes
|
|
3683
|
+
const [nativeParameterId] = Object.entries(prebindingDefinition.parameterDefinitions ?? {}).find(([, value]) => !value.passToNodes?.length) ?? [];
|
|
3675
3684
|
const prebindingData = {
|
|
3676
3685
|
prebindingDefinitionId: prebindingDefinition.id,
|
|
3677
3686
|
parameterIds: Object.keys(prebindingDefinition.parameterDefinitions),
|
|
@@ -3719,7 +3728,7 @@ function getTargetPatternMappingsForParameter({ fetchedPatterns, prebindingDataB
|
|
|
3719
3728
|
}
|
|
3720
3729
|
else {
|
|
3721
3730
|
const parameterDefinition = patternPrebindingData.parameterDefinitions[parameterId];
|
|
3722
|
-
if (!parameterDefinition || !parameterDefinition.passToNodes)
|
|
3731
|
+
if (!parameterDefinition || !parameterDefinition.passToNodes?.length)
|
|
3723
3732
|
return undefined;
|
|
3724
3733
|
const patternEntry = fetchedPatterns.find((entry) => entry.sys.id === patternNodeDefinitionId);
|
|
3725
3734
|
if (!patternEntry)
|
|
@@ -3730,7 +3739,7 @@ function getTargetPatternMappingsForParameter({ fetchedPatterns, prebindingDataB
|
|
|
3730
3739
|
parameters: {},
|
|
3731
3740
|
children: patternEntry.fields.componentTree.children,
|
|
3732
3741
|
}, (node) => {
|
|
3733
|
-
if (node.id === parameterDefinition.passToNodes?.[0]
|
|
3742
|
+
if (node.id === parameterDefinition.passToNodes?.[0]?.nodeId) {
|
|
3734
3743
|
nestedPatternNode = node;
|
|
3735
3744
|
}
|
|
3736
3745
|
return undefined;
|
|
@@ -3742,7 +3751,7 @@ function getTargetPatternMappingsForParameter({ fetchedPatterns, prebindingDataB
|
|
|
3742
3751
|
fetchedPatterns,
|
|
3743
3752
|
prebindingDataByPatternId,
|
|
3744
3753
|
patternNodeDefinitionId: nestedPatternNode.definitionId,
|
|
3745
|
-
parameterId: parameterDefinition.passToNodes?.[0]
|
|
3754
|
+
parameterId: parameterDefinition.passToNodes?.[0]?.parameterId,
|
|
3746
3755
|
});
|
|
3747
3756
|
}
|
|
3748
3757
|
}
|