@contentful/experiences-sdk-react 3.8.0-beta.1 → 3.8.0-beta.3

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.
Files changed (31) hide show
  1. package/dist/blocks/preview/CompositionBlock.js +43 -36
  2. package/dist/blocks/preview/CompositionBlock.js.map +1 -1
  3. package/dist/blocks/preview/PreviewDeliveryRoot.js +18 -1
  4. package/dist/blocks/preview/PreviewDeliveryRoot.js.map +1 -1
  5. package/dist/core/preview/PrebindingManager.js +249 -0
  6. package/dist/core/preview/PrebindingManager.js.map +1 -0
  7. package/dist/core/preview/assemblyUtils.js +74 -38
  8. package/dist/core/preview/assemblyUtils.js.map +1 -1
  9. package/dist/core/sdkFeatures.js +1 -0
  10. package/dist/core/sdkFeatures.js.map +1 -1
  11. package/dist/core/styles/createStylesheetsForBuiltInStyles.js +1 -1
  12. package/dist/core/styles/createStylesheetsForBuiltInStyles.js.map +1 -1
  13. package/dist/index.d.ts +1 -1
  14. package/dist/sdkVersion.js +1 -1
  15. package/dist/sdkVersion.js.map +1 -1
  16. package/dist/src/blocks/preview/CompositionBlock.d.ts +3 -3
  17. package/dist/src/blocks/preview/PreviewDeliveryRoot.d.ts +1 -1
  18. package/dist/src/core/preview/PrebindingManager.d.ts +152 -0
  19. package/dist/src/core/preview/PrebindingManager.test.d.ts +1 -0
  20. package/dist/src/core/preview/__fixtures__.d.ts +517 -0
  21. package/dist/src/core/preview/assemblyUtils.d.ts +17 -8
  22. package/dist/src/core/styles/createStylesheetsForBuiltInStyles.d.ts +1 -1
  23. package/dist/src/sdkVersion.d.ts +1 -1
  24. package/dist/src/utils/parseComponentProps.d.ts +9 -3
  25. package/dist/src/utils/prebindingUtils.d.ts +6 -3
  26. package/dist/test/__fixtures__/assembly.d.ts +5 -2
  27. package/dist/utils/parseComponentProps.js +2 -2
  28. package/dist/utils/parseComponentProps.js.map +1 -1
  29. package/dist/utils/prebindingUtils.js +26 -12
  30. package/dist/utils/prebindingUtils.js.map +1 -1
  31. package/package.json +6 -6
@@ -1,29 +1,34 @@
1
- import { mergeDesignValuesByBreakpoint } from '@contentful/experiences-core';
2
- import md5 from 'md5';
1
+ import { mergeDesignValuesByBreakpoint, checkIsAssemblyNode } from '@contentful/experiences-core';
3
2
  import { shouldUsePrebinding, resolvePrebindingPath } from '../../utils/prebindingUtils.js';
4
- import { PATTERN_PROPERTY_DIVIDER } from '@contentful/experiences-core/constants';
3
+ import { PrebindingManager } from './PrebindingManager.js';
5
4
 
6
5
  /** While unfolding the pattern definition on the instance, this function will replace all
7
6
  * ComponentValue in the definitions tree with the actual value on the instance. */
8
- const deserializePatternNode = ({ node, componentInstanceVariables, componentSettings, parameters, entityStore, }) => {
7
+ const deserializePatternNode = ({ node, rootPatternVariables, componentSettings, entityStore, rootPatternParameters, parentPatternRootNodeIdsChain, }) => {
9
8
  const variables = {};
9
+ let parentPatternNodeId = parentPatternRootNodeIdsChain.slice(-1)[0];
10
+ if (parentPatternNodeId === node.id) {
11
+ parentPatternNodeId = parentPatternRootNodeIdsChain.slice(-2)[0];
12
+ }
10
13
  for (const [variableName, variable] of Object.entries(node.variables)) {
11
14
  variables[variableName] = variable;
12
15
  if (variable.type === 'ComponentValue') {
13
16
  const componentValueKey = variable.key;
14
- const instanceProperty = componentInstanceVariables[componentValueKey];
17
+ const instanceProperty = rootPatternVariables[componentValueKey];
15
18
  const variableDefinition = componentSettings.variableDefinitions?.[componentValueKey];
16
19
  const defaultValue = variableDefinition?.defaultValue;
17
20
  const usePrebinding = shouldUsePrebinding({
18
21
  componentSettings,
19
22
  componentValueKey,
20
- parameters: parameters,
23
+ parameters: rootPatternParameters,
24
+ patternRootNodeIdsChain: parentPatternRootNodeIdsChain,
21
25
  });
22
26
  const path = resolvePrebindingPath({
23
27
  componentSettings,
24
28
  componentValueKey,
25
- parameters: parameters,
29
+ parameters: rootPatternParameters,
26
30
  entityStore,
31
+ patternRootNodeIdsChain: parentPatternRootNodeIdsChain,
27
32
  });
28
33
  if (usePrebinding && path) {
29
34
  variables[variableName] = {
@@ -59,6 +64,12 @@ const deserializePatternNode = ({ node, componentInstanceVariables, componentSet
59
64
  else if (instanceProperty?.type === 'DesignValue') {
60
65
  variables[variableName] = mergeDesignValuesByBreakpoint(defaultValue, instanceProperty);
61
66
  }
67
+ else if (instanceProperty?.type === 'ComponentValue') {
68
+ if (!usePrebinding) {
69
+ // @ts-expect-error ignore for now
70
+ variables[variableName] = defaultValue;
71
+ }
72
+ }
62
73
  else if (!instanceProperty && defaultValue) {
63
74
  // So far, we only automatically fallback to the defaultValue for design properties
64
75
  if (variableDefinition.group === 'style') {
@@ -70,60 +81,85 @@ const deserializePatternNode = ({ node, componentInstanceVariables, componentSet
70
81
  }
71
82
  }
72
83
  }
73
- const children = node.children.map((child) => deserializePatternNode({
74
- node: child,
75
- componentInstanceVariables,
76
- componentSettings,
77
- parameters,
78
- entityStore,
79
- }));
84
+ const children = node.children.map((child) => {
85
+ const isPatternNode = checkIsAssemblyNode({
86
+ componentId: child.definitionId,
87
+ usedComponents: entityStore.usedComponents,
88
+ });
89
+ if (isPatternNode) {
90
+ return deserializePatternNode({
91
+ node: child,
92
+ rootPatternVariables,
93
+ componentSettings,
94
+ entityStore,
95
+ rootPatternParameters,
96
+ parentPatternRootNodeIdsChain,
97
+ });
98
+ }
99
+ return deserializePatternNode({
100
+ node: child,
101
+ rootPatternVariables,
102
+ componentSettings,
103
+ entityStore,
104
+ rootPatternParameters,
105
+ parentPatternRootNodeIdsChain,
106
+ });
107
+ });
108
+ const patternsChain = parentPatternRootNodeIdsChain.join('---');
109
+ const indexedNodeId = patternsChain ? [patternsChain, node.id].join('-') : node.id;
80
110
  return {
81
111
  definitionId: node.definitionId,
82
112
  id: node.id,
83
113
  variables,
84
114
  children,
115
+ pattern: {
116
+ nodeIdOnPattern: node.id,
117
+ parentPatternNodeId,
118
+ prefixedNodeId: indexedNodeId,
119
+ },
85
120
  slotId: node.slotId,
86
121
  displayName: node.displayName,
87
122
  parameters: node.parameters,
88
123
  };
89
124
  };
90
- const resolvePattern = ({ node, parentParameters, patternRootNodeIdsChain, entityStore, }) => {
125
+ const resolvePattern = ({ node, entityStore, parentPatternRootNodeIdsChain, rootPatternParameters, }) => {
91
126
  const componentId = node.definitionId;
92
- const assembly = entityStore.usedComponents?.find((component) => component.sys.id === componentId);
93
- if (!assembly || !('fields' in assembly)) {
127
+ const patternEntry = entityStore.usedComponents?.find((component) => component.sys.id === componentId);
128
+ if (!patternEntry || !('fields' in patternEntry)) {
94
129
  return node;
95
130
  }
96
- const parameters = {};
97
- const allParameters = {
98
- ...parentParameters,
99
- ...(node.parameters || {}),
100
- };
101
- for (const [parameterKey, parameter] of Object.entries(allParameters)) {
102
- /**
103
- * Bubbled up pattern properties are a concatenation of the node id
104
- * and the pattern property definition id. We need to split them so
105
- * that the node only uses the pattern property definition id.
106
- */
107
- const [hashKey, parameterId] = parameterKey.split(PATTERN_PROPERTY_DIVIDER);
108
- const hashedNodeChain = md5(patternRootNodeIdsChain || '');
109
- const isMatchingNode = hashKey === hashedNodeChain;
110
- if (!isMatchingNode)
111
- continue;
112
- parameters[parameterId] = parameter;
131
+ const componentFields = patternEntry.fields;
132
+ const parameters = rootPatternParameters;
133
+ let nodeParameters;
134
+ if (rootPatternParameters) {
135
+ nodeParameters = {};
136
+ const prebindingDefinitions = componentFields.componentSettings?.prebindingDefinitions ?? [];
137
+ const indexedNodeId = parentPatternRootNodeIdsChain.join('---');
138
+ PrebindingManager.linkOriginalNodeIds(indexedNodeId, node.id);
139
+ PrebindingManager.storePrebindingDefinitions(indexedNodeId, componentId, prebindingDefinitions);
140
+ const prebindingDefinition = prebindingDefinitions[0];
141
+ if (prebindingDefinition && prebindingDefinition.parameterDefinitions) {
142
+ for (const [parameterId] of Object.entries(prebindingDefinition.parameterDefinitions)) {
143
+ const hoistedParameterId = PrebindingManager.getHoistedIdForParameterId(parameterId, indexedNodeId);
144
+ if (rootPatternParameters[hoistedParameterId]) {
145
+ nodeParameters[parameterId] = rootPatternParameters[hoistedParameterId];
146
+ }
147
+ }
148
+ }
113
149
  }
114
- const componentFields = assembly.fields;
115
150
  const deserializedNode = deserializePatternNode({
116
151
  node: {
117
152
  definitionId: node.definitionId,
118
153
  id: node.id,
119
154
  variables: node.variables,
120
155
  children: componentFields.componentTree.children,
121
- parameters: parameters,
156
+ parameters: nodeParameters,
122
157
  },
123
- componentInstanceVariables: node.variables,
158
+ rootPatternVariables: node.variables,
124
159
  componentSettings: componentFields.componentSettings,
125
- parameters: parameters,
126
160
  entityStore,
161
+ rootPatternParameters: parameters,
162
+ parentPatternRootNodeIdsChain,
127
163
  });
128
164
  entityStore.addAssemblyUnboundValues(componentFields.unboundValues);
129
165
  return deserializedNode;
@@ -1 +1 @@
1
- {"version":3,"file":"assemblyUtils.js","sources":["../../../../src/core/preview/assemblyUtils.ts"],"sourcesContent":["import { EntityStore, mergeDesignValuesByBreakpoint } from '@contentful/experiences-core';\nimport md5 from 'md5';\nimport type {\n ComponentPropertyValue,\n ComponentTreeNode,\n DesignValue,\n ExperienceComponentSettings,\n Parameter,\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 pattern definition on the instance, this function will replace all\n * ComponentValue in the definitions tree with the actual value on the instance. */\nexport const deserializePatternNode = ({\n node,\n componentInstanceVariables,\n componentSettings,\n parameters,\n entityStore,\n}: {\n node: ComponentTreeNode;\n componentInstanceVariables: ComponentTreeNode['variables'];\n componentSettings: ExperienceComponentSettings;\n parameters: Record<string, Parameter>;\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 parameters: parameters,\n });\n const path = resolvePrebindingPath({\n componentSettings,\n componentValueKey,\n parameters: parameters,\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 throw new Error(\n `Unexpected NoValue for variable \"${variableName}\" when deserializing pattern \"${node.definitionId}\". ` +\n `This can only happen if you created experience in pre-release version of prebinding and experience contains NoValue properties. ` +\n `Resave experience to fix this issue.`,\n );\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] = mergeDesignValuesByBreakpoint(\n defaultValue as DesignValue | undefined,\n instanceProperty,\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 deserializePatternNode({\n node: child,\n componentInstanceVariables,\n componentSettings,\n parameters,\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 parameters: node.parameters,\n };\n};\n\nexport const resolvePattern = ({\n node,\n parentParameters,\n patternRootNodeIdsChain,\n entityStore,\n}: {\n node: ComponentTreeNode;\n entityStore: EntityStore;\n parentParameters: Record<string, Parameter>;\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 parameters: Record<string, Parameter> = {};\n\n const allParameters = {\n ...parentParameters,\n ...(node.parameters || {}),\n };\n\n for (const [parameterKey, parameter] of Object.entries(allParameters)) {\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, parameterId] = parameterKey.split(PATTERN_PROPERTY_DIVIDER);\n\n const hashedNodeChain = md5(patternRootNodeIdsChain || '');\n\n const isMatchingNode = hashKey === hashedNodeChain;\n\n if (!isMatchingNode) continue;\n\n parameters[parameterId] = parameter;\n }\n\n const componentFields = assembly.fields;\n\n const deserializedNode = deserializePatternNode({\n node: {\n definitionId: node.definitionId,\n id: node.id,\n variables: node.variables,\n children: componentFields.componentTree.children,\n parameters: parameters,\n },\n componentInstanceVariables: node.variables,\n componentSettings: componentFields.componentSettings!,\n parameters: parameters,\n entityStore,\n });\n\n entityStore.addAssemblyUnboundValues(componentFields.unboundValues);\n\n return deserializedNode;\n};\n"],"names":[],"mappings":";;;;;AAYA;AACmF;AACtE,MAAA,sBAAsB,GAAG,CAAC,EACrC,IAAI,EACJ,0BAA0B,EAC1B,iBAAiB,EACjB,UAAU,EACV,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,QAAA,IAAI,QAAQ,CAAC,IAAI,KAAK,gBAAgB,EAAE;AACtC,YAAA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AAiB,EAAE,eAAe,CAAC,iBAAkB;AACrD,QAAA,UAAU,EAAE,UAAU;QACtB,WAAW;AACZ,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 {\n checkIsAssemblyNode,\n EntityStore,\n mergeDesignValuesByBreakpoint,\n} from '@contentful/experiences-core';\nimport type {\n ComponentPropertyValue,\n ComponentTreeNode,\n DesignValue,\n ExperienceComponentSettings,\n Parameter,\n} from '@contentful/experiences-core/types';\nimport { resolvePrebindingPath, shouldUsePrebinding } from '../../utils/prebindingUtils';\nimport { PrebindingManager } from './PrebindingManager';\n\ntype ComponentTreeNodeWithPatternInformation = ComponentTreeNode & {\n pattern?: {\n parentPatternNodeId: string;\n nodeIdOnPattern: string;\n prefixedNodeId: string;\n };\n};\n\n/** While unfolding the pattern definition on the instance, this function will replace all\n * ComponentValue in the definitions tree with the actual value on the instance. */\nexport const deserializePatternNode = ({\n node,\n rootPatternVariables,\n componentSettings,\n entityStore,\n rootPatternParameters,\n parentPatternRootNodeIdsChain,\n}: {\n node: ComponentTreeNode;\n rootPatternVariables: ComponentTreeNode['variables'];\n componentSettings: ExperienceComponentSettings;\n entityStore: EntityStore;\n rootPatternParameters: Record<string, Parameter>;\n parentPatternRootNodeIdsChain: string[];\n}): ComponentTreeNodeWithPatternInformation => {\n const variables: Record<string, ComponentPropertyValue> = {};\n\n let parentPatternNodeId = parentPatternRootNodeIdsChain.slice(-1)[0];\n if (parentPatternNodeId === node.id) {\n parentPatternNodeId = parentPatternRootNodeIdsChain.slice(-2)[0];\n }\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 = rootPatternVariables[componentValueKey];\n const variableDefinition = componentSettings.variableDefinitions?.[componentValueKey];\n const defaultValue = variableDefinition?.defaultValue;\n\n const usePrebinding = shouldUsePrebinding({\n componentSettings,\n componentValueKey,\n parameters: rootPatternParameters,\n patternRootNodeIdsChain: parentPatternRootNodeIdsChain,\n });\n const path = resolvePrebindingPath({\n componentSettings,\n componentValueKey,\n parameters: rootPatternParameters,\n entityStore,\n patternRootNodeIdsChain: parentPatternRootNodeIdsChain,\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 throw new Error(\n `Unexpected NoValue for variable \"${variableName}\" when deserializing pattern \"${node.definitionId}\". ` +\n `This can only happen if you created experience in pre-release version of prebinding and experience contains NoValue properties. ` +\n `Resave experience to fix this issue.`,\n );\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] = mergeDesignValuesByBreakpoint(\n defaultValue as DesignValue | undefined,\n instanceProperty,\n );\n } else if (instanceProperty?.type === 'ComponentValue') {\n if (!usePrebinding) {\n // @ts-expect-error ignore for now\n variables[variableName] = defaultValue;\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 const isPatternNode = checkIsAssemblyNode({\n componentId: child.definitionId,\n usedComponents: entityStore.usedComponents,\n });\n\n if (isPatternNode) {\n return deserializePatternNode({\n node: child,\n rootPatternVariables,\n componentSettings,\n entityStore,\n rootPatternParameters,\n parentPatternRootNodeIdsChain,\n });\n }\n\n return deserializePatternNode({\n node: child,\n rootPatternVariables,\n componentSettings,\n entityStore,\n rootPatternParameters,\n parentPatternRootNodeIdsChain,\n });\n });\n\n const patternsChain = parentPatternRootNodeIdsChain.join('---');\n const indexedNodeId = patternsChain ? [patternsChain, node.id!].join('-') : node.id!;\n\n return {\n definitionId: node.definitionId,\n id: node.id,\n variables,\n children,\n pattern: {\n nodeIdOnPattern: node.id!,\n parentPatternNodeId,\n prefixedNodeId: indexedNodeId,\n },\n slotId: node.slotId,\n displayName: node.displayName,\n parameters: node.parameters,\n };\n};\n\nexport const resolvePattern = ({\n node,\n entityStore,\n parentPatternRootNodeIdsChain,\n rootPatternParameters,\n}: {\n node: ComponentTreeNode;\n entityStore: EntityStore;\n parentPatternRootNodeIdsChain: string[];\n rootPatternParameters: Record<string, Parameter>;\n}): ComponentTreeNodeWithPatternInformation => {\n const componentId = node.definitionId as string;\n const patternEntry = entityStore.usedComponents?.find(\n (component) => component.sys.id === componentId,\n );\n\n if (!patternEntry || !('fields' in patternEntry)) {\n return node;\n }\n\n const componentFields = patternEntry.fields;\n const parameters = rootPatternParameters;\n let nodeParameters: Record<string, Parameter> | undefined;\n\n if (rootPatternParameters) {\n nodeParameters = {};\n const prebindingDefinitions = componentFields.componentSettings?.prebindingDefinitions ?? [];\n const indexedNodeId = parentPatternRootNodeIdsChain.join('---');\n PrebindingManager.linkOriginalNodeIds(indexedNodeId, node.id!);\n PrebindingManager.storePrebindingDefinitions(indexedNodeId, componentId, prebindingDefinitions);\n\n const prebindingDefinition = prebindingDefinitions[0];\n\n if (prebindingDefinition && prebindingDefinition.parameterDefinitions) {\n for (const [parameterId] of Object.entries(prebindingDefinition.parameterDefinitions)) {\n const hoistedParameterId = PrebindingManager.getHoistedIdForParameterId(\n parameterId,\n indexedNodeId,\n );\n if (rootPatternParameters[hoistedParameterId]) {\n nodeParameters[parameterId] = rootPatternParameters[hoistedParameterId];\n }\n }\n }\n }\n\n const deserializedNode = deserializePatternNode({\n node: {\n definitionId: node.definitionId,\n id: node.id,\n variables: node.variables,\n children: componentFields.componentTree.children,\n parameters: nodeParameters,\n },\n rootPatternVariables: node.variables,\n componentSettings: componentFields.componentSettings!,\n entityStore,\n rootPatternParameters: parameters,\n parentPatternRootNodeIdsChain,\n });\n\n entityStore.addAssemblyUnboundValues(componentFields.unboundValues);\n\n return deserializedNode;\n};\n"],"names":[],"mappings":";;;;AAuBA;AACmF;AACtE,MAAA,sBAAsB,GAAG,CAAC,EACrC,IAAI,EACJ,oBAAoB,EACpB,iBAAiB,EACjB,WAAW,EACX,qBAAqB,EACrB,6BAA6B,GAQ9B,KAA6C;IAC5C,MAAM,SAAS,GAA2C,EAAE,CAAC;AAE7D,IAAA,IAAI,mBAAmB,GAAG,6BAA6B,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrE,IAAA,IAAI,mBAAmB,KAAK,IAAI,CAAC,EAAE,EAAE;QACnC,mBAAmB,GAAG,6BAA6B,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAClE;AAED,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,QAAA,IAAI,QAAQ,CAAC,IAAI,KAAK,gBAAgB,EAAE;AACtC,YAAA,MAAM,iBAAiB,GAAG,QAAQ,CAAC,GAAG,CAAC;AACvC,YAAA,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;YACjE,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,m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CAAC,aAAa,CAAC,CAAC;AAEpE,IAAA,OAAO,gBAAgB,CAAC;AAC1B;;;;"}
@@ -8,6 +8,7 @@ const sdkFeatures = {
8
8
  patternBreakpointDesignValues: true,
9
9
  // DND is moving to the host application enabling smoother native event handling
10
10
  dndMigration: true,
11
+ hasPrebinding: true,
11
12
  };
12
13
 
13
14
  export { sdkFeatures };
@@ -1 +1 @@
1
- {"version":3,"file":"sdkFeatures.js","sources":["../../../src/core/sdkFeatures.ts"],"sourcesContent":["// Object to store the SDK features that are enabled/disabled\nexport const sdkFeatures: Record<string, unknown> = {\n hasSDKVersionUI: true,\n hasVersionHistory: true,\n cfVisibility: true,\n patternResolution: true,\n // [SPA-2602] allow merging the default and overwriting design values for patterns by breakpoint\n patternBreakpointDesignValues: true,\n // DND is moving to the host application enabling smoother native event handling\n dndMigration: true,\n};\n"],"names":[],"mappings":"AAAA;AACa,MAAA,WAAW,GAA4B;AAClD,IAAA,eAAe,EAAE,IAAI;AACrB,IAAA,iBAAiB,EAAE,IAAI;AACvB,IAAA,YAAY,EAAE,IAAI;AAClB,IAAA,iBAAiB,EAAE,IAAI;;AAEvB,IAAA,6BAA6B,EAAE,IAAI;;AAEnC,IAAA,YAAY,EAAE,IAAI;;;;;"}
1
+ {"version":3,"file":"sdkFeatures.js","sources":["../../../src/core/sdkFeatures.ts"],"sourcesContent":["// Object to store the SDK features that are enabled/disabled\nexport const sdkFeatures: Record<string, unknown> = {\n hasSDKVersionUI: true,\n hasVersionHistory: true,\n cfVisibility: true,\n patternResolution: true,\n // [SPA-2602] allow merging the default and overwriting design values for patterns by breakpoint\n patternBreakpointDesignValues: true,\n // DND is moving to the host application enabling smoother native event handling\n dndMigration: true,\n hasPrebinding: true,\n};\n"],"names":[],"mappings":"AAAA;AACa,MAAA,WAAW,GAA4B;AAClD,IAAA,eAAe,EAAE,IAAI;AACrB,IAAA,iBAAiB,EAAE,IAAI;AACvB,IAAA,YAAY,EAAE,IAAI;AAClB,IAAA,iBAAiB,EAAE,IAAI;;AAEvB,IAAA,6BAA6B,EAAE,IAAI;;AAEnC,IAAA,YAAY,EAAE,IAAI;AAClB,IAAA,aAAa,EAAE,IAAI;;;;;"}
@@ -59,7 +59,7 @@ const createStylesheetsForBuiltInStyles = ({ designPropertiesByBreakpoint, break
59
59
  */
60
60
  // Create a hash ensuring stability across nodes (and breakpoints between nodes)
61
61
  const styleHash = patternRootNodeIdsChain
62
- ? md5(`${patternRootNodeIdsChain}-${node.id}}-${breakpointCss}`)
62
+ ? md5([...patternRootNodeIdsChain, node.id, breakpointCss].join('-'))
63
63
  : md5(`${node.id}-${breakpointCss}`);
64
64
  // Create a CSS className with internal prefix to make sure the value can be processed
65
65
  const className = `cfstyles-${styleHash}`;
@@ -1 +1 @@
1
- {"version":3,"file":"createStylesheetsForBuiltInStyles.js","sources":["../../../../src/core/styles/createStylesheetsForBuiltInStyles.ts"],"sourcesContent":["import {\n addMinHeightForEmptyStructures,\n designTokensRegistry,\n flattenDesignTokenRegistry,\n maybePopulateDesignTokenValue,\n stringifyCssProperties,\n buildCfStyles,\n transformVisibility,\n} from '@contentful/experiences-core';\nimport { Breakpoint, ComponentTreeNode, PrimitiveValue } from '@contentful/experiences-core/types';\nimport md5 from 'md5';\n\nexport type ResolvedStylesheetData = Array<{\n className: string;\n breakpointCondition: string;\n css: string;\n visibilityCss?: string;\n}>;\n\n/**\n * For each provided breakpoint, create the CSS code and a unique class name.\n *\n * **Example Output:**\n * ```\n * [\n * { className: 'cfstyles-123', breakpointCondition: '*', css: 'margin:42px;' },\n * { className: 'cfstyles-456', breakpointCondition: '<768px', css: 'margin:13px;' },\n * ]\n * ```\n */\nexport const createStylesheetsForBuiltInStyles = ({\n designPropertiesByBreakpoint,\n breakpoints,\n node,\n patternRootNodeIdsChain,\n}: {\n designPropertiesByBreakpoint: Record<string, Record<string, PrimitiveValue>>;\n breakpoints: Breakpoint[];\n node: ComponentTreeNode;\n patternRootNodeIdsChain?: string;\n}): ResolvedStylesheetData => {\n const flattenedDesignTokens = flattenDesignTokenRegistry(designTokensRegistry);\n\n // When the node is hidden for any breakpoint, we need to handle this separately with a disjunct media query.\n const isAnyVisibilityValueHidden = Object.values(designPropertiesByBreakpoint).some(\n (designProperties) => designProperties.cfVisibility === false,\n );\n // We always need an explicit value when using disjunct media queries\n // Example: desktop uses \"false\" and tablet is undefined -> we need to set `display: none` for tablet as well.\n let previousVisibilityValue: boolean | undefined;\n\n const result: Array<{\n className: string;\n breakpointCondition: string;\n css: string;\n visibilityCss?: string;\n }> = [];\n\n for (const breakpoint of breakpoints) {\n let visibilityCss: string | undefined;\n const designProperties = designPropertiesByBreakpoint[breakpoint.id];\n if (!designProperties) {\n continue;\n }\n\n const designPropertiesWithResolvedDesignTokens = Object.entries(designProperties).reduce(\n (acc, [propertyName, value]) => ({\n ...acc,\n [propertyName]: maybePopulateDesignTokenValue(\n propertyName,\n value,\n flattenedDesignTokens,\n ) as string,\n }),\n {} as Record<string, PrimitiveValue>,\n );\n /* [Data Format] `designPropertiesWithResolvedDesignTokens` is a map of property name to plain design value:\n * designPropertiesWithResolvedDesignTokens = {\n * cfMargin: '42px',\n * cfBackgroundColor: 'rgba(246, 246, 246, 1)',\n * }\n */\n\n // Special case for visibility to override any custom `display` values but only for a specific breakpoint.\n if (isAnyVisibilityValueHidden) {\n const visibilityValue =\n (designPropertiesWithResolvedDesignTokens.cfVisibility as boolean | undefined) ??\n previousVisibilityValue;\n previousVisibilityValue = visibilityValue;\n const visibilityStyles = transformVisibility(visibilityValue);\n visibilityCss = stringifyCssProperties(visibilityStyles);\n }\n\n // Convert CF-specific property names to CSS variables, e.g. `cfMargin` -> `margin`\n const cfStyles = addMinHeightForEmptyStructures(\n buildCfStyles(designPropertiesWithResolvedDesignTokens),\n node,\n );\n /* [Data Format] `cfStyles` follows the shape of CSSProperties (camelCased CSS property names):\n * cfStyles = {\n * margin: '42px',\n * backgroundColor: 'rgba(246, 246, 246, 1)',\n * }\n */\n\n // Translate the map of CSSProperties into the final shape of CSS code for this specific breakpoint\n const breakpointCss = stringifyCssProperties(cfStyles);\n /* [Data Format] `breakpointCss`:\n * breakpointCss = \"margin:42px;background-color:rgba(246, 246, 246, 1);\"\n */\n\n // Create a hash ensuring stability across nodes (and breakpoints between nodes)\n const styleHash = patternRootNodeIdsChain\n ? md5(`${patternRootNodeIdsChain}-${node.id}}-${breakpointCss}`)\n : md5(`${node.id}-${breakpointCss}`);\n\n // Create a CSS className with internal prefix to make sure the value can be processed\n const className = `cfstyles-${styleHash}`;\n\n result.push({\n className,\n breakpointCondition: breakpoint.query,\n css: breakpointCss,\n visibilityCss,\n });\n }\n\n return result;\n};\n"],"names":[],"mappings":";;;AAmBA;;;;;;;;;;AAUG;AACI,MAAM,iCAAiC,GAAG,CAAC,EAChD,4BAA4B,EAC5B,WAAW,EACX,IAAI,EACJ,uBAAuB,GAMxB,KAA4B;AAC3B,IAAA,MAAM,qBAAqB,GAAG,0BAA0B,CAAC,oBAAoB,CAAC,CAAC;;IAG/E,MAAM,0BAA0B,GAAG,MAAM,CAAC,MAAM,CAAC,4BAA4B,CAAC,CAAC,IAAI,CACjF,CAAC,gBAAgB,KAAK,gBAAgB,CAAC,YAAY,KAAK,KAAK,CAC9D,CAAC;;;AAGF,IAAA,IAAI,uBAA4C,CAAC;IAEjD,MAAM,MAAM,GAKP,EAAE,CAAC;AAER,IAAA,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;AACpC,QAAA,IAAI,aAAiC,CAAC;QACtC,MAAM,gBAAgB,GAAG,4BAA4B,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QACrE,IAAI,CAAC,gBAAgB,EAAE;YACrB,SAAS;SACV;QAED,MAAM,wCAAwC,GAAG,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,MAAM,CACtF,CAAC,GAAG,EAAE,CAAC,YAAY,EAAE,KAAK,CAAC,MAAM;AAC/B,YAAA,GAAG,GAAG;YACN,CAAC,YAAY,GAAG,6BAA6B,CAC3C,YAAY,EACZ,KAAK,EACL,qBAAqB,CACZ;SACZ,CAAC,EACF,EAAoC,CACrC,CAAC;AACF;;;;;AAKG;;QAGH,IAAI,0BAA0B,EAAE;AAC9B,YAAA,MAAM,eAAe,GAClB,wCAAwC,CAAC,YAAoC;AAC9E,gBAAA,uBAAuB,CAAC;YAC1B,uBAAuB,GAAG,eAAe,CAAC;AAC1C,YAAA,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,eAAe,CAAC,CAAC;AAC9D,YAAA,aAAa,GAAG,sBAAsB,CAAC,gBAAgB,CAAC,CAAC;SAC1D;;QAGD,MAAM,QAAQ,GAAG,8BAA8B,CAC7C,aAAa,CAAC,wCAAwC,CAAC,EACvD,IAAI,CACL,CAAC;AACF;;;;;AAKG;;AAGH,QAAA,MAAM,aAAa,GAAG,sBAAsB,CAAC,QAAQ,CAAC,CAAC;AACvD;;AAEG;;QAGH,MAAM,SAAS,GAAG,uBAAuB;AACvC,cAAE,GAAG,CAAC,CAAA,EAAG,uBAAuB,CAAA,CAAA,EAAI,IAAI,CAAC,EAAE,CAAA,EAAA,EAAK,aAAa,CAAA,CAAE,CAAC;cAC9D,GAAG,CAAC,CAAG,EAAA,IAAI,CAAC,EAAE,CAAI,CAAA,EAAA,aAAa,CAAE,CAAA,CAAC,CAAC;;AAGvC,QAAA,MAAM,SAAS,GAAG,CAAY,SAAA,EAAA,SAAS,EAAE,CAAC;QAE1C,MAAM,CAAC,IAAI,CAAC;YACV,SAAS;YACT,mBAAmB,EAAE,UAAU,CAAC,KAAK;AACrC,YAAA,GAAG,EAAE,aAAa;YAClB,aAAa;AACd,SAAA,CAAC,CAAC;KACJ;AAED,IAAA,OAAO,MAAM,CAAC;AAChB;;;;"}
1
+ {"version":3,"file":"createStylesheetsForBuiltInStyles.js","sources":["../../../../src/core/styles/createStylesheetsForBuiltInStyles.ts"],"sourcesContent":["import {\n addMinHeightForEmptyStructures,\n designTokensRegistry,\n flattenDesignTokenRegistry,\n maybePopulateDesignTokenValue,\n stringifyCssProperties,\n buildCfStyles,\n transformVisibility,\n} from '@contentful/experiences-core';\nimport { Breakpoint, ComponentTreeNode, PrimitiveValue } from '@contentful/experiences-core/types';\nimport md5 from 'md5';\n\nexport type ResolvedStylesheetData = Array<{\n className: string;\n breakpointCondition: string;\n css: string;\n visibilityCss?: string;\n}>;\n\n/**\n * For each provided breakpoint, create the CSS code and a unique class name.\n *\n * **Example Output:**\n * ```\n * [\n * { className: 'cfstyles-123', breakpointCondition: '*', css: 'margin:42px;' },\n * { className: 'cfstyles-456', breakpointCondition: '<768px', css: 'margin:13px;' },\n * ]\n * ```\n */\nexport const createStylesheetsForBuiltInStyles = ({\n designPropertiesByBreakpoint,\n breakpoints,\n node,\n patternRootNodeIdsChain,\n}: {\n designPropertiesByBreakpoint: Record<string, Record<string, PrimitiveValue>>;\n breakpoints: Breakpoint[];\n node: ComponentTreeNode;\n patternRootNodeIdsChain?: Array<string>;\n}): ResolvedStylesheetData => {\n const flattenedDesignTokens = flattenDesignTokenRegistry(designTokensRegistry);\n\n // When the node is hidden for any breakpoint, we need to handle this separately with a disjunct media query.\n const isAnyVisibilityValueHidden = Object.values(designPropertiesByBreakpoint).some(\n (designProperties) => designProperties.cfVisibility === false,\n );\n // We always need an explicit value when using disjunct media queries\n // Example: desktop uses \"false\" and tablet is undefined -> we need to set `display: none` for tablet as well.\n let previousVisibilityValue: boolean | undefined;\n\n const result: Array<{\n className: string;\n breakpointCondition: string;\n css: string;\n visibilityCss?: string;\n }> = [];\n\n for (const breakpoint of breakpoints) {\n let visibilityCss: string | undefined;\n const designProperties = designPropertiesByBreakpoint[breakpoint.id];\n if (!designProperties) {\n continue;\n }\n\n const designPropertiesWithResolvedDesignTokens = Object.entries(designProperties).reduce(\n (acc, [propertyName, value]) => ({\n ...acc,\n [propertyName]: maybePopulateDesignTokenValue(\n propertyName,\n value,\n flattenedDesignTokens,\n ) as string,\n }),\n {} as Record<string, PrimitiveValue>,\n );\n /* [Data Format] `designPropertiesWithResolvedDesignTokens` is a map of property name to plain design value:\n * designPropertiesWithResolvedDesignTokens = {\n * cfMargin: '42px',\n * cfBackgroundColor: 'rgba(246, 246, 246, 1)',\n * }\n */\n\n // Special case for visibility to override any custom `display` values but only for a specific breakpoint.\n if (isAnyVisibilityValueHidden) {\n const visibilityValue =\n (designPropertiesWithResolvedDesignTokens.cfVisibility as boolean | undefined) ??\n previousVisibilityValue;\n previousVisibilityValue = visibilityValue;\n const visibilityStyles = transformVisibility(visibilityValue);\n visibilityCss = stringifyCssProperties(visibilityStyles);\n }\n\n // Convert CF-specific property names to CSS variables, e.g. `cfMargin` -> `margin`\n const cfStyles = addMinHeightForEmptyStructures(\n buildCfStyles(designPropertiesWithResolvedDesignTokens),\n node,\n );\n /* [Data Format] `cfStyles` follows the shape of CSSProperties (camelCased CSS property names):\n * cfStyles = {\n * margin: '42px',\n * backgroundColor: 'rgba(246, 246, 246, 1)',\n * }\n */\n\n // Translate the map of CSSProperties into the final shape of CSS code for this specific breakpoint\n const breakpointCss = stringifyCssProperties(cfStyles);\n /* [Data Format] `breakpointCss`:\n * breakpointCss = \"margin:42px;background-color:rgba(246, 246, 246, 1);\"\n */\n\n // Create a hash ensuring stability across nodes (and breakpoints between nodes)\n const styleHash = patternRootNodeIdsChain\n ? md5([...patternRootNodeIdsChain, node.id, breakpointCss].join('-'))\n : md5(`${node.id}-${breakpointCss}`);\n\n // Create a CSS className with internal prefix to make sure the value can be processed\n const className = `cfstyles-${styleHash}`;\n\n result.push({\n className,\n breakpointCondition: breakpoint.query,\n css: breakpointCss,\n visibilityCss,\n });\n }\n\n return result;\n};\n"],"names":[],"mappings":";;;AAmBA;;;;;;;;;;AAUG;AACI,MAAM,iCAAiC,GAAG,CAAC,EAChD,4BAA4B,EAC5B,WAAW,EACX,IAAI,EACJ,uBAAuB,GAMxB,KAA4B;AAC3B,IAAA,MAAM,qBAAqB,GAAG,0BAA0B,CAAC,oBAAoB,CAAC,CAAC;;IAG/E,MAAM,0BAA0B,G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,IAAI,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;cACnE,GAAG,CAAC,CAAG,EAAA,IAAI,CAAC,EAAE,CAAI,CAAA,EAAA,aAAa,CAAE,CAAA,CAAC,CAAC;;AAGvC,QAAA,MAAM,SAAS,GAAG,CAAY,SAAA,EAAA,SAAS,EAAE,CAAC;QAE1C,MAAM,CAAC,IAAI,CAAC;YACV,SAAS;YACT,mBAAmB,EAAE,UAAU,CAAC,KAAK;AACrC,YAAA,GAAG,EAAE,aAAa;YAClB,aAAa;AACd,SAAA,CAAC,CAAC;KACJ;AAED,IAAA,OAAO,MAAM,CAAC;AAChB;;;;"}
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ import * as _contentful_experiences_core_constants from '@contentful/experiences
9
9
  export { CF_STYLE_ATTRIBUTES, CONTENTFUL_COMPONENTS, LATEST_SCHEMA_VERSION } from '@contentful/experiences-core/constants';
10
10
  import { ContentfulClientApi } from 'contentful';
11
11
 
12
- declare const SDK_VERSION = "3.8.0-beta.1";
12
+ declare const SDK_VERSION = "3.8.0-beta.3";
13
13
 
14
14
  type ExperienceRootProps = {
15
15
  experience?: Experience<EntityStore> | string | null;
@@ -1,4 +1,4 @@
1
- const SDK_VERSION = '3.8.0-beta.1';
1
+ const SDK_VERSION = '3.8.0-beta.3';
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 = '3.8.0-beta.1';\n"],"names":[],"mappings":"AAAO,MAAM,WAAW,GAAG;;;;"}
1
+ {"version":3,"file":"sdkVersion.js","sources":["../../src/sdkVersion.ts"],"sourcesContent":["export const SDK_VERSION = '3.8.0-beta.3';\n"],"names":[],"mappings":"AAAO,MAAM,WAAW,GAAG;;;;"}
@@ -9,12 +9,12 @@ type CompositionBlockProps = {
9
9
  getPatternChildNodeClassName?: (childNodeId: string) => string | undefined;
10
10
  /** Set of definition IDs of wrapping patterns to prevent circular dependencies. */
11
11
  wrappingPatternIds?: Set<string>;
12
+ rootPatternParameters?: Record<string, Parameter>;
12
13
  /**
13
14
  * Chained IDs to ensure uniqueness across multiple instances of the same pattern
14
15
  * when storing & accessing cfSsrClassName.
15
16
  */
16
- patternRootNodeIdsChain?: string;
17
- wrappingParameters?: Record<string, Parameter>;
17
+ patternRootNodeIdsChain?: Array<string>;
18
18
  };
19
- export declare const CompositionBlock: ({ node: rawNode, locale, entityStore, hyperlinkPattern, resolveDesignValue, getPatternChildNodeClassName, wrappingPatternIds: parentWrappingPatternIds, wrappingParameters: parentWrappingParameters, patternRootNodeIdsChain: parentPatternRootNodeIdsChain, }: CompositionBlockProps) => import("react/jsx-runtime").JSX.Element | null;
19
+ export declare const CompositionBlock: ({ node: rawNode, locale, entityStore, hyperlinkPattern, resolveDesignValue, getPatternChildNodeClassName, wrappingPatternIds: parentWrappingPatternIds, patternRootNodeIdsChain: parentPatternRootNodeIdsChain, rootPatternParameters, }: CompositionBlockProps) => import("react/jsx-runtime").JSX.Element | null;
20
20
  export {};
@@ -4,5 +4,5 @@ type DeliveryRootProps = {
4
4
  experience: Experience<EntityStore>;
5
5
  locale: string;
6
6
  };
7
- export declare const PreviewDeliveryRoot: ({ locale, experience }: DeliveryRootProps) => import("react/jsx-runtime").JSX.Element | null;
7
+ export declare const PreviewDeliveryRoot: ({ locale, experience }: DeliveryRootProps) => import("react/jsx-runtime").JSX.Element | import("react/jsx-runtime").JSX.Element[] | null;
8
8
  export {};
@@ -0,0 +1,152 @@
1
+ import { ExperienceComponentSettings, ParameterDefinition } from '@contentful/experiences-core/types';
2
+ export type ParameterDefinitionWithParameterId = {
3
+ parameterId: string;
4
+ parameter: ParameterDefinition;
5
+ };
6
+ /**
7
+ * PrebindingManager utility class for resolving parameter bindings across nested patterns.
8
+ *
9
+ * The core approach is to first resolve the top-level parameterId using `getParameterIdByNodeId`,
10
+ * which uses the paramIdToOverwriteIdMap, set when storing pre-binding based on the passToNodes chain to determine which parameter in the parent pattern
11
+ * overrides a given parameterId (with some additionally workaround due to node ID renaming for patterns).
12
+ * Once the owning top-level `parameterId` is found, we can follow the `passToNodes` chain back
13
+ * down to retrieve all nested overrides — including parameter definitions, allowed content types,
14
+ * and default sources — up to three levels deep.
15
+ *
16
+ * ## Lifecycle
17
+ * This utility class currently uses static state, with Zustand stores supplementing the “latest” data
18
+ * for root-level patterns data — for example, when overwriting content types on nested patterns or binding
19
+ * fields on simple patterns. If we need the override mappings to be reactive, we could easily move
20
+ * the full override chain tracking into Zustand but currently we can rely on the pattern definition
21
+ * stores we have currently.
22
+ *
23
+ * The state is populated during deserialization, where we call `storePrebindingDefinitions` for each
24
+ * pattern node. It is ready to be consumed at each level as nodes are deserialized top-down:
25
+ * 1. Pattern C (Template Pattern)
26
+ * 2. Pattern B (Nested Pattern)
27
+ * 3. Pattern A (Simple Pattern)
28
+ *
29
+ * At each level, accessing overrides is possible:
30
+ * - Pattern C has everything it needs once deserialized with its own parameters
31
+ * - Pattern B has everything it needs once deserialized, with its own parameters possibly overridden by C
32
+ * - Pattern A has its own parameters and possiblle overrites by B and/or C
33
+ *
34
+ * After actions that modify patterns without re-deserializing the tree — such as duplication,
35
+ * deletion, or detachment — this state must be kept up to date via storePrebindingDefinitions
36
+ * or storeParameterDefinitions if only parameter definitions are updated.
37
+ *
38
+ * ## Core Data Structures
39
+ *
40
+ * - prebindingDefinitions - A collection of all prebinding definitions aggregated
41
+ * from the parent pattern down to all nested patterns.
42
+ *
43
+ * - prebindingDefinitionIdsByNodeId - Same as above, but indexed by `nodeId`. This allows us
44
+ * to easily find the prebinding definition id for a given node ID.
45
+ *
46
+ * - parameterDefinitionsById - A collection of all parameter definitions aggregated
47
+ * from the parent pattern down to nested patterns.
48
+ *
49
+ * - variableMappingByPatternId - A collection of all variable mappings aggregated from
50
+ * the parent pattern down to nested patterns, indexed by
51
+ * `patternId` for efficient access.
52
+ *
53
+ * - newToOriginalNodeIdMap - When deserializing pattern child nodes, we replace their
54
+ * node IDs with new ones based on their location inside the
55
+ * pattern. This prevents conflicts when multiple instances
56
+ * of the same pattern exist. The issue is that prebinding
57
+ * `passToNodes` resolution requires the original node ID.
58
+ * This map allows us to retrieve it to follow the chain.
59
+ *
60
+ * - paramIdToOverwriteIdMap - Tracks parameter ID overrides through the `passToNodes`
61
+ * chain, allowing us to resolve overrides correctly from
62
+ * the top-level parameter down to the lowest-level.
63
+ */
64
+ export declare class PrebindingManager {
65
+ private static prebindingDefinitions;
66
+ private static prebindingDefinitionIdsByNodeId;
67
+ private static parameterDefinitionsById;
68
+ private static parameterDefinitionsByNodeId;
69
+ private static variableMappingByPatternId;
70
+ private static newToOriginalNodeIdMap;
71
+ private static paramIdToOverwriteIdMap;
72
+ /**
73
+ * Links new node IDs to original node IDs
74
+ * - This is used to track the original node IDs for pattern instances as we change them when deserializing pattern nodes.
75
+ * @param newNodeId
76
+ * @param originalNodeId
77
+ */
78
+ static linkOriginalNodeIds(newNodeId: string, originalNodeId: string): void;
79
+ /**
80
+ * Initializes the pattern editor manager by storing the definitions during deserialization
81
+ * for the root pattern and all nested patterns.
82
+ *
83
+ * @param nodeId - The ID of the pattern node.
84
+ * @param patternEntryId - The ID of the pattern entry from the patterns store.
85
+ * @param prebindingDefinitions - The prebinding definitions from the current pattern's component settings.
86
+ */
87
+ static storePrebindingDefinitions(nodeId: string, patternEntryId: string, prebindingDefinitions: NonNullable<ExperienceComponentSettings['prebindingDefinitions']>): void;
88
+ /**
89
+ * Stores parameter definitions for a given nodeId.
90
+ * @param nodeId - The ID of the node to store parameter definitions for.
91
+ * @param parameterDefinitions - The parameter definitions to store.
92
+ */
93
+ static storeParameterDefinitions(nodeId: string, parameterDefinitions?: Record<string, ParameterDefinition>): void;
94
+ /**
95
+ * Resolves the top-level parameterId for a given nodeId.
96
+ *
97
+ * @param nodeId - The nodeId to resolve the parameterId for
98
+ * @param useStoreParameters - Whether to use the zustand store parameters or not
99
+ * @returns string | undefined - The resolved parameterId or undefined if not found
100
+ **/
101
+ static getParameterIdByNodeId(nodeId: string): string | undefined;
102
+ static getParameterDefinitionsByParameterId(parameterId: string): (ParameterDefinitionWithParameterId | undefined)[] | undefined;
103
+ /**
104
+ * Returns all parameter definitions defined on the pattern of the given nodeId OR the pattern, wrapping the given nodeId
105
+ */
106
+ static getAllParameterDefinitionsForNodeId(nodeId: string): {
107
+ [k: string]: {
108
+ contentTypes: string[];
109
+ passToNodes: {
110
+ prebindingId: string;
111
+ parameterId: string;
112
+ nodeId: string;
113
+ }[];
114
+ defaultSource?: {
115
+ type: "Entry";
116
+ contentTypeId: string;
117
+ link: {
118
+ sys: {
119
+ type: "Link";
120
+ id: string;
121
+ linkType: "Entry";
122
+ };
123
+ };
124
+ } | undefined;
125
+ };
126
+ };
127
+ /**
128
+ * Return all parameter ID's on a pattern by NodeId
129
+ * @param nodeId - The nodeId to return params for
130
+ * @returns string[] An array of parameter IDs or undefined
131
+ */
132
+ static getAllParameterIdsByNodeId(nodeId: string): string[] | undefined;
133
+ /**
134
+ * Get the highest level overriding parameterId for a given parameterId + nodeId combination
135
+ * @param parameterId - The parameter to resolve
136
+ * @param indexedNodeId - The indexed node ID to resolve the parameterId for
137
+ * @returns string - The resolved parameterId - will be from "root" in patterns or the parent pattern node in experiences
138
+ */
139
+ static getHoistedIdForParameterId(parameterId: string, indexedNodeId: string): string;
140
+ /**
141
+ * Retrieves the native parameter definition for a given nodeId. ie one without passToNodes on the node.
142
+ * @param nodeId - The nodeId to retrieve the native parameter definition for
143
+ * @returns The native parameter definition for the given nodeId, or undefined if not found
144
+ */
145
+ static getNativeParameterDefinitionByNodeId(nodeId: string): ParameterDefinitionWithParameterId | undefined;
146
+ private static extractNativeParameterDefinition;
147
+ /**
148
+ * Resets all properties of the PrebindingManager class
149
+ * triggered when we leave ExperienceBuilder back to experience folder view.
150
+ **/
151
+ static reset(): void;
152
+ }
@@ -0,0 +1 @@
1
+ export {};