@contentful/experiences-sdk-react 1.30.0-dev-20250124T1739-560b81b.0 → 1.30.0-dev-20250128T1255-64f728a.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.
@@ -8,7 +8,7 @@ import { Assembly, ContentfulContainer, Columns, SingleColumn } from '@contentfu
8
8
  import { resolveAssembly } from '../../core/preview/assemblyUtils.js';
9
9
  import PreviewUnboundImage from './PreviewUnboundImage.js';
10
10
 
11
- const CompositionBlock = ({ node: rawNode, locale, entityStore, hyperlinkPattern, resolveDesignValue, getPatternChildNodeClassName, }) => {
11
+ const CompositionBlock = ({ node: rawNode, locale, entityStore, hyperlinkPattern, resolveDesignValue, getPatternChildNodeClassName, wrappingPatternIds: parentWrappingPatternIds = new Set(), }) => {
12
12
  const isAssembly = useMemo(() => checkIsAssemblyNode({
13
13
  componentId: rawNode.definitionId,
14
14
  usedComponents: entityStore.usedComponents,
@@ -21,6 +21,12 @@ const CompositionBlock = ({ node: rawNode, locale, entityStore, hyperlinkPattern
21
21
  })
22
22
  : rawNode;
23
23
  }, [entityStore, isAssembly, rawNode]);
24
+ const wrappingPatternIds = useMemo(() => {
25
+ if (isAssembly) {
26
+ return new Set([node.definitionId, ...parentWrappingPatternIds]);
27
+ }
28
+ return parentWrappingPatternIds;
29
+ }, [isAssembly, node, parentWrappingPatternIds]);
24
30
  const componentRegistration = useMemo(() => {
25
31
  const registration = getComponentRegistration(node.definitionId);
26
32
  if (isAssembly && !registration) {
@@ -89,27 +95,32 @@ const CompositionBlock = ({ node: rawNode, locale, entityStore, hyperlinkPattern
89
95
  for (const slotId in componentRegistration.definition.slots) {
90
96
  const slotNode = node.children.find((child) => child.slotId === slotId);
91
97
  if (slotNode) {
92
- props[slotId] = (jsx(CompositionBlock, { node: slotNode, locale: locale, hyperlinkPattern: hyperlinkPattern, entityStore: entityStore, resolveDesignValue: resolveDesignValue }));
98
+ props[slotId] = (jsx(CompositionBlock, { node: slotNode, locale: locale, hyperlinkPattern: hyperlinkPattern, entityStore: entityStore, resolveDesignValue: resolveDesignValue, wrappingPatternIds: wrappingPatternIds }));
93
99
  }
94
100
  }
95
101
  }
96
102
  return props;
97
103
  }, [
98
- resolveDesignValue,
99
104
  node.variables,
100
105
  node.id,
101
106
  node.children,
107
+ resolveDesignValue,
102
108
  componentRegistration,
103
109
  isAssembly,
104
110
  getPatternChildNodeClassName,
105
111
  entityStore,
106
112
  hyperlinkPattern,
107
113
  locale,
114
+ wrappingPatternIds,
108
115
  ]);
109
116
  const className = useClassName({ props: nodeProps, node });
110
117
  if (!componentRegistration) {
111
118
  return null;
112
119
  }
120
+ // When detecting a circular dependency, we stop silently. The editor mode will render an actionable error.
121
+ if (parentWrappingPatternIds.has(node.definitionId)) {
122
+ return null;
123
+ }
113
124
  const { component } = componentRegistration;
114
125
  // Retrieves the CSS class name for a given child node ID.
115
126
  const _getPatternChildNodeClassName = (childNodeId) => {
@@ -126,7 +137,7 @@ const CompositionBlock = ({ node: rawNode, locale, entityStore, hyperlinkPattern
126
137
  ? node.children.map((childNode, index) => {
127
138
  return (jsx(CompositionBlock, { getPatternChildNodeClassName: isAssembly || getPatternChildNodeClassName
128
139
  ? _getPatternChildNodeClassName
129
- : undefined, node: childNode, locale: locale, hyperlinkPattern: hyperlinkPattern, entityStore: entityStore, resolveDesignValue: resolveDesignValue }, index));
140
+ : undefined, node: childNode, locale: locale, hyperlinkPattern: hyperlinkPattern, entityStore: entityStore, resolveDesignValue: resolveDesignValue, wrappingPatternIds: wrappingPatternIds }, index));
130
141
  })
131
142
  : null;
132
143
  if ([CONTENTFUL_COMPONENTS.container.id, CONTENTFUL_COMPONENTS.section.id].includes(node.definitionId)) {
@@ -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 {\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 // In SSR, we store the className under breakpoints[0] which is resolved here to the actual string\n const cfSsrClassNameValues = node.variables.cfSsrClassName as DesignValue | undefined;\n const cfSsrClassName = resolveDesignValue(\n cfSsrClassNameValues?.valuesByBreakpoint,\n 'cfSsrClassName',\n );\n\n // Don't enrich the assembly wrapper node with props\n if (!componentRegistration || isAssembly) {\n return { cfSsrClassName };\n }\n\n const propMap: Record<string, PrimitiveValue> = {\n cfSsrClassName:\n node.id && getPatternChildNodeClassName\n ? getPatternChildNodeClassName(node.id)\n : cfSsrClassName,\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 resolveDesignValue,\n node.variables,\n node.id,\n node.children,\n componentRegistration,\n isAssembly,\n getPatternChildNodeClassName,\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 // Retrieves the CSS class name for a given child node ID.\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: DesignValue | undefined = node.variables.cfSsrClassName?.[childNodeId];\n if (!classesForNode) return undefined;\n return resolveDesignValue(classesForNode.valuesByBreakpoint, 'cfSsrClassName') as string;\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={\n isAssembly || getPatternChildNodeClassName\n ? _getPatternChildNodeClassName\n : undefined\n }\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;AAC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KACH;IAED,IACE,IAAI,CAAC,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;;;;"}
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 wrappingPatternIds?: Set<string>;\n};\n\nexport const CompositionBlock = ({\n node: rawNode,\n locale,\n entityStore,\n hyperlinkPattern,\n resolveDesignValue,\n getPatternChildNodeClassName,\n wrappingPatternIds: parentWrappingPatternIds = new Set(),\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 wrappingPatternIds = useMemo(() => {\n if (isAssembly) {\n return new Set([node.definitionId, ...parentWrappingPatternIds]);\n }\n return parentWrappingPatternIds;\n }, [isAssembly, node, parentWrappingPatternIds]);\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 // In SSR, we store the className under breakpoints[0] which is resolved here to the actual string\n const cfSsrClassNameValues = node.variables.cfSsrClassName as DesignValue | undefined;\n const cfSsrClassName = resolveDesignValue(\n cfSsrClassNameValues?.valuesByBreakpoint,\n 'cfSsrClassName',\n );\n\n // Don't enrich the assembly wrapper node with props\n if (!componentRegistration || isAssembly) {\n return { cfSsrClassName };\n }\n\n const propMap: Record<string, PrimitiveValue> = {\n cfSsrClassName:\n node.id && getPatternChildNodeClassName\n ? getPatternChildNodeClassName(node.id)\n : cfSsrClassName,\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 wrappingPatternIds={wrappingPatternIds}\n />\n );\n }\n }\n }\n\n return props;\n }, [\n node.variables,\n node.id,\n node.children,\n resolveDesignValue,\n componentRegistration,\n isAssembly,\n getPatternChildNodeClassName,\n entityStore,\n hyperlinkPattern,\n locale,\n wrappingPatternIds,\n ]);\n\n const className = useClassName({ props: nodeProps, node });\n\n if (!componentRegistration) {\n return null;\n }\n\n // When detecting a circular dependency, we stop silently. The editor mode will render an actionable error.\n if (parentWrappingPatternIds.has(node.definitionId)) {\n return null;\n }\n\n const { component } = componentRegistration;\n\n // Retrieves the CSS class name for a given child node ID.\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: DesignValue | undefined = node.variables.cfSsrClassName?.[childNodeId];\n if (!classesForNode) return undefined;\n return resolveDesignValue(classesForNode.valuesByBreakpoint, 'cfSsrClassName') as string;\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={\n isAssembly || getPatternChildNodeClassName\n ? _getPatternChildNodeClassName\n : undefined\n }\n node={childNode}\n key={index}\n locale={locale}\n hyperlinkPattern={hyperlinkPattern}\n entityStore={entityStore}\n resolveDesignValue={resolveDesignValue}\n wrappingPatternIds={wrappingPatternIds}\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":";;;;;;;;;;AA0CO,MAAM,gBAAgB,GAAG,CAAC,EAC/B,IAAI,EAAE,OAAO,EACb,MAAM,EACN,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,4BAA4B,EAC5B,kBAAkB,EAAE,wBAAwB,GAAG,IAAI,GAAG,EAAE,GAClC,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,kBAAkB,GAAG,OAAO,CAAC,MAAK;QACtC,IAAI,UAAU,EAAE;AACd,YAAA,OAAO,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,wBAAwB,CAAC,CAAC,CAAC;SAClE;AACD,QAAA,OAAO,wBAAwB,CAAC;KACjC,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,wBAAwB,CAAC,CAAC,CAAC;AAEjD,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,C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,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;IAED,IACE,IAAI,CAAC,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;;;;"}
@@ -6,7 +6,7 @@ import { sdkFeatures } from '../core/sdkFeatures.js';
6
6
 
7
7
  const useDetectCanvasMode = ({ isClientSide = false } = {}) => {
8
8
  const [mounted, setMounted] = useState(false);
9
- const recievedModeMessage = useRef(false);
9
+ const receivedModeMessage = useRef(false);
10
10
  const [mode, setMode] = useState(() => {
11
11
  // if we are client side and running in an iframe, then initialize to read only,
12
12
  // Editor mode can be requested later.
@@ -29,7 +29,7 @@ const useDetectCanvasMode = ({ isClientSide = false } = {}) => {
29
29
  }
30
30
  const isEditorMode = eventData.eventType === INCOMING_EVENTS.RequestEditorMode;
31
31
  const mode = isEditorMode ? StudioCanvasMode.EDITOR : StudioCanvasMode.READ_ONLY;
32
- recievedModeMessage.current = true;
32
+ receivedModeMessage.current = true;
33
33
  setMode(mode);
34
34
  if (typeof window !== 'undefined') {
35
35
  // Once we definitely know that we are in editor mode, we set this flag so future postMessage connect calls are not made
@@ -43,7 +43,7 @@ const useDetectCanvasMode = ({ isClientSide = false } = {}) => {
43
43
  }, []);
44
44
  useEffect(() => {
45
45
  const handleHandshakeTimeout = () => {
46
- if (!recievedModeMessage.current) {
46
+ if (!receivedModeMessage.current) {
47
47
  setMode(StudioCanvasMode.NONE);
48
48
  }
49
49
  };
@@ -54,14 +54,19 @@ const useDetectCanvasMode = ({ isClientSide = false } = {}) => {
54
54
  window.addEventListener('message', onMessage);
55
55
  sendMessage(OUTGOING_EVENTS.Connected, undefined);
56
56
  sendMessage(OUTGOING_EVENTS.SDKFeatures, sdkFeatures);
57
- setTimeout(handleHandshakeTimeout, 100);
57
+ // FIXME: This causes a race condition by setting the mode sometimes to NONE when
58
+ // reloading the canvas due to a save event.
59
+ const handshakeTimeout = setTimeout(handleHandshakeTimeout, 100);
60
+ return () => {
61
+ window.removeEventListener('message', onMessage);
62
+ clearTimeout(handshakeTimeout);
63
+ };
58
64
  }
59
65
  }
60
66
  else {
61
67
  setMounted(true);
62
68
  }
63
- return () => window.removeEventListener('message', onMessage);
64
- }, [mounted, onMessage]);
69
+ }, [mode, mounted, onMessage]);
65
70
  return mode;
66
71
  };
67
72
  function inIframe() {
@@ -1 +1 @@
1
- {"version":3,"file":"useDetectCanvasMode.js","sources":["../../../src/hooks/useDetectCanvasMode.tsx"],"sourcesContent":["'use client';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport {\n doesMismatchMessageSchema,\n sendMessage,\n tryParseMessage,\n} from '@contentful/experiences-core';\nimport {\n INCOMING_EVENTS,\n OUTGOING_EVENTS,\n StudioCanvasMode,\n} from '@contentful/experiences-core/constants';\nimport { sdkFeatures } from '../core/sdkFeatures';\n\ntype useDetectCanvasModeArgs = {\n /** If running from a known client side only situation (ie: useFetchBySlug),\n * set this to true to kick in editor mode check sooner (which avoids a render cycle) */\n isClientSide?: boolean;\n};\n\nexport const useDetectCanvasMode = ({ isClientSide = false }: useDetectCanvasModeArgs = {}) => {\n const [mounted, setMounted] = useState(false);\n const recievedModeMessage = useRef(false);\n const [mode, setMode] = useState<StudioCanvasMode>(() => {\n // if we are client side and running in an iframe, then initialize to read only,\n // Editor mode can be requested later.\n if (isClientSide && inIframe()) {\n return StudioCanvasMode.READ_ONLY;\n } else {\n return StudioCanvasMode.NONE;\n }\n });\n\n const onMessage = useCallback((event: MessageEvent) => {\n if (doesMismatchMessageSchema(event)) {\n return;\n }\n const eventData = tryParseMessage(event);\n const isRequestingCanvasMode =\n eventData.eventType === INCOMING_EVENTS.RequestEditorMode ||\n eventData.eventType === INCOMING_EVENTS.RequestReadOnlyMode;\n\n if (!isRequestingCanvasMode) {\n return;\n }\n\n const isEditorMode = eventData.eventType === INCOMING_EVENTS.RequestEditorMode;\n const mode = isEditorMode ? StudioCanvasMode.EDITOR : StudioCanvasMode.READ_ONLY;\n\n recievedModeMessage.current = true;\n setMode(mode);\n\n if (typeof window !== 'undefined') {\n // Once we definitely know that we are in editor mode, we set this flag so future postMessage connect calls are not made\n if (!window.__EB__) {\n window.__EB__ = {};\n }\n window.__EB__.isReadOnlyMode = !isEditorMode;\n window.__EB__.isEditorMode = isEditorMode;\n }\n\n window.removeEventListener('message', onMessage);\n }, []);\n\n useEffect(() => {\n const handleHandshakeTimeout = () => {\n if (!recievedModeMessage.current) {\n setMode(StudioCanvasMode.NONE);\n }\n };\n\n // Only run check after component is mounted on the client to avoid hydration ssr issues\n if (mounted) {\n // Double check if we are in editor mode by listening to postMessage events\n if (typeof window !== 'undefined') {\n window.addEventListener('message', onMessage);\n sendMessage(OUTGOING_EVENTS.Connected, undefined);\n sendMessage(OUTGOING_EVENTS.SDKFeatures, sdkFeatures);\n\n setTimeout(handleHandshakeTimeout, 100);\n }\n } else {\n setMounted(true);\n }\n\n return () => window.removeEventListener('message', onMessage);\n }, [mounted, onMessage]);\n\n return mode;\n};\n\nfunction inIframe() {\n try {\n return window.self !== window.top;\n } catch (e) {\n return false;\n }\n}\n"],"names":[],"mappings":";;;;;;AAoBO;;AAEL;;;;AAIE;;;;;;AAKF;AAEA;AACE;;;AAGA;;AAGE;;;;;AAOF;AAEA;;AAGA;;AAEE;AACE;;AAEF;AACA;;AAGF;;;;AAKE;AACE;;AAEJ;;;;AAKE;AACE;AACA;AACA;AAEA;;;;;;;AAON;AAEA;AACF;AAEA;AACE;AACE;;;AAEA;;AAEJ;;"}
1
+ {"version":3,"file":"useDetectCanvasMode.js","sources":["../../../src/hooks/useDetectCanvasMode.tsx"],"sourcesContent":["'use client';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport {\n doesMismatchMessageSchema,\n sendMessage,\n tryParseMessage,\n} from '@contentful/experiences-core';\nimport {\n INCOMING_EVENTS,\n OUTGOING_EVENTS,\n StudioCanvasMode,\n} from '@contentful/experiences-core/constants';\nimport { sdkFeatures } from '../core/sdkFeatures';\n\ntype useDetectCanvasModeArgs = {\n /** If running from a known client side only situation (ie: useFetchBySlug),\n * set this to true to kick in editor mode check sooner (which avoids a render cycle) */\n isClientSide?: boolean;\n};\n\nexport const useDetectCanvasMode = ({ isClientSide = false }: useDetectCanvasModeArgs = {}) => {\n const [mounted, setMounted] = useState(false);\n const receivedModeMessage = useRef(false);\n const [mode, setMode] = useState<StudioCanvasMode>(() => {\n // if we are client side and running in an iframe, then initialize to read only,\n // Editor mode can be requested later.\n if (isClientSide && inIframe()) {\n return StudioCanvasMode.READ_ONLY;\n } else {\n return StudioCanvasMode.NONE;\n }\n });\n\n const onMessage = useCallback((event: MessageEvent) => {\n if (doesMismatchMessageSchema(event)) {\n return;\n }\n const eventData = tryParseMessage(event);\n const isRequestingCanvasMode =\n eventData.eventType === INCOMING_EVENTS.RequestEditorMode ||\n eventData.eventType === INCOMING_EVENTS.RequestReadOnlyMode;\n\n if (!isRequestingCanvasMode) {\n return;\n }\n\n const isEditorMode = eventData.eventType === INCOMING_EVENTS.RequestEditorMode;\n const mode = isEditorMode ? StudioCanvasMode.EDITOR : StudioCanvasMode.READ_ONLY;\n\n receivedModeMessage.current = true;\n setMode(mode);\n\n if (typeof window !== 'undefined') {\n // Once we definitely know that we are in editor mode, we set this flag so future postMessage connect calls are not made\n if (!window.__EB__) {\n window.__EB__ = {};\n }\n window.__EB__.isReadOnlyMode = !isEditorMode;\n window.__EB__.isEditorMode = isEditorMode;\n }\n\n window.removeEventListener('message', onMessage);\n }, []);\n\n useEffect(() => {\n const handleHandshakeTimeout = () => {\n if (!receivedModeMessage.current) {\n setMode(StudioCanvasMode.NONE);\n }\n };\n\n // Only run check after component is mounted on the client to avoid hydration ssr issues\n if (mounted) {\n // Double check if we are in editor mode by listening to postMessage events\n if (typeof window !== 'undefined') {\n window.addEventListener('message', onMessage);\n sendMessage(OUTGOING_EVENTS.Connected, undefined);\n sendMessage(OUTGOING_EVENTS.SDKFeatures, sdkFeatures);\n\n // FIXME: This causes a race condition by setting the mode sometimes to NONE when\n // reloading the canvas due to a save event.\n const handshakeTimeout = setTimeout(handleHandshakeTimeout, 100);\n\n return () => {\n window.removeEventListener('message', onMessage);\n clearTimeout(handshakeTimeout);\n };\n }\n } else {\n setMounted(true);\n }\n }, [mode, mounted, onMessage]);\n\n return mode;\n};\n\nfunction inIframe() {\n try {\n return window.self !== window.top;\n } catch (e) {\n return false;\n }\n}\n"],"names":[],"mappings":";;;;;;AAoBO;;AAEL;;;;AAIE;;;;;;AAKF;AAEA;AACE;;;AAGA;;AAGE;;;;;AAOF;AAEA;;AAGA;;AAEE;AACE;;AAEF;AACA;;AAGF;;;;AAKE;AACE;;AAEJ;;;;AAKE;AACE;AACA;AACA;;;;AAMA;AACE;;AAEF;;;;;;;AAON;AACF;AAEA;AACE;AACE;;;AAEA;;AAEJ;;"}
@@ -27,6 +27,16 @@ const useFetchByBase = (fetchMethod, mode) => {
27
27
  }
28
28
  })();
29
29
  }, [fetchMethod, mode]);
30
+ // When a save event caused a canvas reload, the `receivedModeMessage` might time out and set the
31
+ // mode temporarily to NONE. If it's set to a valid mode afterward, we ignore the fetch result.
32
+ if (mode === StudioCanvasMode.EDITOR || mode === StudioCanvasMode.READ_ONLY) {
33
+ return {
34
+ error: undefined,
35
+ experience: undefined,
36
+ isLoading: false,
37
+ mode,
38
+ };
39
+ }
30
40
  return {
31
41
  error,
32
42
  experience,
@@ -1 +1 @@
1
- {"version":3,"file":"useFetchByBase.js","sources":["../../../src/hooks/useFetchByBase.ts"],"sourcesContent":["'use client';\nimport { useEffect, useState } from 'react';\nimport { EntityStore } from '@contentful/experiences-core';\nimport type { Experience } from '@contentful/experiences-core/types';\nimport { StudioCanvasMode } from '@contentful/experiences-core/constants';\n\nexport const useFetchByBase = (\n fetchMethod: () => Promise<Experience<EntityStore> | undefined>,\n mode: StudioCanvasMode,\n) => {\n const [experience, setExperience] = useState<Experience<EntityStore>>();\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<Error>();\n\n useEffect(() => {\n (async () => {\n // if we are in editor/read only mode, we don't want to fetch the experience here\n // it is passed via postMessage instead\n if (mode === StudioCanvasMode.EDITOR || mode === StudioCanvasMode.READ_ONLY) {\n return;\n }\n setIsLoading(true);\n setError(undefined);\n try {\n const exp = await fetchMethod();\n setExperience(exp);\n } catch (error) {\n setError(error as Error);\n } finally {\n setIsLoading(false);\n }\n })();\n }, [fetchMethod, mode]);\n\n return {\n error,\n experience,\n isLoading,\n mode,\n };\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAkBM;;;;;AAKA;AACE;;;;;;;;;;AAQN;;;;;;;AAQF;;"}
1
+ {"version":3,"file":"useFetchByBase.js","sources":["../../../src/hooks/useFetchByBase.ts"],"sourcesContent":["'use client';\nimport { useEffect, useState } from 'react';\nimport { EntityStore } from '@contentful/experiences-core';\nimport type { Experience } from '@contentful/experiences-core/types';\nimport { StudioCanvasMode } from '@contentful/experiences-core/constants';\n\nexport const useFetchByBase = (\n fetchMethod: () => Promise<Experience<EntityStore> | undefined>,\n mode: StudioCanvasMode,\n) => {\n const [experience, setExperience] = useState<Experience<EntityStore>>();\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<Error>();\n\n useEffect(() => {\n (async () => {\n // if we are in editor/read only mode, we don't want to fetch the experience here\n // it is passed via postMessage instead\n if (mode === StudioCanvasMode.EDITOR || mode === StudioCanvasMode.READ_ONLY) {\n return;\n }\n setIsLoading(true);\n setError(undefined);\n try {\n const exp = await fetchMethod();\n setExperience(exp);\n } catch (error) {\n setError(error as Error);\n } finally {\n setIsLoading(false);\n }\n })();\n }, [fetchMethod, mode]);\n\n // When a save event caused a canvas reload, the `receivedModeMessage` might time out and set the\n // mode temporarily to NONE. If it's set to a valid mode afterward, we ignore the fetch result.\n if (mode === StudioCanvasMode.EDITOR || mode === StudioCanvasMode.READ_ONLY) {\n return {\n error: undefined,\n experience: undefined,\n isLoading: false,\n mode,\n };\n }\n\n return {\n error,\n experience,\n isLoading,\n mode,\n };\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAkBM;;;;;AAKA;AACE;;;;;;;;;;AAQN;;;AAIA;;AAEI;AACA;AACA;;;;;;;;;;AAWN;;"}
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ import * as _contentful_experiences_core_constants from '@contentful/experiences
8
8
  export { CF_STYLE_ATTRIBUTES, CONTENTFUL_COMPONENTS, LATEST_SCHEMA_VERSION } from '@contentful/experiences-core/constants';
9
9
  import { ContentfulClientApi } from 'contentful';
10
10
 
11
- declare const SDK_VERSION = "1.30.0-dev-20250124T1739-560b81b.0";
11
+ declare const SDK_VERSION = "1.30.0-dev-20250128T1255-64f728a.0";
12
12
 
13
13
  type ExperienceRootProps = {
14
14
  experience?: Experience<EntityStore> | string | null;
@@ -25,13 +25,21 @@ type UseFetchByIdArgs = {
25
25
  hyperlinkPattern?: string;
26
26
  };
27
27
  declare const useFetchById: ({ id, localeCode, client, experienceTypeId, hyperlinkPattern, }: UseFetchByIdArgs) => {
28
+ experience: {
29
+ hyperlinkPattern: string | undefined;
30
+ entityStore?: _contentful_experiences_core.EntityStore | undefined;
31
+ };
32
+ error: undefined;
33
+ isLoading: boolean;
34
+ mode: _contentful_experiences_core_constants.StudioCanvasMode.READ_ONLY | _contentful_experiences_core_constants.StudioCanvasMode.EDITOR;
35
+ } | {
28
36
  experience: {
29
37
  hyperlinkPattern: string | undefined;
30
38
  entityStore?: _contentful_experiences_core.EntityStore | undefined;
31
39
  };
32
40
  error: Error | undefined;
33
41
  isLoading: boolean;
34
- mode: _contentful_experiences_core_constants.StudioCanvasMode;
42
+ mode: _contentful_experiences_core_constants.StudioCanvasMode.NONE;
35
43
  };
36
44
 
37
45
  type UseFetchBySlugArgs = {
@@ -43,13 +51,21 @@ type UseFetchBySlugArgs = {
43
51
  hyperlinkPattern?: string;
44
52
  };
45
53
  declare const useFetchBySlug: ({ slug, localeCode, client, experienceTypeId, hyperlinkPattern, }: UseFetchBySlugArgs) => {
54
+ experience: {
55
+ hyperlinkPattern: string | undefined;
56
+ entityStore?: _contentful_experiences_core.EntityStore | undefined;
57
+ };
58
+ error: undefined;
59
+ isLoading: boolean;
60
+ mode: _contentful_experiences_core_constants.StudioCanvasMode.READ_ONLY | _contentful_experiences_core_constants.StudioCanvasMode.EDITOR;
61
+ } | {
46
62
  experience: {
47
63
  hyperlinkPattern: string | undefined;
48
64
  entityStore?: _contentful_experiences_core.EntityStore | undefined;
49
65
  };
50
66
  error: Error | undefined;
51
67
  isLoading: boolean;
52
- mode: _contentful_experiences_core_constants.StudioCanvasMode;
68
+ mode: _contentful_experiences_core_constants.StudioCanvasMode.NONE;
53
69
  };
54
70
 
55
71
  /**
@@ -1,4 +1,4 @@
1
- const SDK_VERSION = '1.30.0-dev-20250124T1739-560b81b.0';
1
+ const SDK_VERSION = '1.30.0-dev-20250128T1255-64f728a.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.30.0-dev-20250124T1739-560b81b.0';\n"],"names":[],"mappings":"AAAO,MAAM,WAAW,GAAG;;;;"}
1
+ {"version":3,"file":"sdkVersion.js","sources":["../../src/sdkVersion.ts"],"sourcesContent":["export const SDK_VERSION = '1.30.0-dev-20250128T1255-64f728a.0';\n"],"names":[],"mappings":"AAAO,MAAM,WAAW,GAAG;;;;"}
@@ -7,6 +7,7 @@ type CompositionBlockProps = {
7
7
  hyperlinkPattern?: string | undefined;
8
8
  resolveDesignValue: ResolveDesignValueType;
9
9
  getPatternChildNodeClassName?: (childNodeId: string) => string | undefined;
10
+ wrappingPatternIds?: Set<string>;
10
11
  };
11
- export declare const CompositionBlock: ({ node: rawNode, locale, entityStore, hyperlinkPattern, resolveDesignValue, getPatternChildNodeClassName, }: CompositionBlockProps) => import("react/jsx-runtime").JSX.Element | null;
12
+ export declare const CompositionBlock: ({ node: rawNode, locale, entityStore, hyperlinkPattern, resolveDesignValue, getPatternChildNodeClassName, wrappingPatternIds: parentWrappingPatternIds, }: CompositionBlockProps) => import("react/jsx-runtime").JSX.Element | null;
12
13
  export {};
@@ -2,8 +2,13 @@ import { EntityStore } from '@contentful/experiences-core';
2
2
  import type { Experience } from '@contentful/experiences-core/types';
3
3
  import { StudioCanvasMode } from '@contentful/experiences-core/constants';
4
4
  export declare const useFetchByBase: (fetchMethod: () => Promise<Experience<EntityStore> | undefined>, mode: StudioCanvasMode) => {
5
+ error: undefined;
6
+ experience: undefined;
7
+ isLoading: boolean;
8
+ mode: StudioCanvasMode.READ_ONLY | StudioCanvasMode.EDITOR;
9
+ } | {
5
10
  error: Error | undefined;
6
11
  experience: Experience<EntityStore> | undefined;
7
12
  isLoading: boolean;
8
- mode: StudioCanvasMode;
13
+ mode: StudioCanvasMode.NONE;
9
14
  };
@@ -7,11 +7,19 @@ export type UseFetchByIdArgs = {
7
7
  hyperlinkPattern?: string;
8
8
  };
9
9
  export declare const useFetchById: ({ id, localeCode, client, experienceTypeId, hyperlinkPattern, }: UseFetchByIdArgs) => {
10
+ experience: {
11
+ hyperlinkPattern: string | undefined;
12
+ entityStore?: import("@contentful/experiences-core").EntityStore | undefined;
13
+ };
14
+ error: undefined;
15
+ isLoading: boolean;
16
+ mode: import("@contentful/experiences-core/constants").StudioCanvasMode.READ_ONLY | import("@contentful/experiences-core/constants").StudioCanvasMode.EDITOR;
17
+ } | {
10
18
  experience: {
11
19
  hyperlinkPattern: string | undefined;
12
20
  entityStore?: import("@contentful/experiences-core").EntityStore | undefined;
13
21
  };
14
22
  error: Error | undefined;
15
23
  isLoading: boolean;
16
- mode: import("@contentful/experiences-core/constants").StudioCanvasMode;
24
+ mode: import("@contentful/experiences-core/constants").StudioCanvasMode.NONE;
17
25
  };
@@ -8,11 +8,19 @@ export type UseFetchBySlugArgs = {
8
8
  hyperlinkPattern?: string;
9
9
  };
10
10
  export declare const useFetchBySlug: ({ slug, localeCode, client, experienceTypeId, hyperlinkPattern, }: UseFetchBySlugArgs) => {
11
+ experience: {
12
+ hyperlinkPattern: string | undefined;
13
+ entityStore?: import("@contentful/experiences-core").EntityStore | undefined;
14
+ };
15
+ error: undefined;
16
+ isLoading: boolean;
17
+ mode: import("@contentful/experiences-core/constants").StudioCanvasMode.READ_ONLY | import("@contentful/experiences-core/constants").StudioCanvasMode.EDITOR;
18
+ } | {
11
19
  experience: {
12
20
  hyperlinkPattern: string | undefined;
13
21
  entityStore?: import("@contentful/experiences-core").EntityStore | undefined;
14
22
  };
15
23
  error: Error | undefined;
16
24
  isLoading: boolean;
17
- mode: import("@contentful/experiences-core/constants").StudioCanvasMode;
25
+ mode: import("@contentful/experiences-core/constants").StudioCanvasMode.NONE;
18
26
  };
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.30.0-dev-20250124T1739-560b81b.0";
1
+ export declare const SDK_VERSION = "1.30.0-dev-20250128T1255-64f728a.0";
@@ -1,105 +1,12 @@
1
- import type { ExperienceTreeNode, SchemaVersions } from '@contentful/experiences-core/types';
1
+ import type { ExperienceEntry, ExperienceTreeNode, SchemaVersions } from '@contentful/experiences-core/types';
2
2
  type createAssemblyEntryArgs = {
3
- schemaVersion: SchemaVersions;
4
- id: string;
3
+ schemaVersion?: SchemaVersions;
4
+ id?: string;
5
5
  };
6
6
  export declare const defaultAssemblyId = "assembly-id";
7
7
  export declare const assemblyGeneratedVariableName = "text_uuid1Assembly";
8
8
  export declare const assemblyGeneratedDesignVariableName = "cfWidth_uuid2Assembly";
9
- export declare const createAssemblyEntry: ({ schemaVersion, id, }: createAssemblyEntryArgs) => {
10
- sys: {
11
- id: string;
12
- type: string;
13
- contentType: {
14
- sys: {
15
- id: string;
16
- type: string;
17
- linkType: string;
18
- };
19
- };
20
- createdAt: string;
21
- updatedAt: string;
22
- revision: number;
23
- space: {
24
- sys: {
25
- type: string;
26
- linkType: string;
27
- id: string;
28
- };
29
- };
30
- environment: {
31
- sys: {
32
- type: string;
33
- linkType: string;
34
- id: string;
35
- };
36
- };
37
- };
38
- metadata: {
39
- tags: never[];
40
- };
41
- fields: {
42
- title: string;
43
- slug: string;
44
- componentTree: {
45
- children: {
46
- definitionId: string;
47
- variables: {
48
- cfWidth: {
49
- type: string;
50
- key: string;
51
- };
52
- };
53
- children: {
54
- definitionId: string;
55
- variables: {
56
- text: {
57
- key: string;
58
- type: string;
59
- };
60
- };
61
- children: never[];
62
- }[];
63
- }[];
64
- breakpoints: {
65
- id: string;
66
- query: string;
67
- previewSize: string;
68
- displayName: string;
69
- }[];
70
- schemaVersion: "2023-09-28";
71
- };
72
- dataSource: {};
73
- unboundValues: {
74
- unbound_uuid1Assembly: {
75
- value: string;
76
- };
77
- };
78
- componentSettings: {
79
- variableDefinitions: {
80
- text_uuid1Assembly: {
81
- displayName: string;
82
- type: "Text";
83
- defaultValue: {
84
- type: "UnboundValue";
85
- key: string;
86
- };
87
- };
88
- cfWidth_uuid2Assembly: {
89
- displayName: string;
90
- type: "Text";
91
- group: string;
92
- defaultValue: {
93
- type: "DesignValue";
94
- valuesByBreakpoint: {
95
- desktop: string;
96
- };
97
- };
98
- };
99
- };
100
- };
101
- };
102
- };
9
+ export declare const createAssemblyEntry: ({ schemaVersion, id, }?: createAssemblyEntryArgs) => ExperienceEntry;
103
10
  type createAssemblyNodeArgs = {
104
11
  id: string;
105
12
  blockId?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experiences-sdk-react",
3
- "version": "1.30.0-dev-20250124T1739-560b81b.0",
3
+ "version": "1.30.0-dev-20250128T1255-64f728a.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.30.0-dev-20250124T1739-560b81b.0",
45
- "@contentful/experiences-core": "1.30.0-dev-20250124T1739-560b81b.0",
46
- "@contentful/experiences-validators": "1.30.0-dev-20250124T1739-560b81b.0",
47
- "@contentful/experiences-visual-editor-react": "1.30.0-dev-20250124T1739-560b81b.0",
44
+ "@contentful/experiences-components-react": "1.30.0-dev-20250128T1255-64f728a.0",
45
+ "@contentful/experiences-core": "1.30.0-dev-20250128T1255-64f728a.0",
46
+ "@contentful/experiences-validators": "1.30.0-dev-20250128T1255-64f728a.0",
47
+ "@contentful/experiences-visual-editor-react": "1.30.0-dev-20250128T1255-64f728a.0",
48
48
  "@contentful/rich-text-types": "^17.0.0",
49
49
  "classnames": "^2.3.2",
50
50
  "csstype": "^3.1.2",
@@ -102,5 +102,5 @@
102
102
  "dist",
103
103
  "package.json"
104
104
  ],
105
- "gitHead": "5c79b509edb4485c183c4a9b5b44900498698825"
105
+ "gitHead": "8609cfa992e92dcebf8841757862d58ddd2c153c"
106
106
  }