@picked/client 0.0.62-next.1 → 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-Dfrznen2.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 +1 -1
- 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/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-NpGrXHyM.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
package/dist/types/picked.d.ts
CHANGED
|
@@ -1,215 +1,176 @@
|
|
|
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. Called
|
|
46
|
+
* by each experience's `prepareExperienceContentFx` (fired in parallel with
|
|
47
|
+
* `initialiseFx` by the per-experience sample graph). `undefined` when no plugin
|
|
48
|
+
* has registered one yet.
|
|
49
|
+
*/
|
|
50
|
+
contentLoader?: ContentLoader;
|
|
20
51
|
private readonly plugins;
|
|
21
|
-
|
|
22
|
-
readonly eventBus: import('effector').EventCallable<EventBusPayload>;
|
|
52
|
+
readonly eventBus: EventCallable<EventBusPayload>;
|
|
23
53
|
readonly events: EventHistoryStore;
|
|
24
|
-
readonly organizationId: string;
|
|
25
54
|
readonly projectId: string;
|
|
26
55
|
readonly apiUrl: string;
|
|
27
56
|
readonly dashboardUrl: string;
|
|
28
57
|
readonly documentationSiteUrl: string;
|
|
29
|
-
readonly session
|
|
30
|
-
readonly precondition?: LogicRule | boolean;
|
|
31
|
-
readonly condition?: LogicRule | boolean;
|
|
32
|
-
preconditionPassed?: boolean;
|
|
58
|
+
readonly session: SessionEntity;
|
|
33
59
|
readonly searchParams: import('.').PickedSearchParams;
|
|
34
60
|
readonly history: {
|
|
35
|
-
push:
|
|
61
|
+
push: EventCallable<{
|
|
36
62
|
experienceId: string;
|
|
37
63
|
node: import('.').ExperienceNode;
|
|
38
64
|
}>;
|
|
39
|
-
replace:
|
|
65
|
+
replace: EventCallable<{
|
|
40
66
|
experienceId: string;
|
|
41
67
|
node: import('.').ExperienceNode;
|
|
42
68
|
}>;
|
|
43
|
-
back:
|
|
69
|
+
back: EventCallable<{
|
|
44
70
|
experienceId?: string;
|
|
45
71
|
}>;
|
|
46
|
-
restore:
|
|
72
|
+
restore: EventCallable<{
|
|
47
73
|
entries: import('.').HistoryEntry[];
|
|
48
74
|
}>;
|
|
49
|
-
entriesStore:
|
|
75
|
+
entriesStore: Store<import('.').HistoryEntry[]>;
|
|
50
76
|
};
|
|
51
77
|
readonly components: {
|
|
52
|
-
register:
|
|
53
|
-
|
|
78
|
+
register: EventCallable<{
|
|
79
|
+
name: string;
|
|
80
|
+
component: AdaptedComponent;
|
|
81
|
+
}>;
|
|
82
|
+
getByName: (name: string) => Store<{
|
|
54
83
|
name: string;
|
|
55
84
|
component: AdaptedComponent;
|
|
56
85
|
} | undefined>;
|
|
57
|
-
listStore:
|
|
86
|
+
listStore: Store<{
|
|
58
87
|
name: string;
|
|
59
88
|
component: AdaptedComponent<string, unknown>;
|
|
60
|
-
frameworkStore:
|
|
89
|
+
frameworkStore: Store<Framework | undefined>;
|
|
61
90
|
}[]>;
|
|
62
91
|
};
|
|
63
92
|
readonly experienceInstances: {
|
|
64
93
|
spawn: (experience: import('.').ExperienceStore, target: HTMLElement, options?: LaunchExperienceOptions) => void;
|
|
65
|
-
getByExperienceKey: (key: Experience["key"]) =>
|
|
66
|
-
getByExperienceId: (id: Experience["id"]) =>
|
|
67
|
-
listStore:
|
|
94
|
+
getByExperienceKey: (key: Experience["key"]) => Store<import('.').ExperienceInstance[]>;
|
|
95
|
+
getByExperienceId: (id: Experience["id"]) => Store<import('.').ExperienceInstance[]>;
|
|
96
|
+
listStore: Store<import('.').ExperienceInstance[]>;
|
|
68
97
|
};
|
|
69
98
|
readonly experiences: {
|
|
70
|
-
register:
|
|
71
|
-
get: (id: Experience["id"]) => import('
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
configStore: import('effector').Store<{
|
|
76
|
-
name: string;
|
|
77
|
-
decisionLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
78
|
-
targetSelectors: import('.').ExperienceTarget[];
|
|
79
|
-
initializeOpenLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
80
|
-
}>;
|
|
81
|
-
treeStore: import('effector').Store<{
|
|
82
|
-
steps: ExperienceStep[];
|
|
83
|
-
nodes: import('.').ExperienceNode[];
|
|
84
|
-
edges: import('.').ExperienceEdge[];
|
|
85
|
-
conditions: Condition[];
|
|
86
|
-
}>;
|
|
87
|
-
componentStore: import('effector').Store<{
|
|
88
|
-
name: string;
|
|
89
|
-
component: AdaptedComponent<string, unknown>;
|
|
90
|
-
frameworkStore: import('effector').Store<Framework | undefined>;
|
|
91
|
-
} | undefined>;
|
|
92
|
-
actions: import('.').ExperienceAction[];
|
|
93
|
-
merge: import('effector').EventCallable<{
|
|
94
|
-
experience: Partial<Experience>;
|
|
95
|
-
strategy: "override";
|
|
96
|
-
}>;
|
|
97
|
-
} | undefined>;
|
|
98
|
-
getById: (id: Experience["id"]) => import('effector').Store<{
|
|
99
|
-
id: string;
|
|
100
|
-
key: string;
|
|
101
|
-
name: string;
|
|
102
|
-
configStore: import('effector').Store<{
|
|
103
|
-
name: string;
|
|
104
|
-
decisionLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
105
|
-
targetSelectors: import('.').ExperienceTarget[];
|
|
106
|
-
initializeOpenLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
107
|
-
}>;
|
|
108
|
-
treeStore: import('effector').Store<{
|
|
109
|
-
steps: ExperienceStep[];
|
|
110
|
-
nodes: import('.').ExperienceNode[];
|
|
111
|
-
edges: import('.').ExperienceEdge[];
|
|
112
|
-
conditions: Condition[];
|
|
113
|
-
}>;
|
|
114
|
-
componentStore: import('effector').Store<{
|
|
115
|
-
name: string;
|
|
116
|
-
component: AdaptedComponent<string, unknown>;
|
|
117
|
-
frameworkStore: import('effector').Store<Framework | undefined>;
|
|
118
|
-
} | undefined>;
|
|
119
|
-
actions: import('.').ExperienceAction[];
|
|
120
|
-
merge: import('effector').EventCallable<{
|
|
121
|
-
experience: Partial<Experience>;
|
|
122
|
-
strategy: "override";
|
|
123
|
-
}>;
|
|
124
|
-
} | undefined>;
|
|
125
|
-
getByKey: (key: Experience["key"]) => import('effector').Store<import('.').ExperienceStore | undefined>;
|
|
126
|
-
launch: import('effector').Effect<{
|
|
99
|
+
register: EventCallable<Experience>;
|
|
100
|
+
get: (id: Experience["id"]) => Store<import('.').ExperienceStore | undefined>;
|
|
101
|
+
getById: (id: Experience["id"]) => Store<import('.').ExperienceStore | undefined>;
|
|
102
|
+
getByKey: (key: Experience["key"]) => Store<import('.').ExperienceStore | undefined>;
|
|
103
|
+
launch: Effect<{
|
|
127
104
|
key: string;
|
|
128
105
|
options?: LaunchExperienceOptions;
|
|
129
106
|
} | {
|
|
130
107
|
id: string;
|
|
131
108
|
options?: LaunchExperienceOptions;
|
|
132
109
|
}, void, Error>;
|
|
133
|
-
open:
|
|
110
|
+
open: Effect<{
|
|
134
111
|
key: string;
|
|
135
112
|
options?: import('./exports').OpenExperienceOptions;
|
|
136
113
|
} | {
|
|
137
114
|
id: string;
|
|
138
115
|
options?: import('./exports').OpenExperienceOptions;
|
|
139
116
|
}, void, Error>;
|
|
140
|
-
listStore: import('
|
|
141
|
-
|
|
142
|
-
key: string;
|
|
143
|
-
name: string;
|
|
144
|
-
configStore: import('effector').Store<{
|
|
145
|
-
name: string;
|
|
146
|
-
decisionLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
147
|
-
targetSelectors: import('.').ExperienceTarget[];
|
|
148
|
-
initializeOpenLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
149
|
-
}>;
|
|
150
|
-
treeStore: import('effector').Store<{
|
|
151
|
-
steps: ExperienceStep[];
|
|
152
|
-
nodes: import('.').ExperienceNode[];
|
|
153
|
-
edges: import('.').ExperienceEdge[];
|
|
154
|
-
conditions: Condition[];
|
|
155
|
-
}>;
|
|
156
|
-
componentStore: import('effector').Store<{
|
|
157
|
-
name: string;
|
|
158
|
-
component: AdaptedComponent<string, unknown>;
|
|
159
|
-
frameworkStore: import('effector').Store<Framework | undefined>;
|
|
160
|
-
} | undefined>;
|
|
161
|
-
actions: import('.').ExperienceAction[];
|
|
162
|
-
merge: import('effector').EventCallable<{
|
|
163
|
-
experience: Partial<Experience>;
|
|
164
|
-
strategy: "override";
|
|
165
|
-
}>;
|
|
166
|
-
}[]>;
|
|
117
|
+
listStore: Store<import('.').ExperienceStore[]>;
|
|
118
|
+
initialiseExperiencesFx: Effect<void, void, Error>;
|
|
167
119
|
};
|
|
168
120
|
readonly frameworks: {
|
|
169
|
-
register:
|
|
170
|
-
|
|
171
|
-
|
|
121
|
+
register: EventCallable<{
|
|
122
|
+
name: string;
|
|
123
|
+
framework: Framework;
|
|
124
|
+
}>;
|
|
125
|
+
getByName: (name: string) => Store<Framework | undefined>;
|
|
126
|
+
listStore: Store<Framework[]>;
|
|
172
127
|
};
|
|
173
128
|
readonly predicates: {
|
|
174
|
-
register:
|
|
175
|
-
|
|
176
|
-
|
|
129
|
+
register: EventCallable<{
|
|
130
|
+
name: string;
|
|
131
|
+
predicate: Predicate;
|
|
132
|
+
}>;
|
|
133
|
+
getByName: (name: string) => Store<Predicate | undefined>;
|
|
134
|
+
listStore: Store<{
|
|
177
135
|
name: string;
|
|
178
136
|
predicate: Predicate;
|
|
179
137
|
}[]>;
|
|
180
|
-
getEvokablePredicate: (predicateName: string) =>
|
|
138
|
+
getEvokablePredicate: (predicateName: string) => Store<() => ReturnType<Predicate>>;
|
|
181
139
|
};
|
|
182
140
|
readonly features: {
|
|
183
|
-
register:
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
141
|
+
register: EventCallable<{
|
|
142
|
+
id: string;
|
|
143
|
+
feature: Feature;
|
|
144
|
+
}>;
|
|
145
|
+
getById: (id: string) => Store<import('.').FeatureBucket | undefined>;
|
|
146
|
+
getByName: (name: string) => Store<import('.').FeatureIndexItem | undefined>;
|
|
147
|
+
listStore: Store<import('.').FeatureBucket[]>;
|
|
148
|
+
getEvokableFeature: (featureName: string) => Store<() => Promise<boolean | string | undefined>>;
|
|
188
149
|
};
|
|
189
150
|
readonly conditions: {
|
|
190
151
|
register: (condition: Condition) => void;
|
|
191
|
-
getById: (id: Condition["id"]) =>
|
|
192
|
-
getByKey: (key: Condition["key"]) =>
|
|
193
|
-
listStore:
|
|
194
|
-
indexStore:
|
|
152
|
+
getById: (id: Condition["id"]) => Store<Condition | null>;
|
|
153
|
+
getByKey: (key: Condition["key"]) => Store<Condition | null>;
|
|
154
|
+
listStore: Store<Condition[]>;
|
|
155
|
+
indexStore: StoreWritable<{
|
|
195
156
|
[id: string]: Condition;
|
|
196
157
|
}>;
|
|
197
158
|
};
|
|
198
159
|
readonly fields: {
|
|
199
160
|
register: (field: Field) => void;
|
|
200
161
|
update: (key: import('.').FieldBase["key"], updates: Partial<Field>) => void;
|
|
201
|
-
getById: (id: import('.').FieldBase["id"]) =>
|
|
202
|
-
getByKey: (key: import('.').FieldBase["key"]) =>
|
|
203
|
-
listStore:
|
|
204
|
-
getByName: (name: import('.').FieldBase["name"]) =>
|
|
162
|
+
getById: (id: import('.').FieldBase["id"]) => Store<Field | null>;
|
|
163
|
+
getByKey: (key: import('.').FieldBase["key"]) => Store<Field | null>;
|
|
164
|
+
listStore: Store<Field[]>;
|
|
165
|
+
getByName: (name: import('.').FieldBase["name"]) => Store<Field | null>;
|
|
205
166
|
};
|
|
206
167
|
readonly responses: {
|
|
207
168
|
register: {
|
|
208
169
|
(fieldKey: Field["key"], response: import('.').Response): void;
|
|
209
170
|
(payload: Record<Field["key"], import('.').Response>, response?: never): void;
|
|
210
171
|
};
|
|
211
|
-
clearAll:
|
|
212
|
-
clear:
|
|
172
|
+
clearAll: EventCallable<void>;
|
|
173
|
+
clear: EventCallable<string>;
|
|
213
174
|
commit: (responsesToCommit: import('.').CommitResponses) => Promise<{
|
|
214
175
|
errors: import('.').ValidationError[];
|
|
215
176
|
}>;
|
|
@@ -217,36 +178,71 @@ export declare class Picked {
|
|
|
217
178
|
responsesToCommit: import('.').CommitResponses;
|
|
218
179
|
validationErrors: import('.').ValidationError[];
|
|
219
180
|
}>;
|
|
220
|
-
listStore:
|
|
181
|
+
listStore: Store<{
|
|
221
182
|
fieldKey: string;
|
|
222
183
|
value: import('.').FieldValue;
|
|
223
184
|
}[]>;
|
|
224
|
-
getAllStore:
|
|
185
|
+
getAllStore: Store<{
|
|
225
186
|
[fieldKey: string]: import('.').FieldValue;
|
|
226
187
|
}>;
|
|
227
|
-
getByFieldId: (id: Field["id"]) =>
|
|
228
|
-
getByFieldKey: (key: Field["key"]) =>
|
|
229
|
-
getByFieldName: (fieldName: Field["name"]) =>
|
|
188
|
+
getByFieldId: (id: Field["id"]) => Store<import('.').FieldValue>;
|
|
189
|
+
getByFieldKey: (key: Field["key"]) => Store<import('.').FieldValue>;
|
|
190
|
+
getByFieldName: (fieldName: Field["name"]) => Store<import('.').FieldValue>;
|
|
230
191
|
};
|
|
231
192
|
readonly steps: {
|
|
232
193
|
register: (step: ExperienceStep) => void;
|
|
233
|
-
getById: (id: ExperienceStep["id"]) =>
|
|
234
|
-
getByKey: (key: ExperienceStep["key"]) =>
|
|
235
|
-
listStore:
|
|
236
|
-
indexStore:
|
|
194
|
+
getById: (id: ExperienceStep["id"]) => Store<ExperienceStep | null>;
|
|
195
|
+
getByKey: (key: ExperienceStep["key"]) => Store<ExperienceStep | null>;
|
|
196
|
+
listStore: Store<ExperienceStep[]>;
|
|
197
|
+
indexStore: StoreWritable<{
|
|
237
198
|
[id: string]: ExperienceStep;
|
|
238
199
|
}>;
|
|
239
200
|
};
|
|
201
|
+
readonly contents: {
|
|
202
|
+
register: (content: Content) => void;
|
|
203
|
+
getById: (id: Content["id"]) => Store<Content | null>;
|
|
204
|
+
listStore: Store<Content[]>;
|
|
205
|
+
indexStore: StoreWritable<{
|
|
206
|
+
[id: string]: Content;
|
|
207
|
+
}>;
|
|
208
|
+
};
|
|
240
209
|
readonly actions: {
|
|
241
|
-
register:
|
|
242
|
-
|
|
243
|
-
|
|
210
|
+
register: EventCallable<{
|
|
211
|
+
key: string;
|
|
212
|
+
action: Action;
|
|
213
|
+
}>;
|
|
214
|
+
getByKey: (key: string) => Store<Action | undefined>;
|
|
215
|
+
listStore: Store<import('.').ActionIndexItem[]>;
|
|
244
216
|
getEvokableAction: (actionKey: string, options?: {
|
|
245
217
|
experience: import('.').ExperienceInstance;
|
|
246
|
-
}) =>
|
|
218
|
+
}) => Store<() => ReturnType<Action>>;
|
|
247
219
|
};
|
|
220
|
+
readonly stateSnapshotStore: Store<StateSnapshot>;
|
|
221
|
+
readonly evaluateRuleLogicFx: Effect<EvaluateRuleLogicParams, unknown, Error>;
|
|
222
|
+
/** Public trigger — fires the start chain. `await allSettled(client.start, { scope })` resolves once the chain has fully settled. */
|
|
223
|
+
readonly start: EventCallable<void>;
|
|
224
|
+
/** Reactive store of the readiness flag. */
|
|
225
|
+
readonly readyStore: StoreWritable<boolean>;
|
|
226
|
+
/** Reactive store of the precondition-gate result (`undefined` until `start` is fired). */
|
|
227
|
+
readonly preconditionPassedStore: StoreWritable<boolean | undefined>;
|
|
228
|
+
/** Reactive store of the condition-gate result (`undefined` until `start` is fired). */
|
|
229
|
+
readonly conditionPassedStore: StoreWritable<boolean | undefined>;
|
|
230
|
+
/** Reactive store of the current lifecycle stage. */
|
|
231
|
+
readonly lifecycleStageStore: StoreWritable<LifecycleStage>;
|
|
232
|
+
private readonly lifecycle;
|
|
233
|
+
/**
|
|
234
|
+
* Effect that interpolates a template string against the latest responses plus a caller-supplied context. Source is `responses.listStore` so renders are scope-aware and pick up the latest committed responses without `.getState()`.
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* ```typescript
|
|
238
|
+
* const greeting = await client.renderStringFx({ template: 'Hi {{name}}', context: { name: 'Mae' } })
|
|
239
|
+
* ```
|
|
240
|
+
*/
|
|
241
|
+
readonly renderStringFx: Effect<{
|
|
242
|
+
template: string;
|
|
243
|
+
context?: Record<string, unknown>;
|
|
244
|
+
}, string, Error>;
|
|
248
245
|
constructor(options: CreateClientOptions);
|
|
249
|
-
start: () => void;
|
|
250
246
|
registerFramework: (framework: Framework) => void;
|
|
251
247
|
registerComponent: (name: string, component: AdaptedComponent) => void;
|
|
252
248
|
registerPlugin: (plugin: Plugin) => void;
|
|
@@ -255,9 +251,9 @@ export declare class Picked {
|
|
|
255
251
|
registerCondition: (condition: Condition) => void;
|
|
256
252
|
registerField: (field: Field) => void;
|
|
257
253
|
registerStep: (step: ExperienceStep) => void;
|
|
254
|
+
registerContent: (content: Content) => void;
|
|
258
255
|
registerAction: (key: string, action: Action) => void;
|
|
259
256
|
registerExperience: (experience: Experience) => void;
|
|
260
|
-
getStateSnapshot: () => StateSnapshot;
|
|
261
257
|
/**
|
|
262
258
|
* Launches an experience by ID.
|
|
263
259
|
*
|
|
@@ -300,53 +296,11 @@ export declare class Picked {
|
|
|
300
296
|
* ```
|
|
301
297
|
*/
|
|
302
298
|
openExperienceByKey: (experienceKey: string) => Promise<void>;
|
|
303
|
-
private runPluginStartHooks;
|
|
304
|
-
private evaluateGate;
|
|
305
299
|
private setupPlugins;
|
|
306
300
|
private setupFeatures;
|
|
307
301
|
private setupPredicates;
|
|
308
302
|
private setupActions;
|
|
309
303
|
private setupComponents;
|
|
310
304
|
getPluginConfig: (pluginName: string) => PluginConfigIndex[string] | Record<string, unknown>;
|
|
311
|
-
/**
|
|
312
|
-
* Interpolates a template string using values from the client's response store and/or a provided context.
|
|
313
|
-
* Supports dot-notation, modifiers, and executing functions found in the context.
|
|
314
|
-
*
|
|
315
|
-
* Sources:
|
|
316
|
-
* - responses.*: Loaded automatically from the client's internal response store by fieldId (e.g. {{ responses.email }}).
|
|
317
|
-
* - Context: Any non-responses.* key must be supplied in the context; nested dot-notation is supported.
|
|
318
|
-
* - Functions: If a context value is a function, it is invoked and its result is rendered.
|
|
319
|
-
*
|
|
320
|
-
* Placeholders:
|
|
321
|
-
* - {{ key | modifier: arg | modifier2: arg2 }} with modifiers applied left-to-right.
|
|
322
|
-
*
|
|
323
|
-
* Modifiers:
|
|
324
|
-
* - default: Use the argument when the value is null, undefined, NaN, or empty string; otherwise return the value as a string.
|
|
325
|
-
* - append: Append the argument (space-separated) when the value is non-empty.
|
|
326
|
-
* - prepend: Prepend the argument (space-separated) when the value is non-empty.
|
|
327
|
-
* - upper: Uppercase string values.
|
|
328
|
-
* - lower: Lowercase string values.
|
|
329
|
-
* - capitalize: Capitalize the first letter of string values.
|
|
330
|
-
* - list: Format Arrays, Maps, and Sets via Intl.ListFormat (Maps render as key: value pairs).
|
|
331
|
-
*
|
|
332
|
-
* Behavior:
|
|
333
|
-
* - 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".
|
|
334
|
-
* - Objects and arrays are JSON-stringified; Maps/Sets serialize to {} unless the list modifier is used.
|
|
335
|
-
* - Unknown modifiers are ignored.
|
|
336
|
-
*
|
|
337
|
-
* @param template Template containing placeholders.
|
|
338
|
-
* @param context Optional data for interpolation. Non-responses.* keys belong here; function values are executed.
|
|
339
|
-
* @returns Interpolated string.
|
|
340
|
-
* @example
|
|
341
|
-
* renderString("Hello {{ name | default: 'Guest' | capitalize }}! Email: {{ responses.email | lower }}.", { name: "ALICE" })
|
|
342
|
-
* // => "Hello Alice! Email: alice@example.com."
|
|
343
|
-
* @example
|
|
344
|
-
* renderString("User: {{ getName | capitalize }}", { getName: () => "alice" })
|
|
345
|
-
* // => "User: Alice"
|
|
346
|
-
* @example
|
|
347
|
-
* renderString("Fruits: {{ fruits | list }}", { fruits: ["apple", "banana", "cherry"] })
|
|
348
|
-
* // => "Fruits: apple, banana, and cherry"
|
|
349
|
-
*/
|
|
350
|
-
renderString: (template: string, context?: Record<string, unknown>) => string;
|
|
351
305
|
}
|
|
352
306
|
//# sourceMappingURL=picked.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"picked.d.ts","sourceRoot":"","sources":["../../src/picked.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"picked.d.ts","sourceRoot":"","sources":["../../src/picked.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,OAAO,EAGL,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,KAAK,EACV,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 @@
|
|
|
1
|
+
import { Plugin } from '../../entities/plugin/plugin';
|
|
2
|
+
/**
|
|
3
|
+
* Watches the document for `childList` mutations and reconciles experiences
|
|
4
|
+
* whose declared target selectors match newly added DOM subtrees. Each
|
|
5
|
+
* matching experience runs through its per-experience `shouldInitialiseFx`,
|
|
6
|
+
* and on `true` is handed to its `initialiseFx(undefined)`.
|
|
7
|
+
*
|
|
8
|
+
* Scope: lazy-mounted target hosts that arrive after the initial bulk init
|
|
9
|
+
* in `picked.ts`. Route-driven re-initialisation (decisionLogic depending
|
|
10
|
+
* on `location.pathname`, lifecycle event re-fires, plugin start hooks)
|
|
11
|
+
* is the responsibility of `singlePageAppPlugin`, which calls
|
|
12
|
+
* `client.start()` on history events. Pair the two plugins to cover both.
|
|
13
|
+
*
|
|
14
|
+
* Pipeline:
|
|
15
|
+
* - Each experience's `configStore.watch()` pushes its trimmed selectors
|
|
16
|
+
* into a reactive `Store<Map<id, string[]>>`. Empty / whitespace-only
|
|
17
|
+
* selectors are filtered out.
|
|
18
|
+
* - A single `MutationObserver` collects `Element` instances from
|
|
19
|
+
* `childList.addedNodes` across one animation frame, then fires a
|
|
20
|
+
* single `mutationObserved` event carrying the collected elements.
|
|
21
|
+
* - `sample` filters registered experiences to those whose selectors
|
|
22
|
+
* match at least one added element via `el.matches` or
|
|
23
|
+
* `el.querySelector`. Malformed selectors are skipped per-experience
|
|
24
|
+
* without poisoning the rest of the batch. The matched array is
|
|
25
|
+
* routed straight into `reconcileMatchedFx` via `sample.target`.
|
|
26
|
+
* - `reconcileMatchedFx` invokes each experience's
|
|
27
|
+
* `shouldInitialiseFx`, and on `true` its `initialiseFx(undefined)`.
|
|
28
|
+
* `initialiseFx` is idempotent: tagged target elements are skipped
|
|
29
|
+
* on subsequent passes.
|
|
30
|
+
*
|
|
31
|
+
* Setup is deferred until `document.body` is parsed, so SDKs loaded from
|
|
32
|
+
* `<head>` without `defer` (the standard Shopify-theme / GTM-template
|
|
33
|
+
* pattern) still install once the body becomes available.
|
|
34
|
+
*
|
|
35
|
+
* No-ops outside browser environments and on partial-DOM runtimes that
|
|
36
|
+
* lack `MutationObserver` or `requestAnimationFrame`. `MutationObserver`
|
|
37
|
+
* does not cross shadow root or iframe boundaries, so experiences whose
|
|
38
|
+
* target lives inside a shadow tree or a cross-origin frame are not
|
|
39
|
+
* reconciled by this plugin.
|
|
40
|
+
*
|
|
41
|
+
* @returns {Plugin} The plugin.
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* createClient({
|
|
45
|
+
* plugins: [domObserverPlugin()]
|
|
46
|
+
* })
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare const domObserverPlugin: () => Plugin;
|
|
50
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dom-observer/plugin.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAK1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,eAAO,MAAM,iBAAiB,QAAO,MAiBpC,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
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;AAkPD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,CAAC,EAAE,+BAA+B,GAAG,MAAM,CAoC1F"}
|