@picked/client 0.0.72-next.1 → 0.0.72-next.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.
Files changed (41) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/{api-BmzHzzpu.js → api-B8SVav6V.js} +1 -1
  3. package/dist/{api-B9DDtylO.cjs → api-D9899KCk.cjs} +1 -1
  4. package/dist/cjs/index.js +2 -2
  5. package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
  6. package/dist/cjs/server/index.js +1 -1
  7. package/dist/docs/explanation/how-picked-works.md +25 -3
  8. package/dist/docs/reference/sdk/plugins/dynamic-experiences.md +50 -2
  9. package/dist/docs/reference/tools/vite-plugin.md +90 -8
  10. package/dist/esm/index.js +22 -1
  11. package/dist/esm/plugins/dynamic-experiences/index.js +4 -3
  12. package/dist/esm/server/index.js +43 -46
  13. package/dist/plugin-EFn9ALEF.cjs +1 -0
  14. package/dist/plugin-YytfMG0n.js +153 -0
  15. package/dist/provider-DmXJ58nW.cjs +1 -0
  16. package/dist/provider-GuxX7UDO.js +68 -0
  17. package/dist/registry-CMsN5pHn.cjs +1 -0
  18. package/dist/registry-DzpNnRIF.js +74 -0
  19. package/dist/types/data-source/api.d.ts +60 -0
  20. package/dist/types/data-source/api.d.ts.map +1 -0
  21. package/dist/types/data-source/provider.d.ts +90 -0
  22. package/dist/types/data-source/provider.d.ts.map +1 -0
  23. package/dist/types/data-source/registry.d.ts +26 -0
  24. package/dist/types/data-source/registry.d.ts.map +1 -0
  25. package/dist/types/data-source/virtual-data.d.ts +19 -0
  26. package/dist/types/data-source/virtual-data.d.ts.map +1 -0
  27. package/dist/types/picked.d.ts +65 -1
  28. package/dist/types/picked.d.ts.map +1 -1
  29. package/dist/types/plugins/dynamic-experiences/index.d.ts +1 -0
  30. package/dist/types/plugins/dynamic-experiences/index.d.ts.map +1 -1
  31. package/dist/types/plugins/dynamic-experiences/plugin.d.ts +9 -40
  32. package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
  33. package/dist/types/plugins/dynamic-experiences/types.d.ts +15 -23
  34. package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -1
  35. package/dist/types/server/index.d.ts +1 -1
  36. package/dist/types/server/index.d.ts.map +1 -1
  37. package/dist/types/server/serialize.d.ts +21 -33
  38. package/dist/types/server/serialize.d.ts.map +1 -1
  39. package/package.json +3 -3
  40. package/dist/plugin-CZN0_kqv.js +0 -252
  41. package/dist/plugin-SFx511s_.cjs +0 -1
@@ -0,0 +1,60 @@
1
+ import type { ExperienceContentResponse, FetchProjectOptions, ProjectConfig } from '../plugins/dynamic-experiences/types';
2
+ /**
3
+ * Minimal shape check: verifies that `data` is an object with a `features` array.
4
+ *
5
+ * This is the minimum invariant required to prevent runtime crashes when iterating
6
+ * `config.features`. Individual feature and experience shapes are trusted from the API.
7
+ *
8
+ * @param {unknown} data - Unknown API response to validate.
9
+ * @returns {boolean} Whether `data` has the minimum required shape.
10
+ * @example
11
+ * ```typescript
12
+ * if (isProjectConfig(json)) { json.features }
13
+ * ```
14
+ */
15
+ export declare function isProjectConfig(data: unknown): data is ProjectConfig;
16
+ /**
17
+ * Minimal shape check for a successful experience-content response.
18
+ *
19
+ * @param {unknown} data - Unknown API response to validate.
20
+ * @returns {boolean} Whether `data` has the minimum required shape.
21
+ * @example
22
+ * ```typescript
23
+ * if (isExperienceContentResponse(json)) { useResponse(json) }
24
+ * ```
25
+ */
26
+ export declare function isExperienceContentResponse(data: unknown): data is ExperienceContentResponse;
27
+ /**
28
+ * Fetches the project configuration from the Picked REST API.
29
+ *
30
+ * Returns `null` on network failure, non-OK responses, or invalid JSON shape.
31
+ * Connection-refused errors from local URLs are suppressed silently.
32
+ *
33
+ * @param {string} apiUrl - Base URL for the Picked API.
34
+ * @param {string} projectId - Project ID to fetch config for.
35
+ * @param {FetchProjectOptions} [options] - Optional headers, preview token, and abort signal.
36
+ * @returns {Promise<ProjectConfig | null>} Validated project config, or `null` on any failure.
37
+ * @example
38
+ * ```typescript
39
+ * const config = await fetchProject('https://api.picked.app', 'proj_123')
40
+ * ```
41
+ */
42
+ export declare function fetchProject(apiUrl: string, projectId: string, options?: FetchProjectOptions): Promise<ProjectConfig | null>;
43
+ /**
44
+ * Fetches per-experience content from the Picked API.
45
+ *
46
+ * Returns `null` on network failure, non-OK responses, or invalid JSON shape — preserving
47
+ * the failure-tolerant policy: experiences still render, layouts handle null defensively.
48
+ *
49
+ * @param {string} apiUrl - Base URL for the Picked API.
50
+ * @param {string} projectId - Project ID to fetch content for.
51
+ * @param {string} experienceId - Experience ID whose content to fetch.
52
+ * @param {FetchProjectOptions} [options] - Optional headers, preview token, and abort signal.
53
+ * @returns {Promise<ExperienceContentResponse | null>} Validated content response, or `null` on any failure.
54
+ * @example
55
+ * ```typescript
56
+ * const content = await fetchExperienceContent('https://api.picked.app', 'proj_1', 'exp_1')
57
+ * ```
58
+ */
59
+ export declare function fetchExperienceContent(apiUrl: string, projectId: string, experienceId: string, options?: FetchProjectOptions): Promise<ExperienceContentResponse | null>;
60
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/data-source/api.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,yBAAyB,EACzB,mBAAmB,EACnB,aAAa,EACd,MAAM,sCAAsC,CAAA;AAiC7C;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,aAAa,CAEpE;AAED;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,yBAAyB,CAM5F;AA8CD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAmC/B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC,CAqC3C"}
@@ -0,0 +1,90 @@
1
+ import type { ContentLoader, ExperienceContentResponse, PickedManifestMetadata, ProjectConfig, VirtualPickedData } from '../plugins/dynamic-experiences/types';
2
+ import { isVirtualPickedData } from './virtual-data';
3
+ /** Where a data provider reads project config and CMS content from. */
4
+ export type PickedDataMode = 'bundle' | 'api';
5
+ /** Options for {@link createPickedDataProvider}. */
6
+ export interface PickedDataProviderOptions {
7
+ /** Base URL for the Picked API. Used by `'api'` mode and by every preview session. */
8
+ apiUrl: string;
9
+ /** Project ID to resolve data for. */
10
+ projectId: string;
11
+ /**
12
+ * Which source to read from. Omit to resolve `'bundle'` when a bundle is available and
13
+ * `'api'` otherwise.
14
+ */
15
+ mode?: PickedDataMode;
16
+ /**
17
+ * Preview token from the current session. A present token forces `'api'` for both config
18
+ * and content and overrides `bundle` and `projectConfig`, because preview renders
19
+ * unpublished data that no bundled snapshot can contain.
20
+ */
21
+ previewToken?: string;
22
+ /**
23
+ * The `virtual:picked/data` module, supplied directly to skip both the registry and the
24
+ * dynamic import. A value that fails the shape guard is ignored with a warning, the same as
25
+ * an unresolvable import.
26
+ */
27
+ bundle?: VirtualPickedData;
28
+ /** Explicit project config. Supersedes both sources, except under a preview token. */
29
+ projectConfig?: ProjectConfig;
30
+ /** Explicit content loader. Supersedes both sources, except under a preview token. */
31
+ getContent?: ContentLoader;
32
+ /** Abort signal applied to API fetches, such as an `AbortSignal.timeout` deadline. */
33
+ signal?: AbortSignal;
34
+ }
35
+ /** Read-only description of what a provider resolved to. */
36
+ export interface PickedDataProviderMeta {
37
+ /** The mode in force, after preview-token resolution. */
38
+ mode: PickedDataMode;
39
+ /** The bundle's manifest metadata, or `null` when not reading from a bundle. */
40
+ manifest: PickedManifestMetadata | null;
41
+ }
42
+ /** Resolves this session's project config and per-experience CMS content. */
43
+ export interface PickedDataProvider {
44
+ /** What this provider resolved to. `manifest` populates once a bundle has been read. */
45
+ readonly meta: PickedDataProviderMeta;
46
+ /** Resolves the project config, or `null` when unavailable. Deduplicated across callers. */
47
+ getProjectConfig: () => Promise<ProjectConfig | null>;
48
+ /** Resolves an experience's content, or `null` when unavailable. Deduplicated per experience id. */
49
+ getContent: (experience: {
50
+ id: string;
51
+ key: string;
52
+ }, options?: {
53
+ signal?: AbortSignal;
54
+ }) => Promise<ExperienceContentResponse | null>;
55
+ }
56
+ /**
57
+ * Attempts to resolve `virtual:picked/data` provided by `@picked/vite-plugin-picked`.
58
+ *
59
+ * The dynamic import uses a literal string specifier (intentionally — using a variable plus
60
+ * `@vite-ignore` defeats Vite's import-analysis, so the plugin's `resolveId` is never called
61
+ * at build time and the bundle ends up with a runtime fetch to a `virtual:` URL that the
62
+ * browser cannot resolve). The SDK's own build marks `virtual:picked/data` as external so
63
+ * this literal import is preserved into the published dist, then downstream Vite builds with
64
+ * `@picked/vite-plugin-picked` resolve it through the plugin pipeline.
65
+ *
66
+ * Returns `null` when the virtual module is unresolvable (the consumer is not using the Vite
67
+ * plugin, or its build did not generate the module). Errors are swallowed: the caller falls
68
+ * back to the API path.
69
+ *
70
+ * @returns {Promise<VirtualPickedData | null>} The virtual module exports, or `null`.
71
+ * @example
72
+ * ```typescript
73
+ * const bundle = await resolveVirtualDataModule()
74
+ * ```
75
+ */
76
+ export declare function resolveVirtualDataModule(): Promise<VirtualPickedData | null>;
77
+ export { isVirtualPickedData };
78
+ /**
79
+ * Creates the data provider for a session.
80
+ *
81
+ * @param {PickedDataProviderOptions} options - Provider configuration.
82
+ * @returns {PickedDataProvider} A provider resolving config and content from one source.
83
+ * @example
84
+ * ```typescript
85
+ * const provider = createPickedDataProvider({ mode: 'api', apiUrl, projectId })
86
+ * const config = await provider.getProjectConfig()
87
+ * ```
88
+ */
89
+ export declare function createPickedDataProvider(options: PickedDataProviderOptions): PickedDataProvider;
90
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/data-source/provider.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,aAAa,EACb,yBAAyB,EACzB,sBAAsB,EACtB,aAAa,EACb,iBAAiB,EAClB,MAAM,sCAAsC,CAAA;AAG7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAEpD,uEAAuE;AACvE,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,KAAK,CAAA;AAQ7C,oDAAoD;AACpD,MAAM,WAAW,yBAAyB;IACxC,sFAAsF;IACtF,MAAM,EAAE,MAAM,CAAA;IACd,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,IAAI,CAAC,EAAE,cAAc,CAAA;IACrB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;;OAIG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAA;IAC1B,sFAAsF;IACtF,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,sFAAsF;IACtF,UAAU,CAAC,EAAE,aAAa,CAAA;IAC1B,sFAAsF;IACtF,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED,4DAA4D;AAC5D,MAAM,WAAW,sBAAsB;IACrC,yDAAyD;IACzD,IAAI,EAAE,cAAc,CAAA;IACpB,gFAAgF;IAChF,QAAQ,EAAE,sBAAsB,GAAG,IAAI,CAAA;CACxC;AAED,6EAA6E;AAC7E,MAAM,WAAW,kBAAkB;IACjC,wFAAwF;IACxF,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAA;IACrC,4FAA4F;IAC5F,gBAAgB,EAAE,MAAM,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAA;IACrD,oGAAoG;IACpG,UAAU,EAAE,CACV,UAAU,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EACvC,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,KAC/B,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC,CAAA;CAC/C;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAYlF;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAA;AAyB9B;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,kBAAkB,CAuK/F"}
@@ -0,0 +1,26 @@
1
+ import type { VirtualPickedData } from '../plugins/dynamic-experiences/types';
2
+ /**
3
+ * Records the bundle the build generated, for this session's data provider to read.
4
+ *
5
+ * A value that fails the shape guard is refused, so a malformed registration lands on the
6
+ * "no bundle" path. Any usable bundle registered earlier is kept.
7
+ *
8
+ * @param {unknown} bundle - The generated module's exports.
9
+ * @returns {void} Nothing.
10
+ * @example
11
+ * ```typescript
12
+ * registerPickedBundle({ projectConfig, experienceContent, manifestMetadata })
13
+ * ```
14
+ */
15
+ export declare function registerPickedBundle(bundle: unknown): void;
16
+ /**
17
+ * Reads the registered bundle.
18
+ *
19
+ * @returns {VirtualPickedData | null} The bundle, or `null` when nothing has registered one.
20
+ * @example
21
+ * ```typescript
22
+ * const bundle = readRegisteredBundle()
23
+ * ```
24
+ */
25
+ export declare function readRegisteredBundle(): VirtualPickedData | null;
26
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/data-source/registry.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AAK7E;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAQ1D;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,IAAI,iBAAiB,GAAG,IAAI,CAE/D"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @file The shape guard for the generated `virtual:picked/data` module.
3
+ *
4
+ * Lives apart from the provider and the registry because both validate against it, and a guard
5
+ * shared by two modules that also reference each other would otherwise close an import cycle.
6
+ */
7
+ import type { VirtualPickedData } from '../plugins/dynamic-experiences/types';
8
+ /**
9
+ * Runtime type guard that validates the shape of a `virtual:picked/data` module.
10
+ *
11
+ * @param {unknown} value - Candidate module exports.
12
+ * @returns {boolean} Whether `value` matches the {@link VirtualPickedData} shape.
13
+ * @example
14
+ * ```typescript
15
+ * if (isVirtualPickedData(mod)) { useVirtualModule(mod) }
16
+ * ```
17
+ */
18
+ export declare function isVirtualPickedData(value: unknown): value is VirtualPickedData;
19
+ //# sourceMappingURL=virtual-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"virtual-data.d.ts","sourceRoot":"","sources":["../../../src/data-source/virtual-data.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AAE7E;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAU9E"}
@@ -16,7 +16,7 @@ import { type EventBusPayload, type EventHistoryStore } from './utils/events';
16
16
  import type { Field } from './entities/field/field';
17
17
  import type { ExperienceStep } from './entities/step/step';
18
18
  import type { Content, ContentDataPatch } from './entities/content/content';
19
- import type { ContentLoader } from './plugins/dynamic-experiences/types';
19
+ import type { ContentLoader, ExperienceContentResponse, ProjectConfig } from './plugins/dynamic-experiences/types';
20
20
  import type { Action } from './entities/action/action';
21
21
  import { type Condition } from './entities/condition/condition';
22
22
  import type { SessionEntity } from './entities/session/session';
@@ -44,6 +44,21 @@ export declare class Picked {
44
44
  * resolvable; remains `null` when the SDK is using the runtime API path.
45
45
  */
46
46
  dataSource: PickedDataSource | null;
47
+ /**
48
+ * `versionId` of the SSR snapshot this client was seeded from, set by the framework
49
+ * providers' `seedFromSnapshot`. `null` when no snapshot was seeded — a browser-only client,
50
+ * or a route that rendered without one.
51
+ */
52
+ seededVersionId: string | null;
53
+ /**
54
+ * Set when a resolved project config disagrees with the seeded snapshot's `versionId`. The
55
+ * snapshot stays authoritative (it is what the server rendered the markup from) and the
56
+ * resolved config is dropped, so this records the divergence rather than hiding it.
57
+ */
58
+ versionSkew: {
59
+ seeded: string;
60
+ resolved: string;
61
+ } | null;
47
62
  /**
48
63
  * Content fetcher selected by `dynamicExperiencesPlugin`'s resolution chain. Called
49
64
  * by each experience's `prepareExperienceContentFx` (fired in parallel with
@@ -59,6 +74,7 @@ export declare class Picked {
59
74
  */
60
75
  previewEmbedderOrigins: string[] | null;
61
76
  private readonly plugins;
77
+ private readonly dataProviders;
62
78
  readonly eventBus: EventCallable<EventBusPayload>;
63
79
  readonly events: EventHistoryStore;
64
80
  readonly projectId: string;
@@ -262,6 +278,54 @@ export declare class Picked {
262
278
  context?: Record<string, unknown>;
263
279
  }, string, Error>;
264
280
  constructor(options: CreateClientOptions);
281
+ /**
282
+ * Resolves the data provider backing a given preview token, building it once per token.
283
+ *
284
+ * @param {string | undefined} previewToken - Preview token for the caller, when there is one.
285
+ * @returns {Promise<PickedDataProvider>} The provider for that token.
286
+ * @example
287
+ * const provider = await client.dataProviderFor(undefined)
288
+ */
289
+ private dataProviderFor;
290
+ /**
291
+ * Resolves this project's configuration.
292
+ *
293
+ * Reads the build-time bundle when one registered itself, and the Picked API otherwise. A
294
+ * preview token forces the API, because preview renders unpublished data no bundle can hold.
295
+ * Deduplicated per token, so several callers in one request cost one resolution.
296
+ *
297
+ * @param {object} [options] - Per-call resolution inputs.
298
+ * @param {string} [options.previewToken] - Preview token, forcing a live read.
299
+ * @param {AbortSignal} [options.signal] - Signal applied to an API read.
300
+ * @returns {Promise<ProjectConfig>} The project configuration.
301
+ * @throws {Error} When the configuration cannot be resolved from any source.
302
+ * @example
303
+ * const config = await client.getProjectConfig()
304
+ */
305
+ getProjectConfig(options?: {
306
+ previewToken?: string;
307
+ signal?: AbortSignal;
308
+ }): Promise<ProjectConfig>;
309
+ /**
310
+ * Resolves one experience's CMS content, from the same source as the configuration.
311
+ *
312
+ * @param {{ id: string; key: string }} experience - The experience to resolve content for.
313
+ * @param {string} experience.id - Experience id, which keys bundled content.
314
+ * @param {string} experience.key - Experience key, for a content loader that prefers it.
315
+ * @param {object} [options] - Per-call resolution inputs.
316
+ * @param {string} [options.previewToken] - Preview token, forcing a live read.
317
+ * @param {AbortSignal} [options.signal] - Deadline for this call's API read, if it makes one.
318
+ * @returns {Promise<ExperienceContentResponse | null>} The content, or `null` when it has none.
319
+ * @example
320
+ * const content = await client.getExperienceContent({ id: 'exp_1', key: 'promo' })
321
+ */
322
+ getExperienceContent(experience: {
323
+ id: string;
324
+ key: string;
325
+ }, options?: {
326
+ previewToken?: string;
327
+ signal?: AbortSignal;
328
+ }): Promise<ExperienceContentResponse | null>;
265
329
  /**
266
330
  * Lazily starts the preview channel when this frame is a live-preview session: the outbound
267
331
  * bridge, which reports the frame's URL to the dashboard, and the inbound receiver, which applies
@@ -1 +1 @@
1
- {"version":3,"file":"picked.d.ts","sourceRoot":"","sources":["../../src/picked.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,OAAO,EAGL,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,KAAK,EACV,KAAK,aAAa,EACnB,MAAM,UAAU,CAAA;AACjB,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,uBAAuB,EAC7B,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,iBAAiB,EAAe,MAAM,0BAA0B,CAAA;AAC3F,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,UAAU,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YAAa,OAAO,KAAG,IAAI,CAEzC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,YAAY,OAAQ,MAAM,SAAS,gBAAgB,KAAG,IAAI,CAEzD;IAED,cAAc,QAAS,MAAM,UAAU,MAAM,KAAG,IAAI,CAEnD;IAED,kBAAkB,eAAgB,UAAU,KAAG,IAAI,CAMlD;IAED;;;;;;;;;OASG;IAEH,oBAAoB,iBACJ,MAAM,YACV,uBAAuB,KAChC,OAAO,CAAC,IAAI,CAAC,CAEf;IACD;;;;;;;;;OASG;IAEH,qBAAqB,kBACJ,MAAM,YACX,uBAAuB,KAChC,OAAO,CAAC,IAAI,CAAC,CAEf;IAED;;;;;;;;OAQG;IAEH,kBAAkB,iBAAwB,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC,CAE/D;IAED;;;;;;;;OAQG;IAEH,mBAAmB,kBAAyB,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC,CAEjE;IAED,OAAO,CAAC,YAAY;IAsBpB,OAAO,CAAC,aAAa;IAsCrB,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,eAAe;IAWvB,eAAe,eAAgB,MAAM,KAAG,iBAAiB,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAE1F;CACF"}
@@ -1,5 +1,6 @@
1
1
  /** @file Public exports for the dynamic-experiences plugin (project config + per-experience content resolution). */
2
2
  export { dynamicExperiencesPlugin, fetchExperienceContent, fetchProject } from './plugin';
3
3
  export { createClientHeaders } from '../../utils/client-headers';
4
+ export { registerPickedBundle } from '../../data-source/registry';
4
5
  export type * from './types';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dynamic-experiences/index.ts"],"names":[],"mappings":"AAAA,oHAAoH;AACpH,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACzF,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAChE,mBAAmB,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dynamic-experiences/index.ts"],"names":[],"mappings":"AAAA,oHAAoH;AACpH,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACzF,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAIhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AACjE,mBAAmB,SAAS,CAAA"}
@@ -1,6 +1,7 @@
1
1
  import type { Plugin } from '../../entities/plugin/plugin';
2
2
  import type { Picked } from '../../picked';
3
- import type { DynamicExperiencesPluginOptions, ExperienceContentResponse, FetchProjectOptions, ProjectConfig } from './types';
3
+ import type { ProjectConfig } from './types';
4
+ export { fetchProject, fetchExperienceContent } from '../../data-source/api';
4
5
  /**
5
6
  * Synchronously registers a complete project config with the client: features, conditions,
6
7
  * fields, steps, and experiences, in dependency order.
@@ -24,46 +25,14 @@ export declare function registerProjectConfig(client: Picked, config: ProjectCon
24
25
  sessionId: string;
25
26
  }): void;
26
27
  /**
27
- * Fetches the project configuration from the Picked REST API.
28
+ * Plugin that resolves project configuration through the client and registers features,
29
+ * steps, fields, and experiences with it.
28
30
  *
29
- * Returns `null` on network failure, non-OK responses, or invalid JSON shape.
30
- * Connection-refused errors from local URLs are suppressed silently.
31
+ * Resolution runs during the `onStart` hook, before experience initialisation, and reads
32
+ * whichever source the client resolves to — the build-time bundle when one registered itself,
33
+ * the Picked API otherwise. Search param feature overrides take precedence over resolved
34
+ * values.
31
35
  *
32
- * @param {string} apiUrl - Base URL for the Picked API.
33
- * @param {string} projectId - Project ID to fetch config for.
34
- * @param {FetchProjectOptions} [options] - Optional headers and preview token.
35
- * @returns {Promise<ProjectConfig | null>} Validated project config, or `null` on any failure.
36
- * @example
37
- * ```typescript
38
- * const config = await fetchProject('https://api.picked.app', 'proj_123')
39
- * ```
40
- */
41
- export declare function fetchProject(apiUrl: string, projectId: string, options?: FetchProjectOptions): Promise<ProjectConfig | null>;
42
- /**
43
- * Fetches per-experience content from the Picked API.
44
- *
45
- * Returns `null` on network failure, non-OK responses, or invalid JSON shape — preserving
46
- * the failure-tolerant policy: experiences still render, layouts handle null defensively.
47
- *
48
- * @param {string} apiUrl - Base URL for the Picked API.
49
- * @param {string} projectId - Project ID to fetch content for.
50
- * @param {string} experienceId - Experience ID whose content to fetch.
51
- * @param {FetchProjectOptions} [options] - Optional headers, preview token, and abort signal.
52
- * @returns {Promise<ExperienceContentResponse | null>} Validated content response, or `null` on any failure.
53
- * @example
54
- * ```typescript
55
- * const content = await fetchExperienceContent('https://api.picked.app', 'proj_1', 'exp_1')
56
- * ```
57
- */
58
- export declare function fetchExperienceContent(apiUrl: string, projectId: string, experienceId: string, options?: FetchProjectOptions): Promise<ExperienceContentResponse | null>;
59
- /**
60
- * Plugin that fetches project configuration from the Picked REST API and registers
61
- * features, steps, fields, and experiences with the client.
62
- *
63
- * Features are fetched during the `onStart` hook, before experience initialisation.
64
- * Search param feature overrides take precedence over API-provided values.
65
- *
66
- * @param {DynamicExperiencesPluginOptions} [options] - Optional plugin configuration.
67
36
  * @returns {Plugin} A configured Picked plugin.
68
37
  * @example
69
38
  * ```typescript
@@ -76,5 +45,5 @@ export declare function fetchExperienceContent(apiUrl: string, projectId: string
76
45
  * })
77
46
  * ```
78
47
  */
79
- export declare function dynamicExperiencesPlugin(options?: DynamicExperiencesPluginOptions): Plugin;
48
+ export declare function dynamicExperiencesPlugin(): Plugin;
80
49
  //# sourceMappingURL=plugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dynamic-experiences/plugin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;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B,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACjD,IAAI,CAMN;AAoMD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CA4DjD"}
@@ -78,23 +78,6 @@ export interface ProjectConfig {
78
78
  */
79
79
  previewEmbedderOrigins?: string[];
80
80
  }
81
- export interface DynamicExperiencesPluginOptions {
82
- apiUrl?: string;
83
- projectConfig?: ProjectConfig;
84
- /**
85
- * Customer-supplied content fetcher. When provided, supersedes both the virtual
86
- * data module and the runtime API for per-experience content resolution.
87
- * Customers using this override are responsible for project ↔ content version
88
- * consistency. Receives the resolved experience and the current preview token
89
- * (when present) so the customer can decide preview semantics themselves.
90
- */
91
- getContent?: (experience: {
92
- id: string;
93
- key: string;
94
- }, options?: {
95
- previewToken?: string;
96
- }) => Promise<ExperienceContentResponse | null>;
97
- }
98
81
  export interface FetchProjectOptions {
99
82
  previewToken?: string;
100
83
  headers?: Record<string, string>;
@@ -136,6 +119,20 @@ export type ContentLoader = (experience: {
136
119
  }, options?: {
137
120
  previewToken?: string;
138
121
  }) => Promise<ExperienceContentResponse | null>;
122
+ /**
123
+ * Provenance the virtual data module records about the snapshot it carries: which build
124
+ * flavour produced it, when, and which workspace version it was taken from.
125
+ */
126
+ export interface PickedManifestMetadata {
127
+ /** `'build'` when build-mode prefetch JSON was used, `'dev'` when the dev-mode fetch was. */
128
+ mode: 'dev' | 'build';
129
+ /** ISO 8601 timestamp from the manifest. `null` in dev mode, where no manifest is written. */
130
+ fetchedAt: string | null;
131
+ /** The `versionId` the snapshot was taken from, when known. */
132
+ projectVersionId: string | null;
133
+ /** The `workspaceId` the snapshot was taken from, when known. */
134
+ workspaceId: string | null;
135
+ }
139
136
  /**
140
137
  * Optional-fields surface of the virtual data module exposed by `@picked/vite-plugin-picked`.
141
138
  * The shape is identical between dev (`vite serve`) and build (`vite build`) modes.
@@ -143,11 +140,6 @@ export type ContentLoader = (experience: {
143
140
  export interface VirtualPickedData {
144
141
  projectConfig: ProjectConfig;
145
142
  experienceContent: ContentLoader;
146
- manifestMetadata: {
147
- mode: 'dev' | 'build';
148
- fetchedAt: string | null;
149
- projectVersionId: string | null;
150
- workspaceId: string | null;
151
- };
143
+ manifestMetadata: PickedManifestMetadata;
152
144
  }
153
145
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dynamic-experiences/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAA;AACvD,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,gBAAgB,EACjB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAA;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAE/D;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,cAAc,EAAE,WAAW,GAAG,oBAAoB,CAAC,GAAG;IACzF,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CACpB,CAAA;AAED,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAA;AAE9C;;;;;;GAMG;AACH,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAA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Y,CAAC,EAAE,MAAM,CAAA;CAAE,KAChC,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC,CAAA;AAE9C;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,6FAA6F;IAC7F,IAAI,EAAE,KAAK,GAAG,OAAO,CAAA;IACrB,8FAA8F;IAC9F,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,+DAA+D;IAC/D,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,iEAAiE;IACjE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,aAAa,EAAE,aAAa,CAAA;IAC5B,iBAAiB,EAAE,aAAa,CAAA;IAChC,gBAAgB,EAAE,sBAAsB,CAAA;CACzC"}
@@ -1,7 +1,7 @@
1
1
  import type { Picked } from '../picked';
2
2
  import type { ExperienceInstance } from '../entities/experience-instance/experience-instance';
3
3
  import type { AdaptedComponent } from '../entities/component/component';
4
- export { serialize, type PickedSnapshot, type SerializeParams, type SerializeAttributes, type SerializeLocation, type SerializeGetContent, } from './serialize';
4
+ export { serialize, type PickedSnapshot, type SerializeParams, type SerializeAttributes, type SerializeLocation, } from './serialize';
5
5
  export { createExperienceInstance } from '../entities/experience-instance/experience-instance';
6
6
  export type { ExperienceInstance } from '../entities/experience-instance/experience-instance';
7
7
  export { registerProjectConfig } from '../plugins/dynamic-experiences/plugin';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAA;AAE7F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AAEvE,OAAO,EACL,SAAS,EACT,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,mB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nB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,GACvB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,wBAAwB,EAAE,MAAM,qDAAqD,CAAA;AAC9F,YAAY,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAA;AAC7F,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAA;AAC7E,OAAO,EACL,QAAQ,EACR,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,kCAAkC,CAAA;AACzC,YAAY,EACV,WAAW,EACX,aAAa,EACb,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,sCAAsC,CAAA;AA0B7C,MAAM,WAAW,QAAQ,CAAC,CAAC,GAAG,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC;IAC7D,gBAAgB,EAAE,CAAC,SAAS,EAAE,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAA;IAC3E,MAAM,EAAE,CACN,SAAS,EAAE,CAAC,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,kBAAkB,KAC3B,OAAO,CAAC;QACX,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,MAAM,CAAA;KACb,CAAC,CAAA;CACH;AAmBD;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAoJ/E"}
@@ -1,5 +1,5 @@
1
1
  import type { Picked } from '../picked';
2
- import type { ContentBlob, ExperienceContentResponse, ProjectConfig } from '../plugins/dynamic-experiences/types';
2
+ import type { ContentBlob, ProjectConfig } from '../plugins/dynamic-experiences/types';
3
3
  /** Subset of `Location` fields that can be injected into the selection context. */
4
4
  export interface SerializeLocation {
5
5
  href: string;
@@ -16,31 +16,19 @@ export interface SerializeLocation {
16
16
  export interface SerializeAttributes {
17
17
  location?: Partial<SerializeLocation>;
18
18
  }
19
- /** Customer-supplied content fetcher used in place of the runtime API during serialization. */
20
- export type SerializeGetContent = (experience: {
21
- id: string;
22
- key: string;
23
- }, options?: {
24
- previewToken?: string;
25
- }) => Promise<ExperienceContentResponse | null>;
26
19
  /** Parameters for {@link serialize}. */
27
20
  export interface SerializeParams {
28
- /** The project config to register and select against. */
29
- projectConfig: ProjectConfig;
30
21
  /** URL attributes injected into the selection context. */
31
22
  attributes?: SerializeAttributes;
32
- /** Optional content fetcher; falls back to the runtime API when omitted. */
33
- getContent?: SerializeGetContent;
34
23
  /**
35
- * Preview token forwarded to the default API content fetch (and to a custom `getContent`), so
36
- * preview (unpublished) content resolves during preview SSR. The server has no `searchParams`,
37
- * so the token cannot be recovered otherwise.
24
+ * Preview token for this request, so preview (unpublished) config and content resolve during
25
+ * preview SSR. The server has no `searchParams`, so the token cannot be recovered otherwise.
38
26
  */
39
27
  previewToken?: string;
40
28
  /**
41
- * Per-content-fetch timeout in milliseconds for the default API path, so a slow or hung upstream
42
- * cannot stall the SSR render indefinitely. On timeout the blob is skipped and the render
43
- * proceeds (matching the existing null-tolerant path). Defaults to {@link DEFAULT_CONTENT_TIMEOUT_MS}.
29
+ * Per-content-fetch timeout in milliseconds for the API path, so a slow or hung upstream cannot
30
+ * stall the SSR render indefinitely. On timeout the blob is skipped and the render proceeds.
31
+ * Defaults to {@link DEFAULT_CONTENT_TIMEOUT_MS}.
44
32
  */
45
33
  timeoutMs?: number;
46
34
  }
@@ -58,27 +46,27 @@ export interface PickedSnapshot {
58
46
  conditionResults: Record<string, boolean>;
59
47
  }
60
48
  /**
61
- * Registers a project config, selects experiences whose conditions pass for the given URL,
62
- * fetches content for the selected experiences that reference CMS layout content, and returns
63
- * a plain-JSON snapshot for SSR hydration.
49
+ * Selects the experiences whose conditions pass for a URL and returns a plain-JSON snapshot for
50
+ * SSR hydration.
51
+ *
52
+ * Config and content both resolve through the client, which keeps them on one source: a bundled
53
+ * render cannot pair a bundled config with API-fetched content from a newer publish. Content is
54
+ * deduped by blob id, and each API read carries a deadline so a slow upstream cannot stall the
55
+ * render.
64
56
  *
65
- * Registration is synchronous (no `client.start()`), so the client's stores are populated
66
- * before selection. The condition-results store is reset at entry so a client reused across
67
- * requests never seeds one request's selection with another's; `serialize` still expects a
68
- * per-request client (concurrent calls on one client are not supported). Each experience's own
69
- * condition is evaluated through the memoized evaluator against the injected URL; client-level
70
- * precondition/condition are not evaluated here in v1. Content is fetched via the `getContent`
71
- * override when provided, otherwise via the runtime API (with `previewToken` forwarded and a
72
- * per-fetch timeout so a slow upstream cannot stall the render), and deduped by blob id.
57
+ * Registration is synchronous (no `client.start()`), so the client's stores are populated before
58
+ * selection. The condition-results store is reset at entry, and `serialize` expects a per-request
59
+ * client — concurrent calls on one client are not supported. Each experience's own condition is
60
+ * evaluated through the memoized evaluator against the injected URL; client-level
61
+ * precondition/condition are not evaluated here in v1.
73
62
  *
74
- * @param {Picked} client - The Picked client to register and select with.
75
- * @param {SerializeParams} params - Project config, URL attributes, and optional content fetcher.
63
+ * @param {Picked} client - The Picked client to select with, and to resolve data through.
64
+ * @param {SerializeParams} [params] - URL attributes, preview token, and content timeout.
76
65
  * @returns {Promise<PickedSnapshot>} The plain-JSON snapshot of config, content, and condition results.
77
66
  * @example
78
67
  * const snapshot = await serialize(client, {
79
- * projectConfig,
80
68
  * attributes: { location: { pathname: '/promo' } },
81
69
  * })
82
70
  */
83
- export declare function serialize(client: Picked, params: SerializeParams): Promise<PickedSnapshot>;
71
+ export declare function serialize(client: Picked, params?: SerializeParams): Promise<PickedSnapshot>;
84
72
  //# sourceMappingURL=serialize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../../src/server/serialize.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAOvC,OAAO,KAAK,EACV,WAAW,EACX,yBAAyB,EACzB,aAAa,EAE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AAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC1C;AAoCD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,SAAS,CAC7B,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,eAAoB,GAC3B,OAAO,CAAC,cAAc,CAAC,CA0EzB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picked/client",
3
- "version": "0.0.72-next.1",
3
+ "version": "0.0.72-next.2",
4
4
  "dependencies": {
5
5
  "@withease/factories": "^1.0.5"
6
6
  },
@@ -171,8 +171,8 @@
171
171
  "size-limit": [
172
172
  {
173
173
  "path": "dist/esm/index.js",
174
- "limit": "16 kB",
175
- "name": "index (incl. lazily-loaded preview channel; see AGENTS.md)"
174
+ "limit": "18 kB",
175
+ "name": "index (incl. lazily-loaded preview channel and data provider; see AGENTS.md)"
176
176
  },
177
177
  {
178
178
  "path": "dist/esm/server/index.js",