@picked/client 0.0.8 → 0.0.9-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 (41) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/cjs/plugins/experience-browser-storage/index.js +1 -1
  3. package/dist/cjs/plugins/history-browser-storage/index.js +1 -1
  4. package/dist/cjs/plugins/responses-browser-storage/index.js +1 -1
  5. package/dist/cjs/plugins/shopify/index.js +1 -1
  6. package/dist/cjs/plugins/single-page-app/index.js +1 -1
  7. package/dist/cjs/plugins/web-components/index.js +1 -1
  8. package/dist/cjs/plugins/window-object/index.js +1 -1
  9. package/dist/cjs/server/index.js +1 -1
  10. package/dist/esm/index.js +145 -126
  11. package/dist/esm/plugins/experience-browser-storage/index.js +15 -14
  12. package/dist/esm/plugins/history-browser-storage/index.js +1 -1
  13. package/dist/esm/plugins/responses-browser-storage/index.js +1 -1
  14. package/dist/esm/plugins/shopify/index.js +32 -33
  15. package/dist/esm/plugins/single-page-app/index.js +3 -3
  16. package/dist/esm/plugins/web-components/index.js +1 -1
  17. package/dist/esm/plugins/window-object/index.js +1 -1
  18. package/dist/esm/server/index.js +1 -1
  19. package/dist/{experience-instance-C1Ky25uw.js → experience-instance-BEKoIaYp.js} +156 -151
  20. package/dist/{experience-instance-DNI5sbjx.cjs → experience-instance-D4dHslLZ.cjs} +1 -1
  21. package/dist/{storage-D87xFySf.js → storage-BxBBl9Bw.js} +39 -31
  22. package/dist/storage-LI3UdcCr.cjs +1 -0
  23. package/dist/{supports-yKVnaaMQ.js → supports-BjhuLJ8z.js} +20 -12
  24. package/dist/supports-YvpQZxbh.cjs +1 -0
  25. package/dist/types/entities/experience-instance/experience-instance.d.ts +7 -7
  26. package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
  27. package/dist/types/picked.d.ts +2 -0
  28. package/dist/types/picked.d.ts.map +1 -1
  29. package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +1 -1
  30. package/dist/types/plugins/shopify/plugin.d.ts.map +1 -1
  31. package/dist/types/utils/events.d.ts +23 -24
  32. package/dist/types/utils/events.d.ts.map +1 -1
  33. package/dist/types/utils/storage.d.ts +3 -0
  34. package/dist/types/utils/storage.d.ts.map +1 -1
  35. package/dist/types/utils/supports.d.ts +1 -0
  36. package/dist/types/utils/supports.d.ts.map +1 -1
  37. package/dist/types/utils/user-session.d.ts +6 -0
  38. package/dist/types/utils/user-session.d.ts.map +1 -0
  39. package/package.json +1 -1
  40. package/dist/storage-BPJwmlva.cjs +0 -1
  41. package/dist/supports-B6KShYPU.cjs +0 -1
@@ -1,6 +1,6 @@
1
- import { createDomain as ft, createEvent as b, combine as F, createApi as J, sample as S, createEffect as v, attach as _, split as pt } from "effector";
1
+ import { createDomain as ft, createEvent as b, combine as F, createApi as J, sample as S, createEffect as B, attach as _, split as lt } from "effector";
2
2
  import { createFactory as Q, invoke as Y } from "@withease/factories";
3
- import { h as lt, s as Z, a as dt } from "./supports-yKVnaaMQ.js";
3
+ import { i as pt, s as Z, a as dt } from "./supports-BjhuLJ8z.js";
4
4
  import { l as D } from "./logger-C9a75KZn.js";
5
5
  import { i as gt } from "./object-JwZ58NOH.js";
6
6
  function mt(t) {
@@ -23,7 +23,7 @@ function d(t) {
23
23
  const e = parseFloat(`${t}`);
24
24
  return isNaN(e) ? 0 : e;
25
25
  }
26
- function L(t) {
26
+ function M(t) {
27
27
  return `${t}`;
28
28
  }
29
29
  const ht = {
@@ -38,32 +38,32 @@ const ht = {
38
38
  "<": (t, e, r) => {
39
39
  const n = d(t), i = d(e);
40
40
  if (r === void 0) return n < i;
41
- const c = d(r);
42
- return n < i && i < c;
41
+ const a = d(r);
42
+ return n < i && i < a;
43
43
  },
44
44
  "<=": (t, e, r) => {
45
45
  const n = d(t), i = d(e);
46
46
  if (r === void 0) return n <= i;
47
- const c = d(r);
48
- return n <= i && i <= c;
47
+ const a = d(r);
48
+ return n <= i && i <= a;
49
49
  },
50
50
  "!!": async (t) => await I(t),
51
51
  "!": async (t) => !await I(t),
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(L(t)) !== -1 : w(e) ? e.includes(t) : !1 : !1,
56
- cat: (...t) => t.map(L).join(""),
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(""),
57
57
  /* eslint-disable sonarjs/deprecation */
58
58
  substr: (t, e, r) => {
59
- const n = L(t), i = d(e);
59
+ const n = M(t), i = d(e);
60
60
  if (r === void 0) return n.substr(i);
61
- const c = d(r);
62
- if (c < 0) {
61
+ const a = d(r);
62
+ if (a < 0) {
63
63
  const o = n.substr(i);
64
- return o.substr(0, o.length + c);
64
+ return o.substr(0, o.length + a);
65
65
  }
66
- return n.substr(i, c);
66
+ return n.substr(i, a);
67
67
  },
68
68
  /* eslint-enable sonarjs/deprecation */
69
69
  "+": (...t) => t.reduce((e, r) => d(e) + d(r), 0),
@@ -82,32 +82,32 @@ 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 = L(t);
85
+ const n = M(t);
86
86
  if (n === "" || n === ".")
87
87
  return this;
88
88
  const i = n.split(".");
89
- let c = this;
89
+ let a = this;
90
90
  for (const o of i) {
91
- if (c == null)
91
+ if (a == null)
92
92
  return r;
93
- if (Array.isArray(c)) {
94
- const a = parseInt(o, 10);
95
- isNaN(a) ? c = c[o] : c = c[a];
93
+ if (Array.isArray(a)) {
94
+ const c = parseInt(o, 10);
95
+ isNaN(c) ? a = a[o] : a = a[c];
96
96
  } else
97
- c = c[o];
97
+ a = a[o];
98
98
  }
99
- return c !== void 0 ? c : r;
99
+ return a !== void 0 ? a : r;
100
100
  },
101
101
  async missing(...t) {
102
102
  const e = w(t[0]) ? t[0] : t, r = [];
103
103
  for (const n of e) {
104
- const i = await l({ var: n }, this);
104
+ const i = await p({ var: n }, this);
105
105
  (i === null || i === "") && r.push(`${n}`);
106
106
  }
107
107
  return r;
108
108
  },
109
109
  async missing_some(t, e) {
110
- const r = await l({ missing: e }, this);
110
+ const r = await p({ missing: e }, this);
111
111
  if (!w(r) || !w(e)) return [];
112
112
  const n = r.filter(O);
113
113
  return e.filter(O).length - n.length >= d(t) ? [] : n;
@@ -119,21 +119,21 @@ const ht = {
119
119
  regexp_matches(t, e) {
120
120
  let r = t, n = "";
121
121
  if (w(t)) {
122
- const [c, o] = t;
123
- r = c, n = o;
122
+ const [a, o] = t;
123
+ r = a, n = o;
124
124
  }
125
- return !O(r) || !O(n) ? !1 : new RegExp(r, n).test(L(e));
125
+ return !O(r) || !O(n) ? !1 : new RegExp(r, n).test(M(e));
126
126
  },
127
127
  throw(t) {
128
- throw new Error(L(t));
128
+ throw new Error(M(t));
129
129
  }
130
130
  };
131
- async function l(t, e) {
131
+ async function p(t, e) {
132
132
  if (!t) return t;
133
133
  if (tt(t))
134
- return l(await t, e);
134
+ return p(await t, e);
135
135
  if (w(t))
136
- return Promise.all(t.map((o) => l(o, e)));
136
+ return Promise.all(t.map((o) => p(o, e)));
137
137
  if (!z(t)) return t;
138
138
  const r = St(t);
139
139
  let n = r ? t[r] ?? [] : [];
@@ -141,76 +141,76 @@ async function l(t, e) {
141
141
  case "if":
142
142
  case "?:":
143
143
  for (let o = 0; o < n.length - 1; o += 2)
144
- if (await I(await l(n[o], e)))
145
- return l(n[o + 1], e);
146
- return n.length % 2 === 1 ? l(n[n.length - 1], e) : null;
144
+ if (await I(await p(n[o], e)))
145
+ return p(n[o + 1], e);
146
+ return n.length % 2 === 1 ? p(n[n.length - 1], e) : null;
147
147
  case "and": {
148
148
  let o = null;
149
- for (const a of n)
150
- if (o = await l(a, e), !await I(o))
149
+ for (const c of n)
150
+ if (o = await p(c, e), !await I(o))
151
151
  return o;
152
152
  return o;
153
153
  }
154
154
  case "or": {
155
155
  let o = null;
156
- for (const a of n)
157
- if (o = await l(a, e), await I(o)) return o;
156
+ for (const c of n)
157
+ if (o = await p(c, e), await I(o)) return o;
158
158
  return o;
159
159
  }
160
160
  case "map": {
161
- const o = await l(n[0], e);
162
- return w(o) ? await Promise.all(o.map((a) => l(n[1], a))) : [];
161
+ const o = await p(n[0], e);
162
+ return w(o) ? await Promise.all(o.map((c) => p(n[1], c))) : [];
163
163
  }
164
164
  case "filter": {
165
- const o = await l(n[0], e);
165
+ const o = await p(n[0], e);
166
166
  return w(o) ? (await Promise.all(
167
167
  o.map(async (u) => {
168
- const h = await I(await l(n[1], u));
168
+ const h = await I(await p(n[1], u));
169
169
  return { item: u, shouldInclude: h };
170
170
  })
171
171
  )).filter(({ shouldInclude: u }) => u).map(({ item: u }) => u) : [];
172
172
  }
173
173
  case "reduce": {
174
- const o = await l(n[0], e);
174
+ const o = await p(n[0], e);
175
175
  if (!w(o))
176
- return n.length > 2 ? await l(n[2], e) : null;
177
- const a = n[1];
178
- let h = n.length > 2 ? await l(n[2], e) : null;
176
+ return n.length > 2 ? await p(n[2], e) : null;
177
+ const c = n[1];
178
+ let h = n.length > 2 ? await p(n[2], e) : null;
179
179
  for (const E of o)
180
- h = await l(a, { current: E, accumulator: h });
180
+ h = await p(c, { current: E, accumulator: h });
181
181
  return h;
182
182
  }
183
183
  case "all": {
184
- const o = await l(n[0], e);
184
+ const o = await p(n[0], e);
185
185
  if (!w(o) || o.length === 0) return !1;
186
- for (const a of o)
187
- if (!await I(await l(n[1], a))) return !1;
186
+ for (const c of o)
187
+ if (!await I(await p(n[1], c))) return !1;
188
188
  return !0;
189
189
  }
190
190
  case "some": {
191
- const o = await l(n[0], e);
191
+ const o = await p(n[0], e);
192
192
  if (!w(o)) return !1;
193
- for (const a of o)
194
- if (await I(await l(n[1], a))) return !0;
193
+ for (const c of o)
194
+ if (await I(await p(n[1], c))) return !0;
195
195
  return !1;
196
196
  }
197
197
  case "none": {
198
- const o = await l(n[0], e);
198
+ const o = await p(n[0], e);
199
199
  if (!w(o)) return !0;
200
- for (const a of o)
201
- if (await I(await l(n[1], a))) return !1;
200
+ for (const c of o)
201
+ if (await I(await p(n[1], c))) return !1;
202
202
  return !0;
203
203
  }
204
204
  case "catch":
205
205
  try {
206
- return await l(n[0], e);
206
+ return await p(n[0], e);
207
207
  } catch (o) {
208
- return z(o) ? await l(o, e) : n[1] ? await l(n[1], o) : o instanceof Error ? o.message : o;
208
+ return z(o) ? await p(o, e) : n[1] ? await p(n[1], o) : o instanceof Error ? o.message : o;
209
209
  }
210
210
  }
211
- const i = await Promise.all(n.map((o) => l(o, e))), c = r ? ht[r] : void 0;
212
- if (!c) throw new Error(`Unrecognized operation ${r}`);
213
- return c.apply(e, i);
211
+ const i = await Promise.all(n.map((o) => p(o, e))), a = r ? ht[r] : void 0;
212
+ if (!a) throw new Error(`Unrecognized operation ${r}`);
213
+ return a.apply(e, i);
214
214
  }
215
215
  async function I(t) {
216
216
  return tt(t) ? I(await t) : !(Array.isArray(t) && t.length === 0) && !!t;
@@ -222,11 +222,11 @@ function jt(t) {
222
222
  return !gt(t);
223
223
  }
224
224
  async function yt(t, e, r) {
225
- const n = t.getStateSnapshot(), i = t.predicates.listStore.getState().reduce((a, u) => ({
226
- ...a,
225
+ const n = t.getStateSnapshot(), i = t.predicates.listStore.getState().reduce((c, u) => ({
226
+ ...c,
227
227
  [u.name]: () => u.predicate(n)
228
- }), {}), c = t.features.listStore.getState().reduce((a, u) => ({
229
- ...a,
228
+ }), {}), a = t.features.listStore.getState().reduce((c, u) => ({
229
+ ...c,
230
230
  [u.id]: async () => {
231
231
  const { bucket: h } = await u.getBucket();
232
232
  return h;
@@ -246,9 +246,9 @@ async function yt(t, e, r) {
246
246
  search: n.location.search
247
247
  } : void 0,
248
248
  predicates: i,
249
- features: c
249
+ features: a
250
250
  };
251
- return await l(e, o);
251
+ return await p(e, o);
252
252
  }
253
253
  function wt(t) {
254
254
  return !dt() || !Z() ? [] : Array.from(window.document.querySelectorAll(t)).filter(
@@ -256,7 +256,7 @@ function wt(t) {
256
256
  );
257
257
  }
258
258
  function xt(t) {
259
- if (!lt())
259
+ if (!pt())
260
260
  throw new Error("Shadow DOM is not supported in this environment");
261
261
  return t.attachShadow({ mode: "closed" });
262
262
  }
@@ -286,7 +286,7 @@ function Kt(t, e) {
286
286
  }
287
287
  ].flatMap((n) => {
288
288
  const i = wt(n.selector).filter(
289
- (c) => !It(c, e) && !Nt(c, e)
289
+ (a) => !It(a, e) && !Nt(a, e)
290
290
  );
291
291
  return {
292
292
  ...n,
@@ -295,7 +295,7 @@ function Kt(t, e) {
295
295
  });
296
296
  }
297
297
  function Ut(t, e) {
298
- return t.flatMap((r) => r.elements.map((n) => vt(n, r.placement, e)));
298
+ return t.flatMap((r) => r.elements.map((n) => Bt(n, r.placement, e)));
299
299
  }
300
300
  function Vt(t, e) {
301
301
  t.classList.add(R), t.classList.add(`${R}-${e}`);
@@ -310,7 +310,7 @@ function bt(t) {
310
310
  const e = document.createElement("div");
311
311
  return e.style.display = "block", e.classList.add(P), e.classList.add(`${P}-${t}`), e;
312
312
  }
313
- function vt(t, e, r) {
313
+ function Bt(t, e, r) {
314
314
  let n;
315
315
  const i = bt(r);
316
316
  if (t instanceof Document)
@@ -343,22 +343,22 @@ function _t(t) {
343
343
  function $(t) {
344
344
  return t.type === "step";
345
345
  }
346
- function At(t) {
346
+ function vt(t) {
347
347
  return t.type === "experience";
348
348
  }
349
349
  function X(t) {
350
350
  return t.type === "origin";
351
351
  }
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
- const a = t.find((u) => u.id === o.destinationNodeId);
354
- return a ? et(t, e, a, !1, i) : [];
355
- })), Mt = (t, e, r) => et(t, e, r, !0, /* @__PURE__ */ new Set()), nt = (t, e, r, n, i = /* @__PURE__ */ new Set()) => {
353
+ const c = t.find((u) => u.id === o.destinationNodeId);
354
+ return c ? et(t, e, c, !1, i) : [];
355
+ })), At = (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
- const c = e.filter((u) => u.sourceNodeId === r.id);
359
- if (c.length === 0) return [0, 0];
360
- let o = 1 / 0, a = -1 / 0;
361
- for (const u of c) {
358
+ const a = e.filter((u) => u.sourceNodeId === r.id);
359
+ if (a.length === 0) return [0, 0];
360
+ let o = 1 / 0, c = -1 / 0;
361
+ for (const u of a) {
362
362
  const h = t.find((k) => k.id === u.destinationNodeId);
363
363
  if (!h) continue;
364
364
  const [E, y] = nt(
@@ -368,17 +368,17 @@ const et = (t, e, r, n, i = /* @__PURE__ */ new Set()) => i.has(r.id) ? [] : (i.
368
368
  !1,
369
369
  new Set(i)
370
370
  );
371
- E !== -1 && (o = Math.min(o, E + 1), a = Math.max(a, y + 1));
371
+ E !== -1 && (o = Math.min(o, E + 1), c = Math.max(c, y + 1));
372
372
  }
373
- return o === 1 / 0 ? [-1, -1] : [o, a];
374
- }, Lt = (t, e, r) => nt(t, e, r, !0, /* @__PURE__ */ new Set()), rt = (t, e, r, n = /* @__PURE__ */ new Set()) => {
373
+ return o === 1 / 0 ? [-1, -1] : [o, c];
374
+ }, Mt = (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
- const i = e.filter((a) => a.destinationNodeId === r.id);
377
+ const i = e.filter((c) => c.destinationNodeId === r.id);
378
378
  if (i.length === 0) return [-1, -1];
379
- let c = 1 / 0, o = -1 / 0;
380
- for (const a of i) {
381
- const u = t.find((y) => y.id === a.sourceNodeId);
379
+ let a = 1 / 0, o = -1 / 0;
380
+ for (const c of i) {
381
+ const u = t.find((y) => y.id === c.sourceNodeId);
382
382
  if (!u) continue;
383
383
  const [h, E] = rt(
384
384
  t,
@@ -386,23 +386,23 @@ const et = (t, e, r, n, i = /* @__PURE__ */ new Set()) => i.has(r.id) ? [] : (i.
386
386
  u,
387
387
  new Set(n)
388
388
  );
389
- h !== -1 && (c = Math.min(c, h + 1), o = Math.max(o, E + 1));
389
+ h !== -1 && (a = Math.min(a, h + 1), o = Math.max(o, E + 1));
390
390
  }
391
- return c === 1 / 0 ? [-1, -1] : [c, o];
392
- }, Tt = (t, e, r) => rt(t, e, r, /* @__PURE__ */ new Set()), ot = (t) => t.find((r) => r.type === "origin") || null, K = (t, e, r) => {
391
+ return a === 1 / 0 ? [-1, -1] : [a, o];
392
+ }, Lt = (t, e, r) => rt(t, e, r, /* @__PURE__ */ new Set()), ot = (t) => t.find((r) => r.type === "origin") || null, K = (t, e, r) => {
393
393
  if (!t)
394
394
  return ot(e);
395
- const n = r.find((c) => c.sourceNodeId === t.id);
395
+ const n = r.find((a) => a.sourceNodeId === t.id);
396
396
  if (!n)
397
397
  return null;
398
- const i = e.find((c) => c.id === n.destinationNodeId);
398
+ const i = e.find((a) => a.id === n.destinationNodeId);
399
399
  return i || null;
400
400
  };
401
- async function Bt(t, e, r, n) {
402
- const i = t ? "true" : "false", c = n.find(
401
+ async function Tt(t, e, r, n) {
402
+ const i = t ? "true" : "false", a = n.find(
403
403
  (o) => o.sourceNodeHandle === i && o.sourceNodeId === e
404
404
  );
405
- return r.find((o) => o.id === (c == null ? void 0 : c.destinationNodeId));
405
+ return r.find((o) => o.id === (a == null ? void 0 : a.destinationNodeId));
406
406
  }
407
407
  const U = ft("experience-instance"), Ft = Q(
408
408
  ({
@@ -410,30 +410,30 @@ const U = ft("experience-instance"), Ft = Q(
410
410
  experience: e,
411
411
  target: r
412
412
  }) => {
413
- const n = b(), i = b(), c = b(), o = b(), a = e.componentStore, u = U.store("transitioning"), h = t.history.entriesStore.map((s) => s.filter((p) => p.experienceId === e.id)), E = h.map((s) => s.filter((p) => $(p.node))), y = h.map((s) => {
414
- var p;
415
- return ((p = s[s.length - 1]) == null ? void 0 : p.node) || null;
413
+ const n = b(), i = b(), a = b(), o = b(), c = e.componentStore, u = U.store("transitioning"), h = t.history.entriesStore.map((s) => s.filter((l) => l.experienceId === e.id)), E = h.map((s) => s.filter((l) => $(l.node))), y = h.map((s) => {
414
+ var l;
415
+ return ((l = s[s.length - 1]) == null ? void 0 : l.node) || null;
416
416
  }), k = F(
417
417
  e.treeStore,
418
418
  y,
419
- ({ steps: s }, p) => s.find((g) => p && $(p) && g.id === p.stepId) || null
419
+ ({ steps: s }, l) => s.find((g) => l && $(l) && g.id === l.stepId) || null
420
420
  ), C = F(
421
421
  e.treeStore,
422
422
  y,
423
- ({ nodes: s, edges: p }, g) => g ? Mt(s, p, g) : []
423
+ ({ nodes: s, edges: l }, g) => g ? At(s, l, g) : []
424
424
  ), f = F(
425
425
  e.treeStore,
426
426
  y,
427
- ({ nodes: s, edges: p }, g) => g ? Tt(s, p, g) : [-1, -1]
427
+ ({ nodes: s, edges: l }, g) => g ? Lt(s, l, g) : [-1, -1]
428
428
  ), m = F(
429
429
  e.treeStore,
430
430
  y,
431
- ({ nodes: s, edges: p }, g) => g ? Lt(s, p, g) : [-1, -1]
431
+ ({ nodes: s, edges: l }, g) => g ? Mt(s, l, g) : [-1, -1]
432
432
  ), x = U.store(!0), N = J(x, {
433
433
  open: () => !0,
434
434
  close: () => !1,
435
435
  toggle: (s) => !s,
436
- set: (s, p) => p
436
+ set: (s, l) => l
437
437
  });
438
438
  S({
439
439
  source: x,
@@ -450,12 +450,12 @@ const U = ft("experience-instance"), Ft = Q(
450
450
  experience: e
451
451
  }))
452
452
  });
453
- const A = v(async () => {
453
+ const v = B(async () => {
454
454
  t.history.back({ experienceId: e.id });
455
- }), T = _({
455
+ }), L = _({
456
456
  source: e.treeStore,
457
- effect: async (s, p) => {
458
- const g = s.nodes.find((M) => $(M) && M.stepId === p);
457
+ effect: async (s, l) => {
458
+ const g = s.nodes.find((A) => $(A) && A.stepId === l);
459
459
  g && t.history.push({ experienceId: e.id, node: g });
460
460
  }
461
461
  }), V = _({
@@ -467,33 +467,33 @@ const U = ft("experience-instance"), Ft = Q(
467
467
  effect: async ({ nodes: s }) => ot(s)
468
468
  }), j = _({
469
469
  source: e.treeStore,
470
- effect: async ({ nodes: s, edges: p }, g) => K(g, s, p)
470
+ effect: async ({ nodes: s, edges: l }, g) => K(g, s, l)
471
471
  }), G = _({
472
472
  source: e.treeStore,
473
- effect: async ({ nodes: s, edges: p, conditionals: g }, M) => {
474
- if (!M)
473
+ effect: async ({ nodes: s, edges: l, conditionals: g }, A) => {
474
+ if (!A)
475
475
  return;
476
- const q = g.find((ut) => ut.id === M.conditionalId);
476
+ const q = g.find((ut) => ut.id === A.conditionalId);
477
477
  if (!q)
478
478
  return;
479
- const ct = M.id, at = await yt(t, q.condition);
480
- return Bt(!!at, ct, s, p);
479
+ const at = A.id, ct = await yt(t, q.condition);
480
+ return Tt(!!ct, at, s, l);
481
481
  }
482
- }), st = v((s) => {
482
+ }), st = B((s) => {
483
483
  if (s)
484
484
  return t.launchExperienceById(s.experienceId);
485
485
  }), W = _({
486
486
  source: [y, e.treeStore],
487
- effect: async ([s, { nodes: p, edges: g }]) => K(s, p, g)
488
- }), B = _({
487
+ effect: async ([s, { nodes: l, edges: g }]) => K(s, l, g)
488
+ }), T = _({
489
489
  source: [y, e.treeStore],
490
- effect: async ([s, { nodes: p, edges: g }]) => K(s, p, g)
491
- }), it = v((s) => {
490
+ effect: async ([s, { nodes: l, edges: g }]) => K(s, l, g)
491
+ }), it = B((s) => {
492
492
  t.history.push({ experienceId: e.id, node: s });
493
493
  });
494
- return pt({
494
+ return lt({
495
495
  source: y,
496
- match: (s) => s ? _t(s) ? "condition" : $(s) ? "step" : At(s) ? "launchExperience" : X(s) ? "origin" : "other" : "none",
496
+ match: (s) => s ? _t(s) ? "condition" : $(s) ? "step" : vt(s) ? "launchExperience" : X(s) ? "origin" : "other" : "none",
497
497
  cases: {
498
498
  none: H,
499
499
  origin: j,
@@ -507,64 +507,69 @@ const U = ft("experience-instance"), Ft = Q(
507
507
  G.doneData,
508
508
  j.doneData,
509
509
  H.doneData,
510
- B.doneData,
510
+ T.doneData,
511
511
  W.doneData
512
512
  ],
513
513
  filter: Boolean,
514
514
  target: it
515
515
  }), S({
516
516
  clock: i,
517
- target: B
517
+ target: T
518
518
  }), S({
519
519
  clock: i,
520
520
  source: k,
521
+ filter: Boolean,
521
522
  target: t.eventBus.prepend((s) => ({
522
523
  type: "step_submit",
523
- step: s ?? void 0,
524
+ step: s,
524
525
  experience: e
525
526
  }))
526
527
  }), S({
527
- clock: B.done,
528
+ clock: T.done,
528
529
  source: k,
530
+ filter: Boolean,
529
531
  target: t.eventBus.prepend((s) => ({
530
532
  type: "step_submit_success",
531
- step: s ?? void 0,
533
+ step: s,
532
534
  experience: e
533
535
  }))
534
536
  }), S({
535
- clock: B.fail,
537
+ clock: T.fail,
536
538
  source: k,
539
+ filter: Boolean,
537
540
  target: t.eventBus.prepend((s) => ({
538
541
  type: "step_submit_error",
539
- step: s ?? void 0,
542
+ step: s,
540
543
  experience: e
541
544
  }))
542
545
  }), S({
543
- clock: c,
544
- target: A
546
+ clock: a,
547
+ target: v
545
548
  }), S({
546
- clock: c,
549
+ clock: a,
547
550
  source: k,
551
+ filter: Boolean,
548
552
  target: t.eventBus.prepend((s) => ({
549
553
  type: "step_submit",
550
- step: s ?? void 0,
554
+ step: s,
551
555
  experience: e
552
556
  }))
553
- }), S({ clock: o, target: T }), S({
557
+ }), S({ clock: o, target: L }), S({
554
558
  source: F([
555
559
  G.pending,
556
560
  j.pending,
557
561
  H.pending,
558
- B.pending
562
+ T.pending
559
563
  ]),
560
564
  fn: (s) => s.some(Boolean) ? "transitioning" : "ready",
561
565
  target: u
562
566
  }), S({
563
567
  clock: V.doneData,
564
568
  source: k,
569
+ filter: Boolean,
565
570
  target: t.eventBus.prepend((s) => ({
566
571
  type: "step_enter",
567
- step: s ?? void 0,
572
+ step: s,
568
573
  experience: e
569
574
  }))
570
575
  }), S({
@@ -578,7 +583,7 @@ const U = ft("experience-instance"), Ft = Q(
578
583
  experienceId: e.id,
579
584
  configStore: e.configStore,
580
585
  target: r,
581
- componentStore: a,
586
+ componentStore: c,
582
587
  // state
583
588
  stateStore: u,
584
589
  // open close
@@ -596,7 +601,7 @@ const U = ft("experience-instance"), Ft = Q(
596
601
  stepsToLeafStore: m,
597
602
  // history
598
603
  goToNextStep: i,
599
- goToPreviousStep: c,
604
+ goToPreviousStep: a,
600
605
  goToStepById: o,
601
606
  stepsHistoryStore: E
602
607
  };
@@ -606,7 +611,7 @@ function Ot(t) {
606
611
  return Y(Ft, t);
607
612
  }
608
613
  const $t = Q(({ client: t }) => {
609
- const e = U.store({}), r = b(), n = b(), i = b(), c = J(e, {
614
+ const e = U.store({}), r = b(), n = b(), i = b(), a = J(e, {
610
615
  register(f, m) {
611
616
  const x = [
612
617
  ...f[m.experienceId] ?? []
@@ -617,28 +622,28 @@ const $t = Q(({ client: t }) => {
617
622
  };
618
623
  },
619
624
  unregister(f, m) {
620
- var A;
621
- const x = m.experienceId, N = (A = f[x]) == null ? void 0 : A.filter(
622
- (T) => T !== m
625
+ var v;
626
+ const x = m.experienceId, N = (v = f[x]) == null ? void 0 : v.filter(
627
+ (L) => L !== m
623
628
  );
624
629
  return {
625
630
  ...f,
626
631
  [x]: N ?? []
627
632
  };
628
633
  }
629
- }), o = v(
634
+ }), o = B(
630
635
  ({ experience: f, target: m }) => Ot({ client: t, experience: f, target: m })
631
- ), a = v((f) => {
632
- c.register(f);
633
- }), u = v(
636
+ ), c = B((f) => {
637
+ a.register(f);
638
+ }), u = B(
634
639
  (f) => {
635
640
  f.target && Et(f.target, () => {
636
641
  i(f);
637
642
  });
638
643
  }
639
- ), h = v((f) => {
640
- c.unregister(f);
641
- }), E = v((f) => {
644
+ ), h = B((f) => {
645
+ a.unregister(f);
646
+ }), E = B((f) => {
642
647
  const m = f.componentStore.getState();
643
648
  if (!m) {
644
649
  D("warn", "No app component registered. Skipping init.");
@@ -660,11 +665,11 @@ const $t = Q(({ client: t }) => {
660
665
  );
661
666
  return;
662
667
  }
663
- const A = xt(N);
668
+ const v = xt(N);
664
669
  try {
665
- x.render(A, m.component, t, f);
666
- } catch (T) {
667
- D("error", T);
670
+ x.render(v, m.component, t, f);
671
+ } catch (L) {
672
+ D("error", L);
668
673
  }
669
674
  });
670
675
  S({
@@ -676,7 +681,7 @@ const $t = Q(({ client: t }) => {
676
681
  }), S({
677
682
  clock: o.doneData,
678
683
  target: [
679
- a,
684
+ c,
680
685
  u,
681
686
  n
682
687
  ]