@contentful/experiences-react 0.8.6 → 0.8.8
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/CHANGELOG.md +19 -0
- package/README.md +4 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/use-live-preview-experience.d.ts +1 -0
- package/dist/use-live-preview-experience.js +8 -8
- package/dist/use-live-preview-experience.js.map +1 -1
- package/dist/use-live-preview.d.ts +1 -0
- package/dist/use-live-preview.js +2 -1
- package/dist/use-live-preview.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
## 0.8.8 (2026-09-22)
|
|
2
|
+
|
|
3
|
+
### 🧱 Updated Dependencies
|
|
4
|
+
|
|
5
|
+
- Updated live-preview to 0.1.6
|
|
6
|
+
- Updated client to 0.4.6
|
|
7
|
+
- Updated design to 0.8.5
|
|
8
|
+
- Updated core to 0.8.5
|
|
9
|
+
|
|
10
|
+
## 0.8.7 (2026-09-22)
|
|
11
|
+
|
|
12
|
+
### 🚀 Features
|
|
13
|
+
|
|
14
|
+
- **live-preview:** expose connection errors [SPA-5151] ([#198](https://github.com/contentful/experiences/pull/198))
|
|
15
|
+
|
|
16
|
+
### 🧱 Updated Dependencies
|
|
17
|
+
|
|
18
|
+
- Updated live-preview to 0.1.5
|
|
19
|
+
|
|
1
20
|
## 0.8.6 (2026-09-21)
|
|
2
21
|
|
|
3
22
|
### 🚀 Features
|
package/README.md
CHANGED
|
@@ -30,6 +30,7 @@ createClient(options) // Functional constructor matching t
|
|
|
30
30
|
ContentfulViewDeliveryClient // Re-exported delivery client for advanced use cases
|
|
31
31
|
NotFoundError // Thrown when the Experience ID doesn't exist
|
|
32
32
|
PreviewSessionFetchError // Thrown when fetching a Preview Session fails
|
|
33
|
+
LivePreviewConnectionError // Reported when the live-preview connection fails
|
|
33
34
|
ContentfulViewDelivery // Full error namespace from the delivery client
|
|
34
35
|
type ExperienceOptions, PreviewSessionExperienceOptions, PreviewSessionClientOptions,
|
|
35
36
|
PreviewSessionResolveOptions, ClientOptions, ResolveOptions, CreateClientOptions
|
|
@@ -102,6 +103,9 @@ const plan = useExperiencePlan({
|
|
|
102
103
|
into the `PortableRenderPlan` consumed by the renderer and keeps the current rendered
|
|
103
104
|
experience while an update is being resolved.
|
|
104
105
|
|
|
106
|
+
The live-preview results also expose `error` when the Preview Session connection
|
|
107
|
+
fails. The last valid `data` remains available.
|
|
108
|
+
|
|
105
109
|
### Renderers
|
|
106
110
|
|
|
107
111
|
```ts
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { DiagnosticReporter, RenderError, RenderUnknown } from './nodes-renderer
|
|
|
8
8
|
export { UseLivePreviewExperienceOptions, UseLivePreviewExperienceResult, useLivePreviewExperience } from './use-live-preview-experience.js';
|
|
9
9
|
export { UseLivePreviewOptions, UseLivePreviewResult, useLivePreview } from './use-live-preview.js';
|
|
10
10
|
export { ExperiencePlanResolveOptions, UseExperiencePlanOptions, UseExperiencePlanResult, useExperiencePlan } from './use-experience-plan.js';
|
|
11
|
-
export { LivePreviewClient, PREVIEW_WEBSOCKET_HOST, PreviewSessionClientOptions, PreviewSessionExperienceOptions, PreviewSessionFetchError, PreviewSessionOptions, PreviewSessionResolveOptions, fetchPreviewSession } from '@contentful/experiences-live-preview';
|
|
11
|
+
export { LivePreviewClient, LivePreviewConnectionError, LivePreviewResult, PREVIEW_WEBSOCKET_HOST, PreviewSessionClientOptions, PreviewSessionExperienceOptions, PreviewSessionFetchError, PreviewSessionOptions, PreviewSessionResolveOptions, fetchPreviewSession } from '@contentful/experiences-live-preview';
|
|
12
12
|
export { useContentfulComponent, useContentfulExperienceTemplate, useExperience } from './context.js';
|
|
13
13
|
export { useDesignValues } from './use-design-values.js';
|
|
14
14
|
export { ToCssOptions, toCss } from './design-utils.js';
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,7 @@ import { useLivePreview } from "./use-live-preview";
|
|
|
12
12
|
import { useExperiencePlan } from "./use-experience-plan";
|
|
13
13
|
import {
|
|
14
14
|
fetchPreviewSession,
|
|
15
|
+
LivePreviewConnectionError,
|
|
15
16
|
PREVIEW_WEBSOCKET_HOST,
|
|
16
17
|
PreviewSessionFetchError
|
|
17
18
|
} from "@contentful/experiences-live-preview";
|
|
@@ -56,6 +57,7 @@ export {
|
|
|
56
57
|
DebugExperience,
|
|
57
58
|
ExperienceFetchError,
|
|
58
59
|
ClientExperienceRenderer as ExperienceRenderer,
|
|
60
|
+
LivePreviewConnectionError,
|
|
59
61
|
MissingComponent,
|
|
60
62
|
NotFoundError,
|
|
61
63
|
PREVIEW_HOST,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/*\n * Public API surface for `@contentful/experiences-react`.\n *\n * Customers add ONLY this package to their app's dependencies. Everything\n * needed to render an Experience — types, the resolver, viewport utilities,\n * the renderer components, the authoring helpers — is re-exported from here.\n * The internal `@contentful/experiences-sdk-core` and\n * `@contentful/experiences-design` packages are workspace-only implementation\n * details; they are not part of the public API.\n *\n * `ExperienceRenderer` is an alias for `ClientExperienceRenderer`; SSR\n * consumers explicitly import `ServerExperienceRenderer`.\n */\n\n// ─── Renderers ─────────────────────────────────────────────────────────────\nexport {\n ClientExperienceRenderer as ExperienceRenderer,\n ClientExperienceRenderer,\n} from './client-renderer';\nexport type { ClientExperienceRendererProps as ExperienceRendererProps } from './client-renderer';\nexport type { ClientExperienceRendererProps } from './client-renderer';\n\nexport { ServerExperienceRenderer } from './server-renderer';\nexport type { ServerExperienceRendererProps } from './server-renderer';\n\nexport { MissingComponent } from './missing-component';\nexport type { MissingComponentProps } from './missing-component';\n\nexport { ComponentError } from './component-error';\nexport type { ComponentErrorProps } from './component-error';\n\nexport { DebugExperience } from './debug-experience';\nexport type { DebugExperienceProps } from './debug-experience';\n\nexport { useActiveViewport } from './use-active-viewport';\nexport type { UseActiveViewportResult } from './use-active-viewport';\n\nexport type { DiagnosticReporter, RenderError, RenderUnknown } from './nodes-renderer';\n\nexport { useLivePreviewExperience } from './use-live-preview-experience';\nexport type {\n UseLivePreviewExperienceOptions,\n UseLivePreviewExperienceResult,\n} from './use-live-preview-experience';\nexport { useLivePreview } from './use-live-preview';\nexport type { UseLivePreviewOptions, UseLivePreviewResult } from './use-live-preview';\n\nexport { useExperiencePlan } from './use-experience-plan';\nexport type {\n ExperiencePlanResolveOptions,\n UseExperiencePlanOptions,\n UseExperiencePlanResult,\n} from './use-experience-plan';\nexport type {\n LivePreviewClient,\n PreviewSessionClientOptions,\n PreviewSessionExperienceOptions,\n PreviewSessionOptions,\n PreviewSessionResolveOptions,\n} from '@contentful/experiences-live-preview';\nexport {\n fetchPreviewSession,\n PREVIEW_WEBSOCKET_HOST,\n PreviewSessionFetchError,\n} from '@contentful/experiences-live-preview';\n\n// ─── Runtime context hooks ───────────────────────────────────────────────\nexport { useExperience, useContentfulComponent, useContentfulExperienceTemplate } from './context';\nexport { useDesignValues } from './use-design-values';\nexport { toCss } from './design-utils';\nexport type { ToCssOptions } from './design-utils';\n\n// ─── Authoring helpers + Config types ─────────────────────────────────────\nexport {\n defineComponent,\n defineExperienceTemplate,\n normalizeComponentRegistration,\n normalizeExperienceTemplateRegistration,\n} from './types';\nexport type {\n ComponentConfig,\n Components,\n Config,\n ContentfulComponent,\n ContentfulExperienceTemplate,\n ExperienceTemplateConfig,\n ExperienceTemplateRegistration,\n ExperienceTemplates,\n Registration,\n RenderContext,\n ResolveToken,\n} from './types';\n\n// ─── Resolver (re-exported from render-core) ──────────────────────────────\nexport { resolveExperience } from '@contentful/experiences-sdk-core';\nexport type { ResolverConfig, ResolveExperienceOptions } from '@contentful/experiences-sdk-core';\n\n// ─── Core IR + payload types (re-exported from render-core) ───────────────\nexport type {\n ComponentNode,\n ComponentRef,\n DesignPropValue,\n DesignToken,\n ExperienceContext,\n ExperienceNode,\n ExperiencePayload,\n ExperienceSourceMap,\n ExperienceSys,\n ExperienceTemplateNode,\n ExperienceTemplateRef,\n ManualDesignValue,\n PortableRegistration,\n PortableRenderNode,\n PortableRenderPlan,\n ResolveContext,\n ValuesByViewport,\n ViewportDef,\n} from '@contentful/experiences-sdk-core';\n\n// ─── Design utilities (re-exported from design) ───────────────────────────\nexport {\n CSS_PROPERTIES,\n getValueForViewport,\n getViewportIndex,\n isCssProperty,\n resolveDesignProperties,\n toCssKey,\n toCssMediaQuery,\n} from '@contentful/experiences-design';\n\n// ─── Delivery client + fetchExperience ────────────────────────────────────\nexport {\n ContentfulViewDelivery,\n ContentfulViewDeliveryClient,\n DELIVERY_HOST,\n ExperienceFetchError,\n NotFoundError,\n PREVIEW_HOST,\n createClient,\n fetchExperience,\n readSourceMap,\n toExperiencePayload,\n} from '@contentful/experiences-client';\nexport type {\n ClientOptions,\n CreateClientOptions,\n ExperienceOptions,\n ExperienceResponse,\n ResolveOptions,\n} from '@contentful/experiences-client';\n"],"mappings":"AAeA;AAAA,EAC8B;AAAA,EAC5B,4BAAAA;AAAA,OACK;AAIP,SAAS,gCAAgC;AAGzC,SAAS,wBAAwB;AAGjC,SAAS,sBAAsB;AAG/B,SAAS,uBAAuB;AAGhC,SAAS,yBAAyB;AAKlC,SAAS,gCAAgC;AAKzC,SAAS,sBAAsB;AAG/B,SAAS,yBAAyB;
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/*\n * Public API surface for `@contentful/experiences-react`.\n *\n * Customers add ONLY this package to their app's dependencies. Everything\n * needed to render an Experience — types, the resolver, viewport utilities,\n * the renderer components, the authoring helpers — is re-exported from here.\n * The internal `@contentful/experiences-sdk-core` and\n * `@contentful/experiences-design` packages are workspace-only implementation\n * details; they are not part of the public API.\n *\n * `ExperienceRenderer` is an alias for `ClientExperienceRenderer`; SSR\n * consumers explicitly import `ServerExperienceRenderer`.\n */\n\n// ─── Renderers ─────────────────────────────────────────────────────────────\nexport {\n ClientExperienceRenderer as ExperienceRenderer,\n ClientExperienceRenderer,\n} from './client-renderer';\nexport type { ClientExperienceRendererProps as ExperienceRendererProps } from './client-renderer';\nexport type { ClientExperienceRendererProps } from './client-renderer';\n\nexport { ServerExperienceRenderer } from './server-renderer';\nexport type { ServerExperienceRendererProps } from './server-renderer';\n\nexport { MissingComponent } from './missing-component';\nexport type { MissingComponentProps } from './missing-component';\n\nexport { ComponentError } from './component-error';\nexport type { ComponentErrorProps } from './component-error';\n\nexport { DebugExperience } from './debug-experience';\nexport type { DebugExperienceProps } from './debug-experience';\n\nexport { useActiveViewport } from './use-active-viewport';\nexport type { UseActiveViewportResult } from './use-active-viewport';\n\nexport type { DiagnosticReporter, RenderError, RenderUnknown } from './nodes-renderer';\n\nexport { useLivePreviewExperience } from './use-live-preview-experience';\nexport type {\n UseLivePreviewExperienceOptions,\n UseLivePreviewExperienceResult,\n} from './use-live-preview-experience';\nexport { useLivePreview } from './use-live-preview';\nexport type { UseLivePreviewOptions, UseLivePreviewResult } from './use-live-preview';\n\nexport { useExperiencePlan } from './use-experience-plan';\nexport type {\n ExperiencePlanResolveOptions,\n UseExperiencePlanOptions,\n UseExperiencePlanResult,\n} from './use-experience-plan';\nexport type {\n LivePreviewClient,\n LivePreviewResult,\n PreviewSessionClientOptions,\n PreviewSessionExperienceOptions,\n PreviewSessionOptions,\n PreviewSessionResolveOptions,\n} from '@contentful/experiences-live-preview';\nexport {\n fetchPreviewSession,\n LivePreviewConnectionError,\n PREVIEW_WEBSOCKET_HOST,\n PreviewSessionFetchError,\n} from '@contentful/experiences-live-preview';\n\n// ─── Runtime context hooks ───────────────────────────────────────────────\nexport { useExperience, useContentfulComponent, useContentfulExperienceTemplate } from './context';\nexport { useDesignValues } from './use-design-values';\nexport { toCss } from './design-utils';\nexport type { ToCssOptions } from './design-utils';\n\n// ─── Authoring helpers + Config types ─────────────────────────────────────\nexport {\n defineComponent,\n defineExperienceTemplate,\n normalizeComponentRegistration,\n normalizeExperienceTemplateRegistration,\n} from './types';\nexport type {\n ComponentConfig,\n Components,\n Config,\n ContentfulComponent,\n ContentfulExperienceTemplate,\n ExperienceTemplateConfig,\n ExperienceTemplateRegistration,\n ExperienceTemplates,\n Registration,\n RenderContext,\n ResolveToken,\n} from './types';\n\n// ─── Resolver (re-exported from render-core) ──────────────────────────────\nexport { resolveExperience } from '@contentful/experiences-sdk-core';\nexport type { ResolverConfig, ResolveExperienceOptions } from '@contentful/experiences-sdk-core';\n\n// ─── Core IR + payload types (re-exported from render-core) ───────────────\nexport type {\n ComponentNode,\n ComponentRef,\n DesignPropValue,\n DesignToken,\n ExperienceContext,\n ExperienceNode,\n ExperiencePayload,\n ExperienceSourceMap,\n ExperienceSys,\n ExperienceTemplateNode,\n ExperienceTemplateRef,\n ManualDesignValue,\n PortableRegistration,\n PortableRenderNode,\n PortableRenderPlan,\n ResolveContext,\n ValuesByViewport,\n ViewportDef,\n} from '@contentful/experiences-sdk-core';\n\n// ─── Design utilities (re-exported from design) ───────────────────────────\nexport {\n CSS_PROPERTIES,\n getValueForViewport,\n getViewportIndex,\n isCssProperty,\n resolveDesignProperties,\n toCssKey,\n toCssMediaQuery,\n} from '@contentful/experiences-design';\n\n// ─── Delivery client + fetchExperience ────────────────────────────────────\nexport {\n ContentfulViewDelivery,\n ContentfulViewDeliveryClient,\n DELIVERY_HOST,\n ExperienceFetchError,\n NotFoundError,\n PREVIEW_HOST,\n createClient,\n fetchExperience,\n readSourceMap,\n toExperiencePayload,\n} from '@contentful/experiences-client';\nexport type {\n ClientOptions,\n CreateClientOptions,\n ExperienceOptions,\n ExperienceResponse,\n ResolveOptions,\n} from '@contentful/experiences-client';\n"],"mappings":"AAeA;AAAA,EAC8B;AAAA,EAC5B,4BAAAA;AAAA,OACK;AAIP,SAAS,gCAAgC;AAGzC,SAAS,wBAAwB;AAGjC,SAAS,sBAAsB;AAG/B,SAAS,uBAAuB;AAGhC,SAAS,yBAAyB;AAKlC,SAAS,gCAAgC;AAKzC,SAAS,sBAAsB;AAG/B,SAAS,yBAAyB;AAclC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,SAAS,eAAe,wBAAwB,uCAAuC;AACvF,SAAS,uBAAuB;AAChC,SAAS,aAAa;AAItB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAgBP,SAAS,yBAAyB;AA0BlC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":["ClientExperienceRenderer"]}
|
|
@@ -7,6 +7,7 @@ type UseLivePreviewExperienceOptions = {
|
|
|
7
7
|
};
|
|
8
8
|
interface UseLivePreviewExperienceResult {
|
|
9
9
|
readonly data: ExperiencePayload | undefined;
|
|
10
|
+
readonly error: Error | undefined;
|
|
10
11
|
}
|
|
11
12
|
declare function useLivePreviewExperience(options: UseLivePreviewExperienceOptions): UseLivePreviewExperienceResult;
|
|
12
13
|
|
|
@@ -18,15 +18,15 @@ function useLivePreviewExperience(options) {
|
|
|
18
18
|
previewSessionOptions?.sessionHost,
|
|
19
19
|
previewSessionOptions?.debug
|
|
20
20
|
]);
|
|
21
|
-
const emptySource = useMemo(
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
const emptySource = useMemo(() => {
|
|
22
|
+
const result2 = { data: initialPayload, error: void 0 };
|
|
23
|
+
return {
|
|
24
|
+
getResult: () => result2,
|
|
24
25
|
subscribe: () => () => void 0
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
);
|
|
26
|
+
};
|
|
27
|
+
}, [initialPayload]);
|
|
28
28
|
const source = client ?? emptySource;
|
|
29
|
-
const
|
|
29
|
+
const result = useSyncExternalStore(source.subscribe, source.getResult, source.getResult);
|
|
30
30
|
useEffect(() => {
|
|
31
31
|
if (client === void 0) {
|
|
32
32
|
sendPreviewStatus("static");
|
|
@@ -34,7 +34,7 @@ function useLivePreviewExperience(options) {
|
|
|
34
34
|
}
|
|
35
35
|
return client.subscribeStatus(sendPreviewStatus);
|
|
36
36
|
}, [client]);
|
|
37
|
-
return
|
|
37
|
+
return result;
|
|
38
38
|
}
|
|
39
39
|
export {
|
|
40
40
|
useLivePreviewExperience
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/use-live-preview-experience.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useMemo, useSyncExternalStore } from 'react';\n\nimport {\n createLivePreviewClient,\n sendPreviewStatus,\n type PreviewSessionOptions,\n} from '@contentful/experiences-live-preview';\nimport type { ExperiencePayload } from '@contentful/experiences-sdk-core';\n\nexport type UseLivePreviewExperienceOptions = {\n previewSessionOptions?: PreviewSessionOptions;\n initialPayload?: ExperiencePayload;\n};\n\nexport interface UseLivePreviewExperienceResult {\n readonly data: ExperiencePayload | undefined;\n}\n\nexport function useLivePreviewExperience(\n options: UseLivePreviewExperienceOptions\n): UseLivePreviewExperienceResult {\n const { previewSessionOptions, initialPayload } = options;\n const client = useMemo(() => {\n if (previewSessionOptions === undefined) return undefined;\n\n return createLivePreviewClient(previewSessionOptions, initialPayload);\n }, [\n previewSessionOptions?.spaceId,\n previewSessionOptions?.environmentId,\n previewSessionOptions?.previewToken,\n previewSessionOptions?.sessionId,\n previewSessionOptions?.resourceResolution,\n previewSessionOptions?.sessionHost,\n previewSessionOptions?.debug,\n ]);\n\n const emptySource = useMemo(
|
|
1
|
+
{"version":3,"sources":["../src/use-live-preview-experience.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useMemo, useSyncExternalStore } from 'react';\n\nimport {\n createLivePreviewClient,\n sendPreviewStatus,\n type LivePreviewClient,\n type LivePreviewResult,\n type PreviewSessionOptions,\n} from '@contentful/experiences-live-preview';\nimport type { ExperiencePayload } from '@contentful/experiences-sdk-core';\n\nexport type UseLivePreviewExperienceOptions = {\n previewSessionOptions?: PreviewSessionOptions;\n initialPayload?: ExperiencePayload;\n};\n\nexport interface UseLivePreviewExperienceResult {\n readonly data: ExperiencePayload | undefined;\n readonly error: Error | undefined;\n}\n\nexport function useLivePreviewExperience(\n options: UseLivePreviewExperienceOptions\n): UseLivePreviewExperienceResult {\n const { previewSessionOptions, initialPayload } = options;\n const client = useMemo(() => {\n if (previewSessionOptions === undefined) return undefined;\n\n return createLivePreviewClient(previewSessionOptions, initialPayload);\n }, [\n previewSessionOptions?.spaceId,\n previewSessionOptions?.environmentId,\n previewSessionOptions?.previewToken,\n previewSessionOptions?.sessionId,\n previewSessionOptions?.resourceResolution,\n previewSessionOptions?.sessionHost,\n previewSessionOptions?.debug,\n ]);\n\n const emptySource = useMemo<Pick<LivePreviewClient, 'getResult' | 'subscribe'>>(() => {\n const result: LivePreviewResult = { data: initialPayload, error: undefined };\n return {\n getResult: () => result,\n subscribe: () => () => undefined,\n };\n }, [initialPayload]);\n const source = client ?? emptySource;\n const result = useSyncExternalStore(source.subscribe, source.getResult, source.getResult);\n\n useEffect(() => {\n if (client === undefined) {\n sendPreviewStatus('static');\n return;\n }\n\n return client.subscribeStatus(sendPreviewStatus);\n }, [client]);\n\n return result;\n}\n"],"mappings":";AAEA,SAAS,WAAW,SAAS,4BAA4B;AAEzD;AAAA,EACE;AAAA,EACA;AAAA,OAIK;AAaA,SAAS,yBACd,SACgC;AAChC,QAAM,EAAE,uBAAuB,eAAe,IAAI;AAClD,QAAM,SAAS,QAAQ,MAAM;AAC3B,QAAI,0BAA0B,OAAW,QAAO;AAEhD,WAAO,wBAAwB,uBAAuB,cAAc;AAAA,EACtE,GAAG;AAAA,IACD,uBAAuB;AAAA,IACvB,uBAAuB;AAAA,IACvB,uBAAuB;AAAA,IACvB,uBAAuB;AAAA,IACvB,uBAAuB;AAAA,IACvB,uBAAuB;AAAA,IACvB,uBAAuB;AAAA,EACzB,CAAC;AAED,QAAM,cAAc,QAA4D,MAAM;AACpF,UAAMA,UAA4B,EAAE,MAAM,gBAAgB,OAAO,OAAU;AAC3E,WAAO;AAAA,MACL,WAAW,MAAMA;AAAA,MACjB,WAAW,MAAM,MAAM;AAAA,IACzB;AAAA,EACF,GAAG,CAAC,cAAc,CAAC;AACnB,QAAM,SAAS,UAAU;AACzB,QAAM,SAAS,qBAAqB,OAAO,WAAW,OAAO,WAAW,OAAO,SAAS;AAExF,YAAU,MAAM;AACd,QAAI,WAAW,QAAW;AACxB,wBAAkB,QAAQ;AAC1B;AAAA,IACF;AAEA,WAAO,OAAO,gBAAgB,iBAAiB;AAAA,EACjD,GAAG,CAAC,MAAM,CAAC;AAEX,SAAO;AACT;","names":["result"]}
|
package/dist/use-live-preview.js
CHANGED
|
@@ -6,11 +6,12 @@ function useLivePreview(options) {
|
|
|
6
6
|
previewSessionOptions: options.previewSessionOptions,
|
|
7
7
|
initialPayload: options.initialPayload
|
|
8
8
|
});
|
|
9
|
-
|
|
9
|
+
const plan = useExperiencePlan({
|
|
10
10
|
payload: livePreview.data,
|
|
11
11
|
initialPlan: options.initialPlan,
|
|
12
12
|
resolveOptions: options.resolveOptions
|
|
13
13
|
});
|
|
14
|
+
return { data: plan.data, error: livePreview.error };
|
|
14
15
|
}
|
|
15
16
|
export {
|
|
16
17
|
useLivePreview
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/use-live-preview.ts"],"sourcesContent":["'use client';\n\nimport type { ExperiencePayload, PortableRenderPlan } from '@contentful/experiences-sdk-core';\nimport type { PreviewSessionOptions } from '@contentful/experiences-live-preview';\n\nimport { useLivePreviewExperience } from './use-live-preview-experience';\nimport { useExperiencePlan, type ExperiencePlanResolveOptions } from './use-experience-plan';\n\nexport interface UseLivePreviewOptions {\n previewSessionOptions?: PreviewSessionOptions;\n initialPayload?: ExperiencePayload;\n initialPlan?: PortableRenderPlan;\n resolveOptions: ExperiencePlanResolveOptions;\n}\n\nexport interface UseLivePreviewResult {\n readonly data: PortableRenderPlan | undefined;\n}\n\nexport function useLivePreview(options: UseLivePreviewOptions): UseLivePreviewResult {\n const livePreview = useLivePreviewExperience({\n previewSessionOptions: options.previewSessionOptions,\n initialPayload: options.initialPayload,\n });\n\n
|
|
1
|
+
{"version":3,"sources":["../src/use-live-preview.ts"],"sourcesContent":["'use client';\n\nimport type { ExperiencePayload, PortableRenderPlan } from '@contentful/experiences-sdk-core';\nimport type { PreviewSessionOptions } from '@contentful/experiences-live-preview';\n\nimport { useLivePreviewExperience } from './use-live-preview-experience';\nimport { useExperiencePlan, type ExperiencePlanResolveOptions } from './use-experience-plan';\n\nexport interface UseLivePreviewOptions {\n previewSessionOptions?: PreviewSessionOptions;\n initialPayload?: ExperiencePayload;\n initialPlan?: PortableRenderPlan;\n resolveOptions: ExperiencePlanResolveOptions;\n}\n\nexport interface UseLivePreviewResult {\n readonly data: PortableRenderPlan | undefined;\n readonly error: Error | undefined;\n}\n\nexport function useLivePreview(options: UseLivePreviewOptions): UseLivePreviewResult {\n const livePreview = useLivePreviewExperience({\n previewSessionOptions: options.previewSessionOptions,\n initialPayload: options.initialPayload,\n });\n\n const plan = useExperiencePlan({\n payload: livePreview.data,\n initialPlan: options.initialPlan,\n resolveOptions: options.resolveOptions,\n });\n\n return { data: plan.data, error: livePreview.error };\n}\n"],"mappings":";AAKA,SAAS,gCAAgC;AACzC,SAAS,yBAA4D;AAc9D,SAAS,eAAe,SAAsD;AACnF,QAAM,cAAc,yBAAyB;AAAA,IAC3C,uBAAuB,QAAQ;AAAA,IAC/B,gBAAgB,QAAQ;AAAA,EAC1B,CAAC;AAED,QAAM,OAAO,kBAAkB;AAAA,IAC7B,SAAS,YAAY;AAAA,IACrB,aAAa,QAAQ;AAAA,IACrB,gBAAgB,QAAQ;AAAA,EAC1B,CAAC;AAED,SAAO,EAAE,MAAM,KAAK,MAAM,OAAO,YAAY,MAAM;AACrD;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experiences-react",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.8",
|
|
4
4
|
"description": "React adapter for Contentful Experiences — Server and Client renderers over a PortableRenderPlan",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"directory": "packages/adapter-react"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@contentful/experiences-client": "0.4.
|
|
34
|
-
"@contentful/experiences-sdk-core": "0.8.
|
|
35
|
-
"@contentful/experiences-design": "0.8.
|
|
36
|
-
"@contentful/experiences-live-preview": "0.1.
|
|
33
|
+
"@contentful/experiences-client": "0.4.6",
|
|
34
|
+
"@contentful/experiences-sdk-core": "0.8.5",
|
|
35
|
+
"@contentful/experiences-design": "0.8.5",
|
|
36
|
+
"@contentful/experiences-live-preview": "0.1.6"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"jsdom": "^30.0.1"
|