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