@picked/client 0.0.1-dev.1773365725739 → 0.0.1-dev.1773371977114
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-B3JRgxph.js → api-CLwLE-DW.js} +1 -1
- package/dist/{api-F0IOGUor.cjs → api-Cn-rv5A5.cjs} +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/esm/index.js +558 -554
- package/dist/esm/plugins/create-experience/index.js +173 -174
- package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
- package/dist/types/entities/field/field.d.ts +18 -3
- package/dist/types/entities/field/field.d.ts.map +1 -1
- package/dist/types/entities/response/response.d.ts +6 -2
- package/dist/types/entities/response/response.d.ts.map +1 -1
- package/dist/types/picked.d.ts +6 -2
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +5 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as
|
|
1
|
+
import { g as p } from "../../../id-BW-g3y32.js";
|
|
2
2
|
import { t as m } from "../../../to-kebab-case-BPnCZjhB.js";
|
|
3
3
|
const r = {
|
|
4
4
|
serialize(i) {
|
|
@@ -9,42 +9,42 @@ const r = {
|
|
|
9
9
|
}
|
|
10
10
|
}, x = (i) => ({
|
|
11
11
|
name: "create-experience",
|
|
12
|
-
setup: (
|
|
13
|
-
i.experiences.forEach((
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
setup: (d) => {
|
|
13
|
+
i.experiences.forEach((n) => {
|
|
14
|
+
const o = n.serialize(), s = r.deserialize(o);
|
|
15
|
+
s.component = n.component, d.registerExperience(s), s.fields.forEach((u) => {
|
|
16
|
+
d.registerField(u);
|
|
17
17
|
});
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
}), N = (i,
|
|
21
|
-
id:
|
|
22
|
-
experience:
|
|
20
|
+
}), N = (i, d) => ({
|
|
21
|
+
id: p("node"),
|
|
22
|
+
experience: d,
|
|
23
23
|
type: "action",
|
|
24
24
|
action: i.action,
|
|
25
|
-
addNext(
|
|
26
|
-
if (!
|
|
27
|
-
const
|
|
28
|
-
{ sourceNode: this, destinationNode:
|
|
29
|
-
|
|
25
|
+
addNext(o) {
|
|
26
|
+
if (!o.node) throw new Error("Cannot connect to node");
|
|
27
|
+
const s = h(
|
|
28
|
+
{ sourceNode: this, destinationNode: o.node, sourceNodeHandle: null },
|
|
29
|
+
d
|
|
30
30
|
);
|
|
31
|
-
|
|
31
|
+
d.edges.push(s);
|
|
32
32
|
},
|
|
33
|
-
onSuccess(
|
|
34
|
-
if (!
|
|
35
|
-
const
|
|
36
|
-
{ sourceNode: this, destinationNode:
|
|
37
|
-
|
|
33
|
+
onSuccess(o) {
|
|
34
|
+
if (!o.node) throw new Error("Cannot connect to node");
|
|
35
|
+
const s = h(
|
|
36
|
+
{ sourceNode: this, destinationNode: o.node, sourceNodeHandle: "true" },
|
|
37
|
+
d
|
|
38
38
|
);
|
|
39
|
-
|
|
39
|
+
d.edges.push(s);
|
|
40
40
|
},
|
|
41
|
-
onFail(
|
|
42
|
-
if (!
|
|
43
|
-
const
|
|
44
|
-
{ sourceNode: this, destinationNode:
|
|
45
|
-
|
|
41
|
+
onFail(o) {
|
|
42
|
+
if (!o.node) throw new Error("Cannot connect to node");
|
|
43
|
+
const s = h(
|
|
44
|
+
{ sourceNode: this, destinationNode: o.node, sourceNodeHandle: "false" },
|
|
45
|
+
d
|
|
46
46
|
);
|
|
47
|
-
|
|
47
|
+
d.edges.push(s);
|
|
48
48
|
},
|
|
49
49
|
serialize() {
|
|
50
50
|
return r.serialize({
|
|
@@ -53,53 +53,56 @@ const r = {
|
|
|
53
53
|
action: this.action
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
-
}), V = (i) =>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
56
|
+
}), V = (i) => {
|
|
57
|
+
const d = i.name ?? i.label ?? "";
|
|
58
|
+
return {
|
|
59
|
+
id: i.id ?? p("step"),
|
|
60
|
+
key: i.key ?? m(d),
|
|
61
|
+
name: d,
|
|
62
|
+
fields: i.fields ?? [],
|
|
63
|
+
addField(n) {
|
|
64
|
+
const o = "serialize" in n ? n : y(n);
|
|
65
|
+
return this.fields.includes(o) || this.fields.push(o), o;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}, z = (i, d) => {
|
|
69
|
+
const n = "label" in i ? i.label : void 0, o = i.name ?? n ?? "", s = {
|
|
70
|
+
id: i.id ?? p("step"),
|
|
71
|
+
key: i.key ?? m(o),
|
|
72
|
+
name: o,
|
|
73
|
+
experience: d,
|
|
71
74
|
fields: i.fields ?? [],
|
|
72
75
|
node: null,
|
|
73
|
-
nextStep(
|
|
74
|
-
return this.experience.addStep(
|
|
76
|
+
nextStep(u) {
|
|
77
|
+
return this.experience.addStep(u, this);
|
|
75
78
|
},
|
|
76
|
-
nextConditional(
|
|
77
|
-
return this.experience.addConditional(
|
|
79
|
+
nextConditional(u) {
|
|
80
|
+
return this.experience.addConditional(u, this);
|
|
78
81
|
},
|
|
79
|
-
addNextExperience(
|
|
80
|
-
return this.experience.addExperience(
|
|
82
|
+
addNextExperience(u) {
|
|
83
|
+
return this.experience.addExperience(u, this);
|
|
81
84
|
},
|
|
82
|
-
addField(
|
|
83
|
-
return this.experience.addField(
|
|
85
|
+
addField(u) {
|
|
86
|
+
return this.experience.addField(u, this);
|
|
84
87
|
},
|
|
85
88
|
serialize() {
|
|
86
89
|
return r.serialize({
|
|
87
90
|
id: this.id,
|
|
88
91
|
key: m(this.name),
|
|
89
92
|
name: this.name,
|
|
90
|
-
fieldIds: this.fields.map((
|
|
93
|
+
fieldIds: this.fields.map((u) => u.id)
|
|
91
94
|
});
|
|
92
95
|
}
|
|
93
96
|
};
|
|
94
|
-
return
|
|
95
|
-
},
|
|
96
|
-
const
|
|
97
|
-
id:
|
|
98
|
-
experience:
|
|
97
|
+
return f({ step: s, type: "step" }, d), s;
|
|
98
|
+
}, f = (i, d) => {
|
|
99
|
+
const n = {
|
|
100
|
+
id: p("node"),
|
|
101
|
+
experience: d
|
|
99
102
|
};
|
|
100
103
|
if (i.type === "step") {
|
|
101
|
-
const
|
|
102
|
-
...
|
|
104
|
+
const s = {
|
|
105
|
+
...n,
|
|
103
106
|
type: "step",
|
|
104
107
|
connectedStep: i.step,
|
|
105
108
|
serialize() {
|
|
@@ -111,11 +114,11 @@ const r = {
|
|
|
111
114
|
});
|
|
112
115
|
}
|
|
113
116
|
};
|
|
114
|
-
return
|
|
117
|
+
return s.connectedStep.node = s, s;
|
|
115
118
|
}
|
|
116
119
|
if (i.type === "conditional") {
|
|
117
|
-
const
|
|
118
|
-
...
|
|
120
|
+
const s = {
|
|
121
|
+
...n,
|
|
119
122
|
type: "conditional",
|
|
120
123
|
connectedConditional: i.conditional,
|
|
121
124
|
serialize() {
|
|
@@ -126,10 +129,10 @@ const r = {
|
|
|
126
129
|
});
|
|
127
130
|
}
|
|
128
131
|
};
|
|
129
|
-
return
|
|
132
|
+
return s.connectedConditional.node = s, s;
|
|
130
133
|
}
|
|
131
134
|
return i.type === "experience" ? {
|
|
132
|
-
...
|
|
135
|
+
...n,
|
|
133
136
|
type: "experience",
|
|
134
137
|
connectedExperience: i.experience,
|
|
135
138
|
serialize() {
|
|
@@ -140,7 +143,7 @@ const r = {
|
|
|
140
143
|
});
|
|
141
144
|
}
|
|
142
145
|
} : {
|
|
143
|
-
...
|
|
146
|
+
...n,
|
|
144
147
|
type: "origin",
|
|
145
148
|
serialize() {
|
|
146
149
|
return r.serialize({
|
|
@@ -149,12 +152,12 @@ const r = {
|
|
|
149
152
|
});
|
|
150
153
|
}
|
|
151
154
|
};
|
|
152
|
-
},
|
|
153
|
-
id:
|
|
155
|
+
}, h = (i, d) => ({
|
|
156
|
+
id: p("edge"),
|
|
154
157
|
sourceNode: i.sourceNode,
|
|
155
158
|
sourceNodeHandle: i.sourceNodeHandle,
|
|
156
159
|
destinationNode: i.destinationNode,
|
|
157
|
-
experience:
|
|
160
|
+
experience: d,
|
|
158
161
|
serialize() {
|
|
159
162
|
return r.serialize({
|
|
160
163
|
id: this.id,
|
|
@@ -163,30 +166,30 @@ const r = {
|
|
|
163
166
|
destinationNodeId: this.destinationNode.id
|
|
164
167
|
});
|
|
165
168
|
}
|
|
166
|
-
}), g = (i,
|
|
167
|
-
const
|
|
168
|
-
id:
|
|
169
|
+
}), g = (i, d) => {
|
|
170
|
+
const n = {
|
|
171
|
+
id: p("conditional"),
|
|
169
172
|
label: i.label,
|
|
170
173
|
condition: i.condition,
|
|
171
174
|
node: null,
|
|
172
|
-
experience:
|
|
173
|
-
addTrue(
|
|
174
|
-
if (!this.node || !
|
|
175
|
+
experience: d,
|
|
176
|
+
addTrue(o) {
|
|
177
|
+
if (!this.node || !o.node)
|
|
175
178
|
throw new Error("todo no node");
|
|
176
|
-
const
|
|
177
|
-
{ sourceNode: this.node, destinationNode:
|
|
179
|
+
const s = h(
|
|
180
|
+
{ sourceNode: this.node, destinationNode: o.node, sourceNodeHandle: "true" },
|
|
178
181
|
this.experience
|
|
179
182
|
);
|
|
180
|
-
this.experience.edges.push(
|
|
183
|
+
this.experience.edges.push(s);
|
|
181
184
|
},
|
|
182
|
-
addFalse(
|
|
183
|
-
if (!this.node || !
|
|
185
|
+
addFalse(o) {
|
|
186
|
+
if (!this.node || !o.node)
|
|
184
187
|
throw new Error("todo no node");
|
|
185
|
-
const
|
|
186
|
-
{ sourceNode: this.node, destinationNode:
|
|
188
|
+
const s = h(
|
|
189
|
+
{ sourceNode: this.node, destinationNode: o.node, sourceNodeHandle: "false" },
|
|
187
190
|
this.experience
|
|
188
191
|
);
|
|
189
|
-
this.experience.edges.push(
|
|
192
|
+
this.experience.edges.push(s);
|
|
190
193
|
},
|
|
191
194
|
serialize() {
|
|
192
195
|
return r.serialize({
|
|
@@ -196,9 +199,9 @@ const r = {
|
|
|
196
199
|
});
|
|
197
200
|
}
|
|
198
201
|
};
|
|
199
|
-
return
|
|
202
|
+
return f({ conditional: n, type: "conditional" }, d), n;
|
|
200
203
|
}, y = (i) => ({
|
|
201
|
-
id: i.id ??
|
|
204
|
+
id: i.id ?? p("field"),
|
|
202
205
|
key: i.key ?? m(i.name),
|
|
203
206
|
name: i.name,
|
|
204
207
|
type: i.type,
|
|
@@ -211,14 +214,14 @@ const r = {
|
|
|
211
214
|
validation: i.validation ?? {},
|
|
212
215
|
condition: i.condition,
|
|
213
216
|
required: i.required,
|
|
214
|
-
options: i.options?.map((
|
|
215
|
-
id: "id" in
|
|
216
|
-
...
|
|
217
|
+
options: i.options?.map((n) => ({
|
|
218
|
+
id: "id" in n ? n.id : p("option"),
|
|
219
|
+
...n
|
|
217
220
|
})) ?? null,
|
|
218
221
|
policies: i.policies,
|
|
219
222
|
// eslint-disable-next-line sonarjs/cognitive-complexity -- this function handles all field types and subtypes; splitting it would increase indirection without improving clarity. Addressed in PR #1372
|
|
220
223
|
serialize() {
|
|
221
|
-
const
|
|
224
|
+
const n = {
|
|
222
225
|
id: this.id,
|
|
223
226
|
key: this.key,
|
|
224
227
|
name: this.name,
|
|
@@ -230,35 +233,35 @@ const r = {
|
|
|
230
233
|
validation: this.validation,
|
|
231
234
|
condition: this.condition,
|
|
232
235
|
policies: this.policies
|
|
233
|
-
},
|
|
236
|
+
}, o = typeof this.defaultValue == "string" ? this.defaultValue : void 0, s = typeof this.defaultValue == "number" ? this.defaultValue : void 0, u = typeof this.defaultValue == "boolean" ? this.defaultValue : void 0;
|
|
234
237
|
switch (this.type) {
|
|
235
238
|
case "text":
|
|
236
239
|
if (this.multiple) {
|
|
237
240
|
let e;
|
|
238
241
|
if (Array.isArray(this.defaultValue)) {
|
|
239
242
|
e = [];
|
|
240
|
-
for (const
|
|
241
|
-
typeof
|
|
243
|
+
for (const t of this.defaultValue)
|
|
244
|
+
typeof t == "string" && e.push(t);
|
|
242
245
|
e.length === 0 && (e = void 0);
|
|
243
246
|
}
|
|
244
247
|
return r.serialize({
|
|
245
|
-
...
|
|
248
|
+
...n,
|
|
246
249
|
type: "text",
|
|
247
250
|
multiple: !0,
|
|
248
251
|
defaultValue: e,
|
|
249
|
-
options: this.options ? this.options.map((
|
|
250
|
-
id:
|
|
251
|
-
label:
|
|
252
|
-
value: `${
|
|
253
|
-
condition:
|
|
252
|
+
options: this.options ? this.options.map((t) => ({
|
|
253
|
+
id: t.id,
|
|
254
|
+
label: t.label,
|
|
255
|
+
value: `${t.value}`,
|
|
256
|
+
condition: t.condition
|
|
254
257
|
})) : null
|
|
255
258
|
});
|
|
256
259
|
}
|
|
257
260
|
return r.serialize({
|
|
258
|
-
...
|
|
261
|
+
...n,
|
|
259
262
|
type: "text",
|
|
260
263
|
multiple: !1,
|
|
261
|
-
defaultValue:
|
|
264
|
+
defaultValue: o,
|
|
262
265
|
options: this.options ? this.options.map((e) => ({
|
|
263
266
|
id: e.id,
|
|
264
267
|
label: e.label,
|
|
@@ -271,28 +274,28 @@ const r = {
|
|
|
271
274
|
let e;
|
|
272
275
|
if (Array.isArray(this.defaultValue)) {
|
|
273
276
|
e = [];
|
|
274
|
-
for (const
|
|
275
|
-
typeof
|
|
277
|
+
for (const t of this.defaultValue)
|
|
278
|
+
typeof t == "number" && e.push(t);
|
|
276
279
|
e.length === 0 && (e = void 0);
|
|
277
280
|
}
|
|
278
281
|
return r.serialize({
|
|
279
|
-
...
|
|
282
|
+
...n,
|
|
280
283
|
type: "number",
|
|
281
284
|
multiple: !0,
|
|
282
285
|
defaultValue: e,
|
|
283
|
-
options: this.options ? this.options.map((
|
|
284
|
-
id:
|
|
285
|
-
label:
|
|
286
|
-
value: Number(
|
|
287
|
-
condition:
|
|
286
|
+
options: this.options ? this.options.map((t) => ({
|
|
287
|
+
id: t.id,
|
|
288
|
+
label: t.label,
|
|
289
|
+
value: Number(t.value),
|
|
290
|
+
condition: t.condition
|
|
288
291
|
})) : null
|
|
289
292
|
});
|
|
290
293
|
}
|
|
291
294
|
return r.serialize({
|
|
292
|
-
...
|
|
295
|
+
...n,
|
|
293
296
|
type: "number",
|
|
294
297
|
multiple: !1,
|
|
295
|
-
defaultValue:
|
|
298
|
+
defaultValue: s,
|
|
296
299
|
options: this.options ? this.options.map((e) => ({
|
|
297
300
|
id: e.id,
|
|
298
301
|
label: e.label,
|
|
@@ -305,28 +308,28 @@ const r = {
|
|
|
305
308
|
let e;
|
|
306
309
|
if (Array.isArray(this.defaultValue)) {
|
|
307
310
|
e = [];
|
|
308
|
-
for (const
|
|
309
|
-
typeof
|
|
311
|
+
for (const t of this.defaultValue)
|
|
312
|
+
typeof t == "boolean" && e.push(t);
|
|
310
313
|
e.length === 0 && (e = void 0);
|
|
311
314
|
}
|
|
312
315
|
return r.serialize({
|
|
313
|
-
...
|
|
316
|
+
...n,
|
|
314
317
|
type: "boolean",
|
|
315
318
|
multiple: !0,
|
|
316
319
|
defaultValue: e,
|
|
317
|
-
options: this.options ? this.options.map((
|
|
318
|
-
id:
|
|
319
|
-
label:
|
|
320
|
-
value: !!
|
|
321
|
-
condition:
|
|
320
|
+
options: this.options ? this.options.map((t) => ({
|
|
321
|
+
id: t.id,
|
|
322
|
+
label: t.label,
|
|
323
|
+
value: !!t.value,
|
|
324
|
+
condition: t.condition
|
|
322
325
|
})) : null
|
|
323
326
|
});
|
|
324
327
|
}
|
|
325
328
|
return r.serialize({
|
|
326
|
-
...
|
|
329
|
+
...n,
|
|
327
330
|
type: "boolean",
|
|
328
331
|
multiple: !1,
|
|
329
|
-
defaultValue:
|
|
332
|
+
defaultValue: u,
|
|
330
333
|
options: this.options ? this.options.map((e) => ({
|
|
331
334
|
id: e.id,
|
|
332
335
|
label: e.label,
|
|
@@ -336,7 +339,7 @@ const r = {
|
|
|
336
339
|
});
|
|
337
340
|
case "object":
|
|
338
341
|
return this.multiple ? r.serialize({
|
|
339
|
-
...
|
|
342
|
+
...n,
|
|
340
343
|
type: "object",
|
|
341
344
|
multiple: !0,
|
|
342
345
|
defaultValue: this.defaultValue,
|
|
@@ -348,7 +351,7 @@ const r = {
|
|
|
348
351
|
condition: e.condition
|
|
349
352
|
})) : null
|
|
350
353
|
}) : r.serialize({
|
|
351
|
-
...
|
|
354
|
+
...n,
|
|
352
355
|
type: "object",
|
|
353
356
|
multiple: !1,
|
|
354
357
|
defaultValue: this.defaultValue,
|
|
@@ -365,7 +368,7 @@ const r = {
|
|
|
365
368
|
}
|
|
366
369
|
}
|
|
367
370
|
}), E = (i) => {
|
|
368
|
-
const
|
|
371
|
+
const d = [], n = [], o = [], s = [], u = [];
|
|
369
372
|
return {
|
|
370
373
|
id: i.id,
|
|
371
374
|
component: i.component,
|
|
@@ -373,79 +376,75 @@ const r = {
|
|
|
373
376
|
initializeOpen: i.initializeOpen,
|
|
374
377
|
condition: i.condition,
|
|
375
378
|
targets: i.targets,
|
|
376
|
-
steps:
|
|
377
|
-
nodes:
|
|
378
|
-
edges:
|
|
379
|
-
fields:
|
|
380
|
-
conditionals:
|
|
381
|
-
addStep(e,
|
|
382
|
-
let
|
|
383
|
-
this.nodes.length === 0 && (
|
|
384
|
-
|
|
385
|
-
if (
|
|
386
|
-
|
|
387
|
-
id: d.id ?? h("step"),
|
|
388
|
-
key: d.key ?? m(d.name)
|
|
389
|
-
}, a) {
|
|
390
|
-
if (!d.node)
|
|
379
|
+
steps: d,
|
|
380
|
+
nodes: n,
|
|
381
|
+
edges: o,
|
|
382
|
+
fields: u,
|
|
383
|
+
conditionals: s,
|
|
384
|
+
addStep(e, t) {
|
|
385
|
+
let l = t?.node;
|
|
386
|
+
this.nodes.length === 0 && (l = f({ type: "origin" }, this), this.nodes.push(l));
|
|
387
|
+
const a = "serialize" in e ? e : z(e, this);
|
|
388
|
+
if (l) {
|
|
389
|
+
if (!a.node)
|
|
391
390
|
throw new Error("todo no node");
|
|
392
|
-
const
|
|
393
|
-
{ sourceNode:
|
|
391
|
+
const c = h(
|
|
392
|
+
{ sourceNode: l, destinationNode: a.node, sourceNodeHandle: null },
|
|
394
393
|
this
|
|
395
394
|
);
|
|
396
|
-
this.edges.push(
|
|
395
|
+
this.edges.push(c);
|
|
397
396
|
}
|
|
398
|
-
return
|
|
399
|
-
this.fields.includes(
|
|
400
|
-
}), this.steps.includes(
|
|
397
|
+
return a.fields.length > 0 && a.fields.forEach((c) => {
|
|
398
|
+
this.fields.includes(c) || this.fields.push(c);
|
|
399
|
+
}), this.steps.includes(a) || (this.steps.push(a), a.node && this.nodes.push(a.node)), a;
|
|
401
400
|
},
|
|
402
|
-
addAction(e,
|
|
403
|
-
let
|
|
404
|
-
this.nodes.length === 0 && (
|
|
405
|
-
const
|
|
406
|
-
if (
|
|
407
|
-
const
|
|
408
|
-
{ sourceNode:
|
|
401
|
+
addAction(e, t) {
|
|
402
|
+
let l = t?.node;
|
|
403
|
+
this.nodes.length === 0 && (l = f({ type: "origin" }, this), this.nodes.push(l));
|
|
404
|
+
const a = "serialize" in e ? e : N(e, this);
|
|
405
|
+
if (l) {
|
|
406
|
+
const c = h(
|
|
407
|
+
{ sourceNode: l, destinationNode: a, sourceNodeHandle: null },
|
|
409
408
|
this
|
|
410
409
|
);
|
|
411
|
-
this.edges.push(
|
|
410
|
+
this.edges.push(c);
|
|
412
411
|
}
|
|
413
|
-
return this.nodes.push(
|
|
412
|
+
return this.nodes.push(a), a;
|
|
414
413
|
},
|
|
415
|
-
addConditional(e,
|
|
416
|
-
let
|
|
417
|
-
this.nodes.length === 0 && (
|
|
418
|
-
const
|
|
419
|
-
if (
|
|
420
|
-
if (!
|
|
414
|
+
addConditional(e, t) {
|
|
415
|
+
let l = t?.node;
|
|
416
|
+
this.nodes.length === 0 && (l = f({ type: "origin" }, this), this.nodes.push(l));
|
|
417
|
+
const a = "serialize" in e ? e : g(e, this);
|
|
418
|
+
if (l) {
|
|
419
|
+
if (!a.node)
|
|
421
420
|
throw new Error("todo no node");
|
|
422
|
-
const
|
|
423
|
-
{ sourceNode:
|
|
421
|
+
const c = h(
|
|
422
|
+
{ sourceNode: l, destinationNode: a.node, sourceNodeHandle: null },
|
|
424
423
|
this
|
|
425
424
|
);
|
|
426
|
-
this.edges.push(
|
|
425
|
+
this.edges.push(c);
|
|
427
426
|
}
|
|
428
|
-
return this.conditionals.includes(
|
|
427
|
+
return this.conditionals.includes(a) || (this.conditionals.push(a), a.node && this.nodes.push(a.node)), a;
|
|
429
428
|
},
|
|
430
|
-
addExperience(e,
|
|
431
|
-
let
|
|
432
|
-
this.nodes.length === 0 && (
|
|
433
|
-
const
|
|
429
|
+
addExperience(e, t) {
|
|
430
|
+
let l = t?.node;
|
|
431
|
+
this.nodes.length === 0 && (l = f({ type: "origin" }, this), this.nodes.push(l));
|
|
432
|
+
const a = f(
|
|
434
433
|
{ type: "experience", experience: e },
|
|
435
434
|
this
|
|
436
435
|
);
|
|
437
|
-
if (this.nodes.push(
|
|
438
|
-
const
|
|
439
|
-
{ sourceNode:
|
|
436
|
+
if (this.nodes.push(a), l) {
|
|
437
|
+
const c = h(
|
|
438
|
+
{ sourceNode: l, destinationNode: a, sourceNodeHandle: null },
|
|
440
439
|
this
|
|
441
440
|
);
|
|
442
|
-
this.edges.push(
|
|
441
|
+
this.edges.push(c);
|
|
443
442
|
}
|
|
444
443
|
return e;
|
|
445
444
|
},
|
|
446
|
-
addField(e,
|
|
447
|
-
const
|
|
448
|
-
return
|
|
445
|
+
addField(e, t) {
|
|
446
|
+
const l = "serialize" in e ? e : y(e);
|
|
447
|
+
return t && t.fields.push(l), this.fields.includes(l) || this.fields.push(l), l;
|
|
449
448
|
},
|
|
450
449
|
serialize() {
|
|
451
450
|
return r.serialize({
|
|
@@ -468,11 +467,11 @@ const r = {
|
|
|
468
467
|
};
|
|
469
468
|
export {
|
|
470
469
|
g as createConditional,
|
|
471
|
-
|
|
470
|
+
h as createEdge,
|
|
472
471
|
E as createExperience,
|
|
473
472
|
x as createExperiencePlugin,
|
|
474
473
|
y as createField,
|
|
475
|
-
|
|
474
|
+
f as createNode,
|
|
476
475
|
V as createStep,
|
|
477
476
|
r as serialization
|
|
478
477
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as l } from "../../../api-
|
|
2
|
-
import { c as S } from "../../../api-
|
|
1
|
+
import { a as l } from "../../../api-CLwLE-DW.js";
|
|
2
|
+
import { c as S } from "../../../api-CLwLE-DW.js";
|
|
3
3
|
import { l as a } from "../../../logger-C9a75KZn.js";
|
|
4
4
|
function d(e) {
|
|
5
5
|
let r = 2166136261;
|
|
@@ -13,11 +13,23 @@ export type FieldValue = PrimitiveFieldValue | PrimitiveFieldValue[] | JsonValue
|
|
|
13
13
|
export interface FieldBase<TOptionValue = PrimitiveFieldValue> {
|
|
14
14
|
/** Database row id assigned by the API. Not set on locally-defined fields. */
|
|
15
15
|
id: string;
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Stable kebab-case identifier. Auto-derived from `name` via `toKebabCase` if not provided.
|
|
18
|
+
*
|
|
19
|
+
* @example "first-name".
|
|
20
|
+
*/
|
|
17
21
|
key: string;
|
|
18
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Human-readable name,
|
|
24
|
+
*
|
|
25
|
+
* @example "First Name".
|
|
26
|
+
*/
|
|
19
27
|
name: string;
|
|
20
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Label used the render it to UI
|
|
30
|
+
*
|
|
31
|
+
* @example "What Is Your First Name"
|
|
32
|
+
*/
|
|
21
33
|
label: string;
|
|
22
34
|
type: 'text' | 'number' | 'object' | 'boolean';
|
|
23
35
|
multiple: boolean;
|
|
@@ -89,6 +101,9 @@ declare const createFieldIndexFactory: () => {
|
|
|
89
101
|
listStore: Store<Field[]>;
|
|
90
102
|
getByName: (name: FieldBase["name"]) => Store<Field | null>;
|
|
91
103
|
};
|
|
104
|
+
/**
|
|
105
|
+
*
|
|
106
|
+
*/
|
|
92
107
|
export declare function createFieldIndex(): ReturnType<typeof createFieldIndexFactory>;
|
|
93
108
|
export declare const setupField: (field: Field, fields: FieldsStore) => void;
|
|
94
109
|
export {};
|
|
@@ -1 +1 @@
|
|
|
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,8EAA8E;IAC9E,EAAE,EAAE,MAAM,CAAA;IACV
|
|
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;AAI7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AAA;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;sBAkBF,KAAK,KAAG,IAAI;uBAaX,MAAM,WAAW,OAAO,CAAC,KAAK,CAAC,KAAG,IAAI;oBAuBzC,MAAM;kBAQR,MAAM,KAAG,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC;;sBAQxB,SAAS,CAAC,MAAM,CAAC,KAAG,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC;CAchE,CAAA;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAE7E;AAED,eAAO,MAAM,UAAU,GAAI,OAAO,KAAK,EAAE,QAAQ,WAAW,KAAG,IAE9D,CAAA"}
|
|
@@ -30,9 +30,13 @@ declare const createResponseIndexFactory: ({ client }: {
|
|
|
30
30
|
getAllStore: Store<{
|
|
31
31
|
[fieldId: string]: FieldValue;
|
|
32
32
|
}>;
|
|
33
|
+
getByFieldKey: {
|
|
34
|
+
(fieldKey: Field["key"]): Store<FieldValue>;
|
|
35
|
+
<T extends JsonValue>(fieldKey: Field["key"]): Store<T | null>;
|
|
36
|
+
};
|
|
33
37
|
getByFieldId: {
|
|
34
|
-
(
|
|
35
|
-
<T extends JsonValue>(
|
|
38
|
+
(fieldKey: Field["key"]): Store<FieldValue>;
|
|
39
|
+
<T extends JsonValue>(fieldKey: Field["key"]): Store<T | null>;
|
|
36
40
|
};
|
|
37
41
|
getByFieldName: (fieldName: Field["name"]) => Store<FieldValue>;
|
|
38
42
|
};
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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,CAAA;AAGjC,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,QAAQ,GAAG,SAAS,CAAA;CAC5B;AAED,QAAA,MAAM,0BAA0B,eAA8B;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;;kBA+BnD,MAAM,YAAY,QAAQ,GAAG,IAAI;kBACjC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,aAAa,KAAK,GAAG,IAAI;;;;gCAyOvD,eAAe,KACjC,OAAO,CAAC;QAAE,MAAM,EAAE,eAAe,EAAE,CAAA;KAAE,CAAC;8CAxNpB,eAAe,KACjC,OAAO,CAAC;QAAE,iBAAiB,EAAE,eAAe,CAAC;QAAC,gBAAgB,EAAE,eAAe,EAAE,CAAA;KAAE,CAAC;;;;;;;;;mBAmPtD,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC;SAE1C,CAAC,SAAS,SAAS,YAAY,KAAK,CAAC,KAAK,CAAC,GAAG,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