@picked/client 0.0.73 → 0.0.74
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/dist/.tsbuildinfo +1 -1
- package/dist/api-DGFHHioX.js +22 -0
- package/dist/api-DrR9JbZX.cjs +1 -0
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/docs/how-to/authenticate-the-cli.md +97 -0
- package/dist/docs/how-to/create-and-revoke-an-api-key.md +7 -2
- package/dist/docs/how-to/debug-with-the-chrome-extension.md +1 -1
- package/dist/docs/how-to/install-the-sdk.md +31 -6
- package/dist/docs/how-to/install-the-vite-plugin.md +22 -9
- package/dist/docs/how-to/read-a-feature-flag.md +1 -1
- package/dist/docs/how-to/read-a-referenced-entry.md +4 -6
- package/dist/docs/how-to/register-a-component.md +2 -2
- package/dist/docs/how-to/register-an-action-handler.md +1 -1
- package/dist/docs/how-to/render-a-step-form.md +3 -4
- package/dist/docs/how-to/server-render-a-page.md +1 -1
- package/dist/docs/how-to/switch-workspaces.md +122 -0
- package/dist/docs/how-to/write-a-predicate.md +1 -1
- package/dist/docs/reference/dashboard/api-keys.mdx +5 -4
- package/dist/docs/reference/delivery-api/workspace-schema.md +74 -0
- package/dist/docs/reference/sdk/content.md +7 -10
- package/dist/docs/reference/sdk/features.md +1 -1
- package/dist/docs/reference/sdk/plugins/dynamic-experiences.md +1 -1
- package/dist/docs/reference/sdk/plugins/window-object.md +1 -1
- package/dist/docs/reference/sdk/ssr/serialize.md +1 -1
- package/dist/docs/reference/sdk/steps.md +3 -4
- package/dist/docs/reference/sdk/type-generation.md +169 -0
- package/dist/docs/reference/tools/cli.md +146 -0
- package/dist/docs/reference/tools/vite-plugin.md +28 -6
- package/dist/docs/tutorials/first-experience.mdx +6 -7
- package/dist/docs/tutorials/first-server-rendered-page.mdx +3 -3
- package/dist/esm/index.js +23 -14
- package/dist/esm/plugins/dynamic-experiences/index.js +5 -4
- package/dist/esm/server/index.js +1 -1
- package/dist/{plugin-DviILBha.js → plugin-B-c2VAl2.js} +24 -20
- package/dist/plugin-B8YrVbNq.cjs +1 -0
- package/dist/{provider-fU4mqyvT.js → provider-HpWMlxa0.js} +2 -1
- package/dist/provider-hQPGEy73.cjs +1 -0
- package/dist/registry-C1t8l3t9.cjs +1 -0
- package/dist/registry-CXZv0uLg.js +18 -0
- package/dist/types/data-source/api.d.ts +1 -1
- package/dist/types/data-source/api.d.ts.map +1 -1
- package/dist/types/data-source/provider.d.ts +11 -1
- package/dist/types/data-source/provider.d.ts.map +1 -1
- package/dist/types/entities/response/response.d.ts +22 -6
- package/dist/types/entities/response/response.d.ts.map +1 -1
- package/dist/types/form/create-submit-pipeline.d.ts +32 -3
- package/dist/types/form/create-submit-pipeline.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/picked.d.ts +5 -4
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/ping.d.ts +4 -3
- package/dist/types/ping.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/index.d.ts +2 -1
- package/dist/types/plugins/dynamic-experiences/index.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts +1 -1
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/types.d.ts +6 -116
- package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -1
- package/dist/types/schema-registry.d.ts +190 -0
- package/dist/types/schema-registry.d.ts.map +1 -0
- package/dist/types/server/index.d.ts +1 -1
- package/dist/types/server/index.d.ts.map +1 -1
- package/dist/types/server/serialize.d.ts +11 -1
- package/dist/types/server/serialize.d.ts.map +1 -1
- package/dist/types/typed-content.d.ts +17 -0
- package/dist/types/typed-content.d.ts.map +1 -0
- package/dist/types/utils/picked-config.d.ts +19 -1
- package/dist/types/utils/picked-config.d.ts.map +1 -1
- package/dist/version-BJFZwX5G.js +4 -0
- package/dist/version-DzA5_Ptz.cjs +1 -0
- package/package.json +3 -1
- package/dist/api-B6Ma2KAc.cjs +0 -1
- package/dist/api-BlxGTa53.js +0 -38
- package/dist/plugin-DkSWIASL.cjs +0 -1
- package/dist/provider-C8ONTzzL.cjs +0 -1
- package/dist/registry-BvoKbKKv.cjs +0 -1
- package/dist/registry-ZEiRsEkm.js +0 -74
- package/dist/types/utils/api.d.ts +0 -25
- package/dist/types/utils/api.d.ts.map +0 -1
- package/dist/types/utils/client-headers.d.ts +0 -2
- package/dist/types/utils/client-headers.d.ts.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "./logger-DMN6TxJJ.js";
|
|
2
|
-
import {
|
|
2
|
+
import { n as e, t } from "./api-DGFHHioX.js";
|
|
3
|
+
import { r as n, t as r } from "./registry-CXZv0uLg.js";
|
|
3
4
|
//#region src/data-source/provider.ts
|
|
4
5
|
var i = "bundle", a = "api";
|
|
5
6
|
async function o() {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require("./logger-CSTvAyyB.cjs");const e=require("./api-DrR9JbZX.cjs"),t=require("./registry-C1t8l3t9.cjs");var n=`bundle`,r=`api`;async function i(){try{let e=await import(`virtual:picked/data`);return t.r(e)?e:null}catch{return null}}function a(e){if(e===void 0||t.r(e))return e}function o(o){let{apiUrl:s,projectId:c,previewToken:l,signal:u}=o,d=!!l,f=d?r:o.mode,p=a(d?void 0:o.bundle),m=d?void 0:o.projectConfig,h=o.getContent,g={mode:f??r,manifest:null},_,v,y=new Map;function b(){if(f===r)return Promise.resolve(null);if(p)return Promise.resolve(p);let e=t.t();return e?Promise.resolve(e):(_??=i(),_)}function x(e){g.mode=e?n:r,g.manifest=e?e.manifestMetadata:null}async function S(){if(m)return x(await b()),m;let t=await b();return x(t),t?t.projectConfig:f===n?null:e.n(s,c,{...l!==void 0&&{previewToken:l},...u!==void 0&&{signal:u}})}async function C(t,r){let i=l===void 0?void 0:{previewToken:l};if(h)return h(t,i);let a=await b();if(x(a),a)try{return await a.experienceContent(t,i)}catch{return`${t.id}`,null}if(f===n)return null;let o=r??u;return e.t(s,c,t.id,{...l!==void 0&&{previewToken:l},...o!==void 0&&{signal:o}})}return{meta:g,getProjectConfig:()=>(v??=S(),v),getContent:(e,t)=>{let n=y.get(e.id);if(n)return n;let r=C(e,t?.signal).finally(()=>{y.delete(e.id)});return y.set(e.id,r),r}}}exports.createPickedDataProvider=o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require("./logger-CSTvAyyB.cjs");function e(e){if(typeof e!=`object`||!e||!(`projectConfig`in e)||!(`experienceContent`in e)||!(`manifestMetadata`in e))return!1;let{experienceContent:t}=e;return typeof t==`function`}var t=null;function n(n){e(n)&&(t=n)}function r(){return t}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import "./logger-DMN6TxJJ.js";
|
|
2
|
+
//#region src/data-source/virtual-data.ts
|
|
3
|
+
function e(e) {
|
|
4
|
+
if (typeof e != "object" || !e || !("projectConfig" in e) || !("experienceContent" in e) || !("manifestMetadata" in e)) return !1;
|
|
5
|
+
let { experienceContent: t } = e;
|
|
6
|
+
return typeof t == "function";
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/data-source/registry.ts
|
|
10
|
+
var t = null;
|
|
11
|
+
function n(n) {
|
|
12
|
+
e(n) && (t = n);
|
|
13
|
+
}
|
|
14
|
+
function r() {
|
|
15
|
+
return t;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { n, e as r, r as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExperienceContentResponse, FetchProjectOptions, ProjectConfig } from '
|
|
1
|
+
import type { ExperienceContentResponse, FetchProjectOptions, ProjectConfig } from '@picked/delivery-api-client';
|
|
2
2
|
/**
|
|
3
3
|
* Minimal shape check: verifies that `data` is an object with a `features` array.
|
|
4
4
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/data-source/api.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/data-source/api.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,yBAAyB,EACzB,mBAAmB,EACnB,aAAa,EACd,MAAM,6BAA6B,CAAA;AA6CpC;;;;;;;;;;;;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;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAE/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,CAE3C"}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @file The shared Picked data provider.
|
|
3
|
+
*
|
|
4
|
+
* One object answers "where does this session's project config and CMS content come from". A
|
|
5
|
+
* client builds one per preview token and reaches it through `getProjectConfig` and
|
|
6
|
+
* `getExperienceContent`; nothing outside the SDK constructs one. The mode is decided once, at
|
|
7
|
+
* construction, and the provider stays atomic: config and content come from the source the mode
|
|
8
|
+
* names.
|
|
9
|
+
*/
|
|
10
|
+
import type { ExperienceContentResponse, ProjectConfig } from '@picked/delivery-api-client';
|
|
11
|
+
import type { ContentLoader, PickedManifestMetadata, VirtualPickedData } from '../plugins/dynamic-experiences/types';
|
|
2
12
|
import { isVirtualPickedData } from './virtual-data';
|
|
3
13
|
/** Where a data provider reads project config and CMS content from. */
|
|
4
14
|
export type PickedDataMode = 'bundle' | 'api';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/data-source/provider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/data-source/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAE3F,OAAO,KAAK,EACV,aAAa,EACb,sBAAsB,EACtB,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"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { type Store } from 'effector';
|
|
3
3
|
import type { Picked } from '../../picked';
|
|
4
4
|
import type { Field, FieldValue } from '../field/field';
|
|
5
|
+
import type { FieldKeys, FieldValueFor } from '../../schema-registry';
|
|
5
6
|
import { type ValidationError } from './response-validation';
|
|
6
7
|
export type { ValidationError } from './response-validation';
|
|
7
8
|
export type ResponsesStore = ReturnType<typeof createResponseIndex>;
|
|
@@ -19,10 +20,10 @@ declare const createResponseIndexFactory: ({ client }: {
|
|
|
19
20
|
};
|
|
20
21
|
clearAll: import("effector").EventCallable<void>;
|
|
21
22
|
clear: import("effector").EventCallable<string>;
|
|
22
|
-
commit: (responsesToCommit:
|
|
23
|
+
commit: <T extends CommitResponses>(responsesToCommit: T & ValidateResponses<T>) => Promise<{
|
|
23
24
|
errors: ValidationError[];
|
|
24
25
|
}>;
|
|
25
|
-
getResponsesToCommit: (responsesToCommit:
|
|
26
|
+
getResponsesToCommit: <T extends CommitResponses>(responsesToCommit: T & ValidateResponses<T>) => Promise<{
|
|
26
27
|
responsesToCommit: CommitResponses;
|
|
27
28
|
validationErrors: ValidationError[];
|
|
28
29
|
}>;
|
|
@@ -34,20 +35,35 @@ declare const createResponseIndexFactory: ({ client }: {
|
|
|
34
35
|
[fieldKey: string]: FieldValue;
|
|
35
36
|
}>;
|
|
36
37
|
getByFieldId: (id: Field['id']) => Store<FieldValue>;
|
|
37
|
-
getByFieldKey: (key:
|
|
38
|
+
getByFieldKey: <K extends string>(key: K) => Store<FieldValueFor<K>>;
|
|
38
39
|
getByFieldName: (fieldName: Field['name']) => Store<FieldValue>;
|
|
39
40
|
};
|
|
40
41
|
/**
|
|
41
42
|
* Creates a response index instance bound to the given client.
|
|
42
43
|
*
|
|
43
|
-
* @
|
|
44
|
-
* @
|
|
44
|
+
* @template T
|
|
45
|
+
* @param {T} params - Configuration including the Picked client instance.
|
|
46
|
+
* @returns {ReturnType<typeof createResponseIndexFactory>} The response index with register, commit, and lookup methods.
|
|
45
47
|
* @example
|
|
46
48
|
* ```typescript
|
|
47
49
|
* const responses = createResponseIndex({ client })
|
|
48
50
|
* ```
|
|
49
51
|
*/
|
|
50
52
|
export declare function createResponseIndex<T extends Parameters<typeof createResponseIndexFactory>[0]>(params: T): ReturnType<typeof createResponseIndexFactory>;
|
|
51
|
-
/**
|
|
53
|
+
/** Loose transport shape: a record keyed by field `key`. Used internally and by the form bridge. */
|
|
52
54
|
export type CommitResponses = Record<string, FieldValue>;
|
|
55
|
+
/**
|
|
56
|
+
* Validates a response payload against the generated schema. For each key the caller actually
|
|
57
|
+
* provides, a workspace-known field key is narrowed to its schema value type while any other key
|
|
58
|
+
* stays a permissive `FieldValue`. Mapping over the caller's own keys (rather than requiring the
|
|
59
|
+
* full field set) is what lets typed literals be checked without breaking dynamic, out-of-schema
|
|
60
|
+
* payloads built by the form bridge.
|
|
61
|
+
*
|
|
62
|
+
* @template T - The inferred payload type.
|
|
63
|
+
* @example
|
|
64
|
+
* type Checked = ValidateResponses<{ 'email-address': string }>
|
|
65
|
+
*/
|
|
66
|
+
export type ValidateResponses<T> = {
|
|
67
|
+
[K in keyof T]: K extends FieldKeys ? FieldValueFor<K> : FieldValue;
|
|
68
|
+
};
|
|
53
69
|
//# sourceMappingURL=response.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../../../src/entities/response/response.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,OAAO,EAAiE,KAAK,KAAK,EAAE,MAAM,UAAU,CAAA;AAEpG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../../../src/entities/response/response.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,OAAO,EAAiE,KAAK,KAAK,EAAE,MAAM,UAAU,CAAA;AAEpG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAGrE,OAAO,EAML,KAAK,eAAe,EACrB,MAAM,uBAAuB,CAAA;AAE9B,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAE5D,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAInE,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAA;A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AAG,CAAC,SAAS,SAAS,GAAG,aAAa,CAAC,CAAC,CAAC,GAAG,UAAU;CACpE,CAAA"}
|
|
@@ -2,18 +2,47 @@
|
|
|
2
2
|
import { type Event, type EventCallable, type Store } from 'effector';
|
|
3
3
|
import type { ExperienceInstance } from '../entities/experience-instance/experience-instance';
|
|
4
4
|
import type { ExperienceStep } from '../entities/step/step';
|
|
5
|
-
import type { Field
|
|
5
|
+
import type { Field } from '../entities/field/field';
|
|
6
6
|
import type { ValidationError } from '../entities/response/response';
|
|
7
7
|
import type { Picked } from '../picked';
|
|
8
|
+
import type { FieldValueFor } from '../schema-registry';
|
|
8
9
|
export type SubmitEventWithCurrentTarget = SubmitEvent & {
|
|
9
10
|
currentTarget: EventTarget & HTMLFormElement;
|
|
10
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* Callback fired after a successful commit, receiving the committed `data` keyed by
|
|
14
|
+
* the step's field ids.
|
|
15
|
+
*
|
|
16
|
+
* The `data` value type is a schema-typed *view* over runtime-`FieldValue` data — the
|
|
17
|
+
* same soundness posture as `getField`/`getByFieldKey`. The registry narrows each field
|
|
18
|
+
* id to its declared value type, but the values are not runtime-validated against it. The
|
|
19
|
+
* default `TFieldIds = string` resolves to `Record<string, FieldValue>`, so untyped
|
|
20
|
+
* consumers keep the broad value type.
|
|
21
|
+
*/
|
|
11
22
|
export type SuccessCallback<TFieldIds extends string = string> = (options: {
|
|
12
|
-
data:
|
|
23
|
+
data: {
|
|
24
|
+
[P in TFieldIds]: FieldValueFor<P>;
|
|
25
|
+
};
|
|
13
26
|
stopNavigation: EventCallable<void>;
|
|
14
27
|
}) => void | Promise<void>;
|
|
15
28
|
export type ErrorCallback = (errors: ValidationError[]) => void | Promise<void>;
|
|
16
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Callback fired before commit, receiving the parsed `data` keyed by the step's field
|
|
31
|
+
* ids and optionally returning a transformed copy.
|
|
32
|
+
*
|
|
33
|
+
* The `data` value type is a schema-typed *view* over runtime-`FieldValue` data — the
|
|
34
|
+
* same soundness posture as `getField`/`getByFieldKey`. The registry narrows each field
|
|
35
|
+
* id to its declared value type, but the values are not runtime-validated against it. The
|
|
36
|
+
* default `TFieldIds = string` resolves to `Record<string, FieldValue>`, so untyped
|
|
37
|
+
* consumers keep the broad value type.
|
|
38
|
+
*/
|
|
39
|
+
export type SubmitCallback<TFieldIds extends string = string> = (data: {
|
|
40
|
+
[P in TFieldIds]: FieldValueFor<P>;
|
|
41
|
+
}) => {
|
|
42
|
+
[P in TFieldIds]: FieldValueFor<P>;
|
|
43
|
+
} | void | Promise<{
|
|
44
|
+
[P in TFieldIds]: FieldValueFor<P>;
|
|
45
|
+
} | void>;
|
|
17
46
|
/**
|
|
18
47
|
* Latest-wins submit callback slots accepted by the framework adapters.
|
|
19
48
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-submit-pipeline.d.ts","sourceRoot":"","sources":["../../../src/form/create-submit-pipeline.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,OAAO,EAOL,KAAK,KAAK,EACV,KAAK,aAAa,EAClB,KAAK,KAAK,EACX,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAA;AAC7F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,KAAK,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"create-submit-pipeline.d.ts","sourceRoot":"","sources":["../../../src/form/create-submit-pipeline.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,OAAO,EAOL,KAAK,KAAK,EACV,KAAK,aAAa,EAClB,KAAK,KAAK,EACX,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAA;AAC7F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,KAAK,EAAE,KAAK,EAAc,MAAM,yBA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AAC,EAAE,aAAa,CAAA;CACxB;AA0FD,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAA;IACd,kBAAkB,EAAE,kBAAkB,CAAA;IACtC,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACpB,SAAS,EAAE,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;IACvC,WAAW,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAA;IAC3B,YAAY,EAAE,aAAa,CAAC,IAAI,CAAC,CAAA;CAClC;AAED,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,aAAa,CAAC,4BAA4B,CAAC,CAAA;IACxD,gBAAgB,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;IAChC,cAAc,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,MAAM,IAAI,CAAA;IACxD,SAAS,EAAE,CAAC,QAAQ,EAAE,eAAe,KAAK,MAAM,IAAI,CAAA;IACpD,OAAO,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,MAAM,IAAI,CAAA;IAChD;;;;OAIG;IACH,aAAa,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;IAC1B;;;OAGG;IACH,wBAAwB,EAAE,KAAK,CAAC,eAAe,EAAE,CAAC,CAAA;CACnD;AAyED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,MAAM,EACN,kBAAkB,EAClB,MAAM,EACN,KAAK,EACL,SAAS,EACT,WAAW,EACX,YAAY,GACb,EAAE,oBAAoB,GAAG,cAAc,CAoRvC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -21,4 +21,6 @@ export type * from './utils/events';
|
|
|
21
21
|
export type * from './utils/search-params';
|
|
22
22
|
export type * from './entities/response/response';
|
|
23
23
|
export { Picked } from './picked';
|
|
24
|
+
export type { ActionKeys, ContentForStep, ExperienceKeys, FeatureKeys, FieldKeys, FieldKeysForStep, FieldValueFor, KnownActionKeys, KnownExperienceKeys, KnownFeatureKeys, KnownFieldKeys, KnownStepKeys, PickedSchemaRegistry, ReferencedContent, StepContentModelsMap, StepKeys, StepLayoutContent, TypedContent, } from './schema-registry';
|
|
25
|
+
export { toTypedContentStore } from './typed-content';
|
|
24
26
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAC5G,cAAc,WAAW,CAAA;AACzB,mBAAmB,UAAU,CAAA;AAC7B,mBAAmB,0BAA0B,CAAA;AAC7C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,8BAA8B,CAAA;AACjD,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,oCAAoC,CAAA;AACvD,mBAAmB,oDAAoD,CAAA;AACvE,mBAAmB,kCAAkC,CAAA;AACrD,mBAAmB,sBAAsB,CAAA;AACzC,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,wBAAwB,CAAA;AAC3C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,0BAA0B,CAAA;AAC7C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,gBAAgB,CAAA;AACnC,mBAAmB,uBAAuB,CAAA;AAC1C,mBAAmB,8BAA8B,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAC5G,cAAc,WAAW,CAAA;AACzB,mBAAmB,UAAU,CAAA;AAC7B,mBAAmB,0BAA0B,CAAA;AAC7C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,8BAA8B,CAAA;AACjD,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,oCAAoC,CAAA;AACvD,mBAAmB,oDAAoD,CAAA;AACvE,mBAAmB,kCAAkC,CAAA;AACrD,mBAAmB,sBAAsB,CAAA;AACzC,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,wBAAwB,CAAA;AAC3C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,0BAA0B,CAAA;AAC7C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,gBAAgB,CAAA;AACnC,mBAAmB,uBAAuB,CAAA;AAC1C,mBAAmB,8BAA8B,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,YAAY,EACV,UAAU,EACV,cAAc,EACd,cAAc,EACd,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,QAAQ,EACR,iBAAiB,EACjB,YAAY,GACb,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA"}
|
package/dist/types/picked.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** @file Picked client — the main entry point for the Picked SDK. */
|
|
2
2
|
import { type Effect, type EventCallable, type Store, type StoreWritable } from 'effector';
|
|
3
|
+
import type { ExperienceContentResponse, ProjectConfig } from '@picked/delivery-api-client';
|
|
3
4
|
import { type Experience, type LaunchExperienceOptions } from './entities/experience/experience';
|
|
4
5
|
import { type Plugin, type PluginConfigIndex } from './entities/plugin/plugin';
|
|
5
6
|
import { type CreateClientOptions } from './client';
|
|
@@ -16,7 +17,7 @@ import { type EventBusPayload, type EventHistoryStore } from './utils/events';
|
|
|
16
17
|
import type { Field } from './entities/field/field';
|
|
17
18
|
import type { ExperienceStep } from './entities/step/step';
|
|
18
19
|
import type { Content, ContentDataPatch } from './entities/content/content';
|
|
19
|
-
import type { ContentLoader
|
|
20
|
+
import type { ContentLoader } from './plugins/dynamic-experiences/types';
|
|
20
21
|
import type { Action } from './entities/action/action';
|
|
21
22
|
import { type Condition } from './entities/condition/condition';
|
|
22
23
|
import type { SessionEntity } from './entities/session/session';
|
|
@@ -198,10 +199,10 @@ export declare class Picked {
|
|
|
198
199
|
};
|
|
199
200
|
clearAll: EventCallable<void>;
|
|
200
201
|
clear: EventCallable<string>;
|
|
201
|
-
commit: (responsesToCommit: import(".").
|
|
202
|
+
commit: <T extends import(".").CommitResponses>(responsesToCommit: T & import(".").ValidateResponses<T>) => Promise<{
|
|
202
203
|
errors: import(".").ValidationError[];
|
|
203
204
|
}>;
|
|
204
|
-
getResponsesToCommit: (responsesToCommit: import(".").
|
|
205
|
+
getResponsesToCommit: <T extends import(".").CommitResponses>(responsesToCommit: T & import(".").ValidateResponses<T>) => Promise<{
|
|
205
206
|
responsesToCommit: import(".").CommitResponses;
|
|
206
207
|
validationErrors: import(".").ValidationError[];
|
|
207
208
|
}>;
|
|
@@ -213,7 +214,7 @@ export declare class Picked {
|
|
|
213
214
|
[fieldKey: string]: import(".").FieldValue;
|
|
214
215
|
}>;
|
|
215
216
|
getByFieldId: (id: Field['id']) => Store<import(".").FieldValue>;
|
|
216
|
-
getByFieldKey: (key:
|
|
217
|
+
getByFieldKey: <K extends string>(key: K) => Store<import("./schema-registry").FieldValueFor<K>>;
|
|
217
218
|
getByFieldName: (fieldName: Field['name']) => Store<import(".").FieldValue>;
|
|
218
219
|
};
|
|
219
220
|
readonly steps: {
|
|
@@ -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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C;IAED,YAAY,SAAU,cAAc,KAAG,IAAI,CAE1C;IAED,eAAe,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"}
|
package/dist/types/ping.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { Picked } from './picked';
|
|
2
2
|
/**
|
|
3
3
|
* Pings the server to track the last time the library was loaded.
|
|
4
|
-
* Implements rate limiting and supports Vercel branch deployments.
|
|
5
4
|
*
|
|
6
|
-
* @param
|
|
7
|
-
* @returns
|
|
5
|
+
* @param {Picked} client - The active Picked client instance.
|
|
6
|
+
* @returns {Promise<boolean>} Whether the ping succeeded.
|
|
7
|
+
* @example
|
|
8
|
+
* await ping(client)
|
|
8
9
|
*/
|
|
9
10
|
export declare const ping: (client: Picked) => Promise<boolean>;
|
|
10
11
|
//# sourceMappingURL=ping.d.ts.map
|
package/dist/types/ping.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ping.d.ts","sourceRoot":"","sources":["../../src/ping.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ping.d.ts","sourceRoot":"","sources":["../../src/ping.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAKtC;;;;;;;GAOG;AACH,eAAO,MAAM,IAAI,WAAkB,MAAM,KAAG,OAAO,CAAC,OAAO,CAoC1D,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
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
|
-
export { createClientHeaders } from '
|
|
3
|
+
export { createClientHeaders, fetchSchema } from '@picked/delivery-api-client';
|
|
4
4
|
export { registerPickedBundle } from '../../data-source/registry';
|
|
5
5
|
export type * from './types';
|
|
6
|
+
export type { ApiExperienceStep, ContentBlob, ExperienceContentResponse, FetchProjectOptions, ProjectConfig, ProjectConfigExperience, ProjectConfigFeature, ProjectConfigNode, } from '@picked/delivery-api-client';
|
|
6
7
|
//# 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;
|
|
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;AAGzF,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAI9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AACjE,mBAAmB,SAAS,CAAA;AAI5B,YAAY,EACV,iBAAiB,EACjB,WAAW,EACX,yBAAyB,EACzB,mBAAmB,EACnB,aAAa,EACb,uBAAuB,EACvB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,6BAA6B,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { ProjectConfig } from '@picked/delivery-api-client';
|
|
1
2
|
import type { Plugin } from '../../entities/plugin/plugin';
|
|
2
3
|
import type { Picked } from '../../picked';
|
|
3
|
-
import type { ProjectConfig } from './types';
|
|
4
4
|
export { fetchProject, fetchExperienceContent } from '../../data-source/api';
|
|
5
5
|
/**
|
|
6
6
|
* Synchronously registers a complete project config with the client: features, conditions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dynamic-experiences/plugin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dynamic-experiences/plugin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEV,aAAa,EAGd,MAAM,6BAA6B,CAAA;AACpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAE1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAK1C,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AA+J5E;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,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;AAwMD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CA4DjD"}
|
|
@@ -1,122 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file
|
|
3
|
-
*/
|
|
4
|
-
import type { ExperienceStep } from '../../entities/step/step';
|
|
5
|
-
import type { Field } from '../../entities/field/field';
|
|
6
|
-
import type { ExperienceEdge, ExperienceNode, ExperienceTarget } from '../../entities/experience/experience';
|
|
7
|
-
import type { Condition } from '../../entities/condition/condition';
|
|
8
|
-
import type { LogicRule, LogicValue } from '../../logic-engine';
|
|
9
|
-
/**
|
|
10
|
-
* Wire-format step as returned by the Picked API. Matches {@link ExperienceStep}
|
|
11
|
-
* except that fields are still referenced by ID — the plugin resolves them to
|
|
12
|
-
* keys against `ProjectConfig.fields` at registration time.
|
|
13
|
-
*
|
|
14
|
-
* `fieldIds` is optional: layout-only steps (driven purely by `layoutName`) omit it.
|
|
15
|
-
*
|
|
16
|
-
* `layoutContentId` is the wire-format reference to a CMS Content record. The actual
|
|
17
|
-
* content blob is delivered by `dynamicExperiencesPlugin`'s content resolution chain
|
|
18
|
-
* (virtual data module, preview-token API fetch, or direct API fetch) and registered
|
|
19
|
-
* via `client.registerContent`. Steps' derived `layoutContentStore` resolves reactively
|
|
20
|
-
* against the registry at render time.
|
|
21
|
-
*/
|
|
22
|
-
export type ApiExperienceStep = Omit<ExperienceStep, 'fieldKeys' | 'layoutContentStore'> & {
|
|
23
|
-
fieldIds?: string[];
|
|
24
|
-
};
|
|
25
|
-
export interface ProjectConfigFeature {
|
|
26
|
-
id: string;
|
|
27
|
-
name: string;
|
|
28
|
-
enabled: boolean;
|
|
29
|
-
weight: number;
|
|
30
|
-
version: number;
|
|
31
|
-
}
|
|
32
|
-
export type ProjectConfigNode = ExperienceNode;
|
|
33
|
-
/**
|
|
34
|
-
* An experience payload as returned by the API.
|
|
35
|
-
* Steps are referenced by ID only; the full step definitions live in the
|
|
36
|
-
* top-level `steps` array of ProjectConfig.
|
|
37
|
-
* Conditions are referenced by nodes via `conditionId`; the full condition
|
|
38
|
-
* definitions live in the top-level `conditions` array of ProjectConfig.
|
|
39
|
-
*/
|
|
40
|
-
export interface ProjectConfigExperience {
|
|
41
|
-
id: string;
|
|
42
|
-
key: string;
|
|
43
|
-
name: string;
|
|
44
|
-
componentName: string;
|
|
45
|
-
nodes: ProjectConfigNode[];
|
|
46
|
-
edges: ExperienceEdge[];
|
|
47
|
-
/** Decision logic that controls whether this experience is initialised. */
|
|
48
|
-
condition: LogicRule | LogicValue;
|
|
49
|
-
/** Logic that controls the initial open state of the experience. */
|
|
50
|
-
initializeOpen: LogicRule | LogicValue;
|
|
51
|
-
/** DOM targets this experience mounts into. */
|
|
52
|
-
targets: ExperienceTarget[];
|
|
53
|
-
}
|
|
54
|
-
export interface ProjectConfig {
|
|
55
|
-
id: string;
|
|
56
|
-
name: string;
|
|
57
|
-
status: string;
|
|
58
|
-
versionId: string;
|
|
59
|
-
workspaceId: string;
|
|
60
|
-
features: ProjectConfigFeature[];
|
|
61
|
-
/** Experience definitions with steps and conditions referenced by ID. */
|
|
62
|
-
experiences: ProjectConfigExperience[];
|
|
63
|
-
/** Global step definitions shared across experiences. */
|
|
64
|
-
steps: ApiExperienceStep[];
|
|
65
|
-
/** Global field definitions shared across steps. */
|
|
66
|
-
fields: Field[];
|
|
67
|
-
/** Global condition definitions referenced by experience flow nodes. */
|
|
68
|
-
conditions: Condition[];
|
|
69
|
-
actions: Array<{
|
|
70
|
-
id: string;
|
|
71
|
-
name: string;
|
|
72
|
-
key: string;
|
|
73
|
-
}>;
|
|
74
|
-
/**
|
|
75
|
-
* Origins permitted to push live-preview content patches into this page, issued by the API on the
|
|
76
|
-
* preview surface only. The preview receiver validates every inbound message against this list;
|
|
77
|
-
* absent or empty means no embedder is trusted and the channel stays closed.
|
|
78
|
-
*/
|
|
79
|
-
previewEmbedderOrigins?: string[];
|
|
80
|
-
}
|
|
81
|
-
export interface FetchProjectOptions {
|
|
82
|
-
previewToken?: string;
|
|
83
|
-
headers?: Record<string, string>;
|
|
84
|
-
/** Abort signal applied to the underlying `fetch` (for example an `AbortSignal.timeout` deadline). */
|
|
85
|
-
signal?: AbortSignal;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Wire-format content blob as returned by the Picked API content endpoint.
|
|
89
|
-
*/
|
|
90
|
-
export interface ContentBlob {
|
|
91
|
-
id: string;
|
|
92
|
-
/** The `key` of the Content Model that produced this entry, or `null` when unresolved. */
|
|
93
|
-
contentModelKey: string | null;
|
|
94
|
-
data: Record<string, unknown>;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Wire-format response shape for `GET /api/v1/projects/:projectId/experiences/:experienceId/content`.
|
|
98
|
-
* The response is agnostic of step structure — step ↔ content mapping is encoded in the
|
|
99
|
-
* project blob via `Step.layoutContentId`.
|
|
2
|
+
* @file Plugin-specific types for the dynamic-experiences plugin.
|
|
100
3
|
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
4
|
+
* The wire-format shapes the Delivery API returns live in `@picked/delivery-api-client`,
|
|
5
|
+
* which stays runtime-agnostic. This file holds the types that only mean something inside
|
|
6
|
+
* the client: the content loader and the virtual data module
|
|
7
|
+
* `@picked/vite-plugin-picked` generates.
|
|
104
8
|
*/
|
|
105
|
-
|
|
106
|
-
experienceId: string;
|
|
107
|
-
versionId: string | null;
|
|
108
|
-
/** The Content records the experience's steps point at, via `Step.layoutContentId`. */
|
|
109
|
-
content: ContentBlob[];
|
|
110
|
-
/**
|
|
111
|
-
* Content records reached from `content` through a `reference` field, deduped
|
|
112
|
-
* and excluding the step blobs. Registered into the content registry the same
|
|
113
|
-
* way, so a `{ contentEntryId }` pointer resolves through `contents.getById`.
|
|
114
|
-
*
|
|
115
|
-
* Optional: a response produced before this field existed — notably a build-time
|
|
116
|
-
* cache written by an older `@picked/vite-plugin-picked` — omits it entirely.
|
|
117
|
-
*/
|
|
118
|
-
references?: ContentBlob[];
|
|
119
|
-
}
|
|
9
|
+
import type { ExperienceContentResponse, ProjectConfig } from '@picked/delivery-api-client';
|
|
120
10
|
/**
|
|
121
11
|
* Function that resolves an experience's content blobs. Set on the Picked client by
|
|
122
12
|
* `dynamicExperiencesPlugin` (selecting from virtual module, getContent override, or API)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dynamic-experiences/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dynamic-experiences/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAE3F;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,CAC1B,UAAU,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EACvC,OAAO,CAAC,EAAE;IAAE,YAAY,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"}
|