@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.
Files changed (130) hide show
  1. package/dist/api-CHy9HcU7.cjs +1 -0
  2. package/dist/{api-DWBcrf98.js → api-mlYS-lDj.js} +1 -1
  3. package/dist/cjs/form/index.js +1 -0
  4. package/dist/cjs/index.js +2 -2
  5. package/dist/cjs/plugins/create-experience/index.js +1 -1
  6. package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
  7. package/dist/cjs/plugins/experience-browser-storage/index.js +1 -1
  8. package/dist/cjs/plugins/history-browser-storage/index.js +1 -1
  9. package/dist/cjs/plugins/responses-browser-storage/index.js +1 -1
  10. package/dist/cjs/plugins/responses-indexeddb/index.js +1 -1
  11. package/dist/cjs/plugins/single-page-app/index.js +1 -1
  12. package/dist/cjs/server/index.js +1 -1
  13. package/dist/esm/form/index.js +472 -0
  14. package/dist/esm/index.js +473 -383
  15. package/dist/esm/plugins/create-experience/index.js +198 -165
  16. package/dist/esm/plugins/dynamic-experiences/index.js +52 -30
  17. package/dist/esm/plugins/experience-browser-storage/index.js +1 -1
  18. package/dist/esm/plugins/history-browser-storage/index.js +1 -1
  19. package/dist/esm/plugins/responses-browser-storage/index.js +7 -9
  20. package/dist/esm/plugins/responses-indexeddb/index.js +11 -11
  21. package/dist/esm/plugins/single-page-app/index.js +4 -4
  22. package/dist/esm/server/index.js +1 -1
  23. package/dist/experience-instance-DOcd8XI1.cjs +1 -0
  24. package/dist/experience-instance-NHU1moID.js +486 -0
  25. package/dist/{object-Clj5zVr1.js → object-C82v79xc.js} +2 -1
  26. package/dist/object-CUJOjanb.cjs +1 -0
  27. package/dist/rules-logic-CnVktz2l.js +240 -0
  28. package/dist/rules-logic-nMHNVLn7.cjs +1 -0
  29. package/dist/{storage-DyxpJ0pg.js → storage-6Xk0uAxB.js} +3 -1
  30. package/dist/storage-B6lQtc4-.cjs +1 -0
  31. package/dist/types/client.d.ts +47 -43
  32. package/dist/types/client.d.ts.map +1 -1
  33. package/dist/types/entities/action/action.d.ts +37 -5
  34. package/dist/types/entities/action/action.d.ts.map +1 -1
  35. package/dist/types/entities/condition/condition.d.ts +20 -0
  36. package/dist/types/entities/condition/condition.d.ts.map +1 -0
  37. package/dist/types/entities/experience/experience.d.ts +67 -51
  38. package/dist/types/entities/experience/experience.d.ts.map +1 -1
  39. package/dist/types/entities/experience-instance/experience-instance.d.ts +22 -2
  40. package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
  41. package/dist/types/entities/feature/feature.d.ts.map +1 -1
  42. package/dist/types/entities/field/field.d.ts +24 -10
  43. package/dist/types/entities/field/field.d.ts.map +1 -1
  44. package/dist/types/entities/history/history.d.ts.map +1 -1
  45. package/dist/types/entities/response/response-validation.d.ts +74 -0
  46. package/dist/types/entities/response/response-validation.d.ts.map +1 -0
  47. package/dist/types/entities/response/response.d.ts +24 -20
  48. package/dist/types/entities/response/response.d.ts.map +1 -1
  49. package/dist/types/entities/step/step.d.ts +42 -0
  50. package/dist/types/entities/step/step.d.ts.map +1 -0
  51. package/dist/types/exports.d.ts +0 -1
  52. package/dist/types/exports.d.ts.map +1 -1
  53. package/dist/types/form/build-responses.d.ts +17 -0
  54. package/dist/types/form/build-responses.d.ts.map +1 -0
  55. package/dist/types/form/create-field-evaluator.d.ts +27 -0
  56. package/dist/types/form/create-field-evaluator.d.ts.map +1 -0
  57. package/dist/types/form/create-field-validation.d.ts +59 -0
  58. package/dist/types/form/create-field-validation.d.ts.map +1 -0
  59. package/dist/types/form/create-form.d.ts +97 -0
  60. package/dist/types/form/create-form.d.ts.map +1 -0
  61. package/dist/types/form/create-submit-pipeline.d.ts +70 -0
  62. package/dist/types/form/create-submit-pipeline.d.ts.map +1 -0
  63. package/dist/types/form/get-step-fields.d.ts +18 -0
  64. package/dist/types/form/get-step-fields.d.ts.map +1 -0
  65. package/dist/types/form/index.d.ts +10 -0
  66. package/dist/types/form/index.d.ts.map +1 -0
  67. package/dist/types/index.d.ts +3 -1
  68. package/dist/types/index.d.ts.map +1 -1
  69. package/dist/types/logic-engine.d.ts +12 -10
  70. package/dist/types/logic-engine.d.ts.map +1 -1
  71. package/dist/types/picked.d.ts +99 -33
  72. package/dist/types/picked.d.ts.map +1 -1
  73. package/dist/types/plugins/create-experience/create-experience.d.ts +53 -31
  74. package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
  75. package/dist/types/plugins/create-experience/index.d.ts +2 -2
  76. package/dist/types/plugins/create-experience/index.d.ts.map +1 -1
  77. package/dist/types/plugins/create-experience/plugin.d.ts.map +1 -1
  78. package/dist/types/plugins/dynamic-experiences/plugin.d.ts +21 -4
  79. package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
  80. package/dist/types/plugins/dynamic-experiences/types.d.ts +45 -0
  81. package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -1
  82. package/dist/types/plugins/experience-browser-storage/plugin.d.ts +2 -1
  83. package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +1 -1
  84. package/dist/types/plugins/history-browser-storage/plugin.d.ts +1 -0
  85. package/dist/types/plugins/history-browser-storage/plugin.d.ts.map +1 -1
  86. package/dist/types/plugins/responses-browser-storage/plugin.d.ts +2 -1
  87. package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +1 -1
  88. package/dist/types/plugins/responses-indexeddb/plugin.d.ts.map +1 -1
  89. package/dist/types/plugins/single-page-app/plugin.d.ts +1 -1
  90. package/dist/types/plugins/single-page-app/plugin.d.ts.map +1 -1
  91. package/dist/types/utils/dom.d.ts +0 -3
  92. package/dist/types/utils/dom.d.ts.map +1 -1
  93. package/dist/types/utils/events.d.ts +2 -2
  94. package/dist/types/utils/events.d.ts.map +1 -1
  95. package/dist/types/utils/global-obj.d.ts +0 -1
  96. package/dist/types/utils/global-obj.d.ts.map +1 -1
  97. package/dist/types/utils/indexed-db.d.ts +2 -1
  98. package/dist/types/utils/indexed-db.d.ts.map +1 -1
  99. package/dist/types/utils/logger.d.ts.map +1 -1
  100. package/dist/types/utils/node-tree/get-next-node-from-condition.d.ts +16 -0
  101. package/dist/types/utils/node-tree/get-next-node-from-condition.d.ts.map +1 -0
  102. package/dist/types/utils/node-tree/min-max-steps-to-leaf.d.ts.map +1 -1
  103. package/dist/types/utils/node-tree/min-max-steps-to-origin.d.ts.map +1 -1
  104. package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts.map +1 -1
  105. package/dist/types/utils/nodes.d.ts +2 -2
  106. package/dist/types/utils/nodes.d.ts.map +1 -1
  107. package/dist/types/utils/object.d.ts +0 -8
  108. package/dist/types/utils/object.d.ts.map +1 -1
  109. package/dist/types/utils/picked-config.d.ts +1 -1
  110. package/dist/types/utils/picked-config.d.ts.map +1 -1
  111. package/dist/types/utils/rules-logic.d.ts +31 -0
  112. package/dist/types/utils/rules-logic.d.ts.map +1 -1
  113. package/dist/types/utils/search-params.d.ts.map +1 -1
  114. package/dist/types/utils/state-snaphot.d.ts +11 -1
  115. package/dist/types/utils/state-snaphot.d.ts.map +1 -1
  116. package/dist/types/utils/storage.d.ts.map +1 -1
  117. package/package.json +43 -7
  118. package/dist/api-BwTaomem.cjs +0 -1
  119. package/dist/experience-instance-BRpI9I4s.js +0 -710
  120. package/dist/experience-instance-BUTnwbSJ.cjs +0 -1
  121. package/dist/object-BReQiaSS.cjs +0 -1
  122. package/dist/storage-BFjb8azI.cjs +0 -1
  123. package/dist/types/entities/project/project.d.ts +0 -9
  124. package/dist/types/entities/project/project.d.ts.map +0 -1
  125. package/dist/types/utils/get-step-fields.d.ts +0 -4
  126. package/dist/types/utils/get-step-fields.d.ts.map +0 -1
  127. package/dist/types/utils/node-tree/get-next-node-from-conditional.d.ts +0 -3
  128. package/dist/types/utils/node-tree/get-next-node-from-conditional.d.ts.map +0 -1
  129. /package/dist/{id-CIbS4P60.cjs → id-Bv44ilEo.cjs} +0 -0
  130. /package/dist/{id-BniPxOdF.js → id-CRqy981z.js} +0 -0
@@ -1,4 +1,4 @@
1
- import { t as e } from "../../../id-BniPxOdF.js";
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, n.registerExperience(i), i.fields.forEach((e) => {
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
- sourceNodeHandle: null
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
- sourceNodeHandle: "true"
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
- sourceNodeHandle: "false"
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
- action: this.action
62
+ actionKey: this.action
57
63
  });
58
64
  }
59
- }), i = (t) => ({
60
- id: t.id ?? e("step"),
61
- label: t.label,
62
- fields: t.fields ?? [],
63
- addField(e) {
64
- let t = "serialize" in e ? e : l(e);
65
- return this.fields.includes(t) || this.fields.push(t), t;
66
- }
67
- }), a = (n, r) => {
68
- let i = {
69
- id: n.id ?? e("step"),
70
- label: n.label,
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.experience.addConditional(e, 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: i,
113
+ step: s,
96
114
  type: "step"
97
- }, r), i;
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 === "conditional") {
138
+ if (n.type === "condition") {
120
139
  let e = {
121
140
  ...i,
122
- type: "conditional",
123
- connectedConditional: n.conditional,
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
- conditionalId: this.connectedConditional.id
147
+ conditionId: this.connectedCondition.id
129
148
  });
130
149
  }
131
150
  };
132
- return e.connectedConditional.node = e, 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
- sourceNodeHandle: n.sourceNodeHandle,
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
- sourceNodeHandle: this.sourceNodeHandle ?? void 0,
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: e("conditional"),
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
- condition: n.condition,
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
- sourceNodeHandle: "true"
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
- sourceNodeHandle: "false"
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
- label: this.label,
198
- condition: this.condition
219
+ key: this.key,
220
+ name: this.name,
221
+ logic: this.logic
199
222
  });
200
223
  }
201
224
  };
202
225
  return o({
203
- conditional: i,
204
- type: "conditional"
205
- }, r), i;
206
- }, l = (n) => ({
207
- id: n.id,
208
- name: n.name,
209
- type: n.type,
210
- label: n.label,
211
- placeholder: n.placeholder,
212
- description: n.description,
213
- helpText: n.helpText,
214
- defaultValue: n.defaultValue ?? null,
215
- multiple: n.multiple,
216
- validation: n.validation ?? {},
217
- condition: n.condition,
218
- required: n.required,
219
- options: n.options?.map((t) => ({
220
- id: "id" in t ? t.id : e("option"),
221
- ...t
222
- })) ?? null,
223
- policies: n.policies,
224
- serialize() {
225
- let e = {
226
- id: this.id,
227
- name: this.name,
228
- label: this.label,
229
- placeholder: this.placeholder,
230
- required: this.required,
231
- description: this.description,
232
- helpText: this.helpText,
233
- validation: this.validation,
234
- condition: this.condition,
235
- policies: this.policies
236
- }, 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;
237
- switch (this.type) {
238
- case "text":
239
- if (this.multiple) {
240
- let n;
241
- if (Array.isArray(this.defaultValue)) {
242
- n = [];
243
- for (let e of this.defaultValue) typeof e == "string" && n.push(e);
244
- n.length === 0 && (n = void 0);
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: !0,
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
- return t.serialize({
260
- ...e,
261
- type: "text",
262
- multiple: !1,
263
- defaultValue: n,
264
- options: this.options ? this.options.map((e) => ({
265
- id: e.id,
266
- label: e.label,
267
- value: `${e.value}`,
268
- condition: e.condition
269
- })) : null
270
- });
271
- case "number":
272
- if (this.multiple) {
273
- let n;
274
- if (Array.isArray(this.defaultValue)) {
275
- n = [];
276
- for (let e of this.defaultValue) typeof e == "number" && n.push(e);
277
- n.length === 0 && (n = void 0);
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: !0,
283
- defaultValue: n,
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
- return t.serialize({
293
- ...e,
294
- type: "number",
295
- multiple: !1,
296
- defaultValue: r,
297
- options: this.options ? this.options.map((e) => ({
298
- id: e.id,
299
- label: e.label,
300
- value: Number(e.value),
301
- condition: e.condition
302
- })) : null
303
- });
304
- case "boolean":
305
- if (this.multiple) {
306
- let n;
307
- if (Array.isArray(this.defaultValue)) {
308
- n = [];
309
- for (let e of this.defaultValue) typeof e == "boolean" && n.push(e);
310
- n.length === 0 && (n = void 0);
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: !0,
316
- defaultValue: n,
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: "boolean",
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: i,
380
+ defaultValue: this.defaultValue,
330
381
  options: this.options ? this.options.map((e) => ({
331
382
  id: e.id,
332
383
  label: e.label,
333
- value: !!e.value,
384
+ description: e.description,
385
+ value: e.value,
334
386
  condition: e.condition
335
387
  })) : null
336
388
  });
337
- case "object": return this.multiple ? t.serialize({
338
- ...e,
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
- }), u = (e) => ({
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
- conditionals: [],
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
- sourceNodeHandle: null
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
- sourceNodeHandle: null
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
- addConditional(e, t) {
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
- sourceNodeHandle: null
446
+ sourceHandle: null
418
447
  }, this);
419
448
  this.edges.push(e);
420
449
  }
421
- return this.conditionals.includes(r) || (this.conditionals.push(r), r.node && this.nodes.push(r.node)), r;
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
- sourceNodeHandle: null
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
- conditionals: this.conditionals.map((e) => t.deserialize(e.serialize())),
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 createConditional, s as createEdge, u as createExperience, n as createExperiencePlugin, l as createField, o as createNode, i as createStep, t as serialization };
494
+ export { c as createCondition, s as createEdge, u as createExperience, n as createExperiencePlugin, l as createField, o as createNode, i as createStep };