@picked/client 0.0.1-dev.1778136207545 → 0.0.1-dev.1778458140037
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/{api-NcKXNrkY.cjs → api-DeZvPxwp.cjs} +1 -1
- package/dist/{api-Crj5wFbR.js → api-_Nom0-oJ.js} +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
- package/dist/esm/index.js +174 -220
- package/dist/esm/plugins/dynamic-experiences/index.js +38 -103
- package/dist/types/entities/experience/experience.d.ts +2 -23
- package/dist/types/entities/experience/experience.d.ts.map +1 -1
- package/dist/types/entities/step/step.d.ts +0 -14
- package/dist/types/entities/step/step.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/picked.d.ts +0 -38
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/index.d.ts +1 -2
- package/dist/types/plugins/dynamic-experiences/index.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts +1 -18
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/types.d.ts +1 -62
- package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/types/entities/content/content.d.ts +0 -37
- package/dist/types/entities/content/content.d.ts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../../../logger-6z_gb4rA.js";
|
|
2
|
-
import { i as e, t } from "../../../api-
|
|
2
|
+
import { i as e, t } from "../../../api-_Nom0-oJ.js";
|
|
3
3
|
import { attach as n } from "effector";
|
|
4
4
|
//#region src/plugins/dynamic-experiences/hash.ts
|
|
5
5
|
function r(e) {
|
|
@@ -50,17 +50,12 @@ function u(e, t) {
|
|
|
50
50
|
}
|
|
51
51
|
t.push(i);
|
|
52
52
|
}
|
|
53
|
-
let i = r.layoutContentId ? e.contents.getById(r.layoutContentId) : null;
|
|
54
53
|
e.registerStep({
|
|
55
54
|
id: r.id,
|
|
56
55
|
key: r.key,
|
|
57
56
|
name: r.name,
|
|
58
57
|
fieldKeys: t,
|
|
59
|
-
layoutName: r.layoutName
|
|
60
|
-
...r.layoutContentId !== void 0 && {
|
|
61
|
-
layoutContentId: r.layoutContentId,
|
|
62
|
-
layoutContentStore: i
|
|
63
|
-
}
|
|
58
|
+
layoutName: r.layoutName
|
|
64
59
|
});
|
|
65
60
|
}
|
|
66
61
|
}
|
|
@@ -92,7 +87,24 @@ function h(e, t, n, r) {
|
|
|
92
87
|
decide: () => t.enabled ? a(r, t.weight) : !1
|
|
93
88
|
});
|
|
94
89
|
}
|
|
95
|
-
function g(
|
|
90
|
+
function g() {
|
|
91
|
+
let e;
|
|
92
|
+
try {
|
|
93
|
+
e = __PICKED_PROJECT_CONFIG__;
|
|
94
|
+
} catch {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (e === void 0) return;
|
|
98
|
+
let t;
|
|
99
|
+
if (typeof e == "string") try {
|
|
100
|
+
t = JSON.parse(e);
|
|
101
|
+
} catch {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
else t = e;
|
|
105
|
+
if (o(t)) return t;
|
|
106
|
+
}
|
|
107
|
+
function _(e) {
|
|
96
108
|
try {
|
|
97
109
|
let t = new URL(e).hostname;
|
|
98
110
|
return t === "localhost" || t === "127.0.0.1" || t === "::1";
|
|
@@ -100,17 +112,17 @@ function g(e) {
|
|
|
100
112
|
return !1;
|
|
101
113
|
}
|
|
102
114
|
}
|
|
103
|
-
function
|
|
115
|
+
function v(e) {
|
|
104
116
|
if (typeof e != "object" || !e || !("cause" in e)) return !1;
|
|
105
117
|
let { cause: t } = e;
|
|
106
118
|
return typeof t != "object" || !t || !("code" in t) ? !1 : t.code === "ECONNREFUSED";
|
|
107
119
|
}
|
|
108
|
-
async function
|
|
120
|
+
async function y(e, n, r) {
|
|
109
121
|
let i = r?.previewToken ? `projects/${n}?preview_token=${encodeURIComponent(r.previewToken)}` : `projects/${n}`, a;
|
|
110
122
|
try {
|
|
111
123
|
a = await t(e, i, r?.headers);
|
|
112
124
|
} catch (t) {
|
|
113
|
-
return
|
|
125
|
+
return _(e) && v(t), null;
|
|
114
126
|
}
|
|
115
127
|
if (!a.ok) return `${a.status.toString()}`, null;
|
|
116
128
|
let s;
|
|
@@ -121,91 +133,7 @@ async function v(e, n, r) {
|
|
|
121
133
|
}
|
|
122
134
|
return o(s) ? s : null;
|
|
123
135
|
}
|
|
124
|
-
function
|
|
125
|
-
return typeof e != "object" || !e || !("experienceId" in e) || !("content" in e) ? !1 : Array.isArray(e.content);
|
|
126
|
-
}
|
|
127
|
-
async function b(e, n, r, i) {
|
|
128
|
-
let a = i?.previewToken ? `projects/${n}/experiences/${r}/content?preview_token=${encodeURIComponent(i.previewToken)}` : `projects/${n}/experiences/${r}/content`, o;
|
|
129
|
-
try {
|
|
130
|
-
o = await t(e, a, i?.headers);
|
|
131
|
-
} catch (t) {
|
|
132
|
-
return g(e) && _(t) || `${r}`, null;
|
|
133
|
-
}
|
|
134
|
-
if (!o.ok) return `${r}${o.status.toString()}`, null;
|
|
135
|
-
let s;
|
|
136
|
-
try {
|
|
137
|
-
s = await o.json();
|
|
138
|
-
} catch {
|
|
139
|
-
return `${r}`, null;
|
|
140
|
-
}
|
|
141
|
-
return y(s) ? s : (`${r}`, null);
|
|
142
|
-
}
|
|
143
|
-
function x(e, t) {
|
|
144
|
-
for (let n of t.content) e.registerContent({
|
|
145
|
-
id: n.id,
|
|
146
|
-
data: n.data
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
function S(e) {
|
|
150
|
-
if (typeof e != "object" || !e || !("projectConfig" in e) || !("experienceContent" in e) || !("manifestMetadata" in e)) return !1;
|
|
151
|
-
let { experienceContent: t } = e;
|
|
152
|
-
return typeof t == "function";
|
|
153
|
-
}
|
|
154
|
-
var C = "virtual:picked/data";
|
|
155
|
-
async function w() {
|
|
156
|
-
try {
|
|
157
|
-
let e = await import(
|
|
158
|
-
/* @vite-ignore */
|
|
159
|
-
C
|
|
160
|
-
);
|
|
161
|
-
return S(e) ? e : null;
|
|
162
|
-
} catch {
|
|
163
|
-
return null;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
function T(e, t, n) {
|
|
167
|
-
return (r) => b(e, t, r.id, n ? { previewToken: n } : void 0);
|
|
168
|
-
}
|
|
169
|
-
function E(e, t) {
|
|
170
|
-
return (n) => e(n, t ? { previewToken: t } : void 0);
|
|
171
|
-
}
|
|
172
|
-
function D(e) {
|
|
173
|
-
return (t, n) => e.experienceContent(t, n);
|
|
174
|
-
}
|
|
175
|
-
function O(e, t) {
|
|
176
|
-
return async (n, r) => {
|
|
177
|
-
let i = await t(n, r);
|
|
178
|
-
return i && x(e, i), i;
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
async function k(e) {
|
|
182
|
-
let { client: t, apiUrl: n, options: r } = e, i = f(t), a = !!i, o = r?.projectConfig ?? null, s = r?.getContent ? E(r.getContent, i) : null, c = null;
|
|
183
|
-
if (i) return o ||= await v(n, t.projectId, { previewToken: i }), s ||= T(n, t.projectId, i), {
|
|
184
|
-
config: o,
|
|
185
|
-
contentLoader: s,
|
|
186
|
-
dataSource: c,
|
|
187
|
-
isPreview: a
|
|
188
|
-
};
|
|
189
|
-
if (o && s) return {
|
|
190
|
-
config: o,
|
|
191
|
-
contentLoader: s,
|
|
192
|
-
dataSource: c,
|
|
193
|
-
isPreview: a
|
|
194
|
-
};
|
|
195
|
-
let l = await w();
|
|
196
|
-
return l ? (o ??= l.projectConfig, s ??= D(l), c = l.manifestMetadata, {
|
|
197
|
-
config: o,
|
|
198
|
-
contentLoader: s,
|
|
199
|
-
dataSource: c,
|
|
200
|
-
isPreview: a
|
|
201
|
-
}) : (o ||= await v(n, t.projectId), s ||= T(n, t.projectId), {
|
|
202
|
-
config: o,
|
|
203
|
-
contentLoader: s,
|
|
204
|
-
dataSource: c,
|
|
205
|
-
isPreview: a
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
function A(e) {
|
|
136
|
+
function b(e) {
|
|
209
137
|
return {
|
|
210
138
|
name: "dynamic-experiences",
|
|
211
139
|
setup: (t) => {
|
|
@@ -213,16 +141,23 @@ function A(e) {
|
|
|
213
141
|
return { onStart: n({
|
|
214
142
|
source: t.session.store.map((e) => e.id),
|
|
215
143
|
effect: async (n) => {
|
|
216
|
-
let
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
144
|
+
let i = f(t);
|
|
145
|
+
if (i) {
|
|
146
|
+
let e = await y(r, t.projectId, { previewToken: i });
|
|
147
|
+
e && (m(t, e, !0, n), s(t, e), l(t, e), u(t, e), d(t, e));
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
let a = e?.projectConfig ?? g();
|
|
151
|
+
if (a) {
|
|
152
|
+
m(t, a, !1, n), s(t, a), l(t, a), u(t, a), d(t, a);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
let o = await y(r, t.projectId);
|
|
156
|
+
o && (m(t, o, !1, n), s(t, o), l(t, o), u(t, o), d(t, o));
|
|
222
157
|
}
|
|
223
158
|
}) };
|
|
224
159
|
}
|
|
225
160
|
};
|
|
226
161
|
}
|
|
227
162
|
//#endregion
|
|
228
|
-
export { e as createClientHeaders,
|
|
163
|
+
export { e as createClientHeaders, b as dynamicExperiencesPlugin, y as fetchProject };
|
|
@@ -51,8 +51,8 @@ export interface ExperienceStore {
|
|
|
51
51
|
*
|
|
52
52
|
* @template T - Factory parameter type.
|
|
53
53
|
* @param {T} params - The client instance and experience data.
|
|
54
|
-
* @param
|
|
55
|
-
* @param
|
|
54
|
+
* @param params.client
|
|
55
|
+
* @param params.experience
|
|
56
56
|
* @returns {ReturnType<typeof createExperienceFactory>} An experience store with config, tree, fields, and component sub-stores.
|
|
57
57
|
* @example
|
|
58
58
|
* ```typescript
|
|
@@ -187,26 +187,5 @@ export interface Experience {
|
|
|
187
187
|
* ```
|
|
188
188
|
*/
|
|
189
189
|
export declare const initialiseExperiences: (client: Picked) => Promise<void>;
|
|
190
|
-
/**
|
|
191
|
-
* Resolves CMS Content for an experience by invoking the registered content loader
|
|
192
|
-
* (set on the client by `dynamicExperiencesPlugin`'s resolution chain). Runs after
|
|
193
|
-
* the experience's `shouldInitialiseFx` gate and before its `initialiseFx`, so layouts
|
|
194
|
-
* have content available on first render.
|
|
195
|
-
*
|
|
196
|
-
* Failure-tolerant: if no loader is registered, or the loader rejects, or the loader
|
|
197
|
-
* returns `null`, the experience still proceeds to initialisation. Steps whose
|
|
198
|
-
* `layoutContentId` references content that wasn't registered render with
|
|
199
|
-
* `layoutContentStore` resolving to `null`.
|
|
200
|
-
*
|
|
201
|
-
* @param {Picked} client - The Picked client instance.
|
|
202
|
-
* @param {ExperienceStore} experience - The experience to prepare content for.
|
|
203
|
-
* @returns {Promise<boolean>} Always `true` in this change — reserved for future tiers
|
|
204
|
-
* that may signal "skip render".
|
|
205
|
-
* @example
|
|
206
|
-
* ```typescript
|
|
207
|
-
* await prepareExperienceContent(client, experience)
|
|
208
|
-
* ```
|
|
209
|
-
*/
|
|
210
|
-
export declare const prepareExperienceContent: (client: Picked, experience: ExperienceStore) => Promise<boolean>;
|
|
211
190
|
export {};
|
|
212
191
|
//# sourceMappingURL=experience.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experience.d.ts","sourceRoot":"","sources":["../../../../src/entities/experience/experience.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,OAAO,EAOL,KAAK,MAAM,EACX,KAAK,aAAa,EAElB,KAAK,KAAK,EACX,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;A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AAA;IACvC,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAC5B,2EAA2E;IAC3E,SAAS,CAAC,EAAE,SAAS,GAAG,UAAU,CAAA;IAClC,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,OAAO,EAAE,gBAAgB,EAAE,CAAA;CAC5B;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB,GAAU,QAAQ,MAAM,KAAG,OAAO,CAAC,IAAI,CAExE,CAAA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Store } from 'effector';
|
|
2
|
-
import { Content } from '../content/content';
|
|
3
2
|
export type StepsStore = ReturnType<typeof createStepIndex>;
|
|
4
3
|
export interface ExperienceStep {
|
|
5
4
|
id: string;
|
|
@@ -7,19 +6,6 @@ export interface ExperienceStep {
|
|
|
7
6
|
name: string;
|
|
8
7
|
fieldKeys: string[];
|
|
9
8
|
layoutName?: string | null;
|
|
10
|
-
/**
|
|
11
|
-
* Optional reference to a CMS Content record that supplies the step's layout data.
|
|
12
|
-
* The actual content is registered separately via `client.registerContent` and
|
|
13
|
-
* resolved at render time through `layoutContentStore` against the global content registry.
|
|
14
|
-
*/
|
|
15
|
-
layoutContentId?: string | null;
|
|
16
|
-
/**
|
|
17
|
-
* Reactive store of the content record this step references. Composed at registration
|
|
18
|
-
* time against `client.contents.getById(layoutContentId)`. `null` when the step has no
|
|
19
|
-
* `layoutContentId`. Reads stay reactive — content registered after the step
|
|
20
|
-
* (or updated mid-session) flows through automatically.
|
|
21
|
-
*/
|
|
22
|
-
layoutContentStore?: Store<Content | null> | null;
|
|
23
9
|
}
|
|
24
10
|
declare const createStepIndexFactory: () => {
|
|
25
11
|
register: (step: ExperienceStep) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../../src/entities/step/step.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,OAAO,EAA2B,KAAK,KAAK,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../../src/entities/step/step.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,OAAO,EAA2B,KAAK,KAAK,EAAE,MAAM,UAAU,CAAA;AAG9D,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAA;AAI3D,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3B;AAGD,QAAA,MAAM,sBAAsB;qBAuBF,cAAc,KAAG,IAAI;kBAkBxB,cAAc,CAAC,IAAI,CAAC,KAAG,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC;oBAcjD,cAAc,CAAC,KAAK,CAAC,KAAG,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC;;;;;CAa3E,CAAA;AAEF;;;;;;;GAOG;AACH,wBAAgB,eAAe,IAAI,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAE3E;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,GAAG,IAAI,CAE/F"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
/** @file Top-level public entry point — re-exports the client class, public utilities, and entity types. */
|
|
2
1
|
export * from './exports';
|
|
3
2
|
export type * from './client';
|
|
4
3
|
export type * from './entities/action/action';
|
|
5
4
|
export type * from './entities/condition/condition';
|
|
6
|
-
export type * from './entities/content/content';
|
|
7
5
|
export type * from './entities/component/component';
|
|
8
6
|
export type * from './entities/component/lazyComponent';
|
|
9
7
|
export type * from './entities/experience-instance/experience-instance';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,mBAAmB,UAAU,CAAA;AAC7B,mBAAmB,0BAA0B,CAAA;AAC7C,mBAAmB,gCAAgC,CAAA;AACnD,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"}
|
package/dist/types/picked.d.ts
CHANGED
|
@@ -12,41 +12,12 @@ import { Feature } from './entities/feature/feature';
|
|
|
12
12
|
import { EventBusPayload, EventHistoryStore } from './utils/events';
|
|
13
13
|
import { Field } from './entities/field/field';
|
|
14
14
|
import { ExperienceStep } from './entities/step/step';
|
|
15
|
-
import { Content } from './entities/content/content';
|
|
16
|
-
import { ContentLoader } from './plugins/dynamic-experiences/types';
|
|
17
15
|
import { Action } from './entities/action/action';
|
|
18
16
|
import { Condition } from './entities/condition/condition';
|
|
19
17
|
import { SessionEntity } from './entities/session/session';
|
|
20
|
-
/**
|
|
21
|
-
* Provenance metadata describing where the Picked client's project config and
|
|
22
|
-
* content came from. Set by `dynamicExperiencesPlugin` when the Vite plugin's
|
|
23
|
-
* virtual data module is available; remains `null` otherwise.
|
|
24
|
-
*/
|
|
25
|
-
export interface PickedDataSource {
|
|
26
|
-
/** `'build'` when build-mode prefetch JSON was used, `'dev'` when the dev-mode runtime fetch was used. */
|
|
27
|
-
mode: 'dev' | 'build';
|
|
28
|
-
/** ISO 8601 timestamp from the manifest. `null` in dev mode where no manifest is written. */
|
|
29
|
-
fetchedAt: string | null;
|
|
30
|
-
/** The `versionId` recorded by the source, when known. */
|
|
31
|
-
projectVersionId: string | null;
|
|
32
|
-
/** The `workspaceId` recorded by the source, when known. */
|
|
33
|
-
workspaceId: string | null;
|
|
34
|
-
}
|
|
35
18
|
export declare class Picked {
|
|
36
19
|
static readonly logger: (level: "log" | "warn" | "info" | "error", ...args: Parameters<Console["log"]>) => void;
|
|
37
20
|
private readonly options;
|
|
38
|
-
/**
|
|
39
|
-
* Provenance metadata for the data backing this client. Populated by
|
|
40
|
-
* `dynamicExperiencesPlugin` when the Vite plugin's virtual data module is
|
|
41
|
-
* resolvable; remains `null` when the SDK is using the runtime API path.
|
|
42
|
-
*/
|
|
43
|
-
dataSource: PickedDataSource | null;
|
|
44
|
-
/**
|
|
45
|
-
* Content fetcher selected by `dynamicExperiencesPlugin`'s resolution chain.
|
|
46
|
-
* Called by `prepareExperienceContent` between target-match and
|
|
47
|
-
* the per-experience `initialiseFx`. `undefined` when no plugin has registered one yet.
|
|
48
|
-
*/
|
|
49
|
-
contentLoader?: ContentLoader;
|
|
50
21
|
private readonly plugins;
|
|
51
22
|
readonly eventBus: EventCallable<EventBusPayload>;
|
|
52
23
|
readonly events: EventHistoryStore;
|
|
@@ -197,14 +168,6 @@ export declare class Picked {
|
|
|
197
168
|
[id: string]: ExperienceStep;
|
|
198
169
|
}>;
|
|
199
170
|
};
|
|
200
|
-
readonly contents: {
|
|
201
|
-
register: (content: Content) => void;
|
|
202
|
-
getById: (id: Content["id"]) => Store<Content | null>;
|
|
203
|
-
listStore: Store<Content[]>;
|
|
204
|
-
indexStore: StoreWritable<{
|
|
205
|
-
[id: string]: Content;
|
|
206
|
-
}>;
|
|
207
|
-
};
|
|
208
171
|
readonly actions: {
|
|
209
172
|
register: EventCallable<{
|
|
210
173
|
key: string;
|
|
@@ -250,7 +213,6 @@ export declare class Picked {
|
|
|
250
213
|
registerCondition: (condition: Condition) => void;
|
|
251
214
|
registerField: (field: Field) => void;
|
|
252
215
|
registerStep: (step: ExperienceStep) => void;
|
|
253
|
-
registerContent: (content: Content) => void;
|
|
254
216
|
registerAction: (key: string, action: Action) => void;
|
|
255
217
|
registerExperience: (experience: Experience) => void;
|
|
256
218
|
/**
|
|
@@ -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,CAAA;AACnD,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAEL,KAAK,SAAS,EAEf,MAAM,gCAAgC,CAAA;AAEvC,OAAO,EAA4B,KAAK,aAAa,EAAE,MAAM,4BAA4B,CAAA;AACzF,OAAO,EAA6B,KAAK,uBAAuB,EAAE,MAAM,yBAAyB,CAAA;AACjG,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC5E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAA;AAE/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA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IAAI,CAEnC;IAED,YAAY,GAAI,MAAM,cAAc,KAAG,IAAI,CAE1C;IAED,cAAc,GAAI,KAAK,MAAM,EAAE,QAAQ,MAAM,KAAG,IAAI,CAEnD;IAED,kBAAkB,GAAI,YAAY,UAAU,KAAG,IAAI,CAMlD;IAED;;;;;;;;;OASG;IAEH,oBAAoB,GAClB,cAAc,MAAM,EACpB,UAAU,uBAAuB,KAChC,OAAO,CAAC,IAAI,CAAC,CAEf;IACD;;;;;;;;;OASG;IAEH,qBAAqB,GACnB,eAAe,MAAM,EACrB,UAAU,uBAAuB,KAChC,OAAO,CAAC,IAAI,CAAC,CAEf;IAED;;;;;;;;OAQG;IAEH,kBAAkB,GAAU,cAAc,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC,CAE/D;IAED;;;;;;;;OAQG;IAEH,mBAAmB,GAAU,eAAe,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC,CAEjE;IAED,OAAO,CAAC,YAAY;IAsBpB,OAAO,CAAC,aAAa;IA8CrB,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,eAAe;IAWvB,eAAe,GAAI,YAAY,MAAM,KAAG,iBAAiB,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAE1F;CACF"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export { dynamicExperiencesPlugin, fetchExperienceContent, fetchProject } from './plugin';
|
|
1
|
+
export { dynamicExperiencesPlugin, fetchProject } from './plugin';
|
|
3
2
|
export { createClientHeaders } from '../../utils/client-headers';
|
|
4
3
|
export type * from './types';
|
|
5
4
|
//# 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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dynamic-experiences/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAChE,mBAAmB,SAAS,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Plugin } from '../../entities/plugin/plugin';
|
|
2
|
-
import { DynamicExperiencesPluginOptions,
|
|
2
|
+
import { DynamicExperiencesPluginOptions, FetchProjectOptions, ProjectConfig } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Fetches the project configuration from the Picked REST API.
|
|
5
5
|
*
|
|
@@ -16,23 +16,6 @@ import { DynamicExperiencesPluginOptions, ExperienceContentResponse, FetchProjec
|
|
|
16
16
|
* ```
|
|
17
17
|
*/
|
|
18
18
|
export declare function fetchProject(apiUrl: string, projectId: string, options?: FetchProjectOptions): Promise<ProjectConfig | null>;
|
|
19
|
-
/**
|
|
20
|
-
* Fetches per-experience content from the Picked API.
|
|
21
|
-
*
|
|
22
|
-
* Returns `null` on network failure, non-OK responses, or invalid JSON shape — preserving
|
|
23
|
-
* the failure-tolerant policy: experiences still render, layouts handle null defensively.
|
|
24
|
-
*
|
|
25
|
-
* @param {string} apiUrl - Base URL for the Picked API.
|
|
26
|
-
* @param {string} projectId - Project ID to fetch content for.
|
|
27
|
-
* @param {string} experienceId - Experience ID whose content to fetch.
|
|
28
|
-
* @param {FetchProjectOptions} [options] - Optional headers and preview token.
|
|
29
|
-
* @returns {Promise<ExperienceContentResponse | null>} Validated content response, or `null` on any failure.
|
|
30
|
-
* @example
|
|
31
|
-
* ```typescript
|
|
32
|
-
* const content = await fetchExperienceContent('https://api.picked.app', 'proj_1', 'exp_1')
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
export declare function fetchExperienceContent(apiUrl: string, projectId: string, experienceId: string, options?: FetchProjectOptions): Promise<ExperienceContentResponse | null>;
|
|
36
19
|
/**
|
|
37
20
|
* Plugin that fetches project configuration from the Picked REST API and registers
|
|
38
21
|
* features, steps, fields, and experiences with the client.
|
|
@@ -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;AAK1D,OAAO,KAAK,
|
|
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;AAK1D,OAAO,KAAK,EACV,+BAA+B,EAC/B,mBAAmB,EACnB,aAAa,EAGd,MAAM,SAAS,CAAA;AA2VhB;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,CAAC,EAAE,+BAA+B,GAAG,MAAM,CAmD1F"}
|
|
@@ -9,14 +9,8 @@ import { LogicRule, LogicValue } from '../../logic-engine';
|
|
|
9
9
|
* keys against `ProjectConfig.fields` at registration time.
|
|
10
10
|
*
|
|
11
11
|
* `fieldIds` is optional: layout-only steps (driven purely by `layoutName`) omit it.
|
|
12
|
-
*
|
|
13
|
-
* `layoutContentId` is the wire-format reference to a CMS Content record. The actual
|
|
14
|
-
* content blob is delivered by `dynamicExperiencesPlugin`'s content resolution chain
|
|
15
|
-
* (virtual data module, preview-token API fetch, or direct API fetch) and registered
|
|
16
|
-
* via `client.registerContent`. Steps' derived `layoutContentStore` resolves reactively
|
|
17
|
-
* against the registry at render time.
|
|
18
12
|
*/
|
|
19
|
-
export type ApiExperienceStep = Omit<ExperienceStep, 'fieldKeys'
|
|
13
|
+
export type ApiExperienceStep = Omit<ExperienceStep, 'fieldKeys'> & {
|
|
20
14
|
fieldIds?: string[];
|
|
21
15
|
};
|
|
22
16
|
export interface ProjectConfigFeature {
|
|
@@ -72,64 +66,9 @@ export interface ProjectConfig {
|
|
|
72
66
|
export interface DynamicExperiencesPluginOptions {
|
|
73
67
|
apiUrl?: string;
|
|
74
68
|
projectConfig?: ProjectConfig;
|
|
75
|
-
/**
|
|
76
|
-
* Customer-supplied content fetcher. When provided, supersedes both the virtual
|
|
77
|
-
* data module and the runtime API for per-experience content resolution.
|
|
78
|
-
* Customers using this override are responsible for project ↔ content version
|
|
79
|
-
* consistency. Receives the resolved experience and the current preview token
|
|
80
|
-
* (when present) so the customer can decide preview semantics themselves.
|
|
81
|
-
*/
|
|
82
|
-
getContent?: (experience: {
|
|
83
|
-
id: string;
|
|
84
|
-
key: string;
|
|
85
|
-
}, options?: {
|
|
86
|
-
previewToken?: string;
|
|
87
|
-
}) => Promise<ExperienceContentResponse | null>;
|
|
88
69
|
}
|
|
89
70
|
export interface FetchProjectOptions {
|
|
90
71
|
previewToken?: string;
|
|
91
72
|
headers?: Record<string, string>;
|
|
92
73
|
}
|
|
93
|
-
/**
|
|
94
|
-
* Wire-format content blob as returned by the Picked API content endpoint.
|
|
95
|
-
*/
|
|
96
|
-
export interface ContentBlob {
|
|
97
|
-
id: string;
|
|
98
|
-
data: Record<string, unknown>;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Wire-format response shape for `GET /api/v1/projects/:projectId/experiences/:experienceId/content`.
|
|
102
|
-
* The response is agnostic of step structure — step ↔ content mapping is encoded in the
|
|
103
|
-
* project blob via `Step.layoutContentId`.
|
|
104
|
-
*/
|
|
105
|
-
export interface ExperienceContentResponse {
|
|
106
|
-
experienceId: string;
|
|
107
|
-
versionId: string;
|
|
108
|
-
content: ContentBlob[];
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Function that resolves an experience's content blobs. Set on the Picked client by
|
|
112
|
-
* `dynamicExperiencesPlugin` (selecting from virtual module, getContent override, or API)
|
|
113
|
-
* and called by `prepareExperienceContent` between target-match and `initialiseExperience`.
|
|
114
|
-
*/
|
|
115
|
-
export type ContentLoader = (experience: {
|
|
116
|
-
id: string;
|
|
117
|
-
key: string;
|
|
118
|
-
}, options?: {
|
|
119
|
-
previewToken?: string;
|
|
120
|
-
}) => Promise<ExperienceContentResponse | null>;
|
|
121
|
-
/**
|
|
122
|
-
* Optional-fields surface of the virtual data module exposed by `@picked/vite-plugin-picked`.
|
|
123
|
-
* The shape is identical between dev (`vite serve`) and build (`vite build`) modes.
|
|
124
|
-
*/
|
|
125
|
-
export interface VirtualPickedData {
|
|
126
|
-
projectConfig: ProjectConfig;
|
|
127
|
-
experienceContent: ContentLoader;
|
|
128
|
-
manifestMetadata: {
|
|
129
|
-
mode: 'dev' | 'build';
|
|
130
|
-
fetchedAt: string | null;
|
|
131
|
-
projectVersionId: string | null;
|
|
132
|
-
workspaceId: string | null;
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
74
|
//# 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
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","s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E,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,oBAAoB,EAAE,CAAA;IAChC,yEAAyE;IACzE,WAAW,EAAE,uBAAuB,EAAE,CAAA;IACtC,yDAAyD;IACzD,KAAK,EAAE,iBAAiB,EAAE,CAAA;IAC1B,oDAAoD;IACpD,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,wEAAwE;IACxE,UAAU,EAAE,SAAS,EAAE,CAAA;IACvB,OAAO,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC1D;AAED,MAAM,WAAW,+BAA+B;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,aAAa,CAAC,EAAE,aAAa,CAAA;CAC9B;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACjC"}
|
package/package.json
CHANGED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Store } from 'effector';
|
|
2
|
-
export interface Content {
|
|
3
|
-
id: string;
|
|
4
|
-
data: Record<string, unknown>;
|
|
5
|
-
}
|
|
6
|
-
export type ContentsStore = ReturnType<typeof createContentIndex>;
|
|
7
|
-
declare const createContentIndexFactory: () => {
|
|
8
|
-
register: (content: Content) => void;
|
|
9
|
-
getById: (id: Content["id"]) => Store<Content | null>;
|
|
10
|
-
listStore: Store<Content[]>;
|
|
11
|
-
indexStore: import('effector').StoreWritable<{
|
|
12
|
-
[id: string]: Content;
|
|
13
|
-
}>;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Creates an Effector-based index for registering and retrieving content records.
|
|
17
|
-
*
|
|
18
|
-
* @returns {ContentsStore} A content index with register, getById, and listStore.
|
|
19
|
-
* @example
|
|
20
|
-
* ```typescript
|
|
21
|
-
* const contents = createContentIndex()
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
export declare function createContentIndex(): ReturnType<typeof createContentIndexFactory>;
|
|
25
|
-
/**
|
|
26
|
-
* Registers a content record with the given index via the helper function.
|
|
27
|
-
*
|
|
28
|
-
* @param content - The content record to register.
|
|
29
|
-
* @param index - The content index to register the record with.
|
|
30
|
-
* @example
|
|
31
|
-
* ```typescript
|
|
32
|
-
* setupContent(content, index)
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
export declare function setupContent(content: Content, index: ContentsStore): void;
|
|
36
|
-
export {};
|
|
37
|
-
//# sourceMappingURL=content.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../../src/entities/content/content.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,OAAO,EAA2B,KAAK,KAAK,EAAE,MAAM,UAAU,CAAA;AAK9D,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC9B;AAED,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAGjE,QAAA,MAAM,yBAAyB;wBAuBF,OAAO,KAAG,IAAI;kBAmBpB,OAAO,CAAC,IAAI,CAAC,KAAG,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC;;;;;CAU1D,CAAA;AAEF;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,IAAI,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAEjF;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,GAAG,IAAI,CAEzE"}
|