@contentful/experiences-sdk-react 3.8.0-beta.1 → 3.8.0-beta.2
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/blocks/preview/CompositionBlock.js +39 -36
- package/dist/blocks/preview/CompositionBlock.js.map +1 -1
- package/dist/blocks/preview/PreviewDeliveryRoot.js +18 -1
- package/dist/blocks/preview/PreviewDeliveryRoot.js.map +1 -1
- package/dist/core/preview/PrebindingManager.js +249 -0
- package/dist/core/preview/PrebindingManager.js.map +1 -0
- package/dist/core/preview/assemblyUtils.js +74 -38
- package/dist/core/preview/assemblyUtils.js.map +1 -1
- package/dist/core/sdkFeatures.js +1 -0
- package/dist/core/sdkFeatures.js.map +1 -1
- package/dist/core/styles/createStylesheetsForBuiltInStyles.js +1 -1
- package/dist/core/styles/createStylesheetsForBuiltInStyles.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/sdkVersion.js +1 -1
- package/dist/sdkVersion.js.map +1 -1
- package/dist/src/blocks/preview/CompositionBlock.d.ts +3 -3
- package/dist/src/blocks/preview/PreviewDeliveryRoot.d.ts +1 -1
- package/dist/src/core/preview/PrebindingManager.d.ts +152 -0
- package/dist/src/core/preview/PrebindingManager.test.d.ts +1 -0
- package/dist/src/core/preview/__fixtures__.d.ts +517 -0
- package/dist/src/core/preview/assemblyUtils.d.ts +17 -8
- package/dist/src/core/styles/createStylesheetsForBuiltInStyles.d.ts +1 -1
- package/dist/src/sdkVersion.d.ts +1 -1
- package/dist/src/utils/parseComponentProps.d.ts +9 -3
- package/dist/src/utils/prebindingUtils.d.ts +6 -3
- package/dist/test/__fixtures__/assembly.d.ts +5 -2
- package/dist/utils/parseComponentProps.js +2 -2
- package/dist/utils/parseComponentProps.js.map +1 -1
- package/dist/utils/prebindingUtils.js +26 -12
- package/dist/utils/prebindingUtils.js.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseComponentProps.js","sources":["../../../src/utils/parseComponentProps.ts"],"sourcesContent":["import { isCfStyleAttribute, debug } from '@contentful/experiences-core';\nimport {\n BoundComponentPropertyTypes,\n BoundValue,\n Breakpoint,\n ComponentDefinition,\n ComponentDefinitionVariable,\n ComponentDefinitionVariableType,\n ComponentTreeNode,\n DesignValue,\n PrimitiveValue,\n ResolveDesignValueType,\n} from '@contentful/experiences-core/types';\nimport { convertResolvedDesignValuesToMediaQuery } from '../core/styles/convertResolvedDesignValuesToMediaQuery';\nimport { createStylesheetsForBuiltInStyles } from '../core/styles/createStylesheetsForBuiltInStyles';\n\n// TODO: Test this for nested patterns as the name might be just a random hash without the actual name (needs to be validated).\n/**\n * Checks if prop is a \"siamese\" prop. So far we have only one such prop: `cfBackgroundImageUrl`.\n * It is considered \"siamese\" because despite being a content variable, it always goes in pair\n * (is coupled) with the `cfBackgroundImageOptions` design variable. Without presence of the\n * `cfBackgroundImageUrl` the `cfBackgroundImageOptions` is useless (and is not going to be\n * rendered by the styleTransformers.ts#transformBackgroundImageUrl()).\n *\n * Because of this coupling, we need to create an \"ephemeral\" cfBackgroundImageUrl style(!) prop.\n */\nconst isSpecialCaseCssProp = (propName: string) => {\n return propName === 'cfBackgroundImageUrl' || propName.startsWith('cfBackgroundImageUrl_');\n};\n\n/**\n * The previous logic of prop mapping was too complex and mixed different ues cases together.\n * In this function, I aim to simplify the logic by focusing on the following specific cases FOR PREVIEW/DELIVERY MODES\n * 1) Any non `DesignValue` props should be resolved and returned as is\n * 2) Some exceptions like `cfImageAsset` and `cfBackgroundImageUrl` (BoundValue) should be handled separately\n * and be resolved for the default breakpoint only (cause we don't allow binding per breakpoint anyway)\n * 3) Those DesignValue props which can be converted to CSS should be grouped and resolved into a CSS media query\n * for each breakpoint\n * 4) Those DesignValue props which can NOT be converted to CSS (custom design props) should be resolved dynamically\n * for each breakpoint\n */\ntype ResolveBoundValueType = (data: {\n propertyName: string;\n dataType: ComponentDefinitionVariableType;\n binding: BoundValue;\n}) => BoundComponentPropertyTypes;\n\nexport const parseComponentProps = ({\n breakpoints,\n componentDefinition,\n patternRootNodeIdsChain,\n node,\n resolveDesignValue,\n resolveBoundValue,\n resolveHyperlinkValue,\n resolveUnboundValue,\n resolvePrebindingValue,\n}: {\n breakpoints: Breakpoint[];\n mainBreakpoint: Breakpoint;\n componentDefinition: ComponentDefinition;\n patternRootNodeIdsChain?: string;\n node: ComponentTreeNode;\n resolveDesignValue: ResolveDesignValueType;\n resolveBoundValue: ResolveBoundValueType;\n resolveHyperlinkValue: (data: { linkTargetKey: string }) => string | null;\n resolveUnboundValue: (data: {\n mappingKey: string;\n defaultValue: ComponentDefinitionVariable['defaultValue'];\n }) => PrimitiveValue;\n resolvePrebindingValue: (data: {\n propertyName: string;\n mappingKey: string;\n dataType: ComponentDefinitionVariableType;\n resolveBoundValue: ResolveBoundValueType;\n }) => PrimitiveValue;\n}) => {\n const styleProps: Record<string, DesignValue['valuesByBreakpoint']> = {};\n const customDesignProps: Record<string, PrimitiveValue> = {};\n const contentProps: Record<string, PrimitiveValue> = {};\n\n debug.log(\n '[experiences-sdk-react::parseComponentProps] Parsing component props for node with id: ',\n node.id,\n );\n\n for (const [propName, propDefinition] of Object.entries(componentDefinition.variables)) {\n const propertyValue = node.variables[propName];\n if (!propertyValue) continue;\n\n switch (propertyValue.type) {\n case 'DesignValue': {\n if (isCfStyleAttribute(propName)) {\n // for such properties we know how to convert them to CSS, so we will build a media query from it below after the loop is over\n styleProps[propName] = propertyValue.valuesByBreakpoint;\n } else {\n // for custom design props, the value will be resolved with the javascript per breakpoint at runtime\n customDesignProps[propName] = resolveDesignValue(propertyValue.valuesByBreakpoint);\n }\n break;\n }\n case 'BoundValue': {\n const boundValue = resolveBoundValue({\n propertyName: propName,\n dataType: propDefinition.type as ComponentDefinitionVariableType,\n binding: propertyValue,\n });\n\n const propValue = boundValue ?? propDefinition.defaultValue;\n\n if (isSpecialCaseCssProp(propName)) {\n // styleProps[propName] = { [mainBreakpoint.id]: propValue };\n // Here we create kind of \"fake\" style property out of a bound value.\n // As bound values are breakpoint-universal (they apply to all breakpoints),\n // but styleProps are breakpoint-specific, we need to ensure that\n // semantically our \"fake\" emphemeral style property will be universall as well,\n // by expanding it to all the breakpoints. This is important as\n // styleTransformers.ts#transformBackgroundImageUrl() expects\n // cfBackgroundImageUrl to be present for all breakpoints\n // where cfBackgroundImageOptions is present.\n styleProps[propName] = Object.fromEntries(breakpoints.map((b) => [b.id, propValue]));\n } else {\n contentProps[propName] = propValue;\n }\n break;\n }\n\n case 'HyperlinkValue': {\n const hyperlink = resolveHyperlinkValue({\n linkTargetKey: propertyValue.linkTargetKey,\n });\n if (hyperlink) {\n contentProps[propName] = hyperlink;\n }\n break;\n }\n case 'UnboundValue': {\n const unboundValue = resolveUnboundValue({\n mappingKey: propertyValue.key,\n defaultValue: propDefinition.defaultValue,\n });\n\n if (isSpecialCaseCssProp(propName)) {\n styleProps[propName] = Object.fromEntries(breakpoints.map((b) => [b.id, unboundValue]));\n } else {\n contentProps[propName] = unboundValue;\n }\n break;\n }\n case 'ComponentValue': {\n // This can either be a design (style) or a content property.\n // Where prebinding is used, we resolve like they are a BoundValue.\n const propValue =\n resolvePrebindingValue({\n propertyName: propName,\n mappingKey: propertyValue.key,\n dataType: propDefinition.type,\n resolveBoundValue,\n }) ?? propDefinition.defaultValue;\n\n if (isSpecialCaseCssProp(propName)) {\n styleProps[propName] = Object.fromEntries(breakpoints.map((b) => [b.id, propValue]));\n } else {\n contentProps[propName] = propValue;\n }\n break;\n }\n default:\n break;\n }\n }\n /* [Data Format] After resolving all properties, `styleProps` contains solely the plain design values\n * styleProps = {\n * cfMargin: { desktop: '42px', tablet: '13px' },\n * cfBackgroundColor: { desktop: 'rgba(246, 246, 246, 1)' },\n * cfBackgroundImage: { desktop: 'url(https://example.com/image.jpg)' }\n * }\n */\n\n const stylePropsIndexedByBreakpoint = Object.entries(styleProps).reduce<\n Record<string, Record<string, PrimitiveValue>>\n >((acc, [propName, valuesByBreakpoint]) => {\n for (const [breakpointId, value] of Object.entries(valuesByBreakpoint)) {\n if (!acc[breakpointId]) {\n acc[breakpointId] = {};\n }\n\n acc[breakpointId][propName] = value;\n }\n\n return acc;\n }, {});\n /* [Data Format] `stylePropsIndexedByBreakpoint` contains the plain design values grouped by breakpoint\n * stylePropsIndexedByBreakpoint = {\n * desktop: {\n * cfMargin: '42px',\n * cfBackgroundColor: 'rgba(246, 246, 246, 1)',\n * cfBackgroundImage: 'url(https://example.com/image.jpg)'\n * },\n * tablet: {\n * cfMargin: '13px'\n * }\n * }\n */\n\n const stylesheetData = createStylesheetsForBuiltInStyles({\n designPropertiesByBreakpoint: stylePropsIndexedByBreakpoint,\n breakpoints,\n node,\n patternRootNodeIdsChain,\n });\n /* [Data Format] Stylesheet data provides objects containing `className`, `breakpointCondition`, and `css`.\n * stylesheetData = [{\n * className: 'uniqueMD5Hash',\n * breakpointCondition: '<768px',\n * css: 'margin:13px;'\n * visibilityCss: 'display:none !important;'\n * }, ...]\n */\n const mediaQuery = convertResolvedDesignValuesToMediaQuery(stylesheetData);\n /* [Data Format] `mediaQuery` is a joined string of all media query CSS code\n * mediaQuery = \".cfstyles-123{margin:42px;}@media(max-width:768px){.cfstyles-456{margin:13px;}}\"\n */\n return {\n styleProps,\n mediaQuery,\n customDesignProps,\n contentProps,\n };\n};\n"],"names":[],"mappings":";;;;AAgBA;AACA;;;;;;;;AAQG;AACH,MAAM,oBAAoB,GAAG,CAAC,QAAgB,KAAI;IAChD,OAAO,QAAQ,KAAK,sBAAsB,IAAI,QAAQ,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAC;AAC7F,CAAC,CAAC;AAmBW,MAAA,mBAAmB,GAAG,CAAC,EAClC,WAAW,EACX,mBAAmB,EACnB,uBAAuB,EACvB,IAAI,EACJ,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,GAoBvB,KAAI;IACH,MAAM,UAAU,GAAsD,EAAE,CAAC;I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ACL,oBAAA,YAAY,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;iBACpC;gBACD,MAAM;aACP;SAGF;KACF;AACD;;;;;;AAMG;IAEH,MAAM,6BAA6B,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,MAAM,CAErE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,kBAAkB,CAAC,KAAI;AACxC,QAAA,KAAK,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE;AACtE,YAAA,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;AACtB,gBAAA,GAAG,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC;aACxB;YAED,GAAG,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;SACrC;AAED,QAAA,OAAO,GAAG,CAAC;KACZ,EAAE,EAAE,CAAC,CAAC;AACP;;;;;;;;;;;AAWG;IAEH,MAAM,cAAc,GAAG,iCAAiC,CAAC;AACvD,QAAA,4BAA4B,EAAE,6BAA6B;QAC3D,WAAW;QACX,IAAI;QACJ,uBAAuB;AACxB,KAAA,CAAC,CAAC;AACH;;;;;;;AAOG;AACH,IAAA,MAAM,UAAU,GAAG,uCAAuC,CAAC,cAAc,CAAC,CAAC;AAC3E;;AAEG;IACH,OAAO;QACL,UAAU;QACV,UAAU;QACV,iBAAiB;QACjB,YAAY;KACb,CAAC;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"parseComponentProps.js","sources":["../../../src/utils/parseComponentProps.ts"],"sourcesContent":["import { isCfStyleAttribute, debug } from '@contentful/experiences-core';\nimport {\n BoundComponentPropertyTypes,\n BoundValue,\n Breakpoint,\n ComponentDefinition,\n ComponentDefinitionVariable,\n ComponentDefinitionVariableType,\n ComponentTreeNode,\n DesignValue,\n PrimitiveValue,\n ResolveDesignValueType,\n} from '@contentful/experiences-core/types';\nimport { convertResolvedDesignValuesToMediaQuery } from '../core/styles/convertResolvedDesignValuesToMediaQuery';\nimport { createStylesheetsForBuiltInStyles } from '../core/styles/createStylesheetsForBuiltInStyles';\n\n// TODO: Test this for nested patterns as the name might be just a random hash without the actual name (needs to be validated).\n/**\n * Checks if prop is a \"siamese\" prop. So far we have only one such prop: `cfBackgroundImageUrl`.\n * It is considered \"siamese\" because despite being a content variable, it always goes in pair\n * (is coupled) with the `cfBackgroundImageOptions` design variable. Without presence of the\n * `cfBackgroundImageUrl` the `cfBackgroundImageOptions` is useless (and is not going to be\n * rendered by the styleTransformers.ts#transformBackgroundImageUrl()).\n *\n * Because of this coupling, we need to create an \"ephemeral\" cfBackgroundImageUrl style(!) prop.\n */\nconst isSpecialCaseCssProp = (propName: string) => {\n return propName === 'cfBackgroundImageUrl' || propName.startsWith('cfBackgroundImageUrl_');\n};\n\n/**\n * The previous logic of prop mapping was too complex and mixed different ues cases together.\n * In this function, I aim to simplify the logic by focusing on the following specific cases FOR PREVIEW/DELIVERY MODES\n * 1) Any non `DesignValue` props should be resolved and returned as is\n * 2) Some exceptions like `cfImageAsset` and `cfBackgroundImageUrl` (BoundValue) should be handled separately\n * and be resolved for the default breakpoint only (cause we don't allow binding per breakpoint anyway)\n * 3) Those DesignValue props which can be converted to CSS should be grouped and resolved into a CSS media query\n * for each breakpoint\n * 4) Those DesignValue props which can NOT be converted to CSS (custom design props) should be resolved dynamically\n * for each breakpoint\n */\ntype ResolveBoundValueType = (data: {\n propertyName: string;\n dataType: ComponentDefinitionVariableType;\n binding: BoundValue;\n}) => BoundComponentPropertyTypes;\n\nexport const parseComponentProps = ({\n breakpoints,\n componentDefinition,\n patternRootNodeIdsChain,\n node,\n resolveDesignValue,\n resolveBoundValue,\n resolveHyperlinkValue,\n resolveUnboundValue,\n resolveComponentValue,\n}: {\n breakpoints: Breakpoint[];\n mainBreakpoint: Breakpoint;\n componentDefinition: ComponentDefinition;\n patternRootNodeIdsChain: Array<string>;\n node: ComponentTreeNode;\n resolveDesignValue: ResolveDesignValueType;\n resolveBoundValue: ResolveBoundValueType;\n resolveHyperlinkValue: (data: { linkTargetKey: string }) => string | null;\n resolveUnboundValue: (data: {\n mappingKey: string;\n defaultValue: ComponentDefinitionVariable['defaultValue'];\n }) => PrimitiveValue;\n /**\n * This method will be called to resolve the values for components that are native (not from nested pattern) to the previewed pattern\n * Nested pattern's components are going to be resolved by the `resolvePattern` method from `assemblyUtils` file\n * @param data\n * @returns\n */\n resolveComponentValue: (data: {\n propertyName: string;\n mappingKey: string;\n dataType: ComponentDefinitionVariableType;\n resolveBoundValue: ResolveBoundValueType;\n }) => PrimitiveValue;\n}) => {\n const styleProps: Record<string, DesignValue['valuesByBreakpoint']> = {};\n const customDesignProps: Record<string, PrimitiveValue> = {};\n const contentProps: Record<string, PrimitiveValue> = {};\n\n debug.log(\n '[experiences-sdk-react::parseComponentProps] Parsing component props for node with id: ',\n node.id,\n );\n\n for (const [propName, propDefinition] of Object.entries(componentDefinition.variables)) {\n const propertyValue = node.variables[propName];\n if (!propertyValue) continue;\n\n switch (propertyValue.type) {\n case 'DesignValue': {\n if (isCfStyleAttribute(propName)) {\n // for such properties we know how to convert them to CSS, so we will build a media query from it below after the loop is over\n styleProps[propName] = propertyValue.valuesByBreakpoint;\n } else {\n // for custom design props, the value will be resolved with the javascript per breakpoint at runtime\n customDesignProps[propName] = resolveDesignValue(propertyValue.valuesByBreakpoint);\n }\n break;\n }\n case 'BoundValue': {\n const boundValue = resolveBoundValue({\n propertyName: propName,\n dataType: propDefinition.type as ComponentDefinitionVariableType,\n binding: propertyValue,\n });\n\n const propValue = boundValue ?? propDefinition.defaultValue;\n\n if (isSpecialCaseCssProp(propName)) {\n // styleProps[propName] = { [mainBreakpoint.id]: propValue };\n // Here we create kind of \"fake\" style property out of a bound value.\n // As bound values are breakpoint-universal (they apply to all breakpoints),\n // but styleProps are breakpoint-specific, we need to ensure that\n // semantically our \"fake\" emphemeral style property will be universall as well,\n // by expanding it to all the breakpoints. This is important as\n // styleTransformers.ts#transformBackgroundImageUrl() expects\n // cfBackgroundImageUrl to be present for all breakpoints\n // where cfBackgroundImageOptions is present.\n styleProps[propName] = Object.fromEntries(breakpoints.map((b) => [b.id, propValue]));\n } else {\n contentProps[propName] = propValue;\n }\n break;\n }\n\n case 'HyperlinkValue': {\n const hyperlink = resolveHyperlinkValue({\n linkTargetKey: propertyValue.linkTargetKey,\n });\n if (hyperlink) {\n contentProps[propName] = hyperlink;\n }\n break;\n }\n case 'UnboundValue': {\n const unboundValue = resolveUnboundValue({\n mappingKey: propertyValue.key,\n defaultValue: propDefinition.defaultValue,\n });\n\n if (isSpecialCaseCssProp(propName)) {\n styleProps[propName] = Object.fromEntries(breakpoints.map((b) => [b.id, unboundValue]));\n } else {\n contentProps[propName] = unboundValue;\n }\n break;\n }\n case 'ComponentValue': {\n // This can either be a design (style) or a content property.\n // Where prebinding is used, we resolve like they are a BoundValue.\n const propValue =\n resolveComponentValue({\n propertyName: propName,\n mappingKey: propertyValue.key,\n dataType: propDefinition.type,\n resolveBoundValue,\n }) ?? propDefinition.defaultValue;\n\n if (isSpecialCaseCssProp(propName)) {\n styleProps[propName] = Object.fromEntries(breakpoints.map((b) => [b.id, propValue]));\n } else {\n contentProps[propName] = propValue;\n }\n break;\n }\n default:\n break;\n }\n }\n /* [Data Format] After resolving all properties, `styleProps` contains solely the plain design values\n * styleProps = {\n * cfMargin: { desktop: '42px', tablet: '13px' },\n * cfBackgroundColor: { desktop: 'rgba(246, 246, 246, 1)' },\n * cfBackgroundImage: { desktop: 'url(https://example.com/image.jpg)' }\n * }\n */\n\n const stylePropsIndexedByBreakpoint = Object.entries(styleProps).reduce<\n Record<string, Record<string, PrimitiveValue>>\n >((acc, [propName, valuesByBreakpoint]) => {\n for (const [breakpointId, value] of Object.entries(valuesByBreakpoint)) {\n if (!acc[breakpointId]) {\n acc[breakpointId] = {};\n }\n\n acc[breakpointId][propName] = value;\n }\n\n return acc;\n }, {});\n /* [Data Format] `stylePropsIndexedByBreakpoint` contains the plain design values grouped by breakpoint\n * stylePropsIndexedByBreakpoint = {\n * desktop: {\n * cfMargin: '42px',\n * cfBackgroundColor: 'rgba(246, 246, 246, 1)',\n * cfBackgroundImage: 'url(https://example.com/image.jpg)'\n * },\n * tablet: {\n * cfMargin: '13px'\n * }\n * }\n */\n\n const stylesheetData = createStylesheetsForBuiltInStyles({\n designPropertiesByBreakpoint: stylePropsIndexedByBreakpoint,\n breakpoints,\n node,\n patternRootNodeIdsChain,\n });\n /* [Data Format] Stylesheet data provides objects containing `className`, `breakpointCondition`, and `css`.\n * stylesheetData = [{\n * className: 'uniqueMD5Hash',\n * breakpointCondition: '<768px',\n * css: 'margin:13px;'\n * visibilityCss: 'display:none !important;'\n * }, ...]\n */\n const mediaQuery = convertResolvedDesignValuesToMediaQuery(stylesheetData);\n /* [Data Format] `mediaQuery` is a joined string of all media query CSS code\n * mediaQuery = \".cfstyles-123{margin:42px;}@media(max-width:768px){.cfstyles-456{margin:13px;}}\"\n */\n return {\n styleProps,\n mediaQuery,\n customDesignProps,\n contentProps,\n };\n};\n"],"names":[],"mappings":";;;;AAgBA;AACA;;;;;;;;AAQG;AACH,MAAM,oBAAoB,GAAG,CAAC,QAAgB,KAAI;IAChD,OAAO,QAAQ,KAAK,sBAAsB,IAAI,QAAQ,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAC;AAC7F,CAAC,CAAC;AAmBW,MAAA,mBAAmB,GAAG,CAAC,EAClC,WAAW,EACX,mBAAmB,EACnB,uBAAuB,EACvB,IAAI,EACJ,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,GA0BtB,KAAI;IACH,MAAM,UAAU,GAAsD,EAAE,CAAC;IACzE,MAAM,iBAAiB,GAAmC,EAAE,CAAC;IAC7D,MAAM,YAAY,GAAmC,EAAE,CAAC;IAExD,KAAK,CAAC,GAAG,CACP,yFAAyF,EACzF,IAAI,CAAC,EAAE,CACR,CAAC;AAEF,IAAA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U,CAAC,CAAC,MAAM,CAErE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,kBAAkB,CAAC,KAAI;AACxC,QAAA,KAAK,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE;AACtE,YAAA,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;AACtB,gBAAA,GAAG,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC;aACxB;YAED,GAAG,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;SACrC;AAED,QAAA,OAAO,GAAG,CAAC;KACZ,EAAE,EAAE,CAAC,CAAC;AACP;;;;;;;;;;;AAWG;IAEH,MAAM,cAAc,GAAG,iCAAiC,CAAC;AACvD,QAAA,4BAA4B,EAAE,6BAA6B;QAC3D,WAAW;QACX,IAAI;QACJ,uBAAuB;AACxB,KAAA,CAAC,CAAC;AACH;;;;;;;AAOG;AACH,IAAA,MAAM,UAAU,GAAG,uCAAuC,CAAC,cAAc,CAAC,CAAC;AAC3E;;AAEG;IACH,OAAO;QACL,UAAU;QACV,UAAU;QACV,iBAAiB;QACjB,YAAY;KACb,CAAC;AACJ;;;;"}
|
|
@@ -1,28 +1,36 @@
|
|
|
1
1
|
import { isLink } from '@contentful/experiences-core';
|
|
2
|
-
import {
|
|
2
|
+
import { PrebindingManager } from '../core/preview/PrebindingManager.js';
|
|
3
3
|
|
|
4
|
-
const shouldUsePrebinding = ({ componentValueKey, componentSettings, parameters, }) => {
|
|
4
|
+
const shouldUsePrebinding = ({ componentValueKey, componentSettings, parameters, patternRootNodeIdsChain, }) => {
|
|
5
5
|
const { prebindingDefinitions } = componentSettings;
|
|
6
6
|
const { parameterDefinitions, variableMappings, allowedVariableOverrides } = prebindingDefinitions?.[0] || {};
|
|
7
7
|
const variableMapping = variableMappings?.[componentValueKey];
|
|
8
8
|
const parameterDefinition = parameterDefinitions?.[variableMapping?.parameterId || ''];
|
|
9
|
-
const
|
|
9
|
+
const patternRootNodeIds = patternRootNodeIdsChain.join('---');
|
|
10
|
+
const hoistedParameterId = PrebindingManager.getHoistedIdForParameterId(variableMapping?.parameterId || '', patternRootNodeIds);
|
|
11
|
+
const parameter = parameters?.[hoistedParameterId];
|
|
10
12
|
const isValidForPrebinding = !!parameterDefinition &&
|
|
11
13
|
!!parameter &&
|
|
12
14
|
!!variableMapping &&
|
|
13
15
|
!!allowedVariableOverrides &&
|
|
14
16
|
Array.isArray(allowedVariableOverrides);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
if (!isValidForPrebinding) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
// removed 'NoValue' check
|
|
21
|
+
const isForDirectBindingOnly = allowedVariableOverrides.includes(componentValueKey);
|
|
22
|
+
return !isForDirectBindingOnly;
|
|
17
23
|
};
|
|
18
|
-
const resolvePrebindingPath = ({ componentValueKey, componentSettings, parameters, entityStore, }) => {
|
|
24
|
+
const resolvePrebindingPath = ({ componentValueKey, componentSettings, parameters, entityStore, patternRootNodeIdsChain, }) => {
|
|
19
25
|
const prebindingDefinition = componentSettings.prebindingDefinitions?.[0];
|
|
20
26
|
if (!prebindingDefinition)
|
|
21
27
|
return '';
|
|
22
28
|
const variableMapping = prebindingDefinition.variableMappings?.[componentValueKey];
|
|
23
29
|
if (!variableMapping)
|
|
24
30
|
return '';
|
|
25
|
-
const
|
|
31
|
+
const patternRootNodeIds = patternRootNodeIdsChain.join('---');
|
|
32
|
+
const hoistedParameterId = PrebindingManager.getHoistedIdForParameterId(variableMapping.parameterId, patternRootNodeIds);
|
|
33
|
+
const parameter = parameters?.[hoistedParameterId];
|
|
26
34
|
if (!parameter)
|
|
27
35
|
return '';
|
|
28
36
|
const dataSourceKey = parameter.path.split('/')[1];
|
|
@@ -33,17 +41,22 @@ const resolvePrebindingPath = ({ componentValueKey, componentSettings, parameter
|
|
|
33
41
|
if (!entity || entity.sys.type === 'Asset')
|
|
34
42
|
return '';
|
|
35
43
|
const contentType = entity.sys.contentType.sys.id;
|
|
44
|
+
const hoistedParameterDefinition = entityStore.hoistedParameterDefinitions[hoistedParameterId];
|
|
45
|
+
if (!hoistedParameterDefinition || !hoistedParameterDefinition.contentTypes.includes(contentType))
|
|
46
|
+
return '';
|
|
36
47
|
const fieldPath = variableMapping?.pathsByContentType?.[contentType]?.path;
|
|
37
48
|
if (!fieldPath)
|
|
38
49
|
return '';
|
|
39
50
|
return parameter.path + fieldPath;
|
|
40
51
|
};
|
|
41
|
-
const resolveMaybePrebindingDefaultValuePath = ({ componentValueKey, entityStore, }) => {
|
|
52
|
+
const resolveMaybePrebindingDefaultValuePath = ({ componentValueKey, patternRootNodeIdsChain, entityStore, }) => {
|
|
42
53
|
const variableMapping = entityStore.hoistedVariableMappings[componentValueKey];
|
|
43
54
|
if (!variableMapping)
|
|
44
55
|
return;
|
|
56
|
+
const patternRootNodeIds = patternRootNodeIdsChain.join('---');
|
|
45
57
|
const pdID = variableMapping.parameterId;
|
|
46
|
-
const
|
|
58
|
+
const hoistedpdID = PrebindingManager.getHoistedIdForParameterId(pdID, patternRootNodeIds);
|
|
59
|
+
const prebindingDefinition = entityStore.hoistedParameterDefinitions[hoistedpdID];
|
|
47
60
|
if (!prebindingDefinition) {
|
|
48
61
|
// probably shouldn't happen, as if ppd is not defined, then variableMapping should not be defined either
|
|
49
62
|
return;
|
|
@@ -57,21 +70,22 @@ const resolveMaybePrebindingDefaultValuePath = ({ componentValueKey, entityStore
|
|
|
57
70
|
// just extra safety check, defaultEntryLink should always be a link
|
|
58
71
|
return;
|
|
59
72
|
}
|
|
60
|
-
if (
|
|
73
|
+
if (prebindingDefinition.contentTypes.includes(contentTypeId)) {
|
|
61
74
|
const entity = entityStore.getEntityFromLink(defaultEntryLink);
|
|
62
75
|
if (!entity) {
|
|
63
76
|
// looks like sideloading of the prebinding default value didn't work as expected.
|
|
64
77
|
// And didn't sideload the entry into entityStore (and didn't add it's sideloaded_dsKey to the entityStore.dataSource)
|
|
65
78
|
return;
|
|
66
79
|
}
|
|
67
|
-
const fieldPath = variableMapping.pathsByContentType[contentTypeId]
|
|
80
|
+
const fieldPath = variableMapping.pathsByContentType[contentTypeId]?.path;
|
|
68
81
|
if (!fieldPath) {
|
|
69
82
|
// Path not found or degenerate shape (e.g. empty string '')
|
|
70
83
|
return;
|
|
71
84
|
}
|
|
72
|
-
const fullDefaultValuePath = `/${
|
|
85
|
+
const fullDefaultValuePath = `/${defaultEntryLink.sys.id}${fieldPath}`;
|
|
73
86
|
return fullDefaultValuePath;
|
|
74
87
|
}
|
|
88
|
+
return undefined;
|
|
75
89
|
};
|
|
76
90
|
|
|
77
91
|
export { resolveMaybePrebindingDefaultValuePath, resolvePrebindingPath, shouldUsePrebinding };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prebindingUtils.js","sources":["../../../src/utils/prebindingUtils.ts"],"sourcesContent":["import { type EntityStore, isLink } from '@contentful/experiences-core';\nimport {
|
|
1
|
+
{"version":3,"file":"prebindingUtils.js","sources":["../../../src/utils/prebindingUtils.ts"],"sourcesContent":["import { type EntityStore, isLink } from '@contentful/experiences-core';\nimport { ExperienceComponentSettings, Parameter } from '@contentful/experiences-validators';\nimport { PrebindingManager } from '../core/preview/PrebindingManager';\n\nexport const shouldUsePrebinding = ({\n componentValueKey,\n componentSettings,\n parameters,\n patternRootNodeIdsChain,\n}: {\n componentValueKey: string;\n componentSettings: ExperienceComponentSettings;\n parameters: Record<string, Parameter>;\n patternRootNodeIdsChain: string[];\n}) => {\n const { prebindingDefinitions } = componentSettings;\n const { parameterDefinitions, variableMappings, allowedVariableOverrides } =\n prebindingDefinitions?.[0] || {};\n\n const variableMapping = variableMappings?.[componentValueKey];\n\n const parameterDefinition = parameterDefinitions?.[variableMapping?.parameterId || ''];\n\n const patternRootNodeIds = patternRootNodeIdsChain.join('---');\n const hoistedParameterId = PrebindingManager.getHoistedIdForParameterId(\n variableMapping?.parameterId || '',\n patternRootNodeIds,\n );\n const parameter = parameters?.[hoistedParameterId];\n\n const isValidForPrebinding =\n !!parameterDefinition &&\n !!parameter &&\n !!variableMapping &&\n !!allowedVariableOverrides &&\n Array.isArray(allowedVariableOverrides);\n\n if (!isValidForPrebinding) {\n return false;\n }\n\n // removed 'NoValue' check\n const isForDirectBindingOnly = allowedVariableOverrides.includes(componentValueKey);\n return !isForDirectBindingOnly;\n};\n\nexport const resolvePrebindingPath = ({\n componentValueKey,\n componentSettings,\n parameters,\n entityStore,\n patternRootNodeIdsChain,\n}: {\n componentValueKey: string;\n componentSettings: ExperienceComponentSettings;\n parameters: Record<string, Parameter>;\n entityStore: EntityStore;\n patternRootNodeIdsChain: string[];\n}) => {\n const prebindingDefinition = componentSettings.prebindingDefinitions?.[0];\n if (!prebindingDefinition) return '';\n\n const variableMapping = prebindingDefinition.variableMappings?.[componentValueKey];\n\n if (!variableMapping) return '';\n\n const patternRootNodeIds = patternRootNodeIdsChain.join('---');\n const hoistedParameterId = PrebindingManager.getHoistedIdForParameterId(\n variableMapping.parameterId,\n patternRootNodeIds,\n );\n const parameter = parameters?.[hoistedParameterId];\n\n if (!parameter) return '';\n\n const dataSourceKey = parameter.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 hoistedParameterDefinition = entityStore.hoistedParameterDefinitions[hoistedParameterId];\n if (!hoistedParameterDefinition || !hoistedParameterDefinition.contentTypes.includes(contentType))\n return '';\n\n const fieldPath = variableMapping?.pathsByContentType?.[contentType]?.path;\n\n if (!fieldPath) return '';\n\n return parameter.path + fieldPath;\n};\n\nexport const resolveMaybePrebindingDefaultValuePath = ({\n componentValueKey,\n patternRootNodeIdsChain,\n entityStore,\n}: {\n componentValueKey: string;\n patternRootNodeIdsChain: string[];\n entityStore: EntityStore;\n}): string | undefined => {\n const variableMapping = entityStore.hoistedVariableMappings[componentValueKey];\n if (!variableMapping) return;\n\n const patternRootNodeIds = patternRootNodeIdsChain.join('---');\n\n const pdID = variableMapping.parameterId;\n const hoistedpdID = PrebindingManager.getHoistedIdForParameterId(pdID, patternRootNodeIds);\n const prebindingDefinition = entityStore.hoistedParameterDefinitions[hoistedpdID];\n\n if (!prebindingDefinition) {\n // probably shouldn't happen, as if ppd is not defined, then variableMapping should not be defined either\n return;\n }\n if (!prebindingDefinition.defaultSource) {\n // pretty normal, prebinding definitions are not required to have default source\n return;\n }\n\n const { contentTypeId, link: defaultEntryLink } = prebindingDefinition.defaultSource;\n\n if (!isLink(defaultEntryLink)) {\n // just extra safety check, defaultEntryLink should always be a link\n return;\n }\n\n if (prebindingDefinition.contentTypes.includes(contentTypeId)) {\n const entity = entityStore.getEntityFromLink(defaultEntryLink);\n\n if (!entity) {\n // looks like sideloading of the prebinding default value didn't work as expected.\n // And didn't sideload the entry into entityStore (and didn't add it's sideloaded_dsKey to the entityStore.dataSource)\n return;\n }\n\n const fieldPath = variableMapping.pathsByContentType[contentTypeId]?.path;\n if (!fieldPath) {\n // Path not found or degenerate shape (e.g. empty string '')\n return;\n }\n\n const fullDefaultValuePath = `/${defaultEntryLink.sys.id}${fieldPath}`;\n return fullDefaultValuePath;\n }\n\n return undefined;\n};\n"],"names":[],"mappings":";;;AAIO,MAAM,mBAAmB,GAAG,CAAC,EAClC,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,uBAAuB,GAMxB,KAAI;AACH,IAAA,MAAM,EAAE,qBAAqB,EAAE,GAAG,iBAAiB,CAAC;AACpD,IAAA,MAAM,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,GACxE,qBAAqB,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAEnC,IAAA,MAAM,eAAe,GAAG,gBAAgB,GAAG,iBAAiB,CAAC,CAAC;IAE9D,MAAM,mBAAmB,GAAG,oBAAoB,GAAG,eAAe,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
|
|
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": "3.8.0-beta.
|
|
45
|
-
"@contentful/experiences-core": "3.8.0-beta.
|
|
46
|
-
"@contentful/experiences-validators": "3.8.0-beta.
|
|
47
|
-
"@contentful/experiences-visual-editor-react": "3.8.0-beta.
|
|
44
|
+
"@contentful/experiences-components-react": "3.8.0-beta.2",
|
|
45
|
+
"@contentful/experiences-core": "3.8.0-beta.2",
|
|
46
|
+
"@contentful/experiences-validators": "3.8.0-beta.2",
|
|
47
|
+
"@contentful/experiences-visual-editor-react": "3.8.0-beta.2",
|
|
48
48
|
"@contentful/rich-text-types": "^17.0.0",
|
|
49
49
|
"csstype": "^3.1.2",
|
|
50
50
|
"immer": "^10.0.3",
|
|
@@ -95,5 +95,5 @@
|
|
|
95
95
|
"dist",
|
|
96
96
|
"package.json"
|
|
97
97
|
],
|
|
98
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "b257e04e1273728b1e54d6c78d82e568be2e74dd"
|
|
99
99
|
}
|