@contentful/experiences-visual-editor-react 3.8.0-beta.0 → 3.8.0-beta.2
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 +39 -2
- package/dist/index.js.map +1 -1
- package/dist/renderApp.js +39 -2
- package/dist/renderApp.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -766,6 +766,16 @@ const ComponentVariableSchema$1 = z.object({
|
|
|
766
766
|
});
|
|
767
767
|
const ComponentTreeNodeSchema$1 = BaseComponentTreeNodeSchema$1.extend({
|
|
768
768
|
children: z.lazy(() => ComponentTreeNodeSchema$1.array()),
|
|
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.
|
|
773
|
+
if (prebindingId && !parameters) {
|
|
774
|
+
ctx.addIssue({
|
|
775
|
+
code: z.ZodIssueCode.custom,
|
|
776
|
+
message: `Found "prebindingId" but no "parameters" for node with id: "${id}"`,
|
|
777
|
+
});
|
|
778
|
+
}
|
|
769
779
|
});
|
|
770
780
|
const ComponentTreeSchema$1 = z
|
|
771
781
|
.object({
|
|
@@ -1520,6 +1530,9 @@ const getPrebindingPathBySourceEntry = (preboundValueProperty, getHeadEntityByDa
|
|
|
1520
1530
|
return undefined;
|
|
1521
1531
|
}
|
|
1522
1532
|
const contentTypeId = headEntity.sys.contentType.sys.id;
|
|
1533
|
+
if (!preboundValueProperty.pathsByContentType?.[contentTypeId]) {
|
|
1534
|
+
return undefined;
|
|
1535
|
+
}
|
|
1523
1536
|
return preboundValueProperty.pathsByContentType?.[contentTypeId]?.path;
|
|
1524
1537
|
};
|
|
1525
1538
|
const parseDeepPath$1 = (deepPathCandidate) => {
|
|
@@ -4003,6 +4016,16 @@ const ComponentVariableSchema = z.object({
|
|
|
4003
4016
|
});
|
|
4004
4017
|
const ComponentTreeNodeSchema = BaseComponentTreeNodeSchema.extend({
|
|
4005
4018
|
children: z.lazy(() => ComponentTreeNodeSchema.array()),
|
|
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.
|
|
4023
|
+
if (prebindingId && !parameters) {
|
|
4024
|
+
ctx.addIssue({
|
|
4025
|
+
code: z.ZodIssueCode.custom,
|
|
4026
|
+
message: `Found "prebindingId" but no "parameters" for node with id: "${id}"`,
|
|
4027
|
+
});
|
|
4028
|
+
}
|
|
4006
4029
|
});
|
|
4007
4030
|
const ComponentTreeSchema = z
|
|
4008
4031
|
.object({
|
|
@@ -5083,14 +5106,28 @@ const useComponentProps = ({ node, entityStore, areEntitiesFetched, resolveDesig
|
|
|
5083
5106
|
// eg: "/uuid" vs "/uuid/fields/[fileName]/~locale" as the regular BoundValue would have
|
|
5084
5107
|
const [, uuid, maybePath] = variableMapping.path.split('/');
|
|
5085
5108
|
const link = dataSource[uuid];
|
|
5086
|
-
let boundValue;
|
|
5087
5109
|
// starting from here, if the prop is of type 'BoundValue', and has prebinding
|
|
5088
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
|
+
}
|
|
5089
5120
|
if (link && isPreboundProp(variableMapping) && variableMapping.isPrebound) {
|
|
5090
5121
|
const prebindingPath = getPrebindingPathBySourceEntry(variableMapping, (dataSourceKey) => {
|
|
5091
5122
|
const link = dataSource[dataSourceKey];
|
|
5092
5123
|
return entityStore.getEntityFromLink(link);
|
|
5093
|
-
})
|
|
5124
|
+
});
|
|
5125
|
+
if (!prebindingPath) {
|
|
5126
|
+
return {
|
|
5127
|
+
...acc,
|
|
5128
|
+
[variableName]: variableDefinition.defaultValue,
|
|
5129
|
+
};
|
|
5130
|
+
}
|
|
5094
5131
|
// this allows us to resolve it regularly
|
|
5095
5132
|
boundValue = transformBoundContentValue(node.data.props, entityStore, link, resolveDesignValue, variableName, variableDefinition.type, prebindingPath);
|
|
5096
5133
|
}
|