@picked/client 0.0.1-dev.1778136207545 → 0.0.1-dev.1778212587319

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 (35) hide show
  1. package/dist/{api-Crj5wFbR.js → api-Cwiixs03.js} +1 -1
  2. package/dist/{api-NcKXNrkY.cjs → api-Cz_3UuGL.cjs} +1 -1
  3. package/dist/cjs/index.js +2 -2
  4. package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
  5. package/dist/cjs/plugins/history-browser-storage/index.js +1 -1
  6. package/dist/cjs/server/index.js +1 -1
  7. package/dist/esm/index.js +318 -344
  8. package/dist/esm/plugins/dynamic-experiences/index.js +38 -103
  9. package/dist/esm/plugins/history-browser-storage/index.js +26 -10
  10. package/dist/esm/server/index.js +1 -1
  11. package/dist/experience-instance-DDZR8zjM.cjs +1 -0
  12. package/dist/{experience-instance-BrLWgVAN.js → experience-instance-dwfbKgOd.js} +178 -179
  13. package/dist/types/entities/experience/experience.d.ts +2 -23
  14. package/dist/types/entities/experience/experience.d.ts.map +1 -1
  15. package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
  16. package/dist/types/entities/history/history.d.ts +28 -16
  17. package/dist/types/entities/history/history.d.ts.map +1 -1
  18. package/dist/types/entities/step/step.d.ts +0 -14
  19. package/dist/types/entities/step/step.d.ts.map +1 -1
  20. package/dist/types/index.d.ts +0 -2
  21. package/dist/types/index.d.ts.map +1 -1
  22. package/dist/types/picked.d.ts +8 -52
  23. package/dist/types/picked.d.ts.map +1 -1
  24. package/dist/types/plugins/dynamic-experiences/index.d.ts +1 -2
  25. package/dist/types/plugins/dynamic-experiences/index.d.ts.map +1 -1
  26. package/dist/types/plugins/dynamic-experiences/plugin.d.ts +1 -18
  27. package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
  28. package/dist/types/plugins/dynamic-experiences/types.d.ts +1 -62
  29. package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -1
  30. package/dist/types/plugins/history-browser-storage/plugin.d.ts +19 -0
  31. package/dist/types/plugins/history-browser-storage/plugin.d.ts.map +1 -1
  32. package/package.json +1 -1
  33. package/dist/experience-instance-Ct3ogC7n.cjs +0 -1
  34. package/dist/types/entities/content/content.d.ts +0 -37
  35. package/dist/types/entities/content/content.d.ts.map +0 -1
@@ -1,25 +1,37 @@
1
1
  import { ExperienceNode } from '../experience/experience';
2
- export interface HistoryEntry {
2
+ /** Identifies one navigation slice: the `ExperienceInstance` and the `Experience` it belongs to. */
3
+ export interface InstanceScope {
4
+ instanceId: string;
5
+ experienceId: string;
6
+ }
7
+ /** Payload carried by `push`/`replace` — an `InstanceScope` plus the node to record. */
8
+ export interface InstanceNodeIntent extends InstanceScope {
9
+ node: ExperienceNode;
10
+ }
11
+ export interface HistoryEntry extends InstanceScope {
3
12
  id: string;
4
13
  node: ExperienceNode;
5
14
  at: number;
6
- experienceId: string;
7
15
  }
16
+ /**
17
+ * Creates a fresh history instance: an Effector-backed list of navigation
18
+ * entries plus the events that drive it. Live entries are filtered per
19
+ * instance via `instanceId`; the derived `snapshotStore` groups by
20
+ * `experienceId` and is used by the storage plugin to resume across respawn.
21
+ *
22
+ * @returns {ReturnType<typeof invoke<typeof createHistoryFactory>>} The events and stores.
23
+ * @example
24
+ * const history = createHistory()
25
+ */
8
26
  export declare function createHistory(): {
9
- push: import('effector').EventCallable<{
10
- experienceId: string;
11
- node: ExperienceNode;
12
- }>;
13
- replace: import('effector').EventCallable<{
14
- experienceId: string;
15
- node: ExperienceNode;
16
- }>;
17
- back: import('effector').EventCallable<{
18
- experienceId?: string;
19
- }>;
20
- restore: import('effector').EventCallable<{
21
- entries: HistoryEntry[];
27
+ push: import('effector').EventCallable<InstanceNodeIntent>;
28
+ replace: import('effector').EventCallable<InstanceNodeIntent>;
29
+ back: import('effector').EventCallable<Pick<InstanceScope, "instanceId">>;
30
+ restoreSnapshots: import('effector').EventCallable<{
31
+ snapshots: Record<string, HistoryEntry[]>;
22
32
  }>;
23
- entriesStore: import('effector').Store<HistoryEntry[]>;
33
+ seedInstanceFromSnapshot: import('effector').EventCallable<InstanceScope>;
34
+ entriesStore: import('effector').StoreWritable<HistoryEntry[]>;
35
+ snapshotStore: import('effector').Store<Record<string, HistoryEntry[]>>;
24
36
  };
25
37
  //# sourceMappingURL=history.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../../src/entities/history/history.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAM9D,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,cAAc,CAAA;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,YAAY,EAAE,MAAM,CAAA;CACrB;AA4FD,wBAAgB,aAAa;;sBA3EsB,MAAM;cAAQ,cAAc;;;sBACzB,MAAM;cAAQ,cAAc;;;uBAC9B,MAAM;;;iBACT,YAAY,EAAE;;;EA0E9D"}
1
+ {"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../../src/entities/history/history.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAM9D,oGAAoG;AACpG,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,wFAAwF;AACxF,MAAM,WAAW,kBAAmB,SAAQ,aAAa;IACvD,IAAI,EAAE,cAAc,CAAA;CACrB;AAED,MAAM,WAAW,YAAa,SAAQ,aAAa;IACjD,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,cAAc,CAAA;IACpB,EAAE,EAAE,MAAM,CAAA;CACX;AA2ID;;;;;;;;;GASG;AACH,wBAAgB,aAAa;;;;;mBArGd,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC;;;;;EAuG5C"}
@@ -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;AAE9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAEjD,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;IAC1B;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,IAAI,CAAA;CAClD;AAGD,QAAA,MAAM,sBAAsB;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O,eAAe,CAAC,GAAG,IAAI,CAE/F"}
@@ -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,4GAA4G;AAC5G,cAAc,WAAW,CAAA;AACzB,mBAAmB,UAAU,CAAA;AAC7B,mBAAmB,0BAA0B,CAAA;AAC7C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,4BAA4B,CAAA;AAC/C,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,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"}
@@ -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;
@@ -57,21 +28,15 @@ export declare class Picked {
57
28
  readonly session: SessionEntity;
58
29
  readonly searchParams: import('.').PickedSearchParams;
59
30
  readonly history: {
60
- push: EventCallable<{
61
- experienceId: string;
62
- node: import('.').ExperienceNode;
63
- }>;
64
- replace: EventCallable<{
65
- experienceId: string;
66
- node: import('.').ExperienceNode;
31
+ push: EventCallable<import('.').InstanceNodeIntent>;
32
+ replace: EventCallable<import('.').InstanceNodeIntent>;
33
+ back: EventCallable<Pick<import('.').InstanceScope, "instanceId">>;
34
+ restoreSnapshots: EventCallable<{
35
+ snapshots: Record<string, import('.').HistoryEntry[]>;
67
36
  }>;
68
- back: EventCallable<{
69
- experienceId?: string;
70
- }>;
71
- restore: EventCallable<{
72
- entries: import('.').HistoryEntry[];
73
- }>;
74
- entriesStore: Store<import('.').HistoryEntry[]>;
37
+ seedInstanceFromSnapshot: EventCallable<import('.').InstanceScope>;
38
+ entriesStore: StoreWritable<import('.').HistoryEntry[]>;
39
+ snapshotStore: Store<Record<string, import('.').HistoryEntry[]>>;
75
40
  };
76
41
  readonly components: {
77
42
  register: EventCallable<{
@@ -197,14 +162,6 @@ export declare class Picked {
197
162
  [id: string]: ExperienceStep;
198
163
  }>;
199
164
  };
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
165
  readonly actions: {
209
166
  register: EventCallable<{
210
167
  key: string;
@@ -250,7 +207,6 @@ export declare class Picked {
250
207
  registerCondition: (condition: Condition) => void;
251
208
  registerField: (field: Field) => void;
252
209
  registerStep: (step: ExperienceStep) => void;
253
- registerContent: (content: Content) => void;
254
210
  registerAction: (key: string, action: Action) => void;
255
211
  registerExperience: (experience: Experience) => void;
256
212
  /**
@@ -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,4BAA4B,CAAA;AAIzD,OAAO,EAAsB,KAAK,eAAe,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACjG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,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E1C;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
- /** @file Public exports for the dynamic-experiences plugin (project config + per-experience content resolution). */
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,oHAAoH;AACpH,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACzF,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAChE,mBAAmB,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dynamic-experiences/index.ts"],"names":[],"mappings":"AAAA,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, ExperienceContentResponse, FetchProjectOptions, ProjectConfig } from './types';
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,EAEV,+BAA+B,EAC/B,yBAAyB,EACzB,mBAAmB,EACnB,aAAa,EAId,MAAM,SAAS,CAAA;AAsThB;;;;;;;;;;;;;;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;AAoBD;;;;;;;;;;;;;;;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,CAsC3C;AAgOD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,CAAC,EAAE,+BAA+B,GAAG,MAAM,CAoC1F"}
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' | 'layoutContentStore'> & {
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;;;;;;;;;;;;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;I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I,EAAE,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"}
@@ -1,7 +1,26 @@
1
1
  import { Plugin } from '../../entities/plugin/plugin';
2
+ export declare const STORAGE_KEY: import('../..').StorageKey;
2
3
  /** @public */
3
4
  export interface HistoryBrowserStoragePlugin {
4
5
  storage?: 'local' | 'session';
5
6
  }
7
+ /**
8
+ * Picked plugin that persists per-experience history snapshots into
9
+ * `localStorage` (default) or `sessionStorage` and restores them on the
10
+ * client `load` event. Snapshots are keyed by `experienceId`; when a fresh
11
+ * `ExperienceInstance` spawns it reads its experience's snapshot via the
12
+ * history entity's `seedInstanceFromSnapshot` event and resumes from the
13
+ * last step (trailing action/condition terminals are dropped at seed time).
14
+ *
15
+ * Reads the v1 flat-array shape transparently and migrates it in place — the
16
+ * next save will overwrite the v1 bytes with the v2 record shape, so users
17
+ * mid-flow at deploy time keep their resume position.
18
+ *
19
+ * @param {HistoryBrowserStoragePlugin} [options] - Plugin options.
20
+ * @param {'local' | 'session'} [options.storage] - Backing store.
21
+ * @returns {Plugin} A Picked client plugin.
22
+ * @example
23
+ * client.use(historyBrowserStoragePlugin({ storage: 'session' }))
24
+ */
6
25
  export declare const historyBrowserStoragePlugin: ({ storage, }?: HistoryBrowserStoragePlugin) => Plugin;
7
26
  //# sourceMappingURL=plugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/history-browser-storage/plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAM1D,cAAc;AACd,MAAM,WAAW,2BAA2B;IAC1C,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B;AAED,eAAO,MAAM,2BAA2B,GAAI,eAEzC,2BAAgC,KAAG,MA8BrC,CAAA"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/history-browser-storage/plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAI1D,eAAO,MAAM,WAAW,4BAAwC,CAAA;AA6DhE,cAAc;AACd,MAAM,WAAW,2BAA2B;IAC1C,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,2BAA2B,GAAI,eAEzC,2BAAgC,KAAG,MAsCrC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picked/client",
3
- "version": "0.0.1-dev.1778136207545",
3
+ "version": "0.0.1-dev.1778212587319",
4
4
  "dependencies": {
5
5
  "@withease/factories": "^1.0.5"
6
6
  },
@@ -1 +0,0 @@
1
- const e=require(`./rules-logic-H6P8xwHF.cjs`);require(`./logger-fbvQC40v.cjs`);const t=require(`./supports-Dsjg-82e.cjs`);let n=require(`effector`),r=require(`@withease/factories`);function i(e){return!t.d()||!t.r()?[]:Array.from(window.document.querySelectorAll(e)).filter(e=>e instanceof HTMLElement)}var a=`open`;function o(e){if(!t.l())throw Error(`Shadow DOM is not supported in this environment`);return e.attachShadow({mode:a})}function s(){return new Promise((e,n)=>{if(!t.r()){n();return}document.readyState===`loading`?document.addEventListener(`readystatechange`,()=>e(),{once:!0}):e()})}function c(e,t){let n=new MutationObserver(r=>{document.contains(e)||(n.disconnect(),t())});n.observe(document.body,{childList:!0,subtree:!0})}var l=`picked-root`,u=`picked-target`,d=`picked-root`;function f(e,t){return[...e,{selector:`${d}[experience-id="${t}"]`,placement:`replace`}].flatMap(e=>{let n=i(e.selector).filter(e=>!h(e,t)&&!g(e,t));return{...e,elements:n}})}function p(e,t,n){return e.flatMap(e=>e.elements.map(r=>v(r,e.placement,t,n)))}function m(e,t){e.classList.add(u),e.classList.add(`${u}-${t}`)}function h(e,t){return t?e.classList.contains(`${u}-${t}`):e.classList.contains(`${u}`)}function g(e,t){return t?e.classList.contains(`${l}-${t}`):e.classList.contains(l)}function _(e,t){let n=document.createElement(`div`);return n.style.display=`block`,n.classList.add(l),n.classList.add(`${l}-${e}`),n.classList.add(`${l}-${t}`),n}function v(e,t,n,r){let i,a=_(n,r);if(e instanceof Document)i=e.body.appendChild(a);else{switch(t){case`replace`:e.replaceWith(a);break;case`before`:e.before(a);break;case`after`:e.after(a);break;case`prepend`:e.prepend(a);break;case`append`:e.append(a);break}i=a}return i}function y(e){return e.type===`condition`}function b(e){return e.type===`step`}function x(e){return e.type===`experience`}function S(e){return e.type===`origin`}function C(e){return e.type===`action`}var w=(e,t,n,r,i=new Set)=>i.has(n.id)?[]:(i.add(n.id),b(n)&&!r?[n]:t.filter(e=>e.sourceNodeId===n.id).flatMap(n=>{let r=e.find(e=>e.id===n.destinationNodeId);return r?w(e,t,r,!1,i):[]})),T=(e,t,n)=>w(e,t,n,!0,new Set),E=(e,t,n,r,i=new Set)=>{if(i.has(n.id))return[-1,-1];i.add(n.id);let a=t.filter(e=>e.sourceNodeId===n.id);if(a.length===0)return[0,0];let o=1/0,s=-1/0;for(let n of a){let r=e.find(e=>e.id===n.destinationNodeId);if(!r)continue;let[a,c]=E(e,t,r,!1,new Set(i));a!==-1&&(o=Math.min(o,a+1),s=Math.max(s,c+1))}return o===1/0?[-1,-1]:[o,s]},D=(e,t,n)=>E(e,t,n,!0,new Set),O=(e,t,n,r=new Set)=>{if(r.has(n.id))return[-1,-1];if(r.add(n.id),n.type===`origin`)return[0,0];let i=t.filter(e=>e.destinationNodeId===n.id);if(i.length===0)return[-1,-1];let a=1/0,o=-1/0;for(let n of i){let i=e.find(e=>e.id===n.sourceNodeId);if(!i)continue;let[s,c]=O(e,t,i,new Set(r));s!==-1&&(a=Math.min(a,s+1),o=Math.max(o,c+1))}return a===1/0?[-1,-1]:[a,o]},k=(e,t,n)=>O(e,t,n,new Set),A=e=>e.find(e=>e.type===`origin`)||null,j=(e,t,n)=>{if(!e)return A(t);let r=n.find(t=>t.sourceNodeId===e.id);return r&&t.find(e=>e.id===r.destinationNodeId)||null};async function M(e,t,n,r){let i=e?`true`:`false`,a=r.find(e=>e.sourceHandle===i&&e.sourceNodeId===t);return n.find(e=>e.id===a?.destinationNodeId)}var N=(0,n.createDomain)(`experience-instance`),P=(0,r.createFactory)(({client:t,experience:r,target:i,options:a})=>{let s=(0,n.createEvent)(),c=(0,n.createEvent)(),l=(0,n.createEvent)(),u=(0,n.createEvent)(),d=(0,n.createEvent)(),f=(0,n.createEvent)(),p=r.componentStore,m=N.store(`transitioning`),h=t.history.entriesStore.map(e=>e.filter(e=>e.experienceId===r.id)),g=h.map(e=>e.filter(e=>b(e.node))),_=h.map(e=>e.at(-1)?.node||null),v=(0,n.combine)(t.steps.listStore,_,(e,t)=>e.find(e=>t&&b(t)&&e.id===t.stepId)||null),w=(0,n.combine)(t.steps.listStore,g,(e,t)=>{let n=t.at(-2);if(!n||!b(n.node))return null;let r=n.node;return e.find(e=>e.id===r.stepId)||null}),E=(0,n.combine)(r.treeStore,_,({nodes:e,edges:t},n)=>n?T(e,t,n):[]),O=(0,n.combine)(r.treeStore,_,({nodes:e,edges:t},n)=>n?k(e,t,n):[-1,-1]),P=(0,n.combine)(r.treeStore,_,({nodes:e,edges:t},n)=>n?D(e,t,n):[-1,-1]),F=N.store(!1),I=(0,n.createApi)(F,{open:()=>!0,close:()=>!1,toggle:e=>!e,set:(e,t)=>t}),L=(0,n.createEffect)(async()=>{t.history.back({experienceId:r.id})}),R=(0,n.attach)({source:r.treeStore,effect:async(e,n)=>{let i=e.nodes.find(e=>b(e)&&e.stepId===n);i&&t.history.push({experienceId:r.id,node:i})}}),z=(0,n.attach)({source:_,effect:e=>{}}),B=(0,n.attach)({source:r.treeStore,effect:async({nodes:e})=>A(e)}),V=(0,n.attach)({source:r.treeStore,effect:async({nodes:e,edges:t},n)=>{if(S(n))return j(n,e,t)}}),H=(0,n.attach)({source:r.treeStore,effect:async({nodes:n,edges:r,conditions:i},a)=>{if(!y(a))return;let o=i.find(e=>e.id===a.conditionId)?.logic;return o?M(!!await e.t(t,o),a.id,n,r):void 0}}),U=(0,n.attach)({source:{tree:r.treeStore,actions:t.actions.listStore,snapshot:t.stateSnapshotStore},effect:async({tree:e,actions:t,snapshot:n},r)=>{let{nodes:i,edges:a}=e;if(!C(r))return;let o=r.actionKey;if(!o){`${r.id}`;return}let s=t.find(e=>e.key===o)?.action;if(!s){`${o}`;let e=a.find(e=>e.sourceNodeId===r.id&&e.sourceHandle===`false`);return e?i.find(t=>t.id===e.destinationNodeId):null}if(typeof s!=`function`){`${o}`;let e=a.find(e=>e.sourceNodeId===r.id&&e.sourceHandle===`false`);return e?i.find(t=>t.id===e.destinationNodeId):null}try{`${o}`,await s({...n,args:[]},{experience:X});let e=a.find(e=>e.sourceNodeId===r.id&&e.sourceHandle===`true`);if(!e)return`${r.id}`,null;let t=i.find(t=>t.id===e.destinationNodeId);return`${o}${t?.id}`,t||null}catch{`${o}`;let e=a.find(e=>e.sourceNodeId===r.id&&e.sourceHandle===`false`);if(!e)return`${r.id}`,null;let t=i.find(t=>t.id===e.destinationNodeId);return`${o}${t?.id}`,t||null}}}),W=(0,n.createEffect)(e=>{x(e)&&t.experiences.launch({key:e.experienceKey})}),G=(0,n.attach)({source:[_,r.treeStore],effect:async([e,{nodes:t,edges:n}])=>j(e,t,n)}),K=(0,n.attach)({source:[_,r.treeStore],effect:async([e,{nodes:t,edges:n}])=>j(e,t,n)}),q=(0,n.createEffect)(e=>{t.history.push({experienceId:r.id,node:e})}),J=(0,n.attach)({source:r.configStore,effect:async({initializeOpenLogic:n})=>a?.initialiseOpen===void 0?e.n(n)?!!await e.t(t,n):n??!1:a.initialiseOpen}),Y=(0,n.combine)(p,t.frameworks.listStore,(e,t)=>{if(!e)return null;let n=t.find(t=>t.name===e.component.frameworkName);return n?{component:e,framework:n}:null},{skipVoid:!1}),X,Z=(0,n.attach)({source:Y,effect:e=>{if(!e)return;if(!i){`${r.id}`;return}let n=o(i);try{e.framework.render(n,e.component.component,t,X)}catch{}}});X=Object.freeze({id:Math.random().toString(36).substring(7),experienceKey:r.key,experienceId:r.id,experienceName:r.name,configStore:r.configStore,target:i,componentStore:p,componentAndFrameworkStore:Y,stateStore:m,isOpenStore:F,open:I.open,close:I.close,toggleOpen:I.toggle,setOpen:I.set,treeStore:r.treeStore,currentNodeStore:_,currentStepStore:v,previousStepStore:w,nextReachableStepNodesStore:E,stepsToOriginStore:O,stepsToLeafStore:P,goToNextStep:c,goToPreviousStep:l,goToStepById:u,stepsHistoryStore:g,mountFx:Z});let Q=(0,n.createEvent)(),$=(0,n.createEvent)();return(0,n.sample)({clock:_,target:Q}),(0,n.sample)({clock:Q,filter:e=>e===null,target:B}),(0,n.sample)({clock:Q,filter:e=>e!==null,target:$}),(0,n.split)({source:$,match:e=>y(e)?`condition`:b(e)?`step`:x(e)?`launchExperience`:S(e)?`origin`:C(e)?`action`:`other`,cases:{origin:V,condition:H,step:z,launchExperience:W,action:U,__:(0,n.createEvent)()}}),(0,n.sample)({clock:[H.doneData,V.doneData,B.doneData,K.doneData,G.doneData,U.doneData],filter:Boolean,target:q}),(0,n.sample)({clock:c,target:K}),(0,n.sample)({clock:c,source:v,filter:Boolean,target:t.eventBus.prepend(e=>({type:`step_submit`,step:e,experience:X}))}),(0,n.sample)({clock:K.done,source:v,filter:Boolean,target:t.eventBus.prepend(e=>({type:`step_submit_success`,step:e,experience:X}))}),(0,n.sample)({clock:K.fail,source:v,filter:Boolean,target:t.eventBus.prepend(e=>({type:`step_submit_error`,step:e,experience:X}))}),(0,n.sample)({clock:l,target:L}),(0,n.sample)({clock:u,target:R}),(0,n.sample)({source:(0,n.combine)([H.pending,V.pending,B.pending,K.pending]),fn:e=>e.some(Boolean)?`transitioning`:`ready`,target:m}),(0,n.sample)({clock:z.doneData,source:v,filter:Boolean,target:t.eventBus.prepend(e=>({type:`step_enter`,step:e,experience:X}))}),(0,n.sample)({clock:f,target:J}),(0,n.sample)({source:J.doneData,fn:Boolean,target:F}),(0,n.sample)({source:_,clock:s,filter:e=>e?S(e):!0,target:G}),(0,n.sample)({source:F,filter:Boolean,target:s}),(0,n.sample)({source:F,filter:Boolean,target:t.eventBus.prepend(()=>({type:`experience_open`,experience:X}))}),(0,n.sample)({source:F,filter:e=>!e,target:t.eventBus.prepend(()=>({type:`experience_close`,experience:X}))}),(0,n.sample)({clock:d,target:[f]}),d(),X});function F(e){return(0,r.invoke)(P,e)}var I=(0,r.createFactory)(({client:e})=>{let t=N.store({}),r=(0,n.createEvent)(),i=(0,n.createEvent)(),a=(0,n.createEvent)(),o=(0,n.createApi)(t,{register(e,t){let n=[...e[t.experienceId]??[]];return n.push(t),{...e,[t.experienceId]:n}},unregister(e,t){let n=t.experienceId,r=e[n]?.filter(e=>e!==t);return{...e,[n]:r??[]}}}),s=(0,n.createEffect)(({experience:t,target:n,options:r})=>F({client:e,experience:t,target:n,options:r})),l=(0,n.createEffect)(e=>{o.register(e)}),u=(0,n.createEffect)(e=>{e.target&&c(e.target,()=>{a(e)})}),d=(0,n.createEffect)(e=>{o.unregister(e)}),f=(0,n.createEffect)(async e=>{await e.mountFx()});(0,n.sample)({clock:r,target:s}),(0,n.sample)({clock:a,target:d}),(0,n.sample)({clock:s.doneData,target:[l,u,i]}),(0,n.sample)({clock:s.doneData,target:e.eventBus.prepend(e=>({type:`experience_initialize`,experience:e}))}),(0,n.sample)({clock:i,target:f});function p(e,t,n){r({experience:e,target:t,options:n})}let m=t.map(e=>Object.values(e).flat());function h(e){return m.map(t=>t.filter(t=>t.experienceKey===e),{skipVoid:!1})}function g(e){return t.map(t=>t[e]||[],{skipVoid:!1})}return{spawn:p,getByExperienceKey:h,getByExperienceId:g,listStore:m}});function L(e){return(0,r.invoke)(I,e)}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return F}});
@@ -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"}