@picked/client 0.0.1-dev.1772165084341 → 0.0.1-dev.1772412203098

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 (75) hide show
  1. package/dist/cjs/index.js +2 -2
  2. package/dist/cjs/plugins/create-experience/index.js +1 -1
  3. package/dist/cjs/plugins/experience-browser-storage/index.js +1 -1
  4. package/dist/cjs/plugins/history-browser-storage/index.js +1 -1
  5. package/dist/cjs/plugins/responses-browser-storage/index.js +1 -1
  6. package/dist/cjs/plugins/responses-indexeddb/index.js +1 -1
  7. package/dist/cjs/plugins/single-page-app/index.js +1 -1
  8. package/dist/cjs/server/index.js +1 -1
  9. package/dist/esm/index.js +691 -593
  10. package/dist/esm/plugins/create-experience/index.js +210 -236
  11. package/dist/esm/plugins/experience-browser-storage/index.js +1 -1
  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/responses-indexeddb/index.js +51 -46
  15. package/dist/esm/plugins/single-page-app/index.js +24 -24
  16. package/dist/esm/server/index.js +1 -1
  17. package/dist/experience-instance-BX0aqKsC.cjs +1 -0
  18. package/dist/{experience-instance-fvSEb72i.js → experience-instance-DTyL1fNb.js} +205 -199
  19. package/dist/{object-JwZ58NOH.js → object-CJssU1Pm.js} +1 -1
  20. package/dist/object-mwaxtjLG.cjs +1 -0
  21. package/dist/storage-58NoTSsc.cjs +1 -0
  22. package/dist/{storage-Co_LbKr_.js → storage-B2d81EOI.js} +35 -30
  23. package/dist/types/entities/action/action.d.ts +5 -2
  24. package/dist/types/entities/action/action.d.ts.map +1 -1
  25. package/dist/types/entities/experience/experience.d.ts +5 -4
  26. package/dist/types/entities/experience/experience.d.ts.map +1 -1
  27. package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
  28. package/dist/types/entities/feature/feature.d.ts.map +1 -1
  29. package/dist/types/entities/field/field.d.ts +51 -14
  30. package/dist/types/entities/field/field.d.ts.map +1 -1
  31. package/dist/types/entities/history/history.d.ts.map +1 -1
  32. package/dist/types/entities/project/project.d.ts.map +1 -1
  33. package/dist/types/entities/response/response.d.ts.map +1 -1
  34. package/dist/types/index.d.ts +1 -0
  35. package/dist/types/index.d.ts.map +1 -1
  36. package/dist/types/logic-engine.d.ts +2 -8
  37. package/dist/types/logic-engine.d.ts.map +1 -1
  38. package/dist/types/picked.d.ts +16 -7
  39. package/dist/types/picked.d.ts.map +1 -1
  40. package/dist/types/plugins/create-experience/create-experience.d.ts +26 -21
  41. package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
  42. package/dist/types/plugins/experience-browser-storage/plugin.d.ts +2 -1
  43. package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +1 -1
  44. package/dist/types/plugins/history-browser-storage/plugin.d.ts +2 -1
  45. package/dist/types/plugins/history-browser-storage/plugin.d.ts.map +1 -1
  46. package/dist/types/plugins/responses-browser-storage/plugin.d.ts +2 -1
  47. package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +1 -1
  48. package/dist/types/plugins/responses-indexeddb/plugin.d.ts.map +1 -1
  49. package/dist/types/plugins/single-page-app/plugin.d.ts +1 -1
  50. package/dist/types/plugins/single-page-app/plugin.d.ts.map +1 -1
  51. package/dist/types/utils/dom.d.ts +0 -3
  52. package/dist/types/utils/dom.d.ts.map +1 -1
  53. package/dist/types/utils/events.d.ts +1 -1
  54. package/dist/types/utils/events.d.ts.map +1 -1
  55. package/dist/types/utils/get-step-fields.d.ts +2 -1
  56. package/dist/types/utils/get-step-fields.d.ts.map +1 -1
  57. package/dist/types/utils/global-obj.d.ts +0 -1
  58. package/dist/types/utils/global-obj.d.ts.map +1 -1
  59. package/dist/types/utils/indexed-db.d.ts +2 -1
  60. package/dist/types/utils/indexed-db.d.ts.map +1 -1
  61. package/dist/types/utils/logger.d.ts.map +1 -1
  62. package/dist/types/utils/node-tree/min-max-steps-to-leaf.d.ts.map +1 -1
  63. package/dist/types/utils/node-tree/min-max-steps-to-origin.d.ts.map +1 -1
  64. package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts.map +1 -1
  65. package/dist/types/utils/object.d.ts +0 -8
  66. package/dist/types/utils/object.d.ts.map +1 -1
  67. package/dist/types/utils/picked-config.d.ts +1 -1
  68. package/dist/types/utils/picked-config.d.ts.map +1 -1
  69. package/dist/types/utils/rules-logic.d.ts.map +1 -1
  70. package/dist/types/utils/search-params.d.ts.map +1 -1
  71. package/dist/types/utils/storage.d.ts.map +1 -1
  72. package/package.json +14 -2
  73. package/dist/experience-instance-BsXG5XJ4.cjs +0 -1
  74. package/dist/object-BbFTsGh3.cjs +0 -1
  75. package/dist/storage-Be5xWNPC.cjs +0 -1
@@ -1,15 +1,15 @@
1
- import { createDomain as kt, createEvent as k, combine as D, createApi as lt, createEffect as _, attach as O, sample as m, split as bt } from "effector";
1
+ import { createDomain as kt, createEvent as b, combine as D, createApi as lt, createEffect as B, attach as O, sample as S, split as bt } from "effector";
2
2
  import { createFactory as dt, invoke as pt } from "@withease/factories";
3
3
  import { a as vt, s as gt, j as At } from "./supports-8YT4QKI7.js";
4
4
  import { l as I } from "./logger-C9a75KZn.js";
5
- import { i as Ot } from "./object-JwZ58NOH.js";
5
+ import { i as Ot } from "./object-CJssU1Pm.js";
6
6
  function Ft(t) {
7
7
  return typeof t == "number" && !isNaN(t);
8
8
  }
9
9
  function j(t) {
10
10
  return typeof t == "string";
11
11
  }
12
- function N(t) {
12
+ function E(t) {
13
13
  return Array.isArray(t);
14
14
  }
15
15
  function mt(t) {
@@ -18,7 +18,7 @@ function mt(t) {
18
18
  function st(t) {
19
19
  return typeof t == "object" && t !== null && !Array.isArray(t) && Object.keys(t).length === 1;
20
20
  }
21
- function g(t) {
21
+ function m(t) {
22
22
  if (Ft(t)) return t;
23
23
  const e = parseFloat(`${t}`);
24
24
  return isNaN(e) ? 0 : e;
@@ -26,39 +26,39 @@ function g(t) {
26
26
  function R(t) {
27
27
  return `${t}`;
28
28
  }
29
- const Bt = {
29
+ const _t = {
30
30
  // eslint-disable-next-line eqeqeq
31
31
  "==": (t, e) => t == e,
32
32
  "===": (t, e) => t === e,
33
33
  // eslint-disable-next-line eqeqeq
34
34
  "!=": (t, e) => t != e,
35
35
  "!==": (t, e) => t !== e,
36
- ">": (t, e) => g(t) > g(e),
37
- ">=": (t, e) => g(t) >= g(e),
36
+ ">": (t, e) => m(t) > m(e),
37
+ ">=": (t, e) => m(t) >= m(e),
38
38
  "<": (t, e, r) => {
39
- const n = g(t), s = g(e);
39
+ const n = m(t), s = m(e);
40
40
  if (r === void 0) return n < s;
41
- const a = g(r);
41
+ const a = m(r);
42
42
  return n < s && s < a;
43
43
  },
44
44
  "<=": (t, e, r) => {
45
- const n = g(t), s = g(e);
45
+ const n = m(t), s = m(e);
46
46
  if (r === void 0) return n <= s;
47
- const a = g(r);
47
+ const a = m(r);
48
48
  return n <= s && s <= a;
49
49
  },
50
50
  "!!": async (t) => await v(t),
51
51
  "!": async (t) => !await v(t),
52
- "%": (t, e) => g(t) % g(e),
52
+ "%": (t, e) => m(t) % m(e),
53
53
  // eslint-disable-next-line sonarjs/function-return-type
54
54
  log: (t) => (console.log(t), t),
55
- in: (t, e) => e ? j(e) ? e.indexOf(R(t)) !== -1 : N(e) ? e.includes(t) : !1 : !1,
55
+ in: (t, e) => e ? j(e) ? e.indexOf(R(t)) !== -1 : E(e) ? e.includes(t) : !1 : !1,
56
56
  cat: (...t) => t.map(R).join(""),
57
57
  /* eslint-disable sonarjs/deprecation */
58
58
  substr: (t, e, r) => {
59
- const n = R(t), s = g(e);
59
+ const n = R(t), s = m(e);
60
60
  if (r === void 0) return n.substr(s);
61
- const a = g(r);
61
+ const a = m(r);
62
62
  if (a < 0) {
63
63
  const o = n.substr(s);
64
64
  return o.substr(0, o.length + a);
@@ -66,16 +66,17 @@ const Bt = {
66
66
  return n.substr(s, a);
67
67
  },
68
68
  /* eslint-enable sonarjs/deprecation */
69
- "+": (...t) => t.reduce((e, r) => g(e) + g(r), 0),
70
- "*": (...t) => t.reduce((e, r) => g(e) * g(r), 1),
69
+ "+": (...t) => t.reduce((e, r) => m(e) + m(r), 0),
70
+ "*": (...t) => t.reduce((e, r) => m(e) * m(r), 1),
71
71
  "-": (t, e) => {
72
- const r = g(t);
73
- return e === void 0 ? -r : r - g(e);
72
+ const r = m(t);
73
+ return e === void 0 ? -r : r - m(e);
74
74
  },
75
- "/": (t, e) => g(t) / g(e),
76
- min: (...t) => Math.min(...t.map(g)),
77
- max: (...t) => Math.max(...t.map(g)),
78
- merge: (...t) => t.reduce((e, r) => N(r) ? e.concat(r) : e.concat([r]), []),
75
+ "/": (t, e) => m(t) / m(e),
76
+ min: (...t) => Math.min(...t.map(m)),
77
+ max: (...t) => Math.max(...t.map(m)),
78
+ merge: (...t) => t.reduce((e, r) => E(r) ? e.concat(r) : e.concat([r]), []),
79
+ // eslint-disable-next-line sonarjs/cognitive-complexity -- JSONLogic var operator requires complex path traversal logic
79
80
  var(t, e) {
80
81
  const r = arguments.length > 1 ? e : null;
81
82
  if (t === "" || t === "." || t === null || t === void 0)
@@ -91,15 +92,15 @@ const Bt = {
91
92
  if (a == null)
92
93
  return r;
93
94
  if (Array.isArray(a)) {
94
- const u = parseInt(o, 10);
95
- isNaN(u) ? a = a[o] : a = a[u];
95
+ const f = parseInt(o, 10);
96
+ isNaN(f) ? a = a[o] : a = a[f];
96
97
  } else
97
98
  a = a[o];
98
99
  }
99
100
  return a !== void 0 ? a : r;
100
101
  },
101
102
  async missing(...t) {
102
- const e = N(t[0]) ? t[0] : t, r = [];
103
+ const e = E(t[0]) ? t[0] : t, r = [];
103
104
  for (const n of e) {
104
105
  const s = await p({ var: n }, this);
105
106
  (s === null || s === "") && r.push(`${n}`);
@@ -108,9 +109,9 @@ const Bt = {
108
109
  },
109
110
  async missing_some(t, e) {
110
111
  const r = await p({ missing: e }, this);
111
- if (!N(r) || !N(e)) return [];
112
+ if (!E(r) || !E(e)) return [];
112
113
  const n = r.filter(j);
113
- return e.filter(j).length - n.length >= g(t) ? [] : n;
114
+ return e.filter(j).length - n.length >= m(t) ? [] : n;
114
115
  },
115
116
  /**
116
117
  * Invoke operator - executes a function with optional arguments
@@ -130,7 +131,7 @@ const Bt = {
130
131
  },
131
132
  regexp_matches(t, e) {
132
133
  let r = t, n = "";
133
- if (N(t)) {
134
+ if (E(t)) {
134
135
  const [a, o] = t;
135
136
  r = a, n = o;
136
137
  }
@@ -144,12 +145,12 @@ async function p(t, e) {
144
145
  if (!t) return t;
145
146
  if (mt(t))
146
147
  return p(await t, e);
147
- if (N(t))
148
+ if (E(t))
148
149
  return Promise.all(t.map((o) => p(o, e)));
149
150
  if (!st(t)) return t;
150
- const r = _t(t);
151
+ const r = Bt(t);
151
152
  let n = r ? t[r] ?? [] : [];
152
- switch (N(n) || (n = [n]), r) {
153
+ switch (E(n) || (n = [n]), r) {
153
154
  case "if":
154
155
  case "?:":
155
156
  for (let o = 0; o < n.length - 1; o += 2)
@@ -158,59 +159,59 @@ async function p(t, e) {
158
159
  return n.length % 2 === 1 ? p(n[n.length - 1], e) : null;
159
160
  case "and": {
160
161
  let o = null;
161
- for (const u of n)
162
- if (o = await p(u, e), !await v(o))
162
+ for (const f of n)
163
+ if (o = await p(f, e), !await v(o))
163
164
  return o;
164
165
  return o;
165
166
  }
166
167
  case "or": {
167
168
  let o = null;
168
- for (const u of n)
169
- if (o = await p(u, e), await v(o)) return o;
169
+ for (const f of n)
170
+ if (o = await p(f, e), await v(o)) return o;
170
171
  return o;
171
172
  }
172
173
  case "map": {
173
174
  const o = await p(n[0], e);
174
- return N(o) ? await Promise.all(o.map((u) => p(n[1], u))) : [];
175
+ return E(o) ? await Promise.all(o.map((f) => p(n[1], f))) : [];
175
176
  }
176
177
  case "filter": {
177
178
  const o = await p(n[0], e);
178
- return N(o) ? (await Promise.all(
179
+ return E(o) ? (await Promise.all(
179
180
  o.map(async (d) => {
180
- const y = await v(await p(n[1], d));
181
- return { item: d, shouldInclude: y };
181
+ const g = await v(await p(n[1], d));
182
+ return { item: d, shouldInclude: g };
182
183
  })
183
184
  )).filter(({ shouldInclude: d }) => d).map(({ item: d }) => d) : [];
184
185
  }
185
186
  case "reduce": {
186
187
  const o = await p(n[0], e);
187
- if (!N(o))
188
+ if (!E(o))
188
189
  return n.length > 2 ? await p(n[2], e) : null;
189
- const u = n[1];
190
- let y = n.length > 2 ? await p(n[2], e) : null;
191
- for (const b of o)
192
- y = await p(u, { current: b, accumulator: y });
193
- return y;
190
+ const f = n[1];
191
+ let g = n.length > 2 ? await p(n[2], e) : null;
192
+ for (const x of o)
193
+ g = await p(f, { current: x, accumulator: g });
194
+ return g;
194
195
  }
195
196
  case "all": {
196
197
  const o = await p(n[0], e);
197
- if (!N(o) || o.length === 0) return !1;
198
- for (const u of o)
199
- if (!await v(await p(n[1], u))) return !1;
198
+ if (!E(o) || o.length === 0) return !1;
199
+ for (const f of o)
200
+ if (!await v(await p(n[1], f))) return !1;
200
201
  return !0;
201
202
  }
202
203
  case "some": {
203
204
  const o = await p(n[0], e);
204
- if (!N(o)) return !1;
205
- for (const u of o)
206
- if (await v(await p(n[1], u))) return !0;
205
+ if (!E(o)) return !1;
206
+ for (const f of o)
207
+ if (await v(await p(n[1], f))) return !0;
207
208
  return !1;
208
209
  }
209
210
  case "none": {
210
211
  const o = await p(n[0], e);
211
- if (!N(o)) return !0;
212
- for (const u of o)
213
- if (await v(await p(n[1], u))) return !1;
212
+ if (!E(o)) return !0;
213
+ for (const f of o)
214
+ if (await v(await p(n[1], f))) return !1;
214
215
  return !0;
215
216
  }
216
217
  case "catch":
@@ -220,31 +221,33 @@ async function p(t, e) {
220
221
  return st(o) ? await p(o, e) : n[1] ? await p(n[1], o) : o instanceof Error ? o.message : o;
221
222
  }
222
223
  }
223
- const s = await Promise.all(n.map((o) => p(o, e))), a = r ? Bt[r] : void 0;
224
+ const s = await Promise.all(n.map((o) => p(o, e))), a = r ? _t[r] : void 0;
224
225
  if (!a) throw new Error(`Unrecognized operation ${r}`);
225
226
  return a.apply(e, s);
226
227
  }
227
228
  async function v(t) {
228
229
  return mt(t) ? v(await t) : !(Array.isArray(t) && t.length === 0) && !!t;
229
230
  }
230
- function _t(t) {
231
+ function Bt(t) {
231
232
  return Object.keys(t)[0];
232
233
  }
233
234
  function $t(t) {
234
235
  return !Ot(t);
235
236
  }
236
237
  async function at(t, e, r) {
237
- const n = t.getStateSnapshot(), s = t.predicates.listStore.getState().reduce((u, d) => ({
238
- ...u,
239
- [d.name]: (...y) => d.predicate({ ...n, args: y })
240
- }), {}), a = t.features.listStore.getState().reduce((u, d) => ({
241
- ...u,
242
- [d.id]: async () => {
243
- const { bucket: y } = await d.getBucket();
244
- return y;
238
+ const n = t.getStateSnapshot(), s = t.predicates.listStore.getState().reduce((d, g) => ({
239
+ ...d,
240
+ [g.name]: (...x) => g.predicate({ ...n, args: x })
241
+ }), {}), a = t.features.listStore.getState().reduce((d, g) => ({
242
+ ...d,
243
+ [g.id]: async () => {
244
+ const { bucket: x } = await g.getBucket();
245
+ return x;
245
246
  }
246
- }), {}), o = {
247
- ...r,
247
+ }), {}), o = t.actions.listStore.getState().reduce((d, g) => ({
248
+ ...d,
249
+ [g.name]: (x) => g.action(x)
250
+ }), {}), f = {
248
251
  responses: t.responses.getAllStore.getState(),
249
252
  location: typeof n.location == "object" ? {
250
253
  hash: n.location.hash,
@@ -258,9 +261,11 @@ async function at(t, e, r) {
258
261
  search: n.location.search
259
262
  } : void 0,
260
263
  predicates: s,
261
- features: a
264
+ features: a,
265
+ actions: o,
266
+ ...r
262
267
  };
263
- return await p(e, o);
268
+ return await p(e, f);
264
269
  }
265
270
  function Mt(t) {
266
271
  return !vt() || !gt() ? [] : Array.from(window.document.querySelectorAll(t)).filter(
@@ -342,7 +347,7 @@ function jt(t, e, r) {
342
347
  case "prepend":
343
348
  t.prepend(s);
344
349
  break;
345
- default:
350
+ case "append":
346
351
  t.append(s);
347
352
  break;
348
353
  }
@@ -366,43 +371,43 @@ function ft(t) {
366
371
  return t.type === "action";
367
372
  }
368
373
  const St = (t, e, r, n, s = /* @__PURE__ */ new Set()) => s.has(r.id) ? [] : (s.add(r.id), P(r) && !n ? [r] : e.filter((o) => o.sourceNodeId === r.id).flatMap((o) => {
369
- const u = t.find((d) => d.id === o.destinationNodeId);
370
- return u ? St(t, e, u, !1, s) : [];
374
+ const f = t.find((d) => d.id === o.destinationNodeId);
375
+ return f ? St(t, e, f, !1, s) : [];
371
376
  })), Ut = (t, e, r) => St(t, e, r, !0, /* @__PURE__ */ new Set()), yt = (t, e, r, n, s = /* @__PURE__ */ new Set()) => {
372
377
  if (s.has(r.id)) return [-1, -1];
373
378
  s.add(r.id);
374
379
  const a = e.filter((d) => d.sourceNodeId === r.id);
375
380
  if (a.length === 0) return [0, 0];
376
- let o = 1 / 0, u = -1 / 0;
381
+ let o = 1 / 0, f = -1 / 0;
377
382
  for (const d of a) {
378
- const y = t.find((M) => M.id === d.destinationNodeId);
379
- if (!y) continue;
380
- const [b, F] = yt(
383
+ const g = t.find((M) => M.id === d.destinationNodeId);
384
+ if (!g) continue;
385
+ const [x, F] = yt(
381
386
  t,
382
387
  e,
383
- y,
388
+ g,
384
389
  !1,
385
390
  new Set(s)
386
391
  );
387
- b !== -1 && (o = Math.min(o, b + 1), u = Math.max(u, F + 1));
392
+ x !== -1 && (o = Math.min(o, x + 1), f = Math.max(f, F + 1));
388
393
  }
389
- return o === 1 / 0 ? [-1, -1] : [o, u];
394
+ return o === 1 / 0 ? [-1, -1] : [o, f];
390
395
  }, Wt = (t, e, r) => yt(t, e, r, !0, /* @__PURE__ */ new Set()), ht = (t, e, r, n = /* @__PURE__ */ new Set()) => {
391
396
  if (n.has(r.id)) return [-1, -1];
392
397
  if (n.add(r.id), r.type === "origin") return [0, 0];
393
- const s = e.filter((u) => u.destinationNodeId === r.id);
398
+ const s = e.filter((f) => f.destinationNodeId === r.id);
394
399
  if (s.length === 0) return [-1, -1];
395
400
  let a = 1 / 0, o = -1 / 0;
396
- for (const u of s) {
397
- const d = t.find((F) => F.id === u.sourceNodeId);
401
+ for (const f of s) {
402
+ const d = t.find((F) => F.id === f.sourceNodeId);
398
403
  if (!d) continue;
399
- const [y, b] = ht(
404
+ const [g, x] = ht(
400
405
  t,
401
406
  e,
402
407
  d,
403
408
  new Set(n)
404
409
  );
405
- y !== -1 && (a = Math.min(a, y + 1), o = Math.max(o, b + 1));
410
+ g !== -1 && (a = Math.min(a, g + 1), o = Math.max(o, x + 1));
406
411
  }
407
412
  return a === 1 / 0 ? [-1, -1] : [a, o];
408
413
  }, Gt = (t, e, r) => ht(t, e, r, /* @__PURE__ */ new Set()), wt = (t) => t.find((r) => r.type === "origin") || null, Z = (t, e, r) => {
@@ -427,44 +432,44 @@ const tt = kt("experience-instance"), Vt = dt(
427
432
  target: r,
428
433
  options: n
429
434
  }) => {
430
- const s = k(), a = k(), o = k(), u = k(), d = k(), y = k(), b = e.componentStore, F = tt.store("transitioning"), M = t.history.entriesStore.map((i) => i.filter((l) => l.experienceId === e.id)), U = M.map((i) => i.filter((l) => P(l.node))), c = M.map((i) => i.at(-1)?.node || null), S = D(
435
+ const s = b(), a = b(), o = b(), f = b(), d = b(), g = b(), x = e.componentStore, F = tt.store("transitioning"), M = t.history.entriesStore.map((i) => i.filter((l) => l.experienceId === e.id)), U = M.map((i) => i.filter((l) => P(l.node))), c = M.map((i) => i.at(-1)?.node || null), y = D(
431
436
  e.treeStore,
432
437
  c,
433
- ({ steps: i }, l) => i.find((f) => l && P(l) && f.id === l.stepId) || null
434
- ), x = D(
438
+ ({ steps: i }, l) => i.find((u) => l && P(l) && u.id === l.stepId) || null
439
+ ), N = D(
435
440
  e.treeStore,
436
441
  U,
437
442
  ({ steps: i }, l) => {
438
- const f = l.at(-2);
439
- if (!f || !P(f.node))
443
+ const u = l.at(-2);
444
+ if (!u || !P(u.node))
440
445
  return null;
441
- const h = f.node;
442
- return i.find((B) => B.id === h.stepId) || null;
446
+ const h = u.node;
447
+ return i.find((_) => _.id === h.stepId) || null;
443
448
  }
444
449
  ), T = D(
445
450
  e.treeStore,
446
451
  c,
447
- ({ nodes: i, edges: l }, f) => f ? Ut(i, l, f) : []
452
+ ({ nodes: i, edges: l }, u) => u ? Ut(i, l, u) : []
448
453
  ), C = D(
449
454
  e.treeStore,
450
455
  c,
451
- ({ nodes: i, edges: l }, f) => f ? Gt(i, l, f) : [-1, -1]
456
+ ({ nodes: i, edges: l }, u) => u ? Gt(i, l, u) : [-1, -1]
452
457
  ), q = D(
453
458
  e.treeStore,
454
459
  c,
455
- ({ nodes: i, edges: l }, f) => f ? Wt(i, l, f) : [-1, -1]
460
+ ({ nodes: i, edges: l }, u) => u ? Wt(i, l, u) : [-1, -1]
456
461
  ), L = tt.store(!1), W = lt(L, {
457
462
  open: () => !0,
458
463
  close: () => !1,
459
464
  toggle: (i) => !i,
460
465
  set: (i, l) => l
461
- }), xt = _(async () => {
466
+ }), xt = B(async () => {
462
467
  t.history.back({ experienceId: e.id });
463
468
  }), Nt = O({
464
469
  source: e.treeStore,
465
470
  effect: async (i, l) => {
466
- const f = i.nodes.find((h) => P(h) && h.stepId === l);
467
- f && t.history.push({ experienceId: e.id, node: f });
471
+ const u = i.nodes.find((h) => P(h) && h.stepId === l);
472
+ u && t.history.push({ experienceId: e.id, node: u });
468
473
  }
469
474
  }), et = O({
470
475
  source: c,
@@ -475,86 +480,87 @@ const tt = kt("experience-instance"), Vt = dt(
475
480
  effect: async ({ nodes: i }) => wt(i)
476
481
  }), X = O({
477
482
  source: e.treeStore,
478
- effect: async ({ nodes: i, edges: l }, f) => {
479
- if (Y(f))
480
- return Z(f, i, l);
483
+ effect: async ({ nodes: i, edges: l }, u) => {
484
+ if (Y(u))
485
+ return Z(u, i, l);
481
486
  }
482
487
  }), J = O({
483
488
  source: e.treeStore,
484
- effect: async ({ nodes: i, edges: l, conditionals: f }, h) => {
489
+ effect: async ({ nodes: i, edges: l, conditionals: u }, h) => {
485
490
  if (!ct(h))
486
491
  return;
487
- const B = f.find((A) => A.id === h.conditionalId);
488
- if (!B)
492
+ const _ = u.find((A) => A.id === h.conditionalId);
493
+ if (!_)
489
494
  return;
490
- const E = h.id, w = await at(t, B.condition);
491
- return Kt(!!w, E, i, l);
495
+ const k = h.id, w = await at(t, _.condition);
496
+ return Kt(!!w, k, i, l);
492
497
  }
493
498
  }), nt = O({
494
499
  source: e.treeStore,
495
- effect: async ({ nodes: i, edges: l }, f) => {
496
- if (!ft(f))
500
+ effect: async ({ nodes: i, edges: l }, u) => {
501
+ if (!ft(u))
497
502
  return;
498
- const h = f.action;
503
+ const h = u.action;
499
504
  if (!h) {
500
- I("warn", `Action node ${f.id} has no action name`);
505
+ I("warn", `Action node ${u.id} has no action name`);
501
506
  return;
502
507
  }
503
- const B = t.actions.getByName(h).getState();
504
- if (!B) {
508
+ const _ = t.actions.getByName(h).getState();
509
+ if (!_) {
505
510
  I("warn", `Action '${h}' not registered on client`);
506
- const E = l.find(
507
- (w) => w.sourceNodeId === f.id && w.sourceNodeHandle === "false"
511
+ const k = l.find(
512
+ (w) => w.sourceNodeId === u.id && w.sourceNodeHandle === "false"
508
513
  );
509
- return E ? i.find((w) => w.id === E.destinationNodeId) : null;
514
+ return k ? i.find((w) => w.id === k.destinationNodeId) : null;
510
515
  }
511
- if (typeof B.action != "function") {
516
+ if (typeof _.action != "function") {
512
517
  I("warn", `Action '${h}' is not a function`);
513
- const E = l.find(
514
- (w) => w.sourceNodeId === f.id && w.sourceNodeHandle === "false"
518
+ const k = l.find(
519
+ (w) => w.sourceNodeId === u.id && w.sourceNodeHandle === "false"
515
520
  );
516
- return E ? i.find((w) => w.id === E.destinationNodeId) : null;
521
+ return k ? i.find((w) => w.id === k.destinationNodeId) : null;
517
522
  }
518
523
  try {
519
- I("info", `Executing action: ${h}`), await B.action(h);
520
- const E = l.find(
521
- (A) => A.sourceNodeId === f.id && A.sourceNodeHandle === "true"
524
+ I("info", `Executing action: ${h}`), await _.action(h);
525
+ const k = l.find(
526
+ (A) => A.sourceNodeId === u.id && A.sourceNodeHandle === "true"
522
527
  );
523
- if (!E)
524
- return I("warn", `No 'true' edge found for action node ${f.id}`), null;
525
- const w = i.find((A) => A.id === E.destinationNodeId);
528
+ if (!k)
529
+ return I("warn", `No 'true' edge found for action node ${u.id}`), null;
530
+ const w = i.find((A) => A.id === k.destinationNodeId);
526
531
  return I("info", `Action '${h}' succeeded, moving to node ${w?.id}`), w || null;
527
- } catch (E) {
528
- I("warn", `Action '${h}' failed:`, E);
532
+ } catch (k) {
533
+ I("warn", `Action '${h}' failed:`, k);
529
534
  const w = l.find(
530
- (G) => G.sourceNodeId === f.id && G.sourceNodeHandle === "false"
535
+ (G) => G.sourceNodeId === u.id && G.sourceNodeHandle === "false"
531
536
  );
532
537
  if (!w)
533
- return I("warn", `No 'false' edge found for action node ${f.id}`), null;
538
+ return I("warn", `No 'false' edge found for action node ${u.id}`), null;
534
539
  const A = i.find((G) => G.id === w.destinationNodeId);
535
540
  return I("info", `Action '${h}' failed, moving to node ${A?.id}`), A || null;
536
541
  }
537
542
  }
538
- }), It = _((i) => {
543
+ }), Et = B((i) => {
539
544
  ut(i) && t.experiences.launch({ id: i.experienceId });
540
545
  }), rt = O({
541
546
  source: [c, e.treeStore],
542
- effect: async ([i, { nodes: l, edges: f }]) => Z(i, l, f)
547
+ effect: async ([i, { nodes: l, edges: u }]) => Z(i, l, u)
543
548
  }), H = O({
544
549
  source: [c, e.treeStore],
545
- effect: async ([i, { nodes: l, edges: f }]) => Z(i, l, f)
546
- }), Et = _((i) => {
550
+ effect: async ([i, { nodes: l, edges: u }]) => Z(i, l, u)
551
+ }), It = B((i) => {
547
552
  t.history.push({ experienceId: e.id, node: i });
548
553
  }), ot = O({
549
554
  source: e.configStore,
550
555
  effect: async ({ initializeOpenLogic: i }) => n?.initialiseOpen !== void 0 ? n.initialiseOpen : $t(i) ? !!await at(t, i) : i ?? !1
551
556
  }), $ = Object.freeze({
557
+ // eslint-disable-next-line sonarjs/pseudo-random -- non-security use: generating a unique runtime ID for UI tracking
552
558
  id: Math.random().toString(36).substring(7),
553
559
  // config
554
560
  experienceId: e.id,
555
561
  configStore: e.configStore,
556
562
  target: r,
557
- componentStore: b,
563
+ componentStore: x,
558
564
  // state
559
565
  stateStore: F,
560
566
  // open close
@@ -567,25 +573,25 @@ const tt = kt("experience-instance"), Vt = dt(
567
573
  treeStore: e.treeStore,
568
574
  fieldsStore: e.fieldsStore,
569
575
  currentNodeStore: c,
570
- currentStepStore: S,
571
- previousStepStore: x,
576
+ currentStepStore: y,
577
+ previousStepStore: N,
572
578
  nextReachableStepNodesStore: T,
573
579
  stepsToOriginStore: C,
574
580
  stepsToLeafStore: q,
575
581
  // history
576
582
  goToNextStep: a,
577
583
  goToPreviousStep: o,
578
- goToStepById: u,
584
+ goToStepById: f,
579
585
  stepsHistoryStore: U
580
- }), Q = k(), it = k();
581
- return m({
586
+ }), Q = b(), it = b();
587
+ return S({
582
588
  source: c,
583
589
  target: Q
584
- }), m({
590
+ }), S({
585
591
  clock: Q,
586
592
  filter: (i) => i === null,
587
593
  target: z
588
- }), m({
594
+ }), S({
589
595
  clock: Q,
590
596
  filter: (i) => i !== null,
591
597
  target: it
@@ -596,11 +602,11 @@ const tt = kt("experience-instance"), Vt = dt(
596
602
  origin: X,
597
603
  condition: J,
598
604
  step: et,
599
- launchExperience: It,
605
+ launchExperience: Et,
600
606
  action: nt,
601
- __: k()
607
+ __: b()
602
608
  }
603
- }), m({
609
+ }), S({
604
610
  clock: [
605
611
  J.doneData,
606
612
  X.doneData,
@@ -610,41 +616,41 @@ const tt = kt("experience-instance"), Vt = dt(
610
616
  nt.doneData
611
617
  ],
612
618
  filter: Boolean,
613
- target: Et
614
- }), m({
619
+ target: It
620
+ }), S({
615
621
  clock: a,
616
622
  target: H
617
- }), m({
623
+ }), S({
618
624
  clock: a,
619
- source: S,
625
+ source: y,
620
626
  filter: Boolean,
621
627
  target: t.eventBus.prepend((i) => ({
622
628
  type: "step_submit",
623
629
  step: i,
624
630
  experience: $
625
631
  }))
626
- }), m({
632
+ }), S({
627
633
  clock: H.done,
628
- source: S,
634
+ source: y,
629
635
  filter: Boolean,
630
636
  target: t.eventBus.prepend((i) => ({
631
637
  type: "step_submit_success",
632
638
  step: i,
633
639
  experience: $
634
640
  }))
635
- }), m({
641
+ }), S({
636
642
  clock: H.fail,
637
- source: S,
643
+ source: y,
638
644
  filter: Boolean,
639
645
  target: t.eventBus.prepend((i) => ({
640
646
  type: "step_submit_error",
641
647
  step: i,
642
648
  experience: $
643
649
  }))
644
- }), m({
650
+ }), S({
645
651
  clock: o,
646
652
  target: xt
647
- }), m({ clock: u, target: Nt }), m({
653
+ }), S({ clock: f, target: Nt }), S({
648
654
  source: D([
649
655
  J.pending,
650
656
  X.pending,
@@ -653,48 +659,48 @@ const tt = kt("experience-instance"), Vt = dt(
653
659
  ]),
654
660
  fn: (i) => i.some(Boolean) ? "transitioning" : "ready",
655
661
  target: F
656
- }), m({
662
+ }), S({
657
663
  clock: et.doneData,
658
- source: S,
664
+ source: y,
659
665
  filter: Boolean,
660
666
  target: t.eventBus.prepend((i) => ({
661
667
  type: "step_enter",
662
668
  step: i,
663
669
  experience: $
664
670
  }))
665
- }), m({
666
- clock: y,
671
+ }), S({
672
+ clock: g,
667
673
  target: ot
668
- }), m({
674
+ }), S({
669
675
  source: ot.doneData,
670
676
  fn: Boolean,
671
677
  target: L
672
- }), m({
678
+ }), S({
673
679
  source: c,
674
680
  clock: s,
675
681
  filter: (i) => i ? Y(i) : !0,
676
682
  target: rt
677
- }), m({
683
+ }), S({
678
684
  source: L,
679
685
  filter: Boolean,
680
686
  target: s
681
- }), m({
687
+ }), S({
682
688
  source: L,
683
689
  filter: Boolean,
684
690
  target: t.eventBus.prepend(() => ({
685
691
  type: "experience_open",
686
692
  experience: $
687
693
  }))
688
- }), m({
694
+ }), S({
689
695
  source: L,
690
696
  filter: (i) => !i,
691
697
  target: t.eventBus.prepend(() => ({
692
698
  type: "experience_close",
693
699
  experience: $
694
700
  }))
695
- }), m({
701
+ }), S({
696
702
  clock: d,
697
- target: [y]
703
+ target: [g]
698
704
  }), d(), $;
699
705
  }
700
706
  );
@@ -702,52 +708,52 @@ function qt(t) {
702
708
  return pt(Vt, t);
703
709
  }
704
710
  const zt = dt(({ client: t }) => {
705
- const e = tt.store({}), r = k(), n = k(), s = k(), a = lt(e, {
706
- register(c, S) {
707
- const x = [
708
- ...c[S.experienceId] ?? []
711
+ const e = tt.store({}), r = b(), n = b(), s = b(), a = lt(e, {
712
+ register(c, y) {
713
+ const N = [
714
+ ...c[y.experienceId] ?? []
709
715
  ];
710
- return x.push(S), {
716
+ return N.push(y), {
711
717
  ...c,
712
- [S.experienceId]: x
718
+ [y.experienceId]: N
713
719
  };
714
720
  },
715
- unregister(c, S) {
716
- const x = S.experienceId, T = c[x]?.filter(
717
- (C) => C !== S
721
+ unregister(c, y) {
722
+ const N = y.experienceId, T = c[N]?.filter(
723
+ (C) => C !== y
718
724
  );
719
725
  return {
720
726
  ...c,
721
- [x]: T ?? []
727
+ [N]: T ?? []
722
728
  };
723
729
  }
724
- }), o = _(
730
+ }), o = B(
725
731
  ({
726
732
  experience: c,
727
- target: S,
728
- options: x
729
- }) => qt({ client: t, experience: c, target: S, options: x })
730
- ), u = _((c) => {
733
+ target: y,
734
+ options: N
735
+ }) => qt({ client: t, experience: c, target: y, options: N })
736
+ ), f = B((c) => {
731
737
  a.register(c);
732
- }), d = _(
738
+ }), d = B(
733
739
  (c) => {
734
740
  c.target && Dt(c.target, () => {
735
741
  s(c);
736
742
  });
737
743
  }
738
- ), y = _((c) => {
744
+ ), g = B((c) => {
739
745
  a.unregister(c);
740
- }), b = _((c) => {
741
- const S = c.componentStore.getState();
742
- if (!S) {
746
+ }), x = B((c) => {
747
+ const y = c.componentStore.getState();
748
+ if (!y) {
743
749
  I("warn", "No app component registered. Skipping init.");
744
750
  return;
745
751
  }
746
- const x = S.frameworkStore.getState();
747
- if (!x) {
752
+ const N = y.frameworkStore.getState();
753
+ if (!N) {
748
754
  I(
749
755
  "error",
750
- `No framework registered for component '${S.name}'. Skipping rendering.`
756
+ `No framework registered for component '${y.name}'. Skipping rendering.`
751
757
  );
752
758
  return;
753
759
  }
@@ -761,40 +767,40 @@ const zt = dt(({ client: t }) => {
761
767
  }
762
768
  const C = Lt(T);
763
769
  try {
764
- x.render(C, S.component, t, c);
770
+ N.render(C, y.component, t, c);
765
771
  } catch (q) {
766
772
  I("error", q);
767
773
  }
768
774
  });
769
- m({
775
+ S({
770
776
  clock: r,
771
777
  target: o
772
- }), m({
778
+ }), S({
773
779
  clock: s,
774
- target: y
775
- }), m({
780
+ target: g
781
+ }), S({
776
782
  clock: o.doneData,
777
783
  target: [
778
- u,
784
+ f,
779
785
  d,
780
786
  n
781
787
  ]
782
- }), m({
788
+ }), S({
783
789
  clock: o.doneData,
784
790
  target: t.eventBus.prepend((c) => ({
785
791
  type: "experience_initialize",
786
792
  experience: c
787
793
  }))
788
- }), m({
794
+ }), S({
789
795
  clock: n,
790
- target: b
796
+ target: x
791
797
  });
792
- function F(c, S, x) {
793
- r({ experience: c, target: S, options: x });
798
+ function F(c, y, N) {
799
+ r({ experience: c, target: y, options: N });
794
800
  }
795
801
  const M = e.map((c) => Object.values(c).flat());
796
802
  function U(c) {
797
- return e.map((S) => S[c] || [], { skipVoid: !1 });
803
+ return e.map((y) => y[c] || [], { skipVoid: !1 });
798
804
  }
799
805
  return {
800
806
  spawn: F,