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