@picked/client 0.0.1-dev.1767836126674 → 0.0.1-dev.1767845350659
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/plugins/responses-browser-storage/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/esm/index.js +582 -518
- package/dist/esm/plugins/responses-browser-storage/index.js +23 -22
- package/dist/esm/server/index.js +1 -1
- package/dist/{experience-instance-Du9HFg3P.js → experience-instance-BmL4VkmP.js} +88 -100
- package/dist/experience-instance-IpJwvfUH.cjs +1 -0
- package/dist/types/entities/action/action.d.ts +5 -3
- package/dist/types/entities/action/action.d.ts.map +1 -1
- package/dist/types/entities/feature/feature.d.ts +6 -3
- package/dist/types/entities/feature/feature.d.ts.map +1 -1
- package/dist/types/entities/predicate/predicate.d.ts +5 -8
- package/dist/types/entities/predicate/predicate.d.ts.map +1 -1
- package/dist/types/entities/response/response.d.ts +4 -1
- package/dist/types/entities/response/response.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/logic-engine.d.ts.map +1 -1
- package/dist/types/picked-attributes.d.ts +47 -0
- package/dist/types/picked-attributes.d.ts.map +1 -0
- package/dist/types/picked.d.ts +11 -7
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/utils/events.d.ts +1 -0
- package/dist/types/utils/events.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/experience-instance-Dn8Wxj2o.cjs +0 -1
|
@@ -1,41 +1,42 @@
|
|
|
1
|
-
import { createEffect as
|
|
2
|
-
import { c as
|
|
3
|
-
const p =
|
|
4
|
-
|
|
1
|
+
import { createEffect as u, attach as f, sample as c } from "effector";
|
|
2
|
+
import { c as g, l as S, s as b } from "../../../storage-BLmAhfhl.js";
|
|
3
|
+
const p = g("responses", "global"), d = (n, e) => {
|
|
4
|
+
const o = {};
|
|
5
|
+
return Object.entries(n).forEach(([t, a]) => {
|
|
6
|
+
var r;
|
|
7
|
+
const s = e.find((i) => i.id === t);
|
|
8
|
+
!((r = s == null ? void 0 : s.policies) != null && r.doNotStoreValue) && (o[t] = a);
|
|
9
|
+
}), o;
|
|
10
|
+
}, h = ({
|
|
11
|
+
storage: n = "local"
|
|
5
12
|
} = {}) => ({
|
|
6
13
|
name: "responses-browser-storage-plugin",
|
|
7
14
|
setup: (e) => {
|
|
8
|
-
const
|
|
9
|
-
const s =
|
|
15
|
+
const o = n === "local" ? S : b, t = u(async () => {
|
|
16
|
+
const s = o.get(p).json();
|
|
10
17
|
if (!s)
|
|
11
18
|
return null;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
});
|
|
15
|
-
}), f = m({
|
|
19
|
+
e.responses.register(s);
|
|
20
|
+
}), a = f({
|
|
16
21
|
source: {
|
|
17
22
|
responses: e.responses.getAllStore,
|
|
18
23
|
fields: e.fields.listStore
|
|
19
24
|
},
|
|
20
|
-
effect: ({ responses: s, fields:
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
var c;
|
|
24
|
-
const t = r.find((S) => S.id === a);
|
|
25
|
-
!((c = t == null ? void 0 : t.policies) != null && c.doNotStoreValue) && (o[a] = g);
|
|
26
|
-
}), n.set(p, o);
|
|
25
|
+
effect: ({ responses: s, fields: l }) => {
|
|
26
|
+
const r = d(s, l);
|
|
27
|
+
o.set(p, r);
|
|
27
28
|
}
|
|
28
29
|
});
|
|
29
|
-
|
|
30
|
+
c({
|
|
30
31
|
source: e.eventBus,
|
|
31
32
|
filter: (s) => s.type === "load",
|
|
32
|
-
target:
|
|
33
|
-
}),
|
|
33
|
+
target: t
|
|
34
|
+
}), c({
|
|
34
35
|
source: e.responses.getAllStore,
|
|
35
|
-
target:
|
|
36
|
+
target: a
|
|
36
37
|
});
|
|
37
38
|
}
|
|
38
39
|
});
|
|
39
40
|
export {
|
|
40
|
-
|
|
41
|
+
h as responsesBrowserStoragePlugin
|
|
41
42
|
};
|
package/dist/esm/server/index.js
CHANGED
|
@@ -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-
|
|
2
|
+
import { h as F } from "../../experience-instance-BmL4VkmP.js";
|
|
3
3
|
function R() {
|
|
4
4
|
let c, p;
|
|
5
5
|
return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createDomain as ht, createEvent as O, combine as C, createApi as ot, createEffect as M, attach as
|
|
1
|
+
import { createDomain as ht, createEvent as O, combine as C, createApi as ot, createEffect as M, attach as _, split as yt, sample as m } from "effector";
|
|
2
2
|
import { createFactory as it, invoke as st } from "@withease/factories";
|
|
3
3
|
import { i as wt, s as at, a as Nt } from "./supports-BjhuLJ8z.js";
|
|
4
4
|
import { l as I } from "./logger-C9a75KZn.js";
|
|
@@ -112,21 +112,9 @@ const Et = {
|
|
|
112
112
|
const n = r.filter(H);
|
|
113
113
|
return e.filter(H).length - n.length >= g(t) ? [] : n;
|
|
114
114
|
},
|
|
115
|
-
/**
|
|
116
|
-
* Invoke operator - executes a function with optional arguments
|
|
117
|
-
*
|
|
118
|
-
* Object format (no arguments):
|
|
119
|
-
* { "invoke": { "var": "functionName" } }
|
|
120
|
-
*
|
|
121
|
-
* Array format (with arguments):
|
|
122
|
-
* { "invoke": [{ "var": "functionName" }, arg1, arg2, ...] }
|
|
123
|
-
*
|
|
124
|
-
* Arguments are evaluated as JSONLogic expressions before being passed to the function.
|
|
125
|
-
*/
|
|
126
115
|
// eslint-disable-next-line sonarjs/function-return-type
|
|
127
|
-
invoke(
|
|
128
|
-
|
|
129
|
-
return typeof e != "function" ? null : Reflect.apply(e, null, r);
|
|
116
|
+
invoke(t) {
|
|
117
|
+
return typeof t != "function" ? null : t();
|
|
130
118
|
},
|
|
131
119
|
regexp_matches(t, e) {
|
|
132
120
|
let r = t, n = "";
|
|
@@ -177,8 +165,8 @@ async function p(t, e) {
|
|
|
177
165
|
const o = await p(n[0], e);
|
|
178
166
|
return N(o) ? (await Promise.all(
|
|
179
167
|
o.map(async (d) => {
|
|
180
|
-
const
|
|
181
|
-
return { item: d, shouldInclude:
|
|
168
|
+
const y = await B(await p(n[1], d));
|
|
169
|
+
return { item: d, shouldInclude: y };
|
|
182
170
|
})
|
|
183
171
|
)).filter(({ shouldInclude: d }) => d).map(({ item: d }) => d) : [];
|
|
184
172
|
}
|
|
@@ -187,10 +175,10 @@ async function p(t, e) {
|
|
|
187
175
|
if (!N(o))
|
|
188
176
|
return n.length > 2 ? await p(n[2], e) : null;
|
|
189
177
|
const c = n[1];
|
|
190
|
-
let
|
|
178
|
+
let y = n.length > 2 ? await p(n[2], e) : null;
|
|
191
179
|
for (const k of o)
|
|
192
|
-
|
|
193
|
-
return
|
|
180
|
+
y = await p(c, { current: k, accumulator: y });
|
|
181
|
+
return y;
|
|
194
182
|
}
|
|
195
183
|
case "all": {
|
|
196
184
|
const o = await p(n[0], e);
|
|
@@ -236,12 +224,12 @@ function At(t) {
|
|
|
236
224
|
async function et(t, e, r) {
|
|
237
225
|
const n = t.getStateSnapshot(), s = t.predicates.listStore.getState().reduce((c, d) => ({
|
|
238
226
|
...c,
|
|
239
|
-
[d.name]: (
|
|
227
|
+
[d.name]: () => d.predicate(n)
|
|
240
228
|
}), {}), a = t.features.listStore.getState().reduce((c, d) => ({
|
|
241
229
|
...c,
|
|
242
230
|
[d.id]: async () => {
|
|
243
|
-
const { bucket:
|
|
244
|
-
return
|
|
231
|
+
const { bucket: y } = await d.getBucket();
|
|
232
|
+
return y;
|
|
245
233
|
}
|
|
246
234
|
}), {}), o = {
|
|
247
235
|
...r,
|
|
@@ -288,18 +276,18 @@ function Bt(t, e) {
|
|
|
288
276
|
});
|
|
289
277
|
r.observe(document.body, { childList: !0, subtree: !0 });
|
|
290
278
|
}
|
|
291
|
-
const G = "picked-root", K = "picked-target",
|
|
279
|
+
const G = "picked-root", K = "picked-target", _t = "picked-root";
|
|
292
280
|
function Jt(t, e) {
|
|
293
281
|
return [
|
|
294
282
|
...t,
|
|
295
283
|
// Target and replace picked-root web components
|
|
296
284
|
{
|
|
297
|
-
selector: `${
|
|
285
|
+
selector: `${_t}[experience-id="${e}"]`,
|
|
298
286
|
placement: "replace"
|
|
299
287
|
}
|
|
300
288
|
].flatMap((n) => {
|
|
301
289
|
const s = bt(n.selector).filter(
|
|
302
|
-
(a) =>
|
|
290
|
+
(a) => !$t(a, e) && !Ft(a, e)
|
|
303
291
|
);
|
|
304
292
|
return {
|
|
305
293
|
...n,
|
|
@@ -313,10 +301,10 @@ function Qt(t, e) {
|
|
|
313
301
|
function Yt(t, e) {
|
|
314
302
|
t.classList.add(K), t.classList.add(`${K}-${e}`);
|
|
315
303
|
}
|
|
316
|
-
function
|
|
304
|
+
function $t(t, e) {
|
|
317
305
|
return e ? t.classList.contains(`${K}-${e}`) : t.classList.contains(`${K}`);
|
|
318
306
|
}
|
|
319
|
-
function
|
|
307
|
+
function Ft(t, e) {
|
|
320
308
|
return e ? t.classList.contains(`${G}-${e}`) : t.classList.contains(G);
|
|
321
309
|
}
|
|
322
310
|
function Mt(t) {
|
|
@@ -368,41 +356,41 @@ function rt(t) {
|
|
|
368
356
|
const ut = (t, e, r, n, s = /* @__PURE__ */ new Set()) => s.has(r.id) ? [] : (s.add(r.id), j(r) && !n ? [r] : e.filter((o) => o.sourceNodeId === r.id).flatMap((o) => {
|
|
369
357
|
const c = t.find((d) => d.id === o.destinationNodeId);
|
|
370
358
|
return c ? ut(t, e, c, !1, s) : [];
|
|
371
|
-
})),
|
|
359
|
+
})), Pt = (t, e, r) => ut(t, e, r, !0, /* @__PURE__ */ new Set()), ft = (t, e, r, n, s = /* @__PURE__ */ new Set()) => {
|
|
372
360
|
if (s.has(r.id)) return [-1, -1];
|
|
373
361
|
s.add(r.id);
|
|
374
362
|
const a = e.filter((d) => d.sourceNodeId === r.id);
|
|
375
363
|
if (a.length === 0) return [0, 0];
|
|
376
364
|
let o = 1 / 0, c = -1 / 0;
|
|
377
365
|
for (const d of a) {
|
|
378
|
-
const
|
|
379
|
-
if (!
|
|
380
|
-
const [k,
|
|
366
|
+
const y = t.find((P) => P.id === d.destinationNodeId);
|
|
367
|
+
if (!y) continue;
|
|
368
|
+
const [k, $] = ft(
|
|
381
369
|
t,
|
|
382
370
|
e,
|
|
383
|
-
|
|
371
|
+
y,
|
|
384
372
|
!1,
|
|
385
373
|
new Set(s)
|
|
386
374
|
);
|
|
387
|
-
k !== -1 && (o = Math.min(o, k + 1), c = Math.max(c,
|
|
375
|
+
k !== -1 && (o = Math.min(o, k + 1), c = Math.max(c, $ + 1));
|
|
388
376
|
}
|
|
389
377
|
return o === 1 / 0 ? [-1, -1] : [o, c];
|
|
390
|
-
},
|
|
378
|
+
}, Rt = (t, e, r) => ft(t, e, r, !0, /* @__PURE__ */ new Set()), lt = (t, e, r, n = /* @__PURE__ */ new Set()) => {
|
|
391
379
|
if (n.has(r.id)) return [-1, -1];
|
|
392
380
|
if (n.add(r.id), r.type === "origin") return [0, 0];
|
|
393
381
|
const s = e.filter((c) => c.destinationNodeId === r.id);
|
|
394
382
|
if (s.length === 0) return [-1, -1];
|
|
395
383
|
let a = 1 / 0, o = -1 / 0;
|
|
396
384
|
for (const c of s) {
|
|
397
|
-
const d = t.find((
|
|
385
|
+
const d = t.find(($) => $.id === c.sourceNodeId);
|
|
398
386
|
if (!d) continue;
|
|
399
|
-
const [
|
|
387
|
+
const [y, k] = lt(
|
|
400
388
|
t,
|
|
401
389
|
e,
|
|
402
390
|
d,
|
|
403
391
|
new Set(n)
|
|
404
392
|
);
|
|
405
|
-
|
|
393
|
+
y !== -1 && (a = Math.min(a, y + 1), o = Math.max(o, k + 1));
|
|
406
394
|
}
|
|
407
395
|
return a === 1 / 0 ? [-1, -1] : [a, o];
|
|
408
396
|
}, Ct = (t, e, r) => lt(t, e, r, /* @__PURE__ */ new Set()), dt = (t) => t.find((r) => r.type === "origin") || null, X = (t, e, r) => {
|
|
@@ -426,17 +414,17 @@ const z = ht("experience-instance"), jt = it(
|
|
|
426
414
|
experience: e,
|
|
427
415
|
target: r
|
|
428
416
|
}) => {
|
|
429
|
-
const n = O(), s = O(), a = O(), o = O(), c = O(), d = O(),
|
|
417
|
+
const n = O(), s = O(), a = O(), o = O(), c = O(), d = O(), y = e.componentStore, k = z.store("transitioning"), $ = t.history.entriesStore.map((i) => i.filter((f) => f.experienceId === e.id)), P = $.map((i) => i.filter((f) => j(f.node))), x = $.map((i) => {
|
|
430
418
|
var f;
|
|
431
419
|
return ((f = i[i.length - 1]) == null ? void 0 : f.node) || null;
|
|
432
420
|
}), u = C(
|
|
433
421
|
e.treeStore,
|
|
434
422
|
x,
|
|
435
423
|
({ steps: i }, f) => i.find((l) => f && j(f) && l.id === f.stepId) || null
|
|
436
|
-
),
|
|
424
|
+
), S = C(
|
|
437
425
|
e.treeStore,
|
|
438
426
|
x,
|
|
439
|
-
({ nodes: i, edges: f }, l) => l ?
|
|
427
|
+
({ nodes: i, edges: f }, l) => l ? Pt(i, f, l) : []
|
|
440
428
|
), v = C(
|
|
441
429
|
e.treeStore,
|
|
442
430
|
x,
|
|
@@ -444,31 +432,31 @@ const z = ht("experience-instance"), jt = it(
|
|
|
444
432
|
), T = C(
|
|
445
433
|
e.treeStore,
|
|
446
434
|
x,
|
|
447
|
-
({ nodes: i, edges: f }, l) => l ?
|
|
448
|
-
), A = z.store(!1),
|
|
435
|
+
({ nodes: i, edges: f }, l) => l ? Rt(i, f, l) : [-1, -1]
|
|
436
|
+
), A = z.store(!1), F = ot(A, {
|
|
449
437
|
open: () => !0,
|
|
450
438
|
close: () => !1,
|
|
451
439
|
toggle: (i) => !i,
|
|
452
440
|
set: (i, f) => f
|
|
453
441
|
}), pt = M(async () => {
|
|
454
442
|
t.history.back({ experienceId: e.id });
|
|
455
|
-
}), gt =
|
|
443
|
+
}), gt = _({
|
|
456
444
|
source: e.treeStore,
|
|
457
445
|
effect: async (i, f) => {
|
|
458
446
|
const l = i.nodes.find((w) => j(w) && w.stepId === f);
|
|
459
447
|
l && t.history.push({ experienceId: e.id, node: l });
|
|
460
448
|
}
|
|
461
|
-
}), J =
|
|
449
|
+
}), J = _({
|
|
462
450
|
source: x,
|
|
463
451
|
effect: (i) => {
|
|
464
452
|
}
|
|
465
|
-
}), U =
|
|
453
|
+
}), U = _({
|
|
466
454
|
source: e.treeStore,
|
|
467
455
|
effect: async ({ nodes: i }) => dt(i)
|
|
468
|
-
}), V =
|
|
456
|
+
}), V = _({
|
|
469
457
|
source: e.treeStore,
|
|
470
458
|
effect: async ({ nodes: i, edges: f }, l) => X(l, i, f)
|
|
471
|
-
}), q =
|
|
459
|
+
}), q = _({
|
|
472
460
|
source: e.treeStore,
|
|
473
461
|
effect: async ({ nodes: i, edges: f, conditionals: l }, w) => {
|
|
474
462
|
if (!w)
|
|
@@ -476,10 +464,10 @@ const z = ht("experience-instance"), jt = it(
|
|
|
476
464
|
const L = l.find((b) => b.id === w.conditionalId);
|
|
477
465
|
if (!L)
|
|
478
466
|
return;
|
|
479
|
-
const E = w.id,
|
|
480
|
-
return Ht(!!
|
|
467
|
+
const E = w.id, h = await et(t, L.condition);
|
|
468
|
+
return Ht(!!h, E, i, f);
|
|
481
469
|
}
|
|
482
|
-
}), Q =
|
|
470
|
+
}), Q = _({
|
|
483
471
|
source: e.treeStore,
|
|
484
472
|
effect: async ({ nodes: i, edges: f }, l) => {
|
|
485
473
|
if (!l || !rt(l))
|
|
@@ -493,49 +481,49 @@ const z = ht("experience-instance"), jt = it(
|
|
|
493
481
|
if (!L) {
|
|
494
482
|
I("warn", `Action '${w}' not registered on client`);
|
|
495
483
|
const E = f.find(
|
|
496
|
-
(
|
|
484
|
+
(h) => h.sourceNodeId === l.id && h.sourceNodeHandle === "false"
|
|
497
485
|
);
|
|
498
|
-
return E ? i.find((
|
|
486
|
+
return E ? i.find((h) => h.id === E.destinationNodeId) : null;
|
|
499
487
|
}
|
|
500
488
|
if (typeof L.action != "function") {
|
|
501
489
|
I("warn", `Action '${w}' is not a function`);
|
|
502
490
|
const E = f.find(
|
|
503
|
-
(
|
|
491
|
+
(h) => h.sourceNodeId === l.id && h.sourceNodeHandle === "false"
|
|
504
492
|
);
|
|
505
|
-
return E ? i.find((
|
|
493
|
+
return E ? i.find((h) => h.id === E.destinationNodeId) : null;
|
|
506
494
|
}
|
|
507
495
|
try {
|
|
508
|
-
I("info", `Executing action: ${w}`), await L.action();
|
|
496
|
+
I("info", `Executing action: ${w}`), await L.action(w);
|
|
509
497
|
const E = f.find(
|
|
510
498
|
(b) => b.sourceNodeId === l.id && b.sourceNodeHandle === "true"
|
|
511
499
|
);
|
|
512
500
|
if (!E)
|
|
513
501
|
return I("warn", `No 'true' edge found for action node ${l.id}`), null;
|
|
514
|
-
const
|
|
515
|
-
return I("info", `Action '${w}' succeeded, moving to node ${
|
|
502
|
+
const h = i.find((b) => b.id === E.destinationNodeId);
|
|
503
|
+
return I("info", `Action '${w}' succeeded, moving to node ${h == null ? void 0 : h.id}`), h || null;
|
|
516
504
|
} catch (E) {
|
|
517
505
|
I("warn", `Action '${w}' failed:`, E);
|
|
518
|
-
const
|
|
506
|
+
const h = f.find(
|
|
519
507
|
(W) => W.sourceNodeId === l.id && W.sourceNodeHandle === "false"
|
|
520
508
|
);
|
|
521
|
-
if (!
|
|
509
|
+
if (!h)
|
|
522
510
|
return I("warn", `No 'false' edge found for action node ${l.id}`), null;
|
|
523
|
-
const b = i.find((W) => W.id ===
|
|
511
|
+
const b = i.find((W) => W.id === h.destinationNodeId);
|
|
524
512
|
return I("info", `Action '${w}' failed, moving to node ${b == null ? void 0 : b.id}`), b || null;
|
|
525
513
|
}
|
|
526
514
|
}
|
|
527
515
|
}), mt = M((i) => {
|
|
528
516
|
if (i)
|
|
529
517
|
return t.launchExperienceById(i.experienceId);
|
|
530
|
-
}), Y =
|
|
518
|
+
}), Y = _({
|
|
531
519
|
source: [x, e.treeStore],
|
|
532
520
|
effect: async ([i, { nodes: f, edges: l }]) => X(i, f, l)
|
|
533
|
-
}),
|
|
521
|
+
}), R = _({
|
|
534
522
|
source: [x, e.treeStore],
|
|
535
523
|
effect: async ([i, { nodes: f, edges: l }]) => X(i, f, l)
|
|
536
524
|
}), St = M((i) => {
|
|
537
525
|
t.history.push({ experienceId: e.id, node: i });
|
|
538
|
-
}), Z =
|
|
526
|
+
}), Z = _({
|
|
539
527
|
source: e.configStore,
|
|
540
528
|
effect: async ({ initializeOpenLogic: i }) => At(i) ? !!await et(t, i) : i ?? !1
|
|
541
529
|
});
|
|
@@ -556,7 +544,7 @@ const z = ht("experience-instance"), jt = it(
|
|
|
556
544
|
q.doneData,
|
|
557
545
|
V.doneData,
|
|
558
546
|
U.doneData,
|
|
559
|
-
|
|
547
|
+
R.doneData,
|
|
560
548
|
Y.doneData,
|
|
561
549
|
Q.doneData
|
|
562
550
|
],
|
|
@@ -564,7 +552,7 @@ const z = ht("experience-instance"), jt = it(
|
|
|
564
552
|
target: St
|
|
565
553
|
}), m({
|
|
566
554
|
clock: s,
|
|
567
|
-
target:
|
|
555
|
+
target: R
|
|
568
556
|
}), m({
|
|
569
557
|
clock: s,
|
|
570
558
|
source: u,
|
|
@@ -575,7 +563,7 @@ const z = ht("experience-instance"), jt = it(
|
|
|
575
563
|
experience: e
|
|
576
564
|
}))
|
|
577
565
|
}), m({
|
|
578
|
-
clock:
|
|
566
|
+
clock: R.done,
|
|
579
567
|
source: u,
|
|
580
568
|
filter: Boolean,
|
|
581
569
|
target: t.eventBus.prepend((i) => ({
|
|
@@ -584,7 +572,7 @@ const z = ht("experience-instance"), jt = it(
|
|
|
584
572
|
experience: e
|
|
585
573
|
}))
|
|
586
574
|
}), m({
|
|
587
|
-
clock:
|
|
575
|
+
clock: R.fail,
|
|
588
576
|
source: u,
|
|
589
577
|
filter: Boolean,
|
|
590
578
|
target: t.eventBus.prepend((i) => ({
|
|
@@ -600,7 +588,7 @@ const z = ht("experience-instance"), jt = it(
|
|
|
600
588
|
q.pending,
|
|
601
589
|
V.pending,
|
|
602
590
|
U.pending,
|
|
603
|
-
|
|
591
|
+
R.pending
|
|
604
592
|
]),
|
|
605
593
|
fn: (i) => i.some(Boolean) ? "transitioning" : "ready",
|
|
606
594
|
target: k
|
|
@@ -652,27 +640,27 @@ const z = ht("experience-instance"), jt = it(
|
|
|
652
640
|
experienceId: e.id,
|
|
653
641
|
configStore: e.configStore,
|
|
654
642
|
target: r,
|
|
655
|
-
componentStore:
|
|
643
|
+
componentStore: y,
|
|
656
644
|
// state
|
|
657
645
|
stateStore: k,
|
|
658
646
|
// open close
|
|
659
647
|
isOpenStore: A,
|
|
660
|
-
open:
|
|
661
|
-
close:
|
|
662
|
-
toggleOpen:
|
|
663
|
-
setOpen:
|
|
648
|
+
open: F.open,
|
|
649
|
+
close: F.close,
|
|
650
|
+
toggleOpen: F.toggle,
|
|
651
|
+
setOpen: F.set,
|
|
664
652
|
// nodes
|
|
665
653
|
treeStore: e.treeStore,
|
|
666
654
|
currentNodeStore: x,
|
|
667
655
|
currentStepStore: u,
|
|
668
|
-
nextReachableStepNodesStore:
|
|
656
|
+
nextReachableStepNodesStore: S,
|
|
669
657
|
stepsToOriginStore: v,
|
|
670
658
|
stepsToLeafStore: T,
|
|
671
659
|
// history
|
|
672
660
|
goToNextStep: s,
|
|
673
661
|
goToPreviousStep: a,
|
|
674
662
|
goToStepById: o,
|
|
675
|
-
stepsHistoryStore:
|
|
663
|
+
stepsHistoryStore: P
|
|
676
664
|
};
|
|
677
665
|
}
|
|
678
666
|
);
|
|
@@ -681,19 +669,19 @@ function Wt(t) {
|
|
|
681
669
|
}
|
|
682
670
|
const Gt = it(({ client: t }) => {
|
|
683
671
|
const e = z.store({}), r = O(), n = O(), s = O(), a = ot(e, {
|
|
684
|
-
register(u,
|
|
672
|
+
register(u, S) {
|
|
685
673
|
const v = [
|
|
686
|
-
...u[
|
|
674
|
+
...u[S.experienceId] ?? []
|
|
687
675
|
];
|
|
688
|
-
return v.push(
|
|
676
|
+
return v.push(S), {
|
|
689
677
|
...u,
|
|
690
|
-
[
|
|
678
|
+
[S.experienceId]: v
|
|
691
679
|
};
|
|
692
680
|
},
|
|
693
|
-
unregister(u,
|
|
681
|
+
unregister(u, S) {
|
|
694
682
|
var A;
|
|
695
|
-
const v =
|
|
696
|
-
(
|
|
683
|
+
const v = S.experienceId, T = (A = u[v]) == null ? void 0 : A.filter(
|
|
684
|
+
(F) => F !== S
|
|
697
685
|
);
|
|
698
686
|
return {
|
|
699
687
|
...u,
|
|
@@ -701,7 +689,7 @@ const Gt = it(({ client: t }) => {
|
|
|
701
689
|
};
|
|
702
690
|
}
|
|
703
691
|
}), o = M(
|
|
704
|
-
({ experience: u, target:
|
|
692
|
+
({ experience: u, target: S }) => Wt({ client: t, experience: u, target: S })
|
|
705
693
|
), c = M((u) => {
|
|
706
694
|
a.register(u);
|
|
707
695
|
}), d = M(
|
|
@@ -710,19 +698,19 @@ const Gt = it(({ client: t }) => {
|
|
|
710
698
|
s(u);
|
|
711
699
|
});
|
|
712
700
|
}
|
|
713
|
-
),
|
|
701
|
+
), y = M((u) => {
|
|
714
702
|
a.unregister(u);
|
|
715
703
|
}), k = M((u) => {
|
|
716
|
-
const
|
|
717
|
-
if (!
|
|
704
|
+
const S = u.componentStore.getState();
|
|
705
|
+
if (!S) {
|
|
718
706
|
I("warn", "No app component registered. Skipping init.");
|
|
719
707
|
return;
|
|
720
708
|
}
|
|
721
|
-
const v =
|
|
709
|
+
const v = S.frameworkStore.getState();
|
|
722
710
|
if (!v) {
|
|
723
711
|
I(
|
|
724
712
|
"error",
|
|
725
|
-
`No framework registered for component '${
|
|
713
|
+
`No framework registered for component '${S.name}'. Skipping rendering.`
|
|
726
714
|
);
|
|
727
715
|
return;
|
|
728
716
|
}
|
|
@@ -736,9 +724,9 @@ const Gt = it(({ client: t }) => {
|
|
|
736
724
|
}
|
|
737
725
|
const A = Ot(T);
|
|
738
726
|
try {
|
|
739
|
-
v.render(A,
|
|
740
|
-
} catch (
|
|
741
|
-
I("error",
|
|
727
|
+
v.render(A, S.component, t, u);
|
|
728
|
+
} catch (F) {
|
|
729
|
+
I("error", F);
|
|
742
730
|
}
|
|
743
731
|
});
|
|
744
732
|
m({
|
|
@@ -746,7 +734,7 @@ const Gt = it(({ client: t }) => {
|
|
|
746
734
|
target: o
|
|
747
735
|
}), m({
|
|
748
736
|
clock: s,
|
|
749
|
-
target:
|
|
737
|
+
target: y
|
|
750
738
|
}), m({
|
|
751
739
|
clock: o.doneData,
|
|
752
740
|
target: [
|
|
@@ -764,17 +752,17 @@ const Gt = it(({ client: t }) => {
|
|
|
764
752
|
clock: n,
|
|
765
753
|
target: k
|
|
766
754
|
});
|
|
767
|
-
function
|
|
768
|
-
r({ experience: u, target:
|
|
755
|
+
function $(u, S) {
|
|
756
|
+
r({ experience: u, target: S });
|
|
769
757
|
}
|
|
770
|
-
const
|
|
758
|
+
const P = e.map((u) => Object.values(u).flat());
|
|
771
759
|
function x(u) {
|
|
772
|
-
return e.map((
|
|
760
|
+
return e.map((S) => S[u] || [], { skipVoid: !1 });
|
|
773
761
|
}
|
|
774
762
|
return {
|
|
775
|
-
spawn:
|
|
763
|
+
spawn: $,
|
|
776
764
|
getByExperienceId: x,
|
|
777
|
-
listStore:
|
|
765
|
+
listStore: P
|
|
778
766
|
};
|
|
779
767
|
});
|
|
780
768
|
function Zt(t) {
|
|
@@ -786,7 +774,7 @@ export {
|
|
|
786
774
|
Qt as c,
|
|
787
775
|
zt as d,
|
|
788
776
|
et as e,
|
|
789
|
-
|
|
777
|
+
Ft as f,
|
|
790
778
|
Jt as g,
|
|
791
779
|
Wt as h,
|
|
792
780
|
At as i,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const i=require("effector"),q=require("@withease/factories"),H=require("./supports-YvpQZxbh.cjs"),N=require("./logger-BsmHUUw1.cjs"),ge=require("./object-BbFTsGh3.cjs");function me(e){return typeof e=="number"&&!isNaN(e)}function R(e){return typeof e=="string"}function E(e){return Array.isArray(e)}function ne(e){return e instanceof Promise}function Z(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&Object.keys(e).length===1}function m(e){if(me(e))return e;const t=parseFloat(`${e}`);return isNaN(t)?0:t}function T(e){return`${e}`}const he={"==":(e,t)=>e==t,"===":(e,t)=>e===t,"!=":(e,t)=>e!=t,"!==":(e,t)=>e!==t,">":(e,t)=>m(e)>m(t),">=":(e,t)=>m(e)>=m(t),"<":(e,t,r)=>{const n=m(e),a=m(t);if(r===void 0)return n<a;const c=m(r);return n<a&&a<c},"<=":(e,t,r)=>{const n=m(e),a=m(t);if(r===void 0)return n<=a;const c=m(r);return n<=a&&a<=c},"!!":async e=>await O(e),"!":async e=>!await O(e),"%":(e,t)=>m(e)%m(t),log:e=>(console.log(e),e),in:(e,t)=>t?R(t)?t.indexOf(T(e))!==-1:E(t)?t.includes(e):!1:!1,cat:(...e)=>e.map(T).join(""),substr:(e,t,r)=>{const n=T(e),a=m(t);if(r===void 0)return n.substr(a);const c=m(r);if(c<0){const o=n.substr(a);return o.substr(0,o.length+c)}return n.substr(a,c)},"+":(...e)=>e.reduce((t,r)=>m(t)+m(r),0),"*":(...e)=>e.reduce((t,r)=>m(t)*m(r),1),"-":(e,t)=>{const r=m(e);return t===void 0?-r:r-m(t)},"/":(e,t)=>m(e)/m(t),min:(...e)=>Math.min(...e.map(m)),max:(...e)=>Math.max(...e.map(m)),merge:(...e)=>e.reduce((t,r)=>E(r)?t.concat(r):t.concat([r]),[]),var(e,t){const r=arguments.length>1?t:null;if(e===""||e==="."||e===null||e===void 0)return this;if(typeof e=="number"&&Array.isArray(this))return e>=0&&e<this.length?this[e]:r;const n=T(e);if(n===""||n===".")return this;const a=n.split(".");let c=this;for(const o of a){if(c==null)return r;if(Array.isArray(c)){const u=parseInt(o,10);isNaN(u)?c=c[o]:c=c[u]}else c=c[o]}return c!==void 0?c:r},async missing(...e){const t=E(e[0])?e[0]:e,r=[];for(const n of t){const a=await g({var:n},this);(a===null||a==="")&&r.push(`${n}`)}return r},async missing_some(e,t){const r=await g({missing:t},this);if(!E(r)||!E(t))return[];const n=r.filter(R);return t.filter(R).length-n.length>=m(e)?[]:n},invoke(e){return typeof e!="function"?null:e()},regexp_matches(e,t){let r=e,n="";if(E(e)){const[c,o]=e;r=c,n=o}return!R(r)||!R(n)?!1:new RegExp(r,n).test(T(t))},throw(e){throw new Error(T(e))}};async function g(e,t){if(!e)return e;if(ne(e))return g(await e,t);if(E(e))return Promise.all(e.map(o=>g(o,t)));if(!Z(e))return e;const r=Se(e);let n=r?e[r]??[]:[];switch(E(n)||(n=[n]),r){case"if":case"?:":for(let o=0;o<n.length-1;o+=2)if(await O(await g(n[o],t)))return g(n[o+1],t);return n.length%2===1?g(n[n.length-1],t):null;case"and":{let o=null;for(const u of n)if(o=await g(u,t),!await O(o))return o;return o}case"or":{let o=null;for(const u of n)if(o=await g(u,t),await O(o))return o;return o}case"map":{const o=await g(n[0],t);return E(o)?await Promise.all(o.map(u=>g(n[1],u))):[]}case"filter":{const o=await g(n[0],t);return E(o)?(await Promise.all(o.map(async p=>{const y=await O(await g(n[1],p));return{item:p,shouldInclude:y}}))).filter(({shouldInclude:p})=>p).map(({item:p})=>p):[]}case"reduce":{const o=await g(n[0],t);if(!E(o))return n.length>2?await g(n[2],t):null;const u=n[1];let y=n.length>2?await g(n[2],t):null;for(const k of o)y=await g(u,{current:k,accumulator:y});return y}case"all":{const o=await g(n[0],t);if(!E(o)||o.length===0)return!1;for(const u of o)if(!await O(await g(n[1],u)))return!1;return!0}case"some":{const o=await g(n[0],t);if(!E(o))return!1;for(const u of o)if(await O(await g(n[1],u)))return!0;return!1}case"none":{const o=await g(n[0],t);if(!E(o))return!0;for(const u of o)if(await O(await g(n[1],u)))return!1;return!0}case"catch":try{return await g(n[0],t)}catch(o){return Z(o)?await g(o,t):n[1]?await g(n[1],o):o instanceof Error?o.message:o}}const a=await Promise.all(n.map(o=>g(o,t))),c=r?he[r]:void 0;if(!c)throw new Error(`Unrecognized operation ${r}`);return c.apply(t,a)}async function O(e){return ne(e)?O(await e):!(Array.isArray(e)&&e.length===0)&&!!e}function Se(e){return Object.keys(e)[0]}function re(e){return!ge.isEmpty(e)}async function V(e,t,r){const n=e.getStateSnapshot(),a=e.predicates.listStore.getState().reduce((u,p)=>({...u,[p.name]:()=>p.predicate(n)}),{}),c=e.features.listStore.getState().reduce((u,p)=>({...u,[p.id]:async()=>{const{bucket:y}=await p.getBucket();return y}}),{}),o={...r,responses:e.responses.getAllStore.getState(),location:typeof n.location=="object"?{hash:n.location.hash,host:n.location.host,hostname:n.location.hostname,href:n.location.href,origin:n.location.origin,pathname:n.location.pathname,port:n.location.port,protocol:n.location.protocol,search:n.location.search}:void 0,predicates:a,features:c};return await g(t,o)}function ye(e){return!H.supportsWindow()||!H.supportsDocument()?[]:Array.from(window.document.querySelectorAll(e)).filter(t=>t instanceof HTMLElement)}const we="open";function Ee(e){if(!H.supportsShadowRoot())throw new Error("Shadow DOM is not supported in this environment");return e.attachShadow({mode:we})}function Ne(){return new Promise((e,t)=>{if(!H.supportsDocument()){t();return}document.readyState!=="loading"?e():document.addEventListener("readystatechange",()=>e(),{once:!0})})}function Ie(e,t){const r=new MutationObserver(n=>{document.contains(e)||(r.disconnect(),t())});r.observe(document.body,{childList:!0,subtree:!0})}const C="picked-root",j="picked-target",xe="picked-root";function ke(e,t){return[...e,{selector:`${xe}[experience-id="${t}"]`,placement:"replace"}].flatMap(n=>{const a=ye(n.selector).filter(c=>!Ae(c,t)&&!oe(c,t));return{...n,elements:a}})}function ve(e,t){return e.flatMap(r=>r.elements.map(n=>Be(n,r.placement,t)))}function be(e,t){e.classList.add(j),e.classList.add(`${j}-${t}`)}function Ae(e,t){return t?e.classList.contains(`${j}-${t}`):e.classList.contains(`${j}`)}function oe(e,t){return t?e.classList.contains(`${C}-${t}`):e.classList.contains(C)}function Oe(e){const t=document.createElement("div");return t.style.display="block",t.classList.add(C),t.classList.add(`${C}-${e}`),t}function Be(e,t,r){let n;const a=Oe(r);if(e instanceof Document)n=e.body.appendChild(a);else{switch(t){case"replace":e.replaceWith(a);break;case"before":e.before(a);break;case"after":e.after(a);break;case"prepend":e.prepend(a);break;default:e.append(a);break}n=a}return n}function Fe(e){return e.type==="conditional"}function M(e){return e.type==="step"}function _e(e){return e.type==="experience"}function ee(e){return e.type==="origin"}function te(e){return e.type==="action"}const se=(e,t,r,n,a=new Set)=>a.has(r.id)?[]:(a.add(r.id),M(r)&&!n?[r]:t.filter(o=>o.sourceNodeId===r.id).flatMap(o=>{const u=e.find(p=>p.id===o.destinationNodeId);return u?se(e,t,u,!1,a):[]})),$e=(e,t,r)=>se(e,t,r,!0,new Set),ie=(e,t,r,n,a=new Set)=>{if(a.has(r.id))return[-1,-1];a.add(r.id);const c=t.filter(p=>p.sourceNodeId===r.id);if(c.length===0)return[0,0];let o=1/0,u=-1/0;for(const p of c){const y=e.find(L=>L.id===p.destinationNodeId);if(!y)continue;const[k,B]=ie(e,t,y,!1,new Set(a));k!==-1&&(o=Math.min(o,k+1),u=Math.max(u,B+1))}return o===1/0?[-1,-1]:[o,u]},Te=(e,t,r)=>ie(e,t,r,!0,new Set),ae=(e,t,r,n=new Set)=>{if(n.has(r.id))return[-1,-1];if(n.add(r.id),r.type==="origin")return[0,0];const a=t.filter(u=>u.destinationNodeId===r.id);if(a.length===0)return[-1,-1];let c=1/0,o=-1/0;for(const u of a){const p=e.find(B=>B.id===u.sourceNodeId);if(!p)continue;const[y,k]=ae(e,t,p,new Set(n));y!==-1&&(c=Math.min(c,y+1),o=Math.max(o,k+1))}return c===1/0?[-1,-1]:[c,o]},Me=(e,t,r)=>ae(e,t,r,new Set),ce=e=>e.find(r=>r.type==="origin")||null,U=(e,t,r)=>{if(!e)return ce(t);const n=r.find(c=>c.sourceNodeId===e.id);if(!n)return null;const a=t.find(c=>c.id===n.destinationNodeId);return a||null};async function Le(e,t,r,n){const a=e?"true":"false",c=n.find(o=>o.sourceNodeHandle===a&&o.sourceNodeId===t);return r.find(o=>o.id===(c==null?void 0:c.destinationNodeId))}const X=i.createDomain("experience-instance"),De=q.createFactory(({client:e,experience:t,target:r})=>{const n=i.createEvent(),a=i.createEvent(),c=i.createEvent(),o=i.createEvent(),u=i.createEvent(),p=i.createEvent(),y=t.componentStore,k=X.store("transitioning"),B=e.history.entriesStore.map(s=>s.filter(l=>l.experienceId===t.id)),L=B.map(s=>s.filter(l=>M(l.node))),I=B.map(s=>{var l;return((l=s[s.length-1])==null?void 0:l.node)||null}),f=i.combine(t.treeStore,I,({steps:s},l)=>s.find(d=>l&&M(l)&&d.id===l.stepId)||null),h=i.combine(t.treeStore,I,({nodes:s,edges:l},d)=>d?$e(s,l,d):[]),A=i.combine(t.treeStore,I,({nodes:s,edges:l},d)=>d?Me(s,l,d):[-1,-1]),_=i.combine(t.treeStore,I,({nodes:s,edges:l},d)=>d?Te(s,l,d):[-1,-1]),v=X.store(!1),F=i.createApi(v,{open:()=>!0,close:()=>!1,toggle:s=>!s,set:(s,l)=>l}),fe=i.createEffect(async()=>{e.history.back({experienceId:t.id})}),le=i.attach({source:t.treeStore,effect:async(s,l)=>{const d=s.nodes.find(w=>M(w)&&w.stepId===l);d&&e.history.push({experienceId:t.id,node:d})}}),z=i.attach({source:I,effect:s=>{}}),W=i.attach({source:t.treeStore,effect:async({nodes:s})=>ce(s)}),G=i.attach({source:t.treeStore,effect:async({nodes:s,edges:l},d)=>U(d,s,l)}),K=i.attach({source:t.treeStore,effect:async({nodes:s,edges:l,conditionals:d},w)=>{if(!w)return;const $=d.find(b=>b.id===w.conditionalId);if(!$)return;const x=w.id,S=await V(e,$.condition);return Le(!!S,x,s,l)}}),J=i.attach({source:t.treeStore,effect:async({nodes:s,edges:l},d)=>{if(!d||!te(d))return;const w=d.action;if(!w){N.logger("warn",`Action node ${d.id} has no action name`);return}const $=e.actions.getByName(w).getState();if(!$){N.logger("warn",`Action '${w}' not registered on client`);const x=l.find(S=>S.sourceNodeId===d.id&&S.sourceNodeHandle==="false");return x?s.find(S=>S.id===x.destinationNodeId):null}if(typeof $.action!="function"){N.logger("warn",`Action '${w}' is not a function`);const x=l.find(S=>S.sourceNodeId===d.id&&S.sourceNodeHandle==="false");return x?s.find(S=>S.id===x.destinationNodeId):null}try{N.logger("info",`Executing action: ${w}`),await $.action(w);const x=l.find(b=>b.sourceNodeId===d.id&&b.sourceNodeHandle==="true");if(!x)return N.logger("warn",`No 'true' edge found for action node ${d.id}`),null;const S=s.find(b=>b.id===x.destinationNodeId);return N.logger("info",`Action '${w}' succeeded, moving to node ${S==null?void 0:S.id}`),S||null}catch(x){N.logger("warn",`Action '${w}' failed:`,x);const S=l.find(P=>P.sourceNodeId===d.id&&P.sourceNodeHandle==="false");if(!S)return N.logger("warn",`No 'false' edge found for action node ${d.id}`),null;const b=s.find(P=>P.id===S.destinationNodeId);return N.logger("info",`Action '${w}' failed, moving to node ${b==null?void 0:b.id}`),b||null}}}),de=i.createEffect(s=>{if(s)return e.launchExperienceById(s.experienceId)}),Q=i.attach({source:[I,t.treeStore],effect:async([s,{nodes:l,edges:d}])=>U(s,l,d)}),D=i.attach({source:[I,t.treeStore],effect:async([s,{nodes:l,edges:d}])=>U(s,l,d)}),pe=i.createEffect(s=>{e.history.push({experienceId:t.id,node:s})}),Y=i.attach({source:t.configStore,effect:async({initializeOpenLogic:s})=>re(s)?!!await V(e,s):s??!1});return i.split({source:I,match:s=>s?Fe(s)?"condition":M(s)?"step":_e(s)?"launchExperience":ee(s)?"origin":te(s)?"action":"other":"none",cases:{none:W,origin:G,condition:K,step:z,launchExperience:de,action:J,__:i.createEvent()}}),i.sample({clock:[K.doneData,G.doneData,W.doneData,D.doneData,Q.doneData,J.doneData],filter:Boolean,target:pe}),i.sample({clock:a,target:D}),i.sample({clock:a,source:f,filter:Boolean,target:e.eventBus.prepend(s=>({type:"step_submit",step:s,experience:t}))}),i.sample({clock:D.done,source:f,filter:Boolean,target:e.eventBus.prepend(s=>({type:"step_submit_success",step:s,experience:t}))}),i.sample({clock:D.fail,source:f,filter:Boolean,target:e.eventBus.prepend(s=>({type:"step_submit_error",step:s,experience:t}))}),i.sample({clock:c,target:fe}),i.sample({clock:o,target:le}),i.sample({source:i.combine([K.pending,G.pending,W.pending,D.pending]),fn:s=>s.some(Boolean)?"transitioning":"ready",target:k}),i.sample({clock:z.doneData,source:f,filter:Boolean,target:e.eventBus.prepend(s=>({type:"step_enter",step:s,experience:t}))}),i.sample({clock:p,target:Y}),i.sample({source:Y.doneData,fn:Boolean,target:v}),i.sample({source:I,clock:n,filter:s=>s?ee(s):!0,target:Q}),i.sample({source:v,filter:Boolean,target:n}),i.sample({source:v,filter:Boolean,target:e.eventBus.prepend(()=>({type:"experience_open",experience:t}))}),i.sample({source:v,filter:s=>!s,target:e.eventBus.prepend(()=>({type:"experience_close",experience:t}))}),i.sample({clock:u,target:[p]}),u(),{id:Math.random().toString(36).substring(7),experienceId:t.id,configStore:t.configStore,target:r,componentStore:y,stateStore:k,isOpenStore:v,open:F.open,close:F.close,toggleOpen:F.toggle,setOpen:F.set,treeStore:t.treeStore,currentNodeStore:I,currentStepStore:f,nextReachableStepNodesStore:h,stepsToOriginStore:A,stepsToLeafStore:_,goToNextStep:a,goToPreviousStep:c,goToStepById:o,stepsHistoryStore:L}});function ue(e){return q.invoke(De,e)}const Re=q.createFactory(({client:e})=>{const t=X.store({}),r=i.createEvent(),n=i.createEvent(),a=i.createEvent(),c=i.createApi(t,{register(f,h){const A=[...f[h.experienceId]??[]];return A.push(h),{...f,[h.experienceId]:A}},unregister(f,h){var v;const A=h.experienceId,_=(v=f[A])==null?void 0:v.filter(F=>F!==h);return{...f,[A]:_??[]}}}),o=i.createEffect(({experience:f,target:h})=>ue({client:e,experience:f,target:h})),u=i.createEffect(f=>{c.register(f)}),p=i.createEffect(f=>{f.target&&Ie(f.target,()=>{a(f)})}),y=i.createEffect(f=>{c.unregister(f)}),k=i.createEffect(f=>{const h=f.componentStore.getState();if(!h){N.logger("warn","No app component registered. Skipping init.");return}const A=h.frameworkStore.getState();if(!A){N.logger("error",`No framework registered for component '${h.name}'. Skipping rendering.`);return}const _=f.target;if(!_){N.logger("error",`No target element registered for experience '${f.experienceId}'. Skipping rendering.`);return}const v=Ee(_);try{A.render(v,h.component,e,f)}catch(F){N.logger("error",F)}});i.sample({clock:r,target:o}),i.sample({clock:a,target:y}),i.sample({clock:o.doneData,target:[u,p,n]}),i.sample({clock:o.doneData,target:e.eventBus.prepend(f=>({type:"experience_initialize",experienceInstance:f}))}),i.sample({clock:n,target:k});function B(f,h){r({experience:f,target:h})}const L=t.map(f=>Object.values(f).flat());function I(f){return t.map(h=>h[f]||[],{skipVoid:!1})}return{spawn:B,getByExperienceId:I,listStore:L}});function Pe(e){return q.invoke(Re,e)}exports.createAppHosts=ve;exports.createExperienceInstance=ue;exports.createExperienceInstanceIndex=Pe;exports.domInteractive=Ne;exports.evaluateRuleLogic=V;exports.getTargetElements=ke;exports.isPickedRoot=oe;exports.isRulesLogic=re;exports.isStepNode=M;exports.tagTargetElement=be;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { Store } from 'effector';
|
|
2
|
+
export type Action = <T = void>(params?: T) => void;
|
|
2
3
|
export type ActionsStore = ReturnType<typeof createActionIndexFactory>;
|
|
3
4
|
export interface ActionIndexItem {
|
|
4
5
|
name: string;
|
|
@@ -6,8 +7,9 @@ export interface ActionIndexItem {
|
|
|
6
7
|
}
|
|
7
8
|
declare const createActionIndexFactory: () => {
|
|
8
9
|
register: (name: string, action: Action) => void;
|
|
9
|
-
getByName: (name: string) =>
|
|
10
|
-
listStore:
|
|
10
|
+
getByName: (name: string) => Store<ActionIndexItem | undefined>;
|
|
11
|
+
listStore: Store<ActionIndexItem[]>;
|
|
12
|
+
getEvokableAction: (actionName: string) => Store<(<T = void>(params?: T) => void) | undefined>;
|
|
11
13
|
};
|
|
12
14
|
export declare function createActionIndex(): ReturnType<typeof createActionIndexFactory>;
|
|
13
15
|
export declare const setupAction: (name: string, action: Action, actions: ActionsStore) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../../src/entities/action/action.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../../src/entities/action/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,KAAK,EAAE,MAAM,UAAU,CAAA;AAG9D,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC,KAAK,IAAI,CAAA;AACnD,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAItE,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;CACf;AAED,QAAA,MAAM,wBAAwB;qBAiBJ,MAAM,UAAU,MAAM,KAAG,IAAI;sBAQ5B,MAAM;;oCAIQ,MAAM,KAAG,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CAgBnG,CAAA;AAEF,wBAAgB,iBAAiB,IAAI,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAE/E;AAED,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,QAAQ,MAAM,EAAE,SAAS,YAAY,KAAG,IAEjF,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Store } from 'effector';
|
|
1
2
|
import { Picked } from '../../picked';
|
|
2
3
|
export interface Feature {
|
|
3
4
|
key: string;
|
|
@@ -5,7 +6,7 @@ export interface Feature {
|
|
|
5
6
|
decide: () => boolean | Promise<boolean> | string | Promise<string>;
|
|
6
7
|
storage?: 'local' | 'session';
|
|
7
8
|
}
|
|
8
|
-
export type FeaturesStore = ReturnType<typeof
|
|
9
|
+
export type FeaturesStore = ReturnType<typeof createFeatureIndexFactory>;
|
|
9
10
|
export interface FeatureIndexItem {
|
|
10
11
|
id: string;
|
|
11
12
|
feature: Feature & {
|
|
@@ -42,8 +43,10 @@ declare const createFeatureIndexFactory: ({ client }: {
|
|
|
42
43
|
client: Picked;
|
|
43
44
|
}) => {
|
|
44
45
|
register: (id: string, feature: Feature) => void;
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
getById: (id: string) => Store<FeatureBucket | undefined>;
|
|
47
|
+
getByName: (name: string) => Store<FeatureIndexItem | undefined>;
|
|
48
|
+
listStore: Store<FeatureBucket[]>;
|
|
49
|
+
getEvokableFeature: (featureName: string) => Store<() => Promise<boolean | string | undefined>>;
|
|
47
50
|
};
|
|
48
51
|
export declare function createFeatureIndex<T extends Parameters<typeof createFeatureIndexFactory>[0]>(params: T): ReturnType<typeof createFeatureIndexFactory>;
|
|
49
52
|
export declare const setupFeature: (name: string, feature: Feature, features: FeaturesStore) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../../../../src/entities/feature/feature.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../../../../src/entities/feature/feature.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,KAAK,EACX,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAI1C,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IACnE,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B;AAED,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAExE,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,OAAO,GAAG;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAA;CAClC;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,OAAO,GAAG,MAAM,CAAA;IACxB,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,EAAE,EAAE,MAAM,CAAA;CACX;AAED,MAAM,WAAW,uBAAwB,SAAQ,iBAAiB;IAChE,UAAU,EAAE,KAAK,CAAA;IACjB,SAAS,EAAE,MAAM,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC,CAAA;CACnE;AAED,MAAM,WAAW,qBAAsB,SAAQ,iBAAiB;IAC9D,UAAU,EAAE,IAAI,CAAA;IAChB,SAAS,EAAE,MAAM;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAA;CAC1D;AAED,MAAM,MAAM,aAAa,GAAG,uBAAuB,GAAG,qBAAqB,CAAA;AAK3E,QAAA,MAAM,yBAAyB,eAA8B;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;mBAgBvD,MAAM,WAAW,OAAO,KAAG,IAAI;kBAwMhC,MAAM;sBAOF,MAAM;;sCAKhB,MAAM,KAClB,KAAK,CAAC,MAAM,OAAO,CAAC,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;CA2CrD,CAAA;AAEF,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC,CAAC,CAAC,EAC1F,MAAM,EAAE,CAAC,GACR,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAE9C;AAED,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,EAAE,SAAS,OAAO,EAAE,UAAU,aAAa,SAEnF,CAAA"}
|