@picked/client 0.0.50 → 0.0.51-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/api-CHy9HcU7.cjs +1 -0
- package/dist/{api-DWBcrf98.js → api-mlYS-lDj.js} +1 -1
- package/dist/cjs/form/index.js +1 -0
- 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/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/plugins/responses-indexeddb/index.js +1 -1
- package/dist/cjs/plugins/single-page-app/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/esm/form/index.js +472 -0
- package/dist/esm/index.js +473 -383
- package/dist/esm/plugins/create-experience/index.js +198 -165
- package/dist/esm/plugins/dynamic-experiences/index.js +52 -30
- 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 +7 -9
- package/dist/esm/plugins/responses-indexeddb/index.js +11 -11
- package/dist/esm/plugins/single-page-app/index.js +4 -4
- package/dist/esm/server/index.js +1 -1
- package/dist/experience-instance-DOcd8XI1.cjs +1 -0
- package/dist/experience-instance-NHU1moID.js +486 -0
- package/dist/{object-Clj5zVr1.js → object-C82v79xc.js} +2 -1
- package/dist/object-CUJOjanb.cjs +1 -0
- package/dist/rules-logic-CnVktz2l.js +240 -0
- package/dist/rules-logic-nMHNVLn7.cjs +1 -0
- package/dist/{storage-DyxpJ0pg.js → storage-6Xk0uAxB.js} +3 -1
- package/dist/storage-B6lQtc4-.cjs +1 -0
- package/dist/types/client.d.ts +47 -43
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/entities/action/action.d.ts +37 -5
- package/dist/types/entities/action/action.d.ts.map +1 -1
- package/dist/types/entities/condition/condition.d.ts +20 -0
- package/dist/types/entities/condition/condition.d.ts.map +1 -0
- package/dist/types/entities/experience/experience.d.ts +67 -51
- package/dist/types/entities/experience/experience.d.ts.map +1 -1
- package/dist/types/entities/experience-instance/experience-instance.d.ts +22 -2
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/feature/feature.d.ts.map +1 -1
- package/dist/types/entities/field/field.d.ts +24 -10
- package/dist/types/entities/field/field.d.ts.map +1 -1
- package/dist/types/entities/history/history.d.ts.map +1 -1
- package/dist/types/entities/response/response-validation.d.ts +74 -0
- package/dist/types/entities/response/response-validation.d.ts.map +1 -0
- package/dist/types/entities/response/response.d.ts +24 -20
- package/dist/types/entities/response/response.d.ts.map +1 -1
- package/dist/types/entities/step/step.d.ts +42 -0
- package/dist/types/entities/step/step.d.ts.map +1 -0
- package/dist/types/exports.d.ts +0 -1
- package/dist/types/exports.d.ts.map +1 -1
- package/dist/types/form/build-responses.d.ts +17 -0
- package/dist/types/form/build-responses.d.ts.map +1 -0
- package/dist/types/form/create-field-evaluator.d.ts +27 -0
- package/dist/types/form/create-field-evaluator.d.ts.map +1 -0
- package/dist/types/form/create-field-validation.d.ts +59 -0
- package/dist/types/form/create-field-validation.d.ts.map +1 -0
- package/dist/types/form/create-form.d.ts +97 -0
- package/dist/types/form/create-form.d.ts.map +1 -0
- package/dist/types/form/create-submit-pipeline.d.ts +70 -0
- package/dist/types/form/create-submit-pipeline.d.ts.map +1 -0
- package/dist/types/form/get-step-fields.d.ts +18 -0
- package/dist/types/form/get-step-fields.d.ts.map +1 -0
- package/dist/types/form/index.d.ts +10 -0
- package/dist/types/form/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/logic-engine.d.ts +12 -10
- package/dist/types/logic-engine.d.ts.map +1 -1
- package/dist/types/picked.d.ts +99 -33
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +53 -31
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/index.d.ts +2 -2
- package/dist/types/plugins/create-experience/index.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/plugin.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts +21 -4
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/types.d.ts +45 -0
- package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -1
- package/dist/types/plugins/experience-browser-storage/plugin.d.ts +2 -1
- package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/plugins/history-browser-storage/plugin.d.ts +1 -0
- package/dist/types/plugins/history-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/plugins/responses-browser-storage/plugin.d.ts +2 -1
- package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/plugins/responses-indexeddb/plugin.d.ts.map +1 -1
- package/dist/types/plugins/single-page-app/plugin.d.ts +1 -1
- package/dist/types/plugins/single-page-app/plugin.d.ts.map +1 -1
- package/dist/types/utils/dom.d.ts +0 -3
- package/dist/types/utils/dom.d.ts.map +1 -1
- package/dist/types/utils/events.d.ts +2 -2
- package/dist/types/utils/events.d.ts.map +1 -1
- package/dist/types/utils/global-obj.d.ts +0 -1
- package/dist/types/utils/global-obj.d.ts.map +1 -1
- package/dist/types/utils/indexed-db.d.ts +2 -1
- package/dist/types/utils/indexed-db.d.ts.map +1 -1
- package/dist/types/utils/logger.d.ts.map +1 -1
- package/dist/types/utils/node-tree/get-next-node-from-condition.d.ts +16 -0
- package/dist/types/utils/node-tree/get-next-node-from-condition.d.ts.map +1 -0
- package/dist/types/utils/node-tree/min-max-steps-to-leaf.d.ts.map +1 -1
- package/dist/types/utils/node-tree/min-max-steps-to-origin.d.ts.map +1 -1
- package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts.map +1 -1
- package/dist/types/utils/nodes.d.ts +2 -2
- package/dist/types/utils/nodes.d.ts.map +1 -1
- package/dist/types/utils/object.d.ts +0 -8
- package/dist/types/utils/object.d.ts.map +1 -1
- package/dist/types/utils/picked-config.d.ts +1 -1
- package/dist/types/utils/picked-config.d.ts.map +1 -1
- package/dist/types/utils/rules-logic.d.ts +31 -0
- package/dist/types/utils/rules-logic.d.ts.map +1 -1
- package/dist/types/utils/search-params.d.ts.map +1 -1
- package/dist/types/utils/state-snaphot.d.ts +11 -1
- package/dist/types/utils/state-snaphot.d.ts.map +1 -1
- package/dist/types/utils/storage.d.ts.map +1 -1
- package/package.json +43 -7
- package/dist/api-BwTaomem.cjs +0 -1
- package/dist/experience-instance-BRpI9I4s.js +0 -710
- package/dist/experience-instance-BUTnwbSJ.cjs +0 -1
- package/dist/object-BReQiaSS.cjs +0 -1
- package/dist/storage-BFjb8azI.cjs +0 -1
- package/dist/types/entities/project/project.d.ts +0 -9
- package/dist/types/entities/project/project.d.ts.map +0 -1
- package/dist/types/utils/get-step-fields.d.ts +0 -4
- package/dist/types/utils/get-step-fields.d.ts.map +0 -1
- package/dist/types/utils/node-tree/get-next-node-from-conditional.d.ts +0 -3
- package/dist/types/utils/node-tree/get-next-node-from-conditional.d.ts.map +0 -1
- /package/dist/{id-CIbS4P60.cjs → id-Bv44ilEo.cjs} +0 -0
- /package/dist/{id-BniPxOdF.js → id-CRqy981z.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "../../../id-
|
|
1
|
+
import { t as e } from "../../../id-CRqy981z.js";
|
|
2
2
|
//#region src/plugins/create-experience/serialization.ts
|
|
3
3
|
var t = {
|
|
4
4
|
serialize(e) {
|
|
@@ -12,8 +12,14 @@ var t = {
|
|
|
12
12
|
setup: (n) => {
|
|
13
13
|
e.experiences.forEach((e) => {
|
|
14
14
|
let r = e.serialize(), i = t.deserialize(r);
|
|
15
|
-
i.component = e.component
|
|
15
|
+
i.component = e.component;
|
|
16
|
+
let { steps: a, conditions: o, fields: s, ...c } = i;
|
|
17
|
+
n.registerExperience(c), s.forEach((e) => {
|
|
16
18
|
n.registerField(e);
|
|
19
|
+
}), a.forEach((e) => {
|
|
20
|
+
n.registerStep(e);
|
|
21
|
+
}), o.forEach((e) => {
|
|
22
|
+
n.registerCondition(e);
|
|
17
23
|
});
|
|
18
24
|
});
|
|
19
25
|
}
|
|
@@ -27,7 +33,7 @@ var t = {
|
|
|
27
33
|
let t = s({
|
|
28
34
|
sourceNode: this,
|
|
29
35
|
destinationNode: e.node,
|
|
30
|
-
|
|
36
|
+
sourceHandle: null
|
|
31
37
|
}, r);
|
|
32
38
|
r.edges.push(t);
|
|
33
39
|
},
|
|
@@ -36,7 +42,7 @@ var t = {
|
|
|
36
42
|
let t = s({
|
|
37
43
|
sourceNode: this,
|
|
38
44
|
destinationNode: e.node,
|
|
39
|
-
|
|
45
|
+
sourceHandle: "true"
|
|
40
46
|
}, r);
|
|
41
47
|
r.edges.push(t);
|
|
42
48
|
},
|
|
@@ -45,7 +51,7 @@ var t = {
|
|
|
45
51
|
let t = s({
|
|
46
52
|
sourceNode: this,
|
|
47
53
|
destinationNode: e.node,
|
|
48
|
-
|
|
54
|
+
sourceHandle: "false"
|
|
49
55
|
}, r);
|
|
50
56
|
r.edges.push(t);
|
|
51
57
|
},
|
|
@@ -53,29 +59,39 @@ var t = {
|
|
|
53
59
|
return t.serialize({
|
|
54
60
|
id: this.id,
|
|
55
61
|
type: this.type,
|
|
56
|
-
|
|
62
|
+
actionKey: this.action
|
|
57
63
|
});
|
|
58
64
|
}
|
|
59
|
-
}), i = (t) =>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
65
|
+
}), i = (t) => {
|
|
66
|
+
let n = t.name, r = t.id ?? e("step");
|
|
67
|
+
return {
|
|
68
|
+
id: r,
|
|
69
|
+
name: n,
|
|
70
|
+
key: t.key ?? r,
|
|
71
|
+
label: n,
|
|
72
|
+
fields: t.fields ?? [],
|
|
73
|
+
addField(e) {
|
|
74
|
+
let t = "serialize" in e ? e : l(e);
|
|
75
|
+
return this.fields.includes(t) || this.fields.push(t), t;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}, a = (n, r) => {
|
|
79
|
+
let i = n.name, a = n.id ?? e("step"), s = {
|
|
80
|
+
id: a,
|
|
81
|
+
name: i,
|
|
82
|
+
key: n.key ?? a,
|
|
83
|
+
label: i,
|
|
71
84
|
experience: r,
|
|
72
85
|
fields: n.fields ?? [],
|
|
73
86
|
node: null,
|
|
74
87
|
nextStep(e) {
|
|
75
88
|
return this.experience.addStep(e, this);
|
|
76
89
|
},
|
|
90
|
+
nextCondition(e) {
|
|
91
|
+
return this.experience.addCondition(e, this);
|
|
92
|
+
},
|
|
77
93
|
nextConditional(e) {
|
|
78
|
-
return this.
|
|
94
|
+
return this.nextCondition(e);
|
|
79
95
|
},
|
|
80
96
|
addNextExperience(e) {
|
|
81
97
|
return this.experience.addExperience(e, this);
|
|
@@ -86,15 +102,17 @@ var t = {
|
|
|
86
102
|
serialize() {
|
|
87
103
|
return t.serialize({
|
|
88
104
|
id: this.id,
|
|
105
|
+
key: this.key,
|
|
106
|
+
name: this.name,
|
|
89
107
|
label: this.label,
|
|
90
108
|
fieldIds: this.fields.map((e) => e.id)
|
|
91
109
|
});
|
|
92
110
|
}
|
|
93
111
|
};
|
|
94
112
|
return o({
|
|
95
|
-
step:
|
|
113
|
+
step: s,
|
|
96
114
|
type: "step"
|
|
97
|
-
}, r),
|
|
115
|
+
}, r), s;
|
|
98
116
|
}, o = (n, r) => {
|
|
99
117
|
let i = {
|
|
100
118
|
id: e("node"),
|
|
@@ -110,26 +128,27 @@ var t = {
|
|
|
110
128
|
id: this.id,
|
|
111
129
|
type: this.type,
|
|
112
130
|
stepId: this.connectedStep.id,
|
|
131
|
+
name: this.connectedStep.name,
|
|
113
132
|
label: this.connectedStep.label
|
|
114
133
|
});
|
|
115
134
|
}
|
|
116
135
|
};
|
|
117
136
|
return e.connectedStep.node = e, e;
|
|
118
137
|
}
|
|
119
|
-
if (n.type === "
|
|
138
|
+
if (n.type === "condition") {
|
|
120
139
|
let e = {
|
|
121
140
|
...i,
|
|
122
|
-
type: "
|
|
123
|
-
|
|
141
|
+
type: "condition",
|
|
142
|
+
connectedCondition: n.condition,
|
|
124
143
|
serialize() {
|
|
125
144
|
return t.serialize({
|
|
126
145
|
id: this.id,
|
|
127
146
|
type: this.type,
|
|
128
|
-
|
|
147
|
+
conditionId: this.connectedCondition.id
|
|
129
148
|
});
|
|
130
149
|
}
|
|
131
150
|
};
|
|
132
|
-
return e.
|
|
151
|
+
return e.connectedCondition.node = e, e;
|
|
133
152
|
}
|
|
134
153
|
return n.type === "experience" ? {
|
|
135
154
|
...i,
|
|
@@ -139,7 +158,8 @@ var t = {
|
|
|
139
158
|
return t.serialize({
|
|
140
159
|
id: this.id,
|
|
141
160
|
type: this.type,
|
|
142
|
-
experienceId: this.connectedExperience.id
|
|
161
|
+
experienceId: this.connectedExperience.id,
|
|
162
|
+
experienceKey: this.connectedExperience.key
|
|
143
163
|
});
|
|
144
164
|
}
|
|
145
165
|
} : {
|
|
@@ -155,22 +175,24 @@ var t = {
|
|
|
155
175
|
}, s = (n, r) => ({
|
|
156
176
|
id: e("edge"),
|
|
157
177
|
sourceNode: n.sourceNode,
|
|
158
|
-
|
|
178
|
+
sourceHandle: n.sourceHandle,
|
|
159
179
|
destinationNode: n.destinationNode,
|
|
160
180
|
experience: r,
|
|
161
181
|
serialize() {
|
|
162
182
|
return t.serialize({
|
|
163
183
|
id: this.id,
|
|
164
|
-
|
|
184
|
+
sourceHandle: this.sourceHandle ?? void 0,
|
|
165
185
|
sourceNodeId: this.sourceNode.id,
|
|
166
186
|
destinationNodeId: this.destinationNode.id
|
|
167
187
|
});
|
|
168
188
|
}
|
|
169
189
|
}), c = (n, r) => {
|
|
170
|
-
let i = {
|
|
171
|
-
id:
|
|
190
|
+
let i = e("conditional"), a = n.name ?? n.label ?? i, c = {
|
|
191
|
+
id: i,
|
|
192
|
+
key: n.key ?? i,
|
|
193
|
+
name: a,
|
|
172
194
|
label: n.label,
|
|
173
|
-
|
|
195
|
+
logic: n.condition,
|
|
174
196
|
node: null,
|
|
175
197
|
experience: r,
|
|
176
198
|
addTrue(e) {
|
|
@@ -178,7 +200,7 @@ var t = {
|
|
|
178
200
|
let t = s({
|
|
179
201
|
sourceNode: this.node,
|
|
180
202
|
destinationNode: e.node,
|
|
181
|
-
|
|
203
|
+
sourceHandle: "true"
|
|
182
204
|
}, this.experience);
|
|
183
205
|
this.experience.edges.push(t);
|
|
184
206
|
},
|
|
@@ -187,66 +209,84 @@ var t = {
|
|
|
187
209
|
let t = s({
|
|
188
210
|
sourceNode: this.node,
|
|
189
211
|
destinationNode: e.node,
|
|
190
|
-
|
|
212
|
+
sourceHandle: "false"
|
|
191
213
|
}, this.experience);
|
|
192
214
|
this.experience.edges.push(t);
|
|
193
215
|
},
|
|
194
216
|
serialize() {
|
|
195
217
|
return t.serialize({
|
|
196
218
|
id: this.id,
|
|
197
|
-
|
|
198
|
-
|
|
219
|
+
key: this.key,
|
|
220
|
+
name: this.name,
|
|
221
|
+
logic: this.logic
|
|
199
222
|
});
|
|
200
223
|
}
|
|
201
224
|
};
|
|
202
225
|
return o({
|
|
203
|
-
|
|
204
|
-
type: "
|
|
205
|
-
}, r),
|
|
206
|
-
}, l = (n) =>
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
226
|
+
condition: c,
|
|
227
|
+
type: "condition"
|
|
228
|
+
}, r), c;
|
|
229
|
+
}, l = (n) => {
|
|
230
|
+
let r = n.id ?? e("field");
|
|
231
|
+
return {
|
|
232
|
+
id: r,
|
|
233
|
+
key: n.key ?? r,
|
|
234
|
+
name: n.name,
|
|
235
|
+
type: n.type,
|
|
236
|
+
label: n.label,
|
|
237
|
+
placeholder: n.placeholder,
|
|
238
|
+
description: n.description,
|
|
239
|
+
helpText: n.helpText,
|
|
240
|
+
defaultValue: n.defaultValue ?? null,
|
|
241
|
+
multiple: n.multiple,
|
|
242
|
+
validation: n.validation ?? {},
|
|
243
|
+
condition: n.condition,
|
|
244
|
+
required: n.required,
|
|
245
|
+
options: n.options?.map((t) => ({
|
|
246
|
+
id: "id" in t ? t.id : e("option"),
|
|
247
|
+
...t
|
|
248
|
+
})) ?? null,
|
|
249
|
+
policies: n.policies,
|
|
250
|
+
serialize() {
|
|
251
|
+
let e = {
|
|
252
|
+
id: this.id,
|
|
253
|
+
key: this.key,
|
|
254
|
+
name: this.name,
|
|
255
|
+
label: this.label,
|
|
256
|
+
placeholder: this.placeholder,
|
|
257
|
+
required: this.required,
|
|
258
|
+
description: this.description,
|
|
259
|
+
helpText: this.helpText,
|
|
260
|
+
validation: this.validation,
|
|
261
|
+
condition: this.condition,
|
|
262
|
+
policies: this.policies
|
|
263
|
+
}, n = typeof this.defaultValue == "string" ? this.defaultValue : void 0, r = typeof this.defaultValue == "number" ? this.defaultValue : void 0, i = typeof this.defaultValue == "boolean" ? this.defaultValue : void 0;
|
|
264
|
+
switch (this.type) {
|
|
265
|
+
case "text":
|
|
266
|
+
if (this.multiple) {
|
|
267
|
+
let n;
|
|
268
|
+
if (Array.isArray(this.defaultValue)) {
|
|
269
|
+
n = [];
|
|
270
|
+
for (let e of this.defaultValue) typeof e == "string" && n.push(e);
|
|
271
|
+
n.length === 0 && (n = void 0);
|
|
272
|
+
}
|
|
273
|
+
return t.serialize({
|
|
274
|
+
...e,
|
|
275
|
+
type: "text",
|
|
276
|
+
multiple: !0,
|
|
277
|
+
defaultValue: n,
|
|
278
|
+
options: this.options ? this.options.map((e) => ({
|
|
279
|
+
id: e.id,
|
|
280
|
+
label: e.label,
|
|
281
|
+
value: `${e.value}`,
|
|
282
|
+
condition: e.condition
|
|
283
|
+
})) : null
|
|
284
|
+
});
|
|
245
285
|
}
|
|
246
286
|
return t.serialize({
|
|
247
287
|
...e,
|
|
248
288
|
type: "text",
|
|
249
|
-
multiple: !
|
|
289
|
+
multiple: !1,
|
|
250
290
|
defaultValue: n,
|
|
251
291
|
options: this.options ? this.options.map((e) => ({
|
|
252
292
|
id: e.id,
|
|
@@ -255,32 +295,32 @@ var t = {
|
|
|
255
295
|
condition: e.condition
|
|
256
296
|
})) : null
|
|
257
297
|
});
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
298
|
+
case "number":
|
|
299
|
+
if (this.multiple) {
|
|
300
|
+
let n;
|
|
301
|
+
if (Array.isArray(this.defaultValue)) {
|
|
302
|
+
n = [];
|
|
303
|
+
for (let e of this.defaultValue) typeof e == "number" && n.push(e);
|
|
304
|
+
n.length === 0 && (n = void 0);
|
|
305
|
+
}
|
|
306
|
+
return t.serialize({
|
|
307
|
+
...e,
|
|
308
|
+
type: "number",
|
|
309
|
+
multiple: !0,
|
|
310
|
+
defaultValue: n,
|
|
311
|
+
options: this.options ? this.options.map((e) => ({
|
|
312
|
+
id: e.id,
|
|
313
|
+
label: e.label,
|
|
314
|
+
value: Number(e.value),
|
|
315
|
+
condition: e.condition
|
|
316
|
+
})) : null
|
|
317
|
+
});
|
|
278
318
|
}
|
|
279
319
|
return t.serialize({
|
|
280
320
|
...e,
|
|
281
321
|
type: "number",
|
|
282
|
-
multiple: !
|
|
283
|
-
defaultValue:
|
|
322
|
+
multiple: !1,
|
|
323
|
+
defaultValue: r,
|
|
284
324
|
options: this.options ? this.options.map((e) => ({
|
|
285
325
|
id: e.id,
|
|
286
326
|
label: e.label,
|
|
@@ -288,32 +328,32 @@ var t = {
|
|
|
288
328
|
condition: e.condition
|
|
289
329
|
})) : null
|
|
290
330
|
});
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
331
|
+
case "boolean":
|
|
332
|
+
if (this.multiple) {
|
|
333
|
+
let n;
|
|
334
|
+
if (Array.isArray(this.defaultValue)) {
|
|
335
|
+
n = [];
|
|
336
|
+
for (let e of this.defaultValue) typeof e == "boolean" && n.push(e);
|
|
337
|
+
n.length === 0 && (n = void 0);
|
|
338
|
+
}
|
|
339
|
+
return t.serialize({
|
|
340
|
+
...e,
|
|
341
|
+
type: "boolean",
|
|
342
|
+
multiple: !0,
|
|
343
|
+
defaultValue: n,
|
|
344
|
+
options: this.options ? this.options.map((e) => ({
|
|
345
|
+
id: e.id,
|
|
346
|
+
label: e.label,
|
|
347
|
+
value: !!e.value,
|
|
348
|
+
condition: e.condition
|
|
349
|
+
})) : null
|
|
350
|
+
});
|
|
311
351
|
}
|
|
312
352
|
return t.serialize({
|
|
313
353
|
...e,
|
|
314
354
|
type: "boolean",
|
|
315
|
-
multiple: !
|
|
316
|
-
defaultValue:
|
|
355
|
+
multiple: !1,
|
|
356
|
+
defaultValue: i,
|
|
317
357
|
options: this.options ? this.options.map((e) => ({
|
|
318
358
|
id: e.id,
|
|
319
359
|
label: e.label,
|
|
@@ -321,49 +361,38 @@ var t = {
|
|
|
321
361
|
condition: e.condition
|
|
322
362
|
})) : null
|
|
323
363
|
});
|
|
324
|
-
|
|
325
|
-
return t.serialize({
|
|
364
|
+
case "object": return this.multiple ? t.serialize({
|
|
326
365
|
...e,
|
|
327
|
-
type: "
|
|
366
|
+
type: "object",
|
|
367
|
+
multiple: !0,
|
|
368
|
+
defaultValue: this.defaultValue,
|
|
369
|
+
options: this.options ? this.options.map((e) => ({
|
|
370
|
+
id: e.id,
|
|
371
|
+
label: e.label,
|
|
372
|
+
description: e.description,
|
|
373
|
+
value: e.value,
|
|
374
|
+
condition: e.condition
|
|
375
|
+
})) : null
|
|
376
|
+
}) : t.serialize({
|
|
377
|
+
...e,
|
|
378
|
+
type: "object",
|
|
328
379
|
multiple: !1,
|
|
329
|
-
defaultValue:
|
|
380
|
+
defaultValue: this.defaultValue,
|
|
330
381
|
options: this.options ? this.options.map((e) => ({
|
|
331
382
|
id: e.id,
|
|
332
383
|
label: e.label,
|
|
333
|
-
|
|
384
|
+
description: e.description,
|
|
385
|
+
value: e.value,
|
|
334
386
|
condition: e.condition
|
|
335
387
|
})) : null
|
|
336
388
|
});
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
type: "object",
|
|
340
|
-
multiple: !0,
|
|
341
|
-
defaultValue: this.defaultValue,
|
|
342
|
-
options: this.options ? this.options.map((e) => ({
|
|
343
|
-
id: e.id,
|
|
344
|
-
label: e.label,
|
|
345
|
-
description: e.description,
|
|
346
|
-
value: e.value,
|
|
347
|
-
condition: e.condition
|
|
348
|
-
})) : null
|
|
349
|
-
}) : t.serialize({
|
|
350
|
-
...e,
|
|
351
|
-
type: "object",
|
|
352
|
-
multiple: !1,
|
|
353
|
-
defaultValue: this.defaultValue,
|
|
354
|
-
options: this.options ? this.options.map((e) => ({
|
|
355
|
-
id: e.id,
|
|
356
|
-
label: e.label,
|
|
357
|
-
description: e.description,
|
|
358
|
-
value: e.value,
|
|
359
|
-
condition: e.condition
|
|
360
|
-
})) : null
|
|
361
|
-
});
|
|
362
|
-
default: throw Error("Unsupported field type");
|
|
389
|
+
default: throw Error("Unsupported field type");
|
|
390
|
+
}
|
|
363
391
|
}
|
|
364
|
-
}
|
|
365
|
-
}
|
|
392
|
+
};
|
|
393
|
+
}, u = (e) => ({
|
|
366
394
|
id: e.id,
|
|
395
|
+
key: e.key ?? e.id,
|
|
367
396
|
component: e.component,
|
|
368
397
|
name: e.name,
|
|
369
398
|
initializeOpen: e.initializeOpen,
|
|
@@ -373,7 +402,7 @@ var t = {
|
|
|
373
402
|
nodes: [],
|
|
374
403
|
edges: [],
|
|
375
404
|
fields: [],
|
|
376
|
-
|
|
405
|
+
conditions: [],
|
|
377
406
|
addStep(e, t) {
|
|
378
407
|
let n = t?.node;
|
|
379
408
|
this.nodes.length === 0 && (n = o({ type: "origin" }, this), this.nodes.push(n));
|
|
@@ -383,7 +412,7 @@ var t = {
|
|
|
383
412
|
let e = s({
|
|
384
413
|
sourceNode: n,
|
|
385
414
|
destinationNode: r.node,
|
|
386
|
-
|
|
415
|
+
sourceHandle: null
|
|
387
416
|
}, this);
|
|
388
417
|
this.edges.push(e);
|
|
389
418
|
}
|
|
@@ -399,13 +428,13 @@ var t = {
|
|
|
399
428
|
let e = s({
|
|
400
429
|
sourceNode: n,
|
|
401
430
|
destinationNode: i,
|
|
402
|
-
|
|
431
|
+
sourceHandle: null
|
|
403
432
|
}, this);
|
|
404
433
|
this.edges.push(e);
|
|
405
434
|
}
|
|
406
435
|
return this.nodes.push(i), i;
|
|
407
436
|
},
|
|
408
|
-
|
|
437
|
+
addCondition(e, t) {
|
|
409
438
|
let n = t?.node;
|
|
410
439
|
this.nodes.length === 0 && (n = o({ type: "origin" }, this), this.nodes.push(n));
|
|
411
440
|
let r = "serialize" in e ? e : c(e, this);
|
|
@@ -414,11 +443,14 @@ var t = {
|
|
|
414
443
|
let e = s({
|
|
415
444
|
sourceNode: n,
|
|
416
445
|
destinationNode: r.node,
|
|
417
|
-
|
|
446
|
+
sourceHandle: null
|
|
418
447
|
}, this);
|
|
419
448
|
this.edges.push(e);
|
|
420
449
|
}
|
|
421
|
-
return this.
|
|
450
|
+
return this.conditions.includes(r) || (this.conditions.push(r), r.node && this.nodes.push(r.node)), r;
|
|
451
|
+
},
|
|
452
|
+
addConditional(e, t) {
|
|
453
|
+
return this.addCondition(e, t);
|
|
422
454
|
},
|
|
423
455
|
addExperience(e, t) {
|
|
424
456
|
let n = t?.node;
|
|
@@ -431,7 +463,7 @@ var t = {
|
|
|
431
463
|
let e = s({
|
|
432
464
|
sourceNode: n,
|
|
433
465
|
destinationNode: r,
|
|
434
|
-
|
|
466
|
+
sourceHandle: null
|
|
435
467
|
}, this);
|
|
436
468
|
this.edges.push(e);
|
|
437
469
|
}
|
|
@@ -444,6 +476,7 @@ var t = {
|
|
|
444
476
|
serialize() {
|
|
445
477
|
return t.serialize({
|
|
446
478
|
id: this.id,
|
|
479
|
+
key: this.key,
|
|
447
480
|
component: this.component,
|
|
448
481
|
name: this.name,
|
|
449
482
|
initializeOpen: this.initializeOpen,
|
|
@@ -452,10 +485,10 @@ var t = {
|
|
|
452
485
|
steps: this.steps.map((e) => t.deserialize(e.serialize())),
|
|
453
486
|
nodes: this.nodes.map((e) => t.deserialize(e.serialize())),
|
|
454
487
|
edges: this.edges.map((e) => t.deserialize(e.serialize())),
|
|
455
|
-
|
|
488
|
+
conditions: this.conditions.map((e) => t.deserialize(e.serialize())),
|
|
456
489
|
fields: this.fields.map((e) => t.deserialize(e.serialize()))
|
|
457
490
|
});
|
|
458
491
|
}
|
|
459
492
|
});
|
|
460
493
|
//#endregion
|
|
461
|
-
export { c as
|
|
494
|
+
export { c as createCondition, s as createEdge, u as createExperience, n as createExperiencePlugin, l as createField, o as createNode, i as createStep };
|