@contentful/experiences-web 0.0.2
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 +17 -0
- package/README.md +97 -0
- package/dist/browser-event-context.d.ts +12 -0
- package/dist/browser-event-context.js +32 -0
- package/dist/browser-event-context.js.map +1 -0
- package/dist/contentful-experiences.d.ts +22 -0
- package/dist/contentful-experiences.js +33 -0
- package/dist/contentful-experiences.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/sdk-info.d.ts +11 -0
- package/dist/sdk-info.js +12 -0
- package/dist/sdk-info.js.map +1 -0
- package/package.json +39 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
## 0.0.2 (2026-09-29)
|
|
2
|
+
|
|
3
|
+
### 🧱 Updated Dependencies
|
|
4
|
+
|
|
5
|
+
- Updated client to 0.5.2
|
|
6
|
+
- Updated core to 0.9.2
|
|
7
|
+
|
|
8
|
+
## 0.0.1 (2026-09-29)
|
|
9
|
+
|
|
10
|
+
### 🚀 Features
|
|
11
|
+
|
|
12
|
+
- add Web SDK runtime ([#208](https://github.com/contentful/experiences/pull/208))
|
|
13
|
+
|
|
14
|
+
### 🧱 Updated Dependencies
|
|
15
|
+
|
|
16
|
+
- Updated client to 0.5.1
|
|
17
|
+
- Updated core to 0.9.1
|
package/README.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# @contentful/experiences-web
|
|
2
|
+
|
|
3
|
+
The browser SDK for fetching and resolving [Contentful Experiences](https://www.contentful.com/developers/docs/concepts/experiences/) in a Web application. It produces runtime-neutral `PortableRenderPlan` values; render a plan with the framework adapter used by your application.
|
|
4
|
+
|
|
5
|
+
> **Alpha.** This package is a lean browser runtime. Its API is still evolving.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @contentful/experiences-web
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Browser transport and preview
|
|
14
|
+
|
|
15
|
+
This package inherits Client's by-ID Experience transport capabilities: it can use the Content Delivery API (CDA) and, when configured, the Content Preview API (CPA). Destination operations remain delivery-only.
|
|
16
|
+
|
|
17
|
+
Browser configuration is trusted application configuration. A bearer token is sent to the endpoint selected by that configuration, so validate the endpoint's origin, CORS/preflight policy, and token scope before constructing the SDK. Do not place tokens in query strings. Browser-visible delivery and preview tokens must be appropriate for the audience and origin that can load them; use a server boundary when that is not acceptable.
|
|
18
|
+
|
|
19
|
+
`environmentId` identifies the Contentful environment used by an Experience request. It is distinct from the generated delivery client's optional `environment` endpoint configuration. For endpoint selection, the Experiences SDK's `host` maps to the generated client's `baseUrl`; a raw `ContentfulViewDeliveryClient` can instead be constructed with `baseUrl` directly. Endpoint precedence is explicit `host`/raw-client `baseUrl`, then generated-client `environment`, then the delivery or preview default. These options support trusted custom endpoints such as a proxy, staging service, or regional endpoint.
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { ContentfulExperiences } from '@contentful/experiences-web';
|
|
23
|
+
|
|
24
|
+
const experiences = new ContentfulExperiences({
|
|
25
|
+
spaceId,
|
|
26
|
+
environmentId: 'master',
|
|
27
|
+
resolverConfig,
|
|
28
|
+
delivery: {
|
|
29
|
+
accessToken: publicDeliveryToken,
|
|
30
|
+
host: 'https://experiences-proxy.example.com', // optional trusted endpoint
|
|
31
|
+
},
|
|
32
|
+
preview: { accessToken: publicPreviewToken }, // optional direct CPA client
|
|
33
|
+
locale: 'en-US',
|
|
34
|
+
app: { name: 'storefront', version: '1.0.0' },
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const plan = await experiences.fetchExperience({ experienceId });
|
|
38
|
+
const draft = await experiences.fetchExperience({ experienceId, preview: true });
|
|
39
|
+
|
|
40
|
+
experiences.setLocale('de-DE');
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The generated delivery client must be able to reach the selected endpoint from the browser using its Authorization and feature headers. Validate CORS/preflight behavior in the browsers you support before deployment. If direct browser access is not appropriate, use a trusted same-origin client or an application BFF.
|
|
44
|
+
|
|
45
|
+
Preview here means a direct, by-ID CPA fetch through the shared runtime. It is not a Preview Session: `@contentful/experiences-live-preview` owns Preview Session HTTP loading, WebSocket subscription, and update state. The Web SDK neither integrates nor owns that transport.
|
|
46
|
+
|
|
47
|
+
## Browser-safe configuration
|
|
48
|
+
|
|
49
|
+
Resolver configuration runs in the browser. Keep `resolveData`, `resolveToken`, and component configuration free of server-only imports, secrets, and privileged calls. Treat resolver `metadata` as browser-visible too: pass only values that are safe to expose to the current user. Debug logging and source maps remain opt-in and can expose raw CMS data.
|
|
50
|
+
|
|
51
|
+
Locale is mutable browser state. Update it with `setLocale()` rather than sharing a request-scoped Node facade; browser navigation, language selection, and concurrent renders then observe the current client-side locale without leaking server request state. An explicit per-call locale still wins for that fetch.
|
|
52
|
+
|
|
53
|
+
## Context providers and redaction
|
|
54
|
+
|
|
55
|
+
The default event context is read lazily and includes the current URL, path, query parameters, search, hash, referrer, title, viewport dimensions, and User-Agent. SPA navigation is therefore reflected without reconstructing the SDK. These values can contain sensitive data.
|
|
56
|
+
|
|
57
|
+
Use `browserContext.getPageProperties` and `browserContext.getUserAgent` to redact or replace the defaults before a value is retained, logged, or sent onward. Do not expose authentication material, raw identifiers, or personal data merely because it is available in the browser.
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
const experiences = new ContentfulExperiences({
|
|
61
|
+
// delivery and resolver configuration...
|
|
62
|
+
browserContext: {
|
|
63
|
+
getPageProperties: () => ({
|
|
64
|
+
path: window.location.pathname,
|
|
65
|
+
query: {},
|
|
66
|
+
referrer: '',
|
|
67
|
+
search: '',
|
|
68
|
+
title: document.title,
|
|
69
|
+
url: `${window.location.origin}${window.location.pathname}`,
|
|
70
|
+
}),
|
|
71
|
+
getUserAgent: () => undefined,
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## SSR import safety
|
|
77
|
+
|
|
78
|
+
The package can be imported by server-rendered applications, but importing it must not read browser globals or start browser work. Import safety does not make the live Web runtime a server runtime: create and use browser-owned SDK state only in client-side lifecycle code, and use the Node SDK plus a serializable `PortableRenderPlan` for server rendering. The separate SSR test configuration protects the public-entry import and pure browser-context fallbacks without promising that future stateful Web construction will run on the server.
|
|
79
|
+
|
|
80
|
+
## Errors and destinations
|
|
81
|
+
|
|
82
|
+
Missing Experiences surface the delivery client's `NotFoundError`; other delivery and resolution errors propagate so the application can apply its normal error policy. Destination operations use the delivery service and return either a resolved plan or a redirect result; route redirects at the application boundary.
|
|
83
|
+
|
|
84
|
+
For a by-ID fetch, `preview: true` selects the configured CPA client and throws if no preview client was configured. The delivery client's errors, including `NotFoundError`, otherwise propagate. Destination fetches remain delivery-only.
|
|
85
|
+
|
|
86
|
+
## Current limitations
|
|
87
|
+
|
|
88
|
+
- No event methods, persistence, or offline queues yet.
|
|
89
|
+
- No server request facade; use `@contentful/experiences-node` for request-scoped server work.
|
|
90
|
+
|
|
91
|
+
## Architecture boundary
|
|
92
|
+
|
|
93
|
+
`@contentful/experiences-web` is a public Web-specific sibling of `@contentful/experiences-node`. Both build on the internal `@contentful/experiences-client` and `@contentful/experiences-sdk-core` packages. The Web package owns browser state; the Node package owns request-local state. Neither package inherits the other's lifecycle semantics.
|
|
94
|
+
|
|
95
|
+
## License
|
|
96
|
+
|
|
97
|
+
MIT. See the repository [LICENSE](../../LICENSE) and [NOTICE](../../NOTICE) for full attribution.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EventBuilderConfig } from '@contentful/experiences-client';
|
|
2
|
+
|
|
3
|
+
type Page = ReturnType<NonNullable<EventBuilderConfig['getPageProperties']>>;
|
|
4
|
+
/**
|
|
5
|
+
* Reads the current browser page at event-build time. Keeping this lazy makes
|
|
6
|
+
* navigation updates visible to an existing SDK instance and keeps SSR safe.
|
|
7
|
+
*/
|
|
8
|
+
declare function getPageProperties(): Page;
|
|
9
|
+
/** Returns the current browser user agent, or no value outside a browser. */
|
|
10
|
+
declare function getUserAgent(): string | undefined;
|
|
11
|
+
|
|
12
|
+
export { getPageProperties, getUserAgent };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DEFAULT_PAGE_PROPERTIES } from "@contentful/experiences-client";
|
|
2
|
+
function getPageProperties() {
|
|
3
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
4
|
+
return { ...DEFAULT_PAGE_PROPERTIES };
|
|
5
|
+
}
|
|
6
|
+
try {
|
|
7
|
+
const { location } = window;
|
|
8
|
+
const query = Object.fromEntries(new URL(location.href).searchParams.entries());
|
|
9
|
+
return {
|
|
10
|
+
...DEFAULT_PAGE_PROPERTIES,
|
|
11
|
+
url: location.href,
|
|
12
|
+
path: location.pathname,
|
|
13
|
+
query,
|
|
14
|
+
search: location.search,
|
|
15
|
+
hash: location.hash,
|
|
16
|
+
referrer: document.referrer,
|
|
17
|
+
title: document.title,
|
|
18
|
+
width: window.innerWidth,
|
|
19
|
+
height: window.innerHeight
|
|
20
|
+
};
|
|
21
|
+
} catch {
|
|
22
|
+
return { ...DEFAULT_PAGE_PROPERTIES };
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function getUserAgent() {
|
|
26
|
+
return typeof window === "undefined" || typeof window.navigator === "undefined" ? void 0 : window.navigator.userAgent;
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
getPageProperties,
|
|
30
|
+
getUserAgent
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=browser-event-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/browser-event-context.ts"],"sourcesContent":["import { DEFAULT_PAGE_PROPERTIES, type EventBuilderConfig } from '@contentful/experiences-client';\n\ntype Page = ReturnType<NonNullable<EventBuilderConfig['getPageProperties']>>;\n\n/**\n * Reads the current browser page at event-build time. Keeping this lazy makes\n * navigation updates visible to an existing SDK instance and keeps SSR safe.\n */\nexport function getPageProperties(): Page {\n if (typeof window === 'undefined' || typeof document === 'undefined') {\n return { ...DEFAULT_PAGE_PROPERTIES };\n }\n\n try {\n const { location } = window;\n const query = Object.fromEntries(new URL(location.href).searchParams.entries());\n\n return {\n ...DEFAULT_PAGE_PROPERTIES,\n url: location.href,\n path: location.pathname,\n query,\n search: location.search,\n hash: location.hash,\n referrer: document.referrer,\n title: document.title,\n width: window.innerWidth,\n height: window.innerHeight,\n };\n } catch {\n return { ...DEFAULT_PAGE_PROPERTIES };\n }\n}\n\n/** Returns the current browser user agent, or no value outside a browser. */\nexport function getUserAgent(): string | undefined {\n return typeof window === 'undefined' || typeof window.navigator === 'undefined'\n ? undefined\n : window.navigator.userAgent;\n}\n"],"mappings":"AAAA,SAAS,+BAAwD;AAQ1D,SAAS,oBAA0B;AACxC,MAAI,OAAO,WAAW,eAAe,OAAO,aAAa,aAAa;AACpE,WAAO,EAAE,GAAG,wBAAwB;AAAA,EACtC;AAEA,MAAI;AACF,UAAM,EAAE,SAAS,IAAI;AACrB,UAAM,QAAQ,OAAO,YAAY,IAAI,IAAI,SAAS,IAAI,EAAE,aAAa,QAAQ,CAAC;AAE9E,WAAO;AAAA,MACL,GAAG;AAAA,MACH,KAAK,SAAS;AAAA,MACd,MAAM,SAAS;AAAA,MACf;AAAA,MACA,QAAQ,SAAS;AAAA,MACjB,MAAM,SAAS;AAAA,MACf,UAAU,SAAS;AAAA,MACnB,OAAO,SAAS;AAAA,MAChB,OAAO,OAAO;AAAA,MACd,QAAQ,OAAO;AAAA,IACjB;AAAA,EACF,QAAQ;AACN,WAAO,EAAE,GAAG,wBAAwB;AAAA,EACtC;AACF;AAGO,SAAS,eAAmC;AACjD,SAAO,OAAO,WAAW,eAAe,OAAO,OAAO,cAAc,cAChE,SACA,OAAO,UAAU;AACvB;","names":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { EventBuilderConfig, ContentfulExperiences as ContentfulExperiences$1, ContentfulExperiencesConfig } from '@contentful/experiences-client';
|
|
2
|
+
|
|
3
|
+
/** Optional browser context providers, useful for application-specific redaction. */
|
|
4
|
+
type BrowserEventContextProviders = Pick<EventBuilderConfig, 'getPageProperties' | 'getUserAgent'>;
|
|
5
|
+
/**
|
|
6
|
+
* Long-lived, browser-oriented SDK configuration.
|
|
7
|
+
*/
|
|
8
|
+
type ExperiencesWebConfig = Omit<ContentfulExperiencesConfig, 'eventBuilder' | 'locale'> & {
|
|
9
|
+
locale?: string;
|
|
10
|
+
app?: EventBuilderConfig['app'];
|
|
11
|
+
browserContext?: BrowserEventContextProviders;
|
|
12
|
+
};
|
|
13
|
+
/** Browser runtime with mutable application locale and live event context. */
|
|
14
|
+
declare class ContentfulExperiences extends ContentfulExperiences$1 {
|
|
15
|
+
#private;
|
|
16
|
+
constructor(config: ExperiencesWebConfig);
|
|
17
|
+
get locale(): string | undefined;
|
|
18
|
+
/** Changes the default locale used by subsequent events and fetches. */
|
|
19
|
+
setLocale(locale: string | undefined): void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { type BrowserEventContextProviders, ContentfulExperiences, type ExperiencesWebConfig };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ContentfulExperiences as ClientContentfulExperiences
|
|
3
|
+
} from "@contentful/experiences-client";
|
|
4
|
+
import { getPageProperties, getUserAgent } from "./browser-event-context.js";
|
|
5
|
+
import { DEFAULT_EVENT_CONTEXT_LIBRARY } from "./sdk-info.js";
|
|
6
|
+
class ContentfulExperiences extends ClientContentfulExperiences {
|
|
7
|
+
#locale;
|
|
8
|
+
constructor(config) {
|
|
9
|
+
const { app, browserContext, ...clientConfig } = config;
|
|
10
|
+
super({
|
|
11
|
+
...clientConfig,
|
|
12
|
+
eventBuilder: {
|
|
13
|
+
app,
|
|
14
|
+
channel: "web",
|
|
15
|
+
library: DEFAULT_EVENT_CONTEXT_LIBRARY,
|
|
16
|
+
getPageProperties: browserContext?.getPageProperties ?? getPageProperties,
|
|
17
|
+
getUserAgent: browserContext?.getUserAgent ?? getUserAgent
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
this.#locale = config.locale;
|
|
21
|
+
}
|
|
22
|
+
get locale() {
|
|
23
|
+
return this.#locale;
|
|
24
|
+
}
|
|
25
|
+
/** Changes the default locale used by subsequent events and fetches. */
|
|
26
|
+
setLocale(locale) {
|
|
27
|
+
this.#locale = locale;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
ContentfulExperiences
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=contentful-experiences.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/contentful-experiences.ts"],"sourcesContent":["import {\n ContentfulExperiences as ClientContentfulExperiences,\n type ContentfulExperiencesConfig,\n type EventBuilderConfig,\n} from '@contentful/experiences-client';\n\nimport { getPageProperties, getUserAgent } from './browser-event-context.js';\nimport { DEFAULT_EVENT_CONTEXT_LIBRARY } from './sdk-info.js';\n\n/** Optional browser context providers, useful for application-specific redaction. */\nexport type BrowserEventContextProviders = Pick<\n EventBuilderConfig,\n 'getPageProperties' | 'getUserAgent'\n>;\n\n/**\n * Long-lived, browser-oriented SDK configuration.\n */\nexport type ExperiencesWebConfig = Omit<ContentfulExperiencesConfig, 'eventBuilder' | 'locale'> & {\n locale?: string;\n app?: EventBuilderConfig['app'];\n browserContext?: BrowserEventContextProviders;\n};\n\n/** Browser runtime with mutable application locale and live event context. */\nexport class ContentfulExperiences extends ClientContentfulExperiences {\n #locale: string | undefined;\n\n constructor(config: ExperiencesWebConfig) {\n const { app, browserContext, ...clientConfig } = config;\n super({\n ...clientConfig,\n eventBuilder: {\n app,\n channel: 'web',\n library: DEFAULT_EVENT_CONTEXT_LIBRARY,\n getPageProperties: browserContext?.getPageProperties ?? getPageProperties,\n getUserAgent: browserContext?.getUserAgent ?? getUserAgent,\n },\n });\n this.#locale = config.locale;\n }\n\n override get locale(): string | undefined {\n return this.#locale;\n }\n\n /** Changes the default locale used by subsequent events and fetches. */\n setLocale(locale: string | undefined): void {\n this.#locale = locale;\n }\n}\n"],"mappings":"AAAA;AAAA,EACE,yBAAyB;AAAA,OAGpB;AAEP,SAAS,mBAAmB,oBAAoB;AAChD,SAAS,qCAAqC;AAkBvC,MAAM,8BAA8B,4BAA4B;AAAA,EACrE;AAAA,EAEA,YAAY,QAA8B;AACxC,UAAM,EAAE,KAAK,gBAAgB,GAAG,aAAa,IAAI;AACjD,UAAM;AAAA,MACJ,GAAG;AAAA,MACH,cAAc;AAAA,QACZ;AAAA,QACA,SAAS;AAAA,QACT,SAAS;AAAA,QACT,mBAAmB,gBAAgB,qBAAqB;AAAA,QACxD,cAAc,gBAAgB,gBAAgB;AAAA,MAChD;AAAA,IACF,CAAC;AACD,SAAK,UAAU,OAAO;AAAA,EACxB;AAAA,EAEA,IAAa,SAA6B;AACxC,WAAO,KAAK;AAAA,EACd;AAAA;AAAA,EAGA,UAAU,QAAkC;AAC1C,SAAK,UAAU;AAAA,EACjB;AACF;","names":[]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { getPageProperties, getUserAgent } from './browser-event-context.js';
|
|
2
|
+
export { BrowserEventContextProviders, ContentfulExperiences, ExperiencesWebConfig } from './contentful-experiences.js';
|
|
3
|
+
export { EXPERIENCES_WEB_SDK_NAME, EXPERIENCES_WEB_SDK_VERSION } from './sdk-info.js';
|
|
4
|
+
export { ContentfulViewDelivery, ContentfulViewDeliveryClient, CreateClientOptions, DELIVERY_HOST, DestinationRedirectResult, ExperienceFetchError, NotFoundError, PREVIEW_HOST, RuntimeClientSource, RuntimeFetchByDestinationNodeOptions, RuntimeFetchByDestinationPathOptions, RuntimeFetchExperienceOptions, RuntimeResolveOptions, createClient } from '@contentful/experiences-client';
|
|
5
|
+
export { ExperiencePayload, PortableRenderPlan, ResolverConfig } from '@contentful/experiences-sdk-core';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { getPageProperties, getUserAgent } from "./browser-event-context.js";
|
|
2
|
+
import { ContentfulExperiences } from "./contentful-experiences.js";
|
|
3
|
+
import { EXPERIENCES_WEB_SDK_NAME, EXPERIENCES_WEB_SDK_VERSION } from "./sdk-info.js";
|
|
4
|
+
import {
|
|
5
|
+
ContentfulViewDelivery,
|
|
6
|
+
ContentfulViewDeliveryClient,
|
|
7
|
+
DELIVERY_HOST,
|
|
8
|
+
ExperienceFetchError,
|
|
9
|
+
NotFoundError,
|
|
10
|
+
PREVIEW_HOST,
|
|
11
|
+
createClient
|
|
12
|
+
} from "@contentful/experiences-client";
|
|
13
|
+
export {
|
|
14
|
+
ContentfulExperiences,
|
|
15
|
+
ContentfulViewDelivery,
|
|
16
|
+
ContentfulViewDeliveryClient,
|
|
17
|
+
DELIVERY_HOST,
|
|
18
|
+
EXPERIENCES_WEB_SDK_NAME,
|
|
19
|
+
EXPERIENCES_WEB_SDK_VERSION,
|
|
20
|
+
ExperienceFetchError,
|
|
21
|
+
NotFoundError,
|
|
22
|
+
PREVIEW_HOST,
|
|
23
|
+
createClient,
|
|
24
|
+
getPageProperties,
|
|
25
|
+
getUserAgent
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { getPageProperties, getUserAgent } from './browser-event-context.js';\nexport { ContentfulExperiences } from './contentful-experiences.js';\nexport type {\n BrowserEventContextProviders,\n ExperiencesWebConfig,\n} from './contentful-experiences.js';\nexport { EXPERIENCES_WEB_SDK_NAME, EXPERIENCES_WEB_SDK_VERSION } from './sdk-info.js';\n\nexport {\n ContentfulViewDelivery,\n ContentfulViewDeliveryClient,\n DELIVERY_HOST,\n ExperienceFetchError,\n NotFoundError,\n PREVIEW_HOST,\n createClient,\n} from '@contentful/experiences-client';\nexport type {\n CreateClientOptions,\n DestinationRedirectResult,\n RuntimeClientSource,\n RuntimeFetchByDestinationNodeOptions,\n RuntimeFetchByDestinationPathOptions,\n RuntimeFetchExperienceOptions,\n RuntimeResolveOptions,\n} from '@contentful/experiences-client';\nexport type {\n ExperiencePayload,\n PortableRenderPlan,\n ResolverConfig,\n} from '@contentful/experiences-sdk-core';\n"],"mappings":"AAAA,SAAS,mBAAmB,oBAAoB;AAChD,SAAS,6BAA6B;AAKtC,SAAS,0BAA0B,mCAAmC;AAEtE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Package identity attached to events built by the Web SDK. */
|
|
2
|
+
declare const EXPERIENCES_WEB_SDK_NAME: string;
|
|
3
|
+
/** Package version attached to events built by the Web SDK. */
|
|
4
|
+
declare const EXPERIENCES_WEB_SDK_VERSION: string;
|
|
5
|
+
/** @internal Stable library metadata supplied to the shared EventBuilder. */
|
|
6
|
+
declare const DEFAULT_EVENT_CONTEXT_LIBRARY: {
|
|
7
|
+
name: string;
|
|
8
|
+
version: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { DEFAULT_EVENT_CONTEXT_LIBRARY, EXPERIENCES_WEB_SDK_NAME, EXPERIENCES_WEB_SDK_VERSION };
|
package/dist/sdk-info.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const EXPERIENCES_WEB_SDK_NAME = true ? "@contentful/experiences-web" : "@contentful/experiences-web";
|
|
2
|
+
const EXPERIENCES_WEB_SDK_VERSION = true ? "0.0.1" : "0.0.0";
|
|
3
|
+
const DEFAULT_EVENT_CONTEXT_LIBRARY = {
|
|
4
|
+
name: EXPERIENCES_WEB_SDK_NAME,
|
|
5
|
+
version: EXPERIENCES_WEB_SDK_VERSION
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
DEFAULT_EVENT_CONTEXT_LIBRARY,
|
|
9
|
+
EXPERIENCES_WEB_SDK_NAME,
|
|
10
|
+
EXPERIENCES_WEB_SDK_VERSION
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=sdk-info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/sdk-info.ts"],"sourcesContent":["declare const __DEFAULT_EVENT_CONTEXT_LIBRARY_NAME__: string | undefined;\ndeclare const __DEFAULT_EVENT_CONTEXT_LIBRARY_VERSION__: string | undefined;\n\n/** Package identity attached to events built by the Web SDK. */\nexport const EXPERIENCES_WEB_SDK_NAME =\n typeof __DEFAULT_EVENT_CONTEXT_LIBRARY_NAME__ === 'string'\n ? __DEFAULT_EVENT_CONTEXT_LIBRARY_NAME__\n : '@contentful/experiences-web';\n\n/** Package version attached to events built by the Web SDK. */\nexport const EXPERIENCES_WEB_SDK_VERSION =\n typeof __DEFAULT_EVENT_CONTEXT_LIBRARY_VERSION__ === 'string'\n ? __DEFAULT_EVENT_CONTEXT_LIBRARY_VERSION__\n : '0.0.0';\n\n/** @internal Stable library metadata supplied to the shared EventBuilder. */\nexport const DEFAULT_EVENT_CONTEXT_LIBRARY = {\n name: EXPERIENCES_WEB_SDK_NAME,\n version: EXPERIENCES_WEB_SDK_VERSION,\n};\n"],"mappings":"AAIO,MAAM,2BACX,OACI,gCACA;AAGC,MAAM,8BACX,OACI,UACA;AAGC,MAAM,gCAAgC;AAAA,EAC3C,MAAM;AAAA,EACN,SAAS;AACX;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@contentful/experiences-web",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "Browser SDK for Contentful Experiences",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"sideEffects": false,
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"./package.json": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"README.md",
|
|
22
|
+
"CHANGELOG.md"
|
|
23
|
+
],
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/contentful/experiences.git",
|
|
30
|
+
"directory": "packages/web"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@contentful/experiences-client": "0.5.2",
|
|
34
|
+
"@contentful/experiences-sdk-core": "0.9.2"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"jsdom": "^30.0.1"
|
|
38
|
+
}
|
|
39
|
+
}
|