@contentful/experiences-sdk-react 0.0.1-alpha.10
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/LICENSE +21 -0
- package/README.md +113 -0
- package/dist/VisualEditorInjectScript-6a92528d.js +38 -0
- package/dist/VisualEditorInjectScript-6a92528d.js.map +1 -0
- package/dist/VisualEditorLoader-255ce544.js +28 -0
- package/dist/VisualEditorLoader-255ce544.js.map +1 -0
- package/dist/index.d.ts +51 -0
- package/dist/index.js +5014 -0
- package/dist/index.js.map +1 -0
- package/dist/src/ExperienceRoot.d.ts +10 -0
- package/dist/src/blocks/editor/VisualEditorInjectScript.d.ts +4 -0
- package/dist/src/blocks/editor/VisualEditorLoader.d.ts +7 -0
- package/dist/src/blocks/editor/VisualEditorRoot.d.ts +9 -0
- package/dist/src/blocks/preview/CompositionBlock.d.ts +10 -0
- package/dist/src/blocks/preview/CompositionBlock.spec.d.ts +1 -0
- package/dist/src/blocks/preview/PreviewDeliveryRoot.d.ts +8 -0
- package/dist/src/blocks/preview/PreviewDeliveryRoot.test.d.ts +1 -0
- package/dist/src/components/Assembly.d.ts +3 -0
- package/dist/src/components/ErrorBoundary.d.ts +25 -0
- package/dist/src/components/Flex.d.ts +64 -0
- package/dist/src/constants.d.ts +3 -0
- package/dist/src/core/componentRegistry.d.ts +24 -0
- package/dist/src/core/componentRegistry.test.d.ts +1 -0
- package/dist/src/core/index.d.ts +1 -0
- package/dist/src/core/preview/assemblyUtils.d.ts +10 -0
- package/dist/src/core/preview/assemblyUtils.spec.d.ts +1 -0
- package/dist/src/hooks/index.d.ts +3 -0
- package/dist/src/hooks/useBreakpoints.d.ts +4 -0
- package/dist/src/hooks/useBreakpoints.spec.d.ts +1 -0
- package/dist/src/hooks/useDetectEditorMode.d.ts +7 -0
- package/dist/src/hooks/useFetchByBase.d.ts +8 -0
- package/dist/src/hooks/useFetchById.d.ts +13 -0
- package/dist/src/hooks/useFetchById.spec.d.ts +1 -0
- package/dist/src/hooks/useFetchBySlug.d.ts +13 -0
- package/dist/src/hooks/useFetchBySlug.spec.d.ts +1 -0
- package/dist/src/hooks/useInitializeVisualEditor.d.ts +7 -0
- package/dist/src/hooks/usePrevious.d.ts +6 -0
- package/dist/src/hooks/useStyleTag.d.ts +16 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/src/sdkVersion.d.ts +1 -0
- package/dist/src/utils/withComponentWrapper.d.ts +36 -0
- package/dist/src/utils/withComponentWrapper.spec.d.ts +1 -0
- package/dist/test/__fixtures__/assembly.d.ts +96 -0
- package/dist/test/__fixtures__/composition.d.ts +7 -0
- package/dist/test/__fixtures__/entities.d.ts +9 -0
- package/dist/test/components/Test.d.ts +1 -0
- package/dist/test/components/Test.spec.d.ts +1 -0
- package/dist/vite.config.d.ts +2 -0
- package/package.json +92 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { VisualEditorMode } from '@contentful/experiences-core';
|
|
2
|
+
import { EntityStore } from '@contentful/experiences-core';
|
|
3
|
+
import type { Experience } from '@contentful/experiences-core/types';
|
|
4
|
+
type ExperienceRootProps = {
|
|
5
|
+
experience?: Experience<EntityStore>;
|
|
6
|
+
locale: string;
|
|
7
|
+
visualEditorMode?: VisualEditorMode;
|
|
8
|
+
};
|
|
9
|
+
export declare const ExperienceRoot: ({ locale, experience, visualEditorMode, }: ExperienceRootProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { VisualEditorMode } from '@contentful/experiences-core';
|
|
3
|
+
type VisualEditorLoaderProps = {
|
|
4
|
+
visualEditorMode: VisualEditorMode;
|
|
5
|
+
};
|
|
6
|
+
export declare const VisualEditorLoader: React.FC<VisualEditorLoaderProps>;
|
|
7
|
+
export default VisualEditorLoader;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { EntityStore, VisualEditorMode } from '@contentful/experiences-core';
|
|
3
|
+
type VisualEditorRootProps = {
|
|
4
|
+
visualEditorMode: VisualEditorMode;
|
|
5
|
+
initialEntities: EntityStore['entities'];
|
|
6
|
+
initialLocale: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const VisualEditorRoot: React.FC<VisualEditorRootProps>;
|
|
9
|
+
export default VisualEditorRoot;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EntityStore } from '@contentful/experiences-core';
|
|
2
|
+
import type { ComponentTreeNode, ResolveDesignValueType } from '@contentful/experiences-core/types';
|
|
3
|
+
type CompositionBlockProps = {
|
|
4
|
+
node: ComponentTreeNode;
|
|
5
|
+
locale: string;
|
|
6
|
+
entityStore: EntityStore;
|
|
7
|
+
resolveDesignValue: ResolveDesignValueType;
|
|
8
|
+
};
|
|
9
|
+
export declare const CompositionBlock: ({ node: rawNode, locale, entityStore, resolveDesignValue, }: CompositionBlockProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EntityStore } from '@contentful/experiences-core';
|
|
2
|
+
import type { Experience } from '@contentful/experiences-core/types';
|
|
3
|
+
type DeliveryRootProps = {
|
|
4
|
+
experience: Experience<EntityStore>;
|
|
5
|
+
locale: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const PreviewDeliveryRoot: ({ locale, experience }: DeliveryRootProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, { ErrorInfo, ReactElement } from 'react';
|
|
2
|
+
import '../styles/ErrorBoundary.css';
|
|
3
|
+
export declare class ErrorBoundary extends React.Component<{
|
|
4
|
+
children: ReactElement;
|
|
5
|
+
}, {
|
|
6
|
+
hasError: boolean;
|
|
7
|
+
error: Error | null;
|
|
8
|
+
errorInfo: ErrorInfo | null;
|
|
9
|
+
showErrorDetails: boolean;
|
|
10
|
+
}> {
|
|
11
|
+
constructor(props: {
|
|
12
|
+
children: ReactElement;
|
|
13
|
+
});
|
|
14
|
+
static getDerivedStateFromError(): {
|
|
15
|
+
hasError: boolean;
|
|
16
|
+
};
|
|
17
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
18
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
}
|
|
20
|
+
export declare class ImportedComponentErrorBoundary extends React.Component<{
|
|
21
|
+
children: ReactElement;
|
|
22
|
+
}> {
|
|
23
|
+
componentDidCatch(error: Error, _errorInfo: ErrorInfo): void;
|
|
24
|
+
render(): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React, { MouseEventHandler } from 'react';
|
|
2
|
+
import type * as CSS from 'csstype';
|
|
3
|
+
export interface FlexProps {
|
|
4
|
+
/**
|
|
5
|
+
* Child nodes to be rendered in the component */
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* A shorthand property for flex-grow, flex-shrink, flex-basis
|
|
9
|
+
*/
|
|
10
|
+
flex?: CSS.Property.Flex;
|
|
11
|
+
/**
|
|
12
|
+
* Defines the initial size of a flexbox item.
|
|
13
|
+
* */
|
|
14
|
+
flexBasis?: CSS.Property.FlexBasis;
|
|
15
|
+
/**
|
|
16
|
+
* Defines how much a flexbox item should shrink if there's not enough space available. */
|
|
17
|
+
flexShrink?: CSS.Property.FlexShrink;
|
|
18
|
+
/**
|
|
19
|
+
* Defines if flexbox items appear on a single line or on multiple lines within a flexbox container. */
|
|
20
|
+
flexWrap?: CSS.Property.FlexWrap;
|
|
21
|
+
/**
|
|
22
|
+
* Defines how flexbox items are ordered within a flexbox container. */
|
|
23
|
+
flexDirection?: CSS.Property.FlexDirection;
|
|
24
|
+
/**
|
|
25
|
+
* Defines how much a flexbox item should grow if there's space available. */
|
|
26
|
+
flexGrow?: CSS.Property.FlexGrow;
|
|
27
|
+
/**
|
|
28
|
+
* Defines a gap between flexbox items. */
|
|
29
|
+
gap?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Defines how flexbox/grid items are aligned according to the main axis, within a flexbox/grid container. */
|
|
32
|
+
justifyContent?: CSS.Property.JustifyContent;
|
|
33
|
+
/**
|
|
34
|
+
* Defines the default justify-self for all items of the box, giving them all a default way of justifying each box along the appropriate axis. */
|
|
35
|
+
justifyItems?: CSS.Property.JustifyContent;
|
|
36
|
+
/**
|
|
37
|
+
* Sets the way a box is justified inside its alignment container along the appropriate axis. */
|
|
38
|
+
justifySelf?: CSS.Property.JustifySelf;
|
|
39
|
+
/**
|
|
40
|
+
* Defines how flexbox items are aligned according to the cross axis, within a line of a flexbox container.
|
|
41
|
+
*/
|
|
42
|
+
alignItems?: CSS.Property.AlignItems;
|
|
43
|
+
/**
|
|
44
|
+
* Works like align-items, but applies only to a single flexbox item, instead of all of them.
|
|
45
|
+
*/
|
|
46
|
+
alignSelf?: CSS.Property.AlignItems;
|
|
47
|
+
/**
|
|
48
|
+
* Defines how each line is aligned within a flexbox/grid container.
|
|
49
|
+
*/
|
|
50
|
+
alignContent?: CSS.Property.AlignContent;
|
|
51
|
+
/**
|
|
52
|
+
* Defines the order of a flexbox item
|
|
53
|
+
*/
|
|
54
|
+
order?: CSS.Property.Order;
|
|
55
|
+
onMouseEnter?: MouseEventHandler<HTMLDivElement>;
|
|
56
|
+
onMouseLeave?: MouseEventHandler<HTMLDivElement>;
|
|
57
|
+
onMouseUp?: MouseEventHandler<HTMLDivElement>;
|
|
58
|
+
onMouseDown?: MouseEventHandler<HTMLDivElement>;
|
|
59
|
+
onClick?: MouseEventHandler<HTMLDivElement>;
|
|
60
|
+
className?: string;
|
|
61
|
+
cssStyles?: Record<string, string>;
|
|
62
|
+
id?: string;
|
|
63
|
+
}
|
|
64
|
+
export declare const Flex: React.ForwardRefExoticComponent<FlexProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ComponentRegistration, ComponentRegistrationOptions } from '@contentful/experiences-core/types';
|
|
2
|
+
export declare const enrichComponentDefinition: ({ component, definition, options, }: ComponentRegistration) => ComponentRegistration;
|
|
3
|
+
export declare const componentRegistry: Map<string, ComponentRegistration>;
|
|
4
|
+
export declare const optionalBuiltInComponents: string[];
|
|
5
|
+
export declare const sendRegisteredComponentsMessage: () => void;
|
|
6
|
+
export declare const runRegisteredComponentValidations: () => void;
|
|
7
|
+
export declare const sendConnectedEventWithRegisteredComponents: () => void;
|
|
8
|
+
/**
|
|
9
|
+
* Registers multiple components and their component definitions at once
|
|
10
|
+
* @param componentRegistrations - ComponentRegistration[]
|
|
11
|
+
* @returns void
|
|
12
|
+
*/
|
|
13
|
+
export declare const defineComponents: (componentRegistrations: ComponentRegistration[], options?: ComponentRegistrationOptions) => void;
|
|
14
|
+
/**
|
|
15
|
+
* use this function only in tests
|
|
16
|
+
*/
|
|
17
|
+
export declare const resetComponentRegistry: () => void;
|
|
18
|
+
export declare const getComponentRegistration: (id: string) => ComponentRegistration | undefined;
|
|
19
|
+
export declare const addComponentRegistration: (componentRegistration: ComponentRegistration) => void;
|
|
20
|
+
export declare const createAssemblyRegistration: ({ definitionId, definitionName, component, }: {
|
|
21
|
+
definitionId: string;
|
|
22
|
+
definitionName?: string | undefined;
|
|
23
|
+
component: ComponentRegistration['component'];
|
|
24
|
+
}) => ComponentRegistration | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Flex } from '../components/Flex';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EntityStore } from '@contentful/experiences-core';
|
|
2
|
+
import type { ComponentTreeNode } from '@contentful/experiences-core/types';
|
|
3
|
+
export declare const deserializeAssemblyNode: ({ node, componentInstanceVariables, }: {
|
|
4
|
+
node: ComponentTreeNode;
|
|
5
|
+
componentInstanceVariables: ComponentTreeNode['variables'];
|
|
6
|
+
}) => ComponentTreeNode;
|
|
7
|
+
export declare const resolveAssembly: ({ node, entityStore, }: {
|
|
8
|
+
node: ComponentTreeNode;
|
|
9
|
+
entityStore: EntityStore;
|
|
10
|
+
}) => ComponentTreeNode;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type UseDetectEditorModeArgs = {
|
|
2
|
+
/** If running from a known client side only situation (ie: useFetchBySlug),
|
|
3
|
+
* set this to true to kick in editor mode check sooner (which avoids a render cycle) */
|
|
4
|
+
isClientSide?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare const useDetectEditorMode: ({ isClientSide }?: UseDetectEditorModeArgs) => boolean;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EntityStore } from '@contentful/experiences-core';
|
|
2
|
+
import type { Experience } from '@contentful/experiences-core/types';
|
|
3
|
+
export declare const useFetchByBase: (fetchMethod: () => Promise<Experience<EntityStore> | undefined>, isEditorMode: boolean) => {
|
|
4
|
+
error: Error | undefined;
|
|
5
|
+
experience: Experience<EntityStore> | undefined;
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
isEditorMode: boolean;
|
|
8
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ContentfulClientApi } from 'contentful';
|
|
2
|
+
export type UseFetchByIdArgs = {
|
|
3
|
+
client: ContentfulClientApi<undefined>;
|
|
4
|
+
id: string;
|
|
5
|
+
experienceTypeId: string;
|
|
6
|
+
localeCode: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const useFetchById: ({ id, localeCode, client, experienceTypeId }: UseFetchByIdArgs) => {
|
|
9
|
+
error: Error | undefined;
|
|
10
|
+
experience: import("@contentful/experiences-core/types").Experience<import("@contentful/experiences-core").EntityStore> | undefined;
|
|
11
|
+
isLoading: boolean;
|
|
12
|
+
isEditorMode: boolean;
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ContentfulClientApi } from 'contentful';
|
|
2
|
+
export type UseFetchBySlugArgs = {
|
|
3
|
+
client: ContentfulClientApi<undefined>;
|
|
4
|
+
slug: string;
|
|
5
|
+
experienceTypeId: string;
|
|
6
|
+
localeCode: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const useFetchBySlug: ({ slug, localeCode, client, experienceTypeId, }: UseFetchBySlugArgs) => {
|
|
9
|
+
error: Error | undefined;
|
|
10
|
+
experience: import("@contentful/experiences-core/types").Experience<import("@contentful/experiences-core").EntityStore> | undefined;
|
|
11
|
+
isLoading: boolean;
|
|
12
|
+
isEditorMode: boolean;
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { EntityStore } from '@contentful/experiences-core';
|
|
2
|
+
type InitializeVisualEditorParams = {
|
|
3
|
+
initialLocale: string;
|
|
4
|
+
initialEntities?: EntityStore['entities'];
|
|
5
|
+
};
|
|
6
|
+
export declare const useInitializeVisualEditor: (params: InitializeVisualEditorParams) => void;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CSSProperties } from '@contentful/experiences-core/types';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param styles: the list of styles to apply
|
|
5
|
+
* @param nodeId: [Optional] the id of node that these styles will be applied to
|
|
6
|
+
* @returns className: the className that was used
|
|
7
|
+
* Builds and adds a style tag in the document. Returns the className to be attached to the element.
|
|
8
|
+
* In editor mode the nodeId is used as the identifier in order to avoid creating endless tags as the styles are tweeked
|
|
9
|
+
* In preview/delivery mode the styles don't change oftem so we're using the md5 hash of the content of the tag
|
|
10
|
+
*/
|
|
11
|
+
export declare const useStyleTag: ({ styles, nodeId }: {
|
|
12
|
+
styles: CSSProperties;
|
|
13
|
+
nodeId?: string | undefined;
|
|
14
|
+
}) => {
|
|
15
|
+
className: string;
|
|
16
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { ExperienceRoot } from './ExperienceRoot';
|
|
2
|
+
export { useFetchById, useFetchBySlug } from './hooks';
|
|
3
|
+
export { defineComponents } from './core/componentRegistry';
|
|
4
|
+
export { defineDesignTokens, VisualEditorMode, fetchById, fetchBySlug, createExperience, } from '@contentful/experiences-core';
|
|
5
|
+
export { CONTENTFUL_COMPONENTS, LATEST_SCHEMA_VERSION, CF_STYLE_ATTRIBUTES, } from '@contentful/experiences-core/constants';
|
|
6
|
+
export type { ExternalSDKMode, ComponentDefinition } from '@contentful/experiences-core/types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SDK_VERSION = "0.0.1-alpha.9";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ComponentRegistration } from '@contentful/experiences-core/types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface CFProps {
|
|
4
|
+
/**
|
|
5
|
+
* Classes to be applied to the container component if `wrapComponent` is true, or directly to the child component if false.
|
|
6
|
+
*/
|
|
7
|
+
className?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Classes to be applied to the child component if `wrapComponent` is true, or directly to the child component if false.
|
|
10
|
+
*/
|
|
11
|
+
classes?: string;
|
|
12
|
+
onMouseDown?: React.MouseEventHandler;
|
|
13
|
+
onMouseUp?: React.MouseEventHandler;
|
|
14
|
+
onClick?: React.MouseEventHandler;
|
|
15
|
+
/**
|
|
16
|
+
* Prop required by Experience Builder to identify the component.
|
|
17
|
+
*/
|
|
18
|
+
'data-cf-node-id'?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Prop required by Experience Builder to identify the component.
|
|
21
|
+
*/
|
|
22
|
+
'data-cf-node-block-id'?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Prop required by Experience Builder to identify the component's type.
|
|
25
|
+
*/
|
|
26
|
+
'data-cf-node-block-type'?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 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.
|
|
30
|
+
* @param Component Component to be used by Experience Builder.
|
|
31
|
+
* @param options Options for the `withComponentWrapper` function.
|
|
32
|
+
* @default { wrapComponent: true, wrapContainerTag: 'div' }
|
|
33
|
+
* @returns A component that can be passed to `defineComponents`.
|
|
34
|
+
*/
|
|
35
|
+
export declare function withComponentWrapper<T extends object>(Component: React.ElementType<T>, options?: ComponentRegistration['options']): ({ classes, className, "data-cf-node-id": dataCfNodeId, "data-cf-node-block-id": dataCfNodeBlockId, "data-cf-node-block-type": dataCfNodeBlockType, onClick, onMouseDown, onMouseUp, ...props }: CFProps & T) => import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { ExperienceTreeNode, SchemaVersions } from '@contentful/experiences-core/types';
|
|
2
|
+
type createAssemblyEntryArgs = {
|
|
3
|
+
schemaVersion: SchemaVersions;
|
|
4
|
+
id: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const defaultAssemblyId = "assembly-id";
|
|
7
|
+
export declare const assemblyGeneratedVariableName = "text_uuid1Assembly";
|
|
8
|
+
export declare const createAssemblyEntry: ({ schemaVersion, id, }: createAssemblyEntryArgs) => {
|
|
9
|
+
sys: {
|
|
10
|
+
id: string;
|
|
11
|
+
type: string;
|
|
12
|
+
contentType: {
|
|
13
|
+
sys: {
|
|
14
|
+
id: string;
|
|
15
|
+
type: string;
|
|
16
|
+
linkType: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
createdAt: string;
|
|
20
|
+
updatedAt: string;
|
|
21
|
+
revision: number;
|
|
22
|
+
space: {
|
|
23
|
+
sys: {
|
|
24
|
+
type: string;
|
|
25
|
+
linkType: string;
|
|
26
|
+
id: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
environment: {
|
|
30
|
+
sys: {
|
|
31
|
+
type: string;
|
|
32
|
+
linkType: string;
|
|
33
|
+
id: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
metadata: {
|
|
38
|
+
tags: never[];
|
|
39
|
+
};
|
|
40
|
+
fields: {
|
|
41
|
+
title: string;
|
|
42
|
+
slug: string;
|
|
43
|
+
componentTree: {
|
|
44
|
+
children: {
|
|
45
|
+
definitionId: string;
|
|
46
|
+
variables: {};
|
|
47
|
+
children: {
|
|
48
|
+
definitionId: string;
|
|
49
|
+
variables: {
|
|
50
|
+
text: {
|
|
51
|
+
key: string;
|
|
52
|
+
type: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
children: never[];
|
|
56
|
+
}[];
|
|
57
|
+
}[];
|
|
58
|
+
breakpoints: {
|
|
59
|
+
id: string;
|
|
60
|
+
query: string;
|
|
61
|
+
previewSize: string;
|
|
62
|
+
displayName: string;
|
|
63
|
+
}[];
|
|
64
|
+
schemaVersion: "2023-09-28" | "2023-08-23" | "2023-07-26" | "2023-06-27";
|
|
65
|
+
};
|
|
66
|
+
dataSource: {};
|
|
67
|
+
unboundValues: {
|
|
68
|
+
unbound_uuid1Assembly: {
|
|
69
|
+
value: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
componentSettings: {
|
|
73
|
+
variableDefinitions: {
|
|
74
|
+
text_uuid1Assembly: {
|
|
75
|
+
displayName: string;
|
|
76
|
+
name: string;
|
|
77
|
+
type: string;
|
|
78
|
+
defaultValue: {
|
|
79
|
+
type: string;
|
|
80
|
+
key: string;
|
|
81
|
+
};
|
|
82
|
+
required: boolean;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
type createAssemblyNodeArgs = {
|
|
89
|
+
id: string;
|
|
90
|
+
blockId?: string;
|
|
91
|
+
unboundValue?: string;
|
|
92
|
+
unboundValueKey?: string;
|
|
93
|
+
boundValueKey?: string;
|
|
94
|
+
};
|
|
95
|
+
export declare const createAssemblyNode: ({ id, blockId, unboundValue, unboundValueKey, boundValueKey, }: createAssemblyNodeArgs) => ExperienceTreeNode;
|
|
96
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ExperienceEntry, SchemaVersions } from '@contentful/experiences-core/types';
|
|
2
|
+
export declare const compositionEntry: ExperienceEntry;
|
|
3
|
+
type createExperienceEntryArgs = {
|
|
4
|
+
schemaVersion: SchemaVersions;
|
|
5
|
+
};
|
|
6
|
+
export declare const createExperienceEntry: ({ schemaVersion, }: createExperienceEntryArgs) => ExperienceEntry;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Asset, Entry } from 'contentful';
|
|
2
|
+
export declare const entityIds: {
|
|
3
|
+
ENTRY1: string;
|
|
4
|
+
ENTRY2: string;
|
|
5
|
+
ASSET1: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const entries: Entry[];
|
|
8
|
+
export declare const assets: Asset[];
|
|
9
|
+
export declare const entities: Array<Entry | Asset>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Test: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@contentful/experiences-sdk-react",
|
|
3
|
+
"version": "0.0.1-alpha.10",
|
|
4
|
+
"main": "./dist/index.js",
|
|
5
|
+
"module": "./dist/index.js",
|
|
6
|
+
"typings": "./dist/src/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"author": "Contentful GmbH",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"registry": "https://npm.pkg.github.com/"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"clean": "rimraf dist",
|
|
15
|
+
"predev": "npm run clean",
|
|
16
|
+
"dev": "rollup -c ./rollup.config.mjs --watch --environment DEV",
|
|
17
|
+
"prepare": "node ./bin/injectSDKVersion.cjs",
|
|
18
|
+
"prebuild": "npm run clean && node ./bin/injectSDKVersion.cjs",
|
|
19
|
+
"build": "rollup -c rollup.config.mjs",
|
|
20
|
+
"watch": "vite build --watch",
|
|
21
|
+
"test": "NODE_ENV=test jest",
|
|
22
|
+
"test:watch": "NODE_ENV=test jest --watch",
|
|
23
|
+
"test:coverage": "NODE_ENV=test jest --coverage --maxWorkers 2",
|
|
24
|
+
"tsc": "tsc --noEmit",
|
|
25
|
+
"lint": "eslint ./src --ext '.ts,.tsx,.js,.jsx'",
|
|
26
|
+
"presemantic-release": "npm run build",
|
|
27
|
+
"semantic-release": "semantic-release",
|
|
28
|
+
"prettier:check": "prettier --check '**/*.{jsx,js,ts,tsx,css}'",
|
|
29
|
+
"prettier": "prettier --write '**/*.{jsx,js,ts,tsx,css}'",
|
|
30
|
+
"preview": "vite preview",
|
|
31
|
+
"depcruise": "depcruise src"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@contentful/experiences-components-react": "0.0.1-alpha.8",
|
|
35
|
+
"@contentful/experiences-core": "0.0.1-alpha.8",
|
|
36
|
+
"@contentful/experiences-visual-editor-react": "0.0.1-alpha.10",
|
|
37
|
+
"@contentful/rich-text-types": "^16.2.1",
|
|
38
|
+
"classnames": "^2.3.2",
|
|
39
|
+
"csstype": "^3.1.2",
|
|
40
|
+
"immer": "^10.0.3",
|
|
41
|
+
"lodash-es": "^4.17.21",
|
|
42
|
+
"md5": "^2.3.0",
|
|
43
|
+
"style-inject": "^0.3.0",
|
|
44
|
+
"vite-plugin-css-injected-by-js": "^3.1.1"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@rollup/plugin-commonjs": "^25.0.7",
|
|
48
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
49
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
50
|
+
"@rollup/plugin-typescript": "^11.1.5",
|
|
51
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
52
|
+
"@testing-library/jest-dom": "^6.1.4",
|
|
53
|
+
"@testing-library/react": "^14.0.0",
|
|
54
|
+
"@testing-library/user-event": "^14.4.3",
|
|
55
|
+
"@types/jest": "^29.5.6",
|
|
56
|
+
"@types/lodash-es": "^4.17.12",
|
|
57
|
+
"@types/node": "^20.11.10",
|
|
58
|
+
"@types/react": "^18.0.28",
|
|
59
|
+
"@types/react-dom": "^18.0.11",
|
|
60
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
61
|
+
"@vitejs/plugin-react-swc": "^3.0.0",
|
|
62
|
+
"contentful": "^10.6.14",
|
|
63
|
+
"husky": "^9.0.10",
|
|
64
|
+
"jest": "^29.5.0",
|
|
65
|
+
"jest-environment-jsdom": "^29.5.0",
|
|
66
|
+
"jsdom": "^24.0.0",
|
|
67
|
+
"postcss-import": "^15.1.0",
|
|
68
|
+
"react": "^18.2.0",
|
|
69
|
+
"react-dom": "^18.2.0",
|
|
70
|
+
"relative-deps": "^1.0.7",
|
|
71
|
+
"rollup-plugin-dts": "^6.1.0",
|
|
72
|
+
"rollup-plugin-node-externals": "^7.0.1",
|
|
73
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
74
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
75
|
+
"semantic-release": "23.0.2",
|
|
76
|
+
"ts-jest": "^29.1.0",
|
|
77
|
+
"typescript": "^5.2.2",
|
|
78
|
+
"vite": "^4.3.9",
|
|
79
|
+
"vite-plugin-dts": "^3.6.1",
|
|
80
|
+
"vite-plugin-svgr": "^4.1.0"
|
|
81
|
+
},
|
|
82
|
+
"peerDependencies": {
|
|
83
|
+
"contentful": ">=10.6.0",
|
|
84
|
+
"react": ">=16.0.0",
|
|
85
|
+
"react-dom": ">=16.0.0"
|
|
86
|
+
},
|
|
87
|
+
"files": [
|
|
88
|
+
"dist",
|
|
89
|
+
"package.json"
|
|
90
|
+
],
|
|
91
|
+
"gitHead": "61570fda78098dde45c47ff2f958ac80fa3855b4"
|
|
92
|
+
}
|