@picked/client 0.0.39-next.2 → 0.0.39
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/cjs/index.js +2 -2
- package/dist/cjs/plugins/create-experience/index.js +1 -1
- package/dist/esm/index.js +551 -470
- package/dist/esm/plugins/create-experience/index.js +91 -82
- package/dist/types/entities/field/field.d.ts +31 -55
- package/dist/types/entities/field/field.d.ts.map +1 -1
- package/dist/types/entities/response/response.d.ts +9 -5
- package/dist/types/entities/response/response.d.ts.map +1 -1
- package/dist/types/picked.d.ts +4 -1
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +28 -5
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -6,42 +6,42 @@ const r = {
|
|
|
6
6
|
deserialize(e) {
|
|
7
7
|
return JSON.parse(e);
|
|
8
8
|
}
|
|
9
|
-
},
|
|
9
|
+
}, x = (e) => ({
|
|
10
10
|
name: "create-experience",
|
|
11
11
|
setup: (o) => {
|
|
12
|
-
e.experiences.forEach((
|
|
13
|
-
const
|
|
14
|
-
d.component =
|
|
12
|
+
e.experiences.forEach((s) => {
|
|
13
|
+
const n = s.serialize(), d = r.deserialize(n);
|
|
14
|
+
d.component = s.component, o.registerExperience(d), d.fields.forEach((N) => {
|
|
15
15
|
o.registerField(N);
|
|
16
16
|
});
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
}),
|
|
19
|
+
}), y = (e, o) => ({
|
|
20
20
|
id: f("node"),
|
|
21
21
|
position: [0, 0],
|
|
22
22
|
experience: o,
|
|
23
23
|
type: "action",
|
|
24
24
|
action: e.action,
|
|
25
|
-
addNext(
|
|
26
|
-
if (!
|
|
25
|
+
addNext(n) {
|
|
26
|
+
if (!n.node) throw new Error("Cannot connect to node");
|
|
27
27
|
const d = h(
|
|
28
|
-
{ sourceNode: this, destinationNode:
|
|
28
|
+
{ sourceNode: this, destinationNode: n.node, sourceNodeHandle: null },
|
|
29
29
|
o
|
|
30
30
|
);
|
|
31
31
|
o.edges.push(d);
|
|
32
32
|
},
|
|
33
|
-
onSuccess(
|
|
34
|
-
if (!
|
|
33
|
+
onSuccess(n) {
|
|
34
|
+
if (!n.node) throw new Error("Cannot connect to node");
|
|
35
35
|
const d = h(
|
|
36
|
-
{ sourceNode: this, destinationNode:
|
|
36
|
+
{ sourceNode: this, destinationNode: n.node, sourceNodeHandle: "true" },
|
|
37
37
|
o
|
|
38
38
|
);
|
|
39
39
|
o.edges.push(d);
|
|
40
40
|
},
|
|
41
|
-
onFail(
|
|
42
|
-
if (!
|
|
41
|
+
onFail(n) {
|
|
42
|
+
if (!n.node) throw new Error("Cannot connect to node");
|
|
43
43
|
const d = h(
|
|
44
|
-
{ sourceNode: this, destinationNode:
|
|
44
|
+
{ sourceNode: this, destinationNode: n.node, sourceNodeHandle: "false" },
|
|
45
45
|
o
|
|
46
46
|
);
|
|
47
47
|
o.edges.push(d);
|
|
@@ -54,51 +54,51 @@ const r = {
|
|
|
54
54
|
position: this.position
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
}),
|
|
57
|
+
}), V = (e) => ({
|
|
58
58
|
id: e.id ?? f("step"),
|
|
59
59
|
label: e.label,
|
|
60
60
|
fields: e.fields ?? [],
|
|
61
61
|
addField(o) {
|
|
62
|
-
const
|
|
63
|
-
return this.fields?.includes(
|
|
62
|
+
const s = "serialize" in o ? o : m(o);
|
|
63
|
+
return this.fields?.includes(s) || this.fields?.push(s), s;
|
|
64
64
|
}
|
|
65
|
-
}),
|
|
66
|
-
const
|
|
65
|
+
}), z = (e, o) => {
|
|
66
|
+
const s = {
|
|
67
67
|
id: e.id ?? f("step"),
|
|
68
68
|
label: e.label,
|
|
69
69
|
experience: o,
|
|
70
70
|
fields: e.fields ?? [],
|
|
71
71
|
node: null,
|
|
72
|
-
nextStep(
|
|
73
|
-
return this.experience.addStep(
|
|
72
|
+
nextStep(n) {
|
|
73
|
+
return this.experience.addStep(n, this);
|
|
74
74
|
},
|
|
75
|
-
nextConditional(
|
|
76
|
-
return this.experience.addConditional(
|
|
75
|
+
nextConditional(n) {
|
|
76
|
+
return this.experience.addConditional(n, this);
|
|
77
77
|
},
|
|
78
|
-
addNextExperience(
|
|
79
|
-
return this.experience.addExperience(
|
|
78
|
+
addNextExperience(n) {
|
|
79
|
+
return this.experience.addExperience(n, this);
|
|
80
80
|
},
|
|
81
|
-
addField(
|
|
82
|
-
return this.experience.addField(
|
|
81
|
+
addField(n) {
|
|
82
|
+
return this.experience.addField(n, this);
|
|
83
83
|
},
|
|
84
84
|
serialize() {
|
|
85
85
|
return r.serialize({
|
|
86
86
|
id: this.id,
|
|
87
87
|
label: this.label,
|
|
88
|
-
fieldIds: this.fields.map((
|
|
88
|
+
fieldIds: this.fields.map((n) => n.id)
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
};
|
|
92
|
-
return p({ step:
|
|
93
|
-
},
|
|
94
|
-
const
|
|
92
|
+
return p({ step: s, type: "step" }, o), s;
|
|
93
|
+
}, g = () => [0, 0], p = (e, o) => {
|
|
94
|
+
const s = {
|
|
95
95
|
id: f("node"),
|
|
96
|
-
position:
|
|
96
|
+
position: g(),
|
|
97
97
|
experience: o
|
|
98
98
|
};
|
|
99
99
|
if (e.type === "step") {
|
|
100
100
|
const d = {
|
|
101
|
-
...
|
|
101
|
+
...s,
|
|
102
102
|
type: "step",
|
|
103
103
|
connectedStep: e.step,
|
|
104
104
|
serialize() {
|
|
@@ -115,7 +115,7 @@ const r = {
|
|
|
115
115
|
}
|
|
116
116
|
if (e.type === "conditional") {
|
|
117
117
|
const d = {
|
|
118
|
-
...
|
|
118
|
+
...s,
|
|
119
119
|
type: "conditional",
|
|
120
120
|
connectedConditional: e.conditional,
|
|
121
121
|
serialize() {
|
|
@@ -130,7 +130,7 @@ const r = {
|
|
|
130
130
|
return d.connectedConditional.node = d, d;
|
|
131
131
|
}
|
|
132
132
|
return e.type === "experience" ? {
|
|
133
|
-
...
|
|
133
|
+
...s,
|
|
134
134
|
type: "experience",
|
|
135
135
|
connectedExperience: e.experience,
|
|
136
136
|
serialize() {
|
|
@@ -142,7 +142,7 @@ const r = {
|
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
144
|
} : {
|
|
145
|
-
...
|
|
145
|
+
...s,
|
|
146
146
|
type: "origin",
|
|
147
147
|
serialize() {
|
|
148
148
|
return r.serialize({
|
|
@@ -167,25 +167,25 @@ const r = {
|
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
169
|
}), b = (e, o) => {
|
|
170
|
-
const
|
|
170
|
+
const s = {
|
|
171
171
|
id: f("conditional"),
|
|
172
172
|
condition: e.condition,
|
|
173
173
|
node: null,
|
|
174
174
|
experience: o,
|
|
175
|
-
addTrue(
|
|
176
|
-
if (!this.node || !
|
|
175
|
+
addTrue(n) {
|
|
176
|
+
if (!this.node || !n.node)
|
|
177
177
|
throw new Error("todo no node");
|
|
178
178
|
const d = h(
|
|
179
|
-
{ sourceNode: this.node, destinationNode:
|
|
179
|
+
{ sourceNode: this.node, destinationNode: n.node, sourceNodeHandle: "true" },
|
|
180
180
|
this.experience
|
|
181
181
|
);
|
|
182
182
|
this.experience.edges.push(d);
|
|
183
183
|
},
|
|
184
|
-
addFalse(
|
|
185
|
-
if (!this.node || !
|
|
184
|
+
addFalse(n) {
|
|
185
|
+
if (!this.node || !n.node)
|
|
186
186
|
throw new Error("todo no node");
|
|
187
187
|
const d = h(
|
|
188
|
-
{ sourceNode: this.node, destinationNode:
|
|
188
|
+
{ sourceNode: this.node, destinationNode: n.node, sourceNodeHandle: "false" },
|
|
189
189
|
this.experience
|
|
190
190
|
);
|
|
191
191
|
this.experience.edges.push(d);
|
|
@@ -197,7 +197,7 @@ const r = {
|
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
199
|
};
|
|
200
|
-
return p({ conditional:
|
|
200
|
+
return p({ conditional: s, type: "conditional" }, o), s;
|
|
201
201
|
}, m = (e) => ({
|
|
202
202
|
id: e.id,
|
|
203
203
|
name: e.name,
|
|
@@ -211,12 +211,13 @@ const r = {
|
|
|
211
211
|
validation: e.validation ?? {},
|
|
212
212
|
condition: e.condition,
|
|
213
213
|
required: e.required,
|
|
214
|
-
options: e.options?.map((
|
|
215
|
-
|
|
214
|
+
options: e.options?.map((s) => ({
|
|
215
|
+
id: "id" in s ? s.id : f("option"),
|
|
216
|
+
...s
|
|
216
217
|
})) ?? null,
|
|
217
218
|
policies: e.policies,
|
|
218
219
|
serialize() {
|
|
219
|
-
const
|
|
220
|
+
const s = {
|
|
220
221
|
id: this.id,
|
|
221
222
|
name: this.name,
|
|
222
223
|
label: this.label,
|
|
@@ -227,7 +228,7 @@ const r = {
|
|
|
227
228
|
validation: this.validation,
|
|
228
229
|
condition: this.condition,
|
|
229
230
|
policies: this.policies
|
|
230
|
-
},
|
|
231
|
+
}, n = typeof this.defaultValue == "string" ? this.defaultValue : void 0, d = typeof this.defaultValue == "number" ? this.defaultValue : void 0, N = typeof this.defaultValue == "boolean" ? this.defaultValue : void 0;
|
|
231
232
|
switch (this.type) {
|
|
232
233
|
case "text":
|
|
233
234
|
if (this.multiple) {
|
|
@@ -239,7 +240,7 @@ const r = {
|
|
|
239
240
|
t.length === 0 && (t = void 0);
|
|
240
241
|
}
|
|
241
242
|
return r.serialize({
|
|
242
|
-
...
|
|
243
|
+
...s,
|
|
243
244
|
type: "text",
|
|
244
245
|
multiple: !0,
|
|
245
246
|
defaultValue: t,
|
|
@@ -252,10 +253,10 @@ const r = {
|
|
|
252
253
|
});
|
|
253
254
|
}
|
|
254
255
|
return r.serialize({
|
|
255
|
-
...
|
|
256
|
+
...s,
|
|
256
257
|
type: "text",
|
|
257
258
|
multiple: !1,
|
|
258
|
-
defaultValue:
|
|
259
|
+
defaultValue: n,
|
|
259
260
|
options: this.options ? this.options.map((t) => ({
|
|
260
261
|
id: t.id,
|
|
261
262
|
label: t.label,
|
|
@@ -273,7 +274,7 @@ const r = {
|
|
|
273
274
|
t.length === 0 && (t = void 0);
|
|
274
275
|
}
|
|
275
276
|
return r.serialize({
|
|
276
|
-
...
|
|
277
|
+
...s,
|
|
277
278
|
type: "number",
|
|
278
279
|
multiple: !0,
|
|
279
280
|
defaultValue: t,
|
|
@@ -286,7 +287,7 @@ const r = {
|
|
|
286
287
|
});
|
|
287
288
|
}
|
|
288
289
|
return r.serialize({
|
|
289
|
-
...
|
|
290
|
+
...s,
|
|
290
291
|
type: "number",
|
|
291
292
|
multiple: !1,
|
|
292
293
|
defaultValue: d,
|
|
@@ -307,7 +308,7 @@ const r = {
|
|
|
307
308
|
t.length === 0 && (t = void 0);
|
|
308
309
|
}
|
|
309
310
|
return r.serialize({
|
|
310
|
-
...
|
|
311
|
+
...s,
|
|
311
312
|
type: "boolean",
|
|
312
313
|
multiple: !0,
|
|
313
314
|
defaultValue: t,
|
|
@@ -320,7 +321,7 @@ const r = {
|
|
|
320
321
|
});
|
|
321
322
|
}
|
|
322
323
|
return r.serialize({
|
|
323
|
-
...
|
|
324
|
+
...s,
|
|
324
325
|
type: "boolean",
|
|
325
326
|
multiple: !1,
|
|
326
327
|
defaultValue: N,
|
|
@@ -331,30 +332,38 @@ const r = {
|
|
|
331
332
|
condition: t.condition
|
|
332
333
|
})) : null
|
|
333
334
|
});
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
335
|
+
case "object":
|
|
336
|
+
return this.multiple ? r.serialize({
|
|
337
|
+
...s,
|
|
338
|
+
type: "object",
|
|
339
|
+
multiple: !0,
|
|
340
|
+
defaultValue: this.defaultValue,
|
|
341
|
+
options: this.options ? this.options.map((t) => ({
|
|
342
|
+
id: t.id,
|
|
343
|
+
label: t.label,
|
|
344
|
+
description: t.description,
|
|
345
|
+
value: t.value,
|
|
346
|
+
condition: t.condition
|
|
347
|
+
})) : null
|
|
348
|
+
}) : r.serialize({
|
|
349
|
+
...s,
|
|
350
|
+
type: "object",
|
|
351
|
+
multiple: !1,
|
|
352
|
+
defaultValue: this.defaultValue,
|
|
353
|
+
options: this.options ? this.options.map((t) => ({
|
|
354
|
+
id: t.id,
|
|
355
|
+
label: t.label,
|
|
356
|
+
description: t.description,
|
|
357
|
+
value: t.value,
|
|
358
|
+
condition: t.condition
|
|
359
|
+
})) : null
|
|
360
|
+
});
|
|
352
361
|
default:
|
|
353
362
|
throw new Error("Unsupported field type");
|
|
354
363
|
}
|
|
355
364
|
}
|
|
356
|
-
}),
|
|
357
|
-
const o = [],
|
|
365
|
+
}), E = (e) => {
|
|
366
|
+
const o = [], s = [], n = [], d = [], N = [], t = e.condition ?? e.decide;
|
|
358
367
|
return {
|
|
359
368
|
id: e.id,
|
|
360
369
|
component: e.component,
|
|
@@ -364,14 +373,14 @@ const r = {
|
|
|
364
373
|
decide: e.decide,
|
|
365
374
|
targets: e.targets,
|
|
366
375
|
steps: o,
|
|
367
|
-
nodes:
|
|
368
|
-
edges:
|
|
376
|
+
nodes: s,
|
|
377
|
+
edges: n,
|
|
369
378
|
fields: N,
|
|
370
379
|
conditionals: d,
|
|
371
380
|
addStep(i, u) {
|
|
372
381
|
let l = u?.node;
|
|
373
382
|
this.nodes.length === 0 && (l = p({ type: "origin" }, this), this.nodes.push(l));
|
|
374
|
-
const a = "serialize" in i ? i :
|
|
383
|
+
const a = "serialize" in i ? i : z(i, this);
|
|
375
384
|
if (l) {
|
|
376
385
|
if (!a.node)
|
|
377
386
|
throw new Error("todo no node");
|
|
@@ -388,7 +397,7 @@ const r = {
|
|
|
388
397
|
addAction(i, u) {
|
|
389
398
|
let l = u?.node;
|
|
390
399
|
this.nodes.length === 0 && (l = p({ type: "origin" }, this), this.nodes.push(l));
|
|
391
|
-
const a = "serialize" in i ? i :
|
|
400
|
+
const a = "serialize" in i ? i : y(i, this);
|
|
392
401
|
if (l) {
|
|
393
402
|
const c = h(
|
|
394
403
|
{ sourceNode: l, destinationNode: a, sourceNodeHandle: null },
|
|
@@ -456,10 +465,10 @@ const r = {
|
|
|
456
465
|
export {
|
|
457
466
|
b as createConditional,
|
|
458
467
|
h as createEdge,
|
|
459
|
-
|
|
460
|
-
|
|
468
|
+
E as createExperience,
|
|
469
|
+
x as createExperiencePlugin,
|
|
461
470
|
m as createField,
|
|
462
471
|
p as createNode,
|
|
463
|
-
|
|
472
|
+
V as createStep,
|
|
464
473
|
r as serialization
|
|
465
474
|
};
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
import { Store } from 'effector';
|
|
1
2
|
import { LogicRule } from '../../logic-engine';
|
|
2
3
|
export type FieldsStore = ReturnType<typeof createFieldIndex>;
|
|
3
4
|
export type PrimitiveFieldValue = string | number | boolean | null;
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* JSON-serializable value type for object fields.
|
|
7
|
+
* Recursively defines all valid JSON-serializable structures.
|
|
8
|
+
*/
|
|
9
|
+
export type JsonValue = string | number | boolean | null | {
|
|
10
|
+
[key: string]: JsonValue;
|
|
11
|
+
} | JsonValue[];
|
|
12
|
+
export type FieldValue = PrimitiveFieldValue | PrimitiveFieldValue[] | JsonValue | JsonValue[];
|
|
13
|
+
export interface FieldBase<TOptionValue = PrimitiveFieldValue> {
|
|
6
14
|
id: string;
|
|
7
15
|
name: string;
|
|
8
16
|
label: string;
|
|
@@ -23,89 +31,57 @@ export interface FieldBase {
|
|
|
23
31
|
id: string;
|
|
24
32
|
label: string;
|
|
25
33
|
description?: string;
|
|
26
|
-
value:
|
|
34
|
+
value: TOptionValue;
|
|
27
35
|
condition?: LogicRule;
|
|
28
36
|
}[] | null;
|
|
29
37
|
}
|
|
30
|
-
export interface FieldTextSingular extends FieldBase {
|
|
38
|
+
export interface FieldTextSingular extends FieldBase<string> {
|
|
31
39
|
type: 'text';
|
|
32
40
|
multiple: false;
|
|
33
41
|
defaultValue?: string;
|
|
34
|
-
options?: {
|
|
35
|
-
id: string;
|
|
36
|
-
label: string;
|
|
37
|
-
description?: string;
|
|
38
|
-
value: string;
|
|
39
|
-
condition?: LogicRule;
|
|
40
|
-
}[] | null;
|
|
41
42
|
}
|
|
42
|
-
export interface FieldTextMultiple extends FieldBase {
|
|
43
|
+
export interface FieldTextMultiple extends FieldBase<string> {
|
|
43
44
|
type: 'text';
|
|
44
45
|
multiple: true;
|
|
45
46
|
defaultValue?: string[];
|
|
46
|
-
options?: {
|
|
47
|
-
id: string;
|
|
48
|
-
label: string;
|
|
49
|
-
description?: string;
|
|
50
|
-
value: string;
|
|
51
|
-
condition?: LogicRule;
|
|
52
|
-
}[] | null;
|
|
53
47
|
}
|
|
54
|
-
export interface FieldNumberSingular extends FieldBase {
|
|
48
|
+
export interface FieldNumberSingular extends FieldBase<number> {
|
|
55
49
|
type: 'number';
|
|
56
50
|
multiple: false;
|
|
57
51
|
defaultValue?: number;
|
|
58
|
-
options?: {
|
|
59
|
-
id: string;
|
|
60
|
-
label: string;
|
|
61
|
-
description?: string;
|
|
62
|
-
value: number;
|
|
63
|
-
condition?: LogicRule;
|
|
64
|
-
}[] | null;
|
|
65
52
|
}
|
|
66
|
-
export interface FieldNumberMultiple extends FieldBase {
|
|
53
|
+
export interface FieldNumberMultiple extends FieldBase<number> {
|
|
67
54
|
type: 'number';
|
|
68
55
|
multiple: true;
|
|
69
56
|
defaultValue?: number[];
|
|
70
|
-
options?: {
|
|
71
|
-
id: string;
|
|
72
|
-
label: string;
|
|
73
|
-
description?: string;
|
|
74
|
-
value: number;
|
|
75
|
-
condition?: LogicRule;
|
|
76
|
-
}[] | null;
|
|
77
57
|
}
|
|
78
|
-
export interface
|
|
58
|
+
export interface FieldObjectSingular extends FieldBase<JsonValue> {
|
|
59
|
+
type: 'object';
|
|
60
|
+
multiple: false;
|
|
61
|
+
defaultValue?: JsonValue;
|
|
62
|
+
}
|
|
63
|
+
export interface FieldObjectMultiple extends FieldBase<JsonValue> {
|
|
64
|
+
type: 'object';
|
|
65
|
+
multiple: true;
|
|
66
|
+
defaultValue?: JsonValue[];
|
|
67
|
+
}
|
|
68
|
+
export interface FieldBooleanSingular extends FieldBase<boolean> {
|
|
79
69
|
type: 'boolean';
|
|
80
70
|
multiple: false;
|
|
81
71
|
defaultValue?: boolean;
|
|
82
|
-
options?: {
|
|
83
|
-
id: string;
|
|
84
|
-
label: string;
|
|
85
|
-
description?: string;
|
|
86
|
-
value: boolean;
|
|
87
|
-
condition?: LogicRule;
|
|
88
|
-
}[] | null;
|
|
89
72
|
}
|
|
90
|
-
export interface FieldBooleanMultiple extends FieldBase {
|
|
73
|
+
export interface FieldBooleanMultiple extends FieldBase<boolean> {
|
|
91
74
|
type: 'boolean';
|
|
92
75
|
multiple: true;
|
|
93
76
|
defaultValue?: boolean[];
|
|
94
|
-
options?: {
|
|
95
|
-
id: string;
|
|
96
|
-
label: string;
|
|
97
|
-
description?: string;
|
|
98
|
-
value: boolean;
|
|
99
|
-
condition?: LogicRule;
|
|
100
|
-
}[] | null;
|
|
101
77
|
}
|
|
102
|
-
export type Field = FieldTextSingular | FieldTextMultiple | FieldNumberSingular | FieldNumberMultiple | FieldBooleanSingular | FieldBooleanMultiple;
|
|
78
|
+
export type Field = FieldTextSingular | FieldTextMultiple | FieldNumberSingular | FieldNumberMultiple | FieldObjectSingular | FieldObjectMultiple | FieldBooleanSingular | FieldBooleanMultiple;
|
|
103
79
|
declare const createFieldIndexFactory: () => {
|
|
104
80
|
register: (field: Field) => void;
|
|
105
81
|
update: (fieldId: FieldBase["id"], updates: Partial<Field>) => void;
|
|
106
|
-
getById: (id: FieldBase["id"]) =>
|
|
107
|
-
listStore:
|
|
108
|
-
getByName: (name: FieldBase["name"]) =>
|
|
82
|
+
getById: (id: FieldBase["id"]) => Store<Field | null>;
|
|
83
|
+
listStore: Store<Field[]>;
|
|
84
|
+
getByName: (name: FieldBase["name"]) => Store<Field | null>;
|
|
109
85
|
};
|
|
110
86
|
export declare function createFieldIndex(): ReturnType<typeof createFieldIndexFactory>;
|
|
111
87
|
export declare const setupField: (field: Field, fields: FieldsStore) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../../src/entities/field/field.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../../src/entities/field/field.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,KAAK,EAAE,MAAM,UAAU,CAAA;AAE9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAEnD,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAI7D,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;AAElE;;;GAGG;AACH,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAC5B,SAAS,EAAE,CAAA;AAEf,MAAM,MAAM,UAAU,GAAG,mBAAmB,GAAG,mBAAmB,EAAE,GAAG,SAAS,GAAG,SAAS,EAAE,CAAA;AAE9F,MAAM,WAAW,SAAS,CAAC,YAAY,GAAG,mBAAmB;IAC3D,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAA;IAC9C,QAAQ,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,OAAO,CAAA;IACjB,YAAY,CAAC,EAAE,UAAU,CAAA;IACzB,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,WAAW,CAAC,EA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CAAC,EAAE,SAAS,CAAA;CACzB;AAED,MAAM,WAAW,mBAAoB,SAAQ,SAAS,CAAC,SAAS,CAAC;IAC/D,IAAI,EAAE,QAAQ,CAAA;IACd,QAAQ,EAAE,IAAI,CAAA;IACd,YAAY,CAAC,EAAE,SAAS,EAAE,CAAA;CAC3B;AAED,MAAM,WAAW,oBAAqB,SAAQ,SAAS,CAAC,OAAO,CAAC;IAC9D,IAAI,EAAE,SAAS,CAAA;IACf,QAAQ,EAAE,KAAK,CAAA;IACf,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AAED,MAAM,WAAW,oBAAqB,SAAQ,SAAS,CAAC,OAAO,CAAC;IAC9D,IAAI,EAAE,SAAS,CAAA;IACf,QAAQ,EAAE,IAAI,CAAA;IACd,YAAY,CAAC,EAAE,OAAO,EAAE,CAAA;CACzB;AAED,MAAM,MAAM,KAAK,GACb,iBAAiB,GACjB,iBAAiB,GACjB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,oBAAoB,GACpB,oBAAoB,CAAA;AAGxB,QAAA,MAAM,uBAAuB;sBAcF,KAAK,KAAG,IAAI;sBAcZ,SAAS,CAAC,IAAI,CAAC,WAAW,OAAO,CAAC,KAAK,CAAC,KAAG,IAAI;kBAmBnD,SAAS,CAAC,IAAI,CAAC;;sBAIX,SAAS,CAAC,MAAM,CAAC;CAW1C,CAAA;AAEF,wBAAgB,gBAAgB,IAAI,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAE7E;AAED,eAAO,MAAM,UAAU,GAAI,OAAO,KAAK,EAAE,QAAQ,WAAW,KAAG,IAE9D,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { Store } from 'effector';
|
|
1
2
|
import { Picked } from '../../picked';
|
|
2
|
-
import { Field, FieldValue } from '../field/field';
|
|
3
|
+
import { Field, FieldValue, JsonValue } from '../field/field';
|
|
3
4
|
export type ResponsesStore = ReturnType<typeof createResponseIndex>;
|
|
4
5
|
export type Response = FieldValue;
|
|
5
6
|
export interface ResponseListItem {
|
|
@@ -22,15 +23,18 @@ declare const createResponseIndexFactory: ({ client }: {
|
|
|
22
23
|
responsesToCommit: CommitResponses;
|
|
23
24
|
validationErrors: ValidationError[];
|
|
24
25
|
}>;
|
|
25
|
-
listStore:
|
|
26
|
+
listStore: Store<{
|
|
26
27
|
fieldId: string;
|
|
27
28
|
value: FieldValue | undefined;
|
|
28
29
|
}[]>;
|
|
29
|
-
getAllStore:
|
|
30
|
+
getAllStore: Store<{
|
|
30
31
|
[fieldId: string]: FieldValue;
|
|
31
32
|
}>;
|
|
32
|
-
getByFieldId:
|
|
33
|
-
|
|
33
|
+
getByFieldId: {
|
|
34
|
+
(fieldId: Field["id"]): Store<FieldValue>;
|
|
35
|
+
<T extends JsonValue>(fieldId: Field["id"]): Store<T | null>;
|
|
36
|
+
};
|
|
37
|
+
getByFieldName: (fieldName: Field["name"]) => Store<FieldValue>;
|
|
34
38
|
};
|
|
35
39
|
export declare function createResponseIndex<T extends Parameters<typeof createResponseIndexFactory>[0]>(params: T): ReturnType<typeof createResponseIndexFactory>;
|
|
36
40
|
export type CommitResponses = Record<Field['id'], FieldValue>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../../../src/entities/response/response.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../../../src/entities/response/response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyD,KAAK,KAAK,EAAE,MAAM,UAAU,CAAA;AAE5F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAuB,MAAM,gBAAgB,CAAA;AA8CvF,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAInE,MAAM,MAAM,QAAQ,GAAG,UAAU,C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ked {
|
|
|
155
155
|
getAllStore: import('effector').Store<{
|
|
156
156
|
[fieldId: string]: import('.').FieldValue;
|
|
157
157
|
}>;
|
|
158
|
-
getByFieldId:
|
|
158
|
+
getByFieldId: {
|
|
159
|
+
(fieldId: Field["id"]): import('effector').Store<import('.').FieldValue>;
|
|
160
|
+
<T extends import('.').JsonValue>(fieldId: Field["id"]): import('effector').Store<T | null>;
|
|
161
|
+
};
|
|
159
162
|
getByFieldName: (fieldName: Field["name"]) => import('effector').Store<import('.').FieldValue>;
|
|
160
163
|
};
|
|
161
164
|
readonly fields: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"picked.d.ts","sourceRoot":"","sources":["../../src/picked.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,UAAU,EAIhB,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,mBAAmB,EACxB,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;AAMzD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAEnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AAOtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAK/C,qBAAa,MAAM;IACjB,MAAM,CAAC,QAAQ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;;;;;;;;;;;OAyCG;IACH,YAAY,GAAI,UAAU,MAAM,EAAE,UAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,MAAM,CAY3E;CACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ActionNode, Experience, ExperienceConditional, ExperienceEdge, ExperienceNode, ExperienceStep, ExperienceTarget } from '../../entities/experience/experience';
|
|
2
2
|
import { AdaptedComponent } from '../../entities/component/component';
|
|
3
3
|
import { LogicRule, LogicValue } from '../../logic-engine';
|
|
4
|
-
import { Field, FieldBooleanMultiple, FieldBooleanSingular, FieldNumberMultiple, FieldNumberSingular, FieldTextMultiple, FieldTextSingular } from '../../entities/field/field';
|
|
4
|
+
import { Field, FieldBooleanMultiple, FieldBooleanSingular, FieldNumberMultiple, FieldNumberSingular, FieldObjectMultiple, FieldObjectSingular, FieldTextMultiple, FieldTextSingular, JsonValue } from '../../entities/field/field';
|
|
5
5
|
import { Serialized } from './serialization';
|
|
6
6
|
export interface Nodeable {
|
|
7
7
|
node: SerializableNode | null;
|
|
@@ -105,9 +105,9 @@ export type CreateFieldOptions = Omit<Field, 'options' | 'placeholder' | 'descri
|
|
|
105
105
|
doNotTrackValue?: boolean;
|
|
106
106
|
doNotStoreValue?: boolean;
|
|
107
107
|
};
|
|
108
|
-
options?: NonNullable<FieldTextSingular['options']>[number][] | NonNullable<FieldTextMultiple['options']>[number][] | NonNullable<FieldNumberSingular['options']>[number][] | NonNullable<FieldNumberMultiple['options']>[number][] | NonNullable<FieldBooleanSingular['options']>[number][] | NonNullable<FieldBooleanMultiple['options']>[number][];
|
|
108
|
+
options?: NonNullable<FieldTextSingular['options']>[number][] | NonNullable<FieldTextMultiple['options']>[number][] | NonNullable<FieldNumberSingular['options']>[number][] | NonNullable<FieldNumberMultiple['options']>[number][] | NonNullable<FieldBooleanSingular['options']>[number][] | NonNullable<FieldBooleanMultiple['options']>[number][] | Omit<NonNullable<FieldObjectSingular['options']>[number], 'id'>[] | Omit<NonNullable<FieldObjectMultiple['options']>[number], 'id'>[];
|
|
109
109
|
};
|
|
110
|
-
export type SerializableField = {
|
|
110
|
+
export type SerializableField<T extends JsonValue = JsonValue> = {
|
|
111
111
|
id: string;
|
|
112
112
|
name: string;
|
|
113
113
|
label: string;
|
|
@@ -128,9 +128,15 @@ export type SerializableField = {
|
|
|
128
128
|
id: string;
|
|
129
129
|
label: string;
|
|
130
130
|
description?: string;
|
|
131
|
-
value:
|
|
131
|
+
value: JsonValue;
|
|
132
132
|
condition?: LogicRule;
|
|
133
133
|
}[] | null;
|
|
134
|
+
/**
|
|
135
|
+
* Phantom type property for TypeScript type inference.
|
|
136
|
+
* This property never exists at runtime but enables type-safe field value access.
|
|
137
|
+
* @internal
|
|
138
|
+
*/
|
|
139
|
+
__fieldType?: T;
|
|
134
140
|
} & {
|
|
135
141
|
serialize: () => Serialized<Field>;
|
|
136
142
|
};
|
|
@@ -181,6 +187,23 @@ export declare const bindExperienceStep: (stepOptions: CreateStepOptions | Orpha
|
|
|
181
187
|
export declare const createNode: (nodeOptions: CreateNodeOptions, experience: SerializableExperience) => SerializableNode;
|
|
182
188
|
export declare const createEdge: (edgeOptions: CreateEdgeOptions, experience: SerializableExperience) => SerializableEdge;
|
|
183
189
|
export declare const createConditional: (conditionalOptions: CreateConditionalOptions, experience: SerializableExperience) => SerializableConditional;
|
|
184
|
-
|
|
190
|
+
/**
|
|
191
|
+
* Creates a field with optional generic type parameter for object field type safety.
|
|
192
|
+
*
|
|
193
|
+
* @template T - The type of the object field value (only applicable for type: 'object')
|
|
194
|
+
* @param fieldOptions - The field configuration options
|
|
195
|
+
* @returns A serializable field with type information
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* ```typescript
|
|
199
|
+
* // Without type parameter (default JsonValue)
|
|
200
|
+
* const field = createField({ type: 'text', ... })
|
|
201
|
+
*
|
|
202
|
+
* // With type parameter for object fields
|
|
203
|
+
* interface MyData { name: string; age: number }
|
|
204
|
+
* const typedField = createField<MyData>({ type: 'object', ... })
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
export declare const createField: <T extends JsonValue = JsonValue>(fieldOptions: CreateFieldOptions) => SerializableField<T>;
|
|
185
208
|
export declare const createExperience: (experience: CreateExperienceOptions) => SerializableExperience;
|
|
186
209
|
//# sourceMappingURL=create-experience.d.ts.map
|