@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.
- package/README.md +0 -8
- package/dist/{api-Bn4z854o.js → api-Crj5wFbR.js} +1 -1
- package/dist/{api-GE6C0lxp.cjs → api-NcKXNrkY.cjs} +1 -1
- package/dist/cjs/form/index.js +1 -1
- package/dist/cjs/index.js +4 -4
- 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/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/index.md +0 -2
- package/dist/docs/pickedql/dimensions.md +2 -0
- package/dist/docs/pickedql/virtual-functions.md +27 -0
- package/dist/docs/sdk/actions.md +0 -1
- package/dist/docs/sdk/features.md +0 -1
- 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 +0 -1
- package/dist/docs/sdk/plugins/window-object.md +0 -1
- package/dist/docs/sdk/predicates.md +0 -1
- package/dist/esm/form/index.js +1 -1
- package/dist/esm/index.js +1011 -533
- package/dist/esm/plugins/dynamic-experiences/index.js +127 -60
- package/dist/esm/plugins/experience-browser-storage/index.js +8 -5
- package/dist/esm/plugins/history-browser-storage/index.js +3 -3
- 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-CWYRLfFM.js → experience-instance-BrLWgVAN.js} +135 -127
- package/dist/experience-instance-Ct3ogC7n.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 -112
- 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/history/history.d.ts +15 -27
- package/dist/types/entities/history/history.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 +14 -0
- 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/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 +149 -190
- package/dist/types/picked.d.ts.map +1 -1
- 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 +62 -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/history-browser-storage/plugin.d.ts +0 -14
- package/dist/types/plugins/history-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 +2 -2
- package/dist/experience-instance-BDTNGT8a.cjs +0 -1
- 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/{object-C82v79xc.js → object-DvUDOytC.js} +0 -0
- /package/dist/{object-CUJOjanb.cjs → object-ThO1DEyl.cjs} +0 -0
package/dist/types/picked.d.ts
CHANGED
|
@@ -1,209 +1,175 @@
|
|
|
1
|
+
import { Effect, EventCallable, Store, StoreWritable } from 'effector';
|
|
1
2
|
import { Experience, LaunchExperienceOptions } from './entities/experience/experience';
|
|
2
3
|
import { Plugin, PluginConfigIndex } from './entities/plugin/plugin';
|
|
3
4
|
import { CreateClientOptions } from './client';
|
|
4
5
|
import { AdaptedComponent } from './entities/component/component';
|
|
5
6
|
import { Framework } from './entities/framework/framework';
|
|
6
|
-
import { StateSnapshot } from './
|
|
7
|
+
import { StateSnapshot } from './lifecycle/state-snapshot';
|
|
8
|
+
import { EvaluateRuleLogicParams } from './lifecycle/rules-logic';
|
|
9
|
+
import { LifecycleStage } from './lifecycle/lifecycle';
|
|
7
10
|
import { Predicate } from './entities/predicate/predicate';
|
|
8
11
|
import { Feature } from './entities/feature/feature';
|
|
9
12
|
import { EventBusPayload, EventHistoryStore } from './utils/events';
|
|
10
13
|
import { Field } from './entities/field/field';
|
|
11
14
|
import { ExperienceStep } from './entities/step/step';
|
|
15
|
+
import { Content } from './entities/content/content';
|
|
16
|
+
import { ContentLoader } from './plugins/dynamic-experiences/types';
|
|
12
17
|
import { Action } from './entities/action/action';
|
|
13
18
|
import { Condition } from './entities/condition/condition';
|
|
14
|
-
import {
|
|
15
|
-
|
|
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
|
+
}
|
|
16
35
|
export declare class Picked {
|
|
17
36
|
static readonly logger: (level: "log" | "warn" | "info" | "error", ...args: Parameters<Console["log"]>) => void;
|
|
18
37
|
private readonly options;
|
|
19
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Provenance metadata for the data backing this client. Populated by
|
|
40
|
+
* `dynamicExperiencesPlugin` when the Vite plugin's virtual data module is
|
|
41
|
+
* resolvable; remains `null` when the SDK is using the runtime API path.
|
|
42
|
+
*/
|
|
43
|
+
dataSource: PickedDataSource | null;
|
|
44
|
+
/**
|
|
45
|
+
* Content fetcher selected by `dynamicExperiencesPlugin`'s resolution chain.
|
|
46
|
+
* Called by `prepareExperienceContent` between target-match and
|
|
47
|
+
* the per-experience `initialiseFx`. `undefined` when no plugin has registered one yet.
|
|
48
|
+
*/
|
|
49
|
+
contentLoader?: ContentLoader;
|
|
20
50
|
private readonly plugins;
|
|
21
|
-
|
|
22
|
-
readonly eventBus: import('effector').EventCallable<EventBusPayload>;
|
|
51
|
+
readonly eventBus: EventCallable<EventBusPayload>;
|
|
23
52
|
readonly events: EventHistoryStore;
|
|
24
|
-
readonly organizationId: string;
|
|
25
53
|
readonly projectId: string;
|
|
26
54
|
readonly apiUrl: string;
|
|
27
55
|
readonly dashboardUrl: string;
|
|
28
56
|
readonly documentationSiteUrl: string;
|
|
29
|
-
readonly session
|
|
30
|
-
readonly precondition?: LogicRule | boolean;
|
|
31
|
-
readonly condition?: LogicRule | boolean;
|
|
32
|
-
preconditionPassed?: boolean;
|
|
57
|
+
readonly session: SessionEntity;
|
|
33
58
|
readonly searchParams: import('.').PickedSearchParams;
|
|
34
59
|
readonly history: {
|
|
35
|
-
push:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
60
|
+
push: EventCallable<{
|
|
61
|
+
experienceId: string;
|
|
62
|
+
node: import('.').ExperienceNode;
|
|
63
|
+
}>;
|
|
64
|
+
replace: EventCallable<{
|
|
65
|
+
experienceId: string;
|
|
66
|
+
node: import('.').ExperienceNode;
|
|
67
|
+
}>;
|
|
68
|
+
back: EventCallable<{
|
|
69
|
+
experienceId?: string;
|
|
40
70
|
}>;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
71
|
+
restore: EventCallable<{
|
|
72
|
+
entries: import('.').HistoryEntry[];
|
|
73
|
+
}>;
|
|
74
|
+
entriesStore: Store<import('.').HistoryEntry[]>;
|
|
44
75
|
};
|
|
45
76
|
readonly components: {
|
|
46
|
-
register:
|
|
47
|
-
|
|
77
|
+
register: EventCallable<{
|
|
78
|
+
name: string;
|
|
79
|
+
component: AdaptedComponent;
|
|
80
|
+
}>;
|
|
81
|
+
getByName: (name: string) => Store<{
|
|
48
82
|
name: string;
|
|
49
83
|
component: AdaptedComponent;
|
|
50
84
|
} | undefined>;
|
|
51
|
-
listStore:
|
|
85
|
+
listStore: Store<{
|
|
52
86
|
name: string;
|
|
53
87
|
component: AdaptedComponent<string, unknown>;
|
|
54
|
-
frameworkStore:
|
|
88
|
+
frameworkStore: Store<Framework | undefined>;
|
|
55
89
|
}[]>;
|
|
56
90
|
};
|
|
57
91
|
readonly experienceInstances: {
|
|
58
92
|
spawn: (experience: import('.').ExperienceStore, target: HTMLElement, options?: LaunchExperienceOptions) => void;
|
|
59
|
-
getByExperienceKey: (key: Experience["key"]) =>
|
|
60
|
-
getByExperienceId: (id: Experience["id"]) =>
|
|
61
|
-
listStore:
|
|
93
|
+
getByExperienceKey: (key: Experience["key"]) => Store<import('.').ExperienceInstance[]>;
|
|
94
|
+
getByExperienceId: (id: Experience["id"]) => Store<import('.').ExperienceInstance[]>;
|
|
95
|
+
listStore: Store<import('.').ExperienceInstance[]>;
|
|
62
96
|
};
|
|
63
97
|
readonly experiences: {
|
|
64
|
-
register:
|
|
65
|
-
get: (id: Experience["id"]) => import('
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
configStore: import('effector').Store<{
|
|
70
|
-
name: string;
|
|
71
|
-
decisionLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
72
|
-
targetSelectors: import('.').ExperienceTarget[];
|
|
73
|
-
initializeOpenLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
74
|
-
}>;
|
|
75
|
-
treeStore: import('effector').Store<{
|
|
76
|
-
steps: ExperienceStep[];
|
|
77
|
-
nodes: import('.').ExperienceNode[];
|
|
78
|
-
edges: import('.').ExperienceEdge[];
|
|
79
|
-
conditions: Condition[];
|
|
80
|
-
}>;
|
|
81
|
-
componentStore: import('effector').Store<{
|
|
82
|
-
name: string;
|
|
83
|
-
component: AdaptedComponent<string, unknown>;
|
|
84
|
-
frameworkStore: import('effector').Store<Framework | undefined>;
|
|
85
|
-
} | undefined>;
|
|
86
|
-
actions: import('.').ExperienceAction[];
|
|
87
|
-
merge: import('effector').EventCallable<{
|
|
88
|
-
experience: Partial<Experience>;
|
|
89
|
-
strategy: "override";
|
|
90
|
-
}>;
|
|
91
|
-
} | undefined>;
|
|
92
|
-
getById: (id: Experience["id"]) => import('effector').Store<{
|
|
93
|
-
id: string;
|
|
94
|
-
key: string;
|
|
95
|
-
name: string;
|
|
96
|
-
configStore: import('effector').Store<{
|
|
97
|
-
name: string;
|
|
98
|
-
decisionLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
99
|
-
targetSelectors: import('.').ExperienceTarget[];
|
|
100
|
-
initializeOpenLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
101
|
-
}>;
|
|
102
|
-
treeStore: import('effector').Store<{
|
|
103
|
-
steps: ExperienceStep[];
|
|
104
|
-
nodes: import('.').ExperienceNode[];
|
|
105
|
-
edges: import('.').ExperienceEdge[];
|
|
106
|
-
conditions: Condition[];
|
|
107
|
-
}>;
|
|
108
|
-
componentStore: import('effector').Store<{
|
|
109
|
-
name: string;
|
|
110
|
-
component: AdaptedComponent<string, unknown>;
|
|
111
|
-
frameworkStore: import('effector').Store<Framework | undefined>;
|
|
112
|
-
} | undefined>;
|
|
113
|
-
actions: import('.').ExperienceAction[];
|
|
114
|
-
merge: import('effector').EventCallable<{
|
|
115
|
-
experience: Partial<Experience>;
|
|
116
|
-
strategy: "override";
|
|
117
|
-
}>;
|
|
118
|
-
} | undefined>;
|
|
119
|
-
getByKey: (key: Experience["key"]) => import('effector').Store<import('.').ExperienceStore | undefined>;
|
|
120
|
-
launch: import('effector').Effect<{
|
|
98
|
+
register: EventCallable<Experience>;
|
|
99
|
+
get: (id: Experience["id"]) => Store<import('.').ExperienceStore | undefined>;
|
|
100
|
+
getById: (id: Experience["id"]) => Store<import('.').ExperienceStore | undefined>;
|
|
101
|
+
getByKey: (key: Experience["key"]) => Store<import('.').ExperienceStore | undefined>;
|
|
102
|
+
launch: Effect<{
|
|
121
103
|
key: string;
|
|
122
104
|
options?: LaunchExperienceOptions;
|
|
123
105
|
} | {
|
|
124
106
|
id: string;
|
|
125
107
|
options?: LaunchExperienceOptions;
|
|
126
108
|
}, void, Error>;
|
|
127
|
-
open:
|
|
109
|
+
open: Effect<{
|
|
128
110
|
key: string;
|
|
129
111
|
options?: import('./exports').OpenExperienceOptions;
|
|
130
112
|
} | {
|
|
131
113
|
id: string;
|
|
132
114
|
options?: import('./exports').OpenExperienceOptions;
|
|
133
115
|
}, void, Error>;
|
|
134
|
-
listStore: import('
|
|
135
|
-
|
|
136
|
-
key: string;
|
|
137
|
-
name: string;
|
|
138
|
-
configStore: import('effector').Store<{
|
|
139
|
-
name: string;
|
|
140
|
-
decisionLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
141
|
-
targetSelectors: import('.').ExperienceTarget[];
|
|
142
|
-
initializeOpenLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
143
|
-
}>;
|
|
144
|
-
treeStore: import('effector').Store<{
|
|
145
|
-
steps: ExperienceStep[];
|
|
146
|
-
nodes: import('.').ExperienceNode[];
|
|
147
|
-
edges: import('.').ExperienceEdge[];
|
|
148
|
-
conditions: Condition[];
|
|
149
|
-
}>;
|
|
150
|
-
componentStore: import('effector').Store<{
|
|
151
|
-
name: string;
|
|
152
|
-
component: AdaptedComponent<string, unknown>;
|
|
153
|
-
frameworkStore: import('effector').Store<Framework | undefined>;
|
|
154
|
-
} | undefined>;
|
|
155
|
-
actions: import('.').ExperienceAction[];
|
|
156
|
-
merge: import('effector').EventCallable<{
|
|
157
|
-
experience: Partial<Experience>;
|
|
158
|
-
strategy: "override";
|
|
159
|
-
}>;
|
|
160
|
-
}[]>;
|
|
116
|
+
listStore: Store<import('.').ExperienceStore[]>;
|
|
117
|
+
initialiseExperiencesFx: Effect<void, void, Error>;
|
|
161
118
|
};
|
|
162
119
|
readonly frameworks: {
|
|
163
|
-
register:
|
|
164
|
-
|
|
165
|
-
|
|
120
|
+
register: EventCallable<{
|
|
121
|
+
name: string;
|
|
122
|
+
framework: Framework;
|
|
123
|
+
}>;
|
|
124
|
+
getByName: (name: string) => Store<Framework | undefined>;
|
|
125
|
+
listStore: Store<Framework[]>;
|
|
166
126
|
};
|
|
167
127
|
readonly predicates: {
|
|
168
|
-
register:
|
|
169
|
-
|
|
170
|
-
|
|
128
|
+
register: EventCallable<{
|
|
129
|
+
name: string;
|
|
130
|
+
predicate: Predicate;
|
|
131
|
+
}>;
|
|
132
|
+
getByName: (name: string) => Store<Predicate | undefined>;
|
|
133
|
+
listStore: Store<{
|
|
171
134
|
name: string;
|
|
172
135
|
predicate: Predicate;
|
|
173
136
|
}[]>;
|
|
174
|
-
getEvokablePredicate: (predicateName: string) =>
|
|
137
|
+
getEvokablePredicate: (predicateName: string) => Store<() => ReturnType<Predicate>>;
|
|
175
138
|
};
|
|
176
139
|
readonly features: {
|
|
177
|
-
register:
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
140
|
+
register: EventCallable<{
|
|
141
|
+
id: string;
|
|
142
|
+
feature: Feature;
|
|
143
|
+
}>;
|
|
144
|
+
getById: (id: string) => Store<import('.').FeatureBucket | undefined>;
|
|
145
|
+
getByName: (name: string) => Store<import('.').FeatureIndexItem | undefined>;
|
|
146
|
+
listStore: Store<import('.').FeatureBucket[]>;
|
|
147
|
+
getEvokableFeature: (featureName: string) => Store<() => Promise<boolean | string | undefined>>;
|
|
182
148
|
};
|
|
183
149
|
readonly conditions: {
|
|
184
150
|
register: (condition: Condition) => void;
|
|
185
|
-
getById: (id: Condition["id"]) =>
|
|
186
|
-
getByKey: (key: Condition["key"]) =>
|
|
187
|
-
listStore:
|
|
188
|
-
indexStore:
|
|
151
|
+
getById: (id: Condition["id"]) => Store<Condition | null>;
|
|
152
|
+
getByKey: (key: Condition["key"]) => Store<Condition | null>;
|
|
153
|
+
listStore: Store<Condition[]>;
|
|
154
|
+
indexStore: StoreWritable<{
|
|
189
155
|
[id: string]: Condition;
|
|
190
156
|
}>;
|
|
191
157
|
};
|
|
192
158
|
readonly fields: {
|
|
193
159
|
register: (field: Field) => void;
|
|
194
160
|
update: (key: import('.').FieldBase["key"], updates: Partial<Field>) => void;
|
|
195
|
-
getById: (id: import('.').FieldBase["id"]) =>
|
|
196
|
-
getByKey: (key: import('.').FieldBase["key"]) =>
|
|
197
|
-
listStore:
|
|
198
|
-
getByName: (name: import('.').FieldBase["name"]) =>
|
|
161
|
+
getById: (id: import('.').FieldBase["id"]) => Store<Field | null>;
|
|
162
|
+
getByKey: (key: import('.').FieldBase["key"]) => Store<Field | null>;
|
|
163
|
+
listStore: Store<Field[]>;
|
|
164
|
+
getByName: (name: import('.').FieldBase["name"]) => Store<Field | null>;
|
|
199
165
|
};
|
|
200
166
|
readonly responses: {
|
|
201
167
|
register: {
|
|
202
168
|
(fieldKey: Field["key"], response: import('.').Response): void;
|
|
203
169
|
(payload: Record<Field["key"], import('.').Response>, response?: never): void;
|
|
204
170
|
};
|
|
205
|
-
clearAll:
|
|
206
|
-
clear:
|
|
171
|
+
clearAll: EventCallable<void>;
|
|
172
|
+
clear: EventCallable<string>;
|
|
207
173
|
commit: (responsesToCommit: import('.').CommitResponses) => Promise<{
|
|
208
174
|
errors: import('.').ValidationError[];
|
|
209
175
|
}>;
|
|
@@ -211,36 +177,71 @@ export declare class Picked {
|
|
|
211
177
|
responsesToCommit: import('.').CommitResponses;
|
|
212
178
|
validationErrors: import('.').ValidationError[];
|
|
213
179
|
}>;
|
|
214
|
-
listStore:
|
|
180
|
+
listStore: Store<{
|
|
215
181
|
fieldKey: string;
|
|
216
182
|
value: import('.').FieldValue;
|
|
217
183
|
}[]>;
|
|
218
|
-
getAllStore:
|
|
184
|
+
getAllStore: Store<{
|
|
219
185
|
[fieldKey: string]: import('.').FieldValue;
|
|
220
186
|
}>;
|
|
221
|
-
getByFieldId: (id: Field["id"]) =>
|
|
222
|
-
getByFieldKey: (key: Field["key"]) =>
|
|
223
|
-
getByFieldName: (fieldName: Field["name"]) =>
|
|
187
|
+
getByFieldId: (id: Field["id"]) => Store<import('.').FieldValue>;
|
|
188
|
+
getByFieldKey: (key: Field["key"]) => Store<import('.').FieldValue>;
|
|
189
|
+
getByFieldName: (fieldName: Field["name"]) => Store<import('.').FieldValue>;
|
|
224
190
|
};
|
|
225
191
|
readonly steps: {
|
|
226
192
|
register: (step: ExperienceStep) => void;
|
|
227
|
-
getById: (id: ExperienceStep["id"]) =>
|
|
228
|
-
getByKey: (key: ExperienceStep["key"]) =>
|
|
229
|
-
listStore:
|
|
230
|
-
indexStore:
|
|
193
|
+
getById: (id: ExperienceStep["id"]) => Store<ExperienceStep | null>;
|
|
194
|
+
getByKey: (key: ExperienceStep["key"]) => Store<ExperienceStep | null>;
|
|
195
|
+
listStore: Store<ExperienceStep[]>;
|
|
196
|
+
indexStore: StoreWritable<{
|
|
231
197
|
[id: string]: ExperienceStep;
|
|
232
198
|
}>;
|
|
233
199
|
};
|
|
200
|
+
readonly contents: {
|
|
201
|
+
register: (content: Content) => void;
|
|
202
|
+
getById: (id: Content["id"]) => Store<Content | null>;
|
|
203
|
+
listStore: Store<Content[]>;
|
|
204
|
+
indexStore: StoreWritable<{
|
|
205
|
+
[id: string]: Content;
|
|
206
|
+
}>;
|
|
207
|
+
};
|
|
234
208
|
readonly actions: {
|
|
235
|
-
register:
|
|
236
|
-
|
|
237
|
-
|
|
209
|
+
register: EventCallable<{
|
|
210
|
+
key: string;
|
|
211
|
+
action: Action;
|
|
212
|
+
}>;
|
|
213
|
+
getByKey: (key: string) => Store<Action | undefined>;
|
|
214
|
+
listStore: Store<import('.').ActionIndexItem[]>;
|
|
238
215
|
getEvokableAction: (actionKey: string, options?: {
|
|
239
216
|
experience: import('.').ExperienceInstance;
|
|
240
|
-
}) =>
|
|
217
|
+
}) => Store<() => ReturnType<Action>>;
|
|
241
218
|
};
|
|
219
|
+
readonly stateSnapshotStore: Store<StateSnapshot>;
|
|
220
|
+
readonly evaluateRuleLogicFx: Effect<EvaluateRuleLogicParams, unknown, Error>;
|
|
221
|
+
/** Public trigger — fires the start chain. `await allSettled(client.start, { scope })` resolves once the chain has fully settled. */
|
|
222
|
+
readonly start: EventCallable<void>;
|
|
223
|
+
/** Reactive store of the readiness flag. */
|
|
224
|
+
readonly readyStore: StoreWritable<boolean>;
|
|
225
|
+
/** Reactive store of the precondition-gate result (`undefined` until `start` is fired). */
|
|
226
|
+
readonly preconditionPassedStore: StoreWritable<boolean | undefined>;
|
|
227
|
+
/** Reactive store of the condition-gate result (`undefined` until `start` is fired). */
|
|
228
|
+
readonly conditionPassedStore: StoreWritable<boolean | undefined>;
|
|
229
|
+
/** Reactive store of the current lifecycle stage. */
|
|
230
|
+
readonly lifecycleStageStore: StoreWritable<LifecycleStage>;
|
|
231
|
+
private readonly lifecycle;
|
|
232
|
+
/**
|
|
233
|
+
* 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()`.
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* ```typescript
|
|
237
|
+
* const greeting = await client.renderStringFx({ template: 'Hi {{name}}', context: { name: 'Mae' } })
|
|
238
|
+
* ```
|
|
239
|
+
*/
|
|
240
|
+
readonly renderStringFx: Effect<{
|
|
241
|
+
template: string;
|
|
242
|
+
context?: Record<string, unknown>;
|
|
243
|
+
}, string, Error>;
|
|
242
244
|
constructor(options: CreateClientOptions);
|
|
243
|
-
start: () => void;
|
|
244
245
|
registerFramework: (framework: Framework) => void;
|
|
245
246
|
registerComponent: (name: string, component: AdaptedComponent) => void;
|
|
246
247
|
registerPlugin: (plugin: Plugin) => void;
|
|
@@ -249,9 +250,9 @@ export declare class Picked {
|
|
|
249
250
|
registerCondition: (condition: Condition) => void;
|
|
250
251
|
registerField: (field: Field) => void;
|
|
251
252
|
registerStep: (step: ExperienceStep) => void;
|
|
253
|
+
registerContent: (content: Content) => void;
|
|
252
254
|
registerAction: (key: string, action: Action) => void;
|
|
253
255
|
registerExperience: (experience: Experience) => void;
|
|
254
|
-
getStateSnapshot: () => StateSnapshot;
|
|
255
256
|
/**
|
|
256
257
|
* Launches an experience by ID.
|
|
257
258
|
*
|
|
@@ -294,53 +295,11 @@ export declare class Picked {
|
|
|
294
295
|
* ```
|
|
295
296
|
*/
|
|
296
297
|
openExperienceByKey: (experienceKey: string) => Promise<void>;
|
|
297
|
-
private runPluginStartHooks;
|
|
298
|
-
private evaluateGate;
|
|
299
298
|
private setupPlugins;
|
|
300
299
|
private setupFeatures;
|
|
301
300
|
private setupPredicates;
|
|
302
301
|
private setupActions;
|
|
303
302
|
private setupComponents;
|
|
304
303
|
getPluginConfig: (pluginName: string) => PluginConfigIndex[string] | Record<string, unknown>;
|
|
305
|
-
/**
|
|
306
|
-
* Interpolates a template string using values from the client's response store and/or a provided context.
|
|
307
|
-
* Supports dot-notation, modifiers, and executing functions found in the context.
|
|
308
|
-
*
|
|
309
|
-
* Sources:
|
|
310
|
-
* - responses.*: Loaded automatically from the client's internal response store by fieldId (e.g. {{ responses.email }}).
|
|
311
|
-
* - Context: Any non-responses.* key must be supplied in the context; nested dot-notation is supported.
|
|
312
|
-
* - Functions: If a context value is a function, it is invoked and its result is rendered.
|
|
313
|
-
*
|
|
314
|
-
* Placeholders:
|
|
315
|
-
* - {{ key | modifier: arg | modifier2: arg2 }} with modifiers applied left-to-right.
|
|
316
|
-
*
|
|
317
|
-
* Modifiers:
|
|
318
|
-
* - default: Use the argument when the value is null, undefined, NaN, or empty string; otherwise return the value as a string.
|
|
319
|
-
* - append: Append the argument (space-separated) when the value is non-empty.
|
|
320
|
-
* - prepend: Prepend the argument (space-separated) when the value is non-empty.
|
|
321
|
-
* - upper: Uppercase string values.
|
|
322
|
-
* - lower: Lowercase string values.
|
|
323
|
-
* - capitalize: Capitalize the first letter of string values.
|
|
324
|
-
* - list: Format Arrays, Maps, and Sets via Intl.ListFormat (Maps render as key: value pairs).
|
|
325
|
-
*
|
|
326
|
-
* Behavior:
|
|
327
|
-
* - 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".
|
|
328
|
-
* - Objects and arrays are JSON-stringified; Maps/Sets serialize to {} unless the list modifier is used.
|
|
329
|
-
* - Unknown modifiers are ignored.
|
|
330
|
-
*
|
|
331
|
-
* @param template Template containing placeholders.
|
|
332
|
-
* @param context Optional data for interpolation. Non-responses.* keys belong here; function values are executed.
|
|
333
|
-
* @returns Interpolated string.
|
|
334
|
-
* @example
|
|
335
|
-
* renderString("Hello {{ name | default: 'Guest' | capitalize }}! Email: {{ responses.email | lower }}.", { name: "ALICE" })
|
|
336
|
-
* // => "Hello Alice! Email: alice@example.com."
|
|
337
|
-
* @example
|
|
338
|
-
* renderString("User: {{ getName | capitalize }}", { getName: () => "alice" })
|
|
339
|
-
* // => "User: Alice"
|
|
340
|
-
* @example
|
|
341
|
-
* renderString("Fruits: {{ fruits | list }}", { fruits: ["apple", "banana", "cherry"] })
|
|
342
|
-
* // => "Fruits: apple, banana, and cherry"
|
|
343
|
-
*/
|
|
344
|
-
renderString: (template: string, context?: Record<string, unknown>) => string;
|
|
345
304
|
}
|
|
346
305
|
//# sourceMappingURL=picked.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"picked.d.ts","sourceRoot":"","sources":["../../src/picked.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
|
|
|
1
|
-
|
|
1
|
+
/** @file Public exports for the dynamic-experiences plugin (project config + per-experience content resolution). */
|
|
2
|
+
export { dynamicExperiencesPlugin, fetchExperienceContent, fetchProject } from './plugin';
|
|
2
3
|
export { createClientHeaders } from '../../utils/client-headers';
|
|
3
4
|
export type * from './types';
|
|
4
5
|
//# 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,OAAO,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;
|
|
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,5 +1,5 @@
|
|
|
1
1
|
import { Plugin } from '../../entities/plugin/plugin';
|
|
2
|
-
import { DynamicExperiencesPluginOptions, FetchProjectOptions, ProjectConfig } from './types';
|
|
2
|
+
import { DynamicExperiencesPluginOptions, ExperienceContentResponse, FetchProjectOptions, ProjectConfig } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Fetches the project configuration from the Picked REST API.
|
|
5
5
|
*
|
|
@@ -16,6 +16,23 @@ import { DynamicExperiencesPluginOptions, FetchProjectOptions, ProjectConfig } f
|
|
|
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>;
|
|
19
36
|
/**
|
|
20
37
|
* Plugin that fetches project configuration from the Picked REST API and registers
|
|
21
38
|
* 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":"
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dynamic-experiences/plugin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAK1D,OAAO,KAAK,EAEV,+BAA+B,EAC/B,yBAAyB,EACzB,mBAAmB,EACnB,aAAa,EAId,MAAM,SAAS,CAAA;AAsThB;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAmC/B;AAoBD;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC,CAsC3C;AAgOD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,CAAC,EAAE,+BAA+B,GAAG,MAAM,CAoC1F"}
|
|
@@ -9,8 +9,14 @@ 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.
|
|
12
18
|
*/
|
|
13
|
-
export type ApiExperienceStep = Omit<ExperienceStep, 'fieldKeys'> & {
|
|
19
|
+
export type ApiExperienceStep = Omit<ExperienceStep, 'fieldKeys' | 'layoutContentStore'> & {
|
|
14
20
|
fieldIds?: string[];
|
|
15
21
|
};
|
|
16
22
|
export interface ProjectConfigFeature {
|
|
@@ -66,9 +72,64 @@ export interface ProjectConfig {
|
|
|
66
72
|
export interface DynamicExperiencesPluginOptions {
|
|
67
73
|
apiUrl?: string;
|
|
68
74
|
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>;
|
|
69
88
|
}
|
|
70
89
|
export interface FetchProjectOptions {
|
|
71
90
|
previewToken?: string;
|
|
72
91
|
headers?: Record<string, string>;
|
|
73
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Wire-format content blob as returned by the Picked API content endpoint.
|
|
95
|
+
*/
|
|
96
|
+
export interface ContentBlob {
|
|
97
|
+
id: string;
|
|
98
|
+
data: Record<string, unknown>;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Wire-format response shape for `GET /api/v1/projects/:projectId/experiences/:experienceId/content`.
|
|
102
|
+
* The response is agnostic of step structure — step ↔ content mapping is encoded in the
|
|
103
|
+
* project blob via `Step.layoutContentId`.
|
|
104
|
+
*/
|
|
105
|
+
export interface ExperienceContentResponse {
|
|
106
|
+
experienceId: string;
|
|
107
|
+
versionId: string;
|
|
108
|
+
content: ContentBlob[];
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Function that resolves an experience's content blobs. Set on the Picked client by
|
|
112
|
+
* `dynamicExperiencesPlugin` (selecting from virtual module, getContent override, or API)
|
|
113
|
+
* and called by `prepareExperienceContent` between target-match and `initialiseExperience`.
|
|
114
|
+
*/
|
|
115
|
+
export type ContentLoader = (experience: {
|
|
116
|
+
id: string;
|
|
117
|
+
key: string;
|
|
118
|
+
}, options?: {
|
|
119
|
+
previewToken?: string;
|
|
120
|
+
}) => Promise<ExperienceContentResponse | null>;
|
|
121
|
+
/**
|
|
122
|
+
* Optional-fields surface of the virtual data module exposed by `@picked/vite-plugin-picked`.
|
|
123
|
+
* The shape is identical between dev (`vite serve`) and build (`vite build`) modes.
|
|
124
|
+
*/
|
|
125
|
+
export interface VirtualPickedData {
|
|
126
|
+
projectConfig: ProjectConfig;
|
|
127
|
+
experienceContent: ContentLoader;
|
|
128
|
+
manifestMetadata: {
|
|
129
|
+
mode: 'dev' | 'build';
|
|
130
|
+
fetchedAt: string | null;
|
|
131
|
+
projectVersionId: string | null;
|
|
132
|
+
workspaceId: string | null;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
74
135
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dynamic-experiences/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAA;AACvD,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,gBAAgB,EACjB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAA;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAE/D
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","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,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/B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;KAC3B,CAAA;CACF"}
|
|
@@ -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,
|
|
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"}
|