@contentful/experiences-visual-editor-react 1.41.0-dev-20250611T1249-85aabd5.0 → 1.41.0-dev-20250612T1212-618fdd9.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 +26 -21
- package/dist/index.js.map +1 -1
- package/dist/renderApp.js +26 -21
- package/dist/renderApp.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -724,7 +724,6 @@ const ComponentPropertyValueSchema$1 = z.discriminatedUnion('type', [
|
|
|
724
724
|
const PatternPropertySchema$1 = z.object({
|
|
725
725
|
type: z.literal('BoundValue'),
|
|
726
726
|
path: z.string(),
|
|
727
|
-
contentType: z.string(),
|
|
728
727
|
});
|
|
729
728
|
const PatternPropertiesSchema$1 = z.record(propertyKeySchema$1, PatternPropertySchema$1);
|
|
730
729
|
const BreakpointSchema$1 = z
|
|
@@ -1843,10 +1842,26 @@ const transformMedia = (asset, variables, resolveDesignValue, variableName, path
|
|
|
1843
1842
|
return asset.fields.file?.url;
|
|
1844
1843
|
};
|
|
1845
1844
|
|
|
1845
|
+
const isAsset = (value) => {
|
|
1846
|
+
return (null !== value &&
|
|
1847
|
+
typeof value === 'object' &&
|
|
1848
|
+
'sys' in value &&
|
|
1849
|
+
value.sys?.type === 'Asset');
|
|
1850
|
+
};
|
|
1851
|
+
const isEntry = (value) => {
|
|
1852
|
+
return (null !== value &&
|
|
1853
|
+
typeof value === 'object' &&
|
|
1854
|
+
'sys' in value &&
|
|
1855
|
+
value.sys?.type === 'Entry');
|
|
1856
|
+
};
|
|
1857
|
+
|
|
1846
1858
|
function getResolvedEntryFromLink(entryOrAsset, path, entityStore) {
|
|
1847
|
-
if (entryOrAsset
|
|
1859
|
+
if (isAsset(entryOrAsset)) {
|
|
1848
1860
|
return entryOrAsset;
|
|
1849
1861
|
}
|
|
1862
|
+
else if (!isEntry(entryOrAsset)) {
|
|
1863
|
+
throw new Error(`Expected an Entry or Asset, but got: ${JSON.stringify(entryOrAsset)}`);
|
|
1864
|
+
}
|
|
1850
1865
|
const value = get(entryOrAsset, path.split('/').slice(2, -1));
|
|
1851
1866
|
if (value?.sys.type !== 'Link') {
|
|
1852
1867
|
console.warn(`Expected a link to a reference, but got: ${JSON.stringify(value)}`);
|
|
@@ -2109,10 +2124,13 @@ class EntityStoreBase {
|
|
|
2109
2124
|
}
|
|
2110
2125
|
entity = resolvedEntity;
|
|
2111
2126
|
}
|
|
2112
|
-
else {
|
|
2127
|
+
else if (isAsset(linkOrEntryOrAsset) || isEntry(linkOrEntryOrAsset)) {
|
|
2113
2128
|
// We already have the complete entity in preview & delivery (resolved by the CMA client)
|
|
2114
2129
|
entity = linkOrEntryOrAsset;
|
|
2115
2130
|
}
|
|
2131
|
+
else {
|
|
2132
|
+
throw new Error(`Unexpected object when resolving entity: ${JSON.stringify(linkOrEntryOrAsset)}`);
|
|
2133
|
+
}
|
|
2116
2134
|
return entity;
|
|
2117
2135
|
}
|
|
2118
2136
|
/**
|
|
@@ -2158,14 +2176,14 @@ class EntityStoreBase {
|
|
|
2158
2176
|
};
|
|
2159
2177
|
}
|
|
2160
2178
|
addEntity(entity) {
|
|
2161
|
-
if (
|
|
2179
|
+
if (isAsset(entity)) {
|
|
2162
2180
|
this.assetMap.set(entity.sys.id, entity);
|
|
2163
2181
|
}
|
|
2164
|
-
else if (
|
|
2182
|
+
else if (isEntry(entity)) {
|
|
2165
2183
|
this.entryMap.set(entity.sys.id, entity);
|
|
2166
2184
|
}
|
|
2167
2185
|
else {
|
|
2168
|
-
|
|
2186
|
+
throw new Error(`Attempted to add an entity to the store that is neither Asset nor Entry: '${JSON.stringify(entity)}'`);
|
|
2169
2187
|
}
|
|
2170
2188
|
}
|
|
2171
2189
|
async fetchAsset(id) {
|
|
@@ -2235,7 +2253,7 @@ class EntityStoreBase {
|
|
|
2235
2253
|
resolvedFieldset.push([entityToResolveFieldsFrom, field, _localeQualifier]);
|
|
2236
2254
|
entityToResolveFieldsFrom = entity; // we move up
|
|
2237
2255
|
}
|
|
2238
|
-
else if (
|
|
2256
|
+
else if (isAsset(fieldValue) || isEntry(fieldValue)) {
|
|
2239
2257
|
resolvedFieldset.push([entityToResolveFieldsFrom, field, _localeQualifier]);
|
|
2240
2258
|
entityToResolveFieldsFrom = fieldValue; // we move up
|
|
2241
2259
|
}
|
|
@@ -2271,18 +2289,6 @@ class EntityStoreBase {
|
|
|
2271
2289
|
const [leafEntity] = resolvedFieldset[resolvedFieldset.length - 1];
|
|
2272
2290
|
return leafEntity;
|
|
2273
2291
|
}
|
|
2274
|
-
isAsset(value) {
|
|
2275
|
-
return (null !== value &&
|
|
2276
|
-
typeof value === 'object' &&
|
|
2277
|
-
'sys' in value &&
|
|
2278
|
-
value.sys?.type === 'Asset');
|
|
2279
|
-
}
|
|
2280
|
-
isEntry(value) {
|
|
2281
|
-
return (null !== value &&
|
|
2282
|
-
typeof value === 'object' &&
|
|
2283
|
-
'sys' in value &&
|
|
2284
|
-
value.sys?.type === 'Entry');
|
|
2285
|
-
}
|
|
2286
2292
|
getEntity(type, id) {
|
|
2287
2293
|
if (type === 'Asset') {
|
|
2288
2294
|
return this.assetMap.get(id);
|
|
@@ -3568,7 +3574,6 @@ const ComponentPropertyValueSchema = z.discriminatedUnion('type', [
|
|
|
3568
3574
|
const PatternPropertySchema = z.object({
|
|
3569
3575
|
type: z.literal('BoundValue'),
|
|
3570
3576
|
path: z.string(),
|
|
3571
|
-
contentType: z.string(),
|
|
3572
3577
|
});
|
|
3573
3578
|
const PatternPropertiesSchema = z.record(propertyKeySchema, PatternPropertySchema);
|
|
3574
3579
|
const BreakpointSchema = z
|
|
@@ -5509,7 +5514,7 @@ function useSingleColumn(node, resolveDesignValue) {
|
|
|
5509
5514
|
return false;
|
|
5510
5515
|
}
|
|
5511
5516
|
const { cfWrapColumns } = parentNode.data.props;
|
|
5512
|
-
if (cfWrapColumns
|
|
5517
|
+
if (cfWrapColumns?.type !== 'DesignValue') {
|
|
5513
5518
|
return false;
|
|
5514
5519
|
}
|
|
5515
5520
|
return resolveDesignValue(cfWrapColumns.valuesByBreakpoint);
|