@picked/client 0.0.1-dev.1777513622441 → 0.0.1-dev.1777593605103
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/{api-DlDrrct4.js → api-DGV5XIrB.js} +1 -1
- package/dist/{api-DJvKbj_l.cjs → api-DWzLgPsf.cjs} +1 -1
- package/dist/cjs/form/index.js +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/plugins/create-experience/index.js +1 -1
- package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
- package/dist/cjs/plugins/experience-browser-storage/index.js +1 -1
- package/dist/cjs/plugins/history-browser-storage/index.js +1 -1
- package/dist/cjs/plugins/responses-browser-storage/index.js +1 -1
- package/dist/cjs/plugins/responses-indexeddb/index.js +1 -1
- package/dist/cjs/plugins/single-page-app/index.js +1 -1
- package/dist/cjs/plugins/web-components/index.js +1 -1
- package/dist/cjs/plugins/window-object/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/docs/{actions.mdx → actions.md} +0 -7
- package/dist/docs/{api-keys.mdx → api-keys.md} +0 -7
- package/dist/docs/{conditions.mdx → conditions.md} +0 -7
- package/dist/docs/{experiences.mdx → experiences.md} +0 -7
- package/dist/docs/{features.mdx → features.md} +0 -7
- package/dist/docs/{fields.mdx → fields.md} +0 -7
- package/dist/docs/flow-builder/{overview.mdx → overview.md} +0 -7
- package/dist/docs/pickedql/data-sources.md +2 -49
- package/dist/docs/pickedql/dimensions.md +0 -20
- package/dist/docs/pickedql/examples.md +1 -1
- package/dist/docs/pickedql/filtering.md +0 -22
- package/dist/docs/pickedql/index.md +1 -2
- package/dist/docs/pickedql/schema.md +1 -34
- package/dist/docs/pickedql/virtual-functions.md +4 -4
- package/dist/docs/{projects.mdx → projects.md} +0 -7
- package/dist/docs/{reports.mdx → reports.md} +0 -7
- package/dist/docs/{steps.mdx → steps.md} +0 -7
- package/dist/docs/{workspaces.mdx → workspaces.md} +0 -8
- package/dist/esm/form/index.js +6 -21
- package/dist/esm/index.js +169 -295
- package/dist/esm/plugins/create-experience/index.js +1 -1
- package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
- package/dist/esm/plugins/experience-browser-storage/index.js +19 -21
- package/dist/esm/plugins/history-browser-storage/index.js +15 -17
- package/dist/esm/plugins/responses-browser-storage/index.js +19 -21
- package/dist/esm/plugins/responses-indexeddb/index.js +35 -37
- package/dist/esm/plugins/single-page-app/index.js +28 -14
- package/dist/esm/plugins/web-components/index.js +1 -1
- package/dist/esm/plugins/window-object/index.js +1 -1
- package/dist/esm/server/index.js +1 -1
- package/dist/experience-CNIhapU2.js +136 -0
- package/dist/experience-CTEBY-it.cjs +1 -0
- package/dist/experience-instance-B0tFPMAU.js +396 -0
- package/dist/experience-instance-BN0RZG1b.cjs +1 -0
- package/dist/nodes-2fst8XKi.js +101 -0
- package/dist/nodes-DBK4N9YY.cjs +1 -0
- package/dist/rules-logic-D7dL30U1.js +263 -0
- package/dist/rules-logic-DJhGFqhC.cjs +1 -0
- package/dist/types/entities/action/action.d.ts +4 -30
- package/dist/types/entities/action/action.d.ts.map +1 -1
- package/dist/types/entities/experience-instance/experience-instance.d.ts +2 -4
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/framework/framework.d.ts +2 -0
- package/dist/types/entities/framework/framework.d.ts.map +1 -1
- package/dist/types/entities/response/response-validation.d.ts +17 -17
- package/dist/types/entities/response/response-validation.d.ts.map +1 -1
- package/dist/types/form/create-field-evaluator.d.ts.map +1 -1
- package/dist/types/form/create-submit-pipeline.d.ts.map +1 -1
- package/dist/types/picked.d.ts +1 -3
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/plugins/history-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/plugins/responses-indexeddb/plugin.d.ts.map +1 -1
- package/dist/types/plugins/single-page-app/plugin.d.ts +15 -4
- package/dist/types/plugins/single-page-app/plugin.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/experience-instance-DC2gKwA6.cjs +0 -1
- package/dist/experience-instance-DJaNc5Ob.js +0 -486
- package/dist/object-C82v79xc.js +0 -25
- package/dist/object-CUJOjanb.cjs +0 -1
- package/dist/rules-logic-BTIxfrJJ.js +0 -240
- package/dist/rules-logic-DNLOv90w.cjs +0 -1
- /package/dist/{id-Bv44ilEo.cjs → id-Cg7fVl1O.cjs} +0 -0
- /package/dist/{id-CRqy981z.js → id-n2yrHvNo.js} +0 -0
- /package/dist/{logger-6z_gb4rA.js → logger-C44jSdYl.js} +0 -0
- /package/dist/{logger-fbvQC40v.cjs → logger-CJUj90QX.cjs} +0 -0
- /package/dist/{supports-0XIfd4-R.js → supports-B_trw6lj.js} +0 -0
- /package/dist/{supports-Dsjg-82e.cjs → supports-CKSVYpQx.cjs} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../../../logger-
|
|
2
|
-
import { i as e, t } from "../../../api-
|
|
1
|
+
import "../../../logger-C44jSdYl.js";
|
|
2
|
+
import { i as e, t } from "../../../api-DGV5XIrB.js";
|
|
3
3
|
//#region src/plugins/dynamic-experiences/hash.ts
|
|
4
4
|
function n(e) {
|
|
5
5
|
let t = 2166136261;
|
|
@@ -1,35 +1,33 @@
|
|
|
1
|
-
import "../../../logger-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { createEffect as i, sample as a } from "effector";
|
|
1
|
+
import "../../../logger-C44jSdYl.js";
|
|
2
|
+
import { n as e, r as t, t as n } from "../../../storage-6Xk0uAxB.js";
|
|
3
|
+
import { createEffect as r, sample as i } from "effector";
|
|
5
4
|
//#region src/plugins/experience-browser-storage/plugin.ts
|
|
6
|
-
var
|
|
5
|
+
var a = ({ storage: a = "local" } = {}) => ({
|
|
7
6
|
name: "experience-browser-storage-plugin",
|
|
8
|
-
setup: (
|
|
9
|
-
|
|
10
|
-
let c = o === "local" ? t : n, l = i(async (e) => {
|
|
7
|
+
setup: (o) => {
|
|
8
|
+
let s = a === "local" ? e : t, c = r(async (e) => {
|
|
11
9
|
if (!e) return;
|
|
12
|
-
let t =
|
|
13
|
-
e.setOpen(
|
|
10
|
+
let t = n("open-close", "experience", e), r = s.get(t).boolean();
|
|
11
|
+
e.setOpen(r ?? e.isOpenStore.getState());
|
|
14
12
|
});
|
|
15
|
-
|
|
16
|
-
source:
|
|
13
|
+
i({
|
|
14
|
+
source: o.eventBus,
|
|
17
15
|
filter: (e) => e.type === "experience_initialize" && "experience" in e,
|
|
18
16
|
fn: (e) => e.experience,
|
|
19
|
-
target:
|
|
17
|
+
target: c
|
|
20
18
|
});
|
|
21
|
-
let
|
|
22
|
-
let t =
|
|
23
|
-
|
|
24
|
-
}),
|
|
19
|
+
let l = r(async (e) => {
|
|
20
|
+
let t = n("open-close", "experience", e), r = e.isOpenStore.getState();
|
|
21
|
+
s.set(t, r);
|
|
22
|
+
}), u = (e) => i({
|
|
25
23
|
source: e.isOpenStore,
|
|
26
24
|
fn: () => e,
|
|
27
|
-
target:
|
|
25
|
+
target: l
|
|
28
26
|
});
|
|
29
|
-
|
|
30
|
-
e.forEach((e) =>
|
|
27
|
+
o.experienceInstances.listStore.watch((e) => {
|
|
28
|
+
e.forEach((e) => u(e));
|
|
31
29
|
});
|
|
32
30
|
}
|
|
33
31
|
});
|
|
34
32
|
//#endregion
|
|
35
|
-
export {
|
|
33
|
+
export { a as experienceBrowserStoragePlugin };
|
|
@@ -1,26 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { createEffect as i, sample as a } from "effector";
|
|
1
|
+
import { n as e, r as t, t as n } from "../../../storage-6Xk0uAxB.js";
|
|
2
|
+
import { createEffect as r, sample as i } from "effector";
|
|
4
3
|
//#region src/plugins/history-browser-storage/plugin.ts
|
|
5
|
-
var
|
|
4
|
+
var a = n("history", "global"), o = ({ storage: n = "local" } = {}) => ({
|
|
6
5
|
name: "history-browser-storage-plugin",
|
|
7
|
-
setup: (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
c.set(o, e);
|
|
6
|
+
setup: (o) => {
|
|
7
|
+
let s = n === "local" ? e : t, c = r(async () => {
|
|
8
|
+
let e = s.get(a).json();
|
|
9
|
+
e && o.history.restore({ entries: e });
|
|
10
|
+
}), l = r(async (e) => {
|
|
11
|
+
s.set(a, e);
|
|
14
12
|
});
|
|
15
|
-
|
|
16
|
-
source:
|
|
13
|
+
i({
|
|
14
|
+
source: o.eventBus,
|
|
17
15
|
filter: (e) => e.type === "load",
|
|
16
|
+
target: c
|
|
17
|
+
}), i({
|
|
18
|
+
source: o.history.entriesStore,
|
|
18
19
|
target: l
|
|
19
|
-
}), a({
|
|
20
|
-
source: s.history.entriesStore,
|
|
21
|
-
target: u
|
|
22
20
|
});
|
|
23
21
|
}
|
|
24
22
|
});
|
|
25
23
|
//#endregion
|
|
26
|
-
export {
|
|
24
|
+
export { o as historyBrowserStoragePlugin };
|
|
@@ -1,37 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { attach as i, createEffect as a, sample as o } from "effector";
|
|
1
|
+
import { n as e, r as t, t as n } from "../../../storage-6Xk0uAxB.js";
|
|
2
|
+
import { attach as r, createEffect as i, sample as a } from "effector";
|
|
4
3
|
//#region src/plugins/responses-browser-storage/plugin.ts
|
|
5
|
-
var
|
|
6
|
-
function
|
|
4
|
+
var o = n("responses", "global");
|
|
5
|
+
function s(e, t) {
|
|
7
6
|
return Object.fromEntries(Object.entries(e).flatMap(([e, n]) => t.find((t) => t.key === e)?.policies?.doNotStoreValue ? [] : [[e, n]]));
|
|
8
7
|
}
|
|
9
|
-
var
|
|
8
|
+
var c = ({ storage: n = "local" } = {}) => ({
|
|
10
9
|
name: "responses-browser-storage-plugin",
|
|
11
|
-
setup: (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
let e = u.get(s).json();
|
|
10
|
+
setup: (c) => {
|
|
11
|
+
let l = n === "local" ? e : t, u = i(async () => {
|
|
12
|
+
let e = l.get(o).json();
|
|
15
13
|
if (!e) return null;
|
|
16
|
-
|
|
17
|
-
}),
|
|
14
|
+
c.responses.register(e);
|
|
15
|
+
}), d = r({
|
|
18
16
|
source: {
|
|
19
|
-
responses:
|
|
20
|
-
fields:
|
|
17
|
+
responses: c.responses.getAllStore,
|
|
18
|
+
fields: c.fields.listStore
|
|
21
19
|
},
|
|
22
20
|
effect: ({ responses: e, fields: t }) => {
|
|
23
|
-
|
|
21
|
+
l.set(o, s(e, t));
|
|
24
22
|
}
|
|
25
23
|
});
|
|
26
|
-
|
|
27
|
-
source:
|
|
24
|
+
a({
|
|
25
|
+
source: c.eventBus,
|
|
28
26
|
filter: (e) => e.type === "load",
|
|
27
|
+
target: u
|
|
28
|
+
}), a({
|
|
29
|
+
source: c.responses.getAllStore,
|
|
29
30
|
target: d
|
|
30
|
-
}), o({
|
|
31
|
-
source: l.responses.getAllStore,
|
|
32
|
-
target: f
|
|
33
31
|
});
|
|
34
32
|
}
|
|
35
33
|
});
|
|
36
34
|
//#endregion
|
|
37
|
-
export {
|
|
35
|
+
export { c as responsesBrowserStoragePlugin };
|
|
@@ -1,36 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createEffect as t, sample as n } from "effector";
|
|
1
|
+
import { createEffect as e, sample as t } from "effector";
|
|
3
2
|
//#region src/utils/indexed-db.ts
|
|
4
|
-
var
|
|
5
|
-
async function
|
|
6
|
-
let { storeName: t, version:
|
|
3
|
+
var n = "picked";
|
|
4
|
+
async function r(e) {
|
|
5
|
+
let { storeName: t, version: r = 1, keyPath: i = "id" } = e;
|
|
7
6
|
return new Promise((e, a) => {
|
|
8
|
-
let o = indexedDB.open(
|
|
7
|
+
let o = indexedDB.open(n, r);
|
|
9
8
|
o.onupgradeneeded = () => {
|
|
10
9
|
let e = o.result;
|
|
11
10
|
e.objectStoreNames.contains(t) || e.createObjectStore(t, i ? { keyPath: i } : void 0);
|
|
12
11
|
}, o.onsuccess = () => e(o.result), o.onerror = () => a(Error(o.error?.message));
|
|
13
12
|
});
|
|
14
13
|
}
|
|
15
|
-
async function
|
|
14
|
+
async function i(e, t) {
|
|
16
15
|
return new Promise((n, r) => {
|
|
17
16
|
let i = e.transaction(t, "readonly").objectStore(t).getAll();
|
|
18
17
|
i.onsuccess = () => n(i.result), i.onerror = () => r(Error(i.error?.message));
|
|
19
18
|
});
|
|
20
19
|
}
|
|
21
|
-
async function
|
|
20
|
+
async function a(e, t, n) {
|
|
22
21
|
return new Promise((r, i) => {
|
|
23
22
|
let a = e.transaction(t, "readwrite").objectStore(t).put(n);
|
|
24
23
|
a.onsuccess = () => r(), a.onerror = () => i(Error(a.error?.message));
|
|
25
24
|
});
|
|
26
25
|
}
|
|
27
|
-
async function
|
|
26
|
+
async function o(e, t, n) {
|
|
28
27
|
return new Promise((r, i) => {
|
|
29
28
|
let a = e.transaction(t, "readwrite").objectStore(t).delete(n);
|
|
30
29
|
a.onsuccess = () => r(), a.onerror = () => i(Error(a.error?.message));
|
|
31
30
|
});
|
|
32
31
|
}
|
|
33
|
-
async function
|
|
32
|
+
async function s(e, t) {
|
|
34
33
|
return new Promise((n, r) => {
|
|
35
34
|
let i = e.transaction(t, "readwrite").objectStore(t).clear();
|
|
36
35
|
i.onsuccess = () => n(), i.onerror = () => r(Error(i.error?.message));
|
|
@@ -38,35 +37,34 @@ async function c(e, t) {
|
|
|
38
37
|
}
|
|
39
38
|
//#endregion
|
|
40
39
|
//#region src/plugins/responses-indexeddb/plugin.ts
|
|
41
|
-
var
|
|
42
|
-
storeName:
|
|
40
|
+
var c = "responses", l = {
|
|
41
|
+
storeName: c,
|
|
43
42
|
keyPath: "fieldKey",
|
|
44
43
|
version: 2
|
|
45
|
-
},
|
|
44
|
+
}, u = () => ({
|
|
46
45
|
name: "responses-indexdb-plugin",
|
|
47
|
-
setup: (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}), f = t(async (e) => {
|
|
46
|
+
setup: (n) => {
|
|
47
|
+
let u = e(async () => {
|
|
48
|
+
let e = (await i(await r(l), c)).reduce((e, { fieldKey: t, value: n }) => (e[t] = n, e), {});
|
|
49
|
+
await n.responses.commit(e);
|
|
50
|
+
}), d = e(async (e) => {
|
|
53
51
|
await Promise.allSettled(e.map(async (e) => {
|
|
54
|
-
await
|
|
52
|
+
await a(await r(l), c, e);
|
|
55
53
|
}));
|
|
56
|
-
}),
|
|
57
|
-
await
|
|
58
|
-
}),
|
|
59
|
-
await
|
|
54
|
+
}), f = e(async () => {
|
|
55
|
+
await s(await r(l), c);
|
|
56
|
+
}), p = e(async (e) => {
|
|
57
|
+
await o(await r(l), c, e);
|
|
60
58
|
});
|
|
61
|
-
|
|
62
|
-
source:
|
|
59
|
+
t({
|
|
60
|
+
source: n.eventBus,
|
|
63
61
|
filter: (e) => e.type === "load",
|
|
64
|
-
target:
|
|
65
|
-
}),
|
|
66
|
-
clock:
|
|
62
|
+
target: u
|
|
63
|
+
}), t({
|
|
64
|
+
clock: n.responses.listStore,
|
|
67
65
|
source: {
|
|
68
|
-
responses:
|
|
69
|
-
fields:
|
|
66
|
+
responses: n.responses.listStore,
|
|
67
|
+
fields: n.fields.listStore
|
|
70
68
|
},
|
|
71
69
|
fn: ({ responses: e, fields: t }) => {
|
|
72
70
|
let n = new Set(t.filter((e) => !e.policies?.doNotStoreValue).map((e) => e.key));
|
|
@@ -75,15 +73,15 @@ var l = "responses", u = {
|
|
|
75
73
|
value: e.value
|
|
76
74
|
}));
|
|
77
75
|
},
|
|
76
|
+
target: d
|
|
77
|
+
}), t({
|
|
78
|
+
clock: n.responses.clearAll,
|
|
78
79
|
target: f
|
|
79
|
-
}),
|
|
80
|
-
clock:
|
|
80
|
+
}), t({
|
|
81
|
+
clock: n.responses.clear,
|
|
81
82
|
target: p
|
|
82
|
-
}), n({
|
|
83
|
-
clock: r.responses.clear,
|
|
84
|
-
target: m
|
|
85
83
|
});
|
|
86
84
|
}
|
|
87
85
|
});
|
|
88
86
|
//#endregion
|
|
89
|
-
export {
|
|
87
|
+
export { u as responsesIndexedDBPlugin };
|
|
@@ -1,33 +1,47 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { d as t, f as n, i as r } from "../../../supports-
|
|
1
|
+
import { i as e } from "../../../rules-logic-D7dL30U1.js";
|
|
2
|
+
import { d as t, f as n, i as r } from "../../../supports-B_trw6lj.js";
|
|
3
|
+
import { n as i } from "../../../experience-CNIhapU2.js";
|
|
3
4
|
//#region src/plugins/single-page-app/plugin.ts
|
|
4
|
-
var
|
|
5
|
+
var a = n, o = 1e3, s = 150, c, l = (e) => ({
|
|
5
6
|
name: "single-page-app",
|
|
6
7
|
setup: (e) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
if (!t()) return;
|
|
9
|
+
let n, r, a, c = () => {
|
|
10
|
+
n &&= (n.disconnect(), void 0), r !== void 0 && (clearTimeout(r), r = void 0), a !== void 0 && (clearTimeout(a), a = void 0);
|
|
11
|
+
}, l = () => {
|
|
12
|
+
i(e);
|
|
13
|
+
};
|
|
14
|
+
u(() => {
|
|
15
|
+
c(), requestAnimationFrame(() => {
|
|
16
|
+
l();
|
|
17
|
+
});
|
|
18
|
+
let e = new MutationObserver(() => {
|
|
19
|
+
l(), a !== void 0 && clearTimeout(a), a = setTimeout(c, s);
|
|
10
20
|
});
|
|
21
|
+
e.observe(document.body, {
|
|
22
|
+
childList: !0,
|
|
23
|
+
subtree: !0
|
|
24
|
+
}), n = e, r = setTimeout(c, o);
|
|
11
25
|
});
|
|
12
26
|
}
|
|
13
27
|
});
|
|
14
|
-
function
|
|
15
|
-
if (
|
|
16
|
-
let e =
|
|
17
|
-
|
|
28
|
+
function u(t) {
|
|
29
|
+
if (a.addEventListener("popstate", () => {
|
|
30
|
+
let e = a.location.href, n = c;
|
|
31
|
+
c = e, n !== e && t();
|
|
18
32
|
}), !r()) return;
|
|
19
33
|
function n(e) {
|
|
20
34
|
return function(...n) {
|
|
21
35
|
let r = n.length > 2 ? n[2] : void 0;
|
|
22
36
|
if (r) {
|
|
23
|
-
let i =
|
|
24
|
-
if (
|
|
37
|
+
let i = c, a = String(r);
|
|
38
|
+
if (c = a, i === a) return e.apply(this, n);
|
|
25
39
|
t();
|
|
26
40
|
}
|
|
27
41
|
return e.apply(this, n);
|
|
28
42
|
};
|
|
29
43
|
}
|
|
30
|
-
e(
|
|
44
|
+
e(a.history, "pushState", n), e(a.history, "replaceState", n);
|
|
31
45
|
}
|
|
32
46
|
//#endregion
|
|
33
|
-
export {
|
|
47
|
+
export { l as singlePageAppPlugin };
|
package/dist/esm/server/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "../../experience-instance-
|
|
1
|
+
import { t as e } from "../../experience-instance-B0tFPMAU.js";
|
|
2
2
|
import { attach as t, createEffect as n, createEvent as r, createStore as i, sample as a } from "effector";
|
|
3
3
|
//#region src/server/index.ts
|
|
4
4
|
function o() {
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { n as e, t } from "./rules-logic-D7dL30U1.js";
|
|
2
|
+
import "./logger-C44jSdYl.js";
|
|
3
|
+
import { a as n, f as r, l as i, n as a, o } from "./nodes-2fst8XKi.js";
|
|
4
|
+
import { attach as s, combine as c, createApi as l, createDomain as u } from "effector";
|
|
5
|
+
import { createFactory as d, invoke as f } from "@withease/factories";
|
|
6
|
+
//#region src/entities/experience/experience.ts
|
|
7
|
+
var p = u("experience"), m = d(({ client: e, experience: t }) => {
|
|
8
|
+
let r = p.store(t), i = l(r, { merge(e, t) {
|
|
9
|
+
return {
|
|
10
|
+
...e,
|
|
11
|
+
...t.experience
|
|
12
|
+
};
|
|
13
|
+
} }), o = r.map((e) => ({
|
|
14
|
+
name: e.name,
|
|
15
|
+
decisionLogic: e.condition,
|
|
16
|
+
targetSelectors: e.targets,
|
|
17
|
+
initializeOpenLogic: e.initializeOpen
|
|
18
|
+
})), s = c(r, e.components.listStore, (e, t) => (e.componentName ? t.find((t) => t.name === e.componentName) : void 0) || t.find((t) => t.name === `experience:${e.id}`) || t.find((e) => e.name === "experience"), { skipVoid: !1 }), u = c(r, e.steps.indexStore, e.conditions.indexStore, (e, t, r) => {
|
|
19
|
+
let i = e.nodes.filter(n).map((e) => t[e.stepId]).filter((e) => e !== void 0), o = e.nodes.filter(a).map((e) => r[e.conditionId]).filter((e) => e !== void 0);
|
|
20
|
+
return {
|
|
21
|
+
steps: i,
|
|
22
|
+
nodes: e.nodes,
|
|
23
|
+
edges: e.edges,
|
|
24
|
+
conditions: o
|
|
25
|
+
};
|
|
26
|
+
}), d = t.actions ?? [];
|
|
27
|
+
return {
|
|
28
|
+
id: t.id,
|
|
29
|
+
key: t.key,
|
|
30
|
+
name: t.name,
|
|
31
|
+
configStore: o,
|
|
32
|
+
treeStore: u,
|
|
33
|
+
componentStore: s,
|
|
34
|
+
actions: d,
|
|
35
|
+
merge: i.merge
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
function h(e) {
|
|
39
|
+
return f(m, e);
|
|
40
|
+
}
|
|
41
|
+
var g = d(({ client: e }) => {
|
|
42
|
+
let t = p.store({}), n = l(t, { register(e, t) {
|
|
43
|
+
return {
|
|
44
|
+
...e,
|
|
45
|
+
[t.id]: t
|
|
46
|
+
};
|
|
47
|
+
} });
|
|
48
|
+
function r(r) {
|
|
49
|
+
let i = t.getState()[r.id];
|
|
50
|
+
if (i) {
|
|
51
|
+
i.merge({
|
|
52
|
+
experience: r,
|
|
53
|
+
strategy: "override"
|
|
54
|
+
});
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
let a = h({
|
|
58
|
+
client: e,
|
|
59
|
+
experience: r
|
|
60
|
+
});
|
|
61
|
+
n.register(a);
|
|
62
|
+
}
|
|
63
|
+
let i = t.map((e) => Object.values(e));
|
|
64
|
+
function a(e) {
|
|
65
|
+
return t.map((t) => t[e], { skipVoid: !1 });
|
|
66
|
+
}
|
|
67
|
+
function o(e) {
|
|
68
|
+
return t.map((t) => Object.values(t).find((t) => t.key === e) ?? t[e], { skipVoid: !1 });
|
|
69
|
+
}
|
|
70
|
+
let c = s({
|
|
71
|
+
source: t,
|
|
72
|
+
effect: async (t, n) => {
|
|
73
|
+
let r = "key" in n ? Object.values(t).find((e) => e.key === n.key) : t[n.id];
|
|
74
|
+
if (!r) {
|
|
75
|
+
"key" in n ? `${n.key}` : `${n.id}`;
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
let { options: i } = n;
|
|
79
|
+
if (i?.bypassCondition) {
|
|
80
|
+
v(e, r, i);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
await b(e, r) && v(e, r, i);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
return {
|
|
87
|
+
register: r,
|
|
88
|
+
get: a,
|
|
89
|
+
getById: a,
|
|
90
|
+
getByKey: o,
|
|
91
|
+
launch: c,
|
|
92
|
+
open: s({
|
|
93
|
+
source: {
|
|
94
|
+
experiences: t,
|
|
95
|
+
instances: e.experienceInstances.listStore
|
|
96
|
+
},
|
|
97
|
+
effect: ({ experiences: e, instances: t }, n) => {
|
|
98
|
+
let r = "key" in n ? Object.values(e).find((e) => e.key === n.key) : e[n.id], i = t.filter((e) => r && e.experienceId === r.id);
|
|
99
|
+
if (i.length > 0) for (let e of i) e.open();
|
|
100
|
+
else c("key" in n ? {
|
|
101
|
+
key: n.key,
|
|
102
|
+
options: {
|
|
103
|
+
...n.options,
|
|
104
|
+
initialiseOpen: !0
|
|
105
|
+
}
|
|
106
|
+
} : {
|
|
107
|
+
id: n.id,
|
|
108
|
+
options: {
|
|
109
|
+
...n.options,
|
|
110
|
+
initialiseOpen: !0
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}),
|
|
115
|
+
listStore: i
|
|
116
|
+
};
|
|
117
|
+
});
|
|
118
|
+
function _(e) {
|
|
119
|
+
return f(g, e);
|
|
120
|
+
}
|
|
121
|
+
var v = (e, t, n) => {
|
|
122
|
+
let { targetSelectors: a } = t.configStore.getState(), s = i(a, t.id);
|
|
123
|
+
s.forEach(({ elements: e }) => e.forEach((e) => r(e, t.id))), o(s, t.id, t.key).forEach((r) => {
|
|
124
|
+
n ? e.experienceInstances.spawn(t, r, n) : e.experienceInstances.spawn(t, r);
|
|
125
|
+
});
|
|
126
|
+
}, y = async (e) => {
|
|
127
|
+
await Promise.all(e.experiences.listStore.getState().map(async (t) => {
|
|
128
|
+
await b(e, t) && v(e, t);
|
|
129
|
+
}));
|
|
130
|
+
}, b = async (n, r) => {
|
|
131
|
+
if (!n.preconditionPassed || !n.session?.isUser) return !1;
|
|
132
|
+
let { decisionLogic: a, targetSelectors: o } = r.configStore.getState();
|
|
133
|
+
return i(o, r.id).length < 1 || o.length === 0 ? !1 : a === void 0 ? !0 : e(a) ? await t(n, a) === !0 : !0;
|
|
134
|
+
};
|
|
135
|
+
//#endregion
|
|
136
|
+
export { y as n, _ as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./rules-logic-DJhGFqhC.cjs`);require(`./logger-CJUj90QX.cjs`);const t=require(`./nodes-DBK4N9YY.cjs`);let n=require(`effector`),r=require(`@withease/factories`);var i=(0,n.createDomain)(`experience`),a=(0,r.createFactory)(({client:e,experience:r})=>{let a=i.store(r),o=(0,n.createApi)(a,{merge(e,t){return{...e,...t.experience}}}),s=a.map(e=>({name:e.name,decisionLogic:e.condition,targetSelectors:e.targets,initializeOpenLogic:e.initializeOpen})),c=(0,n.combine)(a,e.components.listStore,(e,t)=>(e.componentName?t.find(t=>t.name===e.componentName):void 0)||t.find(t=>t.name===`experience:${e.id}`)||t.find(e=>e.name===`experience`),{skipVoid:!1}),l=(0,n.combine)(a,e.steps.indexStore,e.conditions.indexStore,(e,n,r)=>{let i=e.nodes.filter(t.a).map(e=>n[e.stepId]).filter(e=>e!==void 0),a=e.nodes.filter(t.n).map(e=>r[e.conditionId]).filter(e=>e!==void 0);return{steps:i,nodes:e.nodes,edges:e.edges,conditions:a}}),u=r.actions??[];return{id:r.id,key:r.key,name:r.name,configStore:s,treeStore:l,componentStore:c,actions:u,merge:o.merge}});function o(e){return(0,r.invoke)(a,e)}var s=(0,r.createFactory)(({client:e})=>{let t=i.store({}),r=(0,n.createApi)(t,{register(e,t){return{...e,[t.id]:t}}});function a(n){let i=t.getState()[n.id];if(i){i.merge({experience:n,strategy:`override`});return}let a=o({client:e,experience:n});r.register(a)}let s=t.map(e=>Object.values(e));function c(e){return t.map(t=>t[e],{skipVoid:!1})}function u(e){return t.map(t=>Object.values(t).find(t=>t.key===e)??t[e],{skipVoid:!1})}let f=(0,n.attach)({source:t,effect:async(t,n)=>{let r=`key`in n?Object.values(t).find(e=>e.key===n.key):t[n.id];if(!r){`key`in n?`${n.key}`:`${n.id}`;return}let{options:i}=n;if(i?.bypassCondition){l(e,r,i);return}await d(e,r)&&l(e,r,i)}});return{register:a,get:c,getById:c,getByKey:u,launch:f,open:(0,n.attach)({source:{experiences:t,instances:e.experienceInstances.listStore},effect:({experiences:e,instances:t},n)=>{let r=`key`in n?Object.values(e).find(e=>e.key===n.key):e[n.id],i=t.filter(e=>r&&e.experienceId===r.id);if(i.length>0)for(let e of i)e.open();else f(`key`in n?{key:n.key,options:{...n.options,initialiseOpen:!0}}:{id:n.id,options:{...n.options,initialiseOpen:!0}})}}),listStore:s}});function c(e){return(0,r.invoke)(s,e)}var l=(e,n,r)=>{let{targetSelectors:i}=n.configStore.getState(),a=t.l(i,n.id);a.forEach(({elements:e})=>e.forEach(e=>t.f(e,n.id))),t.o(a,n.id,n.key).forEach(t=>{r?e.experienceInstances.spawn(n,t,r):e.experienceInstances.spawn(n,t)})},u=async e=>{await Promise.all(e.experiences.listStore.getState().map(async t=>{await d(e,t)&&l(e,t)}))},d=async(n,r)=>{if(!n.preconditionPassed||!n.session?.isUser)return!1;let{decisionLogic:i,targetSelectors:a}=r.configStore.getState();return t.l(a,r.id).length<1||a.length===0?!1:i===void 0?!0:e.n(i)?await e.t(n,i)===!0:!0};Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return c}});
|