@picked/client 0.0.7 → 0.0.8-next.1

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 (29) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/cjs/plugins/create-experience/index.js +1 -1
  3. package/dist/cjs/plugins/responses-browser-storage/index.js +1 -1
  4. package/dist/cjs/plugins/responses-indexeddb/index.js +1 -1
  5. package/dist/cjs/server/index.js +1 -1
  6. package/dist/esm/index.js +323 -291
  7. package/dist/esm/plugins/create-experience/index.js +75 -67
  8. package/dist/esm/plugins/responses-browser-storage/index.js +16 -15
  9. package/dist/esm/plugins/responses-indexeddb/index.js +24 -21
  10. package/dist/esm/server/index.js +1 -1
  11. package/dist/{experience-instance-DYZovD6a.js → experience-instance-C1Ky25uw.js} +17 -16
  12. package/dist/{experience-instance-DwO_yZK0.cjs → experience-instance-DNI5sbjx.cjs} +1 -1
  13. package/dist/types/entities/experience-instance/experience-instance.d.ts +3 -0
  14. package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
  15. package/dist/types/entities/field/field.d.ts +27 -19
  16. package/dist/types/entities/field/field.d.ts.map +1 -1
  17. package/dist/types/entities/predicate/predicate.d.ts +1 -1
  18. package/dist/types/entities/predicate/predicate.d.ts.map +1 -1
  19. package/dist/types/entities/response/response.d.ts +8 -0
  20. package/dist/types/entities/response/response.d.ts.map +1 -1
  21. package/dist/types/exports.d.ts +2 -0
  22. package/dist/types/exports.d.ts.map +1 -1
  23. package/dist/types/picked.d.ts +12 -6
  24. package/dist/types/picked.d.ts.map +1 -1
  25. package/dist/types/plugins/create-experience/create-experience.d.ts +17 -6
  26. package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
  27. package/dist/types/utils/get-step-fields.d.ts +4 -0
  28. package/dist/types/utils/get-step-fields.d.ts.map +1 -0
  29. package/package.json +1 -1
@@ -9,10 +9,10 @@ const r = {
9
9
  }, b = (e) => ({
10
10
  name: "create-experience",
11
11
  setup: (a) => {
12
- e.experiences.forEach((l) => {
13
- const s = l.serialize(), o = r.deserialize(s);
14
- o.component = l.component, a.registerExperience(o), o.fields.forEach((c) => {
15
- a.registerField(c);
12
+ e.experiences.forEach((o) => {
13
+ const s = o.serialize(), d = r.deserialize(s);
14
+ d.component = o.component, a.registerExperience(d), d.fields.forEach((h) => {
15
+ a.registerField(h);
16
16
  });
17
17
  });
18
18
  }
@@ -21,12 +21,12 @@ const r = {
21
21
  label: e.label,
22
22
  fields: e.fields ?? [],
23
23
  addField(a) {
24
- var s, o;
25
- const l = "serialize" in a ? a : m(a);
26
- return (s = this.fields) != null && s.includes(l) || (o = this.fields) == null || o.push(l), l;
24
+ var s, d;
25
+ const o = "serialize" in a ? a : m(a);
26
+ return (s = this.fields) != null && s.includes(o) || (d = this.fields) == null || d.push(o), o;
27
27
  }
28
28
  }), y = (e, a) => {
29
- const l = {
29
+ const o = {
30
30
  id: e.id ?? f("step"),
31
31
  label: e.label,
32
32
  experience: a,
@@ -52,16 +52,16 @@ const r = {
52
52
  });
53
53
  }
54
54
  };
55
- return h({ step: l, type: "step" }, a), l;
56
- }, z = () => [0, 0], h = (e, a) => {
57
- const l = {
55
+ return c({ step: o, type: "step" }, a), o;
56
+ }, z = () => [0, 0], c = (e, a) => {
57
+ const o = {
58
58
  id: f("node"),
59
59
  position: z(),
60
60
  experience: a
61
61
  };
62
62
  if (e.type === "step") {
63
- const o = {
64
- ...l,
63
+ const d = {
64
+ ...o,
65
65
  type: "step",
66
66
  connectedStep: e.step,
67
67
  serialize() {
@@ -74,11 +74,11 @@ const r = {
74
74
  });
75
75
  }
76
76
  };
77
- return o.connectedStep.node = o, o;
77
+ return d.connectedStep.node = d, d;
78
78
  }
79
79
  if (e.type === "conditional") {
80
- const o = {
81
- ...l,
80
+ const d = {
81
+ ...o,
82
82
  type: "conditional",
83
83
  connectedConditional: e.conditional,
84
84
  serialize() {
@@ -90,10 +90,10 @@ const r = {
90
90
  });
91
91
  }
92
92
  };
93
- return o.connectedConditional.node = o, o;
93
+ return d.connectedConditional.node = d, d;
94
94
  }
95
95
  return e.type === "experience" ? {
96
- ...l,
96
+ ...o,
97
97
  type: "experience",
98
98
  connectedExperience: e.experience,
99
99
  serialize() {
@@ -105,7 +105,7 @@ const r = {
105
105
  });
106
106
  }
107
107
  } : {
108
- ...l,
108
+ ...o,
109
109
  type: "origin",
110
110
  serialize() {
111
111
  return r.serialize({
@@ -130,7 +130,7 @@ const r = {
130
130
  });
131
131
  }
132
132
  }), N = (e, a) => {
133
- const l = {
133
+ const o = {
134
134
  id: f("conditional"),
135
135
  condition: e.condition,
136
136
  node: null,
@@ -138,20 +138,20 @@ const r = {
138
138
  addTrue(s) {
139
139
  if (!this.node || !s.node)
140
140
  throw new Error("todo no node");
141
- const o = p(
141
+ const d = p(
142
142
  { sourceNode: this.node, destinationNode: s.node, sourceNodeHandle: "true" },
143
143
  this.experience
144
144
  );
145
- this.experience.edges.push(o);
145
+ this.experience.edges.push(d);
146
146
  },
147
147
  addFalse(s) {
148
148
  if (!this.node || !s.node)
149
149
  throw new Error("todo no node");
150
- const o = p(
150
+ const d = p(
151
151
  { sourceNode: this.node, destinationNode: s.node, sourceNodeHandle: "false" },
152
152
  this.experience
153
153
  );
154
- this.experience.edges.push(o);
154
+ this.experience.edges.push(d);
155
155
  },
156
156
  serialize() {
157
157
  return r.serialize({
@@ -160,9 +160,9 @@ const r = {
160
160
  });
161
161
  }
162
162
  };
163
- return h({ conditional: l, type: "conditional" }, a), l;
163
+ return c({ conditional: o, type: "conditional" }, a), o;
164
164
  }, m = (e) => {
165
- var l;
165
+ var o;
166
166
  return {
167
167
  id: e.id,
168
168
  name: e.name,
@@ -171,13 +171,14 @@ const r = {
171
171
  placeholder: e.placeholder,
172
172
  description: e.description,
173
173
  helpText: e.helpText,
174
- defaultValue: e.defaultValue,
174
+ defaultValue: e.defaultValue ?? null,
175
175
  multiple: e.multiple,
176
- validation: e.validation,
176
+ validation: e.validation ?? {},
177
+ condition: e.condition,
177
178
  required: e.required,
178
- options: ((l = e.options) == null ? void 0 : l.map((s) => ({
179
+ options: ((o = e.options) == null ? void 0 : o.map((s) => ({
179
180
  ...s
180
- }))) || null,
181
+ }))) ?? null,
181
182
  policies: e.policies,
182
183
  serialize() {
183
184
  const s = {
@@ -189,17 +190,18 @@ const r = {
189
190
  description: this.description,
190
191
  helpText: this.helpText,
191
192
  validation: this.validation,
193
+ condition: this.condition,
192
194
  policies: this.policies
193
- }, o = typeof this.defaultValue == "string" ? this.defaultValue : null, c = typeof this.defaultValue == "number" ? this.defaultValue : null, n = typeof this.defaultValue == "boolean" ? this.defaultValue : null;
195
+ }, d = typeof this.defaultValue == "string" ? this.defaultValue : void 0, h = typeof this.defaultValue == "number" ? this.defaultValue : void 0, n = typeof this.defaultValue == "boolean" ? this.defaultValue : void 0;
194
196
  switch (this.type) {
195
197
  case "text":
196
198
  if (this.multiple) {
197
- let i = null;
199
+ let i;
198
200
  if (Array.isArray(this.defaultValue)) {
199
201
  i = [];
200
202
  for (const t of this.defaultValue)
201
203
  typeof t == "string" && i.push(t);
202
- i.length === 0 && (i = null);
204
+ i.length === 0 && (i = void 0);
203
205
  }
204
206
  return r.serialize({
205
207
  ...s,
@@ -209,7 +211,8 @@ const r = {
209
211
  options: this.options ? this.options.map((t) => ({
210
212
  id: t.id,
211
213
  label: t.label,
212
- value: `${t.value}`
214
+ value: `${t.value}`,
215
+ condition: t.condition
213
216
  })) : null
214
217
  });
215
218
  }
@@ -217,21 +220,22 @@ const r = {
217
220
  ...s,
218
221
  type: "text",
219
222
  multiple: !1,
220
- defaultValue: o,
223
+ defaultValue: d,
221
224
  options: this.options ? this.options.map((i) => ({
222
225
  id: i.id,
223
226
  label: i.label,
224
- value: `${i.value}`
227
+ value: `${i.value}`,
228
+ condition: i.condition
225
229
  })) : null
226
230
  });
227
231
  case "number":
228
232
  if (this.multiple) {
229
- let i = null;
233
+ let i;
230
234
  if (Array.isArray(this.defaultValue)) {
231
235
  i = [];
232
236
  for (const t of this.defaultValue)
233
237
  typeof t == "number" && i.push(t);
234
- i.length === 0 && (i = null);
238
+ i.length === 0 && (i = void 0);
235
239
  }
236
240
  return r.serialize({
237
241
  ...s,
@@ -241,7 +245,8 @@ const r = {
241
245
  options: this.options ? this.options.map((t) => ({
242
246
  id: t.id,
243
247
  label: t.label,
244
- value: Number(t.value)
248
+ value: Number(t.value),
249
+ condition: t.condition
245
250
  })) : null
246
251
  });
247
252
  }
@@ -249,21 +254,22 @@ const r = {
249
254
  ...s,
250
255
  type: "number",
251
256
  multiple: !1,
252
- defaultValue: c,
257
+ defaultValue: h,
253
258
  options: this.options ? this.options.map((i) => ({
254
259
  id: i.id,
255
260
  label: i.label,
256
- value: Number(i.value)
261
+ value: Number(i.value),
262
+ condition: i.condition
257
263
  })) : null
258
264
  });
259
265
  case "boolean":
260
266
  if (this.multiple) {
261
- let i = null;
267
+ let i;
262
268
  if (Array.isArray(this.defaultValue)) {
263
269
  i = [];
264
270
  for (const t of this.defaultValue)
265
271
  typeof t == "boolean" && i.push(t);
266
- i.length === 0 && (i = null);
272
+ i.length === 0 && (i = void 0);
267
273
  }
268
274
  return r.serialize({
269
275
  ...s,
@@ -273,7 +279,8 @@ const r = {
273
279
  options: this.options ? this.options.map((t) => ({
274
280
  id: t.id,
275
281
  label: t.label,
276
- value: !!t.value
282
+ value: !!t.value,
283
+ condition: t.condition
277
284
  })) : null
278
285
  });
279
286
  }
@@ -285,7 +292,8 @@ const r = {
285
292
  options: this.options ? this.options.map((i) => ({
286
293
  id: i.id,
287
294
  label: i.label,
288
- value: !!i.value
295
+ value: !!i.value,
296
+ condition: i.condition
289
297
  })) : null
290
298
  });
291
299
  // todo: support for object type fields
@@ -311,8 +319,8 @@ const r = {
311
319
  }
312
320
  }
313
321
  };
314
- }, V = (e) => {
315
- const a = [], l = [], s = [], o = [], c = [];
322
+ }, v = (e) => {
323
+ const a = [], o = [], s = [], d = [], h = [];
316
324
  return {
317
325
  id: e.id,
318
326
  component: e.component,
@@ -321,52 +329,52 @@ const r = {
321
329
  decide: e.decide,
322
330
  targets: e.targets,
323
331
  steps: a,
324
- nodes: l,
332
+ nodes: o,
325
333
  edges: s,
326
- fields: c,
327
- conditionals: o,
334
+ fields: h,
335
+ conditionals: d,
328
336
  addStep(n, i) {
329
337
  let t = i == null ? void 0 : i.node;
330
- this.nodes.length === 0 && (t = h({ type: "origin" }, this), this.nodes.push(t));
331
- const d = "serialize" in n ? n : y(n, this);
338
+ this.nodes.length === 0 && (t = c({ type: "origin" }, this), this.nodes.push(t));
339
+ const l = "serialize" in n ? n : y(n, this);
332
340
  if (t) {
333
- if (!d.node)
341
+ if (!l.node)
334
342
  throw new Error("todo no node");
335
343
  const u = p(
336
- { sourceNode: t, destinationNode: d.node, sourceNodeHandle: null },
344
+ { sourceNode: t, destinationNode: l.node, sourceNodeHandle: null },
337
345
  this
338
346
  );
339
347
  this.edges.push(u);
340
348
  }
341
- return d.fields.length > 0 && d.fields.forEach((u) => {
349
+ return l.fields.length > 0 && l.fields.forEach((u) => {
342
350
  this.fields.includes(u) || this.fields.push(u);
343
- }), this.steps.includes(d) || (this.steps.push(d), d.node && this.nodes.push(d.node)), d;
351
+ }), this.steps.includes(l) || (this.steps.push(l), l.node && this.nodes.push(l.node)), l;
344
352
  },
345
353
  addConditional(n, i) {
346
354
  let t = i == null ? void 0 : i.node;
347
- this.nodes.length === 0 && (t = h({ type: "origin" }, this), this.nodes.push(t));
348
- const d = "serialize" in n ? n : N(n, this);
355
+ this.nodes.length === 0 && (t = c({ type: "origin" }, this), this.nodes.push(t));
356
+ const l = "serialize" in n ? n : N(n, this);
349
357
  if (t) {
350
- if (!d.node)
358
+ if (!l.node)
351
359
  throw new Error("todo no node");
352
360
  const u = p(
353
- { sourceNode: t, destinationNode: d.node, sourceNodeHandle: null },
361
+ { sourceNode: t, destinationNode: l.node, sourceNodeHandle: null },
354
362
  this
355
363
  );
356
364
  this.edges.push(u);
357
365
  }
358
- return this.conditionals.includes(d) || (this.conditionals.push(d), d.node && this.nodes.push(d.node)), d;
366
+ return this.conditionals.includes(l) || (this.conditionals.push(l), l.node && this.nodes.push(l.node)), l;
359
367
  },
360
368
  addExperience(n, i) {
361
369
  let t = i == null ? void 0 : i.node;
362
- this.nodes.length === 0 && (t = h({ type: "origin" }, this), this.nodes.push(t));
363
- const d = h(
370
+ this.nodes.length === 0 && (t = c({ type: "origin" }, this), this.nodes.push(t));
371
+ const l = c(
364
372
  { type: "experience", experience: n },
365
373
  this
366
374
  );
367
- if (this.nodes.push(d), t) {
375
+ if (this.nodes.push(l), t) {
368
376
  const u = p(
369
- { sourceNode: t, destinationNode: d, sourceNodeHandle: null },
377
+ { sourceNode: t, destinationNode: l, sourceNodeHandle: null },
370
378
  this
371
379
  );
372
380
  this.edges.push(u);
@@ -399,10 +407,10 @@ const r = {
399
407
  export {
400
408
  N as createConditional,
401
409
  p as createEdge,
402
- V as createExperience,
410
+ v as createExperience,
403
411
  b as createExperiencePlugin,
404
412
  m as createField,
405
- h as createNode,
413
+ c as createNode,
406
414
  x as createStep,
407
415
  r as serialization
408
416
  };
@@ -1,36 +1,37 @@
1
- import { createEffect as l, sample as p } from "effector";
2
- import { c as m, l as b, s as d } from "../../../storage-D87xFySf.js";
3
- const a = m("responses", "global"), j = ({
4
- storage: i = "local"
1
+ import { createEffect as p, sample as i } from "effector";
2
+ import { c as b, l as d, s as y } from "../../../storage-D87xFySf.js";
3
+ const a = b("responses", "global"), R = ({
4
+ storage: g = "local"
5
5
  } = {}) => ({
6
6
  name: "responses-browser-storage-plugin",
7
7
  setup: (e) => {
8
- const t = i === "local" ? b : d, g = l(async () => {
8
+ const t = g === "local" ? d : y, u = p(async () => {
9
9
  const s = t.get(a).json();
10
10
  if (!s)
11
11
  return null;
12
12
  Object.entries(s).forEach(([r, o]) => {
13
13
  e.responses.register(r, o);
14
14
  });
15
- }), u = l(async (s) => {
15
+ }), f = p(async (s) => {
16
16
  const r = t.get(a).json(), o = {};
17
- Object.entries(s).forEach(([c, S]) => {
17
+ Object.entries(s).forEach(([c, m]) => {
18
+ var l;
18
19
  const n = e.fields.getById(c).getState();
19
- !(n != null && n.policies.doNotStoreValue) && (o[c] = S);
20
+ !((l = n == null ? void 0 : n.policies) != null && l.doNotStoreValue) && (o[c] = m);
20
21
  });
21
- const f = { ...r, ...o };
22
- t.set(a, f);
22
+ const S = { ...r, ...o };
23
+ t.set(a, S);
23
24
  });
24
- p({
25
+ i({
25
26
  source: e.eventBus,
26
27
  filter: (s) => s.type === "initialized",
27
- target: g
28
- }), p({
29
- source: e.responses.getAllStore,
30
28
  target: u
29
+ }), i({
30
+ source: e.responses.getAllStore,
31
+ target: f
31
32
  });
32
33
  }
33
34
  });
34
35
  export {
35
- j as responsesBrowserStoragePlugin
36
+ R as responsesBrowserStoragePlugin
36
37
  };
@@ -1,6 +1,6 @@
1
- import { createEffect as u, sample as d } from "effector";
1
+ import { createEffect as d, sample as p } from "effector";
2
2
  const x = "picked";
3
- async function p(r) {
3
+ async function m(r) {
4
4
  const { storeName: o, version: a = 1, keyPath: n = "id" } = r;
5
5
  return new Promise((i, t) => {
6
6
  const s = indexedDB.open(x, a);
@@ -49,48 +49,51 @@ async function S(r, o) {
49
49
  };
50
50
  });
51
51
  }
52
- const l = "responses", m = { storeName: l, keyPath: "fieldId" }, I = () => ({
52
+ const u = "responses", w = { storeName: u, keyPath: "fieldId" }, I = () => ({
53
53
  name: "responses-indexdb-plugin",
54
54
  setup: (r) => {
55
- const o = u(async () => {
56
- const t = await p(m), e = (await g(t, l)).reduce(
57
- (c, { fieldId: w, value: f }) => (c[w] = f, c),
55
+ const o = d(async () => {
56
+ const t = await m(w), e = (await g(t, u)).reduce(
57
+ (c, { fieldId: l, value: f }) => (c[l] = f, c),
58
58
  {}
59
59
  );
60
60
  await r.responses.commit(e);
61
- }), a = u(
61
+ }), a = d(
62
62
  async (t) => {
63
63
  t.forEach((s) => {
64
- p(m).then((e) => {
65
- y(e, l, s);
64
+ m(w).then((e) => {
65
+ y(e, u, s);
66
66
  }).catch((e) => {
67
67
  console.error("Failed to store response in IndexedDB:", e);
68
68
  });
69
69
  });
70
70
  }
71
- ), n = u(async () => {
72
- const t = await p(m);
73
- await S(t, l);
74
- }), i = u(async (t) => {
75
- const s = await p(m);
76
- await b(s, l, t);
71
+ ), n = d(async () => {
72
+ const t = await m(w);
73
+ await S(t, u);
74
+ }), i = d(async (t) => {
75
+ const s = await m(w);
76
+ await b(s, u, t);
77
77
  });
78
- d({
78
+ p({
79
79
  source: r.eventBus,
80
80
  filter: (t) => t.type === "initialized",
81
81
  target: o
82
- }), d({
82
+ }), p({
83
83
  clock: r.responses.listStore,
84
84
  source: { responses: r.responses.listStore, fields: r.fields.listStore },
85
85
  fn: ({ responses: t, fields: s }) => {
86
- const e = s.filter((c) => !c.policies.doNotStoreValue);
87
- return t.filter((c) => e.some((w) => w.id === c.fieldId));
86
+ const e = s.filter((c) => {
87
+ var l;
88
+ return !((l = c.policies) != null && l.doNotStoreValue);
89
+ });
90
+ return t.filter((c) => e.some((l) => l.id === c.fieldId));
88
91
  },
89
92
  target: a
90
- }), d({
93
+ }), p({
91
94
  clock: r.responses.clearAll,
92
95
  target: n
93
- }), d({
96
+ }), p({
94
97
  clock: r.responses.clear,
95
98
  target: i
96
99
  });
@@ -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-DYZovD6a.js";
2
+ import { h as F } from "../../experience-instance-C1Ky25uw.js";
3
3
  function R() {
4
4
  let c, p;
5
5
  return {
@@ -23,7 +23,7 @@ function d(t) {
23
23
  const e = parseFloat(`${t}`);
24
24
  return isNaN(e) ? 0 : e;
25
25
  }
26
- function M(t) {
26
+ function L(t) {
27
27
  return `${t}`;
28
28
  }
29
29
  const ht = {
@@ -52,11 +52,11 @@ const ht = {
52
52
  "%": (t, e) => d(t) % d(e),
53
53
  // eslint-disable-next-line sonarjs/function-return-type
54
54
  log: (t) => (console.log(t), t),
55
- in: (t, e) => e ? O(e) ? e.indexOf(M(t)) !== -1 : w(e) ? e.includes(t) : !1 : !1,
56
- cat: (...t) => t.map(M).join(""),
55
+ in: (t, e) => e ? O(e) ? e.indexOf(L(t)) !== -1 : w(e) ? e.includes(t) : !1 : !1,
56
+ cat: (...t) => t.map(L).join(""),
57
57
  /* eslint-disable sonarjs/deprecation */
58
58
  substr: (t, e, r) => {
59
- const n = M(t), i = d(e);
59
+ const n = L(t), i = d(e);
60
60
  if (r === void 0) return n.substr(i);
61
61
  const c = d(r);
62
62
  if (c < 0) {
@@ -82,7 +82,7 @@ const ht = {
82
82
  return this;
83
83
  if (typeof t == "number" && Array.isArray(this))
84
84
  return t >= 0 && t < this.length ? this[t] : r;
85
- const n = M(t);
85
+ const n = L(t);
86
86
  if (n === "" || n === ".")
87
87
  return this;
88
88
  const i = n.split(".");
@@ -122,10 +122,10 @@ const ht = {
122
122
  const [c, o] = t;
123
123
  r = c, n = o;
124
124
  }
125
- return !O(r) || !O(n) ? !1 : new RegExp(r, n).test(M(e));
125
+ return !O(r) || !O(n) ? !1 : new RegExp(r, n).test(L(e));
126
126
  },
127
127
  throw(t) {
128
- throw new Error(M(t));
128
+ throw new Error(L(t));
129
129
  }
130
130
  };
131
131
  async function l(t, e) {
@@ -352,7 +352,7 @@ function X(t) {
352
352
  const et = (t, e, r, n, i = /* @__PURE__ */ new Set()) => i.has(r.id) ? [] : (i.add(r.id), $(r) && !n ? [r] : e.filter((o) => o.sourceNodeId === r.id).flatMap((o) => {
353
353
  const a = t.find((u) => u.id === o.destinationNodeId);
354
354
  return a ? et(t, e, a, !1, i) : [];
355
- })), Lt = (t, e, r) => et(t, e, r, !0, /* @__PURE__ */ new Set()), nt = (t, e, r, n, i = /* @__PURE__ */ new Set()) => {
355
+ })), Mt = (t, e, r) => et(t, e, r, !0, /* @__PURE__ */ new Set()), nt = (t, e, r, n, i = /* @__PURE__ */ new Set()) => {
356
356
  if (i.has(r.id)) return [-1, -1];
357
357
  i.add(r.id);
358
358
  const c = e.filter((u) => u.sourceNodeId === r.id);
@@ -371,7 +371,7 @@ const et = (t, e, r, n, i = /* @__PURE__ */ new Set()) => i.has(r.id) ? [] : (i.
371
371
  E !== -1 && (o = Math.min(o, E + 1), a = Math.max(a, y + 1));
372
372
  }
373
373
  return o === 1 / 0 ? [-1, -1] : [o, a];
374
- }, Mt = (t, e, r) => nt(t, e, r, !0, /* @__PURE__ */ new Set()), rt = (t, e, r, n = /* @__PURE__ */ new Set()) => {
374
+ }, Lt = (t, e, r) => nt(t, e, r, !0, /* @__PURE__ */ new Set()), rt = (t, e, r, n = /* @__PURE__ */ new Set()) => {
375
375
  if (n.has(r.id)) return [-1, -1];
376
376
  if (n.add(r.id), r.type === "origin") return [0, 0];
377
377
  const i = e.filter((a) => a.destinationNodeId === r.id);
@@ -420,7 +420,7 @@ const U = ft("experience-instance"), Ft = Q(
420
420
  ), C = F(
421
421
  e.treeStore,
422
422
  y,
423
- ({ nodes: s, edges: p }, g) => g ? Lt(s, p, g) : []
423
+ ({ nodes: s, edges: p }, g) => g ? Mt(s, p, g) : []
424
424
  ), f = F(
425
425
  e.treeStore,
426
426
  y,
@@ -428,7 +428,7 @@ const U = ft("experience-instance"), Ft = Q(
428
428
  ), m = F(
429
429
  e.treeStore,
430
430
  y,
431
- ({ nodes: s, edges: p }, g) => g ? Mt(s, p, g) : [-1, -1]
431
+ ({ nodes: s, edges: p }, g) => g ? Lt(s, p, g) : [-1, -1]
432
432
  ), x = U.store(!0), N = J(x, {
433
433
  open: () => !0,
434
434
  close: () => !1,
@@ -455,7 +455,7 @@ const U = ft("experience-instance"), Ft = Q(
455
455
  }), T = _({
456
456
  source: e.treeStore,
457
457
  effect: async (s, p) => {
458
- const g = s.nodes.find((L) => $(L) && L.stepId === p);
458
+ const g = s.nodes.find((M) => $(M) && M.stepId === p);
459
459
  g && t.history.push({ experienceId: e.id, node: g });
460
460
  }
461
461
  }), V = _({
@@ -470,13 +470,13 @@ const U = ft("experience-instance"), Ft = Q(
470
470
  effect: async ({ nodes: s, edges: p }, g) => K(g, s, p)
471
471
  }), G = _({
472
472
  source: e.treeStore,
473
- effect: async ({ nodes: s, edges: p, conditionals: g }, L) => {
474
- if (!L)
473
+ effect: async ({ nodes: s, edges: p, conditionals: g }, M) => {
474
+ if (!M)
475
475
  return;
476
- const q = g.find((ut) => ut.id === L.conditionalId);
476
+ const q = g.find((ut) => ut.id === M.conditionalId);
477
477
  if (!q)
478
478
  return;
479
- const ct = L.id, at = await yt(t, q.condition);
479
+ const ct = M.id, at = await yt(t, q.condition);
480
480
  return Bt(!!at, ct, s, p);
481
481
  }
482
482
  }), st = v((s) => {
@@ -573,6 +573,7 @@ const U = ft("experience-instance"), Ft = Q(
573
573
  filter: (s) => s ? X(s) : !0,
574
574
  target: W
575
575
  }), n(), {
576
+ id: Math.random().toString(36).substring(7),
576
577
  // config
577
578
  experienceId: e.id,
578
579
  configStore: e.configStore,