@picked/client 0.0.1-dev.1786405786333 → 0.0.1-dev.1786675074931

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 (60) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/api-CSNjsqCv.js +22 -0
  3. package/dist/api-yuvsQhNy.cjs +1 -0
  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/how-to/authenticate-the-cli.md +95 -0
  8. package/dist/docs/how-to/install-the-sdk.md +7 -0
  9. package/dist/docs/how-to/switch-workspaces.md +123 -0
  10. package/dist/docs/reference/delivery-api/workspace-schema.md +74 -0
  11. package/dist/docs/reference/sdk/type-generation.md +146 -0
  12. package/dist/docs/reference/tools/cli.md +141 -0
  13. package/dist/esm/index.js +23 -14
  14. package/dist/esm/plugins/dynamic-experiences/index.js +5 -4
  15. package/dist/esm/server/index.js +1 -1
  16. package/dist/{plugin-DviILBha.js → plugin-ClKkYGTd.js} +24 -20
  17. package/dist/plugin-D4-caxZN.cjs +1 -0
  18. package/dist/{provider-DnRTKPsK.js → provider-BEpf8z6A.js} +2 -1
  19. package/dist/provider-D7msjLQ1.cjs +1 -0
  20. package/dist/registry-C1t8l3t9.cjs +1 -0
  21. package/dist/registry-CXZv0uLg.js +18 -0
  22. package/dist/types/data-source/api.d.ts +1 -1
  23. package/dist/types/data-source/api.d.ts.map +1 -1
  24. package/dist/types/entities/response/response.d.ts +22 -6
  25. package/dist/types/entities/response/response.d.ts.map +1 -1
  26. package/dist/types/form/create-submit-pipeline.d.ts +32 -3
  27. package/dist/types/form/create-submit-pipeline.d.ts.map +1 -1
  28. package/dist/types/index.d.ts +2 -0
  29. package/dist/types/index.d.ts.map +1 -1
  30. package/dist/types/picked.d.ts +3 -3
  31. package/dist/types/ping.d.ts +4 -3
  32. package/dist/types/ping.d.ts.map +1 -1
  33. package/dist/types/plugins/dynamic-experiences/index.d.ts +1 -1
  34. package/dist/types/plugins/dynamic-experiences/index.d.ts.map +1 -1
  35. package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
  36. package/dist/types/plugins/dynamic-experiences/types.d.ts +7 -116
  37. package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -1
  38. package/dist/types/schema-registry.d.ts +190 -0
  39. package/dist/types/schema-registry.d.ts.map +1 -0
  40. package/dist/types/server/index.d.ts +1 -1
  41. package/dist/types/server/index.d.ts.map +1 -1
  42. package/dist/types/server/serialize.d.ts +11 -1
  43. package/dist/types/server/serialize.d.ts.map +1 -1
  44. package/dist/types/typed-content.d.ts +17 -0
  45. package/dist/types/typed-content.d.ts.map +1 -0
  46. package/dist/types/utils/picked-config.d.ts +19 -1
  47. package/dist/types/utils/picked-config.d.ts.map +1 -1
  48. package/dist/version-CRxCADU7.cjs +1 -0
  49. package/dist/version-CTwGfdI4.js +4 -0
  50. package/package.json +3 -1
  51. package/dist/api-CJXSNevv.js +0 -38
  52. package/dist/api-CP8La6ax.cjs +0 -1
  53. package/dist/plugin-DkSWIASL.cjs +0 -1
  54. package/dist/provider-DIV6y0Wi.cjs +0 -1
  55. package/dist/registry-D9oWMcgF.js +0 -74
  56. package/dist/registry-a4Uk2Ivo.cjs +0 -1
  57. package/dist/types/utils/api.d.ts +0 -25
  58. package/dist/types/utils/api.d.ts.map +0 -1
  59. package/dist/types/utils/client-headers.d.ts +0 -2
  60. package/dist/types/utils/client-headers.d.ts.map +0 -1
@@ -1,4 +1,5 @@
1
1
  import "./logger-DMN6TxJJ.js";
2
+ import "./api-CSNjsqCv.js";
2
3
  import { attach as e } from "effector";
3
4
  //#region src/plugins/dynamic-experiences/hash.ts
4
5
  function t(e) {
@@ -34,10 +35,13 @@ function o(e, t) {
34
35
  componentName: t.componentName
35
36
  });
36
37
  }
37
- function s(e, t) {
38
- if (Array.isArray(t.fields)) for (let n of t.fields) e.registerField(n);
38
+ function s(e) {
39
+ return typeof e != "object" || !e ? !1 : "id" in e && "key" in e && "type" in e && "name" in e;
39
40
  }
40
41
  function c(e, t) {
42
+ if (Array.isArray(t.fields)) for (let n of t.fields) s(n) && e.registerField(n);
43
+ }
44
+ function l(e, t) {
41
45
  if (!Array.isArray(t.steps)) return;
42
46
  let n = new Map(t.fields.map((e) => [e.id, e.key]));
43
47
  for (let r of t.steps) {
@@ -64,17 +68,17 @@ function c(e, t) {
64
68
  });
65
69
  }
66
70
  }
67
- function l(e, t) {
71
+ function u(e, t) {
68
72
  if (Array.isArray(t.experiences)) for (let n of t.experiences) o(e, n);
69
73
  }
70
- function u(e, t, n) {
71
- p(e, t, n.isPreview, n.sessionId), a(e, t), s(e, t), c(e, t), l(e, t);
74
+ function d(e, t, n) {
75
+ m(e, t, n.isPreview, n.sessionId), a(e, t), c(e, t), l(e, t), u(e, t);
72
76
  }
73
- function d(e) {
77
+ function f(e) {
74
78
  let t = e.searchParams["preview-token"];
75
79
  if (t && t.length > 0) return t[0];
76
80
  }
77
- function f(e) {
81
+ function p(e) {
78
82
  let t = /* @__PURE__ */ new Set(), n = e.searchParams.feature;
79
83
  if (!n) return t;
80
84
  for (let e of n) {
@@ -83,11 +87,11 @@ function f(e) {
83
87
  }
84
88
  return t;
85
89
  }
86
- function p(e, t, n, r) {
87
- let i = f(e);
88
- for (let a of t.features) i.has(a.id) || m(e, a, n, r);
90
+ function m(e, t, n, r) {
91
+ let i = p(e);
92
+ for (let a of t.features) i.has(a.id) || h(e, a, n, r);
89
93
  }
90
- function m(e, t, n, a) {
94
+ function h(e, t, n, a) {
91
95
  let o = r(a, t.id);
92
96
  e.registerFeature(t.id, {
93
97
  key: `v${t.version}`,
@@ -98,14 +102,14 @@ function m(e, t, n, a) {
98
102
  decide: () => i(o, t.weight)
99
103
  });
100
104
  }
101
- function h(e, t) {
105
+ function g(e, t) {
102
106
  for (let n of [...t.references ?? [], ...t.content]) e.registerContent({
103
107
  id: n.id,
104
108
  contentModelKey: n.contentModelKey,
105
109
  data: n.data
106
110
  });
107
111
  }
108
- function g(e, t) {
112
+ function _(e, t) {
109
113
  let n = /* @__PURE__ */ new Map();
110
114
  return (r, i) => {
111
115
  let a = n.get(r.id);
@@ -113,7 +117,7 @@ function g(e, t) {
113
117
  let o = (async () => {
114
118
  try {
115
119
  let n = await t(r, i);
116
- return n && h(e, n), n;
120
+ return n && g(e, n), n;
117
121
  } finally {
118
122
  n.delete(r.id);
119
123
  }
@@ -121,18 +125,18 @@ function g(e, t) {
121
125
  return n.set(r.id, o), o;
122
126
  };
123
127
  }
124
- function _(e, t) {
128
+ function v(e, t) {
125
129
  let n = new Set(t && Array.isArray(t.experiences) ? t.experiences.map((e) => e.id) : []);
126
130
  return (t, r) => n.has(t.id) ? e(t, r) : Promise.resolve(null);
127
131
  }
128
- function v() {
132
+ function y() {
129
133
  return {
130
134
  name: "dynamic-experiences",
131
135
  setup: (t) => ({ onStart: e({
132
136
  source: t.session.store.map((e) => e.id),
133
137
  effect: async (e) => {
134
- let n = d(t), r = n !== void 0, i = n === void 0 ? void 0 : { previewToken: n }, a = await t.getProjectConfig(n === void 0 ? void 0 : { previewToken: n }).catch((e) => null);
135
- if (t.contentLoader = g(t, _((e) => t.getExperienceContent(e, i), a)), !a) return;
138
+ let n = f(t), r = n !== void 0, i = n === void 0 ? void 0 : { previewToken: n }, a = await t.getProjectConfig(n === void 0 ? void 0 : { previewToken: n }).catch((e) => null);
139
+ if (t.contentLoader = _(t, v((e) => t.getExperienceContent(e, i), a)), !a) return;
136
140
  let o = t.seededVersionId;
137
141
  if (o !== null && o !== a.versionId) {
138
142
  t.versionSkew = {
@@ -141,7 +145,7 @@ function v() {
141
145
  }, `${a.versionId}${o}`;
142
146
  return;
143
147
  }
144
- t.previewEmbedderOrigins = a.previewEmbedderOrigins ?? null, u(t, a, {
148
+ t.previewEmbedderOrigins = a.previewEmbedderOrigins ?? null, d(t, a, {
145
149
  isPreview: r,
146
150
  sessionId: e
147
151
  });
@@ -150,4 +154,4 @@ function v() {
150
154
  };
151
155
  }
152
156
  //#endregion
153
- export { u as n, v as t };
157
+ export { d as n, y as t };
@@ -0,0 +1 @@
1
+ require("./logger-CSTvAyyB.cjs"),require("./api-yuvsQhNy.cjs");let e=require("effector");function t(e){let t=2166136261;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,16777619);return t>>>0}function n(e){let t=e;return t^=t>>>16,t=Math.imul(t,2246822507),t^=t>>>13,t=Math.imul(t,3266489909),t^=t>>>16,t>>>0}function r(e,r){return n(t(`${e}:${r}`))%100}function i(e,t){return t<=0?!1:t>=100||e<t}function a(e,t){if(Array.isArray(t.conditions))for(let n of t.conditions)e.registerCondition(n)}function o(e,t){e.registerExperience({id:t.id,key:t.key,name:t.name,targets:t.targets,nodes:t.nodes,edges:t.edges,condition:t.condition,initializeOpen:t.initializeOpen,componentName:t.componentName})}function s(e){return typeof e!=`object`||!e?!1:`id`in e&&`key`in e&&`type`in e&&`name`in e}function c(e,t){if(Array.isArray(t.fields))for(let n of t.fields)s(n)&&e.registerField(n)}function l(e,t){if(!Array.isArray(t.steps))return;let n=new Map(t.fields.map(e=>[e.id,e.key]));for(let r of t.steps){let t=[];for(let e of r.fieldIds??[]){let i=n.get(e);if(i===void 0){`${r.key}${e}`;continue}t.push(i)}let i=r.layoutContentId?e.contents.getById(r.layoutContentId):null;e.registerStep({id:r.id,key:r.key,name:r.name,fieldKeys:t,layoutName:r.layoutName,...r.layoutContentId!==void 0&&{layoutContentId:r.layoutContentId,layoutContentStore:i}})}}function u(e,t){if(Array.isArray(t.experiences))for(let n of t.experiences)o(e,n)}function d(e,t,n){m(e,t,n.isPreview,n.sessionId),a(e,t),c(e,t),l(e,t),u(e,t)}function f(e){let t=e.searchParams[`preview-token`];if(t&&t.length>0)return t[0]}function p(e){let t=new Set,n=e.searchParams.feature;if(!n)return t;for(let e of n){let n=e.indexOf(`:`);n>0&&t.add(e.substring(0,n))}return t}function m(e,t,n,r){let i=p(e);for(let a of t.features)i.has(a.id)||h(e,a,n,r)}function h(e,t,n,a){let o=r(a,t.id);e.registerFeature(t.id,{key:`v${t.version}`,name:t.name,enabled:t.enabled,weight:t.weight,storage:n?`session`:`local`,decide:()=>i(o,t.weight)})}function g(e,t){for(let n of[...t.references??[],...t.content])e.registerContent({id:n.id,contentModelKey:n.contentModelKey,data:n.data})}function _(e,t){let n=new Map;return(r,i)=>{let a=n.get(r.id);if(a)return a;let o=(async()=>{try{let n=await t(r,i);return n&&g(e,n),n}finally{n.delete(r.id)}})();return n.set(r.id,o),o}}function v(e,t){let n=new Set(t&&Array.isArray(t.experiences)?t.experiences.map(e=>e.id):[]);return(t,r)=>n.has(t.id)?e(t,r):Promise.resolve(null)}function y(){return{name:`dynamic-experiences`,setup:t=>({onStart:(0,e.attach)({source:t.session.store.map(e=>e.id),effect:async e=>{let n=f(t),r=n!==void 0,i=n===void 0?void 0:{previewToken:n},a=await t.getProjectConfig(n===void 0?void 0:{previewToken:n}).catch(e=>null);if(t.contentLoader=_(t,v(e=>t.getExperienceContent(e,i),a)),!a)return;let o=t.seededVersionId;if(o!==null&&o!==a.versionId){t.versionSkew={seeded:o,resolved:a.versionId},`${a.versionId}${o}`;return}t.previewEmbedderOrigins=a.previewEmbedderOrigins??null,d(t,a,{isPreview:r,sessionId:e})}})})}}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return y}});
@@ -1,5 +1,6 @@
1
1
  import "./logger-DMN6TxJJ.js";
2
- import { a as e, i as t, r as n, t as r } from "./registry-D9oWMcgF.js";
2
+ import { n as e, t } from "./api-CSNjsqCv.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-yuvsQhNy.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 '../plugins/dynamic-experiences/types';
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":"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"}
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"}
@@ -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: CommitResponses) => Promise<{
23
+ commit: <T extends CommitResponses>(responsesToCommit: T & ValidateResponses<T>) => Promise<{
23
24
  errors: ValidationError[];
24
25
  }>;
25
- getResponsesToCommit: (responsesToCommit: CommitResponses) => Promise<{
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: Field['key']) => Store<FieldValue>;
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
- * @param params - Configuration including the Picked client instance.
44
- * @returns The response index with register, commit, and lookup methods.
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
- /** Record keyed by field `key`. */
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/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AC,SAAS,eAAe,qBACxC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,KAC1C,OAAO,CAAC;QAAE,iBAAiB,EAAE,eAAe,CAAC;QAAC,gBAAgB,EAAE,eAAe,EAAE,CAAA;KAAE,CAAC;;;;;;;;uBA0F7D,KAAK,CAAC,IAAI,CAAC,KAAG,KAAK,CAAC,UAAU,CAAC;oBAiBlC,CAAC,SAAS,MAAM,OAAO,CAAC,KAAG,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;gCAetC,KAAK,CAAC,MAAM,CAAC,KAAG,KAAK,CAAC,UAAU,CAAC;CA2BpE,CAAA;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAC,CAAC,CAAC,EAC5F,MAAM,EAAE,CAAC,GACR,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAE/C;AAED,oGAAoG;AACpG,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;AAExD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,GAAG,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, FieldValue } from '../entities/field/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: Record<TFieldIds, FieldValue>;
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
- export type SubmitCallback<TFieldIds extends string = string> = (data: Record<TFieldIds, FieldValue>) => Record<TFieldIds, FieldValue> | void | Promise<Record<TFieldIds, FieldValue> | void>;
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,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;IACvC,OAAO,CAAC,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"}
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;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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"}
@@ -198,10 +198,10 @@ export declare class Picked {
198
198
  };
199
199
  clearAll: EventCallable<void>;
200
200
  clear: EventCallable<string>;
201
- commit: (responsesToCommit: import(".").CommitResponses) => Promise<{
201
+ commit: <T extends import(".").CommitResponses>(responsesToCommit: T & import(".").ValidateResponses<T>) => Promise<{
202
202
  errors: import(".").ValidationError[];
203
203
  }>;
204
- getResponsesToCommit: (responsesToCommit: import(".").CommitResponses) => Promise<{
204
+ getResponsesToCommit: <T extends import(".").CommitResponses>(responsesToCommit: T & import(".").ValidateResponses<T>) => Promise<{
205
205
  responsesToCommit: import(".").CommitResponses;
206
206
  validationErrors: import(".").ValidationError[];
207
207
  }>;
@@ -213,7 +213,7 @@ export declare class Picked {
213
213
  [fieldKey: string]: import(".").FieldValue;
214
214
  }>;
215
215
  getByFieldId: (id: Field['id']) => Store<import(".").FieldValue>;
216
- getByFieldKey: (key: Field['key']) => Store<import(".").FieldValue>;
216
+ getByFieldKey: <K extends string>(key: K) => Store<import("./schema-registry").FieldValueFor<K>>;
217
217
  getByFieldName: (fieldName: Field['name']) => Store<import(".").FieldValue>;
218
218
  };
219
219
  readonly steps: {
@@ -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 projectId - The project identifier
7
- * @returns A promise that resolves to a boolean indicating success
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
@@ -1 +1 @@
1
- {"version":3,"file":"ping.d.ts","sourceRoot":"","sources":["../../src/ping.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAKtC;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,WAAkB,MAAM,KAAG,OAAO,CAAC,OAAO,CA2C1D,CAAA"}
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,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
- export { createClientHeaders } from '../../utils/client-headers';
3
+ export { createClientHeaders, fetchSchema } from '@picked/delivery-api-client';
4
4
  export { registerPickedBundle } from '../../data-source/registry';
5
5
  export type * from './types';
6
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;AAIhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AACjE,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;AAGzF,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAI9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AACjE,mBAAmB,SAAS,CAAA"}
@@ -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;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAG1C,OAAO,KAAK,EAGV,aAAa,EAGd,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAyI5E;;;;;;;;;;;;;;;;;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
+ {"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;AAE1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAG1C,OAAO,KAAK,EAGV,aAAa,EAGd,MAAM,SAAS,CAAA;AAEhB,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,13 @@
1
1
  /**
2
- * @file Types for the dynamic-experiences plugin: project config shapes returned by the Picked API.
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
- * `versionId` is the published workspace version id on the published surface and
102
- * `null` on the preview surface, where there is no published version (mirroring
103
- * how the preview project-config payload surfaces `versionId: null`).
4
+ * The wire-format shapes the Delivery API returns live in `@picked/delivery-api-client`,
5
+ * which stays runtime-agnostic. This file re-exports them under the names the SDK uses and
6
+ * adds the types that only mean something inside the client: the content loader and the
7
+ * virtual data module `@picked/vite-plugin-picked` generates.
104
8
  */
105
- export interface ExperienceContentResponse {
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';
10
+ export type { ApiExperienceStep, ContentBlob, ExperienceContentResponse, FetchProjectOptions, ProjectConfig, ProjectConfigExperience, ProjectConfigFeature, ProjectConfigNode, } from '@picked/delivery-api-client';
120
11
  /**
121
12
  * Function that resolves an experience's content blobs. Set on the Picked client by
122
13
  * `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;;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,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,MAAM,CAAA;IACrB,KAAK,EAAE,iBAAiB,EAAE,CAAA;IAC1B,KAAK,EAAE,cAAc,EAAE,CAAA;IAC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,MAAM,CAAA;IACpB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,uFAAuF;IACvF,OAAO,EAAE,WAAW,EAAE,CAAA;IACtB;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,WAAW,EAAE,CAAA;CAC3B;AAED;;;;;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"}
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,YAAY,EACV,iBAAiB,EACjB,WAAW,EACX,yBAAyB,EACzB,mBAAmB,EACnB,aAAa,EACb,uBAAuB,EACvB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,6BAA6B,CAAA;AAEpC;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,CAC1B,UAAU,EAAE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