@contentful/experiences-sdk-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.
@@ -4,7 +4,7 @@ import { PATTERN_PROPERTY_DIVIDER } from '@contentful/experiences-core/constants
4
4
 
5
5
  /** While unfolding the assembly definition on the instance, this function will replace all
6
6
  * ComponentValue in the definitions tree with the actual value on the instance. */
7
- const deserializeAssemblyNode = ({ node, componentInstanceVariables, componentSettings, patternProperties, }) => {
7
+ const deserializeAssemblyNode = ({ node, componentInstanceVariables, componentSettings, patternProperties, entityStore, }) => {
8
8
  const variables = {};
9
9
  for (const [variableName, variable] of Object.entries(node.variables)) {
10
10
  variables[variableName] = variable;
@@ -23,6 +23,7 @@ const deserializeAssemblyNode = ({ node, componentInstanceVariables, componentSe
23
23
  componentSettings,
24
24
  componentValueKey,
25
25
  patternProperties,
26
+ entityStore,
26
27
  });
27
28
  if (usePrebinding && path) {
28
29
  variables[variableName] = {
@@ -75,6 +76,7 @@ const deserializeAssemblyNode = ({ node, componentInstanceVariables, componentSe
75
76
  componentInstanceVariables,
76
77
  componentSettings,
77
78
  patternProperties,
79
+ entityStore,
78
80
  }));
79
81
  return {
80
82
  definitionId: node.definitionId,
@@ -122,6 +124,7 @@ const resolveAssembly = ({ node, parentPatternProperties, patternRootNodeIdsChai
122
124
  componentInstanceVariables: node.variables,
123
125
  componentSettings: componentFields.componentSettings,
124
126
  patternProperties,
127
+ entityStore,
125
128
  });
126
129
  entityStore.addAssemblyUnboundValues(componentFields.unboundValues);
127
130
  return deserializedNode;
@@ -1 +1 @@
1
- {"version":3,"file":"assemblyUtils.js","sources":["../../../../src/core/preview/assemblyUtils.ts"],"sourcesContent":["import { EntityStore } from '@contentful/experiences-core';\nimport md5 from 'md5';\nimport type {\n ComponentPropertyValue,\n ComponentTreeNode,\n DesignValue,\n ExperienceComponentSettings,\n PatternProperty,\n} from '@contentful/experiences-core/types';\nimport { resolvePrebindingPath, shouldUsePrebinding } from '../../utils/prebindingUtils';\nimport { PATTERN_PROPERTY_DIVIDER } from '@contentful/experiences-core/constants';\n\n/** While unfolding the assembly definition on the instance, this function will replace all\n * ComponentValue in the definitions tree with the actual value on the instance. */\nexport const deserializeAssemblyNode = ({\n node,\n componentInstanceVariables,\n componentSettings,\n patternProperties,\n}: {\n node: ComponentTreeNode;\n componentInstanceVariables: ComponentTreeNode['variables'];\n componentSettings: ExperienceComponentSettings;\n patternProperties: Record<string, PatternProperty>;\n}): ComponentTreeNode => {\n const variables: Record<string, ComponentPropertyValue> = {};\n\n for (const [variableName, variable] of Object.entries(node.variables)) {\n variables[variableName] = variable;\n if (variable.type === 'ComponentValue') {\n const componentValueKey = variable.key;\n const instanceProperty = componentInstanceVariables[componentValueKey];\n const variableDefinition = componentSettings.variableDefinitions?.[componentValueKey];\n const defaultValue = variableDefinition?.defaultValue;\n\n const usePrebinding = shouldUsePrebinding({\n componentSettings,\n componentValueKey,\n patternProperties,\n variable: instanceProperty,\n });\n const path = resolvePrebindingPath({\n componentSettings,\n componentValueKey,\n patternProperties,\n });\n\n if (usePrebinding && path) {\n variables[variableName] = {\n type: 'BoundValue',\n path,\n };\n\n // For assembly, we look up the variable in the assembly instance and\n // replace the ComponentValue with that one.\n } else if (instanceProperty?.type === 'UnboundValue') {\n variables[variableName] = {\n type: 'UnboundValue',\n key: instanceProperty.key,\n };\n } else if (instanceProperty?.type === 'NoValue') {\n variables[variableName] = instanceProperty;\n } else if (instanceProperty?.type === 'BoundValue') {\n variables[variableName] = {\n type: 'BoundValue',\n path: instanceProperty.path,\n };\n } else if (instanceProperty?.type === 'HyperlinkValue') {\n variables[variableName] = {\n type: 'HyperlinkValue',\n linkTargetKey: instanceProperty.linkTargetKey,\n };\n } else if (instanceProperty?.type === 'DesignValue') {\n variables[variableName] = {\n type: 'DesignValue',\n valuesByBreakpoint: instanceProperty.valuesByBreakpoint,\n };\n } else if (!instanceProperty && defaultValue) {\n // So far, we only automatically fallback to the defaultValue for design properties\n if (variableDefinition.group === 'style') {\n variables[variableName] = {\n type: 'DesignValue',\n valuesByBreakpoint: (defaultValue as DesignValue).valuesByBreakpoint,\n };\n }\n }\n }\n }\n\n const children: ComponentTreeNode[] = node.children.map((child) =>\n deserializeAssemblyNode({\n node: child,\n componentInstanceVariables,\n componentSettings,\n patternProperties,\n }),\n );\n\n return {\n definitionId: node.definitionId,\n id: node.id,\n variables,\n children,\n slotId: node.slotId,\n displayName: node.displayName,\n patternProperties: node.patternProperties,\n };\n};\n\nexport const resolveAssembly = ({\n node,\n parentPatternProperties,\n patternRootNodeIdsChain,\n entityStore,\n}: {\n node: ComponentTreeNode;\n entityStore: EntityStore;\n parentPatternProperties: Record<string, PatternProperty>;\n patternRootNodeIdsChain: string;\n}) => {\n const componentId = node.definitionId as string;\n const assembly = entityStore.usedComponents?.find(\n (component) => component.sys.id === componentId,\n );\n\n if (!assembly || !('fields' in assembly)) {\n return node;\n }\n\n const patternProperties: Record<string, PatternProperty> = {};\n\n const allPatternProperties = {\n ...parentPatternProperties,\n ...(node.patternProperties || {}),\n };\n\n for (const [patternPropertyKey, patternProperty] of Object.entries(allPatternProperties)) {\n /**\n * Bubbled up pattern properties are a concatenation of the node id\n * and the pattern property definition id. We need to split them so\n * that the node only uses the pattern property definition id.\n */\n const [hashKey, patternPropertyDefinitionId] =\n patternPropertyKey.split(PATTERN_PROPERTY_DIVIDER);\n\n const hashedNodeChain = md5(patternRootNodeIdsChain || '');\n\n const isMatchingNode = hashKey === hashedNodeChain;\n\n if (!isMatchingNode) continue;\n\n patternProperties[patternPropertyDefinitionId] = patternProperty;\n }\n\n const componentFields = assembly.fields;\n\n const deserializedNode = deserializeAssemblyNode({\n node: {\n definitionId: node.definitionId,\n id: node.id,\n variables: node.variables,\n children: componentFields.componentTree.children,\n patternProperties,\n },\n componentInstanceVariables: node.variables,\n componentSettings: componentFields.componentSettings!,\n patternProperties,\n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C,GAAG,eAAe,CAAC;KAClE;AAED,IAAA,MAAM,eAAe,GAAG,QAAQ,CAAC,MAAM,CAAC;IAExC,MAAM,gBAAgB,GAAG,uBAAuB,CAAC;AAC/C,QAAA,IAAI,EAAE;YACJ,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,SAAS,EAAE,IAAI,CAAC,SAAS;AACzB,YAAA,QAAQ,EAAE,eAAe,CAAC,aAAa,CAAC,QAAQ;YAChD,iBAAiB;AAClB,SAAA;QACD,0BAA0B,EAAE,IAAI,CAAC,SAAS;QAC1C,iBAAiB,EAAE,eAAe,CAAC,iBAAkB;QACrD,iBAAiB;AAClB,KAAA,CAAC,CAAC;AAEH,IAAA,WAAW,CAAC,wBAAwB,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;AAEpE,IAAA,OAAO,gBAAgB,CAAC;AAC1B;;;;"}
1
+ {"version":3,"file":"assemblyUtils.js","sources":["../../../../src/core/preview/assemblyUtils.ts"],"sourcesContent":["import { EntityStore } from '@contentful/experiences-core';\nimport md5 from 'md5';\nimport type {\n ComponentPropertyValue,\n ComponentTreeNode,\n DesignValue,\n ExperienceComponentSettings,\n PatternProperty,\n} from '@contentful/experiences-core/types';\nimport { resolvePrebindingPath, shouldUsePrebinding } from '../../utils/prebindingUtils';\nimport { PATTERN_PROPERTY_DIVIDER } from '@contentful/experiences-core/constants';\n\n/** While unfolding the assembly definition on the instance, this function will replace all\n * ComponentValue in the definitions tree with the actual value on the instance. */\nexport const deserializeAssemblyNode = ({\n node,\n componentInstanceVariables,\n componentSettings,\n patternProperties,\n entityStore,\n}: {\n node: ComponentTreeNode;\n componentInstanceVariables: ComponentTreeNode['variables'];\n componentSettings: ExperienceComponentSettings;\n patternProperties: Record<string, PatternProperty>;\n entityStore: EntityStore;\n}): ComponentTreeNode => {\n const variables: Record<string, ComponentPropertyValue> = {};\n\n for (const [variableName, variable] of Object.entries(node.variables)) {\n variables[variableName] = variable;\n if (variable.type === 'ComponentValue') {\n const componentValueKey = variable.key;\n const instanceProperty = componentInstanceVariables[componentValueKey];\n const variableDefinition = componentSettings.variableDefinitions?.[componentValueKey];\n const defaultValue = variableDefinition?.defaultValue;\n\n const usePrebinding = shouldUsePrebinding({\n componentSettings,\n componentValueKey,\n patternProperties,\n variable: instanceProperty,\n });\n const path = resolvePrebindingPath({\n componentSettings,\n componentValueKey,\n patternProperties,\n entityStore,\n });\n\n if (usePrebinding && path) {\n variables[variableName] = {\n type: 'BoundValue',\n path,\n };\n\n // For assembly, we look up the variable in the assembly instance and\n // replace the ComponentValue with that one.\n } else if (instanceProperty?.type === 'UnboundValue') {\n variables[variableName] = {\n type: 'UnboundValue',\n key: instanceProperty.key,\n };\n } else if (instanceProperty?.type === 'NoValue') {\n variables[variableName] = instanceProperty;\n } else if (instanceProperty?.type === 'BoundValue') {\n variables[variableName] = {\n type: 'BoundValue',\n path: instanceProperty.path,\n };\n } else if (instanceProperty?.type === 'HyperlinkValue') {\n variables[variableName] = {\n type: 'HyperlinkValue',\n linkTargetKey: instanceProperty.linkTargetKey,\n };\n } else if (instanceProperty?.type === 'DesignValue') {\n variables[variableName] = {\n type: 'DesignValue',\n valuesByBreakpoint: instanceProperty.valuesByBreakpoint,\n };\n } else if (!instanceProperty && defaultValue) {\n // So far, we only automatically fallback to the defaultValue for design properties\n if (variableDefinition.group === 'style') {\n variables[variableName] = {\n type: 'DesignValue',\n valuesByBreakpoint: (defaultValue as DesignValue).valuesByBreakpoint,\n };\n }\n }\n }\n }\n\n const children: ComponentTreeNode[] = node.children.map((child) =>\n deserializeAssemblyNode({\n node: child,\n componentInstanceVariables,\n componentSettings,\n patternProperties,\n entityStore,\n }),\n );\n\n return {\n definitionId: node.definitionId,\n id: node.id,\n variables,\n children,\n slotId: node.slotId,\n displayName: node.displayName,\n patternProperties: node.patternProperties,\n };\n};\n\nexport const resolveAssembly = ({\n node,\n parentPatternProperties,\n patternRootNodeIdsChain,\n entityStore,\n}: {\n node: ComponentTreeNode;\n entityStore: EntityStore;\n parentPatternProperties: Record<string, PatternProperty>;\n patternRootNodeIdsChain: string;\n}) => {\n const componentId = node.definitionId as string;\n const assembly = entityStore.usedComponents?.find(\n (component) => component.sys.id === componentId,\n );\n\n if (!assembly || !('fields' in assembly)) {\n return node;\n }\n\n const patternProperties: Record<string, PatternProperty> = {};\n\n const allPatternProperties = {\n ...parentPatternProperties,\n ...(node.patternProperties || {}),\n };\n\n for (const [patternPropertyKey, patternProperty] of Object.entries(allPatternProperties)) {\n /**\n * Bubbled up pattern properties are a concatenation of the node id\n * and the pattern property definition id. We need to split them so\n * that the node only uses the pattern property definition id.\n */\n const [hashKey, patternPropertyDefinitionId] =\n patternPropertyKey.split(PATTERN_PROPERTY_DIVIDER);\n\n const hashedNodeChain = md5(patternRootNodeIdsChain || '');\n\n const isMatchingNode = hashKey === hashedNodeChain;\n\n if (!isMatchingNode) continue;\n\n patternProperties[patternPropertyDefinitionId] = patternProperty;\n }\n\n const componentFields = assembly.fields;\n\n const deserializedNode = deserializeAssemblyNode({\n node: {\n definitionId: node.definitionId,\n id: node.id,\n variables: node.variables,\n children: componentFields.componentTree.children,\n patternProperties,\n },\n componentInstanceVariables: node.variables,\n componentSettings: componentFields.componentSettings!,\n patternProperties,\n entityStore,\n });\n\n entityStore.addAssemblyUnboundValues(componentFields.unboundValues);\n\n return deserializedNode;\n};\n"],"names":[],"mappings":";;;;AAYA;AACmF;AACtE,MAAA,uBAAuB,GAAG,CAAC,EACtC,IAAI,EACJ,0BAA0B,EAC1B,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,GAOZ,KAAuB;IACtB,MAAM,SAAS,GAA2C,EAAE,CAAC;AAE7D,IAAA,KAAK,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;AACrE,QAAA,SAAS,CAAC,YAAY,CAAC,GAAG,QAAQ,CAAC;AACnC,QA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,EAAE,eAAe,CAAC,iBAAkB;QACrD,iBAAiB;QACjB,WAAW;AACZ,KAAA,CAAC,CAAC;AAEH,IAAA,WAAW,CAAC,wBAAwB,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;AAEpE,IAAA,OAAO,gBAAgB,CAAC;AAC1B;;;;"}
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ import * as _contentful_experiences_core_constants from '@contentful/experiences
8
8
  export { CF_STYLE_ATTRIBUTES, CONTENTFUL_COMPONENTS, LATEST_SCHEMA_VERSION } from '@contentful/experiences-core/constants';
9
9
  import { ContentfulClientApi } from 'contentful';
10
10
 
11
- declare const SDK_VERSION = "1.41.0-dev-20250611T1249-85aabd5.0";
11
+ declare const SDK_VERSION = "1.41.0-dev-20250612T1212-618fdd9.0";
12
12
 
13
13
  type ExperienceRootProps = {
14
14
  experience?: Experience<EntityStore> | string | null;
@@ -1,4 +1,4 @@
1
- const SDK_VERSION = '1.41.0-dev-20250611T1249-85aabd5.0';
1
+ const SDK_VERSION = '1.41.0-dev-20250612T1212-618fdd9.0';
2
2
 
3
3
  export { SDK_VERSION };
4
4
  //# sourceMappingURL=sdkVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sdkVersion.js","sources":["../../src/sdkVersion.ts"],"sourcesContent":["export const SDK_VERSION = '1.41.0-dev-20250611T1249-85aabd5.0';\n"],"names":[],"mappings":"AAAO,MAAM,WAAW,GAAG;;;;"}
1
+ {"version":3,"file":"sdkVersion.js","sources":["../../src/sdkVersion.ts"],"sourcesContent":["export const SDK_VERSION = '1.41.0-dev-20250612T1212-618fdd9.0';\n"],"names":[],"mappings":"AAAO,MAAM,WAAW,GAAG;;;;"}
@@ -2,11 +2,12 @@ import { EntityStore } from '@contentful/experiences-core';
2
2
  import type { ComponentTreeNode, ExperienceComponentSettings, PatternProperty } from '@contentful/experiences-core/types';
3
3
  /** While unfolding the assembly definition on the instance, this function will replace all
4
4
  * ComponentValue in the definitions tree with the actual value on the instance. */
5
- export declare const deserializeAssemblyNode: ({ node, componentInstanceVariables, componentSettings, patternProperties, }: {
5
+ export declare const deserializeAssemblyNode: ({ node, componentInstanceVariables, componentSettings, patternProperties, entityStore, }: {
6
6
  node: ComponentTreeNode;
7
7
  componentInstanceVariables: ComponentTreeNode["variables"];
8
8
  componentSettings: ExperienceComponentSettings;
9
9
  patternProperties: Record<string, PatternProperty>;
10
+ entityStore: EntityStore;
10
11
  }) => ComponentTreeNode;
11
12
  export declare const resolveAssembly: ({ node, parentPatternProperties, patternRootNodeIdsChain, entityStore, }: {
12
13
  node: ComponentTreeNode;
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.41.0-dev-20250611T1249-85aabd5.0";
1
+ export declare const SDK_VERSION = "1.41.0-dev-20250612T1212-618fdd9.0";
@@ -1,3 +1,4 @@
1
+ import { EntityStore } from '@contentful/experiences-core';
1
2
  import { ComponentPropertyValue, ExperienceComponentSettings, PatternProperty } from '@contentful/experiences-validators';
2
3
  export declare const shouldUsePrebinding: ({ componentValueKey, componentSettings, patternProperties, variable, }: {
3
4
  componentValueKey: string;
@@ -5,8 +6,9 @@ export declare const shouldUsePrebinding: ({ componentValueKey, componentSetting
5
6
  patternProperties: Record<string, PatternProperty>;
6
7
  variable: ComponentPropertyValue;
7
8
  }) => boolean;
8
- export declare const resolvePrebindingPath: ({ componentValueKey, componentSettings, patternProperties, }: {
9
+ export declare const resolvePrebindingPath: ({ componentValueKey, componentSettings, patternProperties, entityStore, }: {
9
10
  componentValueKey: string;
10
11
  componentSettings: ExperienceComponentSettings;
11
12
  patternProperties: Record<string, PatternProperty>;
13
+ entityStore: EntityStore;
12
14
  }) => string;
@@ -1,4 +1,5 @@
1
1
  import { Asset, Entry } from 'contentful';
2
+ export declare const CONTENT_TYPE_ID = "testContentType";
2
3
  export declare const entityIds: {
3
4
  ENTRY1: string;
4
5
  ENTRY2: string;
@@ -0,0 +1,6 @@
1
+ export * from './composition';
2
+ export * from './assembly';
3
+ export * from './entities';
4
+ export * from './breakpoints';
5
+ export * from './componentDefinition';
6
+ export * from './componentTreeNode';
@@ -6,14 +6,21 @@ const shouldUsePrebinding = ({ componentValueKey, componentSettings, patternProp
6
6
  const isValidForPrebinding = !!patternPropertyDefinition && !!patternProperty && !!variableMapping;
7
7
  return isValidForPrebinding && variable?.type === 'NoValue';
8
8
  };
9
- const resolvePrebindingPath = ({ componentValueKey, componentSettings, patternProperties, }) => {
9
+ const resolvePrebindingPath = ({ componentValueKey, componentSettings, patternProperties, entityStore, }) => {
10
10
  const variableMapping = componentSettings.variableMappings?.[componentValueKey];
11
11
  if (!variableMapping)
12
12
  return '';
13
13
  const patternProperty = patternProperties?.[variableMapping.patternPropertyDefinitionId];
14
14
  if (!patternProperty)
15
15
  return '';
16
- const contentType = patternProperty.contentType;
16
+ const dataSourceKey = patternProperty.path.split('/')[1];
17
+ const entityLink = entityStore.dataSource[dataSourceKey];
18
+ if (!entityLink)
19
+ return '';
20
+ const entity = entityStore.getEntityFromLink(entityLink);
21
+ if (!entity || entity.sys.type === 'Asset')
22
+ return '';
23
+ const contentType = entity.sys.contentType.sys.id;
17
24
  const fieldPath = variableMapping?.pathsByContentType?.[contentType]?.path;
18
25
  if (!fieldPath)
19
26
  return '';
@@ -1 +1 @@
1
- {"version":3,"file":"prebindingUtils.js","sources":["../../../src/utils/prebindingUtils.ts"],"sourcesContent":["import {\n ComponentPropertyValue,\n ExperienceComponentSettings,\n PatternProperty,\n} from '@contentful/experiences-validators';\n\nexport const shouldUsePrebinding = ({\n componentValueKey,\n componentSettings,\n patternProperties,\n variable,\n}: {\n componentValueKey: string;\n componentSettings: ExperienceComponentSettings;\n patternProperties: Record<string, PatternProperty>;\n variable: ComponentPropertyValue;\n}) => {\n const { patternPropertyDefinitions, variableMappings } = componentSettings;\n\n const variableMapping = variableMappings?.[componentValueKey];\n\n const patternPropertyDefinition =\n patternPropertyDefinitions?.[variableMapping?.patternPropertyDefinitionId || ''];\n const patternProperty = patternProperties?.[variableMapping?.patternPropertyDefinitionId || ''];\n\n const isValidForPrebinding =\n !!patternPropertyDefinition && !!patternProperty && !!variableMapping;\n\n return isValidForPrebinding && variable?.type === 'NoValue';\n};\n\nexport const resolvePrebindingPath = ({\n componentValueKey,\n componentSettings,\n patternProperties,\n}: {\n componentValueKey: string;\n componentSettings: ExperienceComponentSettings;\n patternProperties: Record<string, PatternProperty>;\n}) => {\n const variableMapping = componentSettings.variableMappings?.[componentValueKey];\n\n if (!variableMapping) return '';\n\n const patternProperty = patternProperties?.[variableMapping.patternPropertyDefinitionId];\n\n if (!patternProperty) return '';\n\n const contentType = patternProperty.contentType;\n\n const fieldPath = variableMapping?.pathsByContentType?.[contentType]?.path;\n\n if (!fieldPath) return '';\n\n return patternProperty.path + fieldPath;\n};\n"],"names":[],"mappings":"AAMO,MAAM,mBAAmB,GAAG,CAAC,EAClC,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,QAAQ,GAMT,KAAI;AACH,IAAA,MAAM,EAAE,0BAA0B,EAAE,gBAAgB,EAAE,GAAG,iBAAiB,CAAC;AAE3E,IAAA,MAAM,eAAe,GAAG,gBAAgB,GAAG,iBAAiB,CAAC,CAAC;IAE9D,MAAM,yBAAyB,GAC7B,0BAA0B,GAAG,eAAe,EAAE,2BAA2B,IAAI,EAAE,CAAC,CAAC;IACnF,MAAM,eAAe,GAAG,iBAAiB,GAAG,eAAe,EAAE,2BAA2B,IAAI,EAAE,CAAC,CAAC;AAEhG,IAAA,MAAM,oBAAoB,GACxB,CAAC,CAAC,yBAAyB,IAAI,CAAC,CAAC,eAAe,IAAI,CAAC,CAAC,eAAe,CAAC;AAExE,IAAA,OAAO,oBAAoB,IAAI,QAAQ,EAAE,IAAI,KAAK,SAAS,CAAC;AAC9D,EAAE;AAEK,MAAM,qBAAqB,GAAG,CAAC,EACpC,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,GAKlB,KAAI;IACH,MAAM,eAAe,GAAG,iBAAiB,CAAC,gBAAgB,GAAG,iBAAiB,CAAC,CAAC;AAEhF,IAAA,IAAI,CAAC,eAAe;AAAE,QAAA,OAAO,EAAE,CAAC;IAEhC,MAAM,eAAe,GAAG,iBAAiB,GAAG,eAAe,CAAC,2BAA2B,CAAC,CAAC;AAEzF,IAAA,IAAI,CAAC,eAAe;AAAE,QAAA,OAAO,EAAE,CAAC;AAEhC,IAAA,MAAM,WAAW,GAAG,eAAe,CAAC,WAAW,CAAC;IAEhD,MAAM,SAAS,GAAG,eAAe,EAAE,kBAAkB,GAAG,WAAW,CAAC,EAAE,IAAI,CAAC;AAE3E,IAAA,IAAI,CAAC,SAAS;AAAE,QAAA,OAAO,EAAE,CAAC;AAE1B,IAAA,OAAO,eAAe,CAAC,IAAI,GAAG,SAAS,CAAC;AAC1C;;;;"}
1
+ {"version":3,"file":"prebindingUtils.js","sources":["../../../src/utils/prebindingUtils.ts"],"sourcesContent":["import { EntityStore } from '@contentful/experiences-core';\nimport {\n ComponentPropertyValue,\n ExperienceComponentSettings,\n PatternProperty,\n} from '@contentful/experiences-validators';\n\nexport const shouldUsePrebinding = ({\n componentValueKey,\n componentSettings,\n patternProperties,\n variable,\n}: {\n componentValueKey: string;\n componentSettings: ExperienceComponentSettings;\n patternProperties: Record<string, PatternProperty>;\n variable: ComponentPropertyValue;\n}) => {\n const { patternPropertyDefinitions, variableMappings } = componentSettings;\n\n const variableMapping = variableMappings?.[componentValueKey];\n\n const patternPropertyDefinition =\n patternPropertyDefinitions?.[variableMapping?.patternPropertyDefinitionId || ''];\n const patternProperty = patternProperties?.[variableMapping?.patternPropertyDefinitionId || ''];\n\n const isValidForPrebinding =\n !!patternPropertyDefinition && !!patternProperty && !!variableMapping;\n\n return isValidForPrebinding && variable?.type === 'NoValue';\n};\n\nexport const resolvePrebindingPath = ({\n componentValueKey,\n componentSettings,\n patternProperties,\n entityStore,\n}: {\n componentValueKey: string;\n componentSettings: ExperienceComponentSettings;\n patternProperties: Record<string, PatternProperty>;\n entityStore: EntityStore;\n}) => {\n const variableMapping = componentSettings.variableMappings?.[componentValueKey];\n\n if (!variableMapping) return '';\n\n const patternProperty = patternProperties?.[variableMapping.patternPropertyDefinitionId];\n\n if (!patternProperty) return '';\n\n const dataSourceKey = patternProperty.path.split('/')[1];\n\n const entityLink = entityStore.dataSource[dataSourceKey];\n if (!entityLink) return '';\n\n const entity = entityStore.getEntityFromLink(entityLink);\n if (!entity || entity.sys.type === 'Asset') return '';\n\n const contentType = entity.sys.contentType.sys.id;\n\n const fieldPath = variableMapping?.pathsByContentType?.[contentType]?.path;\n\n if (!fieldPath) return '';\n\n return patternProperty.path + fieldPath;\n};\n"],"names":[],"mappings":"AAOO,MAAM,mBAAmB,GAAG,CAAC,EAClC,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,QAAQ,GAMT,KAAI;AACH,IAAA,MAAM,EAAE,0BAA0B,EAAE,gBAAgB,EAAE,GAAG,iBAAiB,CAAC;AAE3E,IAAA,MAAM,eAAe,GAAG,gBAAgB,GAAG,iBAAiB,CAAC,CAAC;IAE9D,MAAM,yBAAyB,GAC7B,0BAA0B,GAAG,eAAe,EAAE,2BAA2B,IAAI,EAAE,CAAC,CAAC;IACnF,MAAM,eAAe,GAAG,iBAAiB,GAAG,eAAe,EAAE,2BAA2B,IAAI,EAAE,CAAC,CAAC;AAEhG,IAAA,MAAM,oBAAoB,GACxB,CAAC,CAAC,yBAAyB,IAAI,CAAC,CAAC,eAAe,IAAI,CAAC,CAAC,eAAe,CAAC;AAExE,IAAA,OAAO,oBAAoB,IAAI,QAAQ,EAAE,IAAI,KAAK,SAAS,CAAC;AAC9D,EAAE;AAEK,MAAM,qBAAqB,GAAG,CAAC,EACpC,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,GAMZ,KAAI;IACH,MAAM,eAAe,GAAG,iBAAiB,CAAC,gBAAgB,GAAG,iBAAiB,CAAC,CAAC;AAEhF,IAAA,IAAI,CAAC,eAAe;AAAE,QAAA,OAAO,EAAE,CAAC;IAEhC,MAAM,eAAe,GAAG,iBAAiB,GAAG,eAAe,CAAC,2BAA2B,CAAC,CAAC;AAEzF,IAAA,IAAI,CAAC,eAAe;AAAE,QAAA,OAAO,EAAE,CAAC;AAEhC,IAAA,MAAM,aAAa,GAAG,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAEzD,MAAM,UAAU,GAAG,WAAW,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACzD,IAAA,IAAI,CAAC,UAAU;AAAE,QAAA,OAAO,EAAE,CAAC;IAE3B,MAAM,MAAM,GAAG,WAAW,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACzD,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,KAAK,OAAO;AAAE,QAAA,OAAO,EAAE,CAAC;IAEtD,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;IAElD,MAAM,SAAS,GAAG,eAAe,EAAE,kBAAkB,GAAG,WAAW,CAAC,EAAE,IAAI,CAAC;AAE3E,IAAA,IAAI,CAAC,SAAS;AAAE,QAAA,OAAO,EAAE,CAAC;AAE1B,IAAA,OAAO,eAAe,CAAC,IAAI,GAAG,SAAS,CAAC;AAC1C;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experiences-sdk-react",
3
- "version": "1.41.0-dev-20250611T1249-85aabd5.0",
3
+ "version": "1.41.0-dev-20250612T1212-618fdd9.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "typings": "./dist/src/index.d.ts",
@@ -41,10 +41,10 @@
41
41
  "depcruise": "depcruise src"
42
42
  },
43
43
  "dependencies": {
44
- "@contentful/experiences-components-react": "1.41.0-dev-20250611T1249-85aabd5.0",
45
- "@contentful/experiences-core": "1.41.0-dev-20250611T1249-85aabd5.0",
46
- "@contentful/experiences-validators": "1.41.0-dev-20250611T1249-85aabd5.0",
47
- "@contentful/experiences-visual-editor-react": "1.41.0-dev-20250611T1249-85aabd5.0",
44
+ "@contentful/experiences-components-react": "1.41.0-dev-20250612T1212-618fdd9.0",
45
+ "@contentful/experiences-core": "1.41.0-dev-20250612T1212-618fdd9.0",
46
+ "@contentful/experiences-validators": "1.41.0-dev-20250612T1212-618fdd9.0",
47
+ "@contentful/experiences-visual-editor-react": "1.41.0-dev-20250612T1212-618fdd9.0",
48
48
  "@contentful/rich-text-types": "^17.0.0",
49
49
  "classnames": "^2.3.2",
50
50
  "csstype": "^3.1.2",
@@ -102,5 +102,5 @@
102
102
  "dist",
103
103
  "package.json"
104
104
  ],
105
- "gitHead": "f97dc8aaf8cee75fcedb2c07070738fcc5eee0fc"
105
+ "gitHead": "62cf9421a82407e540656700bee054795a8567b1"
106
106
  }