@picked/client 0.0.62-next.11 → 0.0.62-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/dist/api-C-Q9t21v.cjs +1 -0
  2. package/dist/{api-C6HQ65g9.js → api-Cfb-8mqu.js} +1 -1
  3. package/dist/cjs/form/index.js +1 -1
  4. package/dist/cjs/index.js +2 -2
  5. package/dist/cjs/plugins/create-experience/index.js +1 -1
  6. package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
  7. package/dist/cjs/plugins/experience-browser-storage/index.js +1 -1
  8. package/dist/cjs/plugins/history-browser-storage/index.js +1 -1
  9. package/dist/cjs/plugins/responses-browser-storage/index.js +1 -1
  10. package/dist/cjs/plugins/single-page-app/index.js +1 -1
  11. package/dist/cjs/plugins/web-components/index.js +1 -1
  12. package/dist/cjs/server/index.js +1 -1
  13. package/dist/docs/image-optimisation-service.md +6 -6
  14. package/dist/docs/sdk/content-security-policy.md +7 -8
  15. package/dist/docs/sdk/fields.md +2 -2
  16. package/dist/docs/workspaces.mdx +1 -1
  17. package/dist/esm/form/index.js +1 -1
  18. package/dist/esm/index.js +472 -1015
  19. package/dist/esm/plugins/create-experience/index.js +1 -1
  20. package/dist/esm/plugins/dynamic-experiences/index.js +60 -133
  21. package/dist/esm/plugins/experience-browser-storage/index.js +6 -9
  22. package/dist/esm/plugins/history-browser-storage/index.js +1 -1
  23. package/dist/esm/plugins/responses-browser-storage/index.js +1 -1
  24. package/dist/esm/plugins/single-page-app/index.js +1 -1
  25. package/dist/esm/plugins/web-components/index.js +1 -1
  26. package/dist/esm/server/index.js +13 -23
  27. package/dist/experience-instance-DC2gKwA6.cjs +1 -0
  28. package/dist/experience-instance-DJaNc5Ob.js +486 -0
  29. package/dist/rules-logic-BTIxfrJJ.js +240 -0
  30. package/dist/rules-logic-DNLOv90w.cjs +1 -0
  31. package/dist/types/entities/action/action.d.ts +3 -6
  32. package/dist/types/entities/action/action.d.ts.map +1 -1
  33. package/dist/types/entities/component/component.d.ts +2 -39
  34. package/dist/types/entities/component/component.d.ts.map +1 -1
  35. package/dist/types/entities/experience/experience.d.ts +113 -69
  36. package/dist/types/entities/experience/experience.d.ts.map +1 -1
  37. package/dist/types/entities/experience-instance/experience-instance.d.ts +2 -17
  38. package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
  39. package/dist/types/entities/feature/feature.d.ts +2 -26
  40. package/dist/types/entities/feature/feature.d.ts.map +1 -1
  41. package/dist/types/entities/field/field.d.ts.map +1 -1
  42. package/dist/types/entities/framework/framework.d.ts +3 -24
  43. package/dist/types/entities/framework/framework.d.ts.map +1 -1
  44. package/dist/types/entities/plugin/plugin.d.ts +1 -32
  45. package/dist/types/entities/plugin/plugin.d.ts.map +1 -1
  46. package/dist/types/entities/predicate/predicate.d.ts +3 -24
  47. package/dist/types/entities/predicate/predicate.d.ts.map +1 -1
  48. package/dist/types/entities/step/step.d.ts +2 -17
  49. package/dist/types/entities/step/step.d.ts.map +1 -1
  50. package/dist/types/exports.d.ts +4 -8
  51. package/dist/types/exports.d.ts.map +1 -1
  52. package/dist/types/index.d.ts +1 -3
  53. package/dist/types/index.d.ts.map +1 -1
  54. package/dist/types/logic-engine.d.ts +1 -1
  55. package/dist/types/logic-engine.d.ts.map +1 -1
  56. package/dist/types/picked.d.ts +186 -141
  57. package/dist/types/picked.d.ts.map +1 -1
  58. package/dist/types/plugins/dynamic-experiences/index.d.ts +1 -2
  59. package/dist/types/plugins/dynamic-experiences/index.d.ts.map +1 -1
  60. package/dist/types/plugins/dynamic-experiences/plugin.d.ts +1 -18
  61. package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
  62. package/dist/types/plugins/dynamic-experiences/types.d.ts +1 -63
  63. package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -1
  64. package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +1 -1
  65. package/dist/types/plugins/web-components/plugin.d.ts.map +1 -1
  66. package/dist/types/server/index.d.ts +0 -7
  67. package/dist/types/server/index.d.ts.map +1 -1
  68. package/dist/types/utils/events.d.ts +1 -1
  69. package/dist/types/utils/events.d.ts.map +1 -1
  70. package/dist/types/utils/rules-logic.d.ts +9 -4
  71. package/dist/types/utils/rules-logic.d.ts.map +1 -1
  72. package/dist/types/utils/state-snaphot.d.ts +26 -0
  73. package/dist/types/utils/state-snaphot.d.ts.map +1 -0
  74. package/dist/types/utils/user-session.d.ts +12 -0
  75. package/dist/types/utils/user-session.d.ts.map +1 -0
  76. package/package.json +2 -12
  77. package/dist/api-v323-Asd.cjs +0 -1
  78. package/dist/cjs/plugins/dom-observer/index.js +0 -1
  79. package/dist/dom-C3C6Fmwz.cjs +0 -1
  80. package/dist/dom-DGePXPpM.js +0 -84
  81. package/dist/esm/plugins/dom-observer/index.js +0 -87
  82. package/dist/experience-instance-DImym3m_.js +0 -419
  83. package/dist/experience-instance-DygAdzbn.cjs +0 -1
  84. package/dist/rules-logic-D_CVBuv7.js +0 -13
  85. package/dist/rules-logic-H6P8xwHF.cjs +0 -1
  86. package/dist/types/entities/content/content.d.ts +0 -37
  87. package/dist/types/entities/content/content.d.ts.map +0 -1
  88. package/dist/types/entities/session/session.d.ts +0 -45
  89. package/dist/types/entities/session/session.d.ts.map +0 -1
  90. package/dist/types/lifecycle/lifecycle.d.ts +0 -47
  91. package/dist/types/lifecycle/lifecycle.d.ts.map +0 -1
  92. package/dist/types/lifecycle/rules-logic.d.ts +0 -24
  93. package/dist/types/lifecycle/rules-logic.d.ts.map +0 -1
  94. package/dist/types/lifecycle/state-snapshot.d.ts +0 -37
  95. package/dist/types/lifecycle/state-snapshot.d.ts.map +0 -1
  96. package/dist/types/plugins/dom-observer/index.d.ts +0 -3
  97. package/dist/types/plugins/dom-observer/index.d.ts.map +0 -1
  98. package/dist/types/plugins/dom-observer/plugin.d.ts +0 -50
  99. package/dist/types/plugins/dom-observer/plugin.d.ts.map +0 -1
  100. /package/dist/{id-Cg7fVl1O.cjs → id-Bv44ilEo.cjs} +0 -0
  101. /package/dist/{id-n2yrHvNo.js → id-CRqy981z.js} +0 -0
  102. /package/dist/{object-DvUDOytC.js → object-C82v79xc.js} +0 -0
  103. /package/dist/{object-ThO1DEyl.cjs → object-CUJOjanb.cjs} +0 -0
  104. /package/dist/{storage-hOHCCXvP.js → storage-6Xk0uAxB.js} +0 -0
  105. /package/dist/{storage-BXSlLTRa.cjs → storage-B6lQtc4-.cjs} +0 -0
@@ -1,176 +1,214 @@
1
- import { Effect, EventCallable, Store, StoreWritable } from 'effector';
2
1
  import { Experience, LaunchExperienceOptions } from './entities/experience/experience';
3
2
  import { Plugin, PluginConfigIndex } from './entities/plugin/plugin';
4
3
  import { CreateClientOptions } from './client';
5
4
  import { AdaptedComponent } from './entities/component/component';
6
5
  import { Framework } from './entities/framework/framework';
7
- import { StateSnapshot } from './lifecycle/state-snapshot';
8
- import { EvaluateRuleLogicParams } from './lifecycle/rules-logic';
9
- import { LifecycleStage } from './lifecycle/lifecycle';
6
+ import { StateSnapshot } from './utils/state-snaphot';
10
7
  import { Predicate } from './entities/predicate/predicate';
11
8
  import { Feature } from './entities/feature/feature';
12
9
  import { EventBusPayload, EventHistoryStore } from './utils/events';
13
10
  import { Field } from './entities/field/field';
14
11
  import { ExperienceStep } from './entities/step/step';
15
- import { Content } from './entities/content/content';
16
- import { ContentLoader } from './plugins/dynamic-experiences/types';
17
12
  import { Action } from './entities/action/action';
18
13
  import { Condition } from './entities/condition/condition';
19
- 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
- }
14
+ import { SessionStore } from './utils/user-session';
15
+ import { LogicRule } from './logic-engine';
35
16
  export declare class Picked {
36
17
  static readonly logger: (level: "log" | "warn" | "info" | "error", ...args: Parameters<Console["log"]>) => void;
37
18
  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. Called
46
- * by each experience's `prepareExperienceContentFx` (fired in parallel with
47
- * `initialiseFx` by the per-experience sample graph). `undefined` when no plugin
48
- * has registered one yet.
49
- */
50
- contentLoader?: ContentLoader;
19
+ isReady: boolean;
51
20
  private readonly plugins;
52
- readonly eventBus: EventCallable<EventBusPayload>;
21
+ private readonly pluginStartHooks;
22
+ readonly eventBus: import('effector').EventCallable<EventBusPayload>;
53
23
  readonly events: EventHistoryStore;
54
24
  readonly projectId: string;
55
25
  readonly apiUrl: string;
56
26
  readonly dashboardUrl: string;
57
27
  readonly documentationSiteUrl: string;
58
- readonly session: SessionEntity;
28
+ readonly session?: SessionStore | null;
29
+ readonly precondition?: LogicRule | boolean;
30
+ readonly condition?: LogicRule | boolean;
31
+ preconditionPassed?: boolean;
59
32
  readonly searchParams: import('.').PickedSearchParams;
60
33
  readonly history: {
61
- push: EventCallable<{
34
+ push: import('effector').EventCallable<{
62
35
  experienceId: string;
63
36
  node: import('.').ExperienceNode;
64
37
  }>;
65
- replace: EventCallable<{
38
+ replace: import('effector').EventCallable<{
66
39
  experienceId: string;
67
40
  node: import('.').ExperienceNode;
68
41
  }>;
69
- back: EventCallable<{
42
+ back: import('effector').EventCallable<{
70
43
  experienceId?: string;
71
44
  }>;
72
- restore: EventCallable<{
45
+ restore: import('effector').EventCallable<{
73
46
  entries: import('.').HistoryEntry[];
74
47
  }>;
75
- entriesStore: Store<import('.').HistoryEntry[]>;
48
+ entriesStore: import('effector').Store<import('.').HistoryEntry[]>;
76
49
  };
77
50
  readonly components: {
78
- register: EventCallable<{
79
- name: string;
80
- component: AdaptedComponent;
81
- }>;
82
- getByName: (name: string) => Store<{
51
+ register: (name: string, component: AdaptedComponent) => void;
52
+ getByName: (name: string) => import('effector').Store<{
83
53
  name: string;
84
54
  component: AdaptedComponent;
85
55
  } | undefined>;
86
- listStore: Store<{
56
+ listStore: import('effector').Store<{
87
57
  name: string;
88
58
  component: AdaptedComponent<string, unknown>;
89
- frameworkStore: Store<Framework | undefined>;
59
+ frameworkStore: import('effector').Store<Framework | undefined>;
90
60
  }[]>;
91
61
  };
92
62
  readonly experienceInstances: {
93
63
  spawn: (experience: import('.').ExperienceStore, target: HTMLElement, options?: LaunchExperienceOptions) => void;
94
- getByExperienceKey: (key: Experience["key"]) => Store<import('.').ExperienceInstance[]>;
95
- getByExperienceId: (id: Experience["id"]) => Store<import('.').ExperienceInstance[]>;
96
- listStore: Store<import('.').ExperienceInstance[]>;
64
+ getByExperienceKey: (key: Experience["key"]) => import('effector').Store<import('.').ExperienceInstance[]>;
65
+ getByExperienceId: (id: Experience["id"]) => import('effector').Store<import('.').ExperienceInstance[]>;
66
+ listStore: import('effector').Store<import('.').ExperienceInstance[]>;
97
67
  };
98
68
  readonly experiences: {
99
- register: EventCallable<Experience>;
100
- get: (id: Experience["id"]) => Store<import('.').ExperienceStore | undefined>;
101
- getById: (id: Experience["id"]) => Store<import('.').ExperienceStore | undefined>;
102
- getByKey: (key: Experience["key"]) => Store<import('.').ExperienceStore | undefined>;
103
- launch: Effect<{
69
+ register: (experience: Experience) => void;
70
+ get: (id: Experience["id"]) => import('effector').Store<{
71
+ id: string;
72
+ key: string;
73
+ name: string;
74
+ configStore: import('effector').Store<{
75
+ name: string;
76
+ decisionLogic: import('./logic-engine').LogicValue | LogicRule;
77
+ targetSelectors: import('.').ExperienceTarget[];
78
+ initializeOpenLogic: import('./logic-engine').LogicValue | LogicRule;
79
+ }>;
80
+ treeStore: import('effector').Store<{
81
+ steps: ExperienceStep[];
82
+ nodes: import('.').ExperienceNode[];
83
+ edges: import('.').ExperienceEdge[];
84
+ conditions: Condition[];
85
+ }>;
86
+ componentStore: import('effector').Store<{
87
+ name: string;
88
+ component: AdaptedComponent<string, unknown>;
89
+ frameworkStore: import('effector').Store<Framework | undefined>;
90
+ } | undefined>;
91
+ actions: import('.').ExperienceAction[];
92
+ merge: import('effector').EventCallable<{
93
+ experience: Partial<Experience>;
94
+ strategy: "override";
95
+ }>;
96
+ } | undefined>;
97
+ getById: (id: Experience["id"]) => import('effector').Store<{
98
+ id: string;
99
+ key: string;
100
+ name: string;
101
+ configStore: import('effector').Store<{
102
+ name: string;
103
+ decisionLogic: import('./logic-engine').LogicValue | LogicRule;
104
+ targetSelectors: import('.').ExperienceTarget[];
105
+ initializeOpenLogic: import('./logic-engine').LogicValue | LogicRule;
106
+ }>;
107
+ treeStore: import('effector').Store<{
108
+ steps: ExperienceStep[];
109
+ nodes: import('.').ExperienceNode[];
110
+ edges: import('.').ExperienceEdge[];
111
+ conditions: Condition[];
112
+ }>;
113
+ componentStore: import('effector').Store<{
114
+ name: string;
115
+ component: AdaptedComponent<string, unknown>;
116
+ frameworkStore: import('effector').Store<Framework | undefined>;
117
+ } | undefined>;
118
+ actions: import('.').ExperienceAction[];
119
+ merge: import('effector').EventCallable<{
120
+ experience: Partial<Experience>;
121
+ strategy: "override";
122
+ }>;
123
+ } | undefined>;
124
+ getByKey: (key: Experience["key"]) => import('effector').Store<import('.').ExperienceStore | undefined>;
125
+ launch: import('effector').Effect<{
104
126
  key: string;
105
127
  options?: LaunchExperienceOptions;
106
128
  } | {
107
129
  id: string;
108
130
  options?: LaunchExperienceOptions;
109
131
  }, void, Error>;
110
- open: Effect<{
132
+ open: import('effector').Effect<{
111
133
  key: string;
112
134
  options?: import('./exports').OpenExperienceOptions;
113
135
  } | {
114
136
  id: string;
115
137
  options?: import('./exports').OpenExperienceOptions;
116
138
  }, void, Error>;
117
- listStore: Store<import('.').ExperienceStore[]>;
118
- initialiseExperiencesFx: Effect<void, void, Error>;
139
+ listStore: import('effector').Store<{
140
+ id: string;
141
+ key: string;
142
+ name: string;
143
+ configStore: import('effector').Store<{
144
+ name: string;
145
+ decisionLogic: import('./logic-engine').LogicValue | LogicRule;
146
+ targetSelectors: import('.').ExperienceTarget[];
147
+ initializeOpenLogic: import('./logic-engine').LogicValue | LogicRule;
148
+ }>;
149
+ treeStore: import('effector').Store<{
150
+ steps: ExperienceStep[];
151
+ nodes: import('.').ExperienceNode[];
152
+ edges: import('.').ExperienceEdge[];
153
+ conditions: Condition[];
154
+ }>;
155
+ componentStore: import('effector').Store<{
156
+ name: string;
157
+ component: AdaptedComponent<string, unknown>;
158
+ frameworkStore: import('effector').Store<Framework | undefined>;
159
+ } | undefined>;
160
+ actions: import('.').ExperienceAction[];
161
+ merge: import('effector').EventCallable<{
162
+ experience: Partial<Experience>;
163
+ strategy: "override";
164
+ }>;
165
+ }[]>;
119
166
  };
120
167
  readonly frameworks: {
121
- register: EventCallable<{
122
- name: string;
123
- framework: Framework;
124
- }>;
125
- getByName: (name: string) => Store<Framework | undefined>;
126
- listStore: Store<Framework[]>;
168
+ register: (name: string, framework: Framework) => void;
169
+ getByName: (name: string) => import('effector').Store<Framework | undefined>;
170
+ listStore: import('effector').Store<Framework[]>;
127
171
  };
128
172
  readonly predicates: {
129
- register: EventCallable<{
130
- name: string;
131
- predicate: Predicate;
132
- }>;
133
- getByName: (name: string) => Store<Predicate | undefined>;
134
- listStore: Store<{
173
+ register: (name: string, predicate: Predicate) => void;
174
+ getByName: (name: string) => import('effector').Store<Predicate | undefined>;
175
+ listStore: import('effector').Store<{
135
176
  name: string;
136
177
  predicate: Predicate;
137
178
  }[]>;
138
- getEvokablePredicate: (predicateName: string) => Store<() => ReturnType<Predicate>>;
179
+ getEvokablePredicate: (predicateName: string) => import('effector').Store<() => ReturnType<Predicate>>;
139
180
  };
140
181
  readonly features: {
141
- register: EventCallable<{
142
- id: string;
143
- feature: Feature;
144
- }>;
145
- getById: (id: string) => Store<import('.').FeatureBucket | undefined>;
146
- getByName: (name: string) => Store<import('.').FeatureIndexItem | undefined>;
147
- listStore: Store<import('.').FeatureBucket[]>;
148
- getEvokableFeature: (featureName: string) => Store<() => Promise<boolean | string | undefined>>;
182
+ register: (id: string, feature: Feature) => void;
183
+ getById: (id: string) => import('effector').Store<import('.').FeatureBucket | undefined>;
184
+ getByName: (name: string) => import('effector').Store<import('.').FeatureIndexItem | undefined>;
185
+ listStore: import('effector').Store<import('.').FeatureBucket[]>;
186
+ getEvokableFeature: (featureName: string) => import('effector').Store<() => Promise<boolean | string | undefined>>;
149
187
  };
150
188
  readonly conditions: {
151
189
  register: (condition: Condition) => void;
152
- getById: (id: Condition["id"]) => Store<Condition | null>;
153
- getByKey: (key: Condition["key"]) => Store<Condition | null>;
154
- listStore: Store<Condition[]>;
155
- indexStore: StoreWritable<{
190
+ getById: (id: Condition["id"]) => import('effector').Store<Condition | null>;
191
+ getByKey: (key: Condition["key"]) => import('effector').Store<Condition | null>;
192
+ listStore: import('effector').Store<Condition[]>;
193
+ indexStore: import('effector').StoreWritable<{
156
194
  [id: string]: Condition;
157
195
  }>;
158
196
  };
159
197
  readonly fields: {
160
198
  register: (field: Field) => void;
161
199
  update: (key: import('.').FieldBase["key"], updates: Partial<Field>) => void;
162
- getById: (id: import('.').FieldBase["id"]) => Store<Field | null>;
163
- getByKey: (key: import('.').FieldBase["key"]) => Store<Field | null>;
164
- listStore: Store<Field[]>;
165
- getByName: (name: import('.').FieldBase["name"]) => Store<Field | null>;
200
+ getById: (id: import('.').FieldBase["id"]) => import('effector').Store<Field | null>;
201
+ getByKey: (key: import('.').FieldBase["key"]) => import('effector').Store<Field | null>;
202
+ listStore: import('effector').Store<Field[]>;
203
+ getByName: (name: import('.').FieldBase["name"]) => import('effector').Store<Field | null>;
166
204
  };
167
205
  readonly responses: {
168
206
  register: {
169
207
  (fieldKey: Field["key"], response: import('.').Response): void;
170
208
  (payload: Record<Field["key"], import('.').Response>, response?: never): void;
171
209
  };
172
- clearAll: EventCallable<void>;
173
- clear: EventCallable<string>;
210
+ clearAll: import('effector').EventCallable<void>;
211
+ clear: import('effector').EventCallable<string>;
174
212
  commit: (responsesToCommit: import('.').CommitResponses) => Promise<{
175
213
  errors: import('.').ValidationError[];
176
214
  }>;
@@ -178,71 +216,36 @@ export declare class Picked {
178
216
  responsesToCommit: import('.').CommitResponses;
179
217
  validationErrors: import('.').ValidationError[];
180
218
  }>;
181
- listStore: Store<{
219
+ listStore: import('effector').Store<{
182
220
  fieldKey: string;
183
221
  value: import('.').FieldValue;
184
222
  }[]>;
185
- getAllStore: Store<{
223
+ getAllStore: import('effector').Store<{
186
224
  [fieldKey: string]: import('.').FieldValue;
187
225
  }>;
188
- getByFieldId: (id: Field["id"]) => Store<import('.').FieldValue>;
189
- getByFieldKey: (key: Field["key"]) => Store<import('.').FieldValue>;
190
- getByFieldName: (fieldName: Field["name"]) => Store<import('.').FieldValue>;
226
+ getByFieldId: (id: Field["id"]) => import('effector').Store<import('.').FieldValue>;
227
+ getByFieldKey: (key: Field["key"]) => import('effector').Store<import('.').FieldValue>;
228
+ getByFieldName: (fieldName: Field["name"]) => import('effector').Store<import('.').FieldValue>;
191
229
  };
192
230
  readonly steps: {
193
231
  register: (step: ExperienceStep) => void;
194
- getById: (id: ExperienceStep["id"]) => Store<ExperienceStep | null>;
195
- getByKey: (key: ExperienceStep["key"]) => Store<ExperienceStep | null>;
196
- listStore: Store<ExperienceStep[]>;
197
- indexStore: StoreWritable<{
232
+ getById: (id: ExperienceStep["id"]) => import('effector').Store<ExperienceStep | null>;
233
+ getByKey: (key: ExperienceStep["key"]) => import('effector').Store<ExperienceStep | null>;
234
+ listStore: import('effector').Store<ExperienceStep[]>;
235
+ indexStore: import('effector').StoreWritable<{
198
236
  [id: string]: ExperienceStep;
199
237
  }>;
200
238
  };
201
- readonly contents: {
202
- register: (content: Content) => void;
203
- getById: (id: Content["id"]) => Store<Content | null>;
204
- listStore: Store<Content[]>;
205
- indexStore: StoreWritable<{
206
- [id: string]: Content;
207
- }>;
208
- };
209
239
  readonly actions: {
210
- register: EventCallable<{
211
- key: string;
212
- action: Action;
213
- }>;
214
- getByKey: (key: string) => Store<Action | undefined>;
215
- listStore: Store<import('.').ActionIndexItem[]>;
240
+ register: (key: string, action: Action) => void;
241
+ getByKey: (key: string) => import('effector').Store<Action | undefined>;
242
+ listStore: import('effector').Store<import('.').ActionIndexItem[]>;
216
243
  getEvokableAction: (actionKey: string, options?: {
217
244
  experience: import('.').ExperienceInstance;
218
- }) => Store<() => ReturnType<Action>>;
245
+ }) => import('effector').Store<() => ReturnType<Action>>;
219
246
  };
220
- readonly stateSnapshotStore: Store<StateSnapshot>;
221
- readonly evaluateRuleLogicFx: Effect<EvaluateRuleLogicParams, unknown, Error>;
222
- /** Public trigger — fires the start chain. `await allSettled(client.start, { scope })` resolves once the chain has fully settled. */
223
- readonly start: EventCallable<void>;
224
- /** Reactive store of the readiness flag. */
225
- readonly readyStore: StoreWritable<boolean>;
226
- /** Reactive store of the precondition-gate result (`undefined` until `start` is fired). */
227
- readonly preconditionPassedStore: StoreWritable<boolean | undefined>;
228
- /** Reactive store of the condition-gate result (`undefined` until `start` is fired). */
229
- readonly conditionPassedStore: StoreWritable<boolean | undefined>;
230
- /** Reactive store of the current lifecycle stage. */
231
- readonly lifecycleStageStore: StoreWritable<LifecycleStage>;
232
- private readonly lifecycle;
233
- /**
234
- * Effect that interpolates a template string against the latest responses plus a caller-supplied context. Source is `responses.listStore` so renders are scope-aware and pick up the latest committed responses without `.getState()`.
235
- *
236
- * @example
237
- * ```typescript
238
- * const greeting = await client.renderStringFx({ template: 'Hi {{name}}', context: { name: 'Mae' } })
239
- * ```
240
- */
241
- readonly renderStringFx: Effect<{
242
- template: string;
243
- context?: Record<string, unknown>;
244
- }, string, Error>;
245
247
  constructor(options: CreateClientOptions);
248
+ start: () => void;
246
249
  registerFramework: (framework: Framework) => void;
247
250
  registerComponent: (name: string, component: AdaptedComponent) => void;
248
251
  registerPlugin: (plugin: Plugin) => void;
@@ -251,9 +254,9 @@ export declare class Picked {
251
254
  registerCondition: (condition: Condition) => void;
252
255
  registerField: (field: Field) => void;
253
256
  registerStep: (step: ExperienceStep) => void;
254
- registerContent: (content: Content) => void;
255
257
  registerAction: (key: string, action: Action) => void;
256
258
  registerExperience: (experience: Experience) => void;
259
+ getStateSnapshot: () => StateSnapshot;
257
260
  /**
258
261
  * Launches an experience by ID.
259
262
  *
@@ -296,11 +299,53 @@ export declare class Picked {
296
299
  * ```
297
300
  */
298
301
  openExperienceByKey: (experienceKey: string) => Promise<void>;
302
+ private runPluginStartHooks;
303
+ private evaluateGate;
299
304
  private setupPlugins;
300
305
  private setupFeatures;
301
306
  private setupPredicates;
302
307
  private setupActions;
303
308
  private setupComponents;
304
309
  getPluginConfig: (pluginName: string) => PluginConfigIndex[string] | Record<string, unknown>;
310
+ /**
311
+ * Interpolates a template string using values from the client's response store and/or a provided context.
312
+ * Supports dot-notation, modifiers, and executing functions found in the context.
313
+ *
314
+ * Sources:
315
+ * - responses.*: Loaded automatically from the client's internal response store by fieldId (e.g. {{ responses.email }}).
316
+ * - Context: Any non-responses.* key must be supplied in the context; nested dot-notation is supported.
317
+ * - Functions: If a context value is a function, it is invoked and its result is rendered.
318
+ *
319
+ * Placeholders:
320
+ * - {{ key | modifier: arg | modifier2: arg2 }} with modifiers applied left-to-right.
321
+ *
322
+ * Modifiers:
323
+ * - default: Use the argument when the value is null, undefined, NaN, or empty string; otherwise return the value as a string.
324
+ * - append: Append the argument (space-separated) when the value is non-empty.
325
+ * - prepend: Prepend the argument (space-separated) when the value is non-empty.
326
+ * - upper: Uppercase string values.
327
+ * - lower: Lowercase string values.
328
+ * - capitalize: Capitalize the first letter of string values.
329
+ * - list: Format Arrays, Maps, and Sets via Intl.ListFormat (Maps render as key: value pairs).
330
+ *
331
+ * Behavior:
332
+ * - Empty values (null, undefined, empty string, NaN) render as empty. Numeric 0 renders as "0", boolean false renders as "false", and boolean true renders as "true".
333
+ * - Objects and arrays are JSON-stringified; Maps/Sets serialize to {} unless the list modifier is used.
334
+ * - Unknown modifiers are ignored.
335
+ *
336
+ * @param template Template containing placeholders.
337
+ * @param context Optional data for interpolation. Non-responses.* keys belong here; function values are executed.
338
+ * @returns Interpolated string.
339
+ * @example
340
+ * renderString("Hello {{ name | default: 'Guest' | capitalize }}! Email: {{ responses.email | lower }}.", { name: "ALICE" })
341
+ * // => "Hello Alice! Email: alice@example.com."
342
+ * @example
343
+ * renderString("User: {{ getName | capitalize }}", { getName: () => "alice" })
344
+ * // => "User: Alice"
345
+ * @example
346
+ * renderString("Fruits: {{ fruits | list }}", { fruits: ["apple", "banana", "cherry"] })
347
+ * // => "Fruits: apple, banana, and cherry"
348
+ */
349
+ renderString: (template: string, context?: Record<string, unknown>) => string;
305
350
  }
306
351
  //# sourceMappingURL=picked.d.ts.map
@@ -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,EAA4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H,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;YAEa,mBAAmB;YAMnB,YAAY;IAc1B,OAAO,CAAC,YAAY;IA6BpB,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;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACH,YAAY,GAAI,UAAU,MAAM,EAAE,UAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,MAAM,CAY3E;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;AAkPD;;;;;;;;;;;;;;;;;;;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":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAK1D,OAAO,KAAK,EACV,+BAA+B,EAC/B,mBAAmB,EACnB,aAAa,EAGd,MAAM,SAAS,CAAA;AA4VhB;;;;;;;;;;;;;;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,CAgD1F"}
@@ -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,65 +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 each experience's `prepareExperienceContentFx`, which is fired by the
114
- * per-experience sample graph in parallel with `initialiseFx`.
115
- */
116
- export type ContentLoader = (experience: {
117
- id: string;
118
- key: string;
119
- }, options?: {
120
- previewToken?: string;
121
- }) => Promise<ExperienceContentResponse | null>;
122
- /**
123
- * Optional-fields surface of the virtual data module exposed by `@picked/vite-plugin-picked`.
124
- * The shape is identical between dev (`vite serve`) and build (`vite build`) modes.
125
- */
126
- export interface VirtualPickedData {
127
- projectConfig: ProjectConfig;
128
- experienceContent: ContentLoader;
129
- manifestMetadata: {
130
- mode: 'dev' | 'build';
131
- fetchedAt: string | null;
132
- projectVersionId: string | null;
133
- workspaceId: string | null;
134
- };
135
- }
136
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,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EAAE,CAAA;CAC5B;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,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 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/experience-browser-storage/plugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAM1D,UAAU,8BAA8B;IACtC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B;AAED,eAAO,MAAM,8BAA8B,GAAI,eAE5C,8BAAmC,KAAG,MAmDxC,CAAA"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/experience-browser-storage/plugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAM1D,UAAU,8BAA8B;IACtC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B;AAED,eAAO,MAAM,8BAA8B,GAAI,eAE5C,8BAAmC,KAAG,MA+CxC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/web-components/plugin.ts"],"names":[],"mappings":"AAAA,kJAAkJ;AAClJ,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAG1D,eAAO,MAAM,mBAAmB,QAAO,MA2BtC,CAAA"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/web-components/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAG1D,eAAO,MAAM,mBAAmB,QAAO,MA4BtC,CAAA"}