@contentful/experiences-core 1.40.0 → 1.40.1-beta.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.
@@ -34,6 +34,7 @@ declare abstract class EntityStoreBase {
34
34
  fetchEntries(ids: string[]): Promise<Entry[]>;
35
35
  private getDeepEntry;
36
36
  private isAsset;
37
+ private isEntry;
37
38
  private getEntity;
38
39
  toJSON(): {
39
40
  entryMap: {
package/dist/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export { addLocale, buildTemplate, getTemplateValue, resolveHyperlinkPattern } f
10
10
  export { sanitizeNodeProps } from './utils/sanitizeNodeProps.js';
11
11
  export { addMinHeightForEmptyStructures, buildCfStyles, buildStyleTag, calculateNodeDefaultHeight, stringifyCssProperties, toCSSAttribute } from './utils/styleUtils/stylesUtils.js';
12
12
  export { detachExperienceStyles, flattenDesignTokenRegistry, indexByBreakpoint, isCfStyleAttribute, maybePopulateDesignTokenValue, resolveBackgroundImageBinding, toMediaQuery } from './utils/styleUtils/ssrStyles.js';
13
+ export { transformVisibility } from './utils/styleUtils/styleTransformers.js';
13
14
  export { transformBoundContentValue } from './utils/transformers/transformBoundContentValue.js';
14
15
  export { treeMap, treeVisit } from './utils/treeTraversal.js';
15
16
  export { isExperienceEntry } from './utils/typeguards.js';
package/dist/index.js CHANGED
@@ -1807,6 +1807,7 @@ const sanitizeNodeProps = (nodeProps) => {
1807
1807
  return omit(nodeProps, stylesToRemove, propsToRemove);
1808
1808
  };
1809
1809
 
1810
+ /** Turn the visibility value into a style object that can be used for inline styles in React */
1810
1811
  const transformVisibility = (value) => {
1811
1812
  if (value === false) {
1812
1813
  return {
@@ -1975,7 +1976,6 @@ const buildStyleTag = ({ styles, nodeId }) => {
1975
1976
  const buildCfStyles = (values) => {
1976
1977
  const cssProperties = {
1977
1978
  boxSizing: 'border-box',
1978
- ...transformVisibility(values.cfVisibility),
1979
1979
  margin: values.cfMargin,
1980
1980
  padding: values.cfPadding,
1981
1981
  backgroundColor: values.cfBackgroundColor,
@@ -3302,6 +3302,17 @@ class EntityStoreBase {
3302
3302
  resolvedFieldset.push([entityToResolveFieldsFrom, field, _localeQualifier]);
3303
3303
  entityToResolveFieldsFrom = entity; // we move up
3304
3304
  }
3305
+ else if (this.isAsset(fieldValue) || this.isEntry(fieldValue)) {
3306
+ resolvedFieldset.push([entityToResolveFieldsFrom, field, _localeQualifier]);
3307
+ entityToResolveFieldsFrom = fieldValue; // we move up
3308
+ }
3309
+ else {
3310
+ return {
3311
+ resolvedFieldset,
3312
+ isFullyResolved: false,
3313
+ reason: `Deep path points to an invalid field value of type '${typeof fieldValue}' (value=${fieldValue})`,
3314
+ };
3315
+ }
3305
3316
  }
3306
3317
  return {
3307
3318
  resolvedFieldset,
@@ -3327,8 +3338,17 @@ class EntityStoreBase {
3327
3338
  const [leafEntity] = resolvedFieldset[resolvedFieldset.length - 1];
3328
3339
  return leafEntity;
3329
3340
  }
3330
- isAsset(entity) {
3331
- return entity.sys.type === 'Asset';
3341
+ isAsset(value) {
3342
+ return (null !== value &&
3343
+ typeof value === 'object' &&
3344
+ 'sys' in value &&
3345
+ value.sys?.type === 'Asset');
3346
+ }
3347
+ isEntry(value) {
3348
+ return (null !== value &&
3349
+ typeof value === 'object' &&
3350
+ 'sys' in value &&
3351
+ value.sys?.type === 'Entry');
3332
3352
  }
3333
3353
  getEntity(type, id) {
3334
3354
  if (type === 'Asset') {
@@ -4164,5 +4184,5 @@ async function fetchById({ client, experienceTypeId, id, localeCode, isEditorMod
4164
4184
  }
4165
4185
  }
4166
4186
 
4167
- export { DebugLogger, DeepReference, EditorModeEntityStore, EntityStore, EntityStoreBase, MEDIA_QUERY_REGEXP, VisualEditorMode, addLocale, addMinHeightForEmptyStructures, breakpointsRegistry, buildCfStyles, buildStyleTag, buildTemplate, builtInStyles, calculateNodeDefaultHeight, checkIsAssembly, checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, columnsBuiltInStyles, containerBuiltInStyles, createExperience, debug, defineBreakpoints, defineDesignTokens, designTokensRegistry, detachExperienceStyles, disableDebug, dividerBuiltInStyles, doesMismatchMessageSchema, enableDebug, fetchAllAssets, fetchAllEntries, fetchById, fetchBySlug, fetchExperienceEntry, fetchReferencedEntities, findOutermostCoordinates, flattenDesignTokenRegistry, gatherDeepReferencesFromExperienceEntry, gatherDeepReferencesFromTree, generateRandomId, getActiveBreakpointIndex, getBreakpointRegistration, getDataFromTree, getDesignTokenRegistration, getElementCoordinates, getFallbackBreakpointIndex, getInsertionData, getTargetValueInPixels, getTemplateValue, getValueForBreakpoint, indexByBreakpoint, isCfStyleAttribute, isComponentAllowedOnRoot, isContentfulComponent, isContentfulStructureComponent, isDeepPath, isExperienceEntry, isLink, isLinkToAsset, isPatternComponent, isStructureWithRelativeHeight, isValidBreakpointValue, lastPathNamedSegmentEq, localizeEntity, maybePopulateDesignTokenValue, mediaQueryMatcher, optionalBuiltInStyles, parseCSSValue, parseDataSourcePathIntoFieldset, parseDataSourcePathWithL1DeepBindings, resetBreakpointsRegistry, resetDesignTokenRegistry, resolveBackgroundImageBinding, resolveHyperlinkPattern, runBreakpointsValidation, sanitizeNodeProps, sectionBuiltInStyles, sendMessage, singleColumnBuiltInStyles, stringifyCssProperties, toCSSAttribute, toMediaQuery, transformBoundContentValue, treeMap, treeVisit, tryParseMessage, validateExperienceBuilderConfig };
4187
+ export { DebugLogger, DeepReference, EditorModeEntityStore, EntityStore, EntityStoreBase, MEDIA_QUERY_REGEXP, VisualEditorMode, addLocale, addMinHeightForEmptyStructures, breakpointsRegistry, buildCfStyles, buildStyleTag, buildTemplate, builtInStyles, calculateNodeDefaultHeight, checkIsAssembly, checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, columnsBuiltInStyles, containerBuiltInStyles, createExperience, debug, defineBreakpoints, defineDesignTokens, designTokensRegistry, detachExperienceStyles, disableDebug, dividerBuiltInStyles, doesMismatchMessageSchema, enableDebug, fetchAllAssets, fetchAllEntries, fetchById, fetchBySlug, fetchExperienceEntry, fetchReferencedEntities, findOutermostCoordinates, flattenDesignTokenRegistry, gatherDeepReferencesFromExperienceEntry, gatherDeepReferencesFromTree, generateRandomId, getActiveBreakpointIndex, getBreakpointRegistration, getDataFromTree, getDesignTokenRegistration, getElementCoordinates, getFallbackBreakpointIndex, getInsertionData, getTargetValueInPixels, getTemplateValue, getValueForBreakpoint, indexByBreakpoint, isCfStyleAttribute, isComponentAllowedOnRoot, isContentfulComponent, isContentfulStructureComponent, isDeepPath, isExperienceEntry, isLink, isLinkToAsset, isPatternComponent, isStructureWithRelativeHeight, isValidBreakpointValue, lastPathNamedSegmentEq, localizeEntity, maybePopulateDesignTokenValue, mediaQueryMatcher, optionalBuiltInStyles, parseCSSValue, parseDataSourcePathIntoFieldset, parseDataSourcePathWithL1DeepBindings, resetBreakpointsRegistry, resetDesignTokenRegistry, resolveBackgroundImageBinding, resolveHyperlinkPattern, runBreakpointsValidation, sanitizeNodeProps, sectionBuiltInStyles, sendMessage, singleColumnBuiltInStyles, stringifyCssProperties, toCSSAttribute, toMediaQuery, transformBoundContentValue, transformVisibility, treeMap, treeVisit, tryParseMessage, validateExperienceBuilderConfig };
4168
4188
  //# sourceMappingURL=index.js.map