@contentful/experiences-sdk-react 1.17.1-dev-20241002T1713-b0fd86d.0 → 1.17.1-dev-20241003T1341-e0d12f6.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.
@@ -1,12 +1,12 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import React, { useMemo } from 'react';
3
- import { omit } from 'lodash-es';
4
- import { checkIsAssemblyNode, resolveHyperlinkPattern, transformBoundContentValue } from '@contentful/experiences-core';
5
- import { HYPERLINK_DEFAULT_PATTERN, CONTENTFUL_COMPONENTS, CF_STYLE_ATTRIBUTES } from '@contentful/experiences-core/constants';
3
+ import { checkIsAssemblyNode, resolveHyperlinkPattern, transformBoundContentValue, sanitizeNodeProps } from '@contentful/experiences-core';
4
+ import { HYPERLINK_DEFAULT_PATTERN, CONTENTFUL_COMPONENTS } from '@contentful/experiences-core/constants';
6
5
  import { getComponentRegistration, createAssemblyRegistration } from '../../core/componentRegistry.js';
7
6
  import { useClassName } from '../../hooks/useClassName.js';
8
7
  import { Assembly, ContentfulContainer, Columns, SingleColumn } from '@contentful/experiences-components-react';
9
8
  import { resolveAssembly } from '../../core/preview/assemblyUtils.js';
9
+ import PreviewUnboundImage from './PreviewUnboundImage.js';
10
10
 
11
11
  const CompositionBlock = ({ node: rawNode, locale, entityStore, hyperlinkPattern, resolveDesignValue, getPatternChildNodeClassName, }) => {
12
12
  const isAssembly = useMemo(() => checkIsAssemblyNode({
@@ -139,11 +139,12 @@ const CompositionBlock = ({ node: rawNode, locale, entityStore, hyperlinkPattern
139
139
  if (node.definitionId === CONTENTFUL_COMPONENTS.singleColumn.id) {
140
140
  return (jsx(SingleColumn, { editorMode: false, className: className, children: children }));
141
141
  }
142
- //List explicit style props that will end up being passed to the component
143
- const stylesToKeep = ['cfImageAsset'];
144
- const stylesToRemove = CF_STYLE_ATTRIBUTES.filter((style) => !stylesToKeep.includes(style));
142
+ if (node.definitionId === CONTENTFUL_COMPONENTS.image.id &&
143
+ node.variables.cfImageAsset?.type === 'UnboundValue') {
144
+ return jsx(PreviewUnboundImage, { node: node, nodeProps: nodeProps, component: component });
145
+ }
145
146
  return React.createElement(component, {
146
- ...omit(nodeProps, stylesToRemove, ['cfHyperlink', 'cfOpenInNewTab', 'cfSsrClassName']),
147
+ ...sanitizeNodeProps(nodeProps),
147
148
  className,
148
149
  }, children ?? (typeof nodeProps.children === 'string' ? nodeProps.children : null));
149
150
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CompositionBlock.js","sources":["../../../../src/blocks/preview/CompositionBlock.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport type { UnresolvedLink } from 'contentful';\nimport { omit } from 'lodash-es';\nimport { EntityStore, resolveHyperlinkPattern } from '@contentful/experiences-core';\nimport {\n CF_STYLE_ATTRIBUTES,\n CONTENTFUL_COMPONENTS,\n HYPERLINK_DEFAULT_PATTERN,\n} from '@contentful/experiences-core/constants';\nimport type {\n ComponentTreeNode,\n DesignValue,\n PrimitiveValue,\n ResolveDesignValueType,\n StyleProps,\n} from '@contentful/experiences-core/types';\nimport { createAssemblyRegistration, getComponentRegistration } from '../../core/componentRegistry';\nimport { checkIsAssemblyNode, transformBoundContentValue } from '@contentful/experiences-core';\nimport { useClassName } from '../../hooks/useClassName';\nimport {\n Assembly,\n Columns,\n ContentfulContainer,\n SingleColumn,\n} from '@contentful/experiences-components-react';\n\nimport { resolveAssembly } from '../../core/preview/assemblyUtils';\nimport { Entry } from 'contentful';\n\ntype CompositionBlockProps = {\n node: ComponentTreeNode;\n locale: string;\n entityStore: EntityStore;\n hyperlinkPattern?: string | undefined;\n resolveDesignValue: ResolveDesignValueType;\n getPatternChildNodeClassName?: (childNodeId: string) => string | undefined;\n};\n\nexport const CompositionBlock = ({\n node: rawNode,\n locale,\n entityStore,\n hyperlinkPattern,\n resolveDesignValue,\n getPatternChildNodeClassName,\n}: CompositionBlockProps) => {\n const isAssembly = useMemo(\n () =>\n checkIsAssemblyNode({\n componentId: rawNode.definitionId,\n usedComponents: entityStore.usedComponents,\n }),\n [entityStore.usedComponents, rawNode.definitionId],\n );\n\n const node = useMemo(() => {\n return isAssembly\n ? resolveAssembly({\n node: rawNode,\n entityStore,\n })\n : rawNode;\n }, [entityStore, isAssembly, rawNode]);\n\n const componentRegistration = useMemo(() => {\n const registration = getComponentRegistration(node.definitionId as string);\n\n if (isAssembly && !registration) {\n return createAssemblyRegistration({\n definitionId: node.definitionId as string,\n component: Assembly,\n });\n }\n return registration;\n }, [isAssembly, node.definitionId]);\n\n const nodeProps = useMemo(() => {\n // Don't enrich the assembly wrapper node with props\n if (!componentRegistration || isAssembly) {\n return {\n cfSsrClassName: node.variables.cfSsrClassName\n ? resolveDesignValue(\n (node.variables.cfSsrClassName as DesignValue).valuesByBreakpoint,\n 'cfSsrClassName',\n )\n : undefined,\n };\n }\n\n const propMap: Record<string, PrimitiveValue> = {\n // @ts-expect-error -- node id is being generated in ssrStyles.ts, currently missing ComponentTreeNode type\n cfSsrClassName: node.id\n ? // @ts-expect-error -- node id is being generated in ssrStyles.ts, currently missing ComponentTreeNode type\n getPatternChildNodeClassName?.(node.id)\n : node.variables.cfSsrClassName\n ? resolveDesignValue(\n (node.variables.cfSsrClassName as DesignValue).valuesByBreakpoint,\n 'cfSsrClassName',\n )\n : undefined,\n };\n\n const props = Object.entries(componentRegistration.definition.variables).reduce(\n (acc, [variableName, variableDefinition]) => {\n const variable = node.variables[variableName];\n if (!variable) return acc;\n\n switch (variable.type) {\n case 'DesignValue':\n acc[variableName] = resolveDesignValue(variable.valuesByBreakpoint, variableName);\n break;\n case 'BoundValue': {\n const [, uuid] = variable.path.split('/');\n const binding = entityStore.dataSource[uuid] as UnresolvedLink<'Entry' | 'Asset'>;\n\n const value = transformBoundContentValue(\n node.variables,\n entityStore,\n binding,\n resolveDesignValue,\n variableName,\n variableDefinition,\n variable.path,\n );\n acc[variableName] = value ?? variableDefinition.defaultValue;\n break;\n }\n\n case 'HyperlinkValue': {\n const binding = entityStore.dataSource[variable.linkTargetKey];\n const hyperlinkEntry = entityStore.getEntryOrAsset(binding, variable.linkTargetKey);\n\n const value = resolveHyperlinkPattern(\n componentRegistration.definition.hyperlinkPattern ||\n hyperlinkPattern ||\n HYPERLINK_DEFAULT_PATTERN,\n hyperlinkEntry as Entry,\n locale,\n );\n if (value) {\n acc[variableName] = value;\n }\n break;\n }\n case 'UnboundValue': {\n const uuid = variable.key;\n acc[variableName] =\n entityStore.unboundValues[uuid]?.value ?? variableDefinition.defaultValue;\n break;\n }\n case 'ComponentValue':\n // We're rendering a pattern entry. Content cannot be set for ComponentValue type properties\n // directly in the pattern so we can safely use the default value\n // This can either a design (style) or a content variable\n acc[variableName] = variableDefinition.defaultValue;\n break;\n default:\n break;\n }\n return acc;\n },\n propMap,\n );\n\n if (componentRegistration.definition.slots) {\n for (const slotId in componentRegistration.definition.slots) {\n const slotNode = node.children.find((child) => child.slotId === slotId);\n if (slotNode) {\n props[slotId] = (\n <CompositionBlock\n node={slotNode}\n locale={locale}\n hyperlinkPattern={hyperlinkPattern}\n entityStore={entityStore}\n resolveDesignValue={resolveDesignValue}\n />\n );\n }\n }\n }\n\n return props;\n }, [\n componentRegistration,\n isAssembly,\n node.children,\n node.variables,\n resolveDesignValue,\n entityStore,\n hyperlinkPattern,\n locale,\n ]);\n\n const className = useClassName({ props: nodeProps, node });\n\n if (!componentRegistration) {\n return null;\n }\n\n const { component } = componentRegistration;\n\n const _getPatternChildNodeClassName = (childNodeId: string) => {\n if (isAssembly) {\n // @ts-expect-error -- property cfSsrClassName is a map (id to classNames) that is added during rendering in ssrStyles\n const classesForNode = node.variables.cfSsrClassName[childNodeId];\n if (classesForNode) {\n return resolveDesignValue(\n (classesForNode as DesignValue).valuesByBreakpoint,\n 'cfSsrClassName',\n ) as string;\n }\n return;\n }\n return getPatternChildNodeClassName?.(childNodeId);\n };\n\n const children =\n componentRegistration.definition.children === true\n ? node.children.map((childNode: ComponentTreeNode, index) => {\n return (\n <CompositionBlock\n getPatternChildNodeClassName={_getPatternChildNodeClassName}\n node={childNode}\n key={index}\n locale={locale}\n hyperlinkPattern={hyperlinkPattern}\n entityStore={entityStore}\n resolveDesignValue={resolveDesignValue}\n />\n );\n })\n : null;\n\n if (\n [CONTENTFUL_COMPONENTS.container.id, CONTENTFUL_COMPONENTS.section.id].includes(\n node.definitionId,\n )\n ) {\n return (\n <ContentfulContainer\n editorMode={false}\n cfHyperlink={(nodeProps as StyleProps).cfHyperlink}\n cfOpenInNewTab={(nodeProps as StyleProps).cfOpenInNewTab}\n className={className}>\n {children}\n </ContentfulContainer>\n );\n }\n\n if (node.definitionId === CONTENTFUL_COMPONENTS.columns.id) {\n return (\n <Columns editorMode={false} className={className}>\n {children}\n </Columns>\n );\n }\n\n if (node.definitionId === CONTENTFUL_COMPONENTS.singleColumn.id) {\n return (\n <SingleColumn editorMode={false} className={className}>\n {children}\n </SingleColumn>\n );\n }\n\n //List explicit style props that will end up being passed to the component\n const stylesToKeep = ['cfImageAsset'];\n const stylesToRemove = CF_STYLE_ATTRIBUTES.filter((style) => !stylesToKeep.includes(style));\n\n return React.createElement(\n component,\n {\n ...omit(nodeProps, stylesToRemove, ['cfHyperlink', 'cfOpenInNewTab', 'cfSsrClassName']),\n className,\n },\n children ?? (typeof nodeProps.children === 'string' ? nodeProps.children : null),\n );\n};\n"],"names":["_jsx"],"mappings":";;;;;;;;;;MAsCa,gBAAgB,GAAG,CAAC,EAC/B,IAAI,EAAE,OAAO,EACb,MAAM,EACN,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,4BAA4B,GACN,KAAI;IAC1B,MAAM,UAAU,GAAG,OAAO,CACxB,MACE,mBAAmB,CAAC;QAClB,WAAW,EAAE,OAAO,CAAC,YAAY;QACjC,cAAc,EAAE,WAAW,CAAC,cAAc;KAC3C,CAAC,EACJ,CAAC,WAAW,CAAC,cAAc,EAAE,OAAO,CAAC,YAAY,CAAC,CACnD,CAAC;AAEF,IAAA,MAAM,IAA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Ac,EAAG,SAAwB,CAAC,cAAc,EACxD,SAAS,EAAE,SAAS,EACnB,QAAA,EAAA,QAAQ,EACW,CAAA,EACtB;KACH;IAED,IAAI,IAAI,CAAC,YAAY,KAAK,qBAAqB,CAAC,OAAO,CAAC,EAAE,EAAE;AAC1D,QAAA,QACEA,GAAA,CAAC,OAAO,EAAA,EAAC,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAA,QAAA,EAC7C,QAAQ,EAAA,CACD,EACV;KACH;IAED,IAAI,IAAI,CAAC,YAAY,KAAK,qBAAqB,CAAC,YAAY,CAAC,EAAE,EAAE;AAC/D,QAAA,QACEA,GAAA,CAAC,YAAY,EAAA,EAAC,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAA,QAAA,EAClD,QAAQ,EAAA,CACI,EACf;KACH;;AAGD,IAAA,MAAM,YAAY,GAAG,CAAC,cAAc,CAAC,CAAC;AACtC,IAAA,MAAM,cAAc,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AAE5F,IAAA,OAAO,KAAK,CAAC,aAAa,CACxB,SAAS,EACT;AACE,QAAA,GAAG,IAAI,CAAC,SAAS,EAAE,cAAc,EAAE,CAAC,aAAa,EAAE,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;QACvF,SAAS;KACV,EACD,QAAQ,KAAK,OAAO,SAAS,CAAC,QAAQ,KAAK,QAAQ,GAAG,SAAS,CAAC,QAAQ,GAAG,IAAI,CAAC,CACjF,CAAC;AACJ;;;;"}
1
+ {"version":3,"file":"CompositionBlock.js","sources":["../../../../src/blocks/preview/CompositionBlock.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport type { UnresolvedLink } from 'contentful';\nimport {\n EntityStore,\n resolveHyperlinkPattern,\n sanitizeNodeProps,\n} from '@contentful/experiences-core';\nimport {\n CONTENTFUL_COMPONENTS,\n HYPERLINK_DEFAULT_PATTERN,\n} from '@contentful/experiences-core/constants';\nimport type {\n ComponentTreeNode,\n DesignValue,\n PrimitiveValue,\n ResolveDesignValueType,\n StyleProps,\n} from '@contentful/experiences-core/types';\nimport { createAssemblyRegistration, getComponentRegistration } from '../../core/componentRegistry';\nimport { checkIsAssemblyNode, transformBoundContentValue } from '@contentful/experiences-core';\nimport { useClassName } from '../../hooks/useClassName';\nimport {\n Assembly,\n Columns,\n ContentfulContainer,\n SingleColumn,\n} from '@contentful/experiences-components-react';\n\nimport { resolveAssembly } from '../../core/preview/assemblyUtils';\nimport { Entry } from 'contentful';\nimport PreviewUnboundImage from './PreviewUnboundImage';\n\ntype CompositionBlockProps = {\n node: ComponentTreeNode;\n locale: string;\n entityStore: EntityStore;\n hyperlinkPattern?: string | undefined;\n resolveDesignValue: ResolveDesignValueType;\n getPatternChildNodeClassName?: (childNodeId: string) => string | undefined;\n};\n\nexport const CompositionBlock = ({\n node: rawNode,\n locale,\n entityStore,\n hyperlinkPattern,\n resolveDesignValue,\n getPatternChildNodeClassName,\n}: CompositionBlockProps) => {\n const isAssembly = useMemo(\n () =>\n checkIsAssemblyNode({\n componentId: rawNode.definitionId,\n usedComponents: entityStore.usedComponents,\n }),\n [entityStore.usedComponents, rawNode.definitionId],\n );\n\n const node = useMemo(() => {\n return isAssembly\n ? resolveAssembly({\n node: rawNode,\n entityStore,\n })\n : rawNode;\n }, [entityStore, isAssembly, rawNode]);\n\n const componentRegistration = useMemo(() => {\n const registration = getComponentRegistration(node.definitionId as string);\n\n if (isAssembly && !registration) {\n return createAssemblyRegistration({\n definitionId: node.definitionId as string,\n component: Assembly,\n });\n }\n return registration;\n }, [isAssembly, node.definitionId]);\n\n const nodeProps = useMemo(() => {\n // Don't enrich the assembly wrapper node with props\n if (!componentRegistration || isAssembly) {\n return {\n cfSsrClassName: node.variables.cfSsrClassName\n ? resolveDesignValue(\n (node.variables.cfSsrClassName as DesignValue).valuesByBreakpoint,\n 'cfSsrClassName',\n )\n : undefined,\n };\n }\n\n const propMap: Record<string, PrimitiveValue> = {\n // @ts-expect-error -- node id is being generated in ssrStyles.ts, currently missing ComponentTreeNode type\n cfSsrClassName: node.id\n ? // @ts-expect-error -- node id is being generated in ssrStyles.ts, currently missing ComponentTreeNode type\n getPatternChildNodeClassName?.(node.id)\n : node.variables.cfSsrClassName\n ? resolveDesignValue(\n (node.variables.cfSsrClassName as DesignValue).valuesByBreakpoint,\n 'cfSsrClassName',\n )\n : undefined,\n };\n\n const props = Object.entries(componentRegistration.definition.variables).reduce(\n (acc, [variableName, variableDefinition]) => {\n const variable = node.variables[variableName];\n if (!variable) return acc;\n\n switch (variable.type) {\n case 'DesignValue':\n acc[variableName] = resolveDesignValue(variable.valuesByBreakpoint, variableName);\n break;\n case 'BoundValue': {\n const [, uuid] = variable.path.split('/');\n const binding = entityStore.dataSource[uuid] as UnresolvedLink<'Entry' | 'Asset'>;\n\n const value = transformBoundContentValue(\n node.variables,\n entityStore,\n binding,\n resolveDesignValue,\n variableName,\n variableDefinition,\n variable.path,\n );\n acc[variableName] = value ?? variableDefinition.defaultValue;\n break;\n }\n\n case 'HyperlinkValue': {\n const binding = entityStore.dataSource[variable.linkTargetKey];\n const hyperlinkEntry = entityStore.getEntryOrAsset(binding, variable.linkTargetKey);\n\n const value = resolveHyperlinkPattern(\n componentRegistration.definition.hyperlinkPattern ||\n hyperlinkPattern ||\n HYPERLINK_DEFAULT_PATTERN,\n hyperlinkEntry as Entry,\n locale,\n );\n if (value) {\n acc[variableName] = value;\n }\n break;\n }\n case 'UnboundValue': {\n const uuid = variable.key;\n acc[variableName] =\n entityStore.unboundValues[uuid]?.value ?? variableDefinition.defaultValue;\n break;\n }\n case 'ComponentValue':\n // We're rendering a pattern entry. Content cannot be set for ComponentValue type properties\n // directly in the pattern so we can safely use the default value\n // This can either a design (style) or a content variable\n acc[variableName] = variableDefinition.defaultValue;\n break;\n default:\n break;\n }\n return acc;\n },\n propMap,\n );\n\n if (componentRegistration.definition.slots) {\n for (const slotId in componentRegistration.definition.slots) {\n const slotNode = node.children.find((child) => child.slotId === slotId);\n if (slotNode) {\n props[slotId] = (\n <CompositionBlock\n node={slotNode}\n locale={locale}\n hyperlinkPattern={hyperlinkPattern}\n entityStore={entityStore}\n resolveDesignValue={resolveDesignValue}\n />\n );\n }\n }\n }\n\n return props;\n }, [\n componentRegistration,\n isAssembly,\n node.children,\n node.variables,\n resolveDesignValue,\n entityStore,\n hyperlinkPattern,\n locale,\n ]);\n\n const className = useClassName({ props: nodeProps, node });\n\n if (!componentRegistration) {\n return null;\n }\n\n const { component } = componentRegistration;\n\n const _getPatternChildNodeClassName = (childNodeId: string) => {\n if (isAssembly) {\n // @ts-expect-error -- property cfSsrClassName is a map (id to classNames) that is added during rendering in ssrStyles\n const classesForNode = node.variables.cfSsrClassName[childNodeId];\n if (classesForNode) {\n return resolveDesignValue(\n (classesForNode as DesignValue).valuesByBreakpoint,\n 'cfSsrClassName',\n ) as string;\n }\n return;\n }\n return getPatternChildNodeClassName?.(childNodeId);\n };\n\n const children =\n componentRegistration.definition.children === true\n ? node.children.map((childNode: ComponentTreeNode, index) => {\n return (\n <CompositionBlock\n getPatternChildNodeClassName={_getPatternChildNodeClassName}\n node={childNode}\n key={index}\n locale={locale}\n hyperlinkPattern={hyperlinkPattern}\n entityStore={entityStore}\n resolveDesignValue={resolveDesignValue}\n />\n );\n })\n : null;\n\n if (\n [CONTENTFUL_COMPONENTS.container.id, CONTENTFUL_COMPONENTS.section.id].includes(\n node.definitionId,\n )\n ) {\n return (\n <ContentfulContainer\n editorMode={false}\n cfHyperlink={(nodeProps as StyleProps).cfHyperlink}\n cfOpenInNewTab={(nodeProps as StyleProps).cfOpenInNewTab}\n className={className}>\n {children}\n </ContentfulContainer>\n );\n }\n\n if (node.definitionId === CONTENTFUL_COMPONENTS.columns.id) {\n return (\n <Columns editorMode={false} className={className}>\n {children}\n </Columns>\n );\n }\n\n if (node.definitionId === CONTENTFUL_COMPONENTS.singleColumn.id) {\n return (\n <SingleColumn editorMode={false} className={className}>\n {children}\n </SingleColumn>\n );\n }\n\n if (\n node.definitionId === CONTENTFUL_COMPONENTS.image.id &&\n node.variables.cfImageAsset?.type === 'UnboundValue'\n ) {\n return <PreviewUnboundImage node={node} nodeProps={nodeProps} component={component} />;\n }\n\n return React.createElement(\n component,\n {\n ...sanitizeNodeProps(nodeProps),\n className,\n },\n children ?? (typeof nodeProps.children === 'string' ? nodeProps.children : null),\n );\n};\n"],"names":["_jsx"],"mappings":";;;;;;;;;;MAyCa,gBAAgB,GAAG,CAAC,EAC/B,IAAI,EAAE,OAAO,EACb,MAAM,EACN,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,4BAA4B,GACN,KAAI;IAC1B,MAAM,UAAU,GAAG,OAAO,CACxB,MACE,mBAAmB,CAAC;QAClB,WAAW,EAAE,OAAO,CAAC,YAAY;QACjC,cAAc,EAAE,WAAW,CAAC,cAAc;KAC3C,CAAC,EACJ,CAAC,WAAW,CAAC,cAAc,EAAE,OAAO,CAAC,YAAY,CAAC,CACnD,CAAC;AAEF,IAAA,MAAM,IAAI,GAAG,OAAO,CAAC,MAAK;AACxB,QAAA,OAAO,UAAU;cACb,eAAe,CAAC;AACd,gBAAA,IAAI,EAAE,OAAO;gBACb,WAAW;aACZ,CAAC;cACF,OAAO,CAAC;KACb,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;AAEvC,IAAA,MAAM,qBAAqB,GAAG,OAAO,CAAC,MAAK;QACzC,MAAM,YAAY,GAAG,wBAAwB,CAAC,IAAI,CAAC,YAAsB,CAAC,CAAC;AAE3E,QAAA,IAAI,UAAU,IAAI,CAAC,YAAY,EAAE;AAC/B,YAAA,OAAO,0BAA0B,CAAC;gBAChC,YAAY,EAAE,IAAI,CAAC,YAAsB;AACzC,gBAAA,SAAS,EAAE,QAAQ;AACpB,aAAA,CAAC,CAAC;SACJ;AACD,QAAA,OAAO,YAAY,CAAC;K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AAC,YAAY,KAAK,qBAAqB,CAAC,KAAK,CAAC,EAAE;QACpD,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,KAAK,cAAc,EACpD;AACA,QAAA,OAAOA,GAAC,CAAA,mBAAmB,EAAC,EAAA,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,GAAI,CAAC;KACxF;AAED,IAAA,OAAO,KAAK,CAAC,aAAa,CACxB,SAAS,EACT;QACE,GAAG,iBAAiB,CAAC,SAAS,CAAC;QAC/B,SAAS;KACV,EACD,QAAQ,KAAK,OAAO,SAAS,CAAC,QAAQ,KAAK,QAAQ,GAAG,SAAS,CAAC,QAAQ,GAAG,IAAI,CAAC,CACjF,CAAC;AACJ;;;;"}
@@ -0,0 +1,35 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import React from 'react';
3
+ import { sanitizeNodeProps } from '@contentful/experiences-core';
4
+ import { useClassName } from '../../hooks/useClassName.js';
5
+
6
+ /**
7
+ * This component is used to render a placeholder Image component in the preview
8
+ * when the image is unbound. It applies the Image size styles to a wrapping div.
9
+ */
10
+ const PreviewUnboundImage = ({ node, nodeProps, component, }) => {
11
+ const wrapperStyle = {
12
+ position: 'relative',
13
+ };
14
+ const modifiedNodeProps = { ...nodeProps };
15
+ if (typeof modifiedNodeProps.cfImageOptions === 'object') {
16
+ const { width, height, ...restImageOptions } = modifiedNodeProps.cfImageOptions;
17
+ // Apply the Image size styles to the wrapping div
18
+ wrapperStyle.height = String(height);
19
+ wrapperStyle.width = String(width);
20
+ // Set the Image height and width to 100% to fill the wrapping div
21
+ modifiedNodeProps.cfImageOptions = {
22
+ ...restImageOptions,
23
+ height: '100%',
24
+ width: '100%',
25
+ };
26
+ }
27
+ const className = useClassName({ props: modifiedNodeProps, node });
28
+ return (jsx("div", { className: "cf-preview-unbound-image", style: wrapperStyle, children: React.createElement(component, {
29
+ ...sanitizeNodeProps(modifiedNodeProps),
30
+ className,
31
+ }) }));
32
+ };
33
+
34
+ export { PreviewUnboundImage as default };
35
+ //# sourceMappingURL=PreviewUnboundImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreviewUnboundImage.js","sources":["../../../../src/blocks/preview/PreviewUnboundImage.tsx"],"sourcesContent":["import React from 'react';\nimport type {\n ComponentTreeNode,\n CSSProperties,\n PrimitiveValue,\n} from '@contentful/experiences-core/types';\nimport { sanitizeNodeProps } from '@contentful/experiences-core';\nimport { useClassName } from '../../hooks/useClassName';\n\ninterface PreviewUnboundImageProps {\n node: ComponentTreeNode;\n nodeProps: Record<PropertyKey, PrimitiveValue>;\n component: React.ElementType;\n}\n\n/**\n * This component is used to render a placeholder Image component in the preview\n * when the image is unbound. It applies the Image size styles to a wrapping div.\n */\nconst PreviewUnboundImage: React.FC<PreviewUnboundImageProps> = ({\n node,\n nodeProps,\n component,\n}) => {\n const wrapperStyle: CSSProperties = {\n position: 'relative',\n };\n\n const modifiedNodeProps = { ...nodeProps };\n if (typeof modifiedNodeProps.cfImageOptions === 'object') {\n const { width, height, ...restImageOptions } = modifiedNodeProps.cfImageOptions;\n\n // Apply the Image size styles to the wrapping div\n wrapperStyle.height = String(height);\n wrapperStyle.width = String(width);\n\n // Set the Image height and width to 100% to fill the wrapping div\n modifiedNodeProps.cfImageOptions = {\n ...restImageOptions,\n height: '100%',\n width: '100%',\n };\n }\n\n const className = useClassName({ props: modifiedNodeProps, node });\n\n return (\n <div className=\"cf-preview-unbound-image\" style={wrapperStyle}>\n {React.createElement(component, {\n ...sanitizeNodeProps(modifiedNodeProps),\n className,\n })}\n </div>\n );\n};\n\nexport default PreviewUnboundImage;\n"],"names":["_jsx"],"mappings":";;;;;AAeA;;;AAGG;AACG,MAAA,mBAAmB,GAAuC,CAAC,EAC/D,IAAI,EACJ,SAAS,EACT,SAAS,GACV,KAAI;AACH,IAAA,MAAM,YAAY,GAAkB;AAClC,QAAA,QAAQ,EAAE,UAAU;KACrB,CAAC;AAEF,IAAA,MAAM,iBAAiB,GAAG,EAAE,GAAG,SAAS,EAAE,CAAC;AAC3C,IAAA,IAAI,OAAO,iBAAiB,CAAC,cAAc,KAAK,QAAQ,EAAE;AACxD,QAAA,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,gBAAgB,EAAE,GAAG,iBAAiB,CAAC,cAAc,CAAC;;AAGhF,QAAA,YAAY,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AACrC,QAAA,YAAY,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;;QAGnC,iBAAiB,CAAC,cAAc,GAAG;AACjC,YAAA,GAAG,gBAAgB;AACnB,YAAA,MAAM,EAAE,MAAM;AACd,YAAA,KAAK,EAAE,MAAM;SACd,CAAC;KACH;AAED,IAAA,MAAM,SAAS,GAAG,YAAY,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC;AAEnE,IAAA,QACEA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,0BAA0B,EAAC,KAAK,EAAE,YAAY,YAC1D,KAAK,CAAC,aAAa,CAAC,SAAS,EAAE;YAC9B,GAAG,iBAAiB,CAAC,iBAAiB,CAAC;YACvC,SAAS;SACV,CAAC,EAAA,CACE,EACN;AACJ;;;;"}
@@ -1,4 +1,4 @@
1
- const SDK_VERSION = '1.17.1-dev-20241002T1713-b0fd86d.0';
1
+ const SDK_VERSION = '1.17.1-dev-20241003T1341-e0d12f6.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.17.1-dev-20241002T1713-b0fd86d.0';\n"],"names":[],"mappings":"AAAO,MAAM,WAAW,GAAG;;;;"}
1
+ {"version":3,"file":"sdkVersion.js","sources":["../../src/sdkVersion.ts"],"sourcesContent":["export const SDK_VERSION = '1.17.1-dev-20241003T1341-e0d12f6.0';\n"],"names":[],"mappings":"AAAO,MAAM,WAAW,GAAG;;;;"}
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import type { ComponentTreeNode, PrimitiveValue } from '@contentful/experiences-core/types';
3
+ interface PreviewUnboundImageProps {
4
+ node: ComponentTreeNode;
5
+ nodeProps: Record<PropertyKey, PrimitiveValue>;
6
+ component: React.ElementType;
7
+ }
8
+ /**
9
+ * This component is used to render a placeholder Image component in the preview
10
+ * when the image is unbound. It applies the Image size styles to a wrapping div.
11
+ */
12
+ declare const PreviewUnboundImage: React.FC<PreviewUnboundImageProps>;
13
+ export default PreviewUnboundImage;
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.17.1-dev-20241002T1713-b0fd86d.0";
1
+ export declare const SDK_VERSION = "1.17.1-dev-20241003T1341-e0d12f6.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experiences-sdk-react",
3
- "version": "1.17.1-dev-20241002T1713-b0fd86d.0",
3
+ "version": "1.17.1-dev-20241003T1341-e0d12f6.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.17.1-dev-20241002T1713-b0fd86d.0",
45
- "@contentful/experiences-core": "1.17.1-dev-20241002T1713-b0fd86d.0",
46
- "@contentful/experiences-validators": "1.17.1-dev-20241002T1713-b0fd86d.0",
47
- "@contentful/experiences-visual-editor-react": "1.17.1-dev-20241002T1713-b0fd86d.0",
44
+ "@contentful/experiences-components-react": "1.17.1-dev-20241003T1341-e0d12f6.0",
45
+ "@contentful/experiences-core": "1.17.1-dev-20241003T1341-e0d12f6.0",
46
+ "@contentful/experiences-validators": "1.17.1-dev-20241003T1341-e0d12f6.0",
47
+ "@contentful/experiences-visual-editor-react": "1.17.1-dev-20241003T1341-e0d12f6.0",
48
48
  "@contentful/rich-text-types": "^16.2.1",
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": "7d7e85cfdf2c4e6c72bd743659a1d4471df35644"
105
+ "gitHead": "ce8dfe0adc50cd25f1267d9a76867a29ba0f435c"
106
106
  }