@picked/client 0.0.1-dev.1777594341273 → 0.0.1-dev.1777601813342
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-DWa-ZqA4.cjs → api-BAOO2VZv.cjs} +1 -1
- package/dist/{api-DtOVNMSX.js → api-CiR56vZg.js} +1 -1
- package/dist/cjs/form/index.js +1 -1
- package/dist/cjs/index.js +2 -2
- 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.md → actions.mdx} +7 -0
- package/dist/docs/{api-keys.md → api-keys.mdx} +7 -0
- package/dist/docs/{conditions.md → conditions.mdx} +7 -0
- package/dist/docs/{experiences.md → experiences.mdx} +7 -0
- package/dist/docs/{features.md → features.mdx} +7 -0
- package/dist/docs/{fields.md → fields.mdx} +7 -0
- package/dist/docs/flow-builder/{overview.md → overview.mdx} +7 -0
- package/dist/docs/pickedql/data-sources.md +49 -2
- package/dist/docs/pickedql/dimensions.md +40 -0
- package/dist/docs/pickedql/examples.md +41 -1
- package/dist/docs/pickedql/filtering.md +22 -0
- package/dist/docs/pickedql/index.md +2 -1
- package/dist/docs/pickedql/schema.md +34 -1
- package/dist/docs/pickedql/virtual-functions.md +67 -11
- package/dist/docs/{projects.md → projects.mdx} +7 -0
- package/dist/docs/{reports.md → reports.mdx} +7 -0
- package/dist/docs/{steps.md → steps.mdx} +7 -0
- package/dist/docs/{workspaces.md → workspaces.mdx} +8 -0
- package/dist/esm/form/index.js +21 -6
- package/dist/esm/index.js +174 -174
- package/dist/esm/plugins/dynamic-experiences/index.js +1 -1
- package/dist/esm/plugins/experience-browser-storage/index.js +20 -18
- package/dist/esm/plugins/history-browser-storage/index.js +17 -15
- package/dist/esm/plugins/responses-browser-storage/index.js +21 -19
- package/dist/esm/plugins/responses-indexeddb/index.js +37 -35
- package/dist/esm/plugins/single-page-app/index.js +88 -42
- package/dist/esm/plugins/web-components/index.js +2 -2
- package/dist/esm/plugins/window-object/index.js +1 -1
- package/dist/esm/server/index.js +1 -1
- package/dist/{experience-CNIhapU2.js → experience-CR19HpPg.js} +2 -2
- package/dist/{experience-CTEBY-it.cjs → experience-DOWnsvA1.cjs} +1 -1
- package/dist/experience-instance-C2jZU8ho.cjs +1 -0
- package/dist/{experience-instance-B0tFPMAU.js → experience-instance-CGLdwg--.js} +12 -8
- package/dist/{nodes-2fst8XKi.js → nodes-Bmzx3TP_.js} +7 -7
- package/dist/{nodes-DBK4N9YY.cjs → nodes-Dx9bxj35.cjs} +1 -1
- package/dist/{rules-logic-D7dL30U1.js → rules-logic-CvILqbhz.js} +8 -5
- package/dist/{rules-logic-DJhGFqhC.cjs → rules-logic-DV5SUr5M.cjs} +1 -1
- package/dist/supports-DFDQ6eJO.cjs +1 -0
- package/dist/{supports-B_trw6lj.js → supports-DUJbucFW.js} +18 -9
- package/dist/types/entities/action/action.d.ts +30 -4
- package/dist/types/entities/action/action.d.ts.map +1 -1
- package/dist/types/entities/experience-instance/experience-instance.d.ts +4 -2
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/framework/framework.d.ts +12 -2
- 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 +3 -1
- 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 +64 -12
- package/dist/types/plugins/single-page-app/plugin.d.ts.map +1 -1
- package/dist/types/utils/global-obj.d.ts +5 -0
- package/dist/types/utils/global-obj.d.ts.map +1 -1
- package/dist/types/utils/supports.d.ts +113 -0
- package/dist/types/utils/supports.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/experience-instance-BN0RZG1b.cjs +0 -1
- package/dist/supports-CKSVYpQx.cjs +0 -1
|
@@ -1,33 +1,35 @@
|
|
|
1
1
|
import "../../../logger-C44jSdYl.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { f as e } from "../../../supports-DUJbucFW.js";
|
|
3
|
+
import { n as t, r as n, t as r } from "../../../storage-6Xk0uAxB.js";
|
|
4
|
+
import { createEffect as i, sample as a } from "effector";
|
|
4
5
|
//#region src/plugins/experience-browser-storage/plugin.ts
|
|
5
|
-
var
|
|
6
|
+
var o = ({ storage: o = "local" } = {}) => ({
|
|
6
7
|
name: "experience-browser-storage-plugin",
|
|
7
|
-
setup: (
|
|
8
|
-
|
|
8
|
+
setup: (s) => {
|
|
9
|
+
if (!e()) return;
|
|
10
|
+
let c = o === "local" ? t : n, l = i(async (e) => {
|
|
9
11
|
if (!e) return;
|
|
10
|
-
let t =
|
|
11
|
-
e.setOpen(
|
|
12
|
+
let t = r("open-close", "experience", e), n = c.get(t).boolean();
|
|
13
|
+
e.setOpen(n ?? e.isOpenStore.getState());
|
|
12
14
|
});
|
|
13
|
-
|
|
14
|
-
source:
|
|
15
|
+
a({
|
|
16
|
+
source: s.eventBus,
|
|
15
17
|
filter: (e) => e.type === "experience_initialize" && "experience" in e,
|
|
16
18
|
fn: (e) => e.experience,
|
|
17
|
-
target:
|
|
19
|
+
target: l
|
|
18
20
|
});
|
|
19
|
-
let
|
|
20
|
-
let t =
|
|
21
|
-
|
|
22
|
-
}),
|
|
21
|
+
let u = i(async (e) => {
|
|
22
|
+
let t = r("open-close", "experience", e), n = e.isOpenStore.getState();
|
|
23
|
+
c.set(t, n);
|
|
24
|
+
}), d = (e) => a({
|
|
23
25
|
source: e.isOpenStore,
|
|
24
26
|
fn: () => e,
|
|
25
|
-
target:
|
|
27
|
+
target: u
|
|
26
28
|
});
|
|
27
|
-
|
|
28
|
-
e.forEach((e) =>
|
|
29
|
+
s.experienceInstances.listStore.watch((e) => {
|
|
30
|
+
e.forEach((e) => d(e));
|
|
29
31
|
});
|
|
30
32
|
}
|
|
31
33
|
});
|
|
32
34
|
//#endregion
|
|
33
|
-
export {
|
|
35
|
+
export { o as experienceBrowserStoragePlugin };
|
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { f as e } from "../../../supports-DUJbucFW.js";
|
|
2
|
+
import { n as t, r as n, t as r } from "../../../storage-6Xk0uAxB.js";
|
|
3
|
+
import { createEffect as i, sample as a } from "effector";
|
|
3
4
|
//#region src/plugins/history-browser-storage/plugin.ts
|
|
4
|
-
var
|
|
5
|
+
var o = r("history", "global"), s = ({ storage: r = "local" } = {}) => ({
|
|
5
6
|
name: "history-browser-storage-plugin",
|
|
6
|
-
setup: (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
e
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
setup: (s) => {
|
|
8
|
+
if (!e()) return;
|
|
9
|
+
let c = r === "local" ? t : n, l = i(async () => {
|
|
10
|
+
let e = c.get(o).json();
|
|
11
|
+
e && s.history.restore({ entries: e });
|
|
12
|
+
}), u = i(async (e) => {
|
|
13
|
+
c.set(o, e);
|
|
12
14
|
});
|
|
13
|
-
|
|
14
|
-
source:
|
|
15
|
+
a({
|
|
16
|
+
source: s.eventBus,
|
|
15
17
|
filter: (e) => e.type === "load",
|
|
16
|
-
target: c
|
|
17
|
-
}), i({
|
|
18
|
-
source: o.history.entriesStore,
|
|
19
18
|
target: l
|
|
19
|
+
}), a({
|
|
20
|
+
source: s.history.entriesStore,
|
|
21
|
+
target: u
|
|
20
22
|
});
|
|
21
23
|
}
|
|
22
24
|
});
|
|
23
25
|
//#endregion
|
|
24
|
-
export {
|
|
26
|
+
export { s as historyBrowserStoragePlugin };
|
|
@@ -1,35 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { f as e } from "../../../supports-DUJbucFW.js";
|
|
2
|
+
import { n as t, r as n, t as r } from "../../../storage-6Xk0uAxB.js";
|
|
3
|
+
import { attach as i, createEffect as a, sample as o } from "effector";
|
|
3
4
|
//#region src/plugins/responses-browser-storage/plugin.ts
|
|
4
|
-
var
|
|
5
|
-
function
|
|
5
|
+
var s = r("responses", "global");
|
|
6
|
+
function c(e, t) {
|
|
6
7
|
return Object.fromEntries(Object.entries(e).flatMap(([e, n]) => t.find((t) => t.key === e)?.policies?.doNotStoreValue ? [] : [[e, n]]));
|
|
7
8
|
}
|
|
8
|
-
var
|
|
9
|
+
var l = ({ storage: r = "local" } = {}) => ({
|
|
9
10
|
name: "responses-browser-storage-plugin",
|
|
10
|
-
setup: (
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
setup: (l) => {
|
|
12
|
+
if (!e()) return;
|
|
13
|
+
let u = r === "local" ? t : n, d = a(async () => {
|
|
14
|
+
let e = u.get(s).json();
|
|
13
15
|
if (!e) return null;
|
|
14
|
-
|
|
15
|
-
}),
|
|
16
|
+
l.responses.register(e);
|
|
17
|
+
}), f = i({
|
|
16
18
|
source: {
|
|
17
|
-
responses:
|
|
18
|
-
fields:
|
|
19
|
+
responses: l.responses.getAllStore,
|
|
20
|
+
fields: l.fields.listStore
|
|
19
21
|
},
|
|
20
22
|
effect: ({ responses: e, fields: t }) => {
|
|
21
|
-
|
|
23
|
+
u.set(s, c(e, t));
|
|
22
24
|
}
|
|
23
25
|
});
|
|
24
|
-
|
|
25
|
-
source:
|
|
26
|
+
o({
|
|
27
|
+
source: l.eventBus,
|
|
26
28
|
filter: (e) => e.type === "load",
|
|
27
|
-
target: u
|
|
28
|
-
}), a({
|
|
29
|
-
source: c.responses.getAllStore,
|
|
30
29
|
target: d
|
|
30
|
+
}), o({
|
|
31
|
+
source: l.responses.getAllStore,
|
|
32
|
+
target: f
|
|
31
33
|
});
|
|
32
34
|
}
|
|
33
35
|
});
|
|
34
36
|
//#endregion
|
|
35
|
-
export {
|
|
37
|
+
export { l as responsesBrowserStoragePlugin };
|
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { f as e } from "../../../supports-DUJbucFW.js";
|
|
2
|
+
import { createEffect as t, sample as n } from "effector";
|
|
2
3
|
//#region src/utils/indexed-db.ts
|
|
3
|
-
var
|
|
4
|
-
async function
|
|
5
|
-
let { storeName: t, version:
|
|
4
|
+
var r = "picked";
|
|
5
|
+
async function i(e) {
|
|
6
|
+
let { storeName: t, version: n = 1, keyPath: i = "id" } = e;
|
|
6
7
|
return new Promise((e, a) => {
|
|
7
|
-
let o = indexedDB.open(
|
|
8
|
+
let o = indexedDB.open(r, n);
|
|
8
9
|
o.onupgradeneeded = () => {
|
|
9
10
|
let e = o.result;
|
|
10
11
|
e.objectStoreNames.contains(t) || e.createObjectStore(t, i ? { keyPath: i } : void 0);
|
|
11
12
|
}, o.onsuccess = () => e(o.result), o.onerror = () => a(Error(o.error?.message));
|
|
12
13
|
});
|
|
13
14
|
}
|
|
14
|
-
async function
|
|
15
|
+
async function a(e, t) {
|
|
15
16
|
return new Promise((n, r) => {
|
|
16
17
|
let i = e.transaction(t, "readonly").objectStore(t).getAll();
|
|
17
18
|
i.onsuccess = () => n(i.result), i.onerror = () => r(Error(i.error?.message));
|
|
18
19
|
});
|
|
19
20
|
}
|
|
20
|
-
async function
|
|
21
|
+
async function o(e, t, n) {
|
|
21
22
|
return new Promise((r, i) => {
|
|
22
23
|
let a = e.transaction(t, "readwrite").objectStore(t).put(n);
|
|
23
24
|
a.onsuccess = () => r(), a.onerror = () => i(Error(a.error?.message));
|
|
24
25
|
});
|
|
25
26
|
}
|
|
26
|
-
async function
|
|
27
|
+
async function s(e, t, n) {
|
|
27
28
|
return new Promise((r, i) => {
|
|
28
29
|
let a = e.transaction(t, "readwrite").objectStore(t).delete(n);
|
|
29
30
|
a.onsuccess = () => r(), a.onerror = () => i(Error(a.error?.message));
|
|
30
31
|
});
|
|
31
32
|
}
|
|
32
|
-
async function
|
|
33
|
+
async function c(e, t) {
|
|
33
34
|
return new Promise((n, r) => {
|
|
34
35
|
let i = e.transaction(t, "readwrite").objectStore(t).clear();
|
|
35
36
|
i.onsuccess = () => n(), i.onerror = () => r(Error(i.error?.message));
|
|
@@ -37,34 +38,35 @@ async function s(e, t) {
|
|
|
37
38
|
}
|
|
38
39
|
//#endregion
|
|
39
40
|
//#region src/plugins/responses-indexeddb/plugin.ts
|
|
40
|
-
var
|
|
41
|
-
storeName:
|
|
41
|
+
var l = "responses", u = {
|
|
42
|
+
storeName: l,
|
|
42
43
|
keyPath: "fieldKey",
|
|
43
44
|
version: 2
|
|
44
|
-
},
|
|
45
|
+
}, d = () => ({
|
|
45
46
|
name: "responses-indexdb-plugin",
|
|
46
|
-
setup: (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
await
|
|
50
|
-
|
|
47
|
+
setup: (r) => {
|
|
48
|
+
if (!e()) return;
|
|
49
|
+
let d = t(async () => {
|
|
50
|
+
let e = (await a(await i(u), l)).reduce((e, { fieldKey: t, value: n }) => (e[t] = n, e), {});
|
|
51
|
+
await r.responses.commit(e);
|
|
52
|
+
}), f = t(async (e) => {
|
|
51
53
|
await Promise.allSettled(e.map(async (e) => {
|
|
52
|
-
await
|
|
54
|
+
await o(await i(u), l, e);
|
|
53
55
|
}));
|
|
54
|
-
}),
|
|
55
|
-
await
|
|
56
|
-
}),
|
|
57
|
-
await
|
|
56
|
+
}), p = t(async () => {
|
|
57
|
+
await c(await i(u), l);
|
|
58
|
+
}), m = t(async (e) => {
|
|
59
|
+
await s(await i(u), l, e);
|
|
58
60
|
});
|
|
59
|
-
|
|
60
|
-
source:
|
|
61
|
+
n({
|
|
62
|
+
source: r.eventBus,
|
|
61
63
|
filter: (e) => e.type === "load",
|
|
62
|
-
target:
|
|
63
|
-
}),
|
|
64
|
-
clock:
|
|
64
|
+
target: d
|
|
65
|
+
}), n({
|
|
66
|
+
clock: r.responses.listStore,
|
|
65
67
|
source: {
|
|
66
|
-
responses:
|
|
67
|
-
fields:
|
|
68
|
+
responses: r.responses.listStore,
|
|
69
|
+
fields: r.fields.listStore
|
|
68
70
|
},
|
|
69
71
|
fn: ({ responses: e, fields: t }) => {
|
|
70
72
|
let n = new Set(t.filter((e) => !e.policies?.doNotStoreValue).map((e) => e.key));
|
|
@@ -73,15 +75,15 @@ var c = "responses", l = {
|
|
|
73
75
|
value: e.value
|
|
74
76
|
}));
|
|
75
77
|
},
|
|
76
|
-
target: d
|
|
77
|
-
}), t({
|
|
78
|
-
clock: n.responses.clearAll,
|
|
79
78
|
target: f
|
|
80
|
-
}),
|
|
81
|
-
clock:
|
|
79
|
+
}), n({
|
|
80
|
+
clock: r.responses.clearAll,
|
|
82
81
|
target: p
|
|
82
|
+
}), n({
|
|
83
|
+
clock: r.responses.clear,
|
|
84
|
+
target: m
|
|
83
85
|
});
|
|
84
86
|
}
|
|
85
87
|
});
|
|
86
88
|
//#endregion
|
|
87
|
-
export {
|
|
89
|
+
export { d as responsesIndexedDBPlugin };
|
|
@@ -1,55 +1,101 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { a as e, i as t } from "../../../rules-logic-CvILqbhz.js";
|
|
2
|
+
import { t as n } from "../../../logger-C44jSdYl.js";
|
|
3
|
+
import { c as r, f as i, i as a, p as o, r as s, s as c } from "../../../supports-DUJbucFW.js";
|
|
4
|
+
import { n as l } from "../../../experience-CR19HpPg.js";
|
|
4
5
|
//#region src/plugins/single-page-app/plugin.ts
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
var u = o, d = 1e3, f = 150, p = /* @__PURE__ */ new WeakMap(), m = /* @__PURE__ */ new WeakSet(), h = (e = {}) => {
|
|
7
|
+
let t = _(e), n = e.instrumentHistory !== !1;
|
|
8
|
+
return {
|
|
9
|
+
name: "single-page-app",
|
|
10
|
+
setup: (e) => {
|
|
11
|
+
i() && (m.has(e) || (m.add(e), x(() => v(e, t), { fallbackToHistory: n })));
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
function g(e) {
|
|
16
|
+
i() && v(e, {
|
|
17
|
+
maxWindowMs: d,
|
|
18
|
+
idleDebounceMs: f
|
|
19
|
+
});
|
|
13
20
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
21
|
+
function _(e) {
|
|
22
|
+
return {
|
|
23
|
+
maxWindowMs: e.maxWindowMs ?? d,
|
|
24
|
+
idleDebounceMs: e.idleDebounceMs ?? f
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function v(e, t) {
|
|
28
|
+
p.get(e)?.stop();
|
|
29
|
+
let n = y(e, t);
|
|
30
|
+
n && p.set(e, n);
|
|
16
31
|
}
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
32
|
+
function y(e, t) {
|
|
33
|
+
if (!b()) return;
|
|
34
|
+
let r = !1, i = !1, a = !1, o, s, c, u, d, f = () => {
|
|
35
|
+
r || (r = !0, u !== void 0 && (cancelAnimationFrame(u), u = void 0), d !== void 0 && (cancelAnimationFrame(d), d = void 0), o &&= (o.disconnect(), void 0), s !== void 0 && (clearTimeout(s), s = void 0), c !== void 0 && (clearTimeout(c), c = void 0));
|
|
36
|
+
}, p = () => {
|
|
37
|
+
if (!r) {
|
|
38
|
+
if (i) {
|
|
39
|
+
a = !0;
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
i = !0, Promise.resolve(l(e)).catch((e) => /* @__PURE__ */ n("error", e)).finally(() => {
|
|
43
|
+
i = !1, a && !r && (a = !1, m());
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}, m = () => {
|
|
47
|
+
r || d !== void 0 || (d = requestAnimationFrame(() => {
|
|
48
|
+
d = void 0, p();
|
|
49
|
+
}));
|
|
50
|
+
}, h = () => {
|
|
51
|
+
c !== void 0 && clearTimeout(c), c = setTimeout(f, t.idleDebounceMs);
|
|
22
52
|
};
|
|
23
|
-
requestAnimationFrame(
|
|
24
|
-
|
|
25
|
-
c(), r !== void 0 && clearTimeout(r), r = setTimeout(a, s);
|
|
53
|
+
u = requestAnimationFrame(() => {
|
|
54
|
+
u = void 0, p();
|
|
26
55
|
});
|
|
27
|
-
|
|
56
|
+
let g = new MutationObserver(() => {
|
|
57
|
+
r || (m(), h());
|
|
58
|
+
});
|
|
59
|
+
return g.observe(document.body, {
|
|
28
60
|
childList: !0,
|
|
29
61
|
subtree: !0
|
|
30
|
-
}),
|
|
62
|
+
}), o = g, s = setTimeout(f, t.maxWindowMs), { stop: f };
|
|
63
|
+
}
|
|
64
|
+
function b() {
|
|
65
|
+
return !(!s() || typeof MutationObserver != "function" || typeof requestAnimationFrame != "function" || !document.body);
|
|
31
66
|
}
|
|
32
|
-
function
|
|
33
|
-
if (
|
|
34
|
-
let
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
67
|
+
function x(e, t = { fallbackToHistory: !0 }) {
|
|
68
|
+
if (r()) {
|
|
69
|
+
let t = u.navigation;
|
|
70
|
+
if (t) {
|
|
71
|
+
let n = u.location.href;
|
|
72
|
+
t.addEventListener("navigatesuccess", () => {
|
|
73
|
+
let t = u.location.href, r = n;
|
|
74
|
+
n = t, r !== t && e();
|
|
75
|
+
});
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
t.fallbackToHistory && S(e);
|
|
80
|
+
}
|
|
81
|
+
function S(n) {
|
|
82
|
+
let r = c() ? u.location.href : void 0;
|
|
83
|
+
if (u.addEventListener("popstate", () => {
|
|
84
|
+
let e = u.location.href, t = r;
|
|
85
|
+
r = e, t !== e && n();
|
|
86
|
+
}), !a() || t(u.history.pushState) && t(u.history.replaceState)) return;
|
|
87
|
+
function i(e) {
|
|
88
|
+
return function(...t) {
|
|
89
|
+
let i = t.length > 2 ? t[2] : void 0;
|
|
90
|
+
if (i) {
|
|
91
|
+
let a = r, o = String(i);
|
|
92
|
+
if (r = o, a === o) return e.apply(this, t);
|
|
93
|
+
n();
|
|
44
94
|
}
|
|
45
|
-
return e.apply(this,
|
|
95
|
+
return e.apply(this, t);
|
|
46
96
|
};
|
|
47
97
|
}
|
|
48
|
-
e(
|
|
49
|
-
let i = a.history.pushState, o = a.history.replaceState;
|
|
50
|
-
queueMicrotask(() => {
|
|
51
|
-
(a.history.pushState !== i || a.history.replaceState !== o) && console.warn("@picked/client: window.history.pushState was re-wrapped by another script after Picked's instrumentation. SPA reconciliation will not fire on route changes through that wrapper. Call notifyNavigation(picked) from your router (e.g. React Router useEffect on location, SvelteKit afterNavigate) to trigger reconciliation explicitly.");
|
|
52
|
-
});
|
|
98
|
+
e(u.history, "pushState", i), e(u.history, "replaceState", i);
|
|
53
99
|
}
|
|
54
100
|
//#endregion
|
|
55
|
-
export {
|
|
101
|
+
export { g as notifyNavigation, h as singlePageAppPlugin };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { d as e,
|
|
1
|
+
import { d as e, f as t } from "../../../supports-DUJbucFW.js";
|
|
2
2
|
//#region src/plugins/web-components/plugin.ts
|
|
3
3
|
var n = () => ({
|
|
4
4
|
name: "web-components",
|
|
5
5
|
setup: (n) => {
|
|
6
|
-
if (!
|
|
6
|
+
if (!t() || !e()) return;
|
|
7
7
|
let r = "picked-root";
|
|
8
8
|
if (window.customElements.get(r)) return;
|
|
9
9
|
class i extends HTMLElement {
|
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-CGLdwg--.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() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as e, t } from "./rules-logic-
|
|
1
|
+
import { n as e, t } from "./rules-logic-CvILqbhz.js";
|
|
2
2
|
import "./logger-C44jSdYl.js";
|
|
3
|
-
import { a as n, f as r, l as i, n as a, o } from "./nodes-
|
|
3
|
+
import { a as n, f as r, l as i, n as a, o } from "./nodes-Bmzx3TP_.js";
|
|
4
4
|
import { attach as s, combine as c, createApi as l, createDomain as u } from "effector";
|
|
5
5
|
import { createFactory as d, invoke as f } from "@withease/factories";
|
|
6
6
|
//#region src/entities/experience/experience.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./rules-logic-
|
|
1
|
+
const e=require(`./rules-logic-DV5SUr5M.cjs`);require(`./logger-CJUj90QX.cjs`);const t=require(`./nodes-Dx9bxj35.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}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./rules-logic-DV5SUr5M.cjs`);require(`./logger-CJUj90QX.cjs`);const t=require(`./nodes-Dx9bxj35.cjs`);let n=require(`effector`),r=require(`@withease/factories`);var i=(e,n,r,a,o=new Set)=>o.has(r.id)?[]:(o.add(r.id),t.a(r)&&!a?[r]:n.filter(e=>e.sourceNodeId===r.id).flatMap(t=>{let r=e.find(e=>e.id===t.destinationNodeId);return r?i(e,n,r,!1,o):[]})),a=(e,t,n)=>i(e,t,n,!0,new Set),o=(e,t,n,r,i=new Set)=>{if(i.has(n.id))return[-1,-1];i.add(n.id);let a=t.filter(e=>e.sourceNodeId===n.id);if(a.length===0)return[0,0];let s=1/0,c=-1/0;for(let n of a){let r=e.find(e=>e.id===n.destinationNodeId);if(!r)continue;let[a,l]=o(e,t,r,!1,new Set(i));a!==-1&&(s=Math.min(s,a+1),c=Math.max(c,l+1))}return s===1/0?[-1,-1]:[s,c]},s=(e,t,n)=>o(e,t,n,!0,new Set),c=(e,t,n,r=new Set)=>{if(r.has(n.id))return[-1,-1];if(r.add(n.id),n.type===`origin`)return[0,0];let i=t.filter(e=>e.destinationNodeId===n.id);if(i.length===0)return[-1,-1];let a=1/0,o=-1/0;for(let n of i){let i=e.find(e=>e.id===n.sourceNodeId);if(!i)continue;let[s,l]=c(e,t,i,new Set(r));s!==-1&&(a=Math.min(a,s+1),o=Math.max(o,l+1))}return a===1/0?[-1,-1]:[a,o]},l=(e,t,n)=>c(e,t,n,new Set),u=e=>e.find(e=>e.type===`origin`)||null,d=(e,t,n)=>{if(!e)return u(t);let r=n.find(t=>t.sourceNodeId===e.id);return r&&t.find(e=>e.id===r.destinationNodeId)||null};async function f(e,t,n,r){let i=e?`true`:`false`,a=r.find(e=>e.sourceHandle===i&&e.sourceNodeId===t);return n.find(e=>e.id===a?.destinationNodeId)}var p=(0,n.createDomain)(`experience-instance`),m=(0,r.createFactory)(({client:r,experience:i,target:o,options:c})=>{let m=(0,n.createEvent)(),h=(0,n.createEvent)(),g=(0,n.createEvent)(),_=(0,n.createEvent)(),v=(0,n.createEvent)(),y=(0,n.createEvent)(),b=i.componentStore,x=p.store(`transitioning`),S=r.history.entriesStore.map(e=>e.filter(e=>e.experienceId===i.id)),C=S.map(e=>e.filter(e=>t.a(e.node))),w=S.map(e=>e.at(-1)?.node||null),T=(0,n.combine)(r.steps.listStore,w,(e,n)=>e.find(e=>n&&t.a(n)&&e.id===n.stepId)||null),E=(0,n.combine)(r.steps.listStore,C,(e,n)=>{let r=n.at(-2);if(!r||!t.a(r.node))return null;let i=r.node;return e.find(e=>e.id===i.stepId)||null}),D=(0,n.combine)(i.treeStore,w,({nodes:e,edges:t},n)=>n?a(e,t,n):[]),O=(0,n.combine)(i.treeStore,w,({nodes:e,edges:t},n)=>n?l(e,t,n):[-1,-1]),k=(0,n.combine)(i.treeStore,w,({nodes:e,edges:t},n)=>n?s(e,t,n):[-1,-1]),A=p.store(!1),j=(0,n.createApi)(A,{open:()=>!0,close:()=>!1,toggle:e=>!e,set:(e,t)=>t}),M=(0,n.createEffect)(async()=>{r.history.back({experienceId:i.id})}),N=(0,n.attach)({source:i.treeStore,effect:async(e,n)=>{let a=e.nodes.find(e=>t.a(e)&&e.stepId===n);a&&r.history.push({experienceId:i.id,node:a})}}),P=(0,n.attach)({source:w,effect:e=>{}}),F=(0,n.attach)({source:i.treeStore,effect:async({nodes:e})=>u(e)}),I=(0,n.attach)({source:i.treeStore,effect:async({nodes:e,edges:n},r)=>{if(t.i(r))return d(r,e,n)}}),L=(0,n.attach)({source:i.treeStore,effect:async({nodes:n,edges:i,conditions:a},o)=>{if(!t.n(o))return;let s=a.find(e=>e.id===o.conditionId)?.logic;return s?f(!!await e.t(r,s),o.id,n,i):void 0}}),R=(0,n.attach)({source:i.treeStore,effect:async({nodes:e,edges:n},i)=>{if(!t.t(i))return;let a=i.actionKey;if(!a){`${i.id}`;return}let o=r.actions.getByKey(a).getState();if(!o){`${a}`;let t=n.find(e=>e.sourceNodeId===i.id&&e.sourceHandle===`false`);return t?e.find(e=>e.id===t.destinationNodeId):null}if(typeof o!=`function`){`${a}`;let t=n.find(e=>e.sourceNodeId===i.id&&e.sourceHandle===`false`);return t?e.find(e=>e.id===t.destinationNodeId):null}try{`${a}`,await o({...r.getStateSnapshot(),args:[]},{experience:W});let t=n.find(e=>e.sourceNodeId===i.id&&e.sourceHandle===`true`);if(!t)return`${i.id}`,null;let s=e.find(e=>e.id===t.destinationNodeId);return`${a}${s?.id}`,s||null}catch{`${a}`;let t=n.find(e=>e.sourceNodeId===i.id&&e.sourceHandle===`false`);if(!t)return`${i.id}`,null;let r=e.find(e=>e.id===t.destinationNodeId);return`${a}${r?.id}`,r||null}}}),z=(0,n.createEffect)(e=>{t.r(e)&&r.experiences.launch({key:e.experienceKey})}),B=(0,n.attach)({source:[w,i.treeStore],effect:async([e,{nodes:t,edges:n}])=>d(e,t,n)}),V=(0,n.attach)({source:[w,i.treeStore],effect:async([e,{nodes:t,edges:n}])=>d(e,t,n)}),H=(0,n.createEffect)(e=>{r.history.push({experienceId:i.id,node:e})}),U=(0,n.attach)({source:i.configStore,effect:async({initializeOpenLogic:t})=>c?.initialiseOpen===void 0?e.n(t)?!!await e.t(r,t):t??!1:c.initialiseOpen}),W=Object.freeze({id:Math.random().toString(36).substring(7),experienceKey:i.key,experienceId:i.id,configStore:i.configStore,target:o,componentStore:b,stateStore:x,isOpenStore:A,open:j.open,close:j.close,toggleOpen:j.toggle,setOpen:j.set,treeStore:i.treeStore,currentNodeStore:w,currentStepStore:T,previousStepStore:E,nextReachableStepNodesStore:D,stepsToOriginStore:O,stepsToLeafStore:k,goToNextStep:h,goToPreviousStep:g,goToStepById:_,stepsHistoryStore:C}),G=(0,n.createEvent)(),K=(0,n.createEvent)();return(0,n.sample)({clock:w,target:G}),(0,n.sample)({clock:G,filter:e=>e===null,target:F}),(0,n.sample)({clock:G,filter:e=>e!==null,target:K}),(0,n.split)({source:K,match:e=>t.n(e)?`condition`:t.a(e)?`step`:t.r(e)?`launchExperience`:t.i(e)?`origin`:t.t(e)?`action`:`other`,cases:{origin:I,condition:L,step:P,launchExperience:z,action:R,__:(0,n.createEvent)()}}),(0,n.sample)({clock:[L.doneData,I.doneData,F.doneData,V.doneData,B.doneData,R.doneData],filter:Boolean,target:H}),(0,n.sample)({clock:h,target:V}),(0,n.sample)({clock:h,source:T,filter:Boolean,target:r.eventBus.prepend(e=>({type:`step_submit`,step:e,experience:W}))}),(0,n.sample)({clock:V.done,source:T,filter:Boolean,target:r.eventBus.prepend(e=>({type:`step_submit_success`,step:e,experience:W}))}),(0,n.sample)({clock:V.fail,source:T,filter:Boolean,target:r.eventBus.prepend(e=>({type:`step_submit_error`,step:e,experience:W}))}),(0,n.sample)({clock:g,target:M}),(0,n.sample)({clock:_,target:N}),(0,n.sample)({source:(0,n.combine)([L.pending,I.pending,F.pending,V.pending]),fn:e=>e.some(Boolean)?`transitioning`:`ready`,target:x}),(0,n.sample)({clock:P.doneData,source:T,filter:Boolean,target:r.eventBus.prepend(e=>({type:`step_enter`,step:e,experience:W}))}),(0,n.sample)({clock:y,target:U}),(0,n.sample)({source:U.doneData,fn:Boolean,target:A}),(0,n.sample)({source:w,clock:m,filter:e=>e?t.i(e):!0,target:B}),(0,n.sample)({source:A,filter:Boolean,target:m}),(0,n.sample)({source:A,filter:Boolean,target:r.eventBus.prepend(()=>({type:`experience_open`,experience:W}))}),(0,n.sample)({source:A,filter:e=>!e,target:r.eventBus.prepend(()=>({type:`experience_close`,experience:W}))}),(0,n.sample)({clock:v,target:[y]}),v(),W});function h(e){return(0,r.invoke)(m,e)}var g=(0,r.createFactory)(({client:e})=>{let r=p.store({}),i=(0,n.createEvent)(),a=(0,n.createEvent)(),o=(0,n.createEvent)(),s=(0,n.createApi)(r,{register(e,t){let n=[...e[t.experienceId]??[]];return n.push(t),{...e,[t.experienceId]:n}},unregister(e,t){let n=t.experienceId,r=e[n]?.filter(e=>e!==t);return{...e,[n]:r??[]}}}),c=(0,n.createEffect)(({experience:t,target:n,options:r})=>h({client:e,experience:t,target:n,options:r})),l=(0,n.createEffect)(e=>{s.register(e)}),u=(0,n.createEffect)(e=>{e.target&&t.d(e.target,()=>{o(e)})}),d=(0,n.createEffect)(e=>{s.unregister(e)}),f=(0,n.createEffect)(async e=>{let t=e.componentStore.getState();if(!t)return;let n=t.frameworkStore.getState();if(!n)return;let r=e.target?.shadowRoot;if(r)try{await n.unRender(r)}catch{}}),m=(0,n.createEffect)(n=>{let r=n.componentStore.getState();if(!r)return;let i=r.frameworkStore.getState();if(!i){`${r.name}`;return}let a=n.target;if(!a){`${n.experienceId}`;return}try{let o=a.shadowRoot??t.s(a);i.render(o,r.component,e,n)}catch{}});(0,n.sample)({clock:i,target:c}),(0,n.sample)({clock:o,target:f}),(0,n.sample)({clock:f.finally,fn:({params:e})=>e,target:d}),(0,n.sample)({clock:c.doneData,target:[l,u,a]}),(0,n.sample)({clock:c.doneData,target:e.eventBus.prepend(e=>({type:`experience_initialize`,experience:e}))}),(0,n.sample)({clock:a,target:m});function g(e,t,n){i({experience:e,target:t,options:n})}let _=r.map(e=>Object.values(e).flat());function v(e){return _.map(t=>t.filter(t=>t.experienceKey===e),{skipVoid:!1})}function y(e){return r.map(t=>t[e]||[],{skipVoid:!1})}return{spawn:g,getByExperienceKey:v,getByExperienceId:y,listStore:_}});function _(e){return(0,r.invoke)(g,e)}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return h}});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as e, t } from "./rules-logic-
|
|
1
|
+
import { n as e, t } from "./rules-logic-CvILqbhz.js";
|
|
2
2
|
import "./logger-C44jSdYl.js";
|
|
3
|
-
import { a as n, d as r, i, n as a, r as o, s, t as c } from "./nodes-
|
|
3
|
+
import { a as n, d as r, i, n as a, r as o, s, t as c } from "./nodes-Bmzx3TP_.js";
|
|
4
4
|
import { attach as l, combine as u, createApi as d, createDomain as f, createEffect as p, createEvent as m, sample as h, split as g } from "effector";
|
|
5
5
|
import { createFactory as _, invoke as v } from "@withease/factories";
|
|
6
6
|
//#region src/utils/node-tree/next-reachable-step-nodes.ts
|
|
@@ -110,7 +110,7 @@ var O = f("experience-instance"), k = _(({ client: r, experience: s, target: f,
|
|
|
110
110
|
`${i}`, await a({
|
|
111
111
|
...r.getStateSnapshot(),
|
|
112
112
|
args: []
|
|
113
|
-
});
|
|
113
|
+
}, { experience: Z });
|
|
114
114
|
let o = t.find((e) => e.sourceNodeId === n.id && e.sourceHandle === "true");
|
|
115
115
|
if (!o) return `${n.id}`, null;
|
|
116
116
|
let s = e.find((e) => e.id === o.destinationNodeId);
|
|
@@ -318,14 +318,14 @@ var j = _(({ client: e }) => {
|
|
|
318
318
|
});
|
|
319
319
|
}), f = p((e) => {
|
|
320
320
|
o.unregister(e);
|
|
321
|
-
}), g = p((e) => {
|
|
321
|
+
}), g = p(async (e) => {
|
|
322
322
|
let t = e.componentStore.getState();
|
|
323
323
|
if (!t) return;
|
|
324
324
|
let n = t.frameworkStore.getState();
|
|
325
|
-
if (!n
|
|
325
|
+
if (!n) return;
|
|
326
326
|
let r = e.target?.shadowRoot;
|
|
327
327
|
if (r) try {
|
|
328
|
-
n.unRender(r);
|
|
328
|
+
await n.unRender(r);
|
|
329
329
|
} catch {}
|
|
330
330
|
}), _ = p((t) => {
|
|
331
331
|
let n = t.componentStore.getState();
|
|
@@ -340,8 +340,8 @@ var j = _(({ client: e }) => {
|
|
|
340
340
|
`${t.experienceId}`;
|
|
341
341
|
return;
|
|
342
342
|
}
|
|
343
|
-
let a = s(i);
|
|
344
343
|
try {
|
|
344
|
+
let a = i.shadowRoot ?? s(i);
|
|
345
345
|
r.render(a, n.component, e, t);
|
|
346
346
|
} catch {}
|
|
347
347
|
});
|
|
@@ -350,7 +350,11 @@ var j = _(({ client: e }) => {
|
|
|
350
350
|
target: c
|
|
351
351
|
}), h({
|
|
352
352
|
clock: a,
|
|
353
|
-
target:
|
|
353
|
+
target: g
|
|
354
|
+
}), h({
|
|
355
|
+
clock: g.finally,
|
|
356
|
+
fn: ({ params: e }) => e,
|
|
357
|
+
target: f
|
|
354
358
|
}), h({
|
|
355
359
|
clock: c.doneData,
|
|
356
360
|
target: [
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { f as e, r as t, u as n } from "./supports-DUJbucFW.js";
|
|
2
2
|
//#region src/utils/dom.ts
|
|
3
|
-
function r(
|
|
4
|
-
return !e() || !
|
|
3
|
+
function r(n) {
|
|
4
|
+
return !e() || !t() ? [] : Array.from(window.document.querySelectorAll(n)).filter((e) => e instanceof HTMLElement);
|
|
5
5
|
}
|
|
6
6
|
var i = "open";
|
|
7
7
|
function a(e) {
|
|
8
|
-
if (!
|
|
8
|
+
if (!n()) throw Error("Shadow DOM is not supported in this environment");
|
|
9
9
|
return e.attachShadow({ mode: i });
|
|
10
10
|
}
|
|
11
11
|
function o() {
|
|
12
|
-
return new Promise((e,
|
|
13
|
-
if (!
|
|
14
|
-
|
|
12
|
+
return new Promise((e, n) => {
|
|
13
|
+
if (!t()) {
|
|
14
|
+
n();
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
17
|
document.readyState === "loading" ? document.addEventListener("readystatechange", () => e(), { once: !0 }) : e();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./supports-
|
|
1
|
+
const e=require(`./supports-DFDQ6eJO.cjs`);function t(t){return!e.f()||!e.r()?[]:Array.from(window.document.querySelectorAll(t)).filter(e=>e instanceof HTMLElement)}var n=`open`;function r(t){if(!e.u())throw Error(`Shadow DOM is not supported in this environment`);return t.attachShadow({mode:n})}function i(){return new Promise((t,n)=>{if(!e.r()){n();return}document.readyState===`loading`?document.addEventListener(`readystatechange`,()=>t(),{once:!0}):t()})}function a(e,t){let n=new MutationObserver(r=>{document.contains(e)||(n.disconnect(),t())});n.observe(document.body,{childList:!0,subtree:!0})}var o=`picked-root`,s=`picked-target`,c=`picked-root`;function l(e,n){return[...e,{selector:`${c}[experience-id="${n}"]`,placement:`replace`}].flatMap(e=>{let r=t(e.selector).filter(e=>!f(e,n)&&!p(e,n));return{...e,elements:r}})}function u(e,t,n){return e.flatMap(e=>e.elements.map(r=>h(r,e.placement,t,n)))}function d(e,t){e.classList.add(s),e.classList.add(`${s}-${t}`)}function f(e,t){return t?e.classList.contains(`${s}-${t}`):e.classList.contains(`${s}`)}function p(e,t){return t?e.classList.contains(`${o}-${t}`):e.classList.contains(o)}function m(e,t){let n=document.createElement(`div`);return n.style.display=`block`,n.classList.add(o),n.classList.add(`${o}-${e}`),n.classList.add(`${o}-${t}`),n}function h(e,t,n,r){let i,a=m(n,r);if(e instanceof Document)i=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;case`append`:e.append(a);break}i=a}return i}function g(e){return e.type===`condition`}function _(e){return e.type===`step`}function v(e){return e.type===`experience`}function y(e){return e.type===`origin`}function b(e){return e.type===`action`}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return p}});
|
|
@@ -213,14 +213,17 @@ function p(e, t) {
|
|
|
213
213
|
t.prototype = n, e.prototype = n, f(e, "__picked_original", t);
|
|
214
214
|
}
|
|
215
215
|
function m(e) {
|
|
216
|
+
return typeof e == "function" && "__picked_original" in e;
|
|
217
|
+
}
|
|
218
|
+
function h(e) {
|
|
216
219
|
return e === void 0 || typeof e == "object" && !!e && e.constructor === Object && Object.keys(e).length === 0;
|
|
217
220
|
}
|
|
218
221
|
//#endregion
|
|
219
222
|
//#region src/utils/rules-logic.ts
|
|
220
|
-
function
|
|
221
|
-
return !
|
|
223
|
+
function g(e) {
|
|
224
|
+
return !h(e);
|
|
222
225
|
}
|
|
223
|
-
async function
|
|
226
|
+
async function _(e, t, n) {
|
|
224
227
|
let r = e.getStateSnapshot(), i = e.predicates.listStore.getState().reduce((e, t) => ({
|
|
225
228
|
...e,
|
|
226
229
|
[t.name]: (...e) => t.predicate({
|
|
@@ -232,7 +235,7 @@ async function g(e, t, n) {
|
|
|
232
235
|
[t.key]: (...e) => t.action({
|
|
233
236
|
...r,
|
|
234
237
|
args: e
|
|
235
|
-
})
|
|
238
|
+
}, null)
|
|
236
239
|
}), {}), o = e.features.listStore.getState().reduce((e, t) => ({
|
|
237
240
|
...e,
|
|
238
241
|
[t.id]: async () => {
|
|
@@ -260,4 +263,4 @@ async function g(e, t, n) {
|
|
|
260
263
|
});
|
|
261
264
|
}
|
|
262
265
|
//#endregion
|
|
263
|
-
export { d as i,
|
|
266
|
+
export { d as a, m as i, g as n, h as r, _ as t };
|