@contentful/experiences-client 0.10.0 → 0.10.1

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.
@@ -0,0 +1,241 @@
1
+ import { ContentfulViewDeliveryClient, ContentfulViewDelivery } from '@contentful/experience-delivery';
2
+ export { ContentfulViewDelivery, ContentfulViewDeliveryClient } from '@contentful/experience-delivery';
3
+ import { ResolverConfig, PortableRenderPlan, ExperienceSourceMap, ExperiencePayload } from '@contentful/experiences-sdk-core';
4
+
5
+ /**
6
+ * Thrown by `fetchExperience` for a fetch failure that is not "experience not
7
+ * found" — network failure, an invalid/expired token, a 5xx from the
8
+ * delivery API, etc. This failure mode is "surface clearly to the host app,"
9
+ * unlike the diagnostics `resolveExperience` collects for resolve/render-time
10
+ * issues — there's no partial payload to render around a fetch that never
11
+ * returned one, so a real thrown class is the right shape.
12
+ *
13
+ * `NotFoundError` (the delivery client's class, re-exported from this
14
+ * package) is the one exception: it passes through undisturbed so callers
15
+ * can route it to their framework's 404 idiom, per the existing
16
+ * distinguishable-404 contract.
17
+ *
18
+ * `environmentId` is `undefined` for the destination-shaped `fetchExperience`
19
+ * branches — the destinations delivery endpoints are space-scoped only, with
20
+ * no environment segment, unlike the by-id path.
21
+ */
22
+ declare class ExperienceFetchError extends Error {
23
+ readonly spaceId: string;
24
+ readonly environmentId: string | undefined;
25
+ readonly experienceId: string;
26
+ constructor(message: string, options: {
27
+ spaceId: string;
28
+ environmentId?: string;
29
+ experienceId: string;
30
+ cause?: unknown;
31
+ });
32
+ }
33
+ /**
34
+ * Thrown by `fetchExperience` and `fetchDestinationSitemap` when
35
+ * `clientOptions.preview` is `true` for a destination-shaped call
36
+ * (`destinationId` + `nodeId`/`path`, or a sitemap fetch). The Destinations
37
+ * Delivery API has no preview host or preview-token support yet, so this
38
+ * guards against silently hitting the production host with a preview token
39
+ * it doesn't accept.
40
+ *
41
+ * This is a bridge, not a permanent design: revisit once the platform ships
42
+ * preview support for destinations.
43
+ *
44
+ * Only fires for the inline-credentials branch of `ClientOptions`. A
45
+ * caller-supplied `{ client }` already ignores `preview` entirely, per that
46
+ * branch's existing contract.
47
+ */
48
+ declare class DestinationPreviewNotSupportedError extends Error {
49
+ readonly spaceId: string;
50
+ readonly destinationId: string;
51
+ readonly nodeId: string | undefined;
52
+ readonly path: string | undefined;
53
+ constructor(message: string, options: {
54
+ spaceId: string;
55
+ destinationId: string;
56
+ nodeId?: string;
57
+ path?: string;
58
+ });
59
+ }
60
+
61
+ /** Options for the legacy functional Delivery client constructor. */
62
+ type CreateClientOptions = {
63
+ accessToken: string;
64
+ /**
65
+ * Base URL for the delivery client. Defaults to `DELIVERY_HOST` when omitted.
66
+ * Pass `PREVIEW_HOST` for preview mode, or any custom URL (staging, proxy,
67
+ * per-region). Both constants are exported from this package.
68
+ */
69
+ host?: string;
70
+ } & Omit<ContentfulViewDeliveryClient.Options, 'token' | 'baseUrl'>;
71
+ declare function createClient(options: CreateClientOptions): ContentfulViewDeliveryClient;
72
+
73
+ type ClientOptions = {
74
+ accessToken: string;
75
+ /**
76
+ * Preview access token. Required when calling with `preview: true`.
77
+ */
78
+ previewToken?: string;
79
+ /**
80
+ * Flip between delivery (default) and preview at request time. When
81
+ * `true`, uses `previewToken` and the preview host; when `false` or
82
+ * unset, uses `accessToken` and the delivery host. Ignored when a
83
+ * pre-made `client` is passed instead of inline creds.
84
+ */
85
+ preview?: boolean;
86
+ /**
87
+ * Custom base URL for the delivery client (staging, proxy, per-region).
88
+ * Wins over the `preview`-derived default host — combine `host` with
89
+ * `preview: true` to point preview mode at a non-prod endpoint.
90
+ * Omit for the standard delivery / preview hosts.
91
+ */
92
+ host?: string;
93
+ } | {
94
+ client: ContentfulViewDeliveryClient;
95
+ };
96
+
97
+ type DeliveryExperienceRequestExtensions = ContentfulViewDelivery.GetWithOverridesExperienceRequestExtensions;
98
+ type PersonalizationOptions = NonNullable<DeliveryExperienceRequestExtensions['personalization']>;
99
+ type ExperienceRequestExtensions = Omit<DeliveryExperienceRequestExtensions, 'personalization'>;
100
+ type ByIdExperienceOptions = {
101
+ spaceId: string;
102
+ environmentId: string;
103
+ experienceId: string;
104
+ locale?: string;
105
+ /**
106
+ * Profile and events used by XDA to personalize the resolved Experience.
107
+ */
108
+ personalization?: PersonalizationOptions;
109
+ /**
110
+ * Additional XDA request extensions such as source maps. Supplying a defined
111
+ * extension switches the request to POST.
112
+ */
113
+ extensions?: ExperienceRequestExtensions;
114
+ };
115
+ /**
116
+ * Resolve an Experience by the Destination Node instead of `experienceId`
117
+ * The destinations delivery endpoints are space-scoped only and have no locale
118
+ * param, unlike the by-id path.
119
+ */
120
+ type ByDestinationNodeIdExperienceOptions = {
121
+ spaceId: string;
122
+ destinationId: string;
123
+ nodeId: string;
124
+ };
125
+ /**
126
+ * Resolve an Experience by the absolute path wired up to a
127
+ * Destination Node, instead of a node id directly. Same scoping as
128
+ * `ByDestinationNodeIdExperienceOptions` — no `environmentId` or `locale`.
129
+ */
130
+ type ByDestinationPathExperienceOptions = {
131
+ spaceId: string;
132
+ destinationId: string;
133
+ /** Absolute path to resolve. Must start with `/`. */
134
+ path: string;
135
+ };
136
+ type ExperienceOptions = ByIdExperienceOptions | ByDestinationNodeIdExperienceOptions | ByDestinationPathExperienceOptions;
137
+ /**
138
+ * A Destination resolution that the app must act on as control flow — honor
139
+ * it by navigating or re-resolving at the new path — rather than a hydrated
140
+ * Experience to render. Modeled as a normal return value, not a thrown error,
141
+ * per the Destinations delivery API's own framing of a redirect response.
142
+ */
143
+ interface DestinationRedirectResult {
144
+ redirect: {
145
+ path: string;
146
+ };
147
+ }
148
+ type ResolveOptions = {
149
+ config: ResolverConfig;
150
+ /**
151
+ * Arbitrary per-render metadata exposed to every resolver as
152
+ * `ctx.experience.metadata` and readable at render time via the framework
153
+ * adapter's `useExperience()` / `getExperience()`.
154
+ */
155
+ metadata?: Record<string, unknown>;
156
+ /**
157
+ * Observability switch. When on: logs the fetch (host, ids) and the raw
158
+ * payload here, and threads through to `resolveExperience` (resolution steps
159
+ * + `resolveData` timings) and the renderer (visible missing-component box,
160
+ * debug fallback). A single boolean across fetch + resolve + render.
161
+ */
162
+ debug?: boolean;
163
+ };
164
+ declare function fetchExperience(experienceOptions: ByIdExperienceOptions, clientOptions: ClientOptions, resolveOptions: ResolveOptions): Promise<PortableRenderPlan>;
165
+ declare function fetchExperience(experienceOptions: ByDestinationNodeIdExperienceOptions, clientOptions: ClientOptions, resolveOptions: ResolveOptions): Promise<PortableRenderPlan | DestinationRedirectResult>;
166
+ declare function fetchExperience(experienceOptions: ByDestinationPathExperienceOptions, clientOptions: ClientOptions, resolveOptions: ResolveOptions): Promise<PortableRenderPlan | DestinationRedirectResult>;
167
+
168
+ type FetchDestinationSitemapOptions = {
169
+ spaceId: string;
170
+ destinationId: string;
171
+ };
172
+ type FetchDestinationSitemapPaginationOptions = {
173
+ /** Maximum number of paths to return. Defaults to `100`, maximum `1000`. */
174
+ limit?: number;
175
+ /** Cursor from a previous call's `pages.next`. Treat as opaque; don't combine with `pagePrev`. */
176
+ pageNext?: string;
177
+ /** Cursor from a previous call's `pages.prev`. Treat as opaque; don't combine with `pageNext`. */
178
+ pagePrev?: string;
179
+ };
180
+ type SitemapPathItem = {
181
+ /** Path this entry routes. */
182
+ path: string;
183
+ /** Flat id extracted from the entry's `experienceUrn`. */
184
+ experienceId: string;
185
+ /** Type of the Destination Node that claims this path, e.g. `"DestinationExperienceNode"`. */
186
+ type: string;
187
+ };
188
+ type DestinationSitemapResult = {
189
+ items: SitemapPathItem[];
190
+ limit: number;
191
+ pages: {
192
+ next?: string;
193
+ prev?: string;
194
+ };
195
+ };
196
+ /**
197
+ * List every routable path in a published Destination. Bulk enumeration —
198
+ * pairs with `fetchExperience`'s `destinationId` + `nodeId`/`path` branches,
199
+ * which resolve one path at a time. Does not hydrate any Experience itself
200
+ * and does not call `fetchExperience` internally.
201
+ */
202
+ declare function fetchDestinationSitemap(destinationOptions: FetchDestinationSitemapOptions, clientOptions: ClientOptions, paginationOptions?: FetchDestinationSitemapPaginationOptions): Promise<DestinationSitemapResult>;
203
+
204
+ /** Either shape the experience endpoint can return — `get()` and `getWithOverrides()` share it. */
205
+ type ExperienceResponse = ContentfulViewDelivery.GetExperienceResponse | ContentfulViewDelivery.GetWithOverridesExperienceResponse;
206
+ /**
207
+ * Narrow a delivery response to `ExperiencePayload`.
208
+ *
209
+ * The endpoint types its response as `HydratedView | HydratedExperienceView`.
210
+ * The alpha-feature header the delivery client always sends guarantees the
211
+ * latter, but TypeScript cannot know that, so callers were left casting by hand.
212
+ *
213
+ * `fetchExperience` uses this internally; it is exported for anyone driving the
214
+ * delivery client directly. Type-level only — no validation, no copying.
215
+ *
216
+ * A legacy-shaped response carries `componentType` / `template` links instead;
217
+ * `resolveExperience` reports those through `warnUnrenderableNode`.
218
+ */
219
+ declare function toExperiencePayload(response: ExperienceResponse): ExperiencePayload;
220
+ /** Read `extensions.sourceMap` off a response. `undefined` when the request did not opt in. */
221
+ declare function readSourceMap(response: ExperienceResponse): ExperienceSourceMap | undefined;
222
+ /**
223
+ * Narrow a `ResolvedDestinationExperience.experience` to `ExperiencePayload`.
224
+ *
225
+ * Same cast rationale as `toExperiencePayload` above, for the destination
226
+ * resolution endpoints' `HydratedExperience` shape instead of the by-id
227
+ * endpoints' `HydratedExperienceView`.
228
+ */
229
+ declare function toExperiencePayloadFromDestination(experience: ContentfulViewDelivery.HydratedExperience): ExperiencePayload;
230
+
231
+ declare const DELIVERY_HOST = "https://xdn.contentful.com";
232
+ declare const PREVIEW_HOST = "https://preview.xdn.contentful.com";
233
+ declare const PREVIEW_WEBSOCKET_HOST = "wss://preview.xdn.contentful.com";
234
+
235
+ /** Validate and serialize events to the generated XDA request contract. */
236
+ declare function serializePersonalization(personalization: unknown): PersonalizationOptions;
237
+
238
+ declare const NotFoundError: typeof ContentfulViewDelivery.NotFoundError;
239
+ type NotFoundError = InstanceType<typeof ContentfulViewDelivery.NotFoundError>;
240
+
241
+ export { type ByDestinationNodeIdExperienceOptions, type ByDestinationPathExperienceOptions, type ByIdExperienceOptions, type ClientOptions, type CreateClientOptions, DELIVERY_HOST, DestinationPreviewNotSupportedError, type DestinationRedirectResult, type DestinationSitemapResult, ExperienceFetchError, type ExperienceOptions, type ExperienceRequestExtensions, type ExperienceResponse, type FetchDestinationSitemapOptions, type FetchDestinationSitemapPaginationOptions, NotFoundError, PREVIEW_HOST, PREVIEW_WEBSOCKET_HOST, type PersonalizationOptions, type ResolveOptions, type SitemapPathItem, createClient, fetchDestinationSitemap, fetchExperience, readSourceMap, serializePersonalization, toExperiencePayload, toExperiencePayloadFromDestination };
package/dist/index.d.ts CHANGED
@@ -1,15 +1,241 @@
1
- import { ContentfulViewDelivery } from '@contentful/experience-delivery';
1
+ import { ContentfulViewDeliveryClient, ContentfulViewDelivery } from '@contentful/experience-delivery';
2
2
  export { ContentfulViewDelivery, ContentfulViewDeliveryClient } from '@contentful/experience-delivery';
3
- export { DestinationPreviewNotSupportedError, ExperienceFetchError } from './errors.js';
4
- export { CreateClientOptions, createClient } from './create-delivery-client.js';
5
- export { ByDestinationNodeIdExperienceOptions, ByDestinationPathExperienceOptions, ByIdExperienceOptions, DestinationRedirectResult, ExperienceOptions, ExperienceRequestExtensions, PersonalizationOptions, ResolveOptions, fetchExperience } from './fetch-experience.js';
6
- export { DestinationSitemapResult, FetchDestinationSitemapOptions, FetchDestinationSitemapPaginationOptions, SitemapPathItem, fetchDestinationSitemap } from './fetch-destination-sitemap.js';
7
- export { ExperienceResponse, readSourceMap, toExperiencePayload, toExperiencePayloadFromDestination } from './to-experience-payload.js';
8
- export { DELIVERY_HOST, PREVIEW_HOST, PREVIEW_WEBSOCKET_HOST } from './hosts.js';
9
- export { ClientOptions } from './client-resolution.js';
10
- import '@contentful/experiences-sdk-core';
3
+ import { ResolverConfig, PortableRenderPlan, ExperienceSourceMap, ExperiencePayload } from '@contentful/experiences-sdk-core';
4
+
5
+ /**
6
+ * Thrown by `fetchExperience` for a fetch failure that is not "experience not
7
+ * found" — network failure, an invalid/expired token, a 5xx from the
8
+ * delivery API, etc. This failure mode is "surface clearly to the host app,"
9
+ * unlike the diagnostics `resolveExperience` collects for resolve/render-time
10
+ * issues — there's no partial payload to render around a fetch that never
11
+ * returned one, so a real thrown class is the right shape.
12
+ *
13
+ * `NotFoundError` (the delivery client's class, re-exported from this
14
+ * package) is the one exception: it passes through undisturbed so callers
15
+ * can route it to their framework's 404 idiom, per the existing
16
+ * distinguishable-404 contract.
17
+ *
18
+ * `environmentId` is `undefined` for the destination-shaped `fetchExperience`
19
+ * branches — the destinations delivery endpoints are space-scoped only, with
20
+ * no environment segment, unlike the by-id path.
21
+ */
22
+ declare class ExperienceFetchError extends Error {
23
+ readonly spaceId: string;
24
+ readonly environmentId: string | undefined;
25
+ readonly experienceId: string;
26
+ constructor(message: string, options: {
27
+ spaceId: string;
28
+ environmentId?: string;
29
+ experienceId: string;
30
+ cause?: unknown;
31
+ });
32
+ }
33
+ /**
34
+ * Thrown by `fetchExperience` and `fetchDestinationSitemap` when
35
+ * `clientOptions.preview` is `true` for a destination-shaped call
36
+ * (`destinationId` + `nodeId`/`path`, or a sitemap fetch). The Destinations
37
+ * Delivery API has no preview host or preview-token support yet, so this
38
+ * guards against silently hitting the production host with a preview token
39
+ * it doesn't accept.
40
+ *
41
+ * This is a bridge, not a permanent design: revisit once the platform ships
42
+ * preview support for destinations.
43
+ *
44
+ * Only fires for the inline-credentials branch of `ClientOptions`. A
45
+ * caller-supplied `{ client }` already ignores `preview` entirely, per that
46
+ * branch's existing contract.
47
+ */
48
+ declare class DestinationPreviewNotSupportedError extends Error {
49
+ readonly spaceId: string;
50
+ readonly destinationId: string;
51
+ readonly nodeId: string | undefined;
52
+ readonly path: string | undefined;
53
+ constructor(message: string, options: {
54
+ spaceId: string;
55
+ destinationId: string;
56
+ nodeId?: string;
57
+ path?: string;
58
+ });
59
+ }
60
+
61
+ /** Options for the legacy functional Delivery client constructor. */
62
+ type CreateClientOptions = {
63
+ accessToken: string;
64
+ /**
65
+ * Base URL for the delivery client. Defaults to `DELIVERY_HOST` when omitted.
66
+ * Pass `PREVIEW_HOST` for preview mode, or any custom URL (staging, proxy,
67
+ * per-region). Both constants are exported from this package.
68
+ */
69
+ host?: string;
70
+ } & Omit<ContentfulViewDeliveryClient.Options, 'token' | 'baseUrl'>;
71
+ declare function createClient(options: CreateClientOptions): ContentfulViewDeliveryClient;
72
+
73
+ type ClientOptions = {
74
+ accessToken: string;
75
+ /**
76
+ * Preview access token. Required when calling with `preview: true`.
77
+ */
78
+ previewToken?: string;
79
+ /**
80
+ * Flip between delivery (default) and preview at request time. When
81
+ * `true`, uses `previewToken` and the preview host; when `false` or
82
+ * unset, uses `accessToken` and the delivery host. Ignored when a
83
+ * pre-made `client` is passed instead of inline creds.
84
+ */
85
+ preview?: boolean;
86
+ /**
87
+ * Custom base URL for the delivery client (staging, proxy, per-region).
88
+ * Wins over the `preview`-derived default host — combine `host` with
89
+ * `preview: true` to point preview mode at a non-prod endpoint.
90
+ * Omit for the standard delivery / preview hosts.
91
+ */
92
+ host?: string;
93
+ } | {
94
+ client: ContentfulViewDeliveryClient;
95
+ };
96
+
97
+ type DeliveryExperienceRequestExtensions = ContentfulViewDelivery.GetWithOverridesExperienceRequestExtensions;
98
+ type PersonalizationOptions = NonNullable<DeliveryExperienceRequestExtensions['personalization']>;
99
+ type ExperienceRequestExtensions = Omit<DeliveryExperienceRequestExtensions, 'personalization'>;
100
+ type ByIdExperienceOptions = {
101
+ spaceId: string;
102
+ environmentId: string;
103
+ experienceId: string;
104
+ locale?: string;
105
+ /**
106
+ * Profile and events used by XDA to personalize the resolved Experience.
107
+ */
108
+ personalization?: PersonalizationOptions;
109
+ /**
110
+ * Additional XDA request extensions such as source maps. Supplying a defined
111
+ * extension switches the request to POST.
112
+ */
113
+ extensions?: ExperienceRequestExtensions;
114
+ };
115
+ /**
116
+ * Resolve an Experience by the Destination Node instead of `experienceId`
117
+ * The destinations delivery endpoints are space-scoped only and have no locale
118
+ * param, unlike the by-id path.
119
+ */
120
+ type ByDestinationNodeIdExperienceOptions = {
121
+ spaceId: string;
122
+ destinationId: string;
123
+ nodeId: string;
124
+ };
125
+ /**
126
+ * Resolve an Experience by the absolute path wired up to a
127
+ * Destination Node, instead of a node id directly. Same scoping as
128
+ * `ByDestinationNodeIdExperienceOptions` — no `environmentId` or `locale`.
129
+ */
130
+ type ByDestinationPathExperienceOptions = {
131
+ spaceId: string;
132
+ destinationId: string;
133
+ /** Absolute path to resolve. Must start with `/`. */
134
+ path: string;
135
+ };
136
+ type ExperienceOptions = ByIdExperienceOptions | ByDestinationNodeIdExperienceOptions | ByDestinationPathExperienceOptions;
137
+ /**
138
+ * A Destination resolution that the app must act on as control flow — honor
139
+ * it by navigating or re-resolving at the new path — rather than a hydrated
140
+ * Experience to render. Modeled as a normal return value, not a thrown error,
141
+ * per the Destinations delivery API's own framing of a redirect response.
142
+ */
143
+ interface DestinationRedirectResult {
144
+ redirect: {
145
+ path: string;
146
+ };
147
+ }
148
+ type ResolveOptions = {
149
+ config: ResolverConfig;
150
+ /**
151
+ * Arbitrary per-render metadata exposed to every resolver as
152
+ * `ctx.experience.metadata` and readable at render time via the framework
153
+ * adapter's `useExperience()` / `getExperience()`.
154
+ */
155
+ metadata?: Record<string, unknown>;
156
+ /**
157
+ * Observability switch. When on: logs the fetch (host, ids) and the raw
158
+ * payload here, and threads through to `resolveExperience` (resolution steps
159
+ * + `resolveData` timings) and the renderer (visible missing-component box,
160
+ * debug fallback). A single boolean across fetch + resolve + render.
161
+ */
162
+ debug?: boolean;
163
+ };
164
+ declare function fetchExperience(experienceOptions: ByIdExperienceOptions, clientOptions: ClientOptions, resolveOptions: ResolveOptions): Promise<PortableRenderPlan>;
165
+ declare function fetchExperience(experienceOptions: ByDestinationNodeIdExperienceOptions, clientOptions: ClientOptions, resolveOptions: ResolveOptions): Promise<PortableRenderPlan | DestinationRedirectResult>;
166
+ declare function fetchExperience(experienceOptions: ByDestinationPathExperienceOptions, clientOptions: ClientOptions, resolveOptions: ResolveOptions): Promise<PortableRenderPlan | DestinationRedirectResult>;
167
+
168
+ type FetchDestinationSitemapOptions = {
169
+ spaceId: string;
170
+ destinationId: string;
171
+ };
172
+ type FetchDestinationSitemapPaginationOptions = {
173
+ /** Maximum number of paths to return. Defaults to `100`, maximum `1000`. */
174
+ limit?: number;
175
+ /** Cursor from a previous call's `pages.next`. Treat as opaque; don't combine with `pagePrev`. */
176
+ pageNext?: string;
177
+ /** Cursor from a previous call's `pages.prev`. Treat as opaque; don't combine with `pageNext`. */
178
+ pagePrev?: string;
179
+ };
180
+ type SitemapPathItem = {
181
+ /** Path this entry routes. */
182
+ path: string;
183
+ /** Flat id extracted from the entry's `experienceUrn`. */
184
+ experienceId: string;
185
+ /** Type of the Destination Node that claims this path, e.g. `"DestinationExperienceNode"`. */
186
+ type: string;
187
+ };
188
+ type DestinationSitemapResult = {
189
+ items: SitemapPathItem[];
190
+ limit: number;
191
+ pages: {
192
+ next?: string;
193
+ prev?: string;
194
+ };
195
+ };
196
+ /**
197
+ * List every routable path in a published Destination. Bulk enumeration —
198
+ * pairs with `fetchExperience`'s `destinationId` + `nodeId`/`path` branches,
199
+ * which resolve one path at a time. Does not hydrate any Experience itself
200
+ * and does not call `fetchExperience` internally.
201
+ */
202
+ declare function fetchDestinationSitemap(destinationOptions: FetchDestinationSitemapOptions, clientOptions: ClientOptions, paginationOptions?: FetchDestinationSitemapPaginationOptions): Promise<DestinationSitemapResult>;
203
+
204
+ /** Either shape the experience endpoint can return — `get()` and `getWithOverrides()` share it. */
205
+ type ExperienceResponse = ContentfulViewDelivery.GetExperienceResponse | ContentfulViewDelivery.GetWithOverridesExperienceResponse;
206
+ /**
207
+ * Narrow a delivery response to `ExperiencePayload`.
208
+ *
209
+ * The endpoint types its response as `HydratedView | HydratedExperienceView`.
210
+ * The alpha-feature header the delivery client always sends guarantees the
211
+ * latter, but TypeScript cannot know that, so callers were left casting by hand.
212
+ *
213
+ * `fetchExperience` uses this internally; it is exported for anyone driving the
214
+ * delivery client directly. Type-level only — no validation, no copying.
215
+ *
216
+ * A legacy-shaped response carries `componentType` / `template` links instead;
217
+ * `resolveExperience` reports those through `warnUnrenderableNode`.
218
+ */
219
+ declare function toExperiencePayload(response: ExperienceResponse): ExperiencePayload;
220
+ /** Read `extensions.sourceMap` off a response. `undefined` when the request did not opt in. */
221
+ declare function readSourceMap(response: ExperienceResponse): ExperienceSourceMap | undefined;
222
+ /**
223
+ * Narrow a `ResolvedDestinationExperience.experience` to `ExperiencePayload`.
224
+ *
225
+ * Same cast rationale as `toExperiencePayload` above, for the destination
226
+ * resolution endpoints' `HydratedExperience` shape instead of the by-id
227
+ * endpoints' `HydratedExperienceView`.
228
+ */
229
+ declare function toExperiencePayloadFromDestination(experience: ContentfulViewDelivery.HydratedExperience): ExperiencePayload;
230
+
231
+ declare const DELIVERY_HOST = "https://xdn.contentful.com";
232
+ declare const PREVIEW_HOST = "https://preview.xdn.contentful.com";
233
+ declare const PREVIEW_WEBSOCKET_HOST = "wss://preview.xdn.contentful.com";
234
+
235
+ /** Validate and serialize events to the generated XDA request contract. */
236
+ declare function serializePersonalization(personalization: unknown): PersonalizationOptions;
11
237
 
12
238
  declare const NotFoundError: typeof ContentfulViewDelivery.NotFoundError;
13
239
  type NotFoundError = InstanceType<typeof ContentfulViewDelivery.NotFoundError>;
14
240
 
15
- export { NotFoundError };
241
+ export { type ByDestinationNodeIdExperienceOptions, type ByDestinationPathExperienceOptions, type ByIdExperienceOptions, type ClientOptions, type CreateClientOptions, DELIVERY_HOST, DestinationPreviewNotSupportedError, type DestinationRedirectResult, type DestinationSitemapResult, ExperienceFetchError, type ExperienceOptions, type ExperienceRequestExtensions, type ExperienceResponse, type FetchDestinationSitemapOptions, type FetchDestinationSitemapPaginationOptions, NotFoundError, PREVIEW_HOST, PREVIEW_WEBSOCKET_HOST, type PersonalizationOptions, type ResolveOptions, type SitemapPathItem, createClient, fetchDestinationSitemap, fetchExperience, readSourceMap, serializePersonalization, toExperiencePayload, toExperiencePayloadFromDestination };