@contentful/experiences-sdk-react 0.0.1-alpha.3 → 0.0.1-alpha.4

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/index.js CHANGED
@@ -9,7 +9,7 @@ import * as Components from '@contentful/experiences-components-react';
9
9
  import { ContentfulContainer, Columns, SingleColumn } from '@contentful/experiences-components-react';
10
10
  import styleInject from 'style-inject';
11
11
 
12
- const SDK_VERSION = '0.0.1-alpha.2';
12
+ const SDK_VERSION = '0.0.1-alpha.3';
13
13
 
14
14
  /**
15
15
  * Sets up a component to be consumed by Experience Builder. This function can be used to wrap a component with a container component, or to pass props to the component directly.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/sdkVersion.ts","../../src/utils/withComponentWrapper.tsx","../../src/constants.ts","../../src/core/componentRegistry.ts","../../src/hooks/useStyleTag.ts","../../src/core/preview/assemblyUtils.ts","../../src/components/Assembly.tsx","../../src/blocks/preview/CompositionBlock.tsx","../../src/hooks/useBreakpoints.ts","../../src/hooks/useFetchByBase.ts","../../src/hooks/useDetectEditorMode.tsx","../../src/hooks/useFetchById.ts","../../src/hooks/useFetchBySlug.ts","../../src/blocks/preview/PreviewDeliveryRoot.tsx","../../src/components/ErrorBoundary.tsx","../../src/hooks/useInitializeVisualEditor.ts","../../src/blocks/editor/VisualEditorRoot.tsx","../../src/ExperienceRoot.tsx","../../src/index.ts"],"sourcesContent":["export const SDK_VERSION = '0.0.1-alpha.2';\n","import { ComponentRegistration } from '@contentful/experiences-core/types';\nimport React from 'react';\n\ninterface CFProps {\n /**\n * Classes to be applied to the container component if `wrapComponent` is true, or directly to the child component if false.\n */\n className?: string;\n /**\n * Classes to be applied to the child component if `wrapComponent` is true, or directly to the child component if false.\n */\n classes?: string;\n onMouseDown?: React.MouseEventHandler;\n onMouseUp?: React.MouseEventHandler;\n onClick?: React.MouseEventHandler;\n /**\n * Prop required by Experience Builder to identify the component.\n */\n 'data-cf-node-id'?: string;\n /**\n * Prop required by Experience Builder to identify the component.\n */\n 'data-cf-node-block-id'?: string;\n /**\n * Prop required by Experience Builder to identify the component's type.\n */\n 'data-cf-node-block-type'?: string;\n}\n\n/**\n * Sets up a component to be consumed by Experience Builder. This function can be used to wrap a component with a container component, or to pass props to the component directly.\n * @param Component Component to be used by Experience Builder.\n * @param options Options for the `withComponentWrapper` function.\n * @default { wrapComponent: true, wrapContainerTag: 'div' }\n * @returns A component that can be passed to `defineComponents`.\n */\nexport function withComponentWrapper<T extends object>(\n Component: React.ElementType<T>,\n options: ComponentRegistration['options'] = {\n wrapComponent: true,\n wrapContainerTag: 'div',\n },\n) {\n const Wrapped = ({\n classes = '',\n className = '',\n 'data-cf-node-id': dataCfNodeId,\n 'data-cf-node-block-id': dataCfNodeBlockId,\n 'data-cf-node-block-type': dataCfNodeBlockType,\n onClick,\n onMouseDown,\n onMouseUp,\n ...props\n }: CFProps & T) => {\n const Tag = options.wrapContainerTag || 'div';\n const cfProps = {\n 'data-cf-node-id': dataCfNodeId,\n 'data-cf-node-block-id': dataCfNodeBlockId,\n 'data-cf-node-block-type': dataCfNodeBlockType,\n onClick,\n onMouseDown,\n onMouseUp,\n };\n\n const component = options.wrapComponent ? (\n <Tag className={className} {...cfProps}>\n {typeof Component === 'string' ? (\n React.createElement(Component, { className: classes, ...props })\n ) : (\n <Component className={classes} {...(props as T)} />\n )}\n </Tag>\n ) : (\n React.createElement(Component, {\n className: classes + className ? classes + ' ' + className : undefined,\n ...cfProps,\n ...(props as T),\n })\n );\n return component;\n };\n\n return Wrapped;\n}\n","import type { SchemaVersions } from '@contentful/experiences-core/types';\n\n// this is the array of version which currently LATEST_SCHEMA_VERSION is compatible with\nexport const compatibleVersions: SchemaVersions[] = ['2023-08-23', '2023-09-28'];\n\nexport { SDK_VERSION } from './sdkVersion';\n","import * as Components from '@contentful/experiences-components-react';\nimport type {\n ComponentRegistration,\n ComponentDefinition,\n ComponentRegistrationOptions,\n} from '@contentful/experiences-core/types';\nimport {\n OUTGOING_EVENTS,\n INTERNAL_EVENTS,\n CONTENTFUL_COMPONENTS,\n ASSEMBLY_DEFAULT_CATEGORY,\n} from '@contentful/experiences-core/constants';\nimport {\n builtInStyles as builtInStyleDefinitions,\n designTokensRegistry,\n optionalBuiltInStyles,\n sendMessage,\n containerDefinition,\n sectionDefinition,\n columnsDefinition,\n singleColumnDefinition,\n} from '@contentful/experiences-core';\nimport { withComponentWrapper } from '../utils/withComponentWrapper';\nimport { SDK_VERSION } from '../constants';\n\nconst cloneObject = <T>(targetObject: T): T => {\n if (typeof structuredClone !== 'undefined') {\n return structuredClone(targetObject);\n }\n\n return JSON.parse(JSON.stringify(targetObject));\n};\n\nconst applyComponentDefinitionFallbacks = (componentDefinition: ComponentDefinition) => {\n const clone = cloneObject(componentDefinition);\n for (const variable of Object.values(clone.variables)) {\n variable.group = variable.group ?? 'content';\n }\n return clone;\n};\n\nconst applyBuiltInStyleDefinitions = (componentDefinition: ComponentDefinition) => {\n if ([CONTENTFUL_COMPONENTS.container.id].includes(componentDefinition.id)) {\n return componentDefinition;\n }\n\n const clone = cloneObject(componentDefinition);\n\n // set margin built-in style by default\n if (!clone.builtInStyles) {\n clone.builtInStyles = ['cfMargin'];\n }\n\n for (const style of Object.values(clone.builtInStyles || [])) {\n if (builtInStyleDefinitions[style]) {\n clone.variables[style] = builtInStyleDefinitions[style];\n }\n if (optionalBuiltInStyles[style]) {\n clone.variables[style] = optionalBuiltInStyles[style];\n }\n }\n return clone;\n};\n\nexport const enrichComponentDefinition = ({\n component,\n definition,\n options,\n}: ComponentRegistration): ComponentRegistration => {\n const definitionWithFallbacks = applyComponentDefinitionFallbacks(definition);\n const definitionWithBuiltInStyles = applyBuiltInStyleDefinitions(definitionWithFallbacks);\n return {\n component: withComponentWrapper(component, options),\n definition: definitionWithBuiltInStyles,\n };\n};\n\nconst DEFAULT_COMPONENT_REGISTRATIONS = {\n container: {\n component: Components.ContentfulContainer,\n definition: containerDefinition,\n },\n section: {\n component: Components.ContentfulContainer,\n definition: sectionDefinition,\n },\n columns: {\n component: Components.Columns,\n definition: columnsDefinition,\n },\n singleColumn: {\n component: Components.SingleColumn,\n definition: singleColumnDefinition,\n },\n button: enrichComponentDefinition({\n component: Components.Button,\n definition: Components.ButtonComponentDefinition,\n options: {\n wrapComponent: false,\n },\n }),\n heading: enrichComponentDefinition({\n component: Components.Heading,\n definition: Components.HeadingComponentDefinition,\n options: {\n wrapComponent: false,\n },\n }),\n image: enrichComponentDefinition({\n component: Components.Image,\n definition: Components.ImageComponentDefinition,\n }),\n richText: enrichComponentDefinition({\n component: Components.RichText,\n definition: Components.RichTextComponentDefinition,\n options: {\n wrapComponent: false,\n },\n }),\n text: enrichComponentDefinition({\n component: Components.Text,\n definition: Components.TextComponentDefinition,\n options: {\n wrapComponent: false,\n },\n }),\n} satisfies Record<string, ComponentRegistration>;\n\n// pre-filling with the default component registrations\nexport const componentRegistry = new Map<string, ComponentRegistration>([\n [DEFAULT_COMPONENT_REGISTRATIONS.section.definition.id, DEFAULT_COMPONENT_REGISTRATIONS.section],\n [\n DEFAULT_COMPONENT_REGISTRATIONS.container.definition.id,\n DEFAULT_COMPONENT_REGISTRATIONS.container,\n ],\n [\n DEFAULT_COMPONENT_REGISTRATIONS.singleColumn.definition.id,\n DEFAULT_COMPONENT_REGISTRATIONS.singleColumn,\n ],\n [DEFAULT_COMPONENT_REGISTRATIONS.columns.definition.id, DEFAULT_COMPONENT_REGISTRATIONS.columns],\n [DEFAULT_COMPONENT_REGISTRATIONS.button.definition.id, DEFAULT_COMPONENT_REGISTRATIONS.button],\n [DEFAULT_COMPONENT_REGISTRATIONS.heading.definition.id, DEFAULT_COMPONENT_REGISTRATIONS.heading],\n [DEFAULT_COMPONENT_REGISTRATIONS.image.definition.id, DEFAULT_COMPONENT_REGISTRATIONS.image],\n [\n DEFAULT_COMPONENT_REGISTRATIONS.richText.definition.id,\n DEFAULT_COMPONENT_REGISTRATIONS.richText,\n ],\n [DEFAULT_COMPONENT_REGISTRATIONS.text.definition.id, DEFAULT_COMPONENT_REGISTRATIONS.text],\n]);\n\nexport const optionalBuiltInComponents = [\n DEFAULT_COMPONENT_REGISTRATIONS.button.definition.id,\n DEFAULT_COMPONENT_REGISTRATIONS.heading.definition.id,\n DEFAULT_COMPONENT_REGISTRATIONS.image.definition.id,\n DEFAULT_COMPONENT_REGISTRATIONS.richText.definition.id,\n DEFAULT_COMPONENT_REGISTRATIONS.text.definition.id,\n];\n\nexport const sendRegisteredComponentsMessage = () => {\n // Send the definitions (without components) via the connection message to the experience builder\n const registeredDefinitions = Array.from(componentRegistry.values());\n\n sendMessage(OUTGOING_EVENTS.RegisteredComponents, {\n definitions: registeredDefinitions,\n });\n};\n\nexport const sendConnectedEventWithRegisteredComponents = () => {\n // Send the definitions (without components) via the connection message to the experience builder\n const registeredDefinitions = Array.from(componentRegistry.values()).map(\n ({ definition }) => definition,\n );\n\n sendMessage(OUTGOING_EVENTS.Connected, {\n sdkVersion: SDK_VERSION,\n definitions: registeredDefinitions,\n });\n\n sendMessage(OUTGOING_EVENTS.DesignTokens, {\n designTokens: designTokensRegistry,\n });\n};\n\n/**\n * Registers multiple components and their component definitions at once\n * @param componentRegistrations - ComponentRegistration[]\n * @returns void\n */\nexport const defineComponents = (\n componentRegistrations: ComponentRegistration[],\n options?: ComponentRegistrationOptions,\n) => {\n if (options?.enabledBuiltInComponents) {\n for (const id of optionalBuiltInComponents) {\n if (!options.enabledBuiltInComponents.includes(id)) {\n componentRegistry.delete(id);\n }\n }\n }\n\n for (const registration of componentRegistrations) {\n // Fill definitions with fallbacks values\n const enrichedComponentRegistration = enrichComponentDefinition(registration);\n componentRegistry.set(\n enrichedComponentRegistration.definition.id,\n enrichedComponentRegistration,\n );\n }\n\n if (typeof window !== 'undefined') {\n window.dispatchEvent(new CustomEvent(INTERNAL_EVENTS.ComponentsRegistered));\n }\n};\n\n/**\n * use this function only in tests\n */\nexport const resetComponentRegistry = () => {\n componentRegistry.clear();\n for (const registration of Object.values(DEFAULT_COMPONENT_REGISTRATIONS)) {\n componentRegistry.set(registration.definition.id, registration);\n }\n};\n\nexport const getComponentRegistration = (id: string) => componentRegistry.get(id);\n\nexport const addComponentRegistration = (componentRegistration: ComponentRegistration) => {\n componentRegistry.set(componentRegistration.definition.id, componentRegistration);\n};\n\nexport const createAssemblyRegistration = ({\n definitionId,\n definitionName,\n component,\n}: {\n definitionId: string;\n definitionName?: string;\n component: ComponentRegistration['component'];\n}) => {\n const componentRegistration = componentRegistry.get(definitionId);\n\n if (componentRegistration) {\n return componentRegistration;\n }\n\n const definition = {\n id: definitionId,\n name: definitionName || 'Component',\n variables: {} as ComponentDefinition['variables'],\n children: true,\n category: ASSEMBLY_DEFAULT_CATEGORY,\n };\n\n addComponentRegistration({ component, definition });\n\n return componentRegistry.get(definitionId);\n};\n","import { useEffect, useState } from 'react';\n\nimport { buildStyleTag } from '@contentful/experiences-core';\nimport type { CSSProperties } from '@contentful/experiences-core/types';\n\n/**\n *\n * @param styles: the list of styles to apply\n * @param nodeId: [Optional] the id of node that these styles will be applied to\n * @returns className: the className that was used\n * Builds and adds a style tag in the document. Returns the className to be attached to the element.\n * In editor mode the nodeId is used as the identifier in order to avoid creating endless tags as the styles are tweeked\n * In preview/delivery mode the styles don't change oftem so we're using the md5 hash of the content of the tag\n */\nexport const useStyleTag = ({ styles, nodeId }: { styles: CSSProperties; nodeId?: string }) => {\n const [className, setClassName] = useState('');\n\n useEffect(() => {\n if (Object.keys(styles).length === 0) {\n return;\n }\n\n const [className, styleRule] = buildStyleTag({ styles, nodeId });\n\n setClassName(className);\n\n const existingTag = document.querySelector(`[data-cf-styles=\"${className}\"]`);\n\n if (existingTag) {\n // editor mode - update existing\n if (nodeId) {\n existingTag.innerHTML = styleRule;\n }\n // preview/delivery mode - here we don't need to update the existing tag because\n // the className is based on the md5 hash of the content so it hasn't changed\n return;\n }\n\n const styleTag = document.createElement('style');\n styleTag.dataset['cfStyles'] = className;\n\n document.head.appendChild(styleTag).innerHTML = styleRule;\n }, [styles, nodeId]);\n\n return { className };\n};\n","import { checkIsAssemblyNode, EntityStore } from '@contentful/experiences-core';\nimport type {\n CompositionComponentPropValue,\n CompositionNode,\n} from '@contentful/experiences-core/types';\n\nexport const deserializeAssemblyNode = ({\n node,\n componentInstanceVariables,\n}: {\n node: CompositionNode;\n componentInstanceVariables: CompositionNode['variables'];\n}): CompositionNode => {\n const variables: Record<string, CompositionComponentPropValue> = {};\n\n for (const [variableName, variable] of Object.entries(node.variables)) {\n variables[variableName] = variable;\n if (variable.type === 'ComponentValue') {\n const componentValueKey = variable.key;\n const instanceProperty = componentInstanceVariables[componentValueKey];\n\n // For assembly, we look up the variable in the assembly instance and\n // replace the componentValue with that one.\n if (instanceProperty?.type === 'UnboundValue') {\n variables[variableName] = {\n type: 'UnboundValue',\n key: instanceProperty.key,\n };\n } else if (instanceProperty?.type === 'BoundValue') {\n variables[variableName] = {\n type: 'BoundValue',\n path: instanceProperty.path,\n };\n }\n }\n }\n\n const children: CompositionNode[] = node.children.map((child) =>\n deserializeAssemblyNode({\n node: child,\n componentInstanceVariables,\n }),\n );\n\n return {\n definitionId: node.definitionId,\n variables,\n children,\n };\n};\n\nexport const resolveAssembly = ({\n node,\n entityStore,\n}: {\n node: CompositionNode;\n entityStore: EntityStore;\n}) => {\n const isAssembly = checkIsAssemblyNode({\n componentId: node.definitionId,\n usedComponents: entityStore.usedComponents,\n });\n\n if (!isAssembly) {\n return node;\n }\n\n const componentId = node.definitionId as string;\n const assembly = entityStore.experienceEntryFields?.usedComponents?.find(\n (component) => component.sys.id === componentId,\n );\n\n if (!assembly || !('fields' in assembly)) {\n return node;\n }\n\n const componentFields = assembly.fields;\n\n const deserializedNode = deserializeAssemblyNode({\n node: {\n definitionId: node.definitionId,\n variables: {},\n children: componentFields.componentTree.children,\n },\n componentInstanceVariables: node.variables,\n });\n\n entityStore.addAssemblyUnboundValues(componentFields.unboundValues);\n\n return deserializedNode;\n};\n","import React from 'react';\n\nconst assemblyStyle = { display: 'contents' };\n\n// Feel free to do any magic as regards variable definitions for assemblies\n// Or if this isn't necessary by the time we figure that part out, we can bid this part farewell\nexport const Assembly = ({ ...props }) => {\n // Using a display contents so assembly content/children\n // can appear as if they are direct children of the div wrapper's parent\n return <div data-test-id=\"assembly\" {...props} style={assemblyStyle} />;\n};\n","import React, { useMemo } from 'react';\nimport type { UnresolvedLink } from 'contentful';\nimport { omit } from 'lodash-es';\nimport {\n EntityStore,\n isEmptyStructureWithRelativeHeight,\n isDeepPath,\n} from '@contentful/experiences-core';\nimport {\n CF_STYLE_ATTRIBUTES,\n CONTENTFUL_COMPONENTS,\n EMPTY_CONTAINER_HEIGHT,\n} from '@contentful/experiences-core/constants';\nimport type {\n CompositionNode,\n CompositionVariableValueType,\n ResolveDesignValueType,\n StyleProps,\n} from '@contentful/experiences-core/types';\nimport { createAssemblyRegistration, getComponentRegistration } from '../../core/componentRegistry';\nimport {\n buildCfStyles,\n checkIsAssemblyNode,\n transformContentValue,\n} from '@contentful/experiences-core';\nimport { useStyleTag } from '../../hooks/useStyleTag';\nimport {\n Columns,\n ContentfulContainer,\n SingleColumn,\n} from '@contentful/experiences-components-react';\n\nimport { resolveAssembly } from '../../core/preview/assemblyUtils';\nimport { Assembly } from '../../components/Assembly';\n\ntype CompositionBlockProps = {\n node: CompositionNode;\n locale: string;\n entityStore: EntityStore;\n resolveDesignValue: ResolveDesignValueType;\n};\n\nexport const CompositionBlock = ({\n node: rawNode,\n locale,\n entityStore,\n resolveDesignValue,\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 }\n\n const propMap: Record<string, CompositionVariableValueType> = {};\n\n return Object.entries(node.variables).reduce((acc, [variableName, variable]) => {\n switch (variable.type) {\n case 'DesignValue':\n acc[variableName] = resolveDesignValue(variable.valuesByBreakpoint, variableName);\n break;\n case 'BoundValue': {\n const variableDefinition = componentRegistration.definition.variables[variableName];\n if (isDeepPath(variable.path)) {\n const [, uuid] = variable.path.split('/');\n const link = entityStore.dataSource[uuid] as UnresolvedLink<'Entry' | 'Asset'>;\n const boundValue = entityStore.getValueDeep(link, variable.path);\n const value = boundValue || variableDefinition.defaultValue;\n acc[variableName] = transformContentValue(value, variableDefinition);\n break;\n }\n const [, uuid, ...path] = variable.path.split('/');\n const binding = entityStore.dataSource[uuid] as UnresolvedLink<'Entry' | 'Asset'>;\n let value = entityStore.getValue(binding, path.slice(0, -1));\n if (!value) {\n const foundAssetValue = entityStore.getValue(binding, [\n ...path.slice(0, -2),\n 'fields',\n 'file',\n ]);\n if (foundAssetValue) {\n value = foundAssetValue;\n }\n }\n acc[variableName] = transformContentValue(value, variableDefinition);\n break;\n }\n case 'UnboundValue': {\n const uuid = variable.key;\n acc[variableName] = entityStore.unboundValues[uuid]?.value;\n break;\n }\n default:\n break;\n }\n return acc;\n }, propMap);\n }, [componentRegistration, isAssembly, node.variables, resolveDesignValue, entityStore]);\n\n const cfStyles = buildCfStyles(nodeProps);\n\n if (\n isEmptyStructureWithRelativeHeight(node.children.length, node.definitionId, cfStyles.height)\n ) {\n cfStyles.minHeight = EMPTY_CONTAINER_HEIGHT;\n }\n\n const { className } = useStyleTag({ styles: cfStyles });\n\n if (!componentRegistration) {\n return null;\n }\n\n const { component } = componentRegistration;\n\n const children =\n componentRegistration.definition.children === true\n ? node.children.map((childNode: CompositionNode, index) => {\n return (\n <CompositionBlock\n node={childNode}\n key={index}\n locale={locale}\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 return React.createElement(\n component,\n {\n ...omit(nodeProps, CF_STYLE_ATTRIBUTES, ['cfHyperlink', 'cfOpenInNewTab']),\n className,\n },\n children,\n );\n};\n","import type {\n ValuesByBreakpoint,\n Breakpoint,\n CompositionVariableValueType,\n ResolveDesignValueType,\n} from '@contentful/experiences-core/types';\nimport {\n mediaQueryMatcher,\n getFallbackBreakpointIndex,\n getActiveBreakpointIndex,\n getValueForBreakpoint,\n} from '@contentful/experiences-core';\nimport { useCallback, useEffect, useState } from 'react';\n\n// TODO: In order to support integrations without React, we should extract this heavy logic into simple\n// functions that we can reuse in other frameworks.\n\n/*\n * Registers media query change listeners for each breakpoint (except for \"*\").\n * It will always assume the last matching media query in the list. It therefore,\n * assumes that the breakpoints are sorted beginning with the default value (query: \"*\")\n * and then decending by screen width. For mobile-first designs, the order would be ascending\n */\nexport const useBreakpoints = (breakpoints: Breakpoint[]) => {\n const [mediaQueryMatchers, initialMediaQueryMatches] = mediaQueryMatcher(breakpoints);\n\n const [mediaQueryMatches, setMediaQueryMatches] =\n useState<Record<string, boolean>>(initialMediaQueryMatches);\n\n const fallbackBreakpointIndex = getFallbackBreakpointIndex(breakpoints);\n\n // Register event listeners to update the media query states\n useEffect(() => {\n const eventListeners = mediaQueryMatchers.map(({ id, signal }) => {\n const onChange = () =>\n setMediaQueryMatches((prev) => ({\n ...prev,\n [id]: signal.matches,\n }));\n signal.addEventListener('change', onChange);\n return onChange;\n });\n\n return () => {\n eventListeners.forEach((eventListener, index) => {\n mediaQueryMatchers[index].signal.removeEventListener('change', eventListener);\n });\n };\n }, [mediaQueryMatchers]);\n\n const activeBreakpointIndex = getActiveBreakpointIndex(\n breakpoints,\n mediaQueryMatches,\n fallbackBreakpointIndex,\n );\n\n const resolveDesignValue: ResolveDesignValueType = useCallback(\n (\n valuesByBreakpoint: ValuesByBreakpoint,\n variableName: string,\n ): CompositionVariableValueType => {\n return getValueForBreakpoint(\n valuesByBreakpoint,\n breakpoints,\n activeBreakpointIndex,\n variableName,\n );\n },\n [activeBreakpointIndex, breakpoints],\n );\n\n return { resolveDesignValue };\n};\n","import { useEffect, useState } from 'react';\nimport { EntityStore } from '@contentful/experiences-core';\nimport type { Experience } from '@contentful/experiences-core/types';\n\nexport const useFetchByBase = (\n fetchMethod: () => Promise<Experience<EntityStore> | undefined>,\n isEditorMode: boolean,\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 mode, we don't want to fetch the experience here\n // it is passed via postMessage instead\n if (isEditorMode) {\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, isEditorMode]);\n\n return {\n error,\n experience,\n isLoading,\n isEditorMode,\n };\n};\n","import { useEffect, useRef, useState } from 'react';\nimport {\n doesMismatchMessageSchema,\n sendMessage,\n tryParseMessage,\n} from '@contentful/experiences-core';\nimport { INCOMING_EVENTS, OUTGOING_EVENTS } from '@contentful/experiences-core/constants';\n\ntype UseDetectEditorModeArgs = {\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 useDetectEditorMode = ({ isClientSide = false }: UseDetectEditorModeArgs = {}) => {\n const [mounted, setMounted] = useState(false);\n const [isEditorMode, setIsEditorMode] = useState(isClientSide ? inIframe() : false);\n const receivedMessage = useRef(false);\n\n useEffect(() => {\n const onMessage = (event: MessageEvent) => {\n if (doesMismatchMessageSchema(event)) {\n return;\n }\n const eventData = tryParseMessage(event);\n\n if (eventData.eventType === INCOMING_EVENTS.RequestEditorMode) {\n setIsEditorMode(true);\n receivedMessage.current = true;\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 window.__EB__.isEditorMode = true;\n window.removeEventListener('message', onMessage);\n }\n }\n };\n\n //Only run check after component is mounted on the client to avoid hydration ssr issues\n if (mounted) {\n setIsEditorMode(inIframe());\n //Double check if we are in editor mode by listening to postMessage events\n if (typeof window !== 'undefined' && !window.__EB__?.isEditorMode) {\n window.addEventListener('message', onMessage);\n sendMessage(OUTGOING_EVENTS.Connected);\n\n setTimeout(() => {\n if (!receivedMessage.current) {\n // if message is not received back in time, set editorMode back to false\n setIsEditorMode(false);\n }\n }, 100);\n }\n } else {\n setMounted(true);\n }\n\n return () => window.removeEventListener('message', onMessage);\n }, [mounted]);\n\n return isEditorMode;\n};\n\nfunction inIframe() {\n try {\n return window.self !== window.top;\n } catch (e) {\n return false;\n }\n}\n","import { useCallback } from 'react';\nimport type { ContentfulClientApi } from 'contentful';\nimport { useFetchByBase } from './useFetchByBase';\nimport { fetchById } from '@contentful/experiences-core';\nimport { useDetectEditorMode } from './useDetectEditorMode';\n\nexport type UseFetchByIdArgs = {\n client: ContentfulClientApi<undefined>;\n id: string;\n experienceTypeId: string;\n localeCode: string;\n};\n\nexport const useFetchById = ({ id, localeCode, client, experienceTypeId }: UseFetchByIdArgs) => {\n const isEditorMode = useDetectEditorMode({ isClientSide: typeof window !== 'undefined' });\n\n const fetchMethod = useCallback(() => {\n return fetchById({ id, localeCode, client, experienceTypeId });\n }, [id, localeCode, client, experienceTypeId]);\n\n return useFetchByBase(fetchMethod, isEditorMode);\n};\n","import { useCallback } from 'react';\nimport type { ContentfulClientApi } from 'contentful';\nimport { useFetchByBase } from './useFetchByBase';\nimport { fetchBySlug } from '@contentful/experiences-core';\nimport { useDetectEditorMode } from './useDetectEditorMode';\n\nexport type UseFetchBySlugArgs = {\n client: ContentfulClientApi<undefined>;\n slug: string;\n experienceTypeId: string;\n localeCode: string;\n};\n\nexport const useFetchBySlug = ({\n slug,\n localeCode,\n client,\n experienceTypeId,\n}: UseFetchBySlugArgs) => {\n const isEditorMode = useDetectEditorMode({ isClientSide: typeof window !== 'undefined' });\n\n const fetchMethod = useCallback(() => {\n return fetchBySlug({ slug, localeCode, client, experienceTypeId });\n }, [slug, localeCode, client, experienceTypeId]);\n\n return useFetchByBase(fetchMethod, isEditorMode);\n};\n","import React from 'react';\nimport { EntityStore } from '@contentful/experiences-core';\nimport type { Experience } from '@contentful/experiences-core/types';\nimport { CompositionBlock } from './CompositionBlock';\nimport { compatibleVersions } from '../../constants';\nimport { useBreakpoints } from '../../hooks';\n\ntype DeliveryRootProps = {\n experience: Experience<EntityStore>;\n locale: string;\n};\n\nexport const PreviewDeliveryRoot = ({ locale, experience }: DeliveryRootProps) => {\n const { entityStore } = experience;\n\n const { resolveDesignValue } = useBreakpoints(entityStore?.breakpoints ?? []);\n\n if (!entityStore?.experienceEntryFields || !entityStore?.schemaVersion) {\n return null;\n }\n\n if (!compatibleVersions.includes(entityStore.schemaVersion)) {\n console.warn(\n `[experiences-sdk-react] Contentful composition schema version: ${entityStore.schemaVersion} does not match the compatible schema versions: ${compatibleVersions}. Aborting.`,\n );\n return null;\n }\n\n return (\n <>\n {entityStore.experienceEntryFields.componentTree.children.map((childNode, index) => (\n <CompositionBlock\n key={index}\n node={childNode}\n locale={locale}\n entityStore={entityStore}\n resolveDesignValue={resolveDesignValue}\n />\n ))}\n </>\n );\n};\n","import React, { ErrorInfo, ReactElement } from 'react';\nimport { sendMessage } from '@contentful/experiences-core';\nimport '../styles/ErrorBoundary.css';\nimport { OUTGOING_EVENTS } from '@contentful/experiences-core/constants';\n\nclass ImportedComponentError extends Error {}\n\nexport class ErrorBoundary extends React.Component<\n { children: ReactElement },\n { hasError: boolean; error: Error | null; errorInfo: ErrorInfo | null; showErrorDetails: boolean }\n> {\n constructor(props: { children: ReactElement }) {\n super(props);\n this.state = { hasError: false, error: null, errorInfo: null, showErrorDetails: false };\n }\n\n static getDerivedStateFromError() {\n return { hasError: true };\n }\n\n componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n this.setState({ error, errorInfo });\n if (!(error instanceof ImportedComponentError)) {\n sendMessage(OUTGOING_EVENTS.CanvasError, error);\n } else {\n throw error;\n }\n }\n\n render() {\n if (this.state.hasError) {\n return (\n <div className=\"cf-error-message\">\n <h2 className=\"title\">{`Something went wrong while rendering the experience`}</h2>\n <div>\n The Experience Builder SDK has encountered an error. It may be that the SDK has not been\n set up properly or an imported component has thrown this error. Try to refresh the page\n and find more guidance in our{' '}\n <a\n href=\"https://www.contentful.com/developers/docs/tutorials/general/experience-builder/\"\n rel=\"noreferrer\"\n target=\"_blank\">\n documentation\n </a>\n .\n </div>\n <br />\n <span\n className=\"more-details\"\n onClick={() =>\n this.setState((prevState) => ({\n showErrorDetails: !prevState.showErrorDetails,\n }))\n }>\n {this.state.showErrorDetails ? 'Hide' : 'See'} details\n </span>\n {this.state.showErrorDetails && (\n <code>\n {this.state.error?.stack?.split('\\n').map((i, key) => {\n return <div key={key}>{i}</div>;\n })}\n </code>\n )}\n </div>\n );\n }\n return this.props.children;\n }\n}\n\nexport class ImportedComponentErrorBoundary extends React.Component<{ children: ReactElement }> {\n componentDidCatch(error: Error, _errorInfo: ErrorInfo) {\n const err = new ImportedComponentError(error.message);\n err.stack = error.stack;\n throw err;\n }\n\n render() {\n return this.props.children;\n }\n}\n","import { useEffect, useRef, useState } from 'react';\nimport { EntityStore } from '@contentful/experiences-core';\nimport {\n componentRegistry,\n sendConnectedEventWithRegisteredComponents,\n sendRegisteredComponentsMessage,\n} from '../core/componentRegistry';\nimport { INTERNAL_EVENTS, VISUAL_EDITOR_EVENTS } from '@contentful/experiences-core/constants';\nimport { designTokensRegistry } from '@contentful/experiences-core';\n\ntype InitializeVisualEditorParams = {\n initialLocale: string;\n initialEntities?: EntityStore['entities'];\n};\n\nexport const useInitializeVisualEditor = (params: InitializeVisualEditorParams) => {\n const { initialLocale, initialEntities } = params;\n const [locale, setLocale] = useState<string>(initialLocale);\n\n const hasConnectEventBeenSent = useRef(false);\n\n // sends component definitions to the web app\n // InternalEvents.COMPONENTS_REGISTERED is triggered by defineComponents function\n useEffect(() => {\n if (!hasConnectEventBeenSent.current) {\n // sending CONNECT but with the registered components now\n sendConnectedEventWithRegisteredComponents();\n hasConnectEventBeenSent.current = true;\n }\n\n const onComponentsRegistered = () => {\n sendRegisteredComponentsMessage();\n };\n\n if (typeof window !== 'undefined') {\n window.addEventListener(INTERNAL_EVENTS.ComponentsRegistered, onComponentsRegistered);\n }\n\n return () => {\n if (typeof window !== 'undefined') {\n window.removeEventListener(INTERNAL_EVENTS.ComponentsRegistered, onComponentsRegistered);\n }\n };\n }, []);\n\n useEffect(() => {\n setLocale(initialLocale);\n }, [initialLocale]);\n\n useEffect(() => {\n const onVisualEditorReady = () => {\n window.dispatchEvent(\n new CustomEvent(INTERNAL_EVENTS.VisualEditorInitialize, {\n detail: {\n componentRegistry,\n designTokens: designTokensRegistry,\n locale,\n entities: initialEntities ?? [],\n },\n }),\n );\n };\n\n window.addEventListener(VISUAL_EDITOR_EVENTS.Ready, onVisualEditorReady);\n return () => {\n window.removeEventListener(VISUAL_EDITOR_EVENTS.Ready, onVisualEditorReady);\n };\n }, [locale, initialEntities]);\n};\n","import React, { Suspense } from 'react';\nimport { EntityStore, VisualEditorMode } from '@contentful/experiences-core';\nimport { ErrorBoundary } from '../../components/ErrorBoundary';\nimport { useInitializeVisualEditor } from '../../hooks/useInitializeVisualEditor';\n\nconst VisualEditorLoader = React.lazy(() => import('./VisualEditorLoader'));\n\ntype VisualEditorRootProps = {\n visualEditorMode: VisualEditorMode;\n initialEntities: EntityStore['entities'];\n initialLocale: string;\n};\n\nexport const VisualEditorRoot: React.FC<VisualEditorRootProps> = ({\n visualEditorMode,\n initialEntities,\n initialLocale,\n}) => {\n useInitializeVisualEditor({\n initialLocale,\n initialEntities,\n });\n\n return (\n <ErrorBoundary>\n <Suspense fallback={<div>Loading...</div>}>\n <VisualEditorLoader visualEditorMode={visualEditorMode} />\n </Suspense>\n </ErrorBoundary>\n );\n};\n\nexport default VisualEditorRoot;\n","import React from 'react';\nimport { VisualEditorMode, validateExperienceBuilderConfig } from '@contentful/experiences-core';\nimport { EntityStore } from '@contentful/experiences-core';\nimport type { Experience } from '@contentful/experiences-core/types';\nimport { PreviewDeliveryRoot } from './blocks/preview/PreviewDeliveryRoot';\nimport VisualEditorRoot from './blocks/editor/VisualEditorRoot';\nimport { useDetectEditorMode } from './hooks/useDetectEditorMode';\n\ntype ExperienceRootProps = {\n experience?: Experience<EntityStore>;\n locale: string;\n visualEditorMode?: VisualEditorMode;\n};\n\nexport const ExperienceRoot = ({\n locale,\n experience,\n visualEditorMode = VisualEditorMode.LazyLoad,\n}: ExperienceRootProps) => {\n const isEditorMode = useDetectEditorMode();\n\n validateExperienceBuilderConfig({\n locale,\n isEditorMode,\n });\n\n if (isEditorMode) {\n const entityStore = experience?.entityStore;\n return (\n <VisualEditorRoot\n visualEditorMode={visualEditorMode}\n initialEntities={entityStore?.entities || []}\n initialLocale={locale}\n />\n );\n }\n\n if (!experience) return null;\n\n return <PreviewDeliveryRoot locale={locale} experience={experience} />;\n};\n","import { SDK_VERSION } from './sdkVersion';\n\nexport { ExperienceRoot } from './ExperienceRoot';\nexport { useFetchById, useFetchBySlug } from './hooks';\nexport { defineComponents } from './core/componentRegistry';\nexport {\n calculateNodeDefaultHeight,\n /** @deprecated use `checkIsAssemblyNode` instead. Will be removed with SDK v5. */\n checkIsAssembly,\n checkIsAssemblyNode,\n checkIsAssemblyEntry,\n defineDesignTokens,\n supportedModes,\n VisualEditorMode,\n fetchById,\n fetchBySlug,\n createExperience,\n} from '@contentful/experiences-core';\nexport {\n CONTENTFUL_COMPONENTS,\n OUTGOING_EVENTS,\n INCOMING_EVENTS,\n CONTENTFUL_COMPONENT_CATEGORY,\n LATEST_SCHEMA_VERSION,\n CF_STYLE_ATTRIBUTES,\n ASSEMBLY_BLOCK_NODE_TYPE,\n ASSEMBLY_NODE_TYPE,\n ASSEMBLY_NODE_TYPES,\n SCROLL_STATES,\n} from '@contentful/experiences-core/constants';\n\n// Simple state store to store a few things that are needed across the SDK\nif (typeof window !== 'undefined') {\n window.__EB__ = {\n sdkVersion: SDK_VERSION,\n };\n}\n\nexport type {\n InternalSDKMode,\n ExternalSDKMode,\n ComponentDefinition,\n} from '@contentful/experiences-core/types';\nexport { EntityStore } from '@contentful/experiences-core';\n"],"names":["_jsx","builtInStyleDefinitions","_jsxs"],"mappings":";;;;;;;;;;;AAAO,MAAM,WAAW,GAAG,eAAe;;AC6B1C;;;;;;AAMG;AACa,SAAA,oBAAoB,CAClC,SAA+B,EAC/B,OAA4C,GAAA;AAC1C,IAAA,aAAa,EAAE,IAAI;AACnB,IAAA,gBAAgB,EAAE,KAAK;AACxB,CAAA,EAAA;AAED,IAAA,MAAM,OAAO,GAAG,CAAC,EACf,OAAO,GAAG,EAAE,EACZ,SAAS,GAAG,EAAE,EACd,iBAAiB,EAAE,YAAY,EAC/B,uBAAuB,EAAE,iBAAiB,EAC1C,yBAAyB,EAAE,mBAAmB,EAC9C,OAAO,EACP,WAAW,EACX,SAAS,EACT,GAAG,KAAK,EACI,KAAI;AAChB,QAAA,MA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AAkB,IAAC,gBAAgB,EAAE,gBAAgB,EAAI,CAAA,EAAA,CACjD,EACG,CAAA,EAChB;AACJ,CAAC;;AChBY,MAAA,cAAc,GAAG,CAAC,EAC7B,MAAM,EACN,UAAU,EACV,gBAAgB,GAAG,gBAAgB,CAAC,QAAQ,GACxB,KAAI;AACxB,IAAA,MAAM,YAAY,GAAG,mBAAmB,EAAE,CAAC;AAE3C,IAAA,+BAA+B,CAAC;QAC9B,MAAM;QACN,YAAY;AACb,KAAA,CAAC,CAAC;IAEH,IAAI,YAAY,EAAE;AAChB,QAAA,MAAM,WAAW,GAAG,UAAU,EAAE,WAAW,CAAC;QAC5C,QACEA,IAAC,gBAAgB,EAAA,EACf,gBAAgB,EAAE,gBAAgB,EAClC,eAAe,EAAE,WAAW,EAAE,QAAQ,IAAI,EAAE,EAC5C,aAAa,EAAE,MAAM,EACrB,CAAA,EACF;KACH;AAED,IAAA,IAAI,CAAC,UAAU;AAAE,QAAA,OAAO,IAAI,CAAC;IAE7B,OAAOA,GAAA,CAAC,mBAAmB,EAAA,EAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAA,CAAI,CAAC;AACzE;;ACTA;AACA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IACjC,MAAM,CAAC,MAAM,GAAG;AACd,QAAA,UAAU,EAAE,WAAW;KACxB,CAAC;AACJ;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/sdkVersion.ts","../../src/utils/withComponentWrapper.tsx","../../src/constants.ts","../../src/core/componentRegistry.ts","../../src/hooks/useStyleTag.ts","../../src/core/preview/assemblyUtils.ts","../../src/components/Assembly.tsx","../../src/blocks/preview/CompositionBlock.tsx","../../src/hooks/useBreakpoints.ts","../../src/hooks/useFetchByBase.ts","../../src/hooks/useDetectEditorMode.tsx","../../src/hooks/useFetchById.ts","../../src/hooks/useFetchBySlug.ts","../../src/blocks/preview/PreviewDeliveryRoot.tsx","../../src/components/ErrorBoundary.tsx","../../src/hooks/useInitializeVisualEditor.ts","../../src/blocks/editor/VisualEditorRoot.tsx","../../src/ExperienceRoot.tsx","../../src/index.ts"],"sourcesContent":["export const SDK_VERSION = '0.0.1-alpha.3';\n","import { ComponentRegistration } from '@contentful/experiences-core/types';\nimport React from 'react';\n\ninterface CFProps {\n /**\n * Classes to be applied to the container component if `wrapComponent` is true, or directly to the child component if false.\n */\n className?: string;\n /**\n * Classes to be applied to the child component if `wrapComponent` is true, or directly to the child component if false.\n */\n classes?: string;\n onMouseDown?: React.MouseEventHandler;\n onMouseUp?: React.MouseEventHandler;\n onClick?: React.MouseEventHandler;\n /**\n * Prop required by Experience Builder to identify the component.\n */\n 'data-cf-node-id'?: string;\n /**\n * Prop required by Experience Builder to identify the component.\n */\n 'data-cf-node-block-id'?: string;\n /**\n * Prop required by Experience Builder to identify the component's type.\n */\n 'data-cf-node-block-type'?: string;\n}\n\n/**\n * Sets up a component to be consumed by Experience Builder. This function can be used to wrap a component with a container component, or to pass props to the component directly.\n * @param Component Component to be used by Experience Builder.\n * @param options Options for the `withComponentWrapper` function.\n * @default { wrapComponent: true, wrapContainerTag: 'div' }\n * @returns A component that can be passed to `defineComponents`.\n */\nexport function withComponentWrapper<T extends object>(\n Component: React.ElementType<T>,\n options: ComponentRegistration['options'] = {\n wrapComponent: true,\n wrapContainerTag: 'div',\n },\n) {\n const Wrapped = ({\n classes = '',\n className = '',\n 'data-cf-node-id': dataCfNodeId,\n 'data-cf-node-block-id': dataCfNodeBlockId,\n 'data-cf-node-block-type': dataCfNodeBlockType,\n onClick,\n onMouseDown,\n onMouseUp,\n ...props\n }: CFProps & T) => {\n const Tag = options.wrapContainerTag || 'div';\n const cfProps = {\n 'data-cf-node-id': dataCfNodeId,\n 'data-cf-node-block-id': dataCfNodeBlockId,\n 'data-cf-node-block-type': dataCfNodeBlockType,\n onClick,\n onMouseDown,\n onMouseUp,\n };\n\n const component = options.wrapComponent ? (\n <Tag className={className} {...cfProps}>\n {typeof Component === 'string' ? (\n React.createElement(Component, { className: classes, ...props })\n ) : (\n <Component className={classes} {...(props as T)} />\n )}\n </Tag>\n ) : (\n React.createElement(Component, {\n className: classes + className ? classes + ' ' + className : undefined,\n ...cfProps,\n ...(props as T),\n })\n );\n return component;\n };\n\n return Wrapped;\n}\n","import type { SchemaVersions } from '@contentful/experiences-core/types';\n\n// this is the array of version which currently LATEST_SCHEMA_VERSION is compatible with\nexport const compatibleVersions: SchemaVersions[] = ['2023-08-23', '2023-09-28'];\n\nexport { SDK_VERSION } from './sdkVersion';\n","import * as Components from '@contentful/experiences-components-react';\nimport type {\n ComponentRegistration,\n ComponentDefinition,\n ComponentRegistrationOptions,\n} from '@contentful/experiences-core/types';\nimport {\n OUTGOING_EVENTS,\n INTERNAL_EVENTS,\n CONTENTFUL_COMPONENTS,\n ASSEMBLY_DEFAULT_CATEGORY,\n} from '@contentful/experiences-core/constants';\nimport {\n builtInStyles as builtInStyleDefinitions,\n designTokensRegistry,\n optionalBuiltInStyles,\n sendMessage,\n containerDefinition,\n sectionDefinition,\n columnsDefinition,\n singleColumnDefinition,\n} from '@contentful/experiences-core';\nimport { withComponentWrapper } from '../utils/withComponentWrapper';\nimport { SDK_VERSION } from '../constants';\n\nconst cloneObject = <T>(targetObject: T): T => {\n if (typeof structuredClone !== 'undefined') {\n return structuredClone(targetObject);\n }\n\n return JSON.parse(JSON.stringify(targetObject));\n};\n\nconst applyComponentDefinitionFallbacks = (componentDefinition: ComponentDefinition) => {\n const clone = cloneObject(componentDefinition);\n for (const variable of Object.values(clone.variables)) {\n variable.group = variable.group ?? 'content';\n }\n return clone;\n};\n\nconst applyBuiltInStyleDefinitions = (componentDefinition: ComponentDefinition) => {\n if ([CONTENTFUL_COMPONENTS.container.id].includes(componentDefinition.id)) {\n return componentDefinition;\n }\n\n const clone = cloneObject(componentDefinition);\n\n // set margin built-in style by default\n if (!clone.builtInStyles) {\n clone.builtInStyles = ['cfMargin'];\n }\n\n for (const style of Object.values(clone.builtInStyles || [])) {\n if (builtInStyleDefinitions[style]) {\n clone.variables[style] = builtInStyleDefinitions[style];\n }\n if (optionalBuiltInStyles[style]) {\n clone.variables[style] = optionalBuiltInStyles[style];\n }\n }\n return clone;\n};\n\nexport const enrichComponentDefinition = ({\n component,\n definition,\n options,\n}: ComponentRegistration): ComponentRegistration => {\n const definitionWithFallbacks = applyComponentDefinitionFallbacks(definition);\n const definitionWithBuiltInStyles = applyBuiltInStyleDefinitions(definitionWithFallbacks);\n return {\n component: withComponentWrapper(component, options),\n definition: definitionWithBuiltInStyles,\n };\n};\n\nconst DEFAULT_COMPONENT_REGISTRATIONS = {\n container: {\n component: Components.ContentfulContainer,\n definition: containerDefinition,\n },\n section: {\n component: Components.ContentfulContainer,\n definition: sectionDefinition,\n },\n columns: {\n component: Components.Columns,\n definition: columnsDefinition,\n },\n singleColumn: {\n component: Components.SingleColumn,\n definition: singleColumnDefinition,\n },\n button: enrichComponentDefinition({\n component: Components.Button,\n definition: Components.ButtonComponentDefinition,\n options: {\n wrapComponent: false,\n },\n }),\n heading: enrichComponentDefinition({\n component: Components.Heading,\n definition: Components.HeadingComponentDefinition,\n options: {\n wrapComponent: false,\n },\n }),\n image: enrichComponentDefinition({\n component: Components.Image,\n definition: Components.ImageComponentDefinition,\n }),\n richText: enrichComponentDefinition({\n component: Components.RichText,\n definition: Components.RichTextComponentDefinition,\n options: {\n wrapComponent: false,\n },\n }),\n text: enrichComponentDefinition({\n component: Components.Text,\n definition: Components.TextComponentDefinition,\n options: {\n wrapComponent: false,\n },\n }),\n} satisfies Record<string, ComponentRegistration>;\n\n// pre-filling with the default component registrations\nexport const componentRegistry = new Map<string, ComponentRegistration>([\n [DEFAULT_COMPONENT_REGISTRATIONS.section.definition.id, DEFAULT_COMPONENT_REGISTRATIONS.section],\n [\n DEFAULT_COMPONENT_REGISTRATIONS.container.definition.id,\n DEFAULT_COMPONENT_REGISTRATIONS.container,\n ],\n [\n DEFAULT_COMPONENT_REGISTRATIONS.singleColumn.definition.id,\n DEFAULT_COMPONENT_REGISTRATIONS.singleColumn,\n ],\n [DEFAULT_COMPONENT_REGISTRATIONS.columns.definition.id, DEFAULT_COMPONENT_REGISTRATIONS.columns],\n [DEFAULT_COMPONENT_REGISTRATIONS.button.definition.id, DEFAULT_COMPONENT_REGISTRATIONS.button],\n [DEFAULT_COMPONENT_REGISTRATIONS.heading.definition.id, DEFAULT_COMPONENT_REGISTRATIONS.heading],\n [DEFAULT_COMPONENT_REGISTRATIONS.image.definition.id, DEFAULT_COMPONENT_REGISTRATIONS.image],\n [\n DEFAULT_COMPONENT_REGISTRATIONS.richText.definition.id,\n DEFAULT_COMPONENT_REGISTRATIONS.richText,\n ],\n [DEFAULT_COMPONENT_REGISTRATIONS.text.definition.id, DEFAULT_COMPONENT_REGISTRATIONS.text],\n]);\n\nexport const optionalBuiltInComponents = [\n DEFAULT_COMPONENT_REGISTRATIONS.button.definition.id,\n DEFAULT_COMPONENT_REGISTRATIONS.heading.definition.id,\n DEFAULT_COMPONENT_REGISTRATIONS.image.definition.id,\n DEFAULT_COMPONENT_REGISTRATIONS.richText.definition.id,\n DEFAULT_COMPONENT_REGISTRATIONS.text.definition.id,\n];\n\nexport const sendRegisteredComponentsMessage = () => {\n // Send the definitions (without components) via the connection message to the experience builder\n const registeredDefinitions = Array.from(componentRegistry.values());\n\n sendMessage(OUTGOING_EVENTS.RegisteredComponents, {\n definitions: registeredDefinitions,\n });\n};\n\nexport const sendConnectedEventWithRegisteredComponents = () => {\n // Send the definitions (without components) via the connection message to the experience builder\n const registeredDefinitions = Array.from(componentRegistry.values()).map(\n ({ definition }) => definition,\n );\n\n sendMessage(OUTGOING_EVENTS.Connected, {\n sdkVersion: SDK_VERSION,\n definitions: registeredDefinitions,\n });\n\n sendMessage(OUTGOING_EVENTS.DesignTokens, {\n designTokens: designTokensRegistry,\n });\n};\n\n/**\n * Registers multiple components and their component definitions at once\n * @param componentRegistrations - ComponentRegistration[]\n * @returns void\n */\nexport const defineComponents = (\n componentRegistrations: ComponentRegistration[],\n options?: ComponentRegistrationOptions,\n) => {\n if (options?.enabledBuiltInComponents) {\n for (const id of optionalBuiltInComponents) {\n if (!options.enabledBuiltInComponents.includes(id)) {\n componentRegistry.delete(id);\n }\n }\n }\n\n for (const registration of componentRegistrations) {\n // Fill definitions with fallbacks values\n const enrichedComponentRegistration = enrichComponentDefinition(registration);\n componentRegistry.set(\n enrichedComponentRegistration.definition.id,\n enrichedComponentRegistration,\n );\n }\n\n if (typeof window !== 'undefined') {\n window.dispatchEvent(new CustomEvent(INTERNAL_EVENTS.ComponentsRegistered));\n }\n};\n\n/**\n * use this function only in tests\n */\nexport const resetComponentRegistry = () => {\n componentRegistry.clear();\n for (const registration of Object.values(DEFAULT_COMPONENT_REGISTRATIONS)) {\n componentRegistry.set(registration.definition.id, registration);\n }\n};\n\nexport const getComponentRegistration = (id: string) => componentRegistry.get(id);\n\nexport const addComponentRegistration = (componentRegistration: ComponentRegistration) => {\n componentRegistry.set(componentRegistration.definition.id, componentRegistration);\n};\n\nexport const createAssemblyRegistration = ({\n definitionId,\n definitionName,\n component,\n}: {\n definitionId: string;\n definitionName?: string;\n component: ComponentRegistration['component'];\n}) => {\n const componentRegistration = componentRegistry.get(definitionId);\n\n if (componentRegistration) {\n return componentRegistration;\n }\n\n const definition = {\n id: definitionId,\n name: definitionName || 'Component',\n variables: {} as ComponentDefinition['variables'],\n children: true,\n category: ASSEMBLY_DEFAULT_CATEGORY,\n };\n\n addComponentRegistration({ component, definition });\n\n return componentRegistry.get(definitionId);\n};\n","import { useEffect, useState } from 'react';\n\nimport { buildStyleTag } from '@contentful/experiences-core';\nimport type { CSSProperties } from '@contentful/experiences-core/types';\n\n/**\n *\n * @param styles: the list of styles to apply\n * @param nodeId: [Optional] the id of node that these styles will be applied to\n * @returns className: the className that was used\n * Builds and adds a style tag in the document. Returns the className to be attached to the element.\n * In editor mode the nodeId is used as the identifier in order to avoid creating endless tags as the styles are tweeked\n * In preview/delivery mode the styles don't change oftem so we're using the md5 hash of the content of the tag\n */\nexport const useStyleTag = ({ styles, nodeId }: { styles: CSSProperties; nodeId?: string }) => {\n const [className, setClassName] = useState('');\n\n useEffect(() => {\n if (Object.keys(styles).length === 0) {\n return;\n }\n\n const [className, styleRule] = buildStyleTag({ styles, nodeId });\n\n setClassName(className);\n\n const existingTag = document.querySelector(`[data-cf-styles=\"${className}\"]`);\n\n if (existingTag) {\n // editor mode - update existing\n if (nodeId) {\n existingTag.innerHTML = styleRule;\n }\n // preview/delivery mode - here we don't need to update the existing tag because\n // the className is based on the md5 hash of the content so it hasn't changed\n return;\n }\n\n const styleTag = document.createElement('style');\n styleTag.dataset['cfStyles'] = className;\n\n document.head.appendChild(styleTag).innerHTML = styleRule;\n }, [styles, nodeId]);\n\n return { className };\n};\n","import { checkIsAssemblyNode, EntityStore } from '@contentful/experiences-core';\nimport type { ComponentPropertyValue, ComponentTreeNode } from '@contentful/experiences-core/types';\n\nexport const deserializeAssemblyNode = ({\n node,\n componentInstanceVariables,\n}: {\n node: ComponentTreeNode;\n componentInstanceVariables: ComponentTreeNode['variables'];\n}): ComponentTreeNode => {\n const variables: Record<string, ComponentPropertyValue> = {};\n\n for (const [variableName, variable] of Object.entries(node.variables)) {\n variables[variableName] = variable;\n if (variable.type === 'ComponentValue') {\n const componentValueKey = variable.key;\n const instanceProperty = componentInstanceVariables[componentValueKey];\n\n // For assembly, we look up the variable in the assembly instance and\n // replace the componentValue with that one.\n if (instanceProperty?.type === 'UnboundValue') {\n variables[variableName] = {\n type: 'UnboundValue',\n key: instanceProperty.key,\n };\n } else if (instanceProperty?.type === 'BoundValue') {\n variables[variableName] = {\n type: 'BoundValue',\n path: instanceProperty.path,\n };\n }\n }\n }\n\n const children: ComponentTreeNode[] = node.children.map((child) =>\n deserializeAssemblyNode({\n node: child,\n componentInstanceVariables,\n }),\n );\n\n return {\n definitionId: node.definitionId,\n variables,\n children,\n };\n};\n\nexport const resolveAssembly = ({\n node,\n entityStore,\n}: {\n node: ComponentTreeNode;\n entityStore: EntityStore;\n}) => {\n const isAssembly = checkIsAssemblyNode({\n componentId: node.definitionId,\n usedComponents: entityStore.usedComponents,\n });\n\n if (!isAssembly) {\n return node;\n }\n\n const componentId = node.definitionId as string;\n const assembly = entityStore.experienceEntryFields?.usedComponents?.find(\n (component) => component.sys.id === componentId,\n );\n\n if (!assembly || !('fields' in assembly)) {\n return node;\n }\n\n const componentFields = assembly.fields;\n\n const deserializedNode = deserializeAssemblyNode({\n node: {\n definitionId: node.definitionId,\n variables: {},\n children: componentFields.componentTree.children,\n },\n componentInstanceVariables: node.variables,\n });\n\n entityStore.addAssemblyUnboundValues(componentFields.unboundValues);\n\n return deserializedNode;\n};\n","import React from 'react';\n\nconst assemblyStyle = { display: 'contents' };\n\n// Feel free to do any magic as regards variable definitions for assemblies\n// Or if this isn't necessary by the time we figure that part out, we can bid this part farewell\nexport const Assembly = ({ ...props }) => {\n // Using a display contents so assembly content/children\n // can appear as if they are direct children of the div wrapper's parent\n return <div data-test-id=\"assembly\" {...props} style={assemblyStyle} />;\n};\n","import React, { useMemo } from 'react';\nimport type { UnresolvedLink } from 'contentful';\nimport { omit } from 'lodash-es';\nimport {\n EntityStore,\n isEmptyStructureWithRelativeHeight,\n isDeepPath,\n} from '@contentful/experiences-core';\nimport {\n CF_STYLE_ATTRIBUTES,\n CONTENTFUL_COMPONENTS,\n EMPTY_CONTAINER_HEIGHT,\n} from '@contentful/experiences-core/constants';\nimport type {\n ComponentTreeNode,\n PrimitiveValue,\n ResolveDesignValueType,\n StyleProps,\n} from '@contentful/experiences-core/types';\nimport { createAssemblyRegistration, getComponentRegistration } from '../../core/componentRegistry';\nimport {\n buildCfStyles,\n checkIsAssemblyNode,\n transformContentValue,\n} from '@contentful/experiences-core';\nimport { useStyleTag } from '../../hooks/useStyleTag';\nimport {\n Columns,\n ContentfulContainer,\n SingleColumn,\n} from '@contentful/experiences-components-react';\n\nimport { resolveAssembly } from '../../core/preview/assemblyUtils';\nimport { Assembly } from '../../components/Assembly';\n\ntype CompositionBlockProps = {\n node: ComponentTreeNode;\n locale: string;\n entityStore: EntityStore;\n resolveDesignValue: ResolveDesignValueType;\n};\n\nexport const CompositionBlock = ({\n node: rawNode,\n locale,\n entityStore,\n resolveDesignValue,\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 }\n\n const propMap: Record<string, PrimitiveValue> = {};\n\n return Object.entries(node.variables).reduce((acc, [variableName, variable]) => {\n switch (variable.type) {\n case 'DesignValue':\n acc[variableName] = resolveDesignValue(variable.valuesByBreakpoint, variableName);\n break;\n case 'BoundValue': {\n const variableDefinition = componentRegistration.definition.variables[variableName];\n if (isDeepPath(variable.path)) {\n const [, uuid] = variable.path.split('/');\n const link = entityStore.dataSource[uuid] as UnresolvedLink<'Entry' | 'Asset'>;\n const boundValue = entityStore.getValueDeep(link, variable.path);\n const value = boundValue || variableDefinition.defaultValue;\n acc[variableName] = transformContentValue(value, variableDefinition);\n break;\n }\n const [, uuid, ...path] = variable.path.split('/');\n const binding = entityStore.dataSource[uuid] as UnresolvedLink<'Entry' | 'Asset'>;\n let value = entityStore.getValue(binding, path.slice(0, -1));\n if (!value) {\n const foundAssetValue = entityStore.getValue(binding, [\n ...path.slice(0, -2),\n 'fields',\n 'file',\n ]);\n if (foundAssetValue) {\n value = foundAssetValue;\n }\n }\n acc[variableName] = transformContentValue(value, variableDefinition);\n break;\n }\n case 'UnboundValue': {\n const uuid = variable.key;\n acc[variableName] = entityStore.unboundValues[uuid]?.value;\n break;\n }\n default:\n break;\n }\n return acc;\n }, propMap);\n }, [componentRegistration, isAssembly, node.variables, resolveDesignValue, entityStore]);\n\n const cfStyles = buildCfStyles(nodeProps);\n\n if (\n isEmptyStructureWithRelativeHeight(node.children.length, node.definitionId, cfStyles.height)\n ) {\n cfStyles.minHeight = EMPTY_CONTAINER_HEIGHT;\n }\n\n const { className } = useStyleTag({ styles: cfStyles });\n\n if (!componentRegistration) {\n return null;\n }\n\n const { component } = componentRegistration;\n\n const children =\n componentRegistration.definition.children === true\n ? node.children.map((childNode: ComponentTreeNode, index) => {\n return (\n <CompositionBlock\n node={childNode}\n key={index}\n locale={locale}\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 return React.createElement(\n component,\n {\n ...omit(nodeProps, CF_STYLE_ATTRIBUTES, ['cfHyperlink', 'cfOpenInNewTab']),\n className,\n },\n children,\n );\n};\n","import type {\n ValuesByBreakpoint,\n Breakpoint,\n PrimitiveValue,\n ResolveDesignValueType,\n} from '@contentful/experiences-core/types';\nimport {\n mediaQueryMatcher,\n getFallbackBreakpointIndex,\n getActiveBreakpointIndex,\n getValueForBreakpoint,\n} from '@contentful/experiences-core';\nimport { useCallback, useEffect, useState } from 'react';\n\n// TODO: In order to support integrations without React, we should extract this heavy logic into simple\n// functions that we can reuse in other frameworks.\n\n/*\n * Registers media query change listeners for each breakpoint (except for \"*\").\n * It will always assume the last matching media query in the list. It therefore,\n * assumes that the breakpoints are sorted beginning with the default value (query: \"*\")\n * and then decending by screen width. For mobile-first designs, the order would be ascending\n */\nexport const useBreakpoints = (breakpoints: Breakpoint[]) => {\n const [mediaQueryMatchers, initialMediaQueryMatches] = mediaQueryMatcher(breakpoints);\n\n const [mediaQueryMatches, setMediaQueryMatches] =\n useState<Record<string, boolean>>(initialMediaQueryMatches);\n\n const fallbackBreakpointIndex = getFallbackBreakpointIndex(breakpoints);\n\n // Register event listeners to update the media query states\n useEffect(() => {\n const eventListeners = mediaQueryMatchers.map(({ id, signal }) => {\n const onChange = () =>\n setMediaQueryMatches((prev) => ({\n ...prev,\n [id]: signal.matches,\n }));\n signal.addEventListener('change', onChange);\n return onChange;\n });\n\n return () => {\n eventListeners.forEach((eventListener, index) => {\n mediaQueryMatchers[index].signal.removeEventListener('change', eventListener);\n });\n };\n }, [mediaQueryMatchers]);\n\n const activeBreakpointIndex = getActiveBreakpointIndex(\n breakpoints,\n mediaQueryMatches,\n fallbackBreakpointIndex,\n );\n\n const resolveDesignValue: ResolveDesignValueType = useCallback(\n (valuesByBreakpoint: ValuesByBreakpoint, variableName: string): PrimitiveValue => {\n return getValueForBreakpoint(\n valuesByBreakpoint,\n breakpoints,\n activeBreakpointIndex,\n variableName,\n );\n },\n [activeBreakpointIndex, breakpoints],\n );\n\n return { resolveDesignValue };\n};\n","import { useEffect, useState } from 'react';\nimport { EntityStore } from '@contentful/experiences-core';\nimport type { Experience } from '@contentful/experiences-core/types';\n\nexport const useFetchByBase = (\n fetchMethod: () => Promise<Experience<EntityStore> | undefined>,\n isEditorMode: boolean,\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 mode, we don't want to fetch the experience here\n // it is passed via postMessage instead\n if (isEditorMode) {\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, isEditorMode]);\n\n return {\n error,\n experience,\n isLoading,\n isEditorMode,\n };\n};\n","import { useEffect, useRef, useState } from 'react';\nimport {\n doesMismatchMessageSchema,\n sendMessage,\n tryParseMessage,\n} from '@contentful/experiences-core';\nimport { INCOMING_EVENTS, OUTGOING_EVENTS } from '@contentful/experiences-core/constants';\n\ntype UseDetectEditorModeArgs = {\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 useDetectEditorMode = ({ isClientSide = false }: UseDetectEditorModeArgs = {}) => {\n const [mounted, setMounted] = useState(false);\n const [isEditorMode, setIsEditorMode] = useState(isClientSide ? inIframe() : false);\n const receivedMessage = useRef(false);\n\n useEffect(() => {\n const onMessage = (event: MessageEvent) => {\n if (doesMismatchMessageSchema(event)) {\n return;\n }\n const eventData = tryParseMessage(event);\n\n if (eventData.eventType === INCOMING_EVENTS.RequestEditorMode) {\n setIsEditorMode(true);\n receivedMessage.current = true;\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 window.__EB__.isEditorMode = true;\n window.removeEventListener('message', onMessage);\n }\n }\n };\n\n //Only run check after component is mounted on the client to avoid hydration ssr issues\n if (mounted) {\n setIsEditorMode(inIframe());\n //Double check if we are in editor mode by listening to postMessage events\n if (typeof window !== 'undefined' && !window.__EB__?.isEditorMode) {\n window.addEventListener('message', onMessage);\n sendMessage(OUTGOING_EVENTS.Connected);\n\n setTimeout(() => {\n if (!receivedMessage.current) {\n // if message is not received back in time, set editorMode back to false\n setIsEditorMode(false);\n }\n }, 100);\n }\n } else {\n setMounted(true);\n }\n\n return () => window.removeEventListener('message', onMessage);\n }, [mounted]);\n\n return isEditorMode;\n};\n\nfunction inIframe() {\n try {\n return window.self !== window.top;\n } catch (e) {\n return false;\n }\n}\n","import { useCallback } from 'react';\nimport type { ContentfulClientApi } from 'contentful';\nimport { useFetchByBase } from './useFetchByBase';\nimport { fetchById } from '@contentful/experiences-core';\nimport { useDetectEditorMode } from './useDetectEditorMode';\n\nexport type UseFetchByIdArgs = {\n client: ContentfulClientApi<undefined>;\n id: string;\n experienceTypeId: string;\n localeCode: string;\n};\n\nexport const useFetchById = ({ id, localeCode, client, experienceTypeId }: UseFetchByIdArgs) => {\n const isEditorMode = useDetectEditorMode({ isClientSide: typeof window !== 'undefined' });\n\n const fetchMethod = useCallback(() => {\n return fetchById({ id, localeCode, client, experienceTypeId });\n }, [id, localeCode, client, experienceTypeId]);\n\n return useFetchByBase(fetchMethod, isEditorMode);\n};\n","import { useCallback } from 'react';\nimport type { ContentfulClientApi } from 'contentful';\nimport { useFetchByBase } from './useFetchByBase';\nimport { fetchBySlug } from '@contentful/experiences-core';\nimport { useDetectEditorMode } from './useDetectEditorMode';\n\nexport type UseFetchBySlugArgs = {\n client: ContentfulClientApi<undefined>;\n slug: string;\n experienceTypeId: string;\n localeCode: string;\n};\n\nexport const useFetchBySlug = ({\n slug,\n localeCode,\n client,\n experienceTypeId,\n}: UseFetchBySlugArgs) => {\n const isEditorMode = useDetectEditorMode({ isClientSide: typeof window !== 'undefined' });\n\n const fetchMethod = useCallback(() => {\n return fetchBySlug({ slug, localeCode, client, experienceTypeId });\n }, [slug, localeCode, client, experienceTypeId]);\n\n return useFetchByBase(fetchMethod, isEditorMode);\n};\n","import React from 'react';\nimport { EntityStore } from '@contentful/experiences-core';\nimport type { Experience } from '@contentful/experiences-core/types';\nimport { CompositionBlock } from './CompositionBlock';\nimport { compatibleVersions } from '../../constants';\nimport { useBreakpoints } from '../../hooks';\n\ntype DeliveryRootProps = {\n experience: Experience<EntityStore>;\n locale: string;\n};\n\nexport const PreviewDeliveryRoot = ({ locale, experience }: DeliveryRootProps) => {\n const { entityStore } = experience;\n\n const { resolveDesignValue } = useBreakpoints(entityStore?.breakpoints ?? []);\n\n if (!entityStore?.experienceEntryFields || !entityStore?.schemaVersion) {\n return null;\n }\n\n if (!compatibleVersions.includes(entityStore.schemaVersion)) {\n console.warn(\n `[experiences-sdk-react] Contentful composition schema version: ${entityStore.schemaVersion} does not match the compatible schema versions: ${compatibleVersions}. Aborting.`,\n );\n return null;\n }\n\n return (\n <>\n {entityStore.experienceEntryFields.componentTree.children.map((childNode, index) => (\n <CompositionBlock\n key={index}\n node={childNode}\n locale={locale}\n entityStore={entityStore}\n resolveDesignValue={resolveDesignValue}\n />\n ))}\n </>\n );\n};\n","import React, { ErrorInfo, ReactElement } from 'react';\nimport { sendMessage } from '@contentful/experiences-core';\nimport '../styles/ErrorBoundary.css';\nimport { OUTGOING_EVENTS } from '@contentful/experiences-core/constants';\n\nclass ImportedComponentError extends Error {}\n\nexport class ErrorBoundary extends React.Component<\n { children: ReactElement },\n { hasError: boolean; error: Error | null; errorInfo: ErrorInfo | null; showErrorDetails: boolean }\n> {\n constructor(props: { children: ReactElement }) {\n super(props);\n this.state = { hasError: false, error: null, errorInfo: null, showErrorDetails: false };\n }\n\n static getDerivedStateFromError() {\n return { hasError: true };\n }\n\n componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n this.setState({ error, errorInfo });\n if (!(error instanceof ImportedComponentError)) {\n sendMessage(OUTGOING_EVENTS.CanvasError, error);\n } else {\n throw error;\n }\n }\n\n render() {\n if (this.state.hasError) {\n return (\n <div className=\"cf-error-message\">\n <h2 className=\"title\">{`Something went wrong while rendering the experience`}</h2>\n <div>\n The Experience Builder SDK has encountered an error. It may be that the SDK has not been\n set up properly or an imported component has thrown this error. Try to refresh the page\n and find more guidance in our{' '}\n <a\n href=\"https://www.contentful.com/developers/docs/tutorials/general/experience-builder/\"\n rel=\"noreferrer\"\n target=\"_blank\">\n documentation\n </a>\n .\n </div>\n <br />\n <span\n className=\"more-details\"\n onClick={() =>\n this.setState((prevState) => ({\n showErrorDetails: !prevState.showErrorDetails,\n }))\n }>\n {this.state.showErrorDetails ? 'Hide' : 'See'} details\n </span>\n {this.state.showErrorDetails && (\n <code>\n {this.state.error?.stack?.split('\\n').map((i, key) => {\n return <div key={key}>{i}</div>;\n })}\n </code>\n )}\n </div>\n );\n }\n return this.props.children;\n }\n}\n\nexport class ImportedComponentErrorBoundary extends React.Component<{ children: ReactElement }> {\n componentDidCatch(error: Error, _errorInfo: ErrorInfo) {\n const err = new ImportedComponentError(error.message);\n err.stack = error.stack;\n throw err;\n }\n\n render() {\n return this.props.children;\n }\n}\n","import { useEffect, useRef, useState } from 'react';\nimport { EntityStore } from '@contentful/experiences-core';\nimport {\n componentRegistry,\n sendConnectedEventWithRegisteredComponents,\n sendRegisteredComponentsMessage,\n} from '../core/componentRegistry';\nimport { INTERNAL_EVENTS, VISUAL_EDITOR_EVENTS } from '@contentful/experiences-core/constants';\nimport { designTokensRegistry } from '@contentful/experiences-core';\n\ntype InitializeVisualEditorParams = {\n initialLocale: string;\n initialEntities?: EntityStore['entities'];\n};\n\nexport const useInitializeVisualEditor = (params: InitializeVisualEditorParams) => {\n const { initialLocale, initialEntities } = params;\n const [locale, setLocale] = useState<string>(initialLocale);\n\n const hasConnectEventBeenSent = useRef(false);\n\n // sends component definitions to the web app\n // InternalEvents.COMPONENTS_REGISTERED is triggered by defineComponents function\n useEffect(() => {\n if (!hasConnectEventBeenSent.current) {\n // sending CONNECT but with the registered components now\n sendConnectedEventWithRegisteredComponents();\n hasConnectEventBeenSent.current = true;\n }\n\n const onComponentsRegistered = () => {\n sendRegisteredComponentsMessage();\n };\n\n if (typeof window !== 'undefined') {\n window.addEventListener(INTERNAL_EVENTS.ComponentsRegistered, onComponentsRegistered);\n }\n\n return () => {\n if (typeof window !== 'undefined') {\n window.removeEventListener(INTERNAL_EVENTS.ComponentsRegistered, onComponentsRegistered);\n }\n };\n }, []);\n\n useEffect(() => {\n setLocale(initialLocale);\n }, [initialLocale]);\n\n useEffect(() => {\n const onVisualEditorReady = () => {\n window.dispatchEvent(\n new CustomEvent(INTERNAL_EVENTS.VisualEditorInitialize, {\n detail: {\n componentRegistry,\n designTokens: designTokensRegistry,\n locale,\n entities: initialEntities ?? [],\n },\n }),\n );\n };\n\n window.addEventListener(VISUAL_EDITOR_EVENTS.Ready, onVisualEditorReady);\n return () => {\n window.removeEventListener(VISUAL_EDITOR_EVENTS.Ready, onVisualEditorReady);\n };\n }, [locale, initialEntities]);\n};\n","import React, { Suspense } from 'react';\nimport { EntityStore, VisualEditorMode } from '@contentful/experiences-core';\nimport { ErrorBoundary } from '../../components/ErrorBoundary';\nimport { useInitializeVisualEditor } from '../../hooks/useInitializeVisualEditor';\n\nconst VisualEditorLoader = React.lazy(() => import('./VisualEditorLoader'));\n\ntype VisualEditorRootProps = {\n visualEditorMode: VisualEditorMode;\n initialEntities: EntityStore['entities'];\n initialLocale: string;\n};\n\nexport const VisualEditorRoot: React.FC<VisualEditorRootProps> = ({\n visualEditorMode,\n initialEntities,\n initialLocale,\n}) => {\n useInitializeVisualEditor({\n initialLocale,\n initialEntities,\n });\n\n return (\n <ErrorBoundary>\n <Suspense fallback={<div>Loading...</div>}>\n <VisualEditorLoader visualEditorMode={visualEditorMode} />\n </Suspense>\n </ErrorBoundary>\n );\n};\n\nexport default VisualEditorRoot;\n","import React from 'react';\nimport { VisualEditorMode, validateExperienceBuilderConfig } from '@contentful/experiences-core';\nimport { EntityStore } from '@contentful/experiences-core';\nimport type { Experience } from '@contentful/experiences-core/types';\nimport { PreviewDeliveryRoot } from './blocks/preview/PreviewDeliveryRoot';\nimport VisualEditorRoot from './blocks/editor/VisualEditorRoot';\nimport { useDetectEditorMode } from './hooks/useDetectEditorMode';\n\ntype ExperienceRootProps = {\n experience?: Experience<EntityStore>;\n locale: string;\n visualEditorMode?: VisualEditorMode;\n};\n\nexport const ExperienceRoot = ({\n locale,\n experience,\n visualEditorMode = VisualEditorMode.LazyLoad,\n}: ExperienceRootProps) => {\n const isEditorMode = useDetectEditorMode();\n\n validateExperienceBuilderConfig({\n locale,\n isEditorMode,\n });\n\n if (isEditorMode) {\n const entityStore = experience?.entityStore;\n return (\n <VisualEditorRoot\n visualEditorMode={visualEditorMode}\n initialEntities={entityStore?.entities || []}\n initialLocale={locale}\n />\n );\n }\n\n if (!experience) return null;\n\n return <PreviewDeliveryRoot locale={locale} experience={experience} />;\n};\n","import { SDK_VERSION } from './sdkVersion';\n\nexport { ExperienceRoot } from './ExperienceRoot';\nexport { useFetchById, useFetchBySlug } from './hooks';\nexport { defineComponents } from './core/componentRegistry';\nexport {\n calculateNodeDefaultHeight,\n /** @deprecated use `checkIsAssemblyNode` instead. Will be removed with SDK v5. */\n checkIsAssembly,\n checkIsAssemblyNode,\n checkIsAssemblyEntry,\n defineDesignTokens,\n supportedModes,\n VisualEditorMode,\n fetchById,\n fetchBySlug,\n createExperience,\n} from '@contentful/experiences-core';\nexport {\n CONTENTFUL_COMPONENTS,\n OUTGOING_EVENTS,\n INCOMING_EVENTS,\n CONTENTFUL_COMPONENT_CATEGORY,\n LATEST_SCHEMA_VERSION,\n CF_STYLE_ATTRIBUTES,\n ASSEMBLY_BLOCK_NODE_TYPE,\n ASSEMBLY_NODE_TYPE,\n ASSEMBLY_NODE_TYPES,\n SCROLL_STATES,\n} from '@contentful/experiences-core/constants';\n\n// Simple state store to store a few things that are needed across the SDK\nif (typeof window !== 'undefined') {\n window.__EB__ = {\n sdkVersion: SDK_VERSION,\n };\n}\n\nexport type {\n InternalSDKMode,\n ExternalSDKMode,\n ComponentDefinition,\n} from '@contentful/experiences-core/types';\nexport { EntityStore } from '@contentful/experiences-core';\n"],"names":["_jsx","builtInStyleDefinitions","_jsxs"],"mappings":";;;;;;;;;;;AAAO,MAAM,WAAW,GAA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UAAU,EAAE,WAAW;KACxB,CAAC;AACJ;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { EntityStore } from '@contentful/experiences-core';
2
- import type { CompositionNode, ResolveDesignValueType } from '@contentful/experiences-core/types';
2
+ import type { ComponentTreeNode, ResolveDesignValueType } from '@contentful/experiences-core/types';
3
3
  type CompositionBlockProps = {
4
- node: CompositionNode;
4
+ node: ComponentTreeNode;
5
5
  locale: string;
6
6
  entityStore: EntityStore;
7
7
  resolveDesignValue: ResolveDesignValueType;
@@ -1,10 +1,10 @@
1
1
  import { EntityStore } from '@contentful/experiences-core';
2
- import type { CompositionNode } from '@contentful/experiences-core/types';
2
+ import type { ComponentTreeNode } from '@contentful/experiences-core/types';
3
3
  export declare const deserializeAssemblyNode: ({ node, componentInstanceVariables, }: {
4
- node: CompositionNode;
5
- componentInstanceVariables: CompositionNode['variables'];
6
- }) => CompositionNode;
4
+ node: ComponentTreeNode;
5
+ componentInstanceVariables: ComponentTreeNode['variables'];
6
+ }) => ComponentTreeNode;
7
7
  export declare const resolveAssembly: ({ node, entityStore, }: {
8
- node: CompositionNode;
8
+ node: ComponentTreeNode;
9
9
  entityStore: EntityStore;
10
- }) => CompositionNode;
10
+ }) => ComponentTreeNode;
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.1-alpha.2";
1
+ export declare const SDK_VERSION = "0.0.1-alpha.3";
@@ -1,4 +1,4 @@
1
- import type { CompositionComponentNode, SchemaVersions } from '@contentful/experiences-core/types';
1
+ import type { ExperienceTreeNode, SchemaVersions } from '@contentful/experiences-core/types';
2
2
  type createAssemblyEntryArgs = {
3
3
  schemaVersion: SchemaVersions;
4
4
  id: string;
@@ -92,5 +92,5 @@ type createAssemblyNodeArgs = {
92
92
  unboundValueKey?: string;
93
93
  boundValueKey?: string;
94
94
  };
95
- export declare const createAssemblyNode: ({ id, blockId, unboundValue, unboundValueKey, boundValueKey, }: createAssemblyNodeArgs) => CompositionComponentNode;
95
+ export declare const createAssemblyNode: ({ id, blockId, unboundValue, unboundValueKey, boundValueKey, }: createAssemblyNodeArgs) => ExperienceTreeNode;
96
96
  export {};
@@ -1,7 +1,7 @@
1
1
  import type { ExperienceEntry, SchemaVersions } from '@contentful/experiences-core/types';
2
2
  export declare const compositionEntry: ExperienceEntry;
3
- type createCompositionEntryArgs = {
3
+ type createExperienceEntryArgs = {
4
4
  schemaVersion: SchemaVersions;
5
5
  };
6
- export declare const createCompositionEntry: ({ schemaVersion, }: createCompositionEntryArgs) => ExperienceEntry;
6
+ export declare const createExperienceEntry: ({ schemaVersion, }: createExperienceEntryArgs) => ExperienceEntry;
7
7
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experiences-sdk-react",
3
- "version": "0.0.1-alpha.3",
3
+ "version": "0.0.1-alpha.4",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "typings": "./dist/src/index.d.ts",
@@ -31,9 +31,9 @@
31
31
  "depcruise": "depcruise src"
32
32
  },
33
33
  "dependencies": {
34
- "@contentful/experiences-components-react": "0.0.1-alpha.3",
35
- "@contentful/experiences-core": "0.0.1-alpha.3",
36
- "@contentful/experiences-visual-editor-react": "0.0.1-alpha.3",
34
+ "@contentful/experiences-components-react": "0.0.1-alpha.4",
35
+ "@contentful/experiences-core": "0.0.1-alpha.4",
36
+ "@contentful/experiences-visual-editor-react": "0.0.1-alpha.4",
37
37
  "@contentful/rich-text-types": "^16.2.1",
38
38
  "classnames": "^2.3.2",
39
39
  "csstype": "^3.1.2",
@@ -88,5 +88,5 @@
88
88
  "dist",
89
89
  "package.json"
90
90
  ],
91
- "gitHead": "16ce64efb91be55c9e2395ff9ec774beb6a73e71"
91
+ "gitHead": "3534889cb659fac4329ff54d5bad6bdf3f2d9b3e"
92
92
  }