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