@contentful/experiences-sdk-react 0.0.1-alpha.7 → 0.0.1-alpha.9

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.
@@ -35,4 +35,4 @@ function VisualEditorInjectScript() {
35
35
  }
36
36
 
37
37
  export { VisualEditorInjectScript as default };
38
- //# sourceMappingURL=VisualEditorInjectScript-DPer6DO3.js.map
38
+ //# sourceMappingURL=VisualEditorInjectScript-6a92528d.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"VisualEditorInjectScript-DPer6DO3.js","sources":["../../src/blocks/editor/VisualEditorInjectScript.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { VISUAL_EDITOR_CONTAINER_ID } from '@contentful/experiences-core/constants';\n\n/**\n * The version can be any semver version or dist tag\n * Examples: @latest, @dev, @pre, @0.0.1-pre-20231213T103332.0\n *\n * If the version is empty, unpkg will redirect to the latest version of the package\n */\nconst version = '@0.0.1-pre-20231213T210727.0';\n\n/**\n * CDN URL for the visual editor script\n *\n * This can be changed to a local file path for development\n *\n * TODO: Reconsider unpkg\n */\nconst scriptUrl = `https://unpkg.com/@contentful/experience-builder-visual-editor${version}/dist/renderApp.js`;\n\n/**\n * This component injects the visual editor script into the page\n */\nexport default function VisualEditorInjectScript() {\n useEffect(() => {\n const script = document.createElement('script');\n script.type = 'module';\n script.src = scriptUrl;\n script.async = true;\n\n document.body.appendChild(script);\n return () => {\n document.body.removeChild(script);\n };\n }, []);\n\n return <div id={VISUAL_EDITOR_CONTAINER_ID} />;\n}\n"],"names":["_jsx"],"mappings":";;;;AAGA;;;;;AAKG;AACH,MAAM,OAAO,GAAG,8BAA8B,CAAC;AAE/C;;;;;;AAMG;AACH,MAAM,SAAS,GAAG,CAAiE,8DAAA,EAAA,OAAO,oBAAoB,CAAC;AAE/G;;AAEG;AACW,SAAU,wBAAwB,GAAA;IAC9C,SAAS,CAAC,MAAK;QACb,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;AAChD,QAAA,MAAM,CAAC,IAAI,GAAG,QAAQ,CAAC;AACvB,QAAA,MAAM,CAAC,GAAG,GAAG,SAAS,CAAC;AACvB,QAAA,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC;AAEpB,QAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;AAClC,QAAA,OAAO,MAAK;AACV,YAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;AACpC,SAAC,CAAC;KACH,EAAE,EAAE,CAAC,CAAC;AAEP,IAAA,OAAOA,GAAK,CAAA,KAAA,EAAA,EAAA,EAAE,EAAE,0BAA0B,GAAI,CAAC;AACjD;;;;"}
1
+ {"version":3,"file":"VisualEditorInjectScript-6a92528d.js","sources":["../../src/blocks/editor/VisualEditorInjectScript.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { VISUAL_EDITOR_CONTAINER_ID } from '@contentful/experiences-core/constants';\n\n/**\n * The version can be any semver version or dist tag\n * Examples: @latest, @dev, @pre, @0.0.1-pre-20231213T103332.0\n *\n * If the version is empty, unpkg will redirect to the latest version of the package\n */\nconst version = '@0.0.1-pre-20231213T210727.0';\n\n/**\n * CDN URL for the visual editor script\n *\n * This can be changed to a local file path for development\n *\n * TODO: Reconsider unpkg\n */\nconst scriptUrl = `https://unpkg.com/@contentful/experience-builder-visual-editor${version}/dist/renderApp.js`;\n\n/**\n * This component injects the visual editor script into the page\n */\nexport default function VisualEditorInjectScript() {\n useEffect(() => {\n const script = document.createElement('script');\n script.type = 'module';\n script.src = scriptUrl;\n script.async = true;\n\n document.body.appendChild(script);\n return () => {\n document.body.removeChild(script);\n };\n }, []);\n\n return <div id={VISUAL_EDITOR_CONTAINER_ID} />;\n}\n"],"names":["_jsx"],"mappings":";;;;AAGA;;;;;AAKG;AACH,MAAM,OAAO,GAAG,8BAA8B,CAAC;AAE/C;;;;;;AAMG;AACH,MAAM,SAAS,GAAG,CAAiE,8DAAA,EAAA,OAAO,oBAAoB,CAAC;AAE/G;;AAEG;AACW,SAAU,wBAAwB,GAAA;IAC9C,SAAS,CAAC,MAAK;QACb,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;AAChD,QAAA,MAAM,CAAC,IAAI,GAAG,QAAQ,CAAC;AACvB,QAAA,MAAM,CAAC,GAAG,GAAG,SAAS,CAAC;AACvB,QAAA,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC;AAEpB,QAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;AAClC,QAAA,OAAO,MAAK;AACV,YAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;AACpC,SAAC,CAAC;KACH,EAAE,EAAE,CAAC,CAAC;AAEP,IAAA,OAAOA,GAAK,CAAA,KAAA,EAAA,EAAA,EAAE,EAAE,0BAA0B,GAAI,CAAC;AACjD;;;;"}
@@ -8,7 +8,7 @@ const VisualEditorLoader = ({ visualEditorMode }) => {
8
8
  // Dynamically import the visual editor based on the configured mode
9
9
  switch (visualEditorMode) {
10
10
  case VisualEditorMode.InjectScript:
11
- import('./VisualEditorInjectScript-DPer6DO3.js').then((module) => {
11
+ import('./VisualEditorInjectScript-6a92528d.js').then((module) => {
12
12
  setVisualEditor(() => module.default);
13
13
  });
14
14
  break;
@@ -25,4 +25,4 @@ const VisualEditorLoader = ({ visualEditorMode }) => {
25
25
  };
26
26
 
27
27
  export { VisualEditorLoader, VisualEditorLoader as default };
28
- //# sourceMappingURL=VisualEditorLoader-CY2fhqS5.js.map
28
+ //# sourceMappingURL=VisualEditorLoader-255ce544.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"VisualEditorLoader-CY2fhqS5.js","sources":["../../src/blocks/editor/VisualEditorLoader.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { VisualEditorMode } from '@contentful/experiences-core';\n\ntype VisualEditorLoaderProps = {\n visualEditorMode: VisualEditorMode;\n};\n\nexport const VisualEditorLoader: React.FC<VisualEditorLoaderProps> = ({ visualEditorMode }) => {\n const [VisualEditor, setVisualEditor] = useState<React.ComponentType | null>(null);\n\n useEffect(() => {\n // Dynamically import the visual editor based on the configured mode\n switch (visualEditorMode) {\n case VisualEditorMode.InjectScript:\n import('./VisualEditorInjectScript').then((module) => {\n setVisualEditor(() => module.default);\n });\n break;\n\n // VisualEditorMode.LazyLoad:\n default:\n import('@contentful/experiences-visual-editor-react').then((module) => {\n setVisualEditor(() => module.default);\n });\n }\n }, [visualEditorMode]);\n\n if (!VisualEditor) return null;\n\n return <VisualEditor />;\n};\n\nexport default VisualEditorLoader;\n"],"names":["_jsx"],"mappings":";;;;MAOa,kBAAkB,GAAsC,CAAC,EAAE,gBAAgB,EAAE,KAAI;IAC5F,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAA6B,IAAI,CAAC,CAAC;IAEnF,SAAS,CAAC,MAAK;;QAEb,QAAQ,gBAAgB;YACtB,KAAK,gBAAgB,CAAC,YAAY;gBAChC,OAAO,wCAA4B,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAI;oBACnD,eAAe,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC;AACxC,iBAAC,CAAC,CAAC;gBACH,MAAM;;AAGR,YAAA;gBACE,OAAO,6CAA6C,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAI;oBACpE,eAAe,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC;AACxC,iBAAC,CAAC,CAAC;SACN;AACH,KAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAEvB,IAAA,IAAI,CAAC,YAAY;AAAE,QAAA,OAAO,IAAI,CAAC;IAE/B,OAAOA,GAAA,CAAC,YAAY,EAAA,EAAA,CAAG,CAAC;AAC1B;;;;"}
1
+ {"version":3,"file":"VisualEditorLoader-255ce544.js","sources":["../../src/blocks/editor/VisualEditorLoader.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { VisualEditorMode } from '@contentful/experiences-core';\n\ntype VisualEditorLoaderProps = {\n visualEditorMode: VisualEditorMode;\n};\n\nexport const VisualEditorLoader: React.FC<VisualEditorLoaderProps> = ({ visualEditorMode }) => {\n const [VisualEditor, setVisualEditor] = useState<React.ComponentType | null>(null);\n\n useEffect(() => {\n // Dynamically import the visual editor based on the configured mode\n switch (visualEditorMode) {\n case VisualEditorMode.InjectScript:\n import('./VisualEditorInjectScript').then((module) => {\n setVisualEditor(() => module.default);\n });\n break;\n\n // VisualEditorMode.LazyLoad:\n default:\n import('@contentful/experiences-visual-editor-react').then((module) => {\n setVisualEditor(() => module.default);\n });\n }\n }, [visualEditorMode]);\n\n if (!VisualEditor) return null;\n\n return <VisualEditor />;\n};\n\nexport default VisualEditorLoader;\n"],"names":["_jsx"],"mappings":";;;;MAOa,kBAAkB,GAAsC,CAAC,EAAE,gBAAgB,EAAE,KAAI;IAC5F,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAA6B,IAAI,CAAC,CAAC;IAEnF,SAAS,CAAC,MAAK;;QAEb,QAAQ,gBAAgB;YACtB,KAAK,gBAAgB,CAAC,YAAY;gBAChC,OAAO,wCAA4B,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAI;oBACnD,eAAe,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC;AACxC,iBAAC,CAAC,CAAC;gBACH,MAAM;;AAGR,YAAA;gBACE,OAAO,6CAA6C,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAI;oBACpE,eAAe,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC;AACxC,iBAAC,CAAC,CAAC;SACN;AACH,KAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAEvB,IAAA,IAAI,CAAC,YAAY;AAAE,QAAA,OAAO,IAAI,CAAC;IAE/B,OAAOA,GAAA,CAAC,YAAY,EAAA,EAAA,CAAG,CAAC;AAC1B;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as _contentful_experiences_core from '@contentful/experiences-core';
2
3
  import { EntityStore, VisualEditorMode } from '@contentful/experiences-core';
3
4
  export { VisualEditorMode, createExperience, defineDesignTokens, fetchById, fetchBySlug } from '@contentful/experiences-core';
4
5
  import * as _contentful_experiences_core_types from '@contentful/experiences-core/types';
5
6
  import { Experience, ComponentRegistration, ComponentRegistrationOptions } from '@contentful/experiences-core/types';
6
7
  export { ComponentDefinition, ExternalSDKMode } from '@contentful/experiences-core/types';
7
- import * as _contentful_experiences_core_dist_entity_EntityStore from '@contentful/experiences-core/dist/entity/EntityStore';
8
8
  import { ContentfulClientApi } from 'contentful';
9
9
  export { CF_STYLE_ATTRIBUTES, CONTENTFUL_COMPONENTS, LATEST_SCHEMA_VERSION } from '@contentful/experiences-core/constants';
10
10
 
@@ -23,7 +23,7 @@ type UseFetchByIdArgs = {
23
23
  };
24
24
  declare const useFetchById: ({ id, localeCode, client, experienceTypeId }: UseFetchByIdArgs) => {
25
25
  error: Error | undefined;
26
- experience: _contentful_experiences_core_types.Experience<_contentful_experiences_core_dist_entity_EntityStore.EntityStore> | undefined;
26
+ experience: _contentful_experiences_core_types.Experience<_contentful_experiences_core.EntityStore> | undefined;
27
27
  isLoading: boolean;
28
28
  isEditorMode: boolean;
29
29
  };
@@ -36,7 +36,7 @@ type UseFetchBySlugArgs = {
36
36
  };
37
37
  declare const useFetchBySlug: ({ slug, localeCode, client, experienceTypeId, }: UseFetchBySlugArgs) => {
38
38
  error: Error | undefined;
39
- experience: _contentful_experiences_core_types.Experience<_contentful_experiences_core_dist_entity_EntityStore.EntityStore> | undefined;
39
+ experience: _contentful_experiences_core_types.Experience<_contentful_experiences_core.EntityStore> | undefined;
40
40
  isLoading: boolean;
41
41
  isEditorMode: boolean;
42
42
  };