@picked/client 0.0.7-next.1 → 0.0.7-next.3
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 +1 -1
- package/dist/cjs/plugins/create-experience/index.js +1 -1
- package/dist/cjs/plugins/responses-browser-storage/index.js +1 -1
- package/dist/cjs/plugins/responses-indexeddb/index.js +1 -1
- package/dist/esm/index.js +196 -183
- package/dist/esm/plugins/create-experience/index.js +61 -55
- package/dist/esm/plugins/responses-browser-storage/index.js +16 -15
- package/dist/esm/plugins/responses-indexeddb/index.js +24 -21
- package/dist/types/entities/field/field.d.ts +26 -19
- package/dist/types/entities/field/field.d.ts.map +1 -1
- package/dist/types/entities/predicate/predicate.d.ts +1 -1
- package/dist/types/entities/predicate/predicate.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +16 -6
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/dist/types/utils/get-step-fields.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -10,9 +10,9 @@ const r = {
|
|
|
10
10
|
name: "create-experience",
|
|
11
11
|
setup: (a) => {
|
|
12
12
|
e.experiences.forEach((o) => {
|
|
13
|
-
const s = o.serialize(),
|
|
14
|
-
|
|
15
|
-
a.registerField(
|
|
13
|
+
const s = o.serialize(), d = r.deserialize(s);
|
|
14
|
+
d.component = o.component, a.registerExperience(d), d.fields.forEach((h) => {
|
|
15
|
+
a.registerField(h);
|
|
16
16
|
});
|
|
17
17
|
});
|
|
18
18
|
}
|
|
@@ -21,9 +21,9 @@ const r = {
|
|
|
21
21
|
label: e.label,
|
|
22
22
|
fields: e.fields ?? [],
|
|
23
23
|
addField(a) {
|
|
24
|
-
var s,
|
|
24
|
+
var s, d;
|
|
25
25
|
const o = "serialize" in a ? a : m(a);
|
|
26
|
-
return (s = this.fields) != null && s.includes(o) || (
|
|
26
|
+
return (s = this.fields) != null && s.includes(o) || (d = this.fields) == null || d.push(o), o;
|
|
27
27
|
}
|
|
28
28
|
}), y = (e, a) => {
|
|
29
29
|
const o = {
|
|
@@ -52,15 +52,15 @@ const r = {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
|
-
return
|
|
56
|
-
}, z = () => [0, 0],
|
|
55
|
+
return c({ step: o, type: "step" }, a), o;
|
|
56
|
+
}, z = () => [0, 0], c = (e, a) => {
|
|
57
57
|
const o = {
|
|
58
58
|
id: f("node"),
|
|
59
59
|
position: z(),
|
|
60
60
|
experience: a
|
|
61
61
|
};
|
|
62
62
|
if (e.type === "step") {
|
|
63
|
-
const
|
|
63
|
+
const d = {
|
|
64
64
|
...o,
|
|
65
65
|
type: "step",
|
|
66
66
|
connectedStep: e.step,
|
|
@@ -74,10 +74,10 @@ const r = {
|
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
|
-
return
|
|
77
|
+
return d.connectedStep.node = d, d;
|
|
78
78
|
}
|
|
79
79
|
if (e.type === "conditional") {
|
|
80
|
-
const
|
|
80
|
+
const d = {
|
|
81
81
|
...o,
|
|
82
82
|
type: "conditional",
|
|
83
83
|
connectedConditional: e.conditional,
|
|
@@ -90,7 +90,7 @@ const r = {
|
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
|
-
return
|
|
93
|
+
return d.connectedConditional.node = d, d;
|
|
94
94
|
}
|
|
95
95
|
return e.type === "experience" ? {
|
|
96
96
|
...o,
|
|
@@ -138,20 +138,20 @@ const r = {
|
|
|
138
138
|
addTrue(s) {
|
|
139
139
|
if (!this.node || !s.node)
|
|
140
140
|
throw new Error("todo no node");
|
|
141
|
-
const
|
|
141
|
+
const d = p(
|
|
142
142
|
{ sourceNode: this.node, destinationNode: s.node, sourceNodeHandle: "true" },
|
|
143
143
|
this.experience
|
|
144
144
|
);
|
|
145
|
-
this.experience.edges.push(
|
|
145
|
+
this.experience.edges.push(d);
|
|
146
146
|
},
|
|
147
147
|
addFalse(s) {
|
|
148
148
|
if (!this.node || !s.node)
|
|
149
149
|
throw new Error("todo no node");
|
|
150
|
-
const
|
|
150
|
+
const d = p(
|
|
151
151
|
{ sourceNode: this.node, destinationNode: s.node, sourceNodeHandle: "false" },
|
|
152
152
|
this.experience
|
|
153
153
|
);
|
|
154
|
-
this.experience.edges.push(
|
|
154
|
+
this.experience.edges.push(d);
|
|
155
155
|
},
|
|
156
156
|
serialize() {
|
|
157
157
|
return r.serialize({
|
|
@@ -160,7 +160,7 @@ const r = {
|
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
162
|
};
|
|
163
|
-
return
|
|
163
|
+
return c({ conditional: o, type: "conditional" }, a), o;
|
|
164
164
|
}, m = (e) => {
|
|
165
165
|
var o;
|
|
166
166
|
return {
|
|
@@ -171,14 +171,14 @@ const r = {
|
|
|
171
171
|
placeholder: e.placeholder,
|
|
172
172
|
description: e.description,
|
|
173
173
|
helpText: e.helpText,
|
|
174
|
-
defaultValue: e.defaultValue,
|
|
174
|
+
defaultValue: e.defaultValue ?? null,
|
|
175
175
|
multiple: e.multiple,
|
|
176
|
-
validation: e.validation,
|
|
176
|
+
validation: e.validation ?? {},
|
|
177
177
|
condition: e.condition,
|
|
178
178
|
required: e.required,
|
|
179
179
|
options: ((o = e.options) == null ? void 0 : o.map((s) => ({
|
|
180
180
|
...s
|
|
181
|
-
})))
|
|
181
|
+
}))) ?? null,
|
|
182
182
|
policies: e.policies,
|
|
183
183
|
serialize() {
|
|
184
184
|
const s = {
|
|
@@ -192,16 +192,16 @@ const r = {
|
|
|
192
192
|
validation: this.validation,
|
|
193
193
|
condition: this.condition,
|
|
194
194
|
policies: this.policies
|
|
195
|
-
},
|
|
195
|
+
}, d = typeof this.defaultValue == "string" ? this.defaultValue : void 0, h = typeof this.defaultValue == "number" ? this.defaultValue : void 0, n = typeof this.defaultValue == "boolean" ? this.defaultValue : void 0;
|
|
196
196
|
switch (this.type) {
|
|
197
197
|
case "text":
|
|
198
198
|
if (this.multiple) {
|
|
199
|
-
let i
|
|
199
|
+
let i;
|
|
200
200
|
if (Array.isArray(this.defaultValue)) {
|
|
201
201
|
i = [];
|
|
202
202
|
for (const t of this.defaultValue)
|
|
203
203
|
typeof t == "string" && i.push(t);
|
|
204
|
-
i.length === 0 && (i =
|
|
204
|
+
i.length === 0 && (i = void 0);
|
|
205
205
|
}
|
|
206
206
|
return r.serialize({
|
|
207
207
|
...s,
|
|
@@ -211,7 +211,8 @@ const r = {
|
|
|
211
211
|
options: this.options ? this.options.map((t) => ({
|
|
212
212
|
id: t.id,
|
|
213
213
|
label: t.label,
|
|
214
|
-
value: `${t.value}
|
|
214
|
+
value: `${t.value}`,
|
|
215
|
+
condition: t.condition
|
|
215
216
|
})) : null
|
|
216
217
|
});
|
|
217
218
|
}
|
|
@@ -219,21 +220,22 @@ const r = {
|
|
|
219
220
|
...s,
|
|
220
221
|
type: "text",
|
|
221
222
|
multiple: !1,
|
|
222
|
-
defaultValue:
|
|
223
|
+
defaultValue: d,
|
|
223
224
|
options: this.options ? this.options.map((i) => ({
|
|
224
225
|
id: i.id,
|
|
225
226
|
label: i.label,
|
|
226
|
-
value: `${i.value}
|
|
227
|
+
value: `${i.value}`,
|
|
228
|
+
condition: i.condition
|
|
227
229
|
})) : null
|
|
228
230
|
});
|
|
229
231
|
case "number":
|
|
230
232
|
if (this.multiple) {
|
|
231
|
-
let i
|
|
233
|
+
let i;
|
|
232
234
|
if (Array.isArray(this.defaultValue)) {
|
|
233
235
|
i = [];
|
|
234
236
|
for (const t of this.defaultValue)
|
|
235
237
|
typeof t == "number" && i.push(t);
|
|
236
|
-
i.length === 0 && (i =
|
|
238
|
+
i.length === 0 && (i = void 0);
|
|
237
239
|
}
|
|
238
240
|
return r.serialize({
|
|
239
241
|
...s,
|
|
@@ -243,7 +245,8 @@ const r = {
|
|
|
243
245
|
options: this.options ? this.options.map((t) => ({
|
|
244
246
|
id: t.id,
|
|
245
247
|
label: t.label,
|
|
246
|
-
value: Number(t.value)
|
|
248
|
+
value: Number(t.value),
|
|
249
|
+
condition: t.condition
|
|
247
250
|
})) : null
|
|
248
251
|
});
|
|
249
252
|
}
|
|
@@ -251,21 +254,22 @@ const r = {
|
|
|
251
254
|
...s,
|
|
252
255
|
type: "number",
|
|
253
256
|
multiple: !1,
|
|
254
|
-
defaultValue:
|
|
257
|
+
defaultValue: h,
|
|
255
258
|
options: this.options ? this.options.map((i) => ({
|
|
256
259
|
id: i.id,
|
|
257
260
|
label: i.label,
|
|
258
|
-
value: Number(i.value)
|
|
261
|
+
value: Number(i.value),
|
|
262
|
+
condition: i.condition
|
|
259
263
|
})) : null
|
|
260
264
|
});
|
|
261
265
|
case "boolean":
|
|
262
266
|
if (this.multiple) {
|
|
263
|
-
let i
|
|
267
|
+
let i;
|
|
264
268
|
if (Array.isArray(this.defaultValue)) {
|
|
265
269
|
i = [];
|
|
266
270
|
for (const t of this.defaultValue)
|
|
267
271
|
typeof t == "boolean" && i.push(t);
|
|
268
|
-
i.length === 0 && (i =
|
|
272
|
+
i.length === 0 && (i = void 0);
|
|
269
273
|
}
|
|
270
274
|
return r.serialize({
|
|
271
275
|
...s,
|
|
@@ -275,7 +279,8 @@ const r = {
|
|
|
275
279
|
options: this.options ? this.options.map((t) => ({
|
|
276
280
|
id: t.id,
|
|
277
281
|
label: t.label,
|
|
278
|
-
value: !!t.value
|
|
282
|
+
value: !!t.value,
|
|
283
|
+
condition: t.condition
|
|
279
284
|
})) : null
|
|
280
285
|
});
|
|
281
286
|
}
|
|
@@ -287,7 +292,8 @@ const r = {
|
|
|
287
292
|
options: this.options ? this.options.map((i) => ({
|
|
288
293
|
id: i.id,
|
|
289
294
|
label: i.label,
|
|
290
|
-
value: !!i.value
|
|
295
|
+
value: !!i.value,
|
|
296
|
+
condition: i.condition
|
|
291
297
|
})) : null
|
|
292
298
|
});
|
|
293
299
|
// todo: support for object type fields
|
|
@@ -313,8 +319,8 @@ const r = {
|
|
|
313
319
|
}
|
|
314
320
|
}
|
|
315
321
|
};
|
|
316
|
-
},
|
|
317
|
-
const a = [], o = [], s = [],
|
|
322
|
+
}, v = (e) => {
|
|
323
|
+
const a = [], o = [], s = [], d = [], h = [];
|
|
318
324
|
return {
|
|
319
325
|
id: e.id,
|
|
320
326
|
component: e.component,
|
|
@@ -325,50 +331,50 @@ const r = {
|
|
|
325
331
|
steps: a,
|
|
326
332
|
nodes: o,
|
|
327
333
|
edges: s,
|
|
328
|
-
fields:
|
|
329
|
-
conditionals:
|
|
334
|
+
fields: h,
|
|
335
|
+
conditionals: d,
|
|
330
336
|
addStep(n, i) {
|
|
331
337
|
let t = i == null ? void 0 : i.node;
|
|
332
|
-
this.nodes.length === 0 && (t =
|
|
333
|
-
const
|
|
338
|
+
this.nodes.length === 0 && (t = c({ type: "origin" }, this), this.nodes.push(t));
|
|
339
|
+
const l = "serialize" in n ? n : y(n, this);
|
|
334
340
|
if (t) {
|
|
335
|
-
if (!
|
|
341
|
+
if (!l.node)
|
|
336
342
|
throw new Error("todo no node");
|
|
337
343
|
const u = p(
|
|
338
|
-
{ sourceNode: t, destinationNode:
|
|
344
|
+
{ sourceNode: t, destinationNode: l.node, sourceNodeHandle: null },
|
|
339
345
|
this
|
|
340
346
|
);
|
|
341
347
|
this.edges.push(u);
|
|
342
348
|
}
|
|
343
|
-
return
|
|
349
|
+
return l.fields.length > 0 && l.fields.forEach((u) => {
|
|
344
350
|
this.fields.includes(u) || this.fields.push(u);
|
|
345
|
-
}), this.steps.includes(
|
|
351
|
+
}), this.steps.includes(l) || (this.steps.push(l), l.node && this.nodes.push(l.node)), l;
|
|
346
352
|
},
|
|
347
353
|
addConditional(n, i) {
|
|
348
354
|
let t = i == null ? void 0 : i.node;
|
|
349
|
-
this.nodes.length === 0 && (t =
|
|
350
|
-
const
|
|
355
|
+
this.nodes.length === 0 && (t = c({ type: "origin" }, this), this.nodes.push(t));
|
|
356
|
+
const l = "serialize" in n ? n : N(n, this);
|
|
351
357
|
if (t) {
|
|
352
|
-
if (!
|
|
358
|
+
if (!l.node)
|
|
353
359
|
throw new Error("todo no node");
|
|
354
360
|
const u = p(
|
|
355
|
-
{ sourceNode: t, destinationNode:
|
|
361
|
+
{ sourceNode: t, destinationNode: l.node, sourceNodeHandle: null },
|
|
356
362
|
this
|
|
357
363
|
);
|
|
358
364
|
this.edges.push(u);
|
|
359
365
|
}
|
|
360
|
-
return this.conditionals.includes(
|
|
366
|
+
return this.conditionals.includes(l) || (this.conditionals.push(l), l.node && this.nodes.push(l.node)), l;
|
|
361
367
|
},
|
|
362
368
|
addExperience(n, i) {
|
|
363
369
|
let t = i == null ? void 0 : i.node;
|
|
364
|
-
this.nodes.length === 0 && (t =
|
|
365
|
-
const
|
|
370
|
+
this.nodes.length === 0 && (t = c({ type: "origin" }, this), this.nodes.push(t));
|
|
371
|
+
const l = c(
|
|
366
372
|
{ type: "experience", experience: n },
|
|
367
373
|
this
|
|
368
374
|
);
|
|
369
|
-
if (this.nodes.push(
|
|
375
|
+
if (this.nodes.push(l), t) {
|
|
370
376
|
const u = p(
|
|
371
|
-
{ sourceNode: t, destinationNode:
|
|
377
|
+
{ sourceNode: t, destinationNode: l, sourceNodeHandle: null },
|
|
372
378
|
this
|
|
373
379
|
);
|
|
374
380
|
this.edges.push(u);
|
|
@@ -401,10 +407,10 @@ const r = {
|
|
|
401
407
|
export {
|
|
402
408
|
N as createConditional,
|
|
403
409
|
p as createEdge,
|
|
404
|
-
|
|
410
|
+
v as createExperience,
|
|
405
411
|
b as createExperiencePlugin,
|
|
406
412
|
m as createField,
|
|
407
|
-
|
|
413
|
+
c as createNode,
|
|
408
414
|
x as createStep,
|
|
409
415
|
r as serialization
|
|
410
416
|
};
|
|
@@ -1,36 +1,37 @@
|
|
|
1
|
-
import { createEffect as
|
|
2
|
-
import { c as
|
|
3
|
-
const a =
|
|
4
|
-
storage:
|
|
1
|
+
import { createEffect as p, sample as i } from "effector";
|
|
2
|
+
import { c as b, l as d, s as y } from "../../../storage-D87xFySf.js";
|
|
3
|
+
const a = b("responses", "global"), R = ({
|
|
4
|
+
storage: g = "local"
|
|
5
5
|
} = {}) => ({
|
|
6
6
|
name: "responses-browser-storage-plugin",
|
|
7
7
|
setup: (e) => {
|
|
8
|
-
const t =
|
|
8
|
+
const t = g === "local" ? d : y, u = p(async () => {
|
|
9
9
|
const s = t.get(a).json();
|
|
10
10
|
if (!s)
|
|
11
11
|
return null;
|
|
12
12
|
Object.entries(s).forEach(([r, o]) => {
|
|
13
13
|
e.responses.register(r, o);
|
|
14
14
|
});
|
|
15
|
-
}),
|
|
15
|
+
}), f = p(async (s) => {
|
|
16
16
|
const r = t.get(a).json(), o = {};
|
|
17
|
-
Object.entries(s).forEach(([c,
|
|
17
|
+
Object.entries(s).forEach(([c, m]) => {
|
|
18
|
+
var l;
|
|
18
19
|
const n = e.fields.getById(c).getState();
|
|
19
|
-
!(n
|
|
20
|
+
!((l = n == null ? void 0 : n.policies) != null && l.doNotStoreValue) && (o[c] = m);
|
|
20
21
|
});
|
|
21
|
-
const
|
|
22
|
-
t.set(a,
|
|
22
|
+
const S = { ...r, ...o };
|
|
23
|
+
t.set(a, S);
|
|
23
24
|
});
|
|
24
|
-
|
|
25
|
+
i({
|
|
25
26
|
source: e.eventBus,
|
|
26
27
|
filter: (s) => s.type === "initialized",
|
|
27
|
-
target: g
|
|
28
|
-
}), p({
|
|
29
|
-
source: e.responses.getAllStore,
|
|
30
28
|
target: u
|
|
29
|
+
}), i({
|
|
30
|
+
source: e.responses.getAllStore,
|
|
31
|
+
target: f
|
|
31
32
|
});
|
|
32
33
|
}
|
|
33
34
|
});
|
|
34
35
|
export {
|
|
35
|
-
|
|
36
|
+
R as responsesBrowserStoragePlugin
|
|
36
37
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createEffect as
|
|
1
|
+
import { createEffect as d, sample as p } from "effector";
|
|
2
2
|
const x = "picked";
|
|
3
|
-
async function
|
|
3
|
+
async function m(r) {
|
|
4
4
|
const { storeName: o, version: a = 1, keyPath: n = "id" } = r;
|
|
5
5
|
return new Promise((i, t) => {
|
|
6
6
|
const s = indexedDB.open(x, a);
|
|
@@ -49,48 +49,51 @@ async function S(r, o) {
|
|
|
49
49
|
};
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
const
|
|
52
|
+
const u = "responses", w = { storeName: u, keyPath: "fieldId" }, I = () => ({
|
|
53
53
|
name: "responses-indexdb-plugin",
|
|
54
54
|
setup: (r) => {
|
|
55
|
-
const o =
|
|
56
|
-
const t = await
|
|
57
|
-
(c, { fieldId:
|
|
55
|
+
const o = d(async () => {
|
|
56
|
+
const t = await m(w), e = (await g(t, u)).reduce(
|
|
57
|
+
(c, { fieldId: l, value: f }) => (c[l] = f, c),
|
|
58
58
|
{}
|
|
59
59
|
);
|
|
60
60
|
await r.responses.commit(e);
|
|
61
|
-
}), a =
|
|
61
|
+
}), a = d(
|
|
62
62
|
async (t) => {
|
|
63
63
|
t.forEach((s) => {
|
|
64
|
-
|
|
65
|
-
y(e,
|
|
64
|
+
m(w).then((e) => {
|
|
65
|
+
y(e, u, s);
|
|
66
66
|
}).catch((e) => {
|
|
67
67
|
console.error("Failed to store response in IndexedDB:", e);
|
|
68
68
|
});
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
|
-
), n =
|
|
72
|
-
const t = await
|
|
73
|
-
await S(t,
|
|
74
|
-
}), i =
|
|
75
|
-
const s = await
|
|
76
|
-
await b(s,
|
|
71
|
+
), n = d(async () => {
|
|
72
|
+
const t = await m(w);
|
|
73
|
+
await S(t, u);
|
|
74
|
+
}), i = d(async (t) => {
|
|
75
|
+
const s = await m(w);
|
|
76
|
+
await b(s, u, t);
|
|
77
77
|
});
|
|
78
|
-
|
|
78
|
+
p({
|
|
79
79
|
source: r.eventBus,
|
|
80
80
|
filter: (t) => t.type === "initialized",
|
|
81
81
|
target: o
|
|
82
|
-
}),
|
|
82
|
+
}), p({
|
|
83
83
|
clock: r.responses.listStore,
|
|
84
84
|
source: { responses: r.responses.listStore, fields: r.fields.listStore },
|
|
85
85
|
fn: ({ responses: t, fields: s }) => {
|
|
86
|
-
const e = s.filter((c) =>
|
|
87
|
-
|
|
86
|
+
const e = s.filter((c) => {
|
|
87
|
+
var l;
|
|
88
|
+
return !((l = c.policies) != null && l.doNotStoreValue);
|
|
89
|
+
});
|
|
90
|
+
return t.filter((c) => e.some((l) => l.id === c.fieldId));
|
|
88
91
|
},
|
|
89
92
|
target: a
|
|
90
|
-
}),
|
|
93
|
+
}), p({
|
|
91
94
|
clock: r.responses.clearAll,
|
|
92
95
|
target: n
|
|
93
|
-
}),
|
|
96
|
+
}), p({
|
|
94
97
|
clock: r.responses.clear,
|
|
95
98
|
target: i
|
|
96
99
|
});
|
|
@@ -9,80 +9,87 @@ export interface FieldBase {
|
|
|
9
9
|
type: 'text' | 'number' | 'object' | 'boolean';
|
|
10
10
|
multiple: boolean;
|
|
11
11
|
required: boolean;
|
|
12
|
-
defaultValue
|
|
12
|
+
defaultValue?: FieldValue;
|
|
13
13
|
condition?: LogicRule;
|
|
14
|
-
placeholder
|
|
15
|
-
description
|
|
16
|
-
helpText
|
|
17
|
-
validation
|
|
18
|
-
policies
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
helpText?: string;
|
|
17
|
+
validation?: LogicRule;
|
|
18
|
+
policies?: {
|
|
19
19
|
doNotTrackValue?: boolean;
|
|
20
20
|
doNotStoreValue?: boolean;
|
|
21
21
|
};
|
|
22
|
-
options
|
|
22
|
+
options?: {
|
|
23
23
|
id: string;
|
|
24
24
|
label: string;
|
|
25
25
|
value: PrimitiveFieldValue;
|
|
26
|
+
condition?: LogicRule;
|
|
26
27
|
}[] | null;
|
|
27
28
|
}
|
|
28
29
|
export interface FieldTextSingular extends FieldBase {
|
|
29
30
|
type: 'text';
|
|
30
31
|
multiple: false;
|
|
31
|
-
defaultValue
|
|
32
|
-
options
|
|
32
|
+
defaultValue?: string;
|
|
33
|
+
options?: {
|
|
33
34
|
id: string;
|
|
34
35
|
label: string;
|
|
35
36
|
value: string;
|
|
37
|
+
condition?: LogicRule;
|
|
36
38
|
}[] | null;
|
|
37
39
|
}
|
|
38
40
|
export interface FieldTextMultiple extends FieldBase {
|
|
39
41
|
type: 'text';
|
|
40
42
|
multiple: true;
|
|
41
|
-
defaultValue
|
|
42
|
-
options
|
|
43
|
+
defaultValue?: string[];
|
|
44
|
+
options?: {
|
|
43
45
|
id: string;
|
|
44
46
|
label: string;
|
|
45
47
|
value: string;
|
|
48
|
+
condition?: LogicRule;
|
|
46
49
|
}[] | null;
|
|
47
50
|
}
|
|
48
51
|
export interface FieldNumberSingular extends FieldBase {
|
|
49
52
|
type: 'number';
|
|
50
53
|
multiple: false;
|
|
51
|
-
defaultValue
|
|
52
|
-
options
|
|
54
|
+
defaultValue?: number;
|
|
55
|
+
options?: {
|
|
53
56
|
id: string;
|
|
54
57
|
label: string;
|
|
55
58
|
value: number;
|
|
59
|
+
condition?: LogicRule;
|
|
56
60
|
}[] | null;
|
|
57
61
|
}
|
|
58
62
|
export interface FieldNumberMultiple extends FieldBase {
|
|
59
63
|
type: 'number';
|
|
60
64
|
multiple: true;
|
|
61
|
-
defaultValue
|
|
62
|
-
options
|
|
65
|
+
defaultValue?: number[];
|
|
66
|
+
options?: {
|
|
63
67
|
id: string;
|
|
64
68
|
label: string;
|
|
65
69
|
value: number;
|
|
70
|
+
condition?: LogicRule;
|
|
66
71
|
}[] | null;
|
|
67
72
|
}
|
|
68
73
|
export interface FieldBooleanSingular extends FieldBase {
|
|
69
74
|
type: 'boolean';
|
|
70
75
|
multiple: false;
|
|
71
|
-
defaultValue
|
|
72
|
-
options
|
|
76
|
+
defaultValue?: boolean;
|
|
77
|
+
options?: {
|
|
73
78
|
id: string;
|
|
74
79
|
label: string;
|
|
75
80
|
value: boolean;
|
|
81
|
+
condition?: LogicRule;
|
|
76
82
|
}[] | null;
|
|
77
83
|
}
|
|
78
84
|
export interface FieldBooleanMultiple extends FieldBase {
|
|
79
85
|
type: 'boolean';
|
|
80
86
|
multiple: true;
|
|
81
|
-
defaultValue
|
|
82
|
-
options
|
|
87
|
+
defaultValue?: boolean[];
|
|
88
|
+
options?: {
|
|
83
89
|
id: string;
|
|
84
90
|
label: string;
|
|
85
91
|
value: boolean;
|
|
92
|
+
condition?: LogicRule;
|
|
86
93
|
}[] | null;
|
|
87
94
|
}
|
|
88
95
|
export type Field = FieldTextSingular | FieldTextMultiple | FieldNumberSingular | FieldNumberMultiple | FieldBooleanSingular | FieldBooleanMultiple;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../../src/entities/field/field.ts"],"names":[],"mappings":"AAEA,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;AAClE,MAAM,MAAM,UAAU,GAAG,mBAAmB,GAAG,mBAAmB,EAAE,CAAA;AAIpE,MAAM,WAAW,SAAS;IACxB,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,EAAE,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../../src/entities/field/field.ts"],"names":[],"mappings":"AAEA,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,OA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IACrD,IAAI,EAAE,SAAS,CAAA;IACf,QAAQ,EAAE,IAAI,CAAA;IACd,YAAY,CAAC,EAAE,OAAO,EAAE,CAAA;IACxB,OAAO,CAAC,EACJ;QACE,EAAE,EAAE,MAAM,CAAA;QACV,KAAK,EAAE,MAAM,CAAA;QACb,KAAK,EAAE,OAAO,CAAA;QACd,SAAS,CAAC,EAAE,SAAS,CAAA;KACtB,EAAE,GACH,IAAI,CAAA;CACT;AAED,MAAM,MAAM,KAAK,GACb,iBAAiB,GACjB,iBAAiB,GACjB,mBAAmB,GACnB,mBAAmB,GAGnB,oBAAoB,GACpB,oBAAoB,CAAA;AAGxB,QAAA,MAAM,uBAAuB;sBAcF,KAAK,KAAG,IAAI;kBAQhB,SAAS,CAAC,IAAI,CAAC;;sBAIX,SAAS,CAAC,MAAM,CAAC;CAU1C,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,6 +1,6 @@
|
|
|
1
1
|
import { StateSnapshot } from '../../utils/state-snaphot';
|
|
2
2
|
import { Picked } from '../../picked';
|
|
3
|
-
export type Predicate = (snapshot: StateSnapshot) => boolean | Promise<boolean> | string | Promise<string> | undefined;
|
|
3
|
+
export type Predicate = (snapshot: StateSnapshot) => boolean | Promise<boolean> | string | Promise<string> | string[] | Promise<string[]> | undefined;
|
|
4
4
|
export type PredicatesStore = ReturnType<typeof createPredicateIndex>;
|
|
5
5
|
export interface PredicateIndexItem {
|
|
6
6
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"predicate.d.ts","sourceRoot":"","sources":["../../../../src/entities/predicate/predicate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C,MAAM,MAAM,SAAS,GAAG,CACtB,QAAQ,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"predicate.d.ts","sourceRoot":"","sources":["../../../../src/entities/predicate/predicate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C,MAAM,MAAM,SAAS,GAAG,CACtB,QAAQ,EAAE,aAAa,KAErB,OAAO,GACP,OAAO,CAAC,OAAO,CAAC,GAChB,MAAM,GACN,OAAO,CAAC,MAAM,CAAC,GACf,MAAM,EAAE,GACR,OAAO,CAAC,MAAM,EAAE,CAAC,GACjB,SAAS,CAAA;AAEb,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAErE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,SAAS,CAAA;CACrB;AAKD,QAAA,MAAM,2BAA2B,eAA8B;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;qBAoBvD,MAAM,aAAa,SAAS,KAAG,IAAI;sBAiBlC,MAAM;cAlCrB,MAAM;mBACD,SAAS;;;cADd,MAAM;mBACD,SAAS;;CA0CxB,CAAA;AAEF,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAAC,CAAC,CAAC,EAC9F,MAAM,EAAE,CAAC,GACR,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAEhD;AAED,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,WAAW,SAAS,EAAE,YAAY,eAAe,SAE7F,CAAA"}
|
|
@@ -80,8 +80,17 @@ export interface SerializableConditional extends Nodeable {
|
|
|
80
80
|
export interface CreateConditionalOptions {
|
|
81
81
|
condition: LogicRule;
|
|
82
82
|
}
|
|
83
|
-
export type CreateFieldOptions = Omit<Field, 'options'> & {
|
|
84
|
-
|
|
83
|
+
export type CreateFieldOptions = Omit<Field, 'options' | 'placeholder' | 'description' | 'helpText' | 'validation' | 'policies' | 'defaultValue'> & {
|
|
84
|
+
defaultValue?: string | number | boolean | object | null | string[] | number[] | boolean[] | object[];
|
|
85
|
+
placeholder?: string;
|
|
86
|
+
description?: string;
|
|
87
|
+
helpText?: string;
|
|
88
|
+
validation?: LogicRule;
|
|
89
|
+
policies?: {
|
|
90
|
+
doNotTrackValue?: boolean;
|
|
91
|
+
doNotStoreValue?: boolean;
|
|
92
|
+
};
|
|
93
|
+
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][];
|
|
85
94
|
};
|
|
86
95
|
export type SerializableField = {
|
|
87
96
|
id: string;
|
|
@@ -91,12 +100,12 @@ export type SerializableField = {
|
|
|
91
100
|
multiple: boolean;
|
|
92
101
|
required: boolean;
|
|
93
102
|
defaultValue: string | number | boolean | object | null | string[] | number[] | boolean[] | object[];
|
|
94
|
-
placeholder
|
|
95
|
-
description
|
|
96
|
-
helpText
|
|
103
|
+
placeholder?: string;
|
|
104
|
+
description?: string;
|
|
105
|
+
helpText?: string;
|
|
97
106
|
validation: LogicRule;
|
|
98
107
|
condition?: LogicRule;
|
|
99
|
-
policies
|
|
108
|
+
policies?: {
|
|
100
109
|
doNotTrackValue?: boolean;
|
|
101
110
|
doNotStoreValue?: boolean;
|
|
102
111
|
};
|
|
@@ -104,6 +113,7 @@ export type SerializableField = {
|
|
|
104
113
|
id: string;
|
|
105
114
|
label: string;
|
|
106
115
|
value: string | number | boolean | object;
|
|
116
|
+
condition?: LogicRule;
|
|
107
117
|
}[] | null;
|
|
108
118
|
} & {
|
|
109
119
|
serialize: () => Serialized<Field>;
|