@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/renderApp.js
CHANGED
|
@@ -43345,7 +43345,6 @@ const ComponentPropertyValueSchema$1 = z.discriminatedUnion('type', [
|
|
|
43345
43345
|
const PatternPropertySchema$1 = z.object({
|
|
43346
43346
|
type: z.literal('BoundValue'),
|
|
43347
43347
|
path: z.string(),
|
|
43348
|
-
contentType: z.string(),
|
|
43349
43348
|
});
|
|
43350
43349
|
const PatternPropertiesSchema$1 = z.record(propertyKeySchema$1, PatternPropertySchema$1);
|
|
43351
43350
|
const BreakpointSchema$1 = z
|
|
@@ -44464,10 +44463,26 @@ const transformMedia = (asset, variables, resolveDesignValue, variableName, path
|
|
|
44464
44463
|
return asset.fields.file?.url;
|
|
44465
44464
|
};
|
|
44466
44465
|
|
|
44466
|
+
const isAsset = (value) => {
|
|
44467
|
+
return (null !== value &&
|
|
44468
|
+
typeof value === 'object' &&
|
|
44469
|
+
'sys' in value &&
|
|
44470
|
+
value.sys?.type === 'Asset');
|
|
44471
|
+
};
|
|
44472
|
+
const isEntry = (value) => {
|
|
44473
|
+
return (null !== value &&
|
|
44474
|
+
typeof value === 'object' &&
|
|
44475
|
+
'sys' in value &&
|
|
44476
|
+
value.sys?.type === 'Entry');
|
|
44477
|
+
};
|
|
44478
|
+
|
|
44467
44479
|
function getResolvedEntryFromLink(entryOrAsset, path, entityStore) {
|
|
44468
|
-
if (entryOrAsset
|
|
44480
|
+
if (isAsset(entryOrAsset)) {
|
|
44469
44481
|
return entryOrAsset;
|
|
44470
44482
|
}
|
|
44483
|
+
else if (!isEntry(entryOrAsset)) {
|
|
44484
|
+
throw new Error(`Expected an Entry or Asset, but got: ${JSON.stringify(entryOrAsset)}`);
|
|
44485
|
+
}
|
|
44471
44486
|
const value = get(entryOrAsset, path.split('/').slice(2, -1));
|
|
44472
44487
|
if (value?.sys.type !== 'Link') {
|
|
44473
44488
|
console.warn(`Expected a link to a reference, but got: ${JSON.stringify(value)}`);
|
|
@@ -44730,10 +44745,13 @@ class EntityStoreBase {
|
|
|
44730
44745
|
}
|
|
44731
44746
|
entity = resolvedEntity;
|
|
44732
44747
|
}
|
|
44733
|
-
else {
|
|
44748
|
+
else if (isAsset(linkOrEntryOrAsset) || isEntry(linkOrEntryOrAsset)) {
|
|
44734
44749
|
// We already have the complete entity in preview & delivery (resolved by the CMA client)
|
|
44735
44750
|
entity = linkOrEntryOrAsset;
|
|
44736
44751
|
}
|
|
44752
|
+
else {
|
|
44753
|
+
throw new Error(`Unexpected object when resolving entity: ${JSON.stringify(linkOrEntryOrAsset)}`);
|
|
44754
|
+
}
|
|
44737
44755
|
return entity;
|
|
44738
44756
|
}
|
|
44739
44757
|
/**
|
|
@@ -44779,14 +44797,14 @@ class EntityStoreBase {
|
|
|
44779
44797
|
};
|
|
44780
44798
|
}
|
|
44781
44799
|
addEntity(entity) {
|
|
44782
|
-
if (
|
|
44800
|
+
if (isAsset(entity)) {
|
|
44783
44801
|
this.assetMap.set(entity.sys.id, entity);
|
|
44784
44802
|
}
|
|
44785
|
-
else if (
|
|
44803
|
+
else if (isEntry(entity)) {
|
|
44786
44804
|
this.entryMap.set(entity.sys.id, entity);
|
|
44787
44805
|
}
|
|
44788
44806
|
else {
|
|
44789
|
-
|
|
44807
|
+
throw new Error(`Attempted to add an entity to the store that is neither Asset nor Entry: '${JSON.stringify(entity)}'`);
|
|
44790
44808
|
}
|
|
44791
44809
|
}
|
|
44792
44810
|
async fetchAsset(id) {
|
|
@@ -44856,7 +44874,7 @@ class EntityStoreBase {
|
|
|
44856
44874
|
resolvedFieldset.push([entityToResolveFieldsFrom, field, _localeQualifier]);
|
|
44857
44875
|
entityToResolveFieldsFrom = entity; // we move up
|
|
44858
44876
|
}
|
|
44859
|
-
else if (
|
|
44877
|
+
else if (isAsset(fieldValue) || isEntry(fieldValue)) {
|
|
44860
44878
|
resolvedFieldset.push([entityToResolveFieldsFrom, field, _localeQualifier]);
|
|
44861
44879
|
entityToResolveFieldsFrom = fieldValue; // we move up
|
|
44862
44880
|
}
|
|
@@ -44892,18 +44910,6 @@ class EntityStoreBase {
|
|
|
44892
44910
|
const [leafEntity] = resolvedFieldset[resolvedFieldset.length - 1];
|
|
44893
44911
|
return leafEntity;
|
|
44894
44912
|
}
|
|
44895
|
-
isAsset(value) {
|
|
44896
|
-
return (null !== value &&
|
|
44897
|
-
typeof value === 'object' &&
|
|
44898
|
-
'sys' in value &&
|
|
44899
|
-
value.sys?.type === 'Asset');
|
|
44900
|
-
}
|
|
44901
|
-
isEntry(value) {
|
|
44902
|
-
return (null !== value &&
|
|
44903
|
-
typeof value === 'object' &&
|
|
44904
|
-
'sys' in value &&
|
|
44905
|
-
value.sys?.type === 'Entry');
|
|
44906
|
-
}
|
|
44907
44913
|
getEntity(type, id) {
|
|
44908
44914
|
if (type === 'Asset') {
|
|
44909
44915
|
return this.assetMap.get(id);
|
|
@@ -58482,7 +58488,6 @@ const ComponentPropertyValueSchema = z.discriminatedUnion('type', [
|
|
|
58482
58488
|
const PatternPropertySchema = z.object({
|
|
58483
58489
|
type: z.literal('BoundValue'),
|
|
58484
58490
|
path: z.string(),
|
|
58485
|
-
contentType: z.string(),
|
|
58486
58491
|
});
|
|
58487
58492
|
const PatternPropertiesSchema = z.record(propertyKeySchema, PatternPropertySchema);
|
|
58488
58493
|
const BreakpointSchema = z
|
|
@@ -60552,7 +60557,7 @@ function useSingleColumn(node, resolveDesignValue) {
|
|
|
60552
60557
|
return false;
|
|
60553
60558
|
}
|
|
60554
60559
|
const { cfWrapColumns } = parentNode.data.props;
|
|
60555
|
-
if (cfWrapColumns
|
|
60560
|
+
if (cfWrapColumns?.type !== 'DesignValue') {
|
|
60556
60561
|
return false;
|
|
60557
60562
|
}
|
|
60558
60563
|
return resolveDesignValue(cfWrapColumns.valuesByBreakpoint);
|