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

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 (102) hide show
  1. package/README.md +0 -8
  2. package/dist/{api-Bn4z854o.js → api-Crj5wFbR.js} +1 -1
  3. package/dist/{api-GE6C0lxp.cjs → api-NcKXNrkY.cjs} +1 -1
  4. package/dist/cjs/form/index.js +1 -1
  5. package/dist/cjs/index.js +4 -4
  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/single-page-app/index.js +1 -1
  10. package/dist/cjs/plugins/web-components/index.js +1 -1
  11. package/dist/cjs/server/index.js +1 -1
  12. package/dist/docs/actions.mdx +0 -1
  13. package/dist/docs/index.md +0 -2
  14. package/dist/docs/pickedql/dimensions.md +2 -0
  15. package/dist/docs/pickedql/virtual-functions.md +27 -0
  16. package/dist/docs/sdk/actions.md +0 -1
  17. package/dist/docs/sdk/features.md +0 -1
  18. package/dist/docs/sdk/index.md +0 -1
  19. package/dist/docs/sdk/plugins/create-experience.md +0 -1
  20. package/dist/docs/sdk/plugins/dynamic-experiences.md +0 -1
  21. package/dist/docs/sdk/plugins/window-object.md +0 -1
  22. package/dist/docs/sdk/predicates.md +0 -1
  23. package/dist/esm/form/index.js +1 -1
  24. package/dist/esm/index.js +1011 -533
  25. package/dist/esm/plugins/dynamic-experiences/index.js +127 -60
  26. package/dist/esm/plugins/experience-browser-storage/index.js +8 -5
  27. package/dist/esm/plugins/history-browser-storage/index.js +3 -3
  28. package/dist/esm/plugins/single-page-app/index.js +1 -1
  29. package/dist/esm/plugins/web-components/index.js +1 -1
  30. package/dist/esm/server/index.js +23 -13
  31. package/dist/{experience-instance-CWYRLfFM.js → experience-instance-BrLWgVAN.js} +135 -127
  32. package/dist/experience-instance-Ct3ogC7n.cjs +1 -0
  33. package/dist/rules-logic-D_CVBuv7.js +13 -0
  34. package/dist/rules-logic-H6P8xwHF.cjs +1 -0
  35. package/dist/types/client.d.ts +2 -2
  36. package/dist/types/entities/action/action.d.ts +6 -3
  37. package/dist/types/entities/action/action.d.ts.map +1 -1
  38. package/dist/types/entities/component/component.d.ts +39 -2
  39. package/dist/types/entities/component/component.d.ts.map +1 -1
  40. package/dist/types/entities/content/content.d.ts +37 -0
  41. package/dist/types/entities/content/content.d.ts.map +1 -0
  42. package/dist/types/entities/experience/experience.d.ts +69 -112
  43. package/dist/types/entities/experience/experience.d.ts.map +1 -1
  44. package/dist/types/entities/experience-instance/experience-instance.d.ts +17 -2
  45. package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
  46. package/dist/types/entities/feature/feature.d.ts +26 -2
  47. package/dist/types/entities/feature/feature.d.ts.map +1 -1
  48. package/dist/types/entities/field/field.d.ts.map +1 -1
  49. package/dist/types/entities/framework/framework.d.ts +24 -3
  50. package/dist/types/entities/framework/framework.d.ts.map +1 -1
  51. package/dist/types/entities/history/history.d.ts +15 -27
  52. package/dist/types/entities/history/history.d.ts.map +1 -1
  53. package/dist/types/entities/plugin/plugin.d.ts +32 -1
  54. package/dist/types/entities/plugin/plugin.d.ts.map +1 -1
  55. package/dist/types/entities/predicate/predicate.d.ts +24 -3
  56. package/dist/types/entities/predicate/predicate.d.ts.map +1 -1
  57. package/dist/types/entities/session/session.d.ts +45 -0
  58. package/dist/types/entities/session/session.d.ts.map +1 -0
  59. package/dist/types/entities/step/step.d.ts +14 -0
  60. package/dist/types/entities/step/step.d.ts.map +1 -1
  61. package/dist/types/exports.d.ts +9 -3
  62. package/dist/types/exports.d.ts.map +1 -1
  63. package/dist/types/index.d.ts +3 -1
  64. package/dist/types/index.d.ts.map +1 -1
  65. package/dist/types/lifecycle/lifecycle.d.ts +47 -0
  66. package/dist/types/lifecycle/lifecycle.d.ts.map +1 -0
  67. package/dist/types/lifecycle/rules-logic.d.ts +24 -0
  68. package/dist/types/lifecycle/rules-logic.d.ts.map +1 -0
  69. package/dist/types/lifecycle/state-snapshot.d.ts +37 -0
  70. package/dist/types/lifecycle/state-snapshot.d.ts.map +1 -0
  71. package/dist/types/logic-engine.d.ts +1 -1
  72. package/dist/types/logic-engine.d.ts.map +1 -1
  73. package/dist/types/picked.d.ts +149 -190
  74. package/dist/types/picked.d.ts.map +1 -1
  75. package/dist/types/plugins/dynamic-experiences/index.d.ts +2 -1
  76. package/dist/types/plugins/dynamic-experiences/index.d.ts.map +1 -1
  77. package/dist/types/plugins/dynamic-experiences/plugin.d.ts +18 -1
  78. package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
  79. package/dist/types/plugins/dynamic-experiences/types.d.ts +62 -1
  80. package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -1
  81. package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +1 -1
  82. package/dist/types/plugins/history-browser-storage/plugin.d.ts +0 -14
  83. package/dist/types/plugins/history-browser-storage/plugin.d.ts.map +1 -1
  84. package/dist/types/plugins/web-components/plugin.d.ts.map +1 -1
  85. package/dist/types/server/index.d.ts +7 -0
  86. package/dist/types/server/index.d.ts.map +1 -1
  87. package/dist/types/utils/events.d.ts +1 -1
  88. package/dist/types/utils/events.d.ts.map +1 -1
  89. package/dist/types/utils/picked-config.d.ts +12 -4
  90. package/dist/types/utils/picked-config.d.ts.map +1 -1
  91. package/dist/types/utils/rules-logic.d.ts +4 -9
  92. package/dist/types/utils/rules-logic.d.ts.map +1 -1
  93. package/package.json +2 -2
  94. package/dist/experience-instance-BDTNGT8a.cjs +0 -1
  95. package/dist/rules-logic-BTIxfrJJ.js +0 -240
  96. package/dist/rules-logic-DNLOv90w.cjs +0 -1
  97. package/dist/types/utils/state-snaphot.d.ts +0 -26
  98. package/dist/types/utils/state-snaphot.d.ts.map +0 -1
  99. package/dist/types/utils/user-session.d.ts +0 -12
  100. package/dist/types/utils/user-session.d.ts.map +0 -1
  101. /package/dist/{object-C82v79xc.js → object-DvUDOytC.js} +0 -0
  102. /package/dist/{object-CUJOjanb.cjs → object-ThO1DEyl.cjs} +0 -0
@@ -0,0 +1,37 @@
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
@@ -0,0 +1 @@
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"}
@@ -1,23 +1,21 @@
1
- import { Store } from 'effector';
1
+ import { Effect, EventCallable, Store } from 'effector';
2
2
  import { AdaptedComponent } from '../component/component';
3
3
  import { Condition } from '../condition/condition';
4
4
  import { ExperienceStep } from '../step/step';
5
+ import { Framework } from '../framework/framework';
5
6
  import { Picked } from '../../picked';
6
7
  import { LogicRule, LogicValue } from '../../logic-engine';
7
8
  export type ExperiencesListStore = ReturnType<typeof createExperienceIndex>;
8
- export type ExperienceStore = ReturnType<typeof createExperience>;
9
- declare const createExperienceFactory: ({ client, experience }: {
10
- client: Picked;
11
- experience: Experience;
12
- }) => {
9
+ /** Per-experience reactive entity returned by `createExperience`. */
10
+ export interface ExperienceStore {
13
11
  id: string;
14
12
  key: string;
15
13
  name: string;
16
14
  configStore: Store<{
17
15
  name: string;
18
- decisionLogic: LogicValue | LogicRule;
16
+ decisionLogic?: LogicRule | LogicValue;
19
17
  targetSelectors: ExperienceTarget[];
20
- initializeOpenLogic: LogicValue | LogicRule;
18
+ initializeOpenLogic?: LogicRule | LogicValue;
21
19
  }>;
22
20
  treeStore: Store<{
23
21
  steps: ExperienceStep[];
@@ -27,26 +25,44 @@ declare const createExperienceFactory: ({ client, experience }: {
27
25
  }>;
28
26
  componentStore: Store<{
29
27
  name: string;
30
- component: AdaptedComponent<string, unknown>;
31
- frameworkStore: Store<import('../..').Framework | undefined>;
28
+ component: AdaptedComponent;
29
+ frameworkStore: Store<Framework | undefined>;
32
30
  } | undefined>;
33
31
  actions: ExperienceAction[];
34
- merge: import('effector').EventCallable<{
32
+ /** Effector event that merges a partial experience update into this store. */
33
+ merge: (payload: {
35
34
  experience: Partial<Experience>;
36
- strategy: "override";
37
- }>;
38
- };
35
+ strategy: 'override';
36
+ }) => void;
37
+ /**
38
+ * Per-experience initialise effect. Attaches over `configStore` and spawns one
39
+ * instance per matched DOM target.
40
+ */
41
+ initialiseFx: Effect<LaunchExperienceOptions | undefined, void, Error>;
42
+ /**
43
+ * Per-experience gate evaluation effect. Attaches over `client.preconditionPassedStore`,
44
+ * the session's `isUser` slice, and `configStore`. Returns true when the experience
45
+ * should be initialised.
46
+ */
47
+ shouldInitialiseFx: Effect<void, boolean, Error>;
48
+ }
39
49
  /**
40
50
  * Creates an Effector store for a single experience.
41
51
  *
42
- * @param params - The client instance and experience data.
43
- * @returns An experience store with config, tree, fields, and component sub-stores.
52
+ * @template T - Factory parameter type.
53
+ * @param {T} params - The client instance and experience data.
54
+ * @param {Picked} params.client - The Picked client instance the experience is bound to.
55
+ * @param {Experience} params.experience - The experience definition to wrap in stores and effects.
56
+ * @returns {ReturnType<typeof createExperienceFactory>} An experience store with config, tree, fields, and component sub-stores.
44
57
  * @example
45
58
  * ```typescript
46
59
  * const store = createExperience({ client, experience })
47
60
  * ```
48
61
  */
49
- export declare function createExperience<T extends Parameters<typeof createExperienceFactory>[0]>(params: T): ReturnType<typeof createExperienceFactory>;
62
+ export declare function createExperience(params: {
63
+ client: Picked;
64
+ experience: Experience;
65
+ }): ExperienceStore;
50
66
  /** Options for launching an experience. */
51
67
  export interface LaunchExperienceOptions {
52
68
  /** When true, the experience will be opened immediately after initialization. */
@@ -60,67 +76,15 @@ declare const createExperienceIndexFactory: ({ client }: {
60
76
  client: Picked;
61
77
  }) => {
62
78
  /** Registers an experience in the index. If an experience with the same ID already exists, it is merged. */
63
- register: (experience: Experience) => void;
79
+ register: EventCallable<Experience>;
64
80
  /** Returns a derived store for an experience by its ID. The store value is `undefined` when no match exists. */
65
- get: (id: Experience["id"]) => Store<{
66
- id: string;
67
- key: string;
68
- name: string;
69
- configStore: Store<{
70
- name: string;
71
- decisionLogic: LogicValue | LogicRule;
72
- targetSelectors: ExperienceTarget[];
73
- initializeOpenLogic: LogicValue | LogicRule;
74
- }>;
75
- treeStore: Store<{
76
- steps: ExperienceStep[];
77
- nodes: ExperienceNode[];
78
- edges: ExperienceEdge[];
79
- conditions: Condition[];
80
- }>;
81
- componentStore: Store<{
82
- name: string;
83
- component: AdaptedComponent<string, unknown>;
84
- frameworkStore: Store<import('../..').Framework | undefined>;
85
- } | undefined>;
86
- actions: ExperienceAction[];
87
- merge: import('effector').EventCallable<{
88
- experience: Partial<Experience>;
89
- strategy: "override";
90
- }>;
91
- } | undefined>;
81
+ get: (id: Experience["id"]) => Store<ExperienceStore | undefined>;
92
82
  /** @deprecated Use `experiences.get(id)` instead. */
93
- getById: (id: Experience["id"]) => Store<{
94
- id: string;
95
- key: string;
96
- name: string;
97
- configStore: Store<{
98
- name: string;
99
- decisionLogic: LogicValue | LogicRule;
100
- targetSelectors: ExperienceTarget[];
101
- initializeOpenLogic: LogicValue | LogicRule;
102
- }>;
103
- treeStore: Store<{
104
- steps: ExperienceStep[];
105
- nodes: ExperienceNode[];
106
- edges: ExperienceEdge[];
107
- conditions: Condition[];
108
- }>;
109
- componentStore: Store<{
110
- name: string;
111
- component: AdaptedComponent<string, unknown>;
112
- frameworkStore: Store<import('../..').Framework | undefined>;
113
- } | undefined>;
114
- actions: ExperienceAction[];
115
- merge: import('effector').EventCallable<{
116
- experience: Partial<Experience>;
117
- strategy: "override";
118
- }>;
119
- } | undefined>;
83
+ getById: (id: Experience["id"]) => Store<ExperienceStore | undefined>;
120
84
  /** Returns a derived store for an experience by its key. The store value is `undefined` when no match exists. */
121
85
  getByKey: (key: Experience["key"]) => Store<ExperienceStore | undefined>;
122
86
  /** Effector effect that launches an experience by its key. */
123
- launch: import('effector').Effect<{
87
+ launch: Effect<{
124
88
  key: string;
125
89
  options?: LaunchExperienceOptions;
126
90
  } | {
@@ -128,7 +92,7 @@ declare const createExperienceIndexFactory: ({ client }: {
128
92
  options?: LaunchExperienceOptions;
129
93
  }, void, Error>;
130
94
  /** Effector effect that opens an experience's existing instances, or launches it with `initialiseOpen` if none exist. */
131
- open: import('effector').Effect<{
95
+ open: Effect<{
132
96
  key: string;
133
97
  options?: OpenExperienceOptions;
134
98
  } | {
@@ -136,39 +100,16 @@ declare const createExperienceIndexFactory: ({ client }: {
136
100
  options?: OpenExperienceOptions;
137
101
  }, void, Error>;
138
102
  /** Derived store containing all registered experiences as an array. */
139
- listStore: Store<{
140
- id: string;
141
- key: string;
142
- name: string;
143
- configStore: Store<{
144
- name: string;
145
- decisionLogic: LogicValue | LogicRule;
146
- targetSelectors: ExperienceTarget[];
147
- initializeOpenLogic: LogicValue | LogicRule;
148
- }>;
149
- treeStore: Store<{
150
- steps: ExperienceStep[];
151
- nodes: ExperienceNode[];
152
- edges: ExperienceEdge[];
153
- conditions: Condition[];
154
- }>;
155
- componentStore: Store<{
156
- name: string;
157
- component: AdaptedComponent<string, unknown>;
158
- frameworkStore: Store<import('../..').Framework | undefined>;
159
- } | undefined>;
160
- actions: ExperienceAction[];
161
- merge: import('effector').EventCallable<{
162
- experience: Partial<Experience>;
163
- strategy: "override";
164
- }>;
165
- }[]>;
103
+ listStore: Store<ExperienceStore[]>;
104
+ /** Effector effect that conditionally initialises every registered experience. */
105
+ initialiseExperiencesFx: Effect<void, void, Error>;
166
106
  };
167
107
  /**
168
108
  * Creates an Effector-based index for registering and retrieving experiences.
169
109
  *
170
- * @param params - The client instance.
171
- * @returns An experience index with register, getById, getByKey, launch, and open methods.
110
+ * @template T - Factory parameter type.
111
+ * @param {T} params - The client instance.
112
+ * @returns {ReturnType<typeof createExperienceIndexFactory>} An experience index with register, getById, getByKey, launch, and open methods.
172
113
  * @example
173
114
  * ```typescript
174
115
  * const index = createExperienceIndex({ client })
@@ -234,22 +175,38 @@ export interface Experience {
234
175
  targets: ExperienceTarget[];
235
176
  }
236
177
  /**
237
- * Initializes an experience for each target that exists in the DOM.
178
+ * Conditionally initialises every registered experience by dispatching the index-level
179
+ * `initialiseExperiencesFx` effect, which attaches over `client.experiences.listStore`
180
+ * and runs each experience's per-store `shouldInitialiseFx` and `initialiseFx`.
238
181
  *
239
- * @param client - The Picked client instance.
240
- * @param experience - The experience store to initialise.
182
+ * @param {Picked} client - The Picked client instance.
183
+ * @returns {Promise<void>} Resolves when all per-experience initialisations settle.
184
+ * @example
185
+ * ```typescript
186
+ * await initialiseExperiences(client)
187
+ * ```
241
188
  */
242
- export declare const initialiseExperience: (client: Picked, experience: ExperienceStore, options?: LaunchExperienceOptions) => void;
189
+ export declare const initialiseExperiences: (client: Picked) => Promise<void>;
243
190
  /**
244
- * Conditionally initializes experiences.
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.
245
195
  *
246
- * @param client - The Picked client instance.
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".
247
205
  * @example
248
206
  * ```typescript
249
- * await initialiseExperiences(client)
207
+ * await prepareExperienceContent(client, experience)
250
208
  * ```
251
209
  */
252
- export declare const initialiseExperiences: (client: Picked) => Promise<void>;
253
- export declare const shouldInitialiseExperience: (client: Picked, experience: ExperienceStore) => Promise<boolean>;
210
+ export declare const prepareExperienceContent: (client: Picked, experience: ExperienceStore) => Promise<boolean>;
254
211
  export {};
255
212
  //# sourceMappingURL=experience.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"experience.d.ts","sourceRoot":"","sources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G;AACH,eAAO,MAAM,qBAAqB,GAAU,QAAQ,MAAM,KAAG,OAAO,CAAC,IAAI,CAExE,CAAA;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,eAAO,MAAM,wBAAwB,GACnC,QAAQ,MAAM,EACd,YAAY,eAAe,KAC1B,OAAO,CAAC,OAAO,CAYjB,CAAA"}
@@ -1,5 +1,7 @@
1
- import { EventCallable, Store } from 'effector';
1
+ import { Effect, EventCallable, Store } from 'effector';
2
2
  import { Experience, ExperienceNode, ExperienceStore, ExperienceTarget, LaunchExperienceOptions } from '../experience/experience';
3
+ import { Component } from '../component/component';
4
+ import { Framework } from '../framework/framework';
3
5
  import { ExperienceStep } from '../step/step';
4
6
  import { Picked } from '../../picked';
5
7
  import { HistoryEntry } from '../history/history';
@@ -7,9 +9,18 @@ export interface ExperienceInstance {
7
9
  id: string;
8
10
  experienceKey: Experience['key'];
9
11
  experienceId: Experience['id'];
12
+ /** Static name snapshot captured at spawn time. Use `configStore` for the latest (reactive) value. */
13
+ experienceName: string;
10
14
  configStore: ExperienceStore['configStore'];
11
15
  target: HTMLElement | undefined;
12
16
  componentStore: ExperienceStore['componentStore'];
17
+ /**
18
+ * Reactive store of the resolved `{ component, framework }` pair for this instance, derived via `combine` over the instance's `componentStore` and `client.frameworks.listStore`. Resolves to `null` when either side is missing.
19
+ */
20
+ componentAndFrameworkStore: Store<{
21
+ component: Component;
22
+ framework: Framework;
23
+ } | null>;
13
24
  stateStore: Store<'transitioning' | 'ready'>;
14
25
  isOpenStore: Store<boolean>;
15
26
  open: EventCallable<void>;
@@ -27,6 +38,10 @@ export interface ExperienceInstance {
27
38
  goToPreviousStep: EventCallable<void>;
28
39
  goToStepById: EventCallable<string>;
29
40
  stepsHistoryStore: Store<HistoryEntry[]>;
41
+ /**
42
+ * Per-instance mount effect. Attached over `componentAndFrameworkStore` so the render call always receives the current resolved component+framework pair.
43
+ */
44
+ mountFx: Effect<void, void, Error>;
30
45
  }
31
46
  export type ExperienceInstanceIndex = ReturnType<typeof createExperienceInstanceIndex>;
32
47
  export interface ExperienceInstanceTarget {
@@ -38,7 +53,7 @@ declare const createExperienceInstanceFactory: ({ client, experience, target, op
38
53
  experience: ExperienceStore;
39
54
  target?: HTMLElement;
40
55
  options?: LaunchExperienceOptions;
41
- }) => Readonly<ExperienceInstance>;
56
+ }) => ExperienceInstance;
42
57
  /**
43
58
  * Creates an experience instance with lifecycle stores and navigation logic.
44
59
  *
@@ -1 +1 @@
1
- {"version":3,"file":"experience-instance.d.ts","sourceRoot":"","sources":["../../../../src/entities/experience-instance/experience-instance.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,OAAO,EAOL,KAAK,aAAa,EAGlB,KAAK,KAAK,EACX,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAiB1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAItD,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,aAAa,EAAE,UAAU,CAAC,KAAK,CAAC,CAAA;IAChC,YAAY,EAAE,UAAU,CAAC,IAAI,CAAC,CAAA;IAC9B,WAAW,EAAE,eAAe,CAAC,aAAa,CAAC,CAAA;IAC3C,MAAM,EAAE,WAAW,GAAG,SAAS,CAAA;IAC/B,cAAc,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAA;IACjD,UAAU,EAAE,KAAK,CAAC,eAAe,GAAG,OAAO,CAAC,CAAA;IAC5C,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;IAC3B,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,CAAA;IACzB,KAAK,EAAE,aAAa,CAAC,IA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,EAAE,CAAC,GAAG,UAAU,CAAC,OAAO,+BAA+B,CAAC,CAE/D;AAED,QAAA,MAAM,oCAAoC,eAA8B;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;wBA0J1E,eAAe,UACnB,WAAW,YACT,uBAAuB;8BAmBF,UAAU,CAAC,KAAK,CAAC;4BAiBnB,UAAU,CAAC,IAAI,CAAC;;CAU/C,CAAA;AAEF;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAC3C,CAAC,SAAS,UAAU,CAAC,OAAO,oCAAoC,CAAC,CAAC,CAAC,CAAC,EACpE,MAAM,EAAE,CAAC,GAAG,UAAU,CAAC,OAAO,oCAAoC,CAAC,CAEpE"}
1
+ {"version":3,"file":"experience-instance.d.ts","sourceRoot":"","sources":["../../../../src/entities/experience-instance/experience-instance.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,OAAO,EAOL,KAAK,MAAM,EACX,KAAK,aAAa,EAGlB,KAAK,KAAK,EACX,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAiB1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAItD,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,aAAa,EAAE,UAAU,CAAC,KAAK,CAAC,CAAA;IAChC,YAAY,EAAE,UAAU,CAAC,IAAI,CAAC,CAAA;IAC9B,sGAAsG;IACtG,cAAc,EAAE,MAAM,CAAA;IACtB,WAAW,EAAE,eAAe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I,EAAE,KAAK,CAAC,CAAA;CACnC;AAED,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAAC,OAAO,6BAA6B,CAAC,CAAA;AACtF,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,WAAW,EAAE,CAAA;IACvB,SAAS,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAA;CACzC;AAED,QAAA,MAAM,+BAA+B,6CAMhC;IACD,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,eAAe,CAAA;IAC3B,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,OAAO,CAAC,EAAE,uBAAuB,CAAA;CAClC,uBA0gBF,CAAA;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,CAAC,SAAS,UAAU,CAAC,OAAO,+BAA+B,CAAC,CAAC,CAAC,CAAC,EAC/D,MAAM,EAAE,CAAC,GAAG,UAAU,CAAC,OAAO,+BAA+B,CAAC,CAE/D;AAED,QAAA,MAAM,oCAAoC,eAA8B;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;wBA4H1E,eAAe,UACnB,WAAW,YACT,uBAAuB;8BAmBF,UAAU,CAAC,KAAK,CAAC;4BAiBnB,UAAU,CAAC,IAAI,CAAC;;CAU/C,CAAA;AAEF;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAC3C,CAAC,SAAS,UAAU,CAAC,OAAO,oCAAoC,CAAC,CAAC,CAAC,CAAC,EACpE,MAAM,EAAE,CAAC,GAAG,UAAU,CAAC,OAAO,oCAAoC,CAAC,CAEpE"}
@@ -1,4 +1,4 @@
1
- import { Store } from 'effector';
1
+ import { EventCallable, Store } from 'effector';
2
2
  import { Picked } from '../../picked';
3
3
  export interface Feature {
4
4
  key: string;
@@ -42,13 +42,37 @@ export type FeatureBucket = UnresolvedFeatureBucket | ResolvedFeatureBucket;
42
42
  declare const createFeatureIndexFactory: ({ client }: {
43
43
  client: Picked;
44
44
  }) => {
45
- register: (id: string, feature: Feature) => void;
45
+ register: EventCallable<{
46
+ id: string;
47
+ feature: Feature;
48
+ }>;
46
49
  getById: (id: string) => Store<FeatureBucket | undefined>;
47
50
  getByName: (name: string) => Store<FeatureIndexItem | undefined>;
48
51
  listStore: Store<FeatureBucket[]>;
49
52
  getEvokableFeature: (featureName: string) => Store<() => Promise<boolean | string | undefined>>;
50
53
  };
54
+ /**
55
+ * Creates a feature index with lifecycle stores and registration logic.
56
+ *
57
+ * @template T - Factory parameter type.
58
+ * @param {T} params - Factory parameters including the client.
59
+ * @returns {ReturnType<typeof createFeatureIndexFactory>} The feature index with register, getById, getByName, listStore, and getEvokableFeature methods.
60
+ * @example
61
+ * ```ts
62
+ * const features = createFeatureIndex({ client })
63
+ * features.register('test-feature-1', { key: 'test', name: 'Test Feature', decide: () => true })
64
+ * ```
65
+ */
51
66
  export declare function createFeatureIndex<T extends Parameters<typeof createFeatureIndexFactory>[0]>(params: T): ReturnType<typeof createFeatureIndexFactory>;
67
+ /**
68
+ * Convenience helper that dispatches `features.register` with object-payload shape.
69
+ *
70
+ * @param {string} name - Feature id.
71
+ * @param {Feature} feature - The feature config.
72
+ * @param {FeaturesStore} features - The features index.
73
+ * @example
74
+ * setupFeature('winter-sale', { key: 'v1', name: 'Winter sale', decide: () => true }, featuresIndex)
75
+ */
52
76
  export declare const setupFeature: (name: string, feature: Feature, features: FeaturesStore) => void;
53
77
  export {};
54
78
  //# sourceMappingURL=feature.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../../../../src/entities/feature/feature.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,KAAK,EACX,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAI1C,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,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,SAAS,CAAC,OAAO,CAAC;IAC9D,IAAI,EAAE,SAAS,CAAA;IACf,QAAQ,EAAE,KAAK,CAAA;IACf,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AAED,MAAM,WAAW,oBAAqB,SAAQ,SAAS,CAAC,OAAO,CAAC;IAC9D,IAAI,EAAE,SAAS,CAAA;IACf,QAAQ,EAAE,IAAI,CAAA;IACd,YAAY,CAAC,EAAE,OAAO,EAAE,CAAA;CACzB;AAED,MAAM,MAAM,KAAK,GACb,iBAAiB,GACjB,iBAAiB,GACjB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,oBAAoB,GACpB,oBAAoB,CAAA;AAExB,QAAA,MAAM,uBAAuB;sBA6BF,KAAK,KAAG,IAAI;kBAoBhB,SAAS,CAAC,KAAK,CAAC,WAAW,OAAO,CAAC,KAAK,CAAC,KAAG,IAAI;kBAsBhD,SAAS,CAAC,IAAI,CAAC,KAAG,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC;oBAcnC,SAAS,CAAC,KAAK,CAAC,KAAG,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC;;sBAgBpC,SAAS,CAAC,MAAM,CAAC,KAAG,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC;CAiBhE,CAAA;AAEF;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,IAAI,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAE7E"}
@@ -1,20 +1,41 @@
1
- import { Picked } from '../../picked';
1
+ import { EventCallable } from 'effector';
2
2
  import { AdaptedComponent } from '../component/component';
3
3
  import { ExperienceInstance } from '../experience-instance/experience-instance';
4
+ import { Picked } from '../../picked';
4
5
  export type FrameworksStore = ReturnType<typeof createFrameworkIndex>;
5
6
  export interface Framework {
6
7
  name: string;
7
8
  render: FrameworkRender;
8
9
  }
9
- declare const createFrameworkIndexFactory: ({ client }: {
10
+ declare const createFrameworkIndexFactory: (_params: {
10
11
  client: Picked;
11
12
  }) => {
12
- register: (name: string, framework: Framework) => void;
13
+ register: EventCallable<{
14
+ name: string;
15
+ framework: Framework;
16
+ }>;
13
17
  getByName: (name: string) => import('effector').Store<Framework | undefined>;
14
18
  listStore: import('effector').Store<Framework[]>;
15
19
  };
20
+ /**
21
+ * Creates a framework index with stores and registration logic.
22
+ *
23
+ * @template T - Factory parameter type.
24
+ * @param {T} params - Factory parameters including the client.
25
+ * @returns {ReturnType<typeof createFrameworkIndexFactory>} The framework index.
26
+ * @example
27
+ * const frameworks = createFrameworkIndex({ client })
28
+ */
16
29
  export declare function createFrameworkIndex<T extends Parameters<typeof createFrameworkIndexFactory>[0]>(params: T): ReturnType<typeof createFrameworkIndexFactory>;
17
30
  export type FrameworkRender = (shadowRoot: ShadowRoot, component: AdaptedComponent, client: Picked, experience: ExperienceInstance) => void;
31
+ /**
32
+ * Convenience helper that dispatches `frameworks.register` with object-payload shape.
33
+ *
34
+ * @param {Framework} framework - The framework to register.
35
+ * @param {FrameworksStore} frameworks - The frameworks index.
36
+ * @example
37
+ * setupFramework({ name: 'react', render: renderFn }, frameworksIndex)
38
+ */
18
39
  export declare const setupFramework: (framework: Framework, frameworks: FrameworksStore) => void;
19
40
  export {};
20
41
  //# sourceMappingURL=framework.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"framework.d.ts","sourceRoot":"","sources":["../../../../src/entities/framework/framework.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAA;AAEpF,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAIrE,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,eAAe,CAAA;CACxB;AAGD,QAAA,MAAM,2BAA2B,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,MAAM,EAAE,CAAC,GACR,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAEhD;AAED,MAAM,MAAM,eAAe,GAAG,CAC5B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,gBAAgB,EAC3B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,kBAAkB,KAC3B,IAAI,CAAA;AAET;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,GAAI,WAAW,SAAS,EAAE,YAAY,eAAe,KAAG,IAElF,CAAA"}
@@ -1,37 +1,25 @@
1
1
  import { ExperienceNode } from '../experience/experience';
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 {
2
+ export interface HistoryEntry {
12
3
  id: string;
13
4
  node: ExperienceNode;
14
5
  at: number;
6
+ experienceId: string;
15
7
  }
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
- */
26
8
  export declare function createHistory(): {
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[]>;
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[];
32
22
  }>;
33
- seedInstanceFromSnapshot: import('effector').EventCallable<InstanceScope>;
34
23
  entriesStore: import('effector').Store<HistoryEntry[]>;
35
- snapshotStore: import('effector').Store<Record<string, HistoryEntry[]>>;
36
24
  };
37
25
  //# sourceMappingURL=history.d.ts.map
@@ -1 +1 @@
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;AAyJD;;;;;;;;;GASG;AACH,wBAAgB,aAAa;;;;;mBA5Gd,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC;;;;;EA8G5C"}
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,14 +1,45 @@
1
+ import { Effect } from 'effector';
1
2
  import { Picked } from '../../picked';
2
3
  export interface Plugin {
3
4
  name: string;
4
5
  setup: (client: Picked) => void | PluginConfig;
5
6
  }
6
7
  export interface PluginConfig {
7
- onStart?: () => void | Promise<void>;
8
+ /** Effector effect invoked sequentially during the start chain. Use `createPluginEffect(handler)` to wrap a plain async function. */
9
+ onStart?: Effect<void, void, Error>;
8
10
  [key: string]: unknown;
9
11
  }
10
12
  export interface PluginConfigIndex {
11
13
  [key: string]: PluginConfig;
12
14
  }
15
+ /**
16
+ * Wraps a plain async handler as an effector Effect for use as a plugin onStart hook.
17
+ *
18
+ * @param {() => void | Promise<void>} handler - The function to execute when the plugin starts. May be sync or return a Promise.
19
+ * @returns {Effect<void, void, Error>} An Effect that runs the handler.
20
+ * @example
21
+ * ```typescript
22
+ * const myPlugin: Plugin = {
23
+ * name: 'my-plugin',
24
+ * setup: () => ({
25
+ * onStart: createPluginEffect(async () => {
26
+ * await fetch('/init')
27
+ * }),
28
+ * }),
29
+ * }
30
+ * ```
31
+ */
32
+ export declare function createPluginEffect(handler: () => void | Promise<void>): Effect<void, void, Error>;
33
+ /**
34
+ * Registers a plugin with the client by calling its setup hook and merging any returned config into the plugin index.
35
+ *
36
+ * @param {Picked} client - The Picked client instance.
37
+ * @param {Plugin} plugin - The plugin to register.
38
+ * @param {PluginConfigIndex} plugins - The plugin config index to mutate.
39
+ * @example
40
+ * ```typescript
41
+ * setupPlugin(client, myPlugin, this.plugins)
42
+ * ```
43
+ */
13
44
  export declare const setupPlugin: (client: Picked, plugin: Plugin, plugins: PluginConfigIndex) => void;
14
45
  //# sourceMappingURL=plugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/entities/plugin/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C,MAAM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