@picked/client 0.0.61 → 0.0.62-next.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -8
- package/dist/{api-CjGYS0lP.js → api-C11HFYrl.js} +1 -1
- package/dist/api-DXosW8uz.cjs +1 -0
- package/dist/cjs/form/index.js +1 -1
- package/dist/cjs/index.js +4 -4
- package/dist/cjs/plugins/create-experience/index.js +1 -1
- package/dist/cjs/plugins/dom-observer/index.js +1 -0
- package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
- package/dist/cjs/plugins/experience-browser-storage/index.js +1 -1
- package/dist/cjs/plugins/history-browser-storage/index.js +1 -1
- package/dist/cjs/plugins/responses-browser-storage/index.js +1 -1
- package/dist/cjs/plugins/single-page-app/index.js +1 -1
- package/dist/cjs/plugins/web-components/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/docs/actions.mdx +0 -1
- package/dist/docs/api/authentication.md +376 -0
- package/dist/docs/api/authorization-and-scopes.md +262 -0
- package/dist/docs/api/error-handling.md +211 -0
- package/dist/docs/api/index.md +172 -11
- package/dist/docs/api/pagination.md +176 -0
- package/dist/docs/image-optimisation-service.md +72 -0
- package/dist/docs/index.md +0 -2
- package/dist/docs/pickedql/data-sources.md +2 -2
- package/dist/docs/pickedql/dimensions.md +2 -0
- package/dist/docs/pickedql/schema.md +2 -2
- package/dist/docs/pickedql/virtual-functions.md +27 -0
- package/dist/docs/sdk/actions.md +0 -1
- package/dist/docs/sdk/content-security-policy.md +8 -7
- package/dist/docs/sdk/features.md +0 -1
- package/dist/docs/sdk/fields.md +2 -2
- package/dist/docs/sdk/index.md +0 -1
- package/dist/docs/sdk/plugins/create-experience.md +0 -1
- package/dist/docs/sdk/plugins/dynamic-experiences.md +2 -3
- package/dist/docs/sdk/plugins/window-object.md +0 -1
- package/dist/docs/sdk/predicates.md +0 -1
- package/dist/docs/workspaces.mdx +60 -1
- package/dist/dom-C3C6Fmwz.cjs +1 -0
- package/dist/dom-DGePXPpM.js +84 -0
- package/dist/esm/form/index.js +41 -34
- package/dist/esm/index.js +1020 -494
- package/dist/esm/plugins/create-experience/index.js +1 -1
- package/dist/esm/plugins/dom-observer/index.js +87 -0
- package/dist/esm/plugins/dynamic-experiences/index.js +133 -60
- package/dist/esm/plugins/experience-browser-storage/index.js +9 -6
- package/dist/esm/plugins/history-browser-storage/index.js +1 -1
- package/dist/esm/plugins/responses-browser-storage/index.js +1 -1
- package/dist/esm/plugins/single-page-app/index.js +1 -1
- package/dist/esm/plugins/web-components/index.js +1 -1
- package/dist/esm/server/index.js +23 -13
- package/dist/experience-instance-DImym3m_.js +419 -0
- package/dist/experience-instance-DygAdzbn.cjs +1 -0
- package/dist/rules-logic-D_CVBuv7.js +13 -0
- package/dist/rules-logic-H6P8xwHF.cjs +1 -0
- package/dist/types/client.d.ts +2 -2
- package/dist/types/entities/action/action.d.ts +6 -3
- package/dist/types/entities/action/action.d.ts.map +1 -1
- package/dist/types/entities/component/component.d.ts +39 -2
- package/dist/types/entities/component/component.d.ts.map +1 -1
- package/dist/types/entities/content/content.d.ts +37 -0
- package/dist/types/entities/content/content.d.ts.map +1 -0
- package/dist/types/entities/experience/experience.d.ts +69 -113
- package/dist/types/entities/experience/experience.d.ts.map +1 -1
- package/dist/types/entities/experience-instance/experience-instance.d.ts +17 -2
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/feature/feature.d.ts +26 -2
- package/dist/types/entities/feature/feature.d.ts.map +1 -1
- package/dist/types/entities/field/field.d.ts.map +1 -1
- package/dist/types/entities/framework/framework.d.ts +24 -3
- package/dist/types/entities/framework/framework.d.ts.map +1 -1
- package/dist/types/entities/plugin/plugin.d.ts +32 -1
- package/dist/types/entities/plugin/plugin.d.ts.map +1 -1
- package/dist/types/entities/predicate/predicate.d.ts +24 -3
- package/dist/types/entities/predicate/predicate.d.ts.map +1 -1
- package/dist/types/entities/session/session.d.ts +45 -0
- package/dist/types/entities/session/session.d.ts.map +1 -0
- package/dist/types/entities/step/step.d.ts +17 -2
- package/dist/types/entities/step/step.d.ts.map +1 -1
- package/dist/types/exports.d.ts +9 -3
- package/dist/types/exports.d.ts.map +1 -1
- package/dist/types/form/create-form.d.ts +55 -0
- package/dist/types/form/create-form.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lifecycle/lifecycle.d.ts +47 -0
- package/dist/types/lifecycle/lifecycle.d.ts.map +1 -0
- package/dist/types/lifecycle/rules-logic.d.ts +24 -0
- package/dist/types/lifecycle/rules-logic.d.ts.map +1 -0
- package/dist/types/lifecycle/state-snapshot.d.ts +37 -0
- package/dist/types/lifecycle/state-snapshot.d.ts.map +1 -0
- package/dist/types/logic-engine.d.ts +1 -1
- package/dist/types/logic-engine.d.ts.map +1 -1
- package/dist/types/picked.d.ts +141 -187
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/dom-observer/index.d.ts +3 -0
- package/dist/types/plugins/dom-observer/index.d.ts.map +1 -0
- package/dist/types/plugins/dom-observer/plugin.d.ts +50 -0
- package/dist/types/plugins/dom-observer/plugin.d.ts.map +1 -0
- package/dist/types/plugins/dynamic-experiences/index.d.ts +2 -1
- package/dist/types/plugins/dynamic-experiences/index.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts +18 -1
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/types.d.ts +63 -1
- package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -1
- package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/plugins/web-components/plugin.d.ts.map +1 -1
- package/dist/types/server/index.d.ts +7 -0
- package/dist/types/server/index.d.ts.map +1 -1
- package/dist/types/utils/events.d.ts +1 -1
- package/dist/types/utils/events.d.ts.map +1 -1
- package/dist/types/utils/picked-config.d.ts +12 -4
- package/dist/types/utils/picked-config.d.ts.map +1 -1
- package/dist/types/utils/rules-logic.d.ts +4 -9
- package/dist/types/utils/rules-logic.d.ts.map +1 -1
- package/package.json +12 -2
- package/dist/api-BarClNGB.cjs +0 -1
- package/dist/docs/reference/index.md +0 -11
- package/dist/docs/tooling/index.md +0 -19
- package/dist/experience-instance-DC2gKwA6.cjs +0 -1
- package/dist/experience-instance-DJaNc5Ob.js +0 -486
- package/dist/rules-logic-BTIxfrJJ.js +0 -240
- package/dist/rules-logic-DNLOv90w.cjs +0 -1
- package/dist/types/utils/state-snaphot.d.ts +0 -26
- package/dist/types/utils/state-snaphot.d.ts.map +0 -1
- package/dist/types/utils/user-session.d.ts +0 -12
- package/dist/types/utils/user-session.d.ts.map +0 -1
- /package/dist/docs/{tooling/chrome-extension.md → chrome-extension.md} +0 -0
- /package/dist/docs/{tooling/gtm-template.md → gtm-template.md} +0 -0
- /package/dist/docs/{tooling/mcp.md → mcp.md} +0 -0
- /package/dist/docs/{tooling/vite-plugin.md → vite-plugin.md} +0 -0
- /package/dist/{id-Bv44ilEo.cjs → id-Cg7fVl1O.cjs} +0 -0
- /package/dist/{id-CRqy981z.js → id-n2yrHvNo.js} +0 -0
- /package/dist/{object-C82v79xc.js → object-DvUDOytC.js} +0 -0
- /package/dist/{object-CUJOjanb.cjs → object-ThO1DEyl.cjs} +0 -0
- /package/dist/{storage-B6lQtc4-.cjs → storage-BXSlLTRa.cjs} +0 -0
- /package/dist/{storage-6Xk0uAxB.js → storage-hOHCCXvP.js} +0 -0
|
@@ -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
|
-
|
|
9
|
-
|
|
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
|
|
16
|
+
decisionLogic?: LogicRule | LogicValue;
|
|
19
17
|
targetSelectors: ExperienceTarget[];
|
|
20
|
-
initializeOpenLogic
|
|
18
|
+
initializeOpenLogic?: LogicRule | LogicValue;
|
|
21
19
|
}>;
|
|
22
20
|
treeStore: Store<{
|
|
23
21
|
steps: ExperienceStep[];
|
|
@@ -27,26 +25,64 @@ declare const createExperienceFactory: ({ client, experience }: {
|
|
|
27
25
|
}>;
|
|
28
26
|
componentStore: Store<{
|
|
29
27
|
name: string;
|
|
30
|
-
component: AdaptedComponent
|
|
31
|
-
frameworkStore: Store<
|
|
28
|
+
component: AdaptedComponent;
|
|
29
|
+
frameworkStore: Store<Framework | undefined>;
|
|
32
30
|
} | undefined>;
|
|
33
31
|
actions: ExperienceAction[];
|
|
34
|
-
|
|
32
|
+
/** Effector event that merges a partial experience update into this store. */
|
|
33
|
+
merge: (payload: {
|
|
35
34
|
experience: Partial<Experience>;
|
|
36
|
-
strategy:
|
|
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
|
+
/**
|
|
49
|
+
* Public event — requests initialisation, gated by `shouldInitialiseFx`. When the
|
|
50
|
+
* gate passes, the sample graph fires `prepareExperienceContentFx` and `initialiseFx`
|
|
51
|
+
* in parallel so content loading does not delay initialisation.
|
|
52
|
+
*/
|
|
53
|
+
initialiseRequested: EventCallable<LaunchExperienceOptions | undefined>;
|
|
54
|
+
/**
|
|
55
|
+
* Public event — requests initialisation directly, bypassing the `shouldInitialiseFx`
|
|
56
|
+
* gate. Fires `prepareExperienceContentFx` and `initialiseFx` in parallel.
|
|
57
|
+
*/
|
|
58
|
+
initialiseDirectly: EventCallable<LaunchExperienceOptions | undefined>;
|
|
59
|
+
/**
|
|
60
|
+
* Prepares per-experience CMS content by calling `client.contentLoader` and
|
|
61
|
+
* registering returned blobs into `client.contents`. Driven by the sample graph
|
|
62
|
+
* on `initialiseRequested`/`initialiseDirectly`; can also be called directly for
|
|
63
|
+
* speculative prefetch (e.g. Visibility-driven warm-up). Failure-tolerant:
|
|
64
|
+
* always resolves `true` even when the loader rejects, so initialisation is
|
|
65
|
+
* never blocked by content failures.
|
|
66
|
+
*/
|
|
67
|
+
prepareExperienceContentFx: Effect<void, boolean, Error>;
|
|
68
|
+
}
|
|
39
69
|
/**
|
|
40
70
|
* Creates an Effector store for a single experience.
|
|
41
71
|
*
|
|
42
|
-
* @
|
|
43
|
-
* @
|
|
72
|
+
* @template T - Factory parameter type.
|
|
73
|
+
* @param {T} params - The client instance and experience data.
|
|
74
|
+
* @param {Picked} params.client - The Picked client instance the experience is bound to.
|
|
75
|
+
* @param {Experience} params.experience - The experience definition to wrap in stores and effects.
|
|
76
|
+
* @returns {ReturnType<typeof createExperienceFactory>} An experience store with config, tree, fields, and component sub-stores.
|
|
44
77
|
* @example
|
|
45
78
|
* ```typescript
|
|
46
79
|
* const store = createExperience({ client, experience })
|
|
47
80
|
* ```
|
|
48
81
|
*/
|
|
49
|
-
export declare function createExperience
|
|
82
|
+
export declare function createExperience(params: {
|
|
83
|
+
client: Picked;
|
|
84
|
+
experience: Experience;
|
|
85
|
+
}): ExperienceStore;
|
|
50
86
|
/** Options for launching an experience. */
|
|
51
87
|
export interface LaunchExperienceOptions {
|
|
52
88
|
/** When true, the experience will be opened immediately after initialization. */
|
|
@@ -60,67 +96,15 @@ declare const createExperienceIndexFactory: ({ client }: {
|
|
|
60
96
|
client: Picked;
|
|
61
97
|
}) => {
|
|
62
98
|
/** Registers an experience in the index. If an experience with the same ID already exists, it is merged. */
|
|
63
|
-
register:
|
|
99
|
+
register: EventCallable<Experience>;
|
|
64
100
|
/** 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>;
|
|
101
|
+
get: (id: Experience["id"]) => Store<ExperienceStore | undefined>;
|
|
92
102
|
/** @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>;
|
|
103
|
+
getById: (id: Experience["id"]) => Store<ExperienceStore | undefined>;
|
|
120
104
|
/** Returns a derived store for an experience by its key. The store value is `undefined` when no match exists. */
|
|
121
105
|
getByKey: (key: Experience["key"]) => Store<ExperienceStore | undefined>;
|
|
122
106
|
/** Effector effect that launches an experience by its key. */
|
|
123
|
-
launch:
|
|
107
|
+
launch: Effect<{
|
|
124
108
|
key: string;
|
|
125
109
|
options?: LaunchExperienceOptions;
|
|
126
110
|
} | {
|
|
@@ -128,7 +112,7 @@ declare const createExperienceIndexFactory: ({ client }: {
|
|
|
128
112
|
options?: LaunchExperienceOptions;
|
|
129
113
|
}, void, Error>;
|
|
130
114
|
/** Effector effect that opens an experience's existing instances, or launches it with `initialiseOpen` if none exist. */
|
|
131
|
-
open:
|
|
115
|
+
open: Effect<{
|
|
132
116
|
key: string;
|
|
133
117
|
options?: OpenExperienceOptions;
|
|
134
118
|
} | {
|
|
@@ -136,39 +120,16 @@ declare const createExperienceIndexFactory: ({ client }: {
|
|
|
136
120
|
options?: OpenExperienceOptions;
|
|
137
121
|
}, void, Error>;
|
|
138
122
|
/** Derived store containing all registered experiences as an array. */
|
|
139
|
-
listStore: Store<
|
|
140
|
-
|
|
141
|
-
|
|
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
|
-
}[]>;
|
|
123
|
+
listStore: Store<ExperienceStore[]>;
|
|
124
|
+
/** Effector effect that conditionally initialises every registered experience. */
|
|
125
|
+
initialiseExperiencesFx: Effect<void, void, Error>;
|
|
166
126
|
};
|
|
167
127
|
/**
|
|
168
128
|
* Creates an Effector-based index for registering and retrieving experiences.
|
|
169
129
|
*
|
|
170
|
-
* @
|
|
171
|
-
* @
|
|
130
|
+
* @template T - Factory parameter type.
|
|
131
|
+
* @param {T} params - The client instance.
|
|
132
|
+
* @returns {ReturnType<typeof createExperienceIndexFactory>} An experience index with register, getById, getByKey, launch, and open methods.
|
|
172
133
|
* @example
|
|
173
134
|
* ```typescript
|
|
174
135
|
* const index = createExperienceIndex({ client })
|
|
@@ -234,22 +195,17 @@ export interface Experience {
|
|
|
234
195
|
targets: ExperienceTarget[];
|
|
235
196
|
}
|
|
236
197
|
/**
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
* @param experience - The experience store to initialise.
|
|
241
|
-
*/
|
|
242
|
-
export declare const initialiseExperience: (client: Picked, experience: ExperienceStore, options?: LaunchExperienceOptions) => void;
|
|
243
|
-
/**
|
|
244
|
-
* Conditionally initializes experiences.
|
|
198
|
+
* Conditionally initialises every registered experience by dispatching the index-level
|
|
199
|
+
* `initialiseExperiencesFx` effect, which attaches over `client.experiences.listStore`
|
|
200
|
+
* and runs each experience's per-store `shouldInitialiseFx` and `initialiseFx`.
|
|
245
201
|
*
|
|
246
|
-
* @param client - The Picked client instance.
|
|
202
|
+
* @param {Picked} client - The Picked client instance.
|
|
203
|
+
* @returns {Promise<void>} Resolves when all per-experience initialisations settle.
|
|
247
204
|
* @example
|
|
248
205
|
* ```typescript
|
|
249
206
|
* await initialiseExperiences(client)
|
|
250
207
|
* ```
|
|
251
208
|
*/
|
|
252
209
|
export declare const initialiseExperiences: (client: Picked) => Promise<void>;
|
|
253
|
-
export declare const shouldInitialiseExperience: (client: Picked, experience: ExperienceStore) => Promise<boolean>;
|
|
254
210
|
export {};
|
|
255
211
|
//# sourceMappingURL=experience.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experience.d.ts","sourceRoot":"","sources":["../../../../src/entities/experience/experience.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,OAAO,
|
|
1
|
+
{"version":3,"file":"experience.d.ts","sourceRoot":"","sources":["../../../../src/entities/experience/experience.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,OAAO,EAOL,KAAK,MAAM,EACX,KAAK,aAAa,EAElB,KA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AY,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,UAAW,SAAQ,QAAQ;IAC1C,IAAI,EAAE,QAAQ,CAAA;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,YAAY,EAAE,MAAM,CAAA;IACpB,iBAAiB,EAAE,MAAM,CAAA;IACzB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAA;CACjE;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,SAAS,CAAC,EAAE,gBAAgB,CAAA;IAC5B,cAAc,CAAC,EAAE,SAAS,GAAG,UAAU,CAAA;IACvC,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAC5B,2EAA2E;IAC3E,SAAS,CAAC,EAAE,SAAS,GAAG,UAAU,CAAA;IAClC,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,OAAO,EAAE,gBAAgB,EAAE,CAAA;CAC5B;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB,GAAU,QAAQ,MAAM,KAAG,OAAO,CAAC,IAAI,CAExE,CAAA"}
|
|
@@ -1,5 +1,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
|
-
}) =>
|
|
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,IAAI,CAAC,CAAA;IAC1B,UAAU,EAAE,aAAa,CAAC,IAAI,CAAC,CAAA;IAC/B,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,CAAA;IAC/B,SAAS,EAAE,eAAe,CAAC,WAAW,CAAC,CAAA;IACvC,gBAAgB,EAAE,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;IAC9C,gBAAgB,EAAE,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;IAC9C,iBAAiB,EAAE,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;IAC/C,2BAA2B,EAAE,KAAK,CAAC,cAAc,EAAE,CAAC,CAAA;IACpD,kBAAkB,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAA;IACnC,gBAAgB,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAA;IACjC,YAAY,EAAE,aAAa,CAAC,IAAI,CAAC,CAAA;IACjC,gBAAgB,EAAE,aAAa,CAAC,IAAI,CAAC,CAAA;IACrC,YAAY,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IACnC,iBAAiB,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC,CAAA;
|
|
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;IAC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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:
|
|
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,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IACnE,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B;AAED,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAExE,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,OAAO,GAAG;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAA;CAClC;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,OAAO,GAAG,MAAM,CAAA;IACxB,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,EAAE,EAAE,MAAM,CAAA;CACX;AAED,MAAM,WAAW,uBAAwB,SAAQ,iBAAiB;IAChE,UAAU,EAAE,KAAK,CAAA;IACjB,SAAS,EAAE,MAAM,OAAO,CAAC;QAAE,EAAE,EAAE,MA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,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 {
|
|
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: (
|
|
10
|
+
declare const createFrameworkIndexFactory: (_params: {
|
|
10
11
|
client: Picked;
|
|
11
12
|
}) => {
|
|
12
|
-
register:
|
|
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":"
|
|
1
|
+
{"version":3,"file":"framework.d.ts","sourceRoot":"","sources":["../../../../src/entities/framework/framework.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAChH,OAAO,EAAwC,KAAK,aAAa,EAAU,MAAM,UAAU,CAAA;AAG3F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAA;AACpF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C,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;AAED,QAAA,MAAM,2BAA2B,YAA2B;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;;cAkBtC,MAAM;mBAAa,SAAS;;sBA6BzC,MAAM;;CAS/B,CAAA;AAEF;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAAC,CAAC,CAAC,EAC9F,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,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
|
-
|
|
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,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GAAG,YAAY,CAAA;CAC/C;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/entities/plugin/plugin.ts"],"names":[],"mappings":"AAAA,wIAAwI;AACxI,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,UAAU,CAAA;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GAAG,YAAY,CAAA;CAC/C;AAED,MAAM,WAAW,YAAY;IAC3B,qIAAqI;IACrI,OAAO,CAAC,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAA;IACnC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,MAAM,WAAW,iBAAiB;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAA;CAC5B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAIjG;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,GAAI,QAAQ,MAAM,EAAE,QAAQ,MAAM,EAAE,SAAS,iBAAiB,KAAG,IASxF,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Store } from 'effector';
|
|
2
|
-
import { StateSnapshot } from '../../
|
|
1
|
+
import { EventCallable, Store } from 'effector';
|
|
2
|
+
import { StateSnapshot } from '../../lifecycle/state-snapshot';
|
|
3
3
|
import { Picked } from '../../picked';
|
|
4
4
|
export type Predicate = (snapshot: StateSnapshot & {
|
|
5
5
|
args: unknown[];
|
|
@@ -12,7 +12,10 @@ export interface PredicateIndexItem {
|
|
|
12
12
|
declare const createPredicateIndexFactory: ({ client }: {
|
|
13
13
|
client: Picked;
|
|
14
14
|
}) => {
|
|
15
|
-
register:
|
|
15
|
+
register: EventCallable<{
|
|
16
|
+
name: string;
|
|
17
|
+
predicate: Predicate;
|
|
18
|
+
}>;
|
|
16
19
|
getByName: (name: string) => Store<Predicate | undefined>;
|
|
17
20
|
listStore: Store<{
|
|
18
21
|
name: string;
|
|
@@ -20,7 +23,25 @@ declare const createPredicateIndexFactory: ({ client }: {
|
|
|
20
23
|
}[]>;
|
|
21
24
|
getEvokablePredicate: (predicateName: string) => Store<() => ReturnType<Predicate>>;
|
|
22
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* Creates a predicate index with stores and registration logic.
|
|
28
|
+
*
|
|
29
|
+
* @template T - Factory parameter type.
|
|
30
|
+
* @param {T} params - Factory parameters including the client.
|
|
31
|
+
* @returns {ReturnType<typeof createPredicateIndexFactory>} The predicate index.
|
|
32
|
+
* @example
|
|
33
|
+
* const predicates = createPredicateIndex({ client })
|
|
34
|
+
*/
|
|
23
35
|
export declare function createPredicateIndex<T extends Parameters<typeof createPredicateIndexFactory>[0]>(params: T): ReturnType<typeof createPredicateIndexFactory>;
|
|
36
|
+
/**
|
|
37
|
+
* Convenience helper that dispatches `predicates.register` with object-payload shape.
|
|
38
|
+
*
|
|
39
|
+
* @param {string} name - Predicate name.
|
|
40
|
+
* @param {Predicate} predicate - The predicate function.
|
|
41
|
+
* @param {PredicatesStore} predicates - The predicates index.
|
|
42
|
+
* @example
|
|
43
|
+
* setupPredicate('isAdmin', ({ user }) => user.isAdmin === true, predicatesIndex)
|
|
44
|
+
*/
|
|
24
45
|
export declare const setupPredicate: (name: string, predicate: Predicate, predicates: PredicatesStore) => void;
|
|
25
46
|
export {};
|
|
26
47
|
//# sourceMappingURL=predicate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"predicate.d.ts","sourceRoot":"","sources":["../../../../src/entities/predicate/predicate.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"predicate.d.ts","sourceRoot":"","sources":["../../../../src/entities/predicate/predicate.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,OAAO,EAML,KAAK,aAAa,EAElB,KAAK,KAAK,EACX,MAAM,UAAU,CAAA;AAGjB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C,MAAM,MAAM,SAAS,GAAG,CACtB,QAAQ,EAAE,aAAa,GAAG;IAAE,IAAI,EAAE,OAAO,EAAE,CAAA;CAAE,KAE3C,OAAO,GACP,OAAO,CAAC,OAAO,CAAC,GAChB,MAAM,GACN,OAAO,CAAC,MAAM,CAAC,GACf,MAAM,EAAE,GACR,OAAO,CAAC,MAAM,EAAE,CAAC,GACjB,SAAS,CAAA;AAEb,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAErE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,SAAS,CAAA;CACrB;AAID,QAAA,MAAM,2BAA2B,eAA8B;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;;cAwBzC,MAAM;mBAAa,SAAS;;sBAiCzC,MAAM;;cAtDrB,MAAM;mBACD,SAAS;;0CAiEqB,MAAM,KAAG,KAAK,CAAC,MAAM,UAAU,CAAC,SAAS,CAAC,CAAC;CA0CxF,CAAA;AAEF;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAAC,CAAC,CAAC,EAC9F,MAAM,EAAE,CAAC,GACR,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAEhD;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,WAAW,SAAS,EAAE,YAAY,eAAe,SAE7F,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { EventCallable, Store } from 'effector';
|
|
2
|
+
/** Plain shape of a persisted session — id, optional isUser flag, optional identifiers map. */
|
|
3
|
+
export interface Session {
|
|
4
|
+
id: string;
|
|
5
|
+
isUser?: boolean;
|
|
6
|
+
identifiers?: Record<string, string>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Session entity exposing the reactive `Session` store and mutator events. Field reads
|
|
10
|
+
* derive from the store via `.map`, which is reference-equality memoised so per-field
|
|
11
|
+
* subscribers only re-emit when their slice actually changes.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const session = createSession()
|
|
16
|
+
* session.store.map((s) => s.id).watch((id) => console.log('Session id:', id))
|
|
17
|
+
* session.setIsUser(true)
|
|
18
|
+
* session.setIdentifier({ key: 'fp_id', value: 'abc' })
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export interface SessionEntity {
|
|
22
|
+
/** Reactive store of the full session. Hydrated synchronously from localStorage when available; otherwise minted fresh in memory. */
|
|
23
|
+
store: Store<Session>;
|
|
24
|
+
/** Event — sets the isUser flag. */
|
|
25
|
+
setIsUser: EventCallable<boolean>;
|
|
26
|
+
/** Event — adds or replaces an identifier in the identifiers map. */
|
|
27
|
+
setIdentifier: EventCallable<{
|
|
28
|
+
key: string;
|
|
29
|
+
value: string;
|
|
30
|
+
}>;
|
|
31
|
+
/** Event — removes an identifier from the identifiers map. */
|
|
32
|
+
removeIdentifier: EventCallable<string>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Initialises a session entity. Always succeeds — persistence is gated internally on `supportsLocalStorage()`, so callers do not need to null-check the result.
|
|
36
|
+
*
|
|
37
|
+
* @returns {SessionEntity} A ready-to-use session entity.
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* const session = initialiseSession()
|
|
41
|
+
* console.log(session.store.getState().id)
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function initialiseSession(): SessionEntity;
|
|
45
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/entities/session/session.ts"],"names":[],"mappings":"AAAA,kMAAkM;AAClM,OAAO,EAAkC,KAAK,aAAa,EAAU,KAAK,KAAK,EAAE,MAAM,UAAU,CAAA;AAKjG,+FAA+F;AAC/F,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACrC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,aAAa;IAC5B,qIAAqI;IACrI,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;IAErB,oCAAoC;IACpC,SAAS,EAAE,aAAa,CAAC,OAAO,CAAC,CAAA;IACjC,qEAAqE;IACrE,aAAa,EAAE,aAAa,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC5D,8DAA8D;IAC9D,gBAAgB,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CACxC;AA+GD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,IAAI,aAAa,CAEjD"}
|