@contentful/experiences-sdk-react 3.7.0-dev-20250919T0822-6a47406.0 → 3.7.0-dev-20250919T1400-8d76591.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.
- package/dist/core/componentRegistry.js +6 -12
- package/dist/core/componentRegistry.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/sdkVersion.js +1 -1
- package/dist/sdkVersion.js.map +1 -1
- package/dist/src/core/componentRegistry.d.ts +1 -2
- package/dist/src/sdkVersion.d.ts +1 -1
- package/package.json +6 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Components from '@contentful/experiences-components-react';
|
|
2
2
|
import { containerDefinition, sectionDefinition, columnsDefinition, singleColumnDefinition, dividerDefinition } from '@contentful/experiences-components-react';
|
|
3
|
-
import { CONTENTFUL_COMPONENTS, INTERNAL_EVENTS, OUTGOING_EVENTS
|
|
4
|
-
import { defineSdkOptions, isContentfulStructureComponent, debug, builtInStyles, optionalBuiltInStyles, sendMessage, breakpointsRegistry, designTokensRegistry } from '@contentful/experiences-core';
|
|
3
|
+
import { CONTENTFUL_COMPONENTS, INTERNAL_EVENTS, OUTGOING_EVENTS } from '@contentful/experiences-core/constants';
|
|
4
|
+
import { defineSdkOptions, isContentfulStructureComponent, debug, builtInStyles, optionalBuiltInStyles, createAssemblyDefinition, sendMessage, breakpointsRegistry, designTokensRegistry, checkIsAssemblyDefinition } from '@contentful/experiences-core';
|
|
5
5
|
import { validateComponentDefinition } from '@contentful/experiences-validators';
|
|
6
6
|
import { withComponentWrapper } from '../utils/withComponentWrapper.js';
|
|
7
7
|
import { SDK_VERSION } from '../sdkVersion.js';
|
|
@@ -169,9 +169,9 @@ const sendRegisteredComponentsMessage = () => {
|
|
|
169
169
|
// Send the definitions (without components) via the connection message to the experience builder
|
|
170
170
|
const registeredDefinitions = Array.from(componentRegistry.values())
|
|
171
171
|
.map(({ definition }) => definition)
|
|
172
|
-
//
|
|
172
|
+
// Assembly definitions are empty placeholder within the SDK without variables
|
|
173
173
|
// We don't send those to the editor as they would overwrite the actual correct definitions.
|
|
174
|
-
.filter((definition) => definition
|
|
174
|
+
.filter((definition) => !checkIsAssemblyDefinition(definition));
|
|
175
175
|
sendMessage(OUTGOING_EVENTS.RegisteredComponents, {
|
|
176
176
|
definitions: registeredDefinitions,
|
|
177
177
|
});
|
|
@@ -300,18 +300,12 @@ const getComponentRegistration = (id) => componentRegistry.get(id);
|
|
|
300
300
|
const addComponentRegistration = (componentRegistration) => {
|
|
301
301
|
componentRegistry.set(componentRegistration.definition.id, componentRegistration);
|
|
302
302
|
};
|
|
303
|
-
const createAssemblyRegistration = ({ definitionId,
|
|
303
|
+
const createAssemblyRegistration = ({ definitionId, component, }) => {
|
|
304
304
|
const componentRegistration = componentRegistry.get(definitionId);
|
|
305
305
|
if (componentRegistration) {
|
|
306
306
|
return componentRegistration;
|
|
307
307
|
}
|
|
308
|
-
const definition =
|
|
309
|
-
id: definitionId,
|
|
310
|
-
name: definitionName || 'Component',
|
|
311
|
-
variables: {},
|
|
312
|
-
children: true,
|
|
313
|
-
category: ASSEMBLY_DEFAULT_CATEGORY,
|
|
314
|
-
};
|
|
308
|
+
const definition = createAssemblyDefinition(definitionId);
|
|
315
309
|
addComponentRegistration({ component, definition });
|
|
316
310
|
return componentRegistry.get(definitionId);
|
|
317
311
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"componentRegistry.js","sources":["../../../src/core/componentRegistry.ts"],"sourcesContent":["import * as Components from '@contentful/experiences-components-react';\nimport type {\n ComponentRegistration,\n ComponentDefinition,\n ComponentRegistrationOptions,\n DesignTokensDefinition,\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 breakpointsRegistry,\n optionalBuiltInStyles,\n sendMessage,\n defineSdkOptions,\n debug,\n isContentfulStructureComponent,\n} from '@contentful/experiences-core';\nimport { validateComponentDefinition } from '@contentful/experiences-validators';\nimport { withComponentWrapper } from '../utils/withComponentWrapper';\nimport { SDK_VERSION } from '../constants';\nimport {\n sectionDefinition,\n containerDefinition,\n columnsDefinition,\n singleColumnDefinition,\n dividerDefinition,\n} from '@contentful/experiences-components-react';\n\nconst CssVarRegex = /var\\(--[\\w-]+\\)/;\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 const clone = cloneObject(componentDefinition);\n\n // set margin built-in style by default\n if (!clone.builtInStyles) {\n clone.builtInStyles = ['cfMargin'];\n }\n\n if (!clone.variables) {\n clone.variables = {};\n }\n\n // Enforce the presence of this property for toggling visibility on any node\n clone.variables['cfVisibility'] = builtInStyleDefinitions['cfVisibility'];\n\n for (const style of clone.builtInStyles || []) {\n if (builtInStyleDefinitions[style]) {\n clone.variables[style] = builtInStyleDefinitions[style] as any; // TODO: fix type\n }\n if (optionalBuiltInStyles[style]) {\n clone.variables[style] = optionalBuiltInStyles[style] as any; // TODO: fix type\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 options,\n };\n};\n\nconst DEFAULT_COMPONENT_REGISTRATIONS = {\n container: {\n component: Components.ContentfulContainer,\n definition: containerDefinition,\n options: {\n enableEditorProperties: {\n isEditorMode: true,\n isEmpty: true,\n nodeBlockId: true,\n },\n },\n },\n section: {\n component: Components.ContentfulContainer,\n definition: sectionDefinition,\n options: {\n enableEditorProperties: {\n isEditorMode: true,\n isEmpty: true,\n nodeBlockId: true,\n },\n },\n },\n columns: {\n component: Components.Columns,\n definition: columnsDefinition,\n },\n singleColumn: {\n component: Components.SingleColumn,\n definition: singleColumnDefinition,\n options: {\n enableEditorProperties: {\n isEditorMode: true,\n isEmpty: true,\n },\n },\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 options: { wrapComponent: false },\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 divider: enrichComponentDefinition({\n component: Components.ContentfulDivider,\n definition: dividerDefinition,\n options: {\n wrapComponent: false,\n },\n }),\n carousel: enrichComponentDefinition({\n component: Components.Carousel,\n definition: Components.carouselDefinition,\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 [DEFAULT_COMPONENT_REGISTRATIONS.divider.definition.id, DEFAULT_COMPONENT_REGISTRATIONS.divider],\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 DEFAULT_COMPONENT_REGISTRATIONS.divider.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 .map(({ definition }) => definition)\n // Pattern definitions are empty placeholder within the SDK without variables\n // We don't send those to the editor as they would overwrite the actual correct definitions.\n .filter((definition) => definition.category !== ASSEMBLY_DEFAULT_CATEGORY);\n\n sendMessage(OUTGOING_EVENTS.RegisteredComponents, {\n definitions: registeredDefinitions,\n });\n};\n\nexport const runRegisteredComponentValidations = () => {\n Array.from(componentRegistry.values()).map(({ definition }) => {\n const validation = validateComponentDefinition(definition);\n if (!validation.success) {\n throw new Error(\n `Invalid component definition for component '${definition.name}'. Failed with errors: \\n${JSON.stringify(validation.errors, null, 2)}`,\n );\n }\n });\n};\n\nconst getSingleCssVariableValue = (\n element: HTMLDivElement,\n cssVariableValue: string,\n cssAttribute: any,\n) => {\n element.style[cssAttribute] = cssVariableValue;\n const styles = getComputedStyle(element);\n const resolvedValue = styles.getPropertyValue(cssAttribute);\n return resolvedValue;\n};\n\nconst getAllCssVariableValues = (\n element: HTMLDivElement,\n cssVariable: Record<string, string>,\n cssAttribute: any,\n) => {\n const resolvedCssVariables = {} as Record<string, string>;\n\n Object.keys(cssVariable).forEach((key) => {\n const cssVariableValue = cssVariable[key];\n if (CssVarRegex.test(cssVariableValue)) {\n const resolvedValue = getSingleCssVariableValue(element, cssVariableValue, cssAttribute);\n resolvedCssVariables[cssVariableValue] = resolvedValue;\n }\n });\n return resolvedCssVariables;\n};\n\ntype CssMapType = {\n variable?: Record<string, string>;\n property: string;\n};\n\nconst resolveCssVariables = (designTokensDefinition: DesignTokensDefinition) => {\n const {\n spacing,\n sizing,\n color,\n borderRadius,\n fontSize,\n lineHeight,\n letterSpacing,\n textColor,\n border,\n } = designTokensDefinition;\n const resolvedCssVariables = {} as Record<string, string>;\n\n // Create an element\n const element = document.createElement('div');\n document.body.appendChild(element);\n\n const cssProperties: CssMapType[] = [\n { variable: spacing, property: 'margin' },\n { variable: sizing, property: 'width' },\n { variable: color, property: 'background-color' },\n { variable: borderRadius, property: 'border-radius' },\n { variable: fontSize, property: 'font-size' },\n { variable: lineHeight, property: 'line-height' },\n { variable: letterSpacing, property: 'letter-spacing' },\n { variable: textColor, property: 'color' },\n ];\n\n cssProperties.forEach(({ variable, property }) => {\n if (variable) {\n const rawResolvedValues = getAllCssVariableValues(element, variable, property);\n Object.assign(resolvedCssVariables, rawResolvedValues);\n }\n });\n\n if (border) {\n const tempResolvedValue = {} as Record<string, string>;\n Object.keys(border).forEach((borderKey) => {\n const { width, style, color } = border[borderKey];\n\n if (width && CssVarRegex.test(width)) {\n const resolvedValue = getSingleCssVariableValue(element, width, 'border-width');\n tempResolvedValue[width] = resolvedValue;\n }\n if (style && CssVarRegex.test(style)) {\n const resolvedValue = getSingleCssVariableValue(element, style, 'border-style');\n tempResolvedValue[style] = resolvedValue;\n }\n if (color && CssVarRegex.test(color)) {\n const resolvedValue = getSingleCssVariableValue(element, color, 'border-color');\n tempResolvedValue[color] = resolvedValue;\n }\n Object.assign(resolvedCssVariables, tempResolvedValue);\n });\n }\n\n document.body.removeChild(element);\n return resolvedCssVariables;\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.RegisteredBreakpoints, {\n breakpoints: breakpointsRegistry,\n });\n\n sendMessage(OUTGOING_EVENTS.DesignTokens, {\n designTokens: designTokensRegistry,\n resolvedCssVariables: resolveCssVariables(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?.experimentalComponents?.carousel) {\n componentRegistry.set(\n CONTENTFUL_COMPONENTS.carousel.id,\n DEFAULT_COMPONENT_REGISTRATIONS.carousel,\n );\n }\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 defineSdkOptions({\n __disableTextAlignmentTransform: !!options?.__disableTextAlignmentTransform,\n __unsafe__enableBuiltInStructureOverwrites:\n !!options?.__unsafe__enableBuiltInStructureOverwrites,\n });\n\n for (const registration of componentRegistrations) {\n if (\n isContentfulStructureComponent(registration.definition.id) &&\n !options?.__unsafe__enableBuiltInStructureOverwrites\n ) {\n debug.warn(\n `[experience-builder-sdk:defineComponents] You are registering a ` +\n `structure component with the reserved id '${registration.definition.id}'. This is not recommended ` +\n `and can lead to unexpected behavior. If you still want to register it, please provide the registry option ` +\n `'__unsafe__enableBuiltInStructureOverwrites' to fully enable built-in structure overwrites.`,\n );\n }\n\n // Fill definitions with fallbacks values\n const enrichedComponentRegistration = enrichComponentDefinition(registration);\n\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: {},\n children: true,\n category: ASSEMBLY_DEFAULT_CATEGORY,\n };\n\n addComponentRegistration({ component, definition });\n\n return componentRegistry.get(definitionId);\n};\n"],"names":["builtInStyleDefinitions"],"mappings":";;;;;;;;AAkCA,MAAM,WAAW,GAAG,iBAAiB,CAAC;AAEtC,MAAM,WAAW,GAAG,CAAI,YAAe,KAAO;AAC5C,IAAA,IAAI,OAAO,eAAe,KAAK,WAAW,EAAE;AAC1C,QAAA,OAAO,eAAe,CAAC,YAAY,CAAC,CAAC;KACtC;IAED,OAAO,IAAI,CAAC,KAAK,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AAE;QACjC,MAAM,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,eAAe,CAAC,oBAAoB,CAAC,CAAC,CAAC;KAC7E;AACH,EAAE;AAYK,MAAM,wBAAwB,GAAG,CAAC,EAAU,KAAK,iBAAiB,CAAC,GAAG,CAAC,EAAE,EAAE;AAErE,MAAA,wBAAwB,GAAG,CAAC,qBAA4C,KAAI;IACvF,iBAAiB,CAAC,GAAG,CAAC,qBAAqB,CAAC,UAAU,CAAC,EAAE,EAAE,qBAAqB,CAAC,CAAC;AACpF,EAAE;AAEK,MAAM,0BAA0B,GAAG,CAAC,EACzC,YAAY,EACZ,cAAc,EACd,SAAS,GAKV,KAAI;IACH,MAAM,qBAAqB,GAAG,iBAAiB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAElE,IAAI,qBAAqB,EAAE;AACzB,QAAA,OAAO,qBAAqB,CAAC;KAC9B;AAED,IAAA,MAAM,UAAU,GAAG;AACjB,QAAA,EAAE,EAAE,YAAY;QAChB,IAAI,EAAE,cAAc,IAAI,WAAW;AACnC,QAAA,SAAS,EAAE,EAAE;AACb,QAAA,QAAQ,EAAE,IAAI;AACd,QAAA,QAAQ,EAAE,yBAAyB;KACpC,CAAC;AAEF,IAAA,wBAAwB,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,CAAC;AAEpD,IAAA,OAAO,iBAAiB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;AAC7C;;;;"}
|
|
1
|
+
{"version":3,"file":"componentRegistry.js","sources":["../../../src/core/componentRegistry.ts"],"sourcesContent":["import * as Components from '@contentful/experiences-components-react';\nimport type {\n ComponentRegistration,\n ComponentDefinition,\n ComponentRegistrationOptions,\n DesignTokensDefinition,\n} from '@contentful/experiences-core/types';\nimport {\n OUTGOING_EVENTS,\n INTERNAL_EVENTS,\n CONTENTFUL_COMPONENTS,\n} from '@contentful/experiences-core/constants';\nimport {\n builtInStyles as builtInStyleDefinitions,\n designTokensRegistry,\n breakpointsRegistry,\n optionalBuiltInStyles,\n sendMessage,\n defineSdkOptions,\n debug,\n isContentfulStructureComponent,\n checkIsAssemblyDefinition,\n createAssemblyDefinition,\n} from '@contentful/experiences-core';\nimport { validateComponentDefinition } from '@contentful/experiences-validators';\nimport { withComponentWrapper } from '../utils/withComponentWrapper';\nimport { SDK_VERSION } from '../constants';\nimport {\n sectionDefinition,\n containerDefinition,\n columnsDefinition,\n singleColumnDefinition,\n dividerDefinition,\n} from '@contentful/experiences-components-react';\n\nconst CssVarRegex = /var\\(--[\\w-]+\\)/;\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 const clone = cloneObject(componentDefinition);\n\n // set margin built-in style by default\n if (!clone.builtInStyles) {\n clone.builtInStyles = ['cfMargin'];\n }\n\n if (!clone.variables) {\n clone.variables = {};\n }\n\n // Enforce the presence of this property for toggling visibility on any node\n clone.variables['cfVisibility'] = builtInStyleDefinitions['cfVisibility'];\n\n for (const style of clone.builtInStyles || []) {\n if (builtInStyleDefinitions[style]) {\n clone.variables[style] = builtInStyleDefinitions[style] as any; // TODO: fix type\n }\n if (optionalBuiltInStyles[style]) {\n clone.variables[style] = optionalBuiltInStyles[style] as any; // TODO: fix type\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 options,\n };\n};\n\nconst DEFAULT_COMPONENT_REGISTRATIONS = {\n container: {\n component: Components.ContentfulContainer,\n definition: containerDefinition,\n options: {\n enableEditorProperties: {\n isEditorMode: true,\n isEmpty: true,\n nodeBlockId: true,\n },\n },\n },\n section: {\n component: Components.ContentfulContainer,\n definition: sectionDefinition,\n options: {\n enableEditorProperties: {\n isEditorMode: true,\n isEmpty: true,\n nodeBlockId: true,\n },\n },\n },\n columns: {\n component: Components.Columns,\n definition: columnsDefinition,\n },\n singleColumn: {\n component: Components.SingleColumn,\n definition: singleColumnDefinition,\n options: {\n enableEditorProperties: {\n isEditorMode: true,\n isEmpty: true,\n },\n },\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 options: { wrapComponent: false },\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 divider: enrichComponentDefinition({\n component: Components.ContentfulDivider,\n definition: dividerDefinition,\n options: {\n wrapComponent: false,\n },\n }),\n carousel: enrichComponentDefinition({\n component: Components.Carousel,\n definition: Components.carouselDefinition,\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 [DEFAULT_COMPONENT_REGISTRATIONS.divider.definition.id, DEFAULT_COMPONENT_REGISTRATIONS.divider],\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 DEFAULT_COMPONENT_REGISTRATIONS.divider.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 .map(({ definition }) => definition)\n // Assembly definitions are empty placeholder within the SDK without variables\n // We don't send those to the editor as they would overwrite the actual correct definitions.\n .filter((definition) => !checkIsAssemblyDefinition(definition));\n\n sendMessage(OUTGOING_EVENTS.RegisteredComponents, {\n definitions: registeredDefinitions,\n });\n};\n\nexport const runRegisteredComponentValidations = () => {\n Array.from(componentRegistry.values()).map(({ definition }) => {\n const validation = validateComponentDefinition(definition);\n if (!validation.success) {\n throw new Error(\n `Invalid component definition for component '${definition.name}'. Failed with errors: \\n${JSON.stringify(validation.errors, null, 2)}`,\n );\n }\n });\n};\n\nconst getSingleCssVariableValue = (\n element: HTMLDivElement,\n cssVariableValue: string,\n cssAttribute: any,\n) => {\n element.style[cssAttribute] = cssVariableValue;\n const styles = getComputedStyle(element);\n const resolvedValue = styles.getPropertyValue(cssAttribute);\n return resolvedValue;\n};\n\nconst getAllCssVariableValues = (\n element: HTMLDivElement,\n cssVariable: Record<string, string>,\n cssAttribute: any,\n) => {\n const resolvedCssVariables = {} as Record<string, string>;\n\n Object.keys(cssVariable).forEach((key) => {\n const cssVariableValue = cssVariable[key];\n if (CssVarRegex.test(cssVariableValue)) {\n const resolvedValue = getSingleCssVariableValue(element, cssVariableValue, cssAttribute);\n resolvedCssVariables[cssVariableValue] = resolvedValue;\n }\n });\n return resolvedCssVariables;\n};\n\ntype CssMapType = {\n variable?: Record<string, string>;\n property: string;\n};\n\nconst resolveCssVariables = (designTokensDefinition: DesignTokensDefinition) => {\n const {\n spacing,\n sizing,\n color,\n borderRadius,\n fontSize,\n lineHeight,\n letterSpacing,\n textColor,\n border,\n } = designTokensDefinition;\n const resolvedCssVariables = {} as Record<string, string>;\n\n // Create an element\n const element = document.createElement('div');\n document.body.appendChild(element);\n\n const cssProperties: CssMapType[] = [\n { variable: spacing, property: 'margin' },\n { variable: sizing, property: 'width' },\n { variable: color, property: 'background-color' },\n { variable: borderRadius, property: 'border-radius' },\n { variable: fontSize, property: 'font-size' },\n { variable: lineHeight, property: 'line-height' },\n { variable: letterSpacing, property: 'letter-spacing' },\n { variable: textColor, property: 'color' },\n ];\n\n cssProperties.forEach(({ variable, property }) => {\n if (variable) {\n const rawResolvedValues = getAllCssVariableValues(element, variable, property);\n Object.assign(resolvedCssVariables, rawResolvedValues);\n }\n });\n\n if (border) {\n const tempResolvedValue = {} as Record<string, string>;\n Object.keys(border).forEach((borderKey) => {\n const { width, style, color } = border[borderKey];\n\n if (width && CssVarRegex.test(width)) {\n const resolvedValue = getSingleCssVariableValue(element, width, 'border-width');\n tempResolvedValue[width] = resolvedValue;\n }\n if (style && CssVarRegex.test(style)) {\n const resolvedValue = getSingleCssVariableValue(element, style, 'border-style');\n tempResolvedValue[style] = resolvedValue;\n }\n if (color && CssVarRegex.test(color)) {\n const resolvedValue = getSingleCssVariableValue(element, color, 'border-color');\n tempResolvedValue[color] = resolvedValue;\n }\n Object.assign(resolvedCssVariables, tempResolvedValue);\n });\n }\n\n document.body.removeChild(element);\n return resolvedCssVariables;\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.RegisteredBreakpoints, {\n breakpoints: breakpointsRegistry,\n });\n\n sendMessage(OUTGOING_EVENTS.DesignTokens, {\n designTokens: designTokensRegistry,\n resolvedCssVariables: resolveCssVariables(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?.experimentalComponents?.carousel) {\n componentRegistry.set(\n CONTENTFUL_COMPONENTS.carousel.id,\n DEFAULT_COMPONENT_REGISTRATIONS.carousel,\n );\n }\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 defineSdkOptions({\n __disableTextAlignmentTransform: !!options?.__disableTextAlignmentTransform,\n __unsafe__enableBuiltInStructureOverwrites:\n !!options?.__unsafe__enableBuiltInStructureOverwrites,\n });\n\n for (const registration of componentRegistrations) {\n if (\n isContentfulStructureComponent(registration.definition.id) &&\n !options?.__unsafe__enableBuiltInStructureOverwrites\n ) {\n debug.warn(\n `[experience-builder-sdk:defineComponents] You are registering a ` +\n `structure component with the reserved id '${registration.definition.id}'. This is not recommended ` +\n `and can lead to unexpected behavior. If you still want to register it, please provide the registry option ` +\n `'__unsafe__enableBuiltInStructureOverwrites' to fully enable built-in structure overwrites.`,\n );\n }\n\n // Fill definitions with fallbacks values\n const enrichedComponentRegistration = enrichComponentDefinition(registration);\n\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 component,\n}: {\n definitionId: string;\n component: ComponentRegistration['component'];\n}) => {\n const componentRegistration = componentRegistry.get(definitionId);\n\n if (componentRegistration) {\n return componentRegistration;\n }\n\n const definition = createAssemblyDefinition(definitionId);\n\n addComponentRegistration({ component, definition });\n\n return componentRegistry.get(definitionId);\n};\n"],"names":["builtInStyleDefinitions"],"mappings":";;;;;;;;AAmCA,MAAM,WAAW,GAAG,iBAAiB,CAAC;AAEtC,MAAM,WAAW,GAAG,CAAI,YAAe,KAAO;AAC5C,IAAA,IAAI,OAAO,eAAe,KAAK,WAAW,EAAE;AAC1C,QAAA,OAAO,eAAe,CAAC,YAAY,CAAC,CAAC;KACtC;IAED,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC;AAClD,CAA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BAAoB,CAAC,CAAC,CAAC;KAC7E;AACH,EAAE;AAYK,MAAM,wBAAwB,GAAG,CAAC,EAAU,KAAK,iBAAiB,CAAC,GAAG,CAAC,EAAE,EAAE;AAErE,MAAA,wBAAwB,GAAG,CAAC,qBAA4C,KAAI;IACvF,iBAAiB,CAAC,GAAG,CAAC,qBAAqB,CAAC,UAAU,CAAC,EAAE,EAAE,qBAAqB,CAAC,CAAC;AACpF,EAAE;AAEW,MAAA,0BAA0B,GAAG,CAAC,EACzC,YAAY,EACZ,SAAS,GAIV,KAAI;IACH,MAAM,qBAAqB,GAAG,iBAAiB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAElE,IAAI,qBAAqB,EAAE;AACzB,QAAA,OAAO,qBAAqB,CAAC;KAC9B;AAED,IAAA,MAAM,UAAU,GAAG,wBAAwB,CAAC,YAAY,CAAC,CAAC;AAE1D,IAAA,wBAAwB,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,CAAC;AAEpD,IAAA,OAAO,iBAAiB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;AAC7C;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import * as _contentful_experiences_core_constants from '@contentful/experiences
|
|
|
9
9
|
export { CF_STYLE_ATTRIBUTES, CONTENTFUL_COMPONENTS, LATEST_SCHEMA_VERSION } from '@contentful/experiences-core/constants';
|
|
10
10
|
import { ContentfulClientApi } from 'contentful';
|
|
11
11
|
|
|
12
|
-
declare const SDK_VERSION = "3.7.0-dev-
|
|
12
|
+
declare const SDK_VERSION = "3.7.0-dev-20250919T1400-8d76591.0";
|
|
13
13
|
|
|
14
14
|
type ExperienceRootProps = {
|
|
15
15
|
experience?: Experience<EntityStore> | string | null;
|
package/dist/sdkVersion.js
CHANGED
package/dist/sdkVersion.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdkVersion.js","sources":["../../src/sdkVersion.ts"],"sourcesContent":["export const SDK_VERSION = '3.7.0-dev-
|
|
1
|
+
{"version":3,"file":"sdkVersion.js","sources":["../../src/sdkVersion.ts"],"sourcesContent":["export const SDK_VERSION = '3.7.0-dev-20250919T1400-8d76591.0';\n"],"names":[],"mappings":"AAAO,MAAM,WAAW,GAAG;;;;"}
|
|
@@ -17,8 +17,7 @@ export declare const defineComponents: (componentRegistrations: ComponentRegistr
|
|
|
17
17
|
export declare const resetComponentRegistry: () => void;
|
|
18
18
|
export declare const getComponentRegistration: (id: string) => ComponentRegistration | undefined;
|
|
19
19
|
export declare const addComponentRegistration: (componentRegistration: ComponentRegistration) => void;
|
|
20
|
-
export declare const createAssemblyRegistration: ({ definitionId,
|
|
20
|
+
export declare const createAssemblyRegistration: ({ definitionId, component, }: {
|
|
21
21
|
definitionId: string;
|
|
22
|
-
definitionName?: string;
|
|
23
22
|
component: ComponentRegistration["component"];
|
|
24
23
|
}) => ComponentRegistration | undefined;
|
package/dist/src/sdkVersion.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "3.7.0-dev-
|
|
1
|
+
export declare const SDK_VERSION = "3.7.0-dev-20250919T1400-8d76591.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experiences-sdk-react",
|
|
3
|
-
"version": "3.7.0-dev-
|
|
3
|
+
"version": "3.7.0-dev-20250919T1400-8d76591.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": "3.7.0-dev-
|
|
45
|
-
"@contentful/experiences-core": "3.7.0-dev-
|
|
46
|
-
"@contentful/experiences-validators": "3.7.0-dev-
|
|
47
|
-
"@contentful/experiences-visual-editor-react": "3.7.0-dev-
|
|
44
|
+
"@contentful/experiences-components-react": "3.7.0-dev-20250919T1400-8d76591.0",
|
|
45
|
+
"@contentful/experiences-core": "3.7.0-dev-20250919T1400-8d76591.0",
|
|
46
|
+
"@contentful/experiences-validators": "3.7.0-dev-20250919T1400-8d76591.0",
|
|
47
|
+
"@contentful/experiences-visual-editor-react": "3.7.0-dev-20250919T1400-8d76591.0",
|
|
48
48
|
"@contentful/rich-text-types": "^17.0.0",
|
|
49
49
|
"csstype": "^3.1.2",
|
|
50
50
|
"immer": "^10.0.3",
|
|
@@ -95,5 +95,5 @@
|
|
|
95
95
|
"dist",
|
|
96
96
|
"package.json"
|
|
97
97
|
],
|
|
98
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "5e7638afea05af4aca5130f77907c4733482a85f"
|
|
99
99
|
}
|