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

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/README.md CHANGED
@@ -81,14 +81,12 @@ const Home = () => {
81
81
  // You could pull these values from your router, state, etc...
82
82
  const localeCode = 'en-US'; // the initial locale to use
83
83
  const slug = 'homePage'; // the slug of the experience to fetch
84
- const mode = 'delivery'; // 'delivery' or 'preview'
85
84
  const experienceTypeId = 'layout'; // the content id of the experience to fetch
86
85
 
87
86
  // 3. Fetch the experience
88
87
  const { experience, error, isLoading } = useFetchBySlug({
89
88
  client,
90
89
  slug,
91
- mode,
92
90
  experienceTypeId,
93
91
  localeCode,
94
92
  });
package/dist/index.d.ts CHANGED
@@ -2,89 +2,20 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { EntityStore, VisualEditorMode } from '@contentful/experiences-core';
3
3
  export { EntityStore, VisualEditorMode, calculateNodeDefaultHeight, checkIsAssembly, checkIsAssemblyEntry, checkIsAssemblyNode, createExperience, defineDesignTokens, fetchById, fetchBySlug, supportedModes } from '@contentful/experiences-core';
4
4
  import * as _contentful_experiences_core_types from '@contentful/experiences-core/types';
5
- import { Experience, DeprecatedExperience, ExternalSDKMode, ComponentRegistration, ComponentRegistrationOptions } from '@contentful/experiences-core/types';
5
+ import { Experience, ComponentRegistration, ComponentRegistrationOptions } from '@contentful/experiences-core/types';
6
6
  export { ComponentDefinition, ExternalSDKMode, InternalSDKMode } from '@contentful/experiences-core/types';
7
- import { ContentfulClientApi } from 'contentful';
8
7
  import * as _contentful_experiences_core_dist_entity_EntityStore from '@contentful/experiences-core/dist/entity/EntityStore';
9
- export { ASSEMBLY_BLOCK_NODE_TYPE, ASSEMBLY_NODE_TYPE, ASSEMBLY_NODE_TYPES, CF_STYLE_ATTRIBUTES, CONTENTFUL_COMPONENTS, CONTENTFUL_COMPONENT_CATEGORY, CONTENTFUL_CONTAINER_ID, CONTENTFUL_SECTION_ID, DESIGN_COMPONENT_BLOCK_NODE_TYPE, DESIGN_COMPONENT_NODE_TYPE, DESIGN_COMPONENT_NODE_TYPES, INCOMING_EVENTS, LATEST_SCHEMA_VERSION, OUTGOING_EVENTS, SCROLL_STATES } from '@contentful/experiences-core/constants';
8
+ import { ContentfulClientApi } from 'contentful';
9
+ export { ASSEMBLY_BLOCK_NODE_TYPE, ASSEMBLY_NODE_TYPE, ASSEMBLY_NODE_TYPES, CF_STYLE_ATTRIBUTES, CONTENTFUL_COMPONENTS, CONTENTFUL_COMPONENT_CATEGORY, INCOMING_EVENTS, LATEST_SCHEMA_VERSION, OUTGOING_EVENTS, SCROLL_STATES } from '@contentful/experiences-core/constants';
10
10
 
11
11
  type ExperienceRootProps = {
12
- experience?: Experience<EntityStore> | DeprecatedExperience;
12
+ experience?: Experience<EntityStore>;
13
13
  locale: string;
14
- /**
15
- * @deprecated
16
- */
17
- slug?: string;
18
14
  visualEditorMode?: VisualEditorMode;
19
15
  };
20
- declare const ExperienceRoot: ({ locale, experience, slug, visualEditorMode, }: ExperienceRootProps) => react_jsx_runtime.JSX.Element | null;
21
-
22
- type UseExperienceBuilderProps = {
23
- /**
24
- * Id of the content type of the target experience
25
- */
26
- experienceTypeId: string;
27
- /**
28
- * Instance of a Delivery or Preview client from "contentful" package
29
- */
30
- client: ContentfulClientApi<undefined>;
31
- /**
32
- * Mode defines the behaviour of the sdk.
33
- * - `preview` - fetching and rendering draft data. Will automatically switch to `editor` mode if open from contentful web app.
34
- * - `delivery` - fetching and rendering of published data. Can not be switched to `editor` mode. */
35
- mode?: ExternalSDKMode;
36
- };
37
- /**
38
- * @deprecated This hook is deprecated. Use fetchBySlug or fetchById instead
39
- */
40
- declare const useExperienceBuilder: ({ experienceTypeId, client, mode, }: UseExperienceBuilderProps) => {
41
- /**
42
- * @deprecated please fetch the experience using `useFetchExperience` hook or fetch the data manually using `fetchers` or `client` and create experience with `createExperience` function
43
- *
44
- * @example
45
- *
46
- * import { useFetchExperience } from '@contentful/experiences-sdk-react'
47
- *
48
- * const { fetchBySlug, fetchById, experience, isFetching } = useFetchExperience({ client, mode })
49
- */
50
- experience: DeprecatedExperience;
51
- /**
52
- * @deprecated please import the function from the library
53
- *
54
- * @example
55
- *
56
- * import { defineComponents } from '@contentful/experiences-sdk-react'
57
- */
58
- defineComponents: (componentRegistrations: _contentful_experiences_core_types.ComponentRegistration[], options?: _contentful_experiences_core_types.ComponentRegistrationOptions | undefined) => void;
59
- };
60
-
61
- type useClientsideExperienceFetchersProps = {
62
- /** @deprecated mode no longer required */
63
- mode?: ExternalSDKMode;
64
- client: ContentfulClientApi<undefined>;
65
- };
66
- /**
67
- * @deprecated please use `useFetchBySlug` or `useFetchById` hooks instead
68
- */
69
- declare const useFetchExperience: ({ client }: useClientsideExperienceFetchersProps) => {
70
- fetchBySlug: ({ experienceTypeId, slug, localeCode, }: {
71
- experienceTypeId: string;
72
- slug: string;
73
- localeCode: string;
74
- }) => Promise<Experience<EntityStore> | undefined>;
75
- fetchById: ({ experienceTypeId, id, localeCode, }: {
76
- experienceTypeId: string;
77
- id: string;
78
- localeCode: string;
79
- }) => Promise<Experience<EntityStore> | undefined>;
80
- error: Error | undefined;
81
- experience: Experience<EntityStore> | undefined;
82
- isFetching: boolean;
83
- };
16
+ declare const ExperienceRoot: ({ locale, experience, visualEditorMode, }: ExperienceRootProps) => react_jsx_runtime.JSX.Element | null;
84
17
 
85
18
  type UseFetchByIdArgs = {
86
- /** @deprecated mode no longer used */
87
- mode?: ExternalSDKMode;
88
19
  client: ContentfulClientApi<undefined>;
89
20
  id: string;
90
21
  experienceTypeId: string;
@@ -98,8 +29,6 @@ declare const useFetchById: ({ id, localeCode, client, experienceTypeId }: UseFe
98
29
  };
99
30
 
100
31
  type UseFetchBySlugArgs = {
101
- /** @deprecated mode no longer needed */
102
- mode?: ExternalSDKMode;
103
32
  client: ContentfulClientApi<undefined>;
104
33
  slug: string;
105
34
  experienceTypeId: string;
@@ -119,4 +48,4 @@ declare const useFetchBySlug: ({ slug, localeCode, client, experienceTypeId, }:
119
48
  */
120
49
  declare const defineComponents: (componentRegistrations: ComponentRegistration[], options?: ComponentRegistrationOptions) => void;
121
50
 
122
- export { ExperienceRoot, defineComponents, useExperienceBuilder, useFetchById, useFetchBySlug, useFetchExperience };
51
+ export { ExperienceRoot, defineComponents, useFetchById, useFetchBySlug };
package/dist/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
- import { containerDefinition, sectionDefinition, columnsDefinition, singleColumnDefinition, builtInStyles, optionalBuiltInStyles, sendMessage, designTokensRegistry, buildStyleTag, checkIsAssemblyNode, isDeepPath, transformContentValue, buildCfStyles, isEmptyStructureWithRelativeHeight, mediaQueryMatcher, getFallbackBreakpointIndex, getActiveBreakpointIndex, getValueForBreakpoint, fetchBySlug, fetchById, doesMismatchMessageSchema, tryParseMessage, validateExperienceBuilderConfig, isDeprecatedExperience, VisualEditorMode } from '@contentful/experiences-core';
2
+ import { containerDefinition, sectionDefinition, columnsDefinition, singleColumnDefinition, builtInStyles, optionalBuiltInStyles, sendMessage, designTokensRegistry, buildStyleTag, checkIsAssemblyNode, isDeepPath, transformContentValue, buildCfStyles, isEmptyStructureWithRelativeHeight, mediaQueryMatcher, getFallbackBreakpointIndex, getActiveBreakpointIndex, getValueForBreakpoint, doesMismatchMessageSchema, tryParseMessage, fetchById, fetchBySlug, validateExperienceBuilderConfig, VisualEditorMode } from '@contentful/experiences-core';
3
3
  export { EntityStore, VisualEditorMode, calculateNodeDefaultHeight, checkIsAssembly, checkIsAssemblyEntry, checkIsAssemblyNode, createExperience, defineDesignTokens, fetchById, fetchBySlug, supportedModes } from '@contentful/experiences-core';
4
4
  import React, { useState, useEffect, useMemo, useCallback, useRef, Suspense } from 'react';
5
5
  import { omit } from 'lodash-es';
6
6
  import { INTERNAL_EVENTS, CONTENTFUL_COMPONENTS, OUTGOING_EVENTS, ASSEMBLY_DEFAULT_CATEGORY, EMPTY_CONTAINER_HEIGHT, CF_STYLE_ATTRIBUTES, INCOMING_EVENTS, VISUAL_EDITOR_EVENTS } from '@contentful/experiences-core/constants';
7
- export { ASSEMBLY_BLOCK_NODE_TYPE, ASSEMBLY_NODE_TYPE, ASSEMBLY_NODE_TYPES, CF_STYLE_ATTRIBUTES, CONTENTFUL_COMPONENTS, CONTENTFUL_COMPONENT_CATEGORY, CONTENTFUL_CONTAINER_ID, CONTENTFUL_SECTION_ID, DESIGN_COMPONENT_BLOCK_NODE_TYPE, DESIGN_COMPONENT_NODE_TYPE, DESIGN_COMPONENT_NODE_TYPES, INCOMING_EVENTS, LATEST_SCHEMA_VERSION, OUTGOING_EVENTS, SCROLL_STATES } from '@contentful/experiences-core/constants';
7
+ export { ASSEMBLY_BLOCK_NODE_TYPE, ASSEMBLY_NODE_TYPE, ASSEMBLY_NODE_TYPES, CF_STYLE_ATTRIBUTES, CONTENTFUL_COMPONENTS, CONTENTFUL_COMPONENT_CATEGORY, INCOMING_EVENTS, LATEST_SCHEMA_VERSION, OUTGOING_EVENTS, SCROLL_STATES } from '@contentful/experiences-core/constants';
8
8
  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.1';
12
+ const SDK_VERSION = '0.0.1-alpha.2';
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.
@@ -423,37 +423,6 @@ const CompositionBlock = ({ node: rawNode, locale, entityStore, resolveDesignVal
423
423
  }, children);
424
424
  };
425
425
 
426
- /**
427
- * @deprecated This hook is deprecated. Use fetchBySlug or fetchById instead
428
- */
429
- const useExperienceBuilder = ({ experienceTypeId, client, mode = 'delivery', }) => {
430
- const experience = useMemo(() => ({
431
- client,
432
- experienceTypeId,
433
- mode,
434
- }), [mode, client, experienceTypeId]);
435
- return {
436
- /**
437
- * @deprecated please fetch the experience using `useFetchExperience` hook or fetch the data manually using `fetchers` or `client` and create experience with `createExperience` function
438
- *
439
- * @example
440
- *
441
- * import { useFetchExperience } from '@contentful/experiences-sdk-react'
442
- *
443
- * const { fetchBySlug, fetchById, experience, isFetching } = useFetchExperience({ client, mode })
444
- */
445
- experience,
446
- /**
447
- * @deprecated please import the function from the library
448
- *
449
- * @example
450
- *
451
- * import { defineComponents } from '@contentful/experiences-sdk-react'
452
- */
453
- defineComponents,
454
- };
455
- };
456
-
457
426
  // TODO: In order to support integrations without React, we should extract this heavy logic into simple
458
427
  // functions that we can reuse in other frameworks.
459
428
  /*
@@ -489,74 +458,6 @@ const useBreakpoints = (breakpoints) => {
489
458
  return { resolveDesignValue };
490
459
  };
491
460
 
492
- /**
493
- * @deprecated please use `useFetchBySlug` or `useFetchById` hooks instead
494
- */
495
- const useFetchExperience = ({ client }) => {
496
- const [experience, setExperience] = useState(undefined);
497
- const [isFetching, setIsFetching] = useState(false);
498
- const [error, setError] = useState();
499
- /**
500
- * Fetch experience entry using slug as the identifier
501
- * @param {string} experienceTypeId - id of the content type associated with the experience
502
- * @param {string} slug - slug of the experience (defined in entry settings)
503
- * @param {string} localeCode - locale code to fetch the experience. Falls back to the currently active locale in the state
504
- */
505
- const fetchBySlug$1 = useCallback(async ({ experienceTypeId, slug, localeCode, }) => {
506
- setIsFetching(true);
507
- setError(undefined);
508
- try {
509
- const experience = await fetchBySlug({
510
- client,
511
- experienceTypeId,
512
- localeCode,
513
- slug,
514
- });
515
- setExperience(experience);
516
- return experience;
517
- }
518
- catch (error) {
519
- setError(error);
520
- }
521
- finally {
522
- setIsFetching(false);
523
- }
524
- }, [client]);
525
- /**
526
- * Fetch experience entry using id as the identifier
527
- * @param {string} experienceTypeId - id of the content type associated with the experience
528
- * @param {string} id - id of the experience (defined in entry settings)
529
- * @param {string} localeCode - locale code to fetch the experience. Falls back to the currently active locale in the state
530
- */
531
- const fetchById$1 = useCallback(async ({ experienceTypeId, id, localeCode, }) => {
532
- setIsFetching(true);
533
- setError(undefined);
534
- try {
535
- const experience = await fetchById({
536
- client,
537
- experienceTypeId,
538
- localeCode,
539
- id,
540
- });
541
- setExperience(experience);
542
- return experience;
543
- }
544
- catch (error) {
545
- setError(error);
546
- }
547
- finally {
548
- setIsFetching(false);
549
- }
550
- }, [client]);
551
- return {
552
- fetchBySlug: fetchBySlug$1,
553
- fetchById: fetchById$1,
554
- error,
555
- experience,
556
- isFetching,
557
- };
558
- };
559
-
560
461
  const useFetchByBase = (fetchMethod, isEditorMode) => {
561
462
  const [experience, setExperience] = useState();
562
463
  const [isLoading, setIsLoading] = useState(false);
@@ -657,68 +558,6 @@ const useFetchBySlug = ({ slug, localeCode, client, experienceTypeId, }) => {
657
558
  return useFetchByBase(fetchMethod, isEditorMode);
658
559
  };
659
560
 
660
- /**
661
- * Returns the value of the argument from the previous render
662
- * @param {T} value
663
- * @returns {T | undefined} previous value
664
- */
665
- function usePrevious(value) {
666
- const ref = useRef();
667
- useEffect(() => {
668
- ref.current = value;
669
- }, [value]);
670
- return ref.current;
671
- }
672
-
673
- /**
674
- * @deprecated Remove after the BETA release
675
- * @returns
676
- */
677
- const DeprecatedPreviewDeliveryRoot = ({ locale, slug, deprecatedExperience, }) => {
678
- const attemptedToFetch = useRef(false);
679
- const previousLocale = usePrevious(locale);
680
- const { experienceTypeId, client } = deprecatedExperience;
681
- const { fetchBySlug, experience, isFetching } = useFetchExperience({
682
- client,
683
- });
684
- const entityStore = experience?.entityStore;
685
- useEffect(() => {
686
- // TODO: Test it, it is crucial
687
- // will make it fetch on each locale change as well as if experience entry hasn't been fetched yet at least once
688
- const shouldFetch = (client && !entityStore && !attemptedToFetch.current) || previousLocale !== locale;
689
- // this useEffect is meant to trigger fetching for the first time if it hasn't been done earlier
690
- // if not yet fetched and not fetchin at the moment
691
- if (shouldFetch && !isFetching && slug) {
692
- attemptedToFetch.current = true;
693
- fetchBySlug({
694
- experienceTypeId,
695
- localeCode: locale,
696
- slug,
697
- }).catch(() => {
698
- // noop
699
- });
700
- }
701
- }, [
702
- experienceTypeId,
703
- entityStore,
704
- isFetching,
705
- fetchBySlug,
706
- client,
707
- slug,
708
- locale,
709
- previousLocale,
710
- ]);
711
- const { resolveDesignValue } = useBreakpoints(entityStore?.breakpoints ?? []);
712
- if (!entityStore?.experienceEntryFields || !entityStore?.schemaVersion) {
713
- return null;
714
- }
715
- if (!compatibleVersions.includes(entityStore.schemaVersion)) {
716
- console.warn(`[experiences-sdk-react] Contenful composition schema version: ${entityStore.schemaVersion} does not match the compatible schema versions: ${compatibleVersions}. Aborting.`);
717
- return null;
718
- }
719
- return (jsx(Fragment, { children: entityStore.experienceEntryFields.componentTree.children.map((childNode, index) => (jsx(CompositionBlock, { node: childNode, locale: locale, entityStore: entityStore, resolveDesignValue: resolveDesignValue }, index))) }));
720
- };
721
-
722
561
  const PreviewDeliveryRoot = ({ locale, experience }) => {
723
562
  const { entityStore } = experience;
724
563
  const { resolveDesignValue } = useBreakpoints(entityStore?.breakpoints ?? []);
@@ -830,21 +669,18 @@ const VisualEditorRoot = ({ visualEditorMode, initialEntities, initialLocale, })
830
669
  return (jsx(ErrorBoundary, { children: jsx(Suspense, { fallback: jsx("div", { children: "Loading..." }), children: jsx(VisualEditorLoader, { visualEditorMode: visualEditorMode }) }) }));
831
670
  };
832
671
 
833
- const ExperienceRoot = ({ locale, experience, slug, visualEditorMode = VisualEditorMode.LazyLoad, }) => {
672
+ const ExperienceRoot = ({ locale, experience, visualEditorMode = VisualEditorMode.LazyLoad, }) => {
834
673
  const isEditorMode = useDetectEditorMode();
835
674
  validateExperienceBuilderConfig({
836
675
  locale,
837
676
  isEditorMode,
838
677
  });
839
678
  if (isEditorMode) {
840
- const entityStore = experience && !isDeprecatedExperience(experience) ? experience.entityStore : undefined;
679
+ const entityStore = experience?.entityStore;
841
680
  return (jsx(VisualEditorRoot, { visualEditorMode: visualEditorMode, initialEntities: entityStore?.entities || [], initialLocale: locale }));
842
681
  }
843
682
  if (!experience)
844
683
  return null;
845
- if (isDeprecatedExperience(experience)) {
846
- return (jsx(DeprecatedPreviewDeliveryRoot, { deprecatedExperience: experience, locale: locale, slug: slug }));
847
- }
848
684
  return jsx(PreviewDeliveryRoot, { locale: locale, experience: experience });
849
685
  };
850
686
 
@@ -855,5 +691,5 @@ if (typeof window !== 'undefined') {
855
691
  };
856
692
  }
857
693
 
858
- export { ExperienceRoot, defineComponents, useExperienceBuilder, useFetchById, useFetchBySlug, useFetchExperience };
694
+ export { ExperienceRoot, defineComponents, useFetchById, useFetchBySlug };
859
695
  //# sourceMappingURL=index.js.map
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/useExperienceBuilder.ts","../../src/hooks/useBreakpoints.ts","../../src/hooks/useFetchExperience.ts","../../src/hooks/useFetchByBase.ts","../../src/hooks/useDetectEditorMode.tsx","../../src/hooks/useFetchById.ts","../../src/hooks/useFetchBySlug.ts","../../src/hooks/usePrevious.ts","../../src/blocks/preview/DeprecatedPreviewDeliveryRoot.tsx","../../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.1';\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 { useMemo } from 'react';\nimport type { DeprecatedExperience, ExternalSDKMode } from '@contentful/experiences-core/types';\nimport type { ContentfulClientApi } from 'contentful';\nimport { defineComponents } from '../core/componentRegistry';\n\ntype UseExperienceBuilderProps = {\n /**\n * Id of the content type of the target experience\n */\n experienceTypeId: string;\n /**\n * Instance of a Delivery or Preview client from \"contentful\" package\n */\n client: ContentfulClientApi<undefined>;\n /**\n * Mode defines the behaviour of the sdk.\n * - `preview` - fetching and rendering draft data. Will automatically switch to `editor` mode if open from contentful web app.\n * - `delivery` - fetching and rendering of published data. Can not be switched to `editor` mode. */\n mode?: ExternalSDKMode;\n};\n\n/**\n * @deprecated This hook is deprecated. Use fetchBySlug or fetchById instead\n */\nexport const useExperienceBuilder = ({\n experienceTypeId,\n client,\n mode = 'delivery',\n}: UseExperienceBuilderProps) => {\n const experience = useMemo<DeprecatedExperience>(\n () => ({\n client,\n experienceTypeId,\n mode,\n }),\n [mode, client, experienceTypeId],\n );\n\n return {\n /**\n * @deprecated please fetch the experience using `useFetchExperience` hook or fetch the data manually using `fetchers` or `client` and create experience with `createExperience` function\n *\n * @example\n *\n * import { useFetchExperience } from '@contentful/experiences-sdk-react'\n *\n * const { fetchBySlug, fetchById, experience, isFetching } = useFetchExperience({ client, mode })\n */\n experience,\n /**\n * @deprecated please import the function from the library\n *\n * @example\n *\n * import { defineComponents } from '@contentful/experiences-sdk-react'\n */\n defineComponents,\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 type { ContentfulClientApi } from 'contentful';\nimport { useCallback, useState } from 'react';\nimport {\n EntityStore,\n fetchBySlug as fetchBySlugCore,\n fetchById as fetchByIdCore,\n} from '@contentful/experiences-core';\nimport { Experience, ExternalSDKMode } from '@contentful/experiences-core/types';\n\ntype useClientsideExperienceFetchersProps = {\n /** @deprecated mode no longer required */\n mode?: ExternalSDKMode;\n client: ContentfulClientApi<undefined>;\n};\n\n/**\n * @deprecated please use `useFetchBySlug` or `useFetchById` hooks instead\n */\nexport const useFetchExperience = ({ client }: useClientsideExperienceFetchersProps) => {\n const [experience, setExperience] = useState<Experience<EntityStore> | undefined>(undefined);\n const [isFetching, setIsFetching] = useState(false);\n const [error, setError] = useState<Error>();\n\n /**\n * Fetch experience entry using slug as the identifier\n * @param {string} experienceTypeId - id of the content type associated with the experience\n * @param {string} slug - slug of the experience (defined in entry settings)\n * @param {string} localeCode - locale code to fetch the experience. Falls back to the currently active locale in the state\n */\n const fetchBySlug = useCallback(\n async ({\n experienceTypeId,\n slug,\n localeCode,\n }: {\n experienceTypeId: string;\n slug: string;\n localeCode: string;\n }): Promise<Experience<EntityStore> | undefined> => {\n setIsFetching(true);\n setError(undefined);\n try {\n const experience = await fetchBySlugCore({\n client,\n experienceTypeId,\n localeCode,\n slug,\n });\n\n setExperience(experience);\n\n return experience;\n } catch (error) {\n setError(error as Error);\n } finally {\n setIsFetching(false);\n }\n },\n [client],\n );\n\n /**\n * Fetch experience entry using id as the identifier\n * @param {string} experienceTypeId - id of the content type associated with the experience\n * @param {string} id - id of the experience (defined in entry settings)\n * @param {string} localeCode - locale code to fetch the experience. Falls back to the currently active locale in the state\n */\n const fetchById = useCallback(\n async ({\n experienceTypeId,\n id,\n localeCode,\n }: {\n experienceTypeId: string;\n id: string;\n localeCode: string;\n }): Promise<Experience<EntityStore> | undefined> => {\n setIsFetching(true);\n setError(undefined);\n try {\n const experience = await fetchByIdCore({\n client,\n experienceTypeId,\n localeCode,\n id,\n });\n\n setExperience(experience);\n return experience;\n } catch (error) {\n setError(error as Error);\n } finally {\n setIsFetching(false);\n }\n },\n [client],\n );\n\n return {\n fetchBySlug,\n fetchById,\n error,\n experience,\n isFetching,\n };\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 type { ExternalSDKMode } from '@contentful/experiences-core/types';\nimport { useFetchByBase } from './useFetchByBase';\nimport { fetchById } from '@contentful/experiences-core';\nimport { useDetectEditorMode } from './useDetectEditorMode';\n\nexport type UseFetchByIdArgs = {\n /** @deprecated mode no longer used */\n mode?: ExternalSDKMode;\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 type { ExternalSDKMode } from '@contentful/experiences-core/types';\nimport { useFetchByBase } from './useFetchByBase';\nimport { fetchBySlug } from '@contentful/experiences-core';\nimport { useDetectEditorMode } from './useDetectEditorMode';\n\nexport type UseFetchBySlugArgs = {\n /** @deprecated mode no longer needed */\n mode?: ExternalSDKMode;\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 { useEffect, useRef } from 'react';\n\n/**\n * Returns the value of the argument from the previous render\n * @param {T} value\n * @returns {T | undefined} previous value\n */\nexport function usePrevious<T>(value: T): T | undefined {\n const ref = useRef<T>();\n\n useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref.current;\n}\n","import React, { useEffect, useRef } from 'react';\nimport type { DeprecatedExperience } from '@contentful/experiences-core/types';\nimport { CompositionBlock } from './CompositionBlock';\nimport { compatibleVersions } from '../../constants';\nimport { useBreakpoints, useFetchExperience } from '../../hooks';\nimport { usePrevious } from '../../hooks/usePrevious';\n\ntype DeprecatedPreviewDeliveryRootProps = {\n deprecatedExperience: DeprecatedExperience;\n locale: string;\n slug?: string;\n};\n\n/**\n * @deprecated Remove after the BETA release\n * @returns\n */\nexport const DeprecatedPreviewDeliveryRoot = ({\n locale,\n slug,\n deprecatedExperience,\n}: DeprecatedPreviewDeliveryRootProps) => {\n const attemptedToFetch = useRef<boolean>(false);\n const previousLocale = usePrevious(locale);\n\n const { experienceTypeId, client } = deprecatedExperience;\n\n const { fetchBySlug, experience, isFetching } = useFetchExperience({\n client,\n });\n\n const entityStore = experience?.entityStore;\n\n useEffect(() => {\n // TODO: Test it, it is crucial\n // will make it fetch on each locale change as well as if experience entry hasn't been fetched yet at least once\n const shouldFetch =\n (client && !entityStore && !attemptedToFetch.current) || previousLocale !== locale;\n // this useEffect is meant to trigger fetching for the first time if it hasn't been done earlier\n // if not yet fetched and not fetchin at the moment\n if (shouldFetch && !isFetching && slug) {\n attemptedToFetch.current = true;\n fetchBySlug({\n experienceTypeId,\n localeCode: locale,\n slug,\n }).catch(() => {\n // noop\n });\n }\n }, [\n experienceTypeId,\n entityStore,\n isFetching,\n fetchBySlug,\n client,\n slug,\n locale,\n previousLocale,\n ]);\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] Contenful 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 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 {\n VisualEditorMode,\n isDeprecatedExperience,\n validateExperienceBuilderConfig,\n} from '@contentful/experiences-core';\nimport { EntityStore } from '@contentful/experiences-core';\nimport type { DeprecatedExperience, Experience } from '@contentful/experiences-core/types';\nimport { DeprecatedPreviewDeliveryRoot } from './blocks/preview/DeprecatedPreviewDeliveryRoot';\nimport { PreviewDeliveryRoot } from './blocks/preview/PreviewDeliveryRoot';\nimport VisualEditorRoot from './blocks/editor/VisualEditorRoot';\nimport { useDetectEditorMode } from './hooks/useDetectEditorMode';\n\ntype ExperienceRootProps = {\n experience?: Experience<EntityStore> | DeprecatedExperience;\n locale: string;\n /**\n * @deprecated\n */\n slug?: string;\n visualEditorMode?: VisualEditorMode;\n};\n\nexport const ExperienceRoot = ({\n locale,\n experience,\n slug,\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 =\n experience && !isDeprecatedExperience(experience) ? experience.entityStore : undefined;\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 if (isDeprecatedExperience(experience)) {\n return (\n <DeprecatedPreviewDeliveryRoot\n deprecatedExperience={experience as DeprecatedExperience}\n locale={locale}\n slug={slug}\n />\n );\n }\n\n return <PreviewDeliveryRoot locale={locale} experience={experience} />;\n};\n","import { SDK_VERSION } from './sdkVersion';\n\nexport { ExperienceRoot } from './ExperienceRoot';\nexport { useExperienceBuilder, useFetchExperience, 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 /** @deprecated use `CONTENTFUL_COMPONENTS.section.id` instead. This will be removed in version 4. */\n CONTENTFUL_SECTION_ID,\n /** @deprecated use `CONTENTFUL_COMPONENTS.container.id` instead. This will be removed in version 4. */\n CONTENTFUL_CONTAINER_ID,\n CONTENTFUL_COMPONENTS,\n OUTGOING_EVENTS,\n INCOMING_EVENTS,\n CONTENTFUL_COMPONENT_CATEGORY,\n LATEST_SCHEMA_VERSION,\n CF_STYLE_ATTRIBUTES,\n // We still need to expose those, so in the editor we can check for both to support older SDK versions\n /** @deprecated use `ASSEMBLY_BLOCK_NODE_TYPE` instead. This will be removed in version 5. */\n DESIGN_COMPONENT_BLOCK_NODE_TYPE,\n /** @deprecated use `ASSEMBLY_NODE_TYPE` instead. This will be removed in version 5. */\n DESIGN_COMPONENT_NODE_TYPE,\n /** @deprecated use `ASSEMBLY_NODE_TYPES` instead. This will be removed in version 5. */\n DESIGN_COMPONENT_NODE_TYPES,\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","fetchBySlug","fetchBySlugCore","fetchById","fetchByIdCore","_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,MAAM,GAAG,GAAG,OAAO,CAAC,gBAAgB,IAAI,KAAK,CAAC;AAC9C,QAAA,MAAM,OAAO,GAAG;AACd,YAAA,iBAAiB,EAAE,YAAY;AAC/B,YAAA,uBAAuB,EAAE,iBA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../../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,MAAM,GAAG,GAAG,OAAO,CAAC,gBAAgB,IAAI,KAAK,CAAC;AAC9C,QAAA,MAAM,OAAO,GAAG;AACd,YAAA,iBAAiB,EAAE,YAAY;AAC/B,YAAA,uBAAuB,EAAE,iBAAiB;AAC1C,YAAA,yBAAyB,EAAE,mBAAmB;YAC9C,OAAO;YACP,WAAW;YACX,SAAS;SACV,CAAC;AAEF,QAAA,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,IACrCA,GAAA,CAAC,GAAG,EAAA,EAAC,SAAS,EAAE,SAAS,EAAM,GAAA,OAAO,EACnC,QAAA,EAAA,OAAO,SAAS,KAAK,QAAQ,IAC5B,KAAK,CAAC,aAAa,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,CAAC,KAEhEA,GAAC,CAAA,SAAS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,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,14 +1,10 @@
1
1
  import { VisualEditorMode } from '@contentful/experiences-core';
2
2
  import { EntityStore } from '@contentful/experiences-core';
3
- import type { DeprecatedExperience, Experience } from '@contentful/experiences-core/types';
3
+ import type { Experience } from '@contentful/experiences-core/types';
4
4
  type ExperienceRootProps = {
5
- experience?: Experience<EntityStore> | DeprecatedExperience;
5
+ experience?: Experience<EntityStore>;
6
6
  locale: string;
7
- /**
8
- * @deprecated
9
- */
10
- slug?: string;
11
7
  visualEditorMode?: VisualEditorMode;
12
8
  };
13
- export declare const ExperienceRoot: ({ locale, experience, slug, visualEditorMode, }: ExperienceRootProps) => import("react/jsx-runtime").JSX.Element | null;
9
+ export declare const ExperienceRoot: ({ locale, experience, visualEditorMode, }: ExperienceRootProps) => import("react/jsx-runtime").JSX.Element | null;
14
10
  export {};
@@ -1,5 +1,3 @@
1
- export { useExperienceBuilder } from './useExperienceBuilder';
2
1
  export { useBreakpoints } from './useBreakpoints';
3
- export { useFetchExperience } from './useFetchExperience';
4
2
  export * from './useFetchById';
5
3
  export * from './useFetchBySlug';
@@ -1,8 +1,5 @@
1
1
  import type { ContentfulClientApi } from 'contentful';
2
- import type { ExternalSDKMode } from '@contentful/experiences-core/types';
3
2
  export type UseFetchByIdArgs = {
4
- /** @deprecated mode no longer used */
5
- mode?: ExternalSDKMode;
6
3
  client: ContentfulClientApi<undefined>;
7
4
  id: string;
8
5
  experienceTypeId: string;
@@ -1,8 +1,5 @@
1
1
  import type { ContentfulClientApi } from 'contentful';
2
- import type { ExternalSDKMode } from '@contentful/experiences-core/types';
3
2
  export type UseFetchBySlugArgs = {
4
- /** @deprecated mode no longer needed */
5
- mode?: ExternalSDKMode;
6
3
  client: ContentfulClientApi<undefined>;
7
4
  slug: string;
8
5
  experienceTypeId: string;
@@ -1,19 +1,9 @@
1
1
  export { ExperienceRoot } from './ExperienceRoot';
2
- export { useExperienceBuilder, useFetchExperience, useFetchById, useFetchBySlug } from './hooks';
2
+ export { useFetchById, useFetchBySlug } from './hooks';
3
3
  export { defineComponents } from './core/componentRegistry';
4
4
  export { calculateNodeDefaultHeight,
5
5
  /** @deprecated use `checkIsAssemblyNode` instead. Will be removed with SDK v5. */
6
6
  checkIsAssembly, checkIsAssemblyNode, checkIsAssemblyEntry, defineDesignTokens, supportedModes, VisualEditorMode, fetchById, fetchBySlug, createExperience, } from '@contentful/experiences-core';
7
- export {
8
- /** @deprecated use `CONTENTFUL_COMPONENTS.section.id` instead. This will be removed in version 4. */
9
- CONTENTFUL_SECTION_ID,
10
- /** @deprecated use `CONTENTFUL_COMPONENTS.container.id` instead. This will be removed in version 4. */
11
- CONTENTFUL_CONTAINER_ID, CONTENTFUL_COMPONENTS, OUTGOING_EVENTS, INCOMING_EVENTS, CONTENTFUL_COMPONENT_CATEGORY, LATEST_SCHEMA_VERSION, CF_STYLE_ATTRIBUTES,
12
- /** @deprecated use `ASSEMBLY_BLOCK_NODE_TYPE` instead. This will be removed in version 5. */
13
- DESIGN_COMPONENT_BLOCK_NODE_TYPE,
14
- /** @deprecated use `ASSEMBLY_NODE_TYPE` instead. This will be removed in version 5. */
15
- DESIGN_COMPONENT_NODE_TYPE,
16
- /** @deprecated use `ASSEMBLY_NODE_TYPES` instead. This will be removed in version 5. */
17
- DESIGN_COMPONENT_NODE_TYPES, ASSEMBLY_BLOCK_NODE_TYPE, ASSEMBLY_NODE_TYPE, ASSEMBLY_NODE_TYPES, SCROLL_STATES, } from '@contentful/experiences-core/constants';
7
+ export { CONTENTFUL_COMPONENTS, OUTGOING_EVENTS, INCOMING_EVENTS, CONTENTFUL_COMPONENT_CATEGORY, LATEST_SCHEMA_VERSION, CF_STYLE_ATTRIBUTES, ASSEMBLY_BLOCK_NODE_TYPE, ASSEMBLY_NODE_TYPE, ASSEMBLY_NODE_TYPES, SCROLL_STATES, } from '@contentful/experiences-core/constants';
18
8
  export type { InternalSDKMode, ExternalSDKMode, ComponentDefinition, } from '@contentful/experiences-core/types';
19
9
  export { EntityStore } from '@contentful/experiences-core';
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.1-alpha.1";
1
+ export declare const SDK_VERSION = "0.0.1-alpha.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experiences-sdk-react",
3
- "version": "0.0.1-alpha.2",
3
+ "version": "0.0.1-alpha.3",
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.2",
35
- "@contentful/experiences-core": "0.0.1-alpha.2",
36
- "@contentful/experiences-visual-editor-react": "0.0.1-alpha.2",
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",
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": "ed1b56b4398d7aaff1b0ea40c14514fb3a2e3d09"
91
+ "gitHead": "16ce64efb91be55c9e2395ff9ec774beb6a73e71"
92
92
  }
@@ -1,12 +0,0 @@
1
- import type { DeprecatedExperience } from '@contentful/experiences-core/types';
2
- type DeprecatedPreviewDeliveryRootProps = {
3
- deprecatedExperience: DeprecatedExperience;
4
- locale: string;
5
- slug?: string;
6
- };
7
- /**
8
- * @deprecated Remove after the BETA release
9
- * @returns
10
- */
11
- export declare const DeprecatedPreviewDeliveryRoot: ({ locale, slug, deprecatedExperience, }: DeprecatedPreviewDeliveryRootProps) => import("react/jsx-runtime").JSX.Element | null;
12
- export {};
@@ -1,41 +0,0 @@
1
- import type { DeprecatedExperience, ExternalSDKMode } from '@contentful/experiences-core/types';
2
- import type { ContentfulClientApi } from 'contentful';
3
- type UseExperienceBuilderProps = {
4
- /**
5
- * Id of the content type of the target experience
6
- */
7
- experienceTypeId: string;
8
- /**
9
- * Instance of a Delivery or Preview client from "contentful" package
10
- */
11
- client: ContentfulClientApi<undefined>;
12
- /**
13
- * Mode defines the behaviour of the sdk.
14
- * - `preview` - fetching and rendering draft data. Will automatically switch to `editor` mode if open from contentful web app.
15
- * - `delivery` - fetching and rendering of published data. Can not be switched to `editor` mode. */
16
- mode?: ExternalSDKMode;
17
- };
18
- /**
19
- * @deprecated This hook is deprecated. Use fetchBySlug or fetchById instead
20
- */
21
- export declare const useExperienceBuilder: ({ experienceTypeId, client, mode, }: UseExperienceBuilderProps) => {
22
- /**
23
- * @deprecated please fetch the experience using `useFetchExperience` hook or fetch the data manually using `fetchers` or `client` and create experience with `createExperience` function
24
- *
25
- * @example
26
- *
27
- * import { useFetchExperience } from '@contentful/experiences-sdk-react'
28
- *
29
- * const { fetchBySlug, fetchById, experience, isFetching } = useFetchExperience({ client, mode })
30
- */
31
- experience: DeprecatedExperience;
32
- /**
33
- * @deprecated please import the function from the library
34
- *
35
- * @example
36
- *
37
- * import { defineComponents } from '@contentful/experiences-sdk-react'
38
- */
39
- defineComponents: (componentRegistrations: import("@contentful/experiences-core/types").ComponentRegistration[], options?: import("@contentful/experiences-core/types").ComponentRegistrationOptions | undefined) => void;
40
- };
41
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,27 +0,0 @@
1
- import type { ContentfulClientApi } from 'contentful';
2
- import { EntityStore } from '@contentful/experiences-core';
3
- import { Experience, ExternalSDKMode } from '@contentful/experiences-core/types';
4
- type useClientsideExperienceFetchersProps = {
5
- /** @deprecated mode no longer required */
6
- mode?: ExternalSDKMode;
7
- client: ContentfulClientApi<undefined>;
8
- };
9
- /**
10
- * @deprecated please use `useFetchBySlug` or `useFetchById` hooks instead
11
- */
12
- export declare const useFetchExperience: ({ client }: useClientsideExperienceFetchersProps) => {
13
- fetchBySlug: ({ experienceTypeId, slug, localeCode, }: {
14
- experienceTypeId: string;
15
- slug: string;
16
- localeCode: string;
17
- }) => Promise<Experience<EntityStore> | undefined>;
18
- fetchById: ({ experienceTypeId, id, localeCode, }: {
19
- experienceTypeId: string;
20
- id: string;
21
- localeCode: string;
22
- }) => Promise<Experience<EntityStore> | undefined>;
23
- error: Error | undefined;
24
- experience: Experience<EntityStore> | undefined;
25
- isFetching: boolean;
26
- };
27
- export {};
@@ -1 +0,0 @@
1
- export {};