@picked/client 0.0.48 → 0.0.49
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-CbpxV_xX.cjs → api-BO25XMFT.cjs} +1 -1
- package/dist/{api-CTXU-Aoh.js → api-Dwv3CsVW.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/esm/index.js +338 -330
- package/dist/esm/plugins/create-experience/index.js +201 -209
- package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
- package/dist/types/client.d.ts +13 -0
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/entities/experience/experience.d.ts +28 -15
- package/dist/types/entities/experience/experience.d.ts.map +1 -1
- package/dist/types/picked.d.ts +7 -5
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +0 -7
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,30 +1,29 @@
|
|
|
1
|
-
import { g as
|
|
1
|
+
import { g as p } from "../../../id-BW-g3y32.js";
|
|
2
2
|
const r = {
|
|
3
|
-
serialize(
|
|
4
|
-
return JSON.stringify(
|
|
3
|
+
serialize(i) {
|
|
4
|
+
return JSON.stringify(i);
|
|
5
5
|
},
|
|
6
|
-
deserialize(
|
|
7
|
-
return JSON.parse(
|
|
6
|
+
deserialize(i) {
|
|
7
|
+
return JSON.parse(i);
|
|
8
8
|
}
|
|
9
|
-
},
|
|
9
|
+
}, b = (i) => ({
|
|
10
10
|
name: "create-experience",
|
|
11
11
|
setup: (o) => {
|
|
12
|
-
|
|
13
|
-
const n =
|
|
14
|
-
d.component =
|
|
15
|
-
o.registerField(
|
|
12
|
+
i.experiences.forEach((t) => {
|
|
13
|
+
const n = t.serialize(), d = r.deserialize(n);
|
|
14
|
+
d.component = t.component, o.registerExperience(d), d.fields.forEach((f) => {
|
|
15
|
+
o.registerField(f);
|
|
16
16
|
});
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
}),
|
|
20
|
-
id:
|
|
21
|
-
position: [0, 0],
|
|
19
|
+
}), m = (i, o) => ({
|
|
20
|
+
id: p("node"),
|
|
22
21
|
experience: o,
|
|
23
22
|
type: "action",
|
|
24
|
-
action:
|
|
23
|
+
action: i.action,
|
|
25
24
|
addNext(n) {
|
|
26
25
|
if (!n.node) throw new Error("Cannot connect to node");
|
|
27
|
-
const d =
|
|
26
|
+
const d = c(
|
|
28
27
|
{ sourceNode: this, destinationNode: n.node, sourceNodeHandle: null },
|
|
29
28
|
o
|
|
30
29
|
);
|
|
@@ -32,7 +31,7 @@ const r = {
|
|
|
32
31
|
},
|
|
33
32
|
onSuccess(n) {
|
|
34
33
|
if (!n.node) throw new Error("Cannot connect to node");
|
|
35
|
-
const d =
|
|
34
|
+
const d = c(
|
|
36
35
|
{ sourceNode: this, destinationNode: n.node, sourceNodeHandle: "true" },
|
|
37
36
|
o
|
|
38
37
|
);
|
|
@@ -40,7 +39,7 @@ const r = {
|
|
|
40
39
|
},
|
|
41
40
|
onFail(n) {
|
|
42
41
|
if (!n.node) throw new Error("Cannot connect to node");
|
|
43
|
-
const d =
|
|
42
|
+
const d = c(
|
|
44
43
|
{ sourceNode: this, destinationNode: n.node, sourceNodeHandle: "false" },
|
|
45
44
|
o
|
|
46
45
|
);
|
|
@@ -50,24 +49,23 @@ const r = {
|
|
|
50
49
|
return r.serialize({
|
|
51
50
|
id: this.id,
|
|
52
51
|
type: this.type,
|
|
53
|
-
action: this.action
|
|
54
|
-
position: this.position
|
|
52
|
+
action: this.action
|
|
55
53
|
});
|
|
56
54
|
}
|
|
57
|
-
}),
|
|
58
|
-
id:
|
|
59
|
-
label:
|
|
60
|
-
fields:
|
|
55
|
+
}), v = (i) => ({
|
|
56
|
+
id: i.id ?? p("step"),
|
|
57
|
+
label: i.label,
|
|
58
|
+
fields: i.fields ?? [],
|
|
61
59
|
addField(o) {
|
|
62
|
-
const
|
|
63
|
-
return this.fields
|
|
60
|
+
const t = "serialize" in o ? o : N(o);
|
|
61
|
+
return this.fields.includes(t) || this.fields.push(t), t;
|
|
64
62
|
}
|
|
65
|
-
}),
|
|
66
|
-
const
|
|
67
|
-
id:
|
|
68
|
-
label:
|
|
63
|
+
}), y = (i, o) => {
|
|
64
|
+
const t = {
|
|
65
|
+
id: i.id ?? p("step"),
|
|
66
|
+
label: i.label,
|
|
69
67
|
experience: o,
|
|
70
|
-
fields:
|
|
68
|
+
fields: i.fields ?? [],
|
|
71
69
|
node: null,
|
|
72
70
|
nextStep(n) {
|
|
73
71
|
return this.experience.addStep(n, this);
|
|
@@ -89,74 +87,69 @@ const r = {
|
|
|
89
87
|
});
|
|
90
88
|
}
|
|
91
89
|
};
|
|
92
|
-
return
|
|
93
|
-
},
|
|
94
|
-
const
|
|
95
|
-
id:
|
|
96
|
-
position: g(),
|
|
90
|
+
return h({ step: t, type: "step" }, o), t;
|
|
91
|
+
}, h = (i, o) => {
|
|
92
|
+
const t = {
|
|
93
|
+
id: p("node"),
|
|
97
94
|
experience: o
|
|
98
95
|
};
|
|
99
|
-
if (
|
|
96
|
+
if (i.type === "step") {
|
|
100
97
|
const d = {
|
|
101
|
-
...
|
|
98
|
+
...t,
|
|
102
99
|
type: "step",
|
|
103
|
-
connectedStep:
|
|
100
|
+
connectedStep: i.step,
|
|
104
101
|
serialize() {
|
|
105
102
|
return r.serialize({
|
|
106
103
|
id: this.id,
|
|
107
104
|
type: this.type,
|
|
108
105
|
stepId: this.connectedStep.id,
|
|
109
|
-
position: this.position,
|
|
110
106
|
label: this.connectedStep.label
|
|
111
107
|
});
|
|
112
108
|
}
|
|
113
109
|
};
|
|
114
110
|
return d.connectedStep.node = d, d;
|
|
115
111
|
}
|
|
116
|
-
if (
|
|
112
|
+
if (i.type === "conditional") {
|
|
117
113
|
const d = {
|
|
118
|
-
...
|
|
114
|
+
...t,
|
|
119
115
|
type: "conditional",
|
|
120
|
-
connectedConditional:
|
|
116
|
+
connectedConditional: i.conditional,
|
|
121
117
|
serialize() {
|
|
122
118
|
return r.serialize({
|
|
123
119
|
id: this.id,
|
|
124
120
|
type: this.type,
|
|
125
|
-
conditionalId: this.connectedConditional.id
|
|
126
|
-
position: this.position
|
|
121
|
+
conditionalId: this.connectedConditional.id
|
|
127
122
|
});
|
|
128
123
|
}
|
|
129
124
|
};
|
|
130
125
|
return d.connectedConditional.node = d, d;
|
|
131
126
|
}
|
|
132
|
-
return
|
|
133
|
-
...
|
|
127
|
+
return i.type === "experience" ? {
|
|
128
|
+
...t,
|
|
134
129
|
type: "experience",
|
|
135
|
-
connectedExperience:
|
|
130
|
+
connectedExperience: i.experience,
|
|
136
131
|
serialize() {
|
|
137
132
|
return r.serialize({
|
|
138
133
|
id: this.id,
|
|
139
134
|
type: this.type,
|
|
140
|
-
experienceId: this.connectedExperience.id
|
|
141
|
-
position: this.position
|
|
135
|
+
experienceId: this.connectedExperience.id
|
|
142
136
|
});
|
|
143
137
|
}
|
|
144
138
|
} : {
|
|
145
|
-
...
|
|
139
|
+
...t,
|
|
146
140
|
type: "origin",
|
|
147
141
|
serialize() {
|
|
148
142
|
return r.serialize({
|
|
149
143
|
id: this.id,
|
|
150
|
-
type: this.type
|
|
151
|
-
position: this.position
|
|
144
|
+
type: this.type
|
|
152
145
|
});
|
|
153
146
|
}
|
|
154
147
|
};
|
|
155
|
-
},
|
|
156
|
-
id:
|
|
157
|
-
sourceNode:
|
|
158
|
-
sourceNodeHandle:
|
|
159
|
-
destinationNode:
|
|
148
|
+
}, c = (i, o) => ({
|
|
149
|
+
id: p("edge"),
|
|
150
|
+
sourceNode: i.sourceNode,
|
|
151
|
+
sourceNodeHandle: i.sourceNodeHandle,
|
|
152
|
+
destinationNode: i.destinationNode,
|
|
160
153
|
experience: o,
|
|
161
154
|
serialize() {
|
|
162
155
|
return r.serialize({
|
|
@@ -166,17 +159,17 @@ const r = {
|
|
|
166
159
|
destinationNodeId: this.destinationNode.id
|
|
167
160
|
});
|
|
168
161
|
}
|
|
169
|
-
}),
|
|
170
|
-
const
|
|
171
|
-
id:
|
|
172
|
-
label:
|
|
173
|
-
condition:
|
|
162
|
+
}), z = (i, o) => {
|
|
163
|
+
const t = {
|
|
164
|
+
id: p("conditional"),
|
|
165
|
+
label: i.label,
|
|
166
|
+
condition: i.condition,
|
|
174
167
|
node: null,
|
|
175
168
|
experience: o,
|
|
176
169
|
addTrue(n) {
|
|
177
170
|
if (!this.node || !n.node)
|
|
178
171
|
throw new Error("todo no node");
|
|
179
|
-
const d =
|
|
172
|
+
const d = c(
|
|
180
173
|
{ sourceNode: this.node, destinationNode: n.node, sourceNodeHandle: "true" },
|
|
181
174
|
this.experience
|
|
182
175
|
);
|
|
@@ -185,7 +178,7 @@ const r = {
|
|
|
185
178
|
addFalse(n) {
|
|
186
179
|
if (!this.node || !n.node)
|
|
187
180
|
throw new Error("todo no node");
|
|
188
|
-
const d =
|
|
181
|
+
const d = c(
|
|
189
182
|
{ sourceNode: this.node, destinationNode: n.node, sourceNodeHandle: "false" },
|
|
190
183
|
this.experience
|
|
191
184
|
);
|
|
@@ -199,27 +192,28 @@ const r = {
|
|
|
199
192
|
});
|
|
200
193
|
}
|
|
201
194
|
};
|
|
202
|
-
return
|
|
203
|
-
},
|
|
204
|
-
id:
|
|
205
|
-
name:
|
|
206
|
-
type:
|
|
207
|
-
label:
|
|
208
|
-
placeholder:
|
|
209
|
-
description:
|
|
210
|
-
helpText:
|
|
211
|
-
defaultValue:
|
|
212
|
-
multiple:
|
|
213
|
-
validation:
|
|
214
|
-
condition:
|
|
215
|
-
required:
|
|
216
|
-
options:
|
|
217
|
-
id: "id" in
|
|
218
|
-
...
|
|
195
|
+
return h({ conditional: t, type: "conditional" }, o), t;
|
|
196
|
+
}, N = (i) => ({
|
|
197
|
+
id: i.id,
|
|
198
|
+
name: i.name,
|
|
199
|
+
type: i.type,
|
|
200
|
+
label: i.label,
|
|
201
|
+
placeholder: i.placeholder,
|
|
202
|
+
description: i.description,
|
|
203
|
+
helpText: i.helpText,
|
|
204
|
+
defaultValue: i.defaultValue ?? null,
|
|
205
|
+
multiple: i.multiple,
|
|
206
|
+
validation: i.validation ?? {},
|
|
207
|
+
condition: i.condition,
|
|
208
|
+
required: i.required,
|
|
209
|
+
options: i.options?.map((t) => ({
|
|
210
|
+
id: "id" in t ? t.id : p("option"),
|
|
211
|
+
...t
|
|
219
212
|
})) ?? null,
|
|
220
|
-
policies:
|
|
213
|
+
policies: i.policies,
|
|
214
|
+
// 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
|
|
221
215
|
serialize() {
|
|
222
|
-
const
|
|
216
|
+
const t = {
|
|
223
217
|
id: this.id,
|
|
224
218
|
name: this.name,
|
|
225
219
|
label: this.label,
|
|
@@ -230,219 +224,218 @@ const r = {
|
|
|
230
224
|
validation: this.validation,
|
|
231
225
|
condition: this.condition,
|
|
232
226
|
policies: this.policies
|
|
233
|
-
}, n = typeof this.defaultValue == "string" ? this.defaultValue : void 0, d = typeof this.defaultValue == "number" ? this.defaultValue : void 0,
|
|
227
|
+
}, n = typeof this.defaultValue == "string" ? this.defaultValue : void 0, d = typeof this.defaultValue == "number" ? this.defaultValue : void 0, f = typeof this.defaultValue == "boolean" ? this.defaultValue : void 0;
|
|
234
228
|
switch (this.type) {
|
|
235
229
|
case "text":
|
|
236
230
|
if (this.multiple) {
|
|
237
|
-
let
|
|
231
|
+
let e;
|
|
238
232
|
if (Array.isArray(this.defaultValue)) {
|
|
239
|
-
|
|
240
|
-
for (const
|
|
241
|
-
typeof
|
|
242
|
-
|
|
233
|
+
e = [];
|
|
234
|
+
for (const s of this.defaultValue)
|
|
235
|
+
typeof s == "string" && e.push(s);
|
|
236
|
+
e.length === 0 && (e = void 0);
|
|
243
237
|
}
|
|
244
238
|
return r.serialize({
|
|
245
|
-
...
|
|
239
|
+
...t,
|
|
246
240
|
type: "text",
|
|
247
241
|
multiple: !0,
|
|
248
|
-
defaultValue:
|
|
249
|
-
options: this.options ? this.options.map((
|
|
250
|
-
id:
|
|
251
|
-
label:
|
|
252
|
-
value: `${
|
|
253
|
-
condition:
|
|
242
|
+
defaultValue: e,
|
|
243
|
+
options: this.options ? this.options.map((s) => ({
|
|
244
|
+
id: s.id,
|
|
245
|
+
label: s.label,
|
|
246
|
+
value: `${s.value}`,
|
|
247
|
+
condition: s.condition
|
|
254
248
|
})) : null
|
|
255
249
|
});
|
|
256
250
|
}
|
|
257
251
|
return r.serialize({
|
|
258
|
-
...
|
|
252
|
+
...t,
|
|
259
253
|
type: "text",
|
|
260
254
|
multiple: !1,
|
|
261
255
|
defaultValue: n,
|
|
262
|
-
options: this.options ? this.options.map((
|
|
263
|
-
id:
|
|
264
|
-
label:
|
|
265
|
-
value: `${
|
|
266
|
-
condition:
|
|
256
|
+
options: this.options ? this.options.map((e) => ({
|
|
257
|
+
id: e.id,
|
|
258
|
+
label: e.label,
|
|
259
|
+
value: `${e.value}`,
|
|
260
|
+
condition: e.condition
|
|
267
261
|
})) : null
|
|
268
262
|
});
|
|
269
263
|
case "number":
|
|
270
264
|
if (this.multiple) {
|
|
271
|
-
let
|
|
265
|
+
let e;
|
|
272
266
|
if (Array.isArray(this.defaultValue)) {
|
|
273
|
-
|
|
274
|
-
for (const
|
|
275
|
-
typeof
|
|
276
|
-
|
|
267
|
+
e = [];
|
|
268
|
+
for (const s of this.defaultValue)
|
|
269
|
+
typeof s == "number" && e.push(s);
|
|
270
|
+
e.length === 0 && (e = void 0);
|
|
277
271
|
}
|
|
278
272
|
return r.serialize({
|
|
279
|
-
...
|
|
273
|
+
...t,
|
|
280
274
|
type: "number",
|
|
281
275
|
multiple: !0,
|
|
282
|
-
defaultValue:
|
|
283
|
-
options: this.options ? this.options.map((
|
|
284
|
-
id:
|
|
285
|
-
label:
|
|
286
|
-
value: Number(
|
|
287
|
-
condition:
|
|
276
|
+
defaultValue: e,
|
|
277
|
+
options: this.options ? this.options.map((s) => ({
|
|
278
|
+
id: s.id,
|
|
279
|
+
label: s.label,
|
|
280
|
+
value: Number(s.value),
|
|
281
|
+
condition: s.condition
|
|
288
282
|
})) : null
|
|
289
283
|
});
|
|
290
284
|
}
|
|
291
285
|
return r.serialize({
|
|
292
|
-
...
|
|
286
|
+
...t,
|
|
293
287
|
type: "number",
|
|
294
288
|
multiple: !1,
|
|
295
289
|
defaultValue: d,
|
|
296
|
-
options: this.options ? this.options.map((
|
|
297
|
-
id:
|
|
298
|
-
label:
|
|
299
|
-
value: Number(
|
|
300
|
-
condition:
|
|
290
|
+
options: this.options ? this.options.map((e) => ({
|
|
291
|
+
id: e.id,
|
|
292
|
+
label: e.label,
|
|
293
|
+
value: Number(e.value),
|
|
294
|
+
condition: e.condition
|
|
301
295
|
})) : null
|
|
302
296
|
});
|
|
303
297
|
case "boolean":
|
|
304
298
|
if (this.multiple) {
|
|
305
|
-
let
|
|
299
|
+
let e;
|
|
306
300
|
if (Array.isArray(this.defaultValue)) {
|
|
307
|
-
|
|
308
|
-
for (const
|
|
309
|
-
typeof
|
|
310
|
-
|
|
301
|
+
e = [];
|
|
302
|
+
for (const s of this.defaultValue)
|
|
303
|
+
typeof s == "boolean" && e.push(s);
|
|
304
|
+
e.length === 0 && (e = void 0);
|
|
311
305
|
}
|
|
312
306
|
return r.serialize({
|
|
313
|
-
...
|
|
307
|
+
...t,
|
|
314
308
|
type: "boolean",
|
|
315
309
|
multiple: !0,
|
|
316
|
-
defaultValue:
|
|
317
|
-
options: this.options ? this.options.map((
|
|
318
|
-
id:
|
|
319
|
-
label:
|
|
320
|
-
value: !!
|
|
321
|
-
condition:
|
|
310
|
+
defaultValue: e,
|
|
311
|
+
options: this.options ? this.options.map((s) => ({
|
|
312
|
+
id: s.id,
|
|
313
|
+
label: s.label,
|
|
314
|
+
value: !!s.value,
|
|
315
|
+
condition: s.condition
|
|
322
316
|
})) : null
|
|
323
317
|
});
|
|
324
318
|
}
|
|
325
319
|
return r.serialize({
|
|
326
|
-
...
|
|
320
|
+
...t,
|
|
327
321
|
type: "boolean",
|
|
328
322
|
multiple: !1,
|
|
329
|
-
defaultValue:
|
|
330
|
-
options: this.options ? this.options.map((
|
|
331
|
-
id:
|
|
332
|
-
label:
|
|
333
|
-
value: !!
|
|
334
|
-
condition:
|
|
323
|
+
defaultValue: f,
|
|
324
|
+
options: this.options ? this.options.map((e) => ({
|
|
325
|
+
id: e.id,
|
|
326
|
+
label: e.label,
|
|
327
|
+
value: !!e.value,
|
|
328
|
+
condition: e.condition
|
|
335
329
|
})) : null
|
|
336
330
|
});
|
|
337
331
|
case "object":
|
|
338
332
|
return this.multiple ? r.serialize({
|
|
339
|
-
...
|
|
333
|
+
...t,
|
|
340
334
|
type: "object",
|
|
341
335
|
multiple: !0,
|
|
342
336
|
defaultValue: this.defaultValue,
|
|
343
|
-
options: this.options ? this.options.map((
|
|
344
|
-
id:
|
|
345
|
-
label:
|
|
346
|
-
description:
|
|
347
|
-
value:
|
|
348
|
-
condition:
|
|
337
|
+
options: this.options ? this.options.map((e) => ({
|
|
338
|
+
id: e.id,
|
|
339
|
+
label: e.label,
|
|
340
|
+
description: e.description,
|
|
341
|
+
value: e.value,
|
|
342
|
+
condition: e.condition
|
|
349
343
|
})) : null
|
|
350
344
|
}) : r.serialize({
|
|
351
|
-
...
|
|
345
|
+
...t,
|
|
352
346
|
type: "object",
|
|
353
347
|
multiple: !1,
|
|
354
348
|
defaultValue: this.defaultValue,
|
|
355
|
-
options: this.options ? this.options.map((
|
|
356
|
-
id:
|
|
357
|
-
label:
|
|
358
|
-
description:
|
|
359
|
-
value:
|
|
360
|
-
condition:
|
|
349
|
+
options: this.options ? this.options.map((e) => ({
|
|
350
|
+
id: e.id,
|
|
351
|
+
label: e.label,
|
|
352
|
+
description: e.description,
|
|
353
|
+
value: e.value,
|
|
354
|
+
condition: e.condition
|
|
361
355
|
})) : null
|
|
362
356
|
});
|
|
363
357
|
default:
|
|
364
358
|
throw new Error("Unsupported field type");
|
|
365
359
|
}
|
|
366
360
|
}
|
|
367
|
-
}),
|
|
368
|
-
const o = [],
|
|
361
|
+
}), x = (i) => {
|
|
362
|
+
const o = [], t = [], n = [], d = [], f = [];
|
|
369
363
|
return {
|
|
370
|
-
id:
|
|
371
|
-
component:
|
|
372
|
-
name:
|
|
373
|
-
initializeOpen:
|
|
374
|
-
condition:
|
|
375
|
-
|
|
376
|
-
targets: e.targets,
|
|
364
|
+
id: i.id,
|
|
365
|
+
component: i.component,
|
|
366
|
+
name: i.name,
|
|
367
|
+
initializeOpen: i.initializeOpen,
|
|
368
|
+
condition: i.condition,
|
|
369
|
+
targets: i.targets,
|
|
377
370
|
steps: o,
|
|
378
|
-
nodes:
|
|
371
|
+
nodes: t,
|
|
379
372
|
edges: n,
|
|
380
|
-
fields:
|
|
373
|
+
fields: f,
|
|
381
374
|
conditionals: d,
|
|
382
|
-
addStep(
|
|
383
|
-
let l =
|
|
384
|
-
this.nodes.length === 0 && (l =
|
|
385
|
-
const a = "serialize" in
|
|
375
|
+
addStep(e, s) {
|
|
376
|
+
let l = s?.node;
|
|
377
|
+
this.nodes.length === 0 && (l = h({ type: "origin" }, this), this.nodes.push(l));
|
|
378
|
+
const a = "serialize" in e ? e : y(e, this);
|
|
386
379
|
if (l) {
|
|
387
380
|
if (!a.node)
|
|
388
381
|
throw new Error("todo no node");
|
|
389
|
-
const
|
|
382
|
+
const u = c(
|
|
390
383
|
{ sourceNode: l, destinationNode: a.node, sourceNodeHandle: null },
|
|
391
384
|
this
|
|
392
385
|
);
|
|
393
|
-
this.edges.push(
|
|
386
|
+
this.edges.push(u);
|
|
394
387
|
}
|
|
395
|
-
return a.fields.length > 0 && a.fields.forEach((
|
|
396
|
-
this.fields.includes(
|
|
388
|
+
return a.fields.length > 0 && a.fields.forEach((u) => {
|
|
389
|
+
this.fields.includes(u) || this.fields.push(u);
|
|
397
390
|
}), this.steps.includes(a) || (this.steps.push(a), a.node && this.nodes.push(a.node)), a;
|
|
398
391
|
},
|
|
399
|
-
addAction(
|
|
400
|
-
let l =
|
|
401
|
-
this.nodes.length === 0 && (l =
|
|
402
|
-
const a = "serialize" in
|
|
392
|
+
addAction(e, s) {
|
|
393
|
+
let l = s?.node;
|
|
394
|
+
this.nodes.length === 0 && (l = h({ type: "origin" }, this), this.nodes.push(l));
|
|
395
|
+
const a = "serialize" in e ? e : m(e, this);
|
|
403
396
|
if (l) {
|
|
404
|
-
const
|
|
397
|
+
const u = c(
|
|
405
398
|
{ sourceNode: l, destinationNode: a, sourceNodeHandle: null },
|
|
406
399
|
this
|
|
407
400
|
);
|
|
408
|
-
this.edges.push(
|
|
401
|
+
this.edges.push(u);
|
|
409
402
|
}
|
|
410
403
|
return this.nodes.push(a), a;
|
|
411
404
|
},
|
|
412
|
-
addConditional(
|
|
413
|
-
let l =
|
|
414
|
-
this.nodes.length === 0 && (l =
|
|
415
|
-
const a = "serialize" in
|
|
405
|
+
addConditional(e, s) {
|
|
406
|
+
let l = s?.node;
|
|
407
|
+
this.nodes.length === 0 && (l = h({ type: "origin" }, this), this.nodes.push(l));
|
|
408
|
+
const a = "serialize" in e ? e : z(e, this);
|
|
416
409
|
if (l) {
|
|
417
410
|
if (!a.node)
|
|
418
411
|
throw new Error("todo no node");
|
|
419
|
-
const
|
|
412
|
+
const u = c(
|
|
420
413
|
{ sourceNode: l, destinationNode: a.node, sourceNodeHandle: null },
|
|
421
414
|
this
|
|
422
415
|
);
|
|
423
|
-
this.edges.push(
|
|
416
|
+
this.edges.push(u);
|
|
424
417
|
}
|
|
425
418
|
return this.conditionals.includes(a) || (this.conditionals.push(a), a.node && this.nodes.push(a.node)), a;
|
|
426
419
|
},
|
|
427
|
-
addExperience(
|
|
428
|
-
let l =
|
|
429
|
-
this.nodes.length === 0 && (l =
|
|
430
|
-
const a =
|
|
431
|
-
{ type: "experience", experience:
|
|
420
|
+
addExperience(e, s) {
|
|
421
|
+
let l = s?.node;
|
|
422
|
+
this.nodes.length === 0 && (l = h({ type: "origin" }, this), this.nodes.push(l));
|
|
423
|
+
const a = h(
|
|
424
|
+
{ type: "experience", experience: e },
|
|
432
425
|
this
|
|
433
426
|
);
|
|
434
427
|
if (this.nodes.push(a), l) {
|
|
435
|
-
const
|
|
428
|
+
const u = c(
|
|
436
429
|
{ sourceNode: l, destinationNode: a, sourceNodeHandle: null },
|
|
437
430
|
this
|
|
438
431
|
);
|
|
439
|
-
this.edges.push(
|
|
432
|
+
this.edges.push(u);
|
|
440
433
|
}
|
|
441
|
-
return
|
|
434
|
+
return e;
|
|
442
435
|
},
|
|
443
|
-
addField(
|
|
444
|
-
const l = "serialize" in
|
|
445
|
-
return
|
|
436
|
+
addField(e, s) {
|
|
437
|
+
const l = "serialize" in e ? e : N(e);
|
|
438
|
+
return s && s.fields.push(l), this.fields.includes(l) || this.fields.push(l), l;
|
|
446
439
|
},
|
|
447
440
|
serialize() {
|
|
448
441
|
return r.serialize({
|
|
@@ -450,27 +443,26 @@ const r = {
|
|
|
450
443
|
component: this.component,
|
|
451
444
|
name: this.name,
|
|
452
445
|
initializeOpen: this.initializeOpen,
|
|
453
|
-
condition: this.condition
|
|
454
|
-
decide: this.decide,
|
|
446
|
+
condition: this.condition,
|
|
455
447
|
targets: this.targets,
|
|
456
|
-
steps: this.steps.map((
|
|
457
|
-
nodes: this.nodes.map((
|
|
458
|
-
edges: this.edges.map((
|
|
448
|
+
steps: this.steps.map((e) => r.deserialize(e.serialize())),
|
|
449
|
+
nodes: this.nodes.map((e) => r.deserialize(e.serialize())),
|
|
450
|
+
edges: this.edges.map((e) => r.deserialize(e.serialize())),
|
|
459
451
|
conditionals: this.conditionals.map(
|
|
460
|
-
(
|
|
452
|
+
(e) => r.deserialize(e.serialize())
|
|
461
453
|
),
|
|
462
|
-
fields: this.fields.map((
|
|
454
|
+
fields: this.fields.map((e) => r.deserialize(e.serialize()))
|
|
463
455
|
});
|
|
464
456
|
}
|
|
465
457
|
};
|
|
466
458
|
};
|
|
467
459
|
export {
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
460
|
+
z as createConditional,
|
|
461
|
+
c as createEdge,
|
|
462
|
+
x as createExperience,
|
|
463
|
+
b as createExperiencePlugin,
|
|
464
|
+
N as createField,
|
|
465
|
+
h as createNode,
|
|
466
|
+
v as createStep,
|
|
475
467
|
r as serialization
|
|
476
468
|
};
|
|
@@ -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-Dwv3CsVW.js";
|
|
2
|
+
import { c as S } from "../../../api-Dwv3CsVW.js";
|
|
3
3
|
import { l as a } from "../../../logger-C9a75KZn.js";
|
|
4
4
|
function d(e) {
|
|
5
5
|
let r = 2166136261;
|