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