@picked/client 0.0.1-dev.1774231221701 → 0.0.1-dev.1774912386475
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/dist/{api-BEXzPJHZ.cjs → api-B-wGEgt8.cjs} +1 -1
- package/dist/{api-oudcFuUX.js → api-DwERBrAZ.js} +1 -1
- package/dist/cjs/form/index.js +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/plugins/create-experience/index.js +1 -1
- package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
- package/dist/cjs/plugins/responses-browser-storage/index.js +1 -1
- package/dist/cjs/plugins/web-components/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/esm/form/index.js +128 -84
- package/dist/esm/index.js +393 -334
- package/dist/esm/plugins/create-experience/index.js +183 -151
- package/dist/esm/plugins/dynamic-experiences/index.js +52 -30
- package/dist/esm/plugins/responses-browser-storage/index.js +47 -20
- package/dist/esm/plugins/web-components/index.js +1 -1
- package/dist/esm/server/index.js +1 -1
- package/dist/{experience-instance-DZiAwXph.js → experience-instance-CwwrKUI8.js} +50 -46
- package/dist/experience-instance-DdFUcVRd.cjs +1 -0
- package/dist/{rules-logic-B7vJrWyO.js → rules-logic-BIkBWZmf.js} +4 -2
- package/dist/rules-logic-DDxCiq4P.cjs +1 -0
- package/dist/types/entities/condition/condition.d.ts +17 -0
- package/dist/types/entities/condition/condition.d.ts.map +1 -0
- package/dist/types/entities/experience/experience.d.ts +40 -35
- package/dist/types/entities/experience/experience.d.ts.map +1 -1
- package/dist/types/entities/experience-instance/experience-instance.d.ts +21 -2
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/field/field.d.ts +13 -2
- package/dist/types/entities/field/field.d.ts.map +1 -1
- package/dist/types/entities/response/response-validation.d.ts +76 -0
- package/dist/types/entities/response/response-validation.d.ts.map +1 -0
- package/dist/types/entities/response/response.d.ts +24 -17
- package/dist/types/entities/response/response.d.ts.map +1 -1
- package/dist/types/entities/step/step.d.ts +36 -0
- package/dist/types/entities/step/step.d.ts.map +1 -0
- package/dist/types/form/build-responses.d.ts +12 -9
- package/dist/types/form/build-responses.d.ts.map +1 -1
- package/dist/types/form/create-field-evaluator.d.ts +11 -3
- package/dist/types/form/create-field-evaluator.d.ts.map +1 -1
- package/dist/types/form/create-field-validation.d.ts +21 -6
- package/dist/types/form/create-field-validation.d.ts.map +1 -1
- package/dist/types/form/create-form.d.ts +42 -11
- package/dist/types/form/create-form.d.ts.map +1 -1
- package/dist/types/form/create-submit-pipeline.d.ts +21 -9
- package/dist/types/form/create-submit-pipeline.d.ts.map +1 -1
- package/dist/types/form/get-step-fields.d.ts +13 -0
- package/dist/types/form/get-step-fields.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/logic-engine.d.ts +10 -2
- package/dist/types/logic-engine.d.ts.map +1 -1
- package/dist/types/picked.d.ts +68 -32
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +51 -29
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/index.d.ts +2 -2
- package/dist/types/plugins/create-experience/index.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/plugin.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/serialization.d.ts +1 -0
- package/dist/types/plugins/create-experience/serialization.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts +21 -4
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/types.d.ts +41 -0
- package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -1
- package/dist/types/plugins/responses-browser-storage/plugin.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/node-tree/get-next-node-from-condition.d.ts +3 -0
- package/dist/types/utils/node-tree/get-next-node-from-condition.d.ts.map +1 -0
- package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts +10 -6
- package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts.map +1 -1
- package/dist/types/utils/nodes.d.ts +74 -2
- package/dist/types/utils/nodes.d.ts.map +1 -1
- package/dist/types/utils/rules-logic.d.ts +31 -0
- package/dist/types/utils/rules-logic.d.ts.map +1 -1
- package/package.json +32 -6
- package/dist/experience-instance-Ddk4Jktn.cjs +0 -1
- package/dist/rules-logic-CXr4wXcG.cjs +0 -1
- package/dist/types/utils/node-tree/get-next-node-from-conditional.d.ts +0 -3
- package/dist/types/utils/node-tree/get-next-node-from-conditional.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-submit-pipeline.d.ts","sourceRoot":"","sources":["../../../src/form/create-submit-pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAA;AAC7F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"create-submit-pipeline.d.ts","sourceRoot":"","sources":["../../../src/form/create-submit-pipeline.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,OAAO,EAOL,KAAK,KAAK,EACV,KAAK,aAAa,EAClB,KAAK,KAAK,EACX,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAA;AAC7F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAGvC,MAAM,MAAM,4BAA4B,GAAG,WAAW,GAAG;IACvD,aAAa,EAAE,WAA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AI,CAAA;IACpD,OAAO,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,MAAM,IAAI,CAAA;IAChD;;;;OAIG;IACH,aAAa,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;IAC1B;;;OAGG;IACH,wBAAwB,EAAE,KAAK,CAAC,eAAe,EAAE,CAAC,CAAA;CACnD;AA2CD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,MAAM,EACN,kBAAkB,EAClB,MAAM,EACN,KAAK,EACL,SAAS,EACT,WAAW,EACX,YAAY,GACb,EAAE,oBAAoB,GAAG,cAAc,CAiMvC"}
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { Field } from '../entities/field/field';
|
|
2
2
|
import { Picked } from '../picked';
|
|
3
3
|
import { evaluateRuleLogic } from '../utils/rules-logic';
|
|
4
|
+
/**
|
|
5
|
+
* Evaluates field and option conditions, returning only the fields that should be visible.
|
|
6
|
+
*
|
|
7
|
+
* @template T
|
|
8
|
+
* @param {Picked} client - The Picked client instance for condition evaluation.
|
|
9
|
+
* @param {T[]} fields - The fields to filter by their conditions.
|
|
10
|
+
* @param {Parameters<typeof evaluateRuleLogic>[2]} [context] - Optional context object passed to the rule evaluator.
|
|
11
|
+
* @returns {Promise<T[]>} The filtered array of visible fields with conditional options resolved.
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const visibleFields = await getStepFields(client, step.fields, { cartTotal: 50 })
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
4
17
|
export declare function getStepFields<T extends Field>(client: Picked, fields: T[], context?: Parameters<typeof evaluateRuleLogic>[2]): Promise<T[]>;
|
|
5
18
|
//# sourceMappingURL=get-step-fields.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-step-fields.d.ts","sourceRoot":"","sources":["../../../src/form/get-step-fields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"get-step-fields.d.ts","sourceRoot":"","sources":["../../../src/form/get-step-fields.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AA8CxD;;;;;;;;;;;;GAYG;AACH,wBAAsB,aAAa,CAAC,CAAC,SAAS,KAAK,EACjD,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,CAAC,EAAE,EACX,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAChD,OAAO,CAAC,CAAC,EAAE,CAAC,CAoDd"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export * from './exports';
|
|
2
2
|
export type * from './client';
|
|
3
3
|
export type * from './entities/action/action';
|
|
4
|
+
export type * from './entities/condition/condition';
|
|
4
5
|
export type * from './entities/component/component';
|
|
5
6
|
export type * from './entities/component/lazyComponent';
|
|
6
7
|
export type * from './entities/experience-instance/experience-instance';
|
|
7
8
|
export type * from './entities/experience/experience';
|
|
9
|
+
export type * from './entities/step/step';
|
|
8
10
|
export type * from './entities/feature/feature';
|
|
9
11
|
export type * from './entities/field/field';
|
|
10
12
|
export type * from './entities/framework/framework';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,mBAAmB,UAAU,CAAA;AAC7B,mBAAmB,0BAA0B,CAAA;AAC7C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,oCAAoC,CAAA;AACvD,mBAAmB,oDAAoD,CAAA;AACvE,mBAAmB,kCAAkC,CAAA;AACrD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,wBAAwB,CAAA;AAC3C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,0BAA0B,CAAA;AAC7C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,uBAAuB,CAAA;AAC1C,mBAAmB,gBAAgB,CAAA;AACnC,mBAAmB,uBAAuB,CAAA;AAC1C,mBAAmB,8BAA8B,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,mBAAmB,UAAU,CAAA;AAC7B,mBAAmB,0BAA0B,CAAA;AAC7C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,oCAAoC,CAAA;AACvD,mBAAmB,oDAAoD,CAAA;AACvE,mBAAmB,kCAAkC,CAAA;AACrD,mBAAmB,sBAAsB,CAAA;AACzC,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,wBAAwB,CAAA;AAC3C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,0BAA0B,CAAA;AAC7C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,uBAAuB,CAAA;AAC1C,mBAAmB,gBAAgB,CAAA;AACnC,mBAAmB,uBAAuB,CAAA;AAC1C,mBAAmB,8BAA8B,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* @file Async implementation of json-logic-js.
|
|
3
3
|
*
|
|
4
|
-
* For the original implementation, see https://github.com/jwadhams/json-logic-js
|
|
4
|
+
* For the original implementation, see https://github.com/jwadhams/json-logic-js.
|
|
5
5
|
*/
|
|
6
6
|
export type SyncLogicValue = string | number | boolean | null | undefined | LogicArray | LogicObject;
|
|
7
7
|
export type LogicValue = SyncLogicValue | (() => LogicValue) | (() => Promise<SyncLogicValue>) | Promise<SyncLogicValue>;
|
|
@@ -16,6 +16,14 @@ export interface LogicRule {
|
|
|
16
16
|
export type LogicContext = {
|
|
17
17
|
[key: string]: LogicValue;
|
|
18
18
|
} | LogicValue;
|
|
19
|
+
/**
|
|
20
|
+
* Evaluates a JSON Logic expression against a data context.
|
|
21
|
+
*
|
|
22
|
+
* @param {LogicObject | LogicValue | undefined} logic - The JSON Logic expression to evaluate.
|
|
23
|
+
* @param {LogicContext} [data] - The data context for variable resolution.
|
|
24
|
+
* @returns {Promise<LogicValue>} The result of evaluating the expression.
|
|
25
|
+
* @example apply({ '==': [{ var: 'x' }, 1] }, { x: 1 }) // true
|
|
26
|
+
*/
|
|
19
27
|
export declare function apply(logic: LogicObject | LogicValue | undefined, data?: LogicContext): Promise<LogicValue>;
|
|
20
28
|
export {};
|
|
21
29
|
//# sourceMappingURL=logic-engine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logic-engine.d.ts","sourceRoot":"","sources":["../../src/logic-engine.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,GAAG,UAAU,GAAG,WAAW,CAAA;AAEpG,MAAM,MAAM,UAAU,GAClB,cAAc,GACd,CAAC,MAAM,UAAU,CAAC,GAClB,CAAC,MAAM,OAAO,CAAC,cAAc,CAAC,CAAC,GAC/B,OAAO,CAAC,cAAc,CAAC,CAAA;AAE3B,MAAM,WAAW,WAAW;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAA;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;;GAOG;AAEH,wBAAsB,KAAK,CACzB,KAAK,EAAE,WAAW,GAAG,UAAU,GAAG,SAAS,EAC3C,IAAI,CAAC,EAAE,YAAY,GAClB,OAAO,CAAC,UAAU,CAAC,CAmJrB"}
|
package/dist/types/picked.d.ts
CHANGED
|
@@ -8,7 +8,9 @@ import { Predicate } from './entities/predicate/predicate';
|
|
|
8
8
|
import { Feature } from './entities/feature/feature';
|
|
9
9
|
import { EventBusPayload, EventHistoryStore } from './utils/events';
|
|
10
10
|
import { Field } from './entities/field/field';
|
|
11
|
+
import { ExperienceStep } from './entities/step/step';
|
|
11
12
|
import { Action } from './entities/action/action';
|
|
13
|
+
import { Condition } from './entities/condition/condition';
|
|
12
14
|
import { SessionStore } from './utils/user-session';
|
|
13
15
|
import { LogicRule } from './logic-engine';
|
|
14
16
|
export declare class Picked {
|
|
@@ -65,8 +67,10 @@ export declare class Picked {
|
|
|
65
67
|
};
|
|
66
68
|
readonly experiences: {
|
|
67
69
|
register: (experience: Experience) => void;
|
|
68
|
-
get: (
|
|
70
|
+
get: (key: string) => import('effector').Store<{
|
|
69
71
|
id: string;
|
|
72
|
+
key: string;
|
|
73
|
+
name: string;
|
|
70
74
|
configStore: import('effector').Store<{
|
|
71
75
|
name: string;
|
|
72
76
|
decisionLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
@@ -74,12 +78,11 @@ export declare class Picked {
|
|
|
74
78
|
initializeOpenLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
75
79
|
}>;
|
|
76
80
|
treeStore: import('effector').Store<{
|
|
77
|
-
steps:
|
|
81
|
+
steps: ExperienceStep[];
|
|
78
82
|
nodes: import('.').ExperienceNode[];
|
|
79
83
|
edges: import('.').ExperienceEdge[];
|
|
80
|
-
|
|
84
|
+
conditions: Condition[];
|
|
81
85
|
}>;
|
|
82
|
-
fieldsStore: import('effector').Store<Field[]>;
|
|
83
86
|
componentStore: import('effector').Store<{
|
|
84
87
|
name: string;
|
|
85
88
|
component: AdaptedComponent<string, unknown>;
|
|
@@ -91,8 +94,10 @@ export declare class Picked {
|
|
|
91
94
|
strategy: "override";
|
|
92
95
|
}>;
|
|
93
96
|
} | undefined>;
|
|
94
|
-
getById: (
|
|
97
|
+
getById: (key: string) => import('effector').Store<{
|
|
95
98
|
id: string;
|
|
99
|
+
key: string;
|
|
100
|
+
name: string;
|
|
96
101
|
configStore: import('effector').Store<{
|
|
97
102
|
name: string;
|
|
98
103
|
decisionLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
@@ -100,12 +105,11 @@ export declare class Picked {
|
|
|
100
105
|
initializeOpenLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
101
106
|
}>;
|
|
102
107
|
treeStore: import('effector').Store<{
|
|
103
|
-
steps:
|
|
108
|
+
steps: ExperienceStep[];
|
|
104
109
|
nodes: import('.').ExperienceNode[];
|
|
105
110
|
edges: import('.').ExperienceEdge[];
|
|
106
|
-
|
|
111
|
+
conditions: Condition[];
|
|
107
112
|
}>;
|
|
108
|
-
fieldsStore: import('effector').Store<Field[]>;
|
|
109
113
|
componentStore: import('effector').Store<{
|
|
110
114
|
name: string;
|
|
111
115
|
component: AdaptedComponent<string, unknown>;
|
|
@@ -118,15 +122,19 @@ export declare class Picked {
|
|
|
118
122
|
}>;
|
|
119
123
|
} | undefined>;
|
|
120
124
|
launch: import('effector').Effect<{
|
|
121
|
-
|
|
125
|
+
key?: string;
|
|
126
|
+
id?: string;
|
|
122
127
|
options?: LaunchExperienceOptions;
|
|
123
128
|
}, void, Error>;
|
|
124
129
|
open: import('effector').Effect<{
|
|
125
|
-
|
|
130
|
+
key?: string;
|
|
131
|
+
id?: string;
|
|
126
132
|
options?: import('./exports').OpenExperienceOptions;
|
|
127
133
|
}, void, Error>;
|
|
128
134
|
listStore: import('effector').Store<{
|
|
129
135
|
id: string;
|
|
136
|
+
key: string;
|
|
137
|
+
name: string;
|
|
130
138
|
configStore: import('effector').Store<{
|
|
131
139
|
name: string;
|
|
132
140
|
decisionLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
@@ -134,12 +142,11 @@ export declare class Picked {
|
|
|
134
142
|
initializeOpenLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
135
143
|
}>;
|
|
136
144
|
treeStore: import('effector').Store<{
|
|
137
|
-
steps:
|
|
145
|
+
steps: ExperienceStep[];
|
|
138
146
|
nodes: import('.').ExperienceNode[];
|
|
139
147
|
edges: import('.').ExperienceEdge[];
|
|
140
|
-
|
|
148
|
+
conditions: Condition[];
|
|
141
149
|
}>;
|
|
142
|
-
fieldsStore: import('effector').Store<Field[]>;
|
|
143
150
|
componentStore: import('effector').Store<{
|
|
144
151
|
name: string;
|
|
145
152
|
component: AdaptedComponent<string, unknown>;
|
|
@@ -173,10 +180,24 @@ export declare class Picked {
|
|
|
173
180
|
listStore: import('effector').Store<import('.').FeatureBucket[]>;
|
|
174
181
|
getEvokableFeature: (featureName: string) => import('effector').Store<() => Promise<boolean | string | undefined>>;
|
|
175
182
|
};
|
|
183
|
+
readonly conditions: {
|
|
184
|
+
register: (condition: Condition) => void;
|
|
185
|
+
getById: (id: Condition["id"]) => import('effector').Store<Condition | null>;
|
|
186
|
+
getByKey: (key: Condition["key"]) => import('effector').Store<Condition | null>;
|
|
187
|
+
listStore: import('effector').Store<Condition[]>;
|
|
188
|
+
};
|
|
189
|
+
readonly fields: {
|
|
190
|
+
register: (field: Field) => void;
|
|
191
|
+
update: (fieldKeyOrId: string, updates: Partial<Field>) => void;
|
|
192
|
+
getById: (id: import('.').FieldBase["id"]) => import('effector').Store<Field | null>;
|
|
193
|
+
getByKey: (key: import('.').FieldBase["key"]) => import('effector').Store<Field | null>;
|
|
194
|
+
listStore: import('effector').Store<Field[]>;
|
|
195
|
+
getByName: (name: import('.').FieldBase["name"]) => import('effector').Store<Field | null>;
|
|
196
|
+
};
|
|
176
197
|
readonly responses: {
|
|
177
198
|
register: {
|
|
178
|
-
(
|
|
179
|
-
(payload: Record<Field["
|
|
199
|
+
(fieldKey: Field["key"], response: import('.').Response): void;
|
|
200
|
+
(payload: Record<Field["key"], import('.').Response>, response?: never): void;
|
|
180
201
|
};
|
|
181
202
|
clearAll: import('effector').EventCallable<void>;
|
|
182
203
|
clear: import('effector').EventCallable<string>;
|
|
@@ -189,23 +210,20 @@ export declare class Picked {
|
|
|
189
210
|
}>;
|
|
190
211
|
listStore: import('effector').Store<{
|
|
191
212
|
fieldId: string;
|
|
192
|
-
|
|
213
|
+
fieldKey: string;
|
|
214
|
+
value: import('.').FieldValue;
|
|
193
215
|
}[]>;
|
|
194
216
|
getAllStore: import('effector').Store<{
|
|
195
|
-
[
|
|
217
|
+
[fieldKey: string]: import('.').FieldValue;
|
|
196
218
|
}>;
|
|
197
|
-
getByFieldId:
|
|
198
|
-
|
|
199
|
-
<T extends import('.').JsonValue>(fieldId: Field["id"]): import('effector').Store<T | null>;
|
|
200
|
-
};
|
|
219
|
+
getByFieldId: (fieldIdOrKey: string) => import('effector').Store<import('.').FieldValue>;
|
|
220
|
+
getByFieldKey: (key: Field["key"]) => import('effector').Store<import('.').FieldValue>;
|
|
201
221
|
getByFieldName: (fieldName: Field["name"]) => import('effector').Store<import('.').FieldValue>;
|
|
202
222
|
};
|
|
203
|
-
readonly
|
|
204
|
-
register: (
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
listStore: import('effector').Store<Field[]>;
|
|
208
|
-
getByName: (name: import('.').FieldBase["name"]) => import('effector').Store<Field | null>;
|
|
223
|
+
readonly steps: {
|
|
224
|
+
register: (step: ExperienceStep) => void;
|
|
225
|
+
getById: (id: ExperienceStep["id"]) => import('effector').Store<ExperienceStep | null>;
|
|
226
|
+
listStore: import('effector').Store<ExperienceStep[]>;
|
|
209
227
|
};
|
|
210
228
|
readonly actions: {
|
|
211
229
|
register: (name: string, action: Action) => void;
|
|
@@ -220,13 +238,34 @@ export declare class Picked {
|
|
|
220
238
|
registerPlugin: (plugin: Plugin) => void;
|
|
221
239
|
registerFeature: (name: string, feature: Feature) => void;
|
|
222
240
|
registerPredicate: (name: string, predicate: Predicate) => void;
|
|
241
|
+
registerCondition: (condition: Condition) => void;
|
|
223
242
|
registerField: (field: Field) => void;
|
|
243
|
+
registerStep: (step: ExperienceStep) => void;
|
|
224
244
|
registerAction: (name: string, action: Action) => void;
|
|
225
245
|
registerExperience: (experience: Experience) => void;
|
|
226
246
|
getStateSnapshot: () => StateSnapshot;
|
|
227
|
-
/**
|
|
247
|
+
/**
|
|
248
|
+
* Launches an experience by ID.
|
|
249
|
+
*
|
|
250
|
+
* @deprecated Use `client.experiences.launch({ key: experienceKey })` instead.
|
|
251
|
+
* @param experienceKey - The experience key to launch.
|
|
252
|
+
* @param options - Optional launch options.
|
|
253
|
+
* @example
|
|
254
|
+
* ```typescript
|
|
255
|
+
* await client.launchExperienceById('exp-1')
|
|
256
|
+
* ```
|
|
257
|
+
*/
|
|
228
258
|
launchExperienceById: (experienceId: string, options?: LaunchExperienceOptions) => Promise<void>;
|
|
229
|
-
/**
|
|
259
|
+
/**
|
|
260
|
+
* Opens an experience by ID.
|
|
261
|
+
*
|
|
262
|
+
* @deprecated Use `client.experiences.open({ key: experienceKey })` instead.
|
|
263
|
+
* @param experienceId - The experience ID to open.
|
|
264
|
+
* @example
|
|
265
|
+
* ```typescript
|
|
266
|
+
* await client.openExperienceById('exp-1')
|
|
267
|
+
* ```
|
|
268
|
+
*/
|
|
230
269
|
openExperienceById: (experienceId: string) => Promise<void>;
|
|
231
270
|
private runPluginStartHooks;
|
|
232
271
|
private evaluateGate;
|
|
@@ -265,15 +304,12 @@ export declare class Picked {
|
|
|
265
304
|
* @param template Template containing placeholders.
|
|
266
305
|
* @param context Optional data for interpolation. Non-responses.* keys belong here; function values are executed.
|
|
267
306
|
* @returns Interpolated string.
|
|
268
|
-
*
|
|
269
307
|
* @example
|
|
270
308
|
* renderString("Hello {{ name | default: 'Guest' | capitalize }}! Email: {{ responses.email | lower }}.", { name: "ALICE" })
|
|
271
309
|
* // => "Hello Alice! Email: alice@example.com."
|
|
272
|
-
*
|
|
273
310
|
* @example
|
|
274
311
|
* renderString("User: {{ getName | capitalize }}", { getName: () => "alice" })
|
|
275
312
|
* // => "User: Alice"
|
|
276
|
-
*
|
|
277
313
|
* @example
|
|
278
314
|
* renderString("Fruits: {{ fruits | list }}", { fruits: ["apple", "banana", "cherry"] })
|
|
279
315
|
* // => "Fruits: apple, banana, and cherry"
|
|
@@ -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":"AAEA,OAAO,EAEL,KAAK,UAAU,EAEf,KAAK,uBAAuB,EAC7B,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,iBAAiB,EAAe,MAAM,0BAA0B,CAAA;AAC3F,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAEL,KAAK,SAAS,EAEf,MAAM,gCAAgC,CAAA;AAGvC,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAA;AAE/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAKzD,OAAO,EAAsB,KAAK,eAAe,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACjG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AAGtD,OAAO,EAAE,KAAK,SAAS,EAAwB,MAAM,gCAAgC,CAAA;AAKrF,OA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CAAC,eAAe;IAgBvB,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,eAAe;IAWvB,eAAe,GAAI,YAAY,MAAM,KAAG,iBAAiB,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAE1F;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACH,YAAY,GAAI,UAAU,MAAM,EAAE,UAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,MAAM,CAY3E;CACF"}
|
|
@@ -1,28 +1,40 @@
|
|
|
1
|
-
import { ActionNode, Experience,
|
|
1
|
+
import { ActionNode, Experience, ExperienceEdge, ExperienceNode, ExperienceTarget } from '../../entities/experience/experience';
|
|
2
|
+
import { ExperienceStep } from '../../entities/step/step';
|
|
3
|
+
import { Condition } from '../../entities/condition/condition';
|
|
2
4
|
import { AdaptedComponent } from '../../entities/component/component';
|
|
3
5
|
import { LogicRule, LogicValue } from '../../logic-engine';
|
|
4
6
|
import { Field, FieldBooleanMultiple, FieldBooleanSingular, FieldNumberMultiple, FieldNumberSingular, FieldObjectMultiple, FieldObjectSingular, FieldTextMultiple, FieldTextSingular, JsonValue } from '../../entities/field/field';
|
|
5
7
|
import { Serialized } from './serialization';
|
|
8
|
+
export interface SerializedExperience extends Experience {
|
|
9
|
+
steps: ExperienceStep[];
|
|
10
|
+
conditions: Condition[];
|
|
11
|
+
fields: Field[];
|
|
12
|
+
}
|
|
6
13
|
export interface Nodeable {
|
|
7
14
|
node: SerializableNode | null;
|
|
8
15
|
}
|
|
9
16
|
export interface SerializableStep extends Nodeable {
|
|
10
17
|
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
key: string;
|
|
11
20
|
label: string;
|
|
12
21
|
fields: SerializableField[];
|
|
13
22
|
experience: SerializableExperience;
|
|
14
23
|
nextStep: (stepOptions: CreateStepOptions | SerializableStep) => SerializableStep;
|
|
15
|
-
|
|
24
|
+
nextCondition: (conditionOptions: CreateConditionOptions | SerializableCondition) => SerializableCondition;
|
|
25
|
+
/** @deprecated Use `nextCondition` instead. */
|
|
26
|
+
nextConditional: (conditionOptions: CreateConditionOptions | SerializableCondition) => SerializableCondition;
|
|
16
27
|
addNextExperience: (experience: SerializableExperience) => SerializableExperience;
|
|
17
28
|
addField: (fieldOptions: CreateFieldOptions | SerializableField) => SerializableField;
|
|
18
29
|
serialize: () => Serialized<ExperienceStep>;
|
|
19
30
|
}
|
|
20
31
|
export interface CreateStepOptions {
|
|
21
32
|
id?: string;
|
|
22
|
-
|
|
33
|
+
key?: string;
|
|
34
|
+
name: string;
|
|
23
35
|
fields?: SerializableField[];
|
|
24
36
|
}
|
|
25
|
-
export type SerializableNode = SerializableStepNode |
|
|
37
|
+
export type SerializableNode = SerializableStepNode | SerializableConditionNode | SerializableLaunchExperienceNode | SerializableOriginNode | SerializableActionNode;
|
|
26
38
|
export interface SerializableActionNode extends SerializableBaseNode {
|
|
27
39
|
type: 'action';
|
|
28
40
|
action: string;
|
|
@@ -44,9 +56,9 @@ export interface SerializableStepNode extends SerializableBaseNode {
|
|
|
44
56
|
type: 'step';
|
|
45
57
|
connectedStep: SerializableStep;
|
|
46
58
|
}
|
|
47
|
-
export interface
|
|
48
|
-
type: '
|
|
49
|
-
|
|
59
|
+
export interface SerializableConditionNode extends SerializableBaseNode {
|
|
60
|
+
type: 'condition';
|
|
61
|
+
connectedCondition: SerializableCondition;
|
|
50
62
|
}
|
|
51
63
|
export interface SerializableLaunchExperienceNode extends SerializableBaseNode {
|
|
52
64
|
type: 'experience';
|
|
@@ -59,8 +71,8 @@ export type CreateNodeOptions = {
|
|
|
59
71
|
step: SerializableStep;
|
|
60
72
|
type: 'step';
|
|
61
73
|
} | {
|
|
62
|
-
|
|
63
|
-
type: '
|
|
74
|
+
condition: SerializableCondition;
|
|
75
|
+
type: 'condition';
|
|
64
76
|
} | {
|
|
65
77
|
type: 'origin';
|
|
66
78
|
} | {
|
|
@@ -83,20 +95,26 @@ export interface CreateEdgeOptions {
|
|
|
83
95
|
sourceNodeHandle: 'true' | 'false' | null;
|
|
84
96
|
destinationNode: SerializableNode;
|
|
85
97
|
}
|
|
86
|
-
export interface
|
|
98
|
+
export interface SerializableCondition extends Nodeable {
|
|
87
99
|
id: string;
|
|
100
|
+
key: string;
|
|
101
|
+
name: string;
|
|
88
102
|
label?: string;
|
|
89
|
-
|
|
103
|
+
logic: LogicRule;
|
|
90
104
|
experience: SerializableExperience;
|
|
91
105
|
addTrue: (nodeable: Nodeable) => undefined;
|
|
92
106
|
addFalse: (nodeable: Nodeable) => undefined;
|
|
93
|
-
serialize: () => Serialized<
|
|
107
|
+
serialize: () => Serialized<Condition>;
|
|
94
108
|
}
|
|
95
|
-
export interface
|
|
109
|
+
export interface CreateConditionOptions {
|
|
96
110
|
condition: LogicRule;
|
|
111
|
+
name?: string;
|
|
112
|
+
key?: string;
|
|
97
113
|
label?: string;
|
|
98
114
|
}
|
|
99
|
-
export type CreateFieldOptions = Omit<Field, 'options' | 'placeholder' | 'description' | 'helpText' | 'validation' | 'policies' | 'defaultValue'> & {
|
|
115
|
+
export type CreateFieldOptions = Omit<Field, 'id' | 'key' | 'options' | 'placeholder' | 'description' | 'helpText' | 'validation' | 'policies' | 'defaultValue'> & {
|
|
116
|
+
id?: string;
|
|
117
|
+
key?: string;
|
|
100
118
|
defaultValue?: string | number | boolean | object | null | string[] | number[] | boolean[] | object[];
|
|
101
119
|
placeholder?: string;
|
|
102
120
|
description?: string;
|
|
@@ -110,6 +128,7 @@ export type CreateFieldOptions = Omit<Field, 'options' | 'placeholder' | 'descri
|
|
|
110
128
|
};
|
|
111
129
|
export type SerializableField<T extends JsonValue = JsonValue> = {
|
|
112
130
|
id: string;
|
|
131
|
+
key: string;
|
|
113
132
|
name: string;
|
|
114
133
|
label: string;
|
|
115
134
|
type: 'text' | 'number' | 'object' | 'boolean';
|
|
@@ -132,17 +151,12 @@ export type SerializableField<T extends JsonValue = JsonValue> = {
|
|
|
132
151
|
value: JsonValue;
|
|
133
152
|
condition?: LogicRule;
|
|
134
153
|
}[] | null;
|
|
135
|
-
/**
|
|
136
|
-
* Phantom type property for TypeScript type inference.
|
|
137
|
-
* This property never exists at runtime but enables type-safe field value access.
|
|
138
|
-
* @internal
|
|
139
|
-
*/
|
|
140
|
-
__fieldType?: T;
|
|
141
154
|
} & {
|
|
142
155
|
serialize: () => Serialized<Field>;
|
|
143
156
|
};
|
|
144
157
|
export interface SerializableExperience {
|
|
145
158
|
id: string;
|
|
159
|
+
key: string;
|
|
146
160
|
component?: AdaptedComponent;
|
|
147
161
|
name: string;
|
|
148
162
|
condition?: LogicRule | LogicValue;
|
|
@@ -152,13 +166,17 @@ export interface SerializableExperience {
|
|
|
152
166
|
nodes: SerializableNode[];
|
|
153
167
|
edges: SerializableEdge[];
|
|
154
168
|
fields: SerializableField[];
|
|
155
|
-
|
|
169
|
+
conditions: SerializableCondition[];
|
|
156
170
|
addStep: (stepOptions: CreateStepOptions | SerializableStep | OrphanStep, after?: {
|
|
157
171
|
node: SerializableNode | null;
|
|
158
172
|
}) => SerializableStep;
|
|
159
|
-
|
|
173
|
+
addCondition: (conditionOptions: CreateConditionOptions | SerializableCondition, after?: {
|
|
160
174
|
node: SerializableNode | null;
|
|
161
|
-
}) =>
|
|
175
|
+
}) => SerializableCondition;
|
|
176
|
+
/** @deprecated Use `addCondition` instead. */
|
|
177
|
+
addConditional: (conditionOptions: CreateConditionOptions | SerializableCondition, after?: {
|
|
178
|
+
node: SerializableNode | null;
|
|
179
|
+
}) => SerializableCondition;
|
|
162
180
|
addExperience: (experience: SerializableExperience, after?: {
|
|
163
181
|
node: SerializableNode | null;
|
|
164
182
|
}) => SerializableExperience;
|
|
@@ -166,29 +184,33 @@ export interface SerializableExperience {
|
|
|
166
184
|
addAction: (actionOptions: CreateActionOptions | SerializableActionNode, after?: {
|
|
167
185
|
node: SerializableNode | null;
|
|
168
186
|
}) => SerializableActionNode;
|
|
169
|
-
serialize: () => Serialized<
|
|
187
|
+
serialize: () => Serialized<SerializedExperience>;
|
|
170
188
|
}
|
|
171
189
|
export interface CreateExperienceOptions {
|
|
172
190
|
id: string;
|
|
191
|
+
key: string;
|
|
173
192
|
name: string;
|
|
174
193
|
condition?: LogicRule | LogicValue;
|
|
175
194
|
initializeOpen?: LogicRule | LogicValue;
|
|
176
195
|
targets: ExperienceTarget[];
|
|
177
196
|
component?: AdaptedComponent;
|
|
178
197
|
}
|
|
179
|
-
export type OrphanStep = Omit<SerializableStep, 'nextStep' | 'nextConditional' | 'addNextExperience' | 'node' | 'serialize' | 'addField' | 'experience'> & {
|
|
198
|
+
export type OrphanStep = Omit<SerializableStep, 'nextStep' | 'nextCondition' | 'nextConditional' | 'addNextExperience' | 'node' | 'serialize' | 'addField' | 'experience'> & {
|
|
180
199
|
addField: (fieldOrFieldOptions: CreateFieldOptions | SerializableField) => void;
|
|
181
200
|
};
|
|
182
201
|
export declare const createStep: (stepOptions: CreateStepOptions) => OrphanStep;
|
|
183
202
|
export declare const bindExperienceStep: (stepOptions: CreateStepOptions | OrphanStep, experience: SerializableExperience) => SerializableStep;
|
|
184
203
|
export declare const createNode: (nodeOptions: CreateNodeOptions, experience: SerializableExperience) => SerializableNode;
|
|
185
204
|
export declare const createEdge: (edgeOptions: CreateEdgeOptions, experience: SerializableExperience) => SerializableEdge;
|
|
186
|
-
export declare const
|
|
205
|
+
export declare const createCondition: (conditionOptions: CreateConditionOptions, experience: SerializableExperience) => SerializableCondition;
|
|
206
|
+
/** @deprecated Use `createCondition` instead. */
|
|
207
|
+
export declare const createConditional: (conditionOptions: CreateConditionOptions, experience: SerializableExperience) => SerializableCondition;
|
|
187
208
|
/**
|
|
188
209
|
* Creates a field with optional generic type parameter for object field type safety.
|
|
189
|
-
*
|
|
190
|
-
* @
|
|
191
|
-
* @
|
|
210
|
+
*
|
|
211
|
+
* @template T - The type of the object field value (only applicable for type: 'object').
|
|
212
|
+
* @param {CreateFieldOptions} fieldOptions - The field configuration options.
|
|
213
|
+
* @returns {SerializableField<T>} A serializable field with type information.
|
|
192
214
|
* @example
|
|
193
215
|
* ```typescript
|
|
194
216
|
* // Without type parameter (default JsonValue)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-experience.d.ts","sourceRoot":"","sources":["../../../../src/plugins/create-experience/create-experience.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EAEV,UAAU,EACV,
|
|
1
|
+
{"version":3,"file":"create-experience.d.ts","sourceRoot":"","sources":["../../../../src/plugins/create-experience/create-experience.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,OAAO,KAAK,EACV,UAAU,EAEV,UAAU,EACV,cAAc,EACd,cAAc,EACd,gBAAgB,EAGjB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAA;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;AAE1E,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/D,OAAO,KAAK,EACV,KAAK,EACL,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EACV,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEhE,MAAM,WAAW,oBAAqB,SAAQ,UAAU;IACtD,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,UAAU,EAAE,SAAS,EAAE,CAAA;IACvB,MAAM,EAAE,KAAK,EAAE,CAAA;CAChB;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAAA;CAC9B;AAED,MAAM,WAAW,gBAAiB,SAAQ,QAAQ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IACvC,OAAO,EAAE,gBAAgB,EAAE,CAAA;IAC3B,SAAS,CAAC,EAAE,gBAAgB,CAAA;CAC7B;AAED,MAAM,MAAM,UAAU,GAAG,IAAI,CAC3B,gBAAgB,EACd,UAAU,GACV,eAAe,GACf,iBAAiB,GACjB,mBAAmB,GACnB,MAAM,GACN,WAAW,GACX,UAAU,GACV,YAAY,CACf,GAAG;IACF,QAAQ,EAAE,CAAC,mBAAmB,EAAE,kBAAkB,GAAG,iBAAiB,KAAK,IAAI,CAAA;CAChF,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,aAAa,iBAAiB,KAAG,UAqB3D,CAAA;AAED,eAAO,MAAM,kBAAkB,GAC7B,aAAa,iBAAiB,GAAG,UAAU,EAC3C,YAAY,sBAAsB,KACjC,gBA0CF,CAAA;AAED,eAAO,MAAM,UAAU,GACrB,aAAa,iBAAiB,EAC9B,YAAY,sBAAsB,KACjC,gBA2EF,CAAA;AAED,eAAO,MAAM,UAAU,GACrB,aAAa,iBAAiB,EAC9B,YAAY,sBAAsB,KACjC,gBAkBF,CAAA;AAED,eAAO,MAAM,eAAe,GAC1B,kBAAkB,sBAAsB,EACxC,YAAY,sBAAsB,KACjC,qBAmDF,CAAA;AAED,iDAAiD;AACjD,eAAO,MAAM,iBAAiB,qBAxDV,sBAAsB,cAC5B,sBAAsB,KACjC,qBAsD6C,CAAA;AAEhD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,SAAS,GAAG,SAAS,EACzD,cAAc,kBAAkB,KAC/B,iBAAiB,CAAC,CAAC,CAsOrB,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,YAAY,uBAAuB,KAAG,sBA4LtE,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
/** @file Public API for the create-experience plugin. */
|
|
1
2
|
export { createExperiencePlugin } from './plugin';
|
|
2
3
|
export type * from './plugin';
|
|
3
4
|
export type * from './create-experience';
|
|
4
|
-
export {
|
|
5
|
-
export { serialization } from './serialization';
|
|
5
|
+
export { createCondition, createEdge, createExperience, createNode, createField, createStep, } from './create-experience';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/create-experience/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AACjD,mBAAmB,UAAU,CAAA;AAC7B,mBAAmB,qBAAqB,CAAA;AACxC,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/create-experience/index.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AACjD,mBAAmB,UAAU,CAAA;AAC7B,mBAAmB,qBAAqB,CAAA;AACxC,OAAO,EACL,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,UAAU,GACX,MAAM,qBAAqB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/create-experience/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/create-experience/plugin.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAE1D,OAAO,KAAK,EAAwB,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAGvF,UAAU,6BAA6B;IACrC,WAAW,EAAE,sBAAsB,EAAE,CAAA;CACtC;AAED,eAAO,MAAM,sBAAsB,GAAI,SAAS,6BAA6B,KAAG,MA0B/E,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialization.d.ts","sourceRoot":"","sources":["../../../../src/plugins/create-experience/serialization.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serialization.d.ts","sourceRoot":"","sources":["../../../../src/plugins/create-experience/serialization.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAGlF,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,MAAM,CAAA;AAElC,eAAO,MAAM,aAAa;cACd,CAAC,OAAO,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;gBAGvB,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC;CAGtC,CAAA"}
|
|
@@ -1,13 +1,30 @@
|
|
|
1
1
|
import { Plugin } from '../../entities/plugin/plugin';
|
|
2
2
|
import { DynamicExperiencesPluginOptions, FetchProjectOptions, ProjectConfig } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Fetches the project configuration from the Picked REST API.
|
|
5
|
+
*
|
|
6
|
+
* Returns `null` on network failure, non-OK responses, or invalid JSON shape.
|
|
7
|
+
* Connection-refused errors from local URLs are suppressed silently.
|
|
8
|
+
*
|
|
9
|
+
* @param apiUrl - Base URL for the Picked API.
|
|
10
|
+
* @param projectId - Project ID to fetch config for.
|
|
11
|
+
* @param options - Optional headers and preview token.
|
|
12
|
+
* @returns Validated project config, or `null` on any failure.
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const config = await fetchProject('https://api.picked.app', 'proj_123')
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
3
18
|
export declare function fetchProject(apiUrl: string, projectId: string, options?: FetchProjectOptions): Promise<ProjectConfig | null>;
|
|
4
19
|
/**
|
|
5
|
-
* Plugin that fetches
|
|
6
|
-
* and
|
|
20
|
+
* Plugin that fetches project configuration from the Picked REST API and registers
|
|
21
|
+
* features, steps, fields, and experiences with the client.
|
|
7
22
|
*
|
|
8
|
-
* Features are fetched during the `onStart` hook, before experience
|
|
9
|
-
*
|
|
23
|
+
* Features are fetched during the `onStart` hook, before experience initialisation.
|
|
24
|
+
* Search param feature overrides take precedence over API-provided values.
|
|
10
25
|
*
|
|
26
|
+
* @param options - Optional plugin configuration.
|
|
27
|
+
* @returns A configured Picked plugin.
|
|
11
28
|
* @example
|
|
12
29
|
* ```typescript
|
|
13
30
|
* import { dynamicExperiencesPlugin } from '@picked/client/plugins/dynamic-experiences'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dynamic-experiences/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAK1D,OAAO,KAAK,EACV,+BAA+B,EAC/B,mBAAmB,EACnB,aAAa,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dynamic-experiences/plugin.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAK1D,OAAO,KAAK,EACV,+BAA+B,EAC/B,mBAAmB,EACnB,aAAa,EAGd,MAAM,SAAS,CAAA;AA2ThB;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAmC/B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,CAAC,EAAE,+BAA+B,GAAG,MAAM,CAgD1F"}
|