@picked/client 0.0.62-next.2 → 0.0.62-next.4
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-Cfb-8mqu.js → api-D-_eTc_P.js} +1 -1
- package/dist/{api-C-Q9t21v.cjs → api-EHKlffsC.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/dom-observer/index.js +1 -0
- 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/single-page-app/index.js +1 -1
- package/dist/cjs/plugins/web-components/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/dom-C3C6Fmwz.cjs +1 -0
- package/dist/dom-DGePXPpM.js +84 -0
- package/dist/esm/form/index.js +1 -1
- package/dist/esm/index.js +948 -469
- package/dist/esm/plugins/create-experience/index.js +1 -1
- package/dist/esm/plugins/dom-observer/index.js +87 -0
- package/dist/esm/plugins/dynamic-experiences/index.js +51 -49
- package/dist/esm/plugins/experience-browser-storage/index.js +9 -6
- package/dist/esm/plugins/history-browser-storage/index.js +1 -1
- package/dist/esm/plugins/responses-browser-storage/index.js +1 -1
- package/dist/esm/plugins/single-page-app/index.js +1 -1
- package/dist/esm/plugins/web-components/index.js +1 -1
- package/dist/esm/server/index.js +23 -13
- package/dist/experience-instance-DImym3m_.js +419 -0
- package/dist/experience-instance-DygAdzbn.cjs +1 -0
- package/dist/rules-logic-D_CVBuv7.js +13 -0
- package/dist/rules-logic-H6P8xwHF.cjs +1 -0
- package/dist/types/entities/action/action.d.ts +6 -3
- package/dist/types/entities/action/action.d.ts.map +1 -1
- package/dist/types/entities/component/component.d.ts +39 -2
- package/dist/types/entities/component/component.d.ts.map +1 -1
- package/dist/types/entities/experience/experience.d.ts +49 -113
- package/dist/types/entities/experience/experience.d.ts.map +1 -1
- package/dist/types/entities/experience-instance/experience-instance.d.ts +17 -2
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/feature/feature.d.ts +26 -2
- package/dist/types/entities/feature/feature.d.ts.map +1 -1
- package/dist/types/entities/field/field.d.ts.map +1 -1
- package/dist/types/entities/framework/framework.d.ts +24 -3
- package/dist/types/entities/framework/framework.d.ts.map +1 -1
- package/dist/types/entities/plugin/plugin.d.ts +32 -1
- package/dist/types/entities/plugin/plugin.d.ts.map +1 -1
- package/dist/types/entities/predicate/predicate.d.ts +24 -3
- package/dist/types/entities/predicate/predicate.d.ts.map +1 -1
- package/dist/types/entities/session/session.d.ts +45 -0
- package/dist/types/entities/session/session.d.ts.map +1 -0
- package/dist/types/exports.d.ts +8 -4
- package/dist/types/exports.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lifecycle/lifecycle.d.ts +47 -0
- package/dist/types/lifecycle/lifecycle.d.ts.map +1 -0
- package/dist/types/lifecycle/rules-logic.d.ts +24 -0
- package/dist/types/lifecycle/rules-logic.d.ts.map +1 -0
- package/dist/types/lifecycle/state-snapshot.d.ts +37 -0
- package/dist/types/lifecycle/state-snapshot.d.ts.map +1 -0
- package/dist/types/logic-engine.d.ts +1 -1
- package/dist/types/logic-engine.d.ts.map +1 -1
- package/dist/types/picked.d.ts +102 -186
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/dom-observer/index.d.ts +3 -0
- package/dist/types/plugins/dom-observer/index.d.ts.map +1 -0
- package/dist/types/plugins/dom-observer/plugin.d.ts +50 -0
- package/dist/types/plugins/dom-observer/plugin.d.ts.map +1 -0
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
- package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/plugins/web-components/plugin.d.ts.map +1 -1
- package/dist/types/server/index.d.ts +7 -0
- package/dist/types/server/index.d.ts.map +1 -1
- package/dist/types/utils/events.d.ts +1 -1
- package/dist/types/utils/events.d.ts.map +1 -1
- package/dist/types/utils/rules-logic.d.ts +4 -9
- package/dist/types/utils/rules-logic.d.ts.map +1 -1
- package/package.json +12 -2
- package/dist/experience-instance-DC2gKwA6.cjs +0 -1
- package/dist/experience-instance-DJaNc5Ob.js +0 -486
- package/dist/rules-logic-BTIxfrJJ.js +0 -240
- package/dist/rules-logic-DNLOv90w.cjs +0 -1
- package/dist/types/utils/state-snaphot.d.ts +0 -26
- package/dist/types/utils/state-snaphot.d.ts.map +0 -1
- package/dist/types/utils/user-session.d.ts +0 -12
- package/dist/types/utils/user-session.d.ts.map +0 -1
- /package/dist/{id-Bv44ilEo.cjs → id-Cg7fVl1O.cjs} +0 -0
- /package/dist/{id-CRqy981z.js → id-n2yrHvNo.js} +0 -0
- /package/dist/{object-C82v79xc.js → object-DvUDOytC.js} +0 -0
- /package/dist/{object-CUJOjanb.cjs → object-ThO1DEyl.cjs} +0 -0
- /package/dist/{storage-B6lQtc4-.cjs → storage-BXSlLTRa.cjs} +0 -0
- /package/dist/{storage-6Xk0uAxB.js → storage-hOHCCXvP.js} +0 -0
package/dist/esm/index.js
CHANGED
|
@@ -1,108 +1,143 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as n } from "../
|
|
1
|
+
import { t as e } from "../object-DvUDOytC.js";
|
|
2
|
+
import { n as t, t as n } from "../rules-logic-D_CVBuv7.js";
|
|
3
3
|
import { t as r } from "../logger-6z_gb4rA.js";
|
|
4
4
|
import { a as i, c as a, d as o, i as s, l as c, n as l, o as u, p as d, r as f, s as p, t as m, u as h } from "../supports-0XIfd4-R.js";
|
|
5
|
-
import { a as g,
|
|
6
|
-
import { i as
|
|
7
|
-
import { n as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
5
|
+
import { a as g, i as _, r as ee, s as v, t as y } from "../dom-DGePXPpM.js";
|
|
6
|
+
import { i as b, n as x, r as S } from "../experience-instance-DImym3m_.js";
|
|
7
|
+
import { i as C, n as w, r as T, t as E } from "../storage-hOHCCXvP.js";
|
|
8
|
+
import { n as D, r as te } from "../api-D-_eTc_P.js";
|
|
9
|
+
import { t as ne } from "../id-n2yrHvNo.js";
|
|
10
|
+
import { attach as O, combine as k, createApi as A, createDomain as j, createEffect as M, createEvent as N, createStore as P, sample as F } from "effector";
|
|
11
|
+
import { createFactory as I, invoke as L } from "@withease/factories";
|
|
11
12
|
//#region src/entities/experience/experience.ts
|
|
12
|
-
var
|
|
13
|
-
let
|
|
13
|
+
var re = j("experience"), ie = I(({ client: e, experience: r }) => {
|
|
14
|
+
let i = re.store(r), a = A(i, { merge(e, t) {
|
|
14
15
|
return {
|
|
15
16
|
...e,
|
|
16
17
|
...t.experience
|
|
17
18
|
};
|
|
18
|
-
} }),
|
|
19
|
+
} }), o = i.map((e) => ({
|
|
19
20
|
name: e.name,
|
|
20
21
|
decisionLogic: e.condition,
|
|
21
22
|
targetSelectors: e.targets,
|
|
22
23
|
initializeOpenLogic: e.initializeOpen
|
|
23
|
-
})),
|
|
24
|
-
let r = e.nodes.filter(
|
|
24
|
+
})), s = k(i, 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 }), c = k(i, e.steps.indexStore, e.conditions.indexStore, (e, t, n) => {
|
|
25
|
+
let r = e.nodes.filter(b).map((e) => t[e.stepId]).filter((e) => e !== void 0), i = e.nodes.filter(S).map((e) => n[e.conditionId]).filter((e) => e !== void 0);
|
|
25
26
|
return {
|
|
26
27
|
steps: r,
|
|
27
28
|
nodes: e.nodes,
|
|
28
29
|
edges: e.edges,
|
|
29
30
|
conditions: i
|
|
30
31
|
};
|
|
31
|
-
}),
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
32
|
+
}), l = r.actions ?? [], u, d = O({
|
|
33
|
+
source: o,
|
|
34
|
+
effect: (t, n) => {
|
|
35
|
+
let i = _(t.targetSelectors, r.id);
|
|
36
|
+
i.forEach(({ elements: e }) => e.forEach((e) => v(e, r.id))), y(i, r.id, r.key).forEach((t) => {
|
|
37
|
+
n ? e.experienceInstances.spawn(u, t, n) : e.experienceInstances.spawn(u, t);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}), f = O({
|
|
41
|
+
source: k({
|
|
42
|
+
preconditionPassed: e.preconditionPassedStore,
|
|
43
|
+
isUser: e.session.store.map((e) => e.isUser, { skipVoid: !1 }),
|
|
44
|
+
config: o
|
|
45
|
+
}),
|
|
46
|
+
effect: async ({ preconditionPassed: i, isUser: a, config: o }) => {
|
|
47
|
+
if (!i || !a) return !1;
|
|
48
|
+
let { decisionLogic: s, targetSelectors: c } = o;
|
|
49
|
+
return c.length === 0 || _(c, r.id).length < 1 ? !1 : s === void 0 ? !0 : t(s) ? await n(e, s) === !0 : !0;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
return u = {
|
|
53
|
+
id: r.id,
|
|
54
|
+
key: r.key,
|
|
55
|
+
name: r.name,
|
|
56
|
+
configStore: o,
|
|
57
|
+
treeStore: c,
|
|
58
|
+
componentStore: s,
|
|
59
|
+
actions: l,
|
|
60
|
+
merge: a.merge,
|
|
61
|
+
initialiseFx: d,
|
|
62
|
+
shouldInitialiseFx: f
|
|
63
|
+
}, u;
|
|
42
64
|
});
|
|
43
|
-
function
|
|
44
|
-
return
|
|
65
|
+
function ae(e) {
|
|
66
|
+
return L(ie, e);
|
|
45
67
|
}
|
|
46
|
-
var
|
|
47
|
-
let t =
|
|
68
|
+
var oe = I(({ client: e }) => {
|
|
69
|
+
let t = re.store({}), n = A(t, { register(e, t) {
|
|
48
70
|
return {
|
|
49
71
|
...e,
|
|
50
72
|
[t.id]: t
|
|
51
73
|
};
|
|
52
|
-
} })
|
|
53
|
-
|
|
54
|
-
let i = t.getState()[r.id];
|
|
55
|
-
if (i) {
|
|
56
|
-
i.merge({
|
|
57
|
-
experience: r,
|
|
58
|
-
strategy: "override"
|
|
59
|
-
});
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
let a = le({
|
|
74
|
+
} }), r = N(), i = M((t) => {
|
|
75
|
+
n.register(ae({
|
|
63
76
|
client: e,
|
|
64
|
-
experience:
|
|
77
|
+
experience: t
|
|
78
|
+
}));
|
|
79
|
+
});
|
|
80
|
+
F({
|
|
81
|
+
clock: r,
|
|
82
|
+
source: t,
|
|
83
|
+
filter: (e, t) => e[t.id] !== void 0,
|
|
84
|
+
fn: (e, t) => ({
|
|
85
|
+
existing: e[t.id],
|
|
86
|
+
experience: t
|
|
87
|
+
})
|
|
88
|
+
}).watch(({ existing: e, experience: t }) => {
|
|
89
|
+
e?.merge({
|
|
90
|
+
experience: t,
|
|
91
|
+
strategy: "override"
|
|
65
92
|
});
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
93
|
+
}), F({
|
|
94
|
+
clock: r,
|
|
95
|
+
source: t,
|
|
96
|
+
filter: (e, t) => e[t.id] === void 0,
|
|
97
|
+
fn: (e, t) => t,
|
|
98
|
+
target: i
|
|
99
|
+
});
|
|
100
|
+
let a = t.map((e) => Object.values(e));
|
|
101
|
+
function o(e) {
|
|
70
102
|
return t.map((t) => t[e], { skipVoid: !1 });
|
|
71
103
|
}
|
|
72
|
-
function
|
|
104
|
+
function s(e) {
|
|
73
105
|
return t.map((t) => Object.values(t).find((t) => t.key === e) ?? t[e], { skipVoid: !1 });
|
|
74
106
|
}
|
|
75
|
-
let
|
|
107
|
+
let c = O({
|
|
76
108
|
source: t,
|
|
77
|
-
effect: async (
|
|
78
|
-
let
|
|
79
|
-
if (!
|
|
80
|
-
"key" in
|
|
109
|
+
effect: async (e, t) => {
|
|
110
|
+
let n = "key" in t ? Object.values(e).find((e) => e.key === t.key) : e[t.id];
|
|
111
|
+
if (!n) {
|
|
112
|
+
"key" in t ? `${t.key}` : `${t.id}`;
|
|
81
113
|
return;
|
|
82
114
|
}
|
|
83
|
-
let { options:
|
|
84
|
-
if (
|
|
85
|
-
|
|
115
|
+
let { options: r } = t;
|
|
116
|
+
if (r?.bypassCondition) {
|
|
117
|
+
await n.initialiseFx(r);
|
|
86
118
|
return;
|
|
87
119
|
}
|
|
88
|
-
await
|
|
120
|
+
await n.shouldInitialiseFx() && await n.initialiseFx(r);
|
|
89
121
|
}
|
|
90
122
|
});
|
|
91
123
|
return {
|
|
92
124
|
register: r,
|
|
93
|
-
get:
|
|
94
|
-
getById:
|
|
95
|
-
getByKey:
|
|
96
|
-
launch:
|
|
97
|
-
open:
|
|
125
|
+
get: o,
|
|
126
|
+
getById: o,
|
|
127
|
+
getByKey: s,
|
|
128
|
+
launch: c,
|
|
129
|
+
open: O({
|
|
98
130
|
source: {
|
|
99
131
|
experiences: t,
|
|
100
132
|
instances: e.experienceInstances.listStore
|
|
101
133
|
},
|
|
102
|
-
effect: ({ experiences: e, instances: t }, n) => {
|
|
134
|
+
effect: async ({ experiences: e, instances: t }, n) => {
|
|
103
135
|
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);
|
|
104
|
-
if (i.length > 0)
|
|
105
|
-
|
|
136
|
+
if (i.length > 0) {
|
|
137
|
+
for (let e of i) e.open();
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
await c("key" in n ? {
|
|
106
141
|
key: n.key,
|
|
107
142
|
options: {
|
|
108
143
|
...n.options,
|
|
@@ -117,26 +152,31 @@ var ue = j(({ client: e }) => {
|
|
|
117
152
|
});
|
|
118
153
|
}
|
|
119
154
|
}),
|
|
120
|
-
listStore:
|
|
155
|
+
listStore: a,
|
|
156
|
+
initialiseExperiencesFx: O({
|
|
157
|
+
source: a,
|
|
158
|
+
effect: async (e) => {
|
|
159
|
+
await Promise.all(e.map(async (e) => {
|
|
160
|
+
await e.shouldInitialiseFx() && await e.initialiseFx(void 0);
|
|
161
|
+
}));
|
|
162
|
+
}
|
|
163
|
+
})
|
|
121
164
|
};
|
|
122
165
|
});
|
|
123
|
-
function
|
|
124
|
-
return
|
|
166
|
+
function se(e) {
|
|
167
|
+
return L(oe, e);
|
|
125
168
|
}
|
|
126
|
-
var
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
169
|
+
var ce = async (e) => {
|
|
170
|
+
await e.experiences.initialiseExperiencesFx();
|
|
171
|
+
};
|
|
172
|
+
//#endregion
|
|
173
|
+
//#region src/entities/plugin/plugin.ts
|
|
174
|
+
function le(e) {
|
|
175
|
+
return M(async () => {
|
|
176
|
+
await e();
|
|
130
177
|
});
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
await I(e, t) && P(e, t);
|
|
134
|
-
}));
|
|
135
|
-
}, I = async (n, r) => {
|
|
136
|
-
if (!n.preconditionPassed || !n.session?.isUser) return !1;
|
|
137
|
-
let { decisionLogic: i, targetSelectors: a } = r.configStore.getState();
|
|
138
|
-
return y(a, r.id).length < 1 || a.length === 0 ? !1 : i === void 0 ? !0 : e(i) ? await t(n, i) === !0 : !0;
|
|
139
|
-
}, fe = (e, t, n) => {
|
|
178
|
+
}
|
|
179
|
+
var ue = (e, t, n) => {
|
|
140
180
|
let r = t.name, i = t.setup(e);
|
|
141
181
|
if (i) {
|
|
142
182
|
let e = n[r] ?? {};
|
|
@@ -145,106 +185,508 @@ var P = (e, t, n) => {
|
|
|
145
185
|
...i
|
|
146
186
|
});
|
|
147
187
|
}
|
|
148
|
-
},
|
|
188
|
+
}, de = j("component"), fe = I(({ client: e, component: t, name: n }) => ({
|
|
149
189
|
name: n,
|
|
150
190
|
component: t,
|
|
151
191
|
frameworkStore: e.frameworks.getByName(t.frameworkName)
|
|
152
192
|
}));
|
|
153
|
-
function
|
|
154
|
-
return
|
|
193
|
+
function pe(e) {
|
|
194
|
+
return L(fe, e);
|
|
155
195
|
}
|
|
156
|
-
var
|
|
157
|
-
let t =
|
|
196
|
+
var me = I(({ client: e }) => {
|
|
197
|
+
let t = de.store({}), n = A(t, { register(e, t) {
|
|
158
198
|
return {
|
|
159
199
|
...e,
|
|
160
200
|
[t.name]: t
|
|
161
201
|
};
|
|
162
|
-
} });
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
202
|
+
} }), i = N();
|
|
203
|
+
F({
|
|
204
|
+
clock: i,
|
|
205
|
+
source: t,
|
|
206
|
+
filter: (e, { name: t }) => e[t] !== void 0,
|
|
207
|
+
fn: (e, { name: t }) => `Component '${t}' already registered. Registering again will override the previous registration.`
|
|
208
|
+
}).watch((e) => /* @__PURE__ */ r("warn", e)), F({
|
|
209
|
+
clock: i,
|
|
210
|
+
fn: ({ name: t, component: n }) => pe({
|
|
166
211
|
client: e,
|
|
167
|
-
name:
|
|
168
|
-
component:
|
|
169
|
-
})
|
|
170
|
-
n.register
|
|
171
|
-
}
|
|
172
|
-
let
|
|
173
|
-
function
|
|
212
|
+
name: t,
|
|
213
|
+
component: n
|
|
214
|
+
}),
|
|
215
|
+
target: n.register
|
|
216
|
+
});
|
|
217
|
+
let a = t.map((e) => Object.values(e));
|
|
218
|
+
function o(e) {
|
|
174
219
|
return t.map((t) => t[e], { skipVoid: !1 });
|
|
175
220
|
}
|
|
176
221
|
return {
|
|
177
|
-
register:
|
|
178
|
-
getByName:
|
|
179
|
-
listStore:
|
|
222
|
+
register: i,
|
|
223
|
+
getByName: o,
|
|
224
|
+
listStore: a
|
|
180
225
|
};
|
|
181
226
|
});
|
|
182
|
-
function
|
|
183
|
-
return
|
|
227
|
+
function he(e) {
|
|
228
|
+
return L(me, e);
|
|
184
229
|
}
|
|
185
|
-
var
|
|
186
|
-
n.register(
|
|
187
|
-
|
|
188
|
-
|
|
230
|
+
var ge = (e, t, n) => {
|
|
231
|
+
n.register({
|
|
232
|
+
name: e,
|
|
233
|
+
component: t
|
|
234
|
+
});
|
|
235
|
+
}, _e = j("framework"), ve = I((e) => {
|
|
236
|
+
let t = _e.store({}), n = A(t, { register(e, t) {
|
|
189
237
|
return {
|
|
190
238
|
...e,
|
|
191
239
|
[t.name]: t.framework
|
|
192
240
|
};
|
|
193
|
-
} });
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
})
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
|
|
241
|
+
} }), i = N();
|
|
242
|
+
F({
|
|
243
|
+
clock: i,
|
|
244
|
+
source: t,
|
|
245
|
+
filter: (e, { name: t }) => e[t] !== void 0,
|
|
246
|
+
fn: (e, { name: t }) => `Framework '${t}' already registered. Registering again will override the previous registration.`
|
|
247
|
+
}).watch((e) => /* @__PURE__ */ r("warn", e)), F({
|
|
248
|
+
clock: i,
|
|
249
|
+
target: n.register
|
|
250
|
+
});
|
|
251
|
+
let a = t.map((e) => Object.values(e));
|
|
252
|
+
function o(e) {
|
|
202
253
|
return t.map((t) => t[e], { skipVoid: !1 });
|
|
203
254
|
}
|
|
204
255
|
return {
|
|
205
|
-
register:
|
|
206
|
-
getByName:
|
|
207
|
-
listStore:
|
|
256
|
+
register: i,
|
|
257
|
+
getByName: o,
|
|
258
|
+
listStore: a
|
|
208
259
|
};
|
|
209
260
|
});
|
|
210
|
-
function
|
|
211
|
-
return
|
|
261
|
+
function ye(e) {
|
|
262
|
+
return L(ve, e);
|
|
212
263
|
}
|
|
213
|
-
var
|
|
214
|
-
t.register(
|
|
215
|
-
|
|
264
|
+
var be = (e, t) => {
|
|
265
|
+
t.register({
|
|
266
|
+
name: e.name,
|
|
267
|
+
framework: e
|
|
268
|
+
});
|
|
269
|
+
}, xe = I(({ client: e }) => {
|
|
270
|
+
let t = typeof window < "u", n = {
|
|
271
|
+
location: t ? window.location : void 0,
|
|
272
|
+
document: t ? window.document : void 0,
|
|
273
|
+
sessionStorage: t ? window.sessionStorage : void 0,
|
|
274
|
+
localStorage: t ? window.localStorage : void 0
|
|
275
|
+
};
|
|
276
|
+
return k(e.responses.listStore, e.fields.listStore, (t, r) => Object.freeze({
|
|
277
|
+
client: e,
|
|
278
|
+
responses: t,
|
|
279
|
+
fields: r,
|
|
280
|
+
...n
|
|
281
|
+
}));
|
|
282
|
+
});
|
|
283
|
+
function Se(e) {
|
|
284
|
+
return L(xe, e);
|
|
285
|
+
}
|
|
286
|
+
//#endregion
|
|
287
|
+
//#region src/logic-engine.ts
|
|
288
|
+
function Ce(e) {
|
|
289
|
+
return typeof e == "number" && !isNaN(e);
|
|
290
|
+
}
|
|
291
|
+
function R(e) {
|
|
292
|
+
return typeof e == "string";
|
|
293
|
+
}
|
|
294
|
+
function z(e) {
|
|
295
|
+
return Array.isArray(e);
|
|
296
|
+
}
|
|
297
|
+
function B(e) {
|
|
298
|
+
return e instanceof Promise;
|
|
299
|
+
}
|
|
300
|
+
function V(e) {
|
|
301
|
+
return typeof e == "object" && !!e && !Array.isArray(e) && Object.keys(e).length === 1;
|
|
302
|
+
}
|
|
303
|
+
function H(e) {
|
|
304
|
+
if (Ce(e)) return e;
|
|
305
|
+
let t = parseFloat(`${e}`);
|
|
306
|
+
return isNaN(t) ? 0 : t;
|
|
307
|
+
}
|
|
308
|
+
function U(e) {
|
|
309
|
+
return `${e}`;
|
|
310
|
+
}
|
|
311
|
+
var we = {
|
|
312
|
+
"==": (e, t) => e == t,
|
|
313
|
+
"===": (e, t) => e === t,
|
|
314
|
+
"!=": (e, t) => e != t,
|
|
315
|
+
"!==": (e, t) => e !== t,
|
|
316
|
+
">": (e, t) => H(e) > H(t),
|
|
317
|
+
">=": (e, t) => H(e) >= H(t),
|
|
318
|
+
"<": (e, t, n) => {
|
|
319
|
+
let r = H(e), i = H(t);
|
|
320
|
+
if (n === void 0) return r < i;
|
|
321
|
+
let a = H(n);
|
|
322
|
+
return r < i && i < a;
|
|
323
|
+
},
|
|
324
|
+
"<=": (e, t, n) => {
|
|
325
|
+
let r = H(e), i = H(t);
|
|
326
|
+
if (n === void 0) return r <= i;
|
|
327
|
+
let a = H(n);
|
|
328
|
+
return r <= i && i <= a;
|
|
329
|
+
},
|
|
330
|
+
"!!": async (e) => await G(e),
|
|
331
|
+
"!": async (e) => !await G(e),
|
|
332
|
+
"%": (e, t) => H(e) % H(t),
|
|
333
|
+
log: (e) => (console.log(e), e),
|
|
334
|
+
in: (e, t) => t ? R(t) ? t.indexOf(U(e)) !== -1 : z(t) ? t.includes(e) : !1 : !1,
|
|
335
|
+
cat: (...e) => e.map(U).join(""),
|
|
336
|
+
substr: (e, t, n) => {
|
|
337
|
+
let r = U(e), i = H(t);
|
|
338
|
+
if (n === void 0) return r.substr(i);
|
|
339
|
+
let a = H(n);
|
|
340
|
+
if (a < 0) {
|
|
341
|
+
let e = r.substr(i);
|
|
342
|
+
return e.substr(0, e.length + a);
|
|
343
|
+
}
|
|
344
|
+
return r.substr(i, a);
|
|
345
|
+
},
|
|
346
|
+
"+": (...e) => e.reduce((e, t) => H(e) + H(t), 0),
|
|
347
|
+
"*": (...e) => e.reduce((e, t) => H(e) * H(t), 1),
|
|
348
|
+
"-": (e, t) => {
|
|
349
|
+
let n = H(e);
|
|
350
|
+
return t === void 0 ? -n : n - H(t);
|
|
351
|
+
},
|
|
352
|
+
"/": (e, t) => H(e) / H(t),
|
|
353
|
+
min: (...e) => Math.min(...e.map(H)),
|
|
354
|
+
max: (...e) => Math.max(...e.map(H)),
|
|
355
|
+
merge: (...e) => e.reduce((e, t) => z(t) ? e.concat(t) : e.concat([t]), []),
|
|
356
|
+
var(e, t) {
|
|
357
|
+
let n = arguments.length > 1 ? t : null;
|
|
358
|
+
if (e === "" || e === "." || e == null) return this;
|
|
359
|
+
if (typeof e == "number" && Array.isArray(this)) return e >= 0 && e < this.length ? this[e] : n;
|
|
360
|
+
let r = U(e);
|
|
361
|
+
if (r === "" || r === ".") return this;
|
|
362
|
+
let i = r.split("."), a = this;
|
|
363
|
+
for (let e of i) {
|
|
364
|
+
if (a == null) return n;
|
|
365
|
+
if (Array.isArray(a)) {
|
|
366
|
+
let t = parseInt(e, 10);
|
|
367
|
+
a = isNaN(t) ? a[e] : a[t];
|
|
368
|
+
} else a = a[e];
|
|
369
|
+
}
|
|
370
|
+
return a === void 0 ? n : a;
|
|
371
|
+
},
|
|
372
|
+
async missing(...e) {
|
|
373
|
+
let t = z(e[0]) ? e[0] : e, n = [];
|
|
374
|
+
for (let e of t) {
|
|
375
|
+
let t = await W({ var: e }, this);
|
|
376
|
+
(t === null || t === "") && n.push(`${e}`);
|
|
377
|
+
}
|
|
378
|
+
return n;
|
|
379
|
+
},
|
|
380
|
+
async missing_some(e, t) {
|
|
381
|
+
let n = await W({ missing: t }, this);
|
|
382
|
+
if (!z(n) || !z(t)) return [];
|
|
383
|
+
let r = n.filter(R);
|
|
384
|
+
return t.filter(R).length - r.length >= H(e) ? [] : r;
|
|
385
|
+
},
|
|
386
|
+
invoke(...e) {
|
|
387
|
+
let [t, ...n] = e;
|
|
388
|
+
return typeof t == "function" ? Reflect.apply(t, null, n) : null;
|
|
389
|
+
},
|
|
390
|
+
startsWith: (e, t) => R(e) && R(t) && e.startsWith(t),
|
|
391
|
+
endsWith: (e, t) => R(e) && R(t) && e.endsWith(t),
|
|
392
|
+
regexp_matches(e, t) {
|
|
393
|
+
let n = e, r = "";
|
|
394
|
+
if (z(e)) {
|
|
395
|
+
let [t, i] = e;
|
|
396
|
+
n = t, r = i;
|
|
397
|
+
}
|
|
398
|
+
return !R(n) || !R(r) ? !1 : new RegExp(n, r).test(U(t));
|
|
399
|
+
},
|
|
400
|
+
throw(e) {
|
|
401
|
+
throw Error(U(e));
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
async function W(e, t) {
|
|
405
|
+
if (!e) return e;
|
|
406
|
+
if (B(e)) return W(await e, t);
|
|
407
|
+
if (z(e)) return Promise.all(e.map((e) => W(e, t)));
|
|
408
|
+
if (!V(e)) return e;
|
|
409
|
+
let n = Te(e), r = n ? e[n] ?? [] : [];
|
|
410
|
+
switch (z(r) || (r = [r]), n) {
|
|
411
|
+
case "if":
|
|
412
|
+
case "?:":
|
|
413
|
+
for (let e = 0; e < r.length - 1; e += 2) if (await G(await W(r[e], t))) return W(r[e + 1], t);
|
|
414
|
+
return r.length % 2 == 1 ? W(r[r.length - 1], t) : null;
|
|
415
|
+
case "and": {
|
|
416
|
+
let e = null;
|
|
417
|
+
for (let n of r) if (e = await W(n, t), !await G(e)) return e;
|
|
418
|
+
return e;
|
|
419
|
+
}
|
|
420
|
+
case "or": {
|
|
421
|
+
let e = null;
|
|
422
|
+
for (let n of r) if (e = await W(n, t), await G(e)) return e;
|
|
423
|
+
return e;
|
|
424
|
+
}
|
|
425
|
+
case "map": {
|
|
426
|
+
let e = await W(r[0], t);
|
|
427
|
+
return z(e) ? await Promise.all(e.map((e) => W(r[1], e))) : [];
|
|
428
|
+
}
|
|
429
|
+
case "filter": {
|
|
430
|
+
let e = await W(r[0], t);
|
|
431
|
+
return z(e) ? (await Promise.all(e.map(async (e) => ({
|
|
432
|
+
item: e,
|
|
433
|
+
shouldInclude: await G(await W(r[1], e))
|
|
434
|
+
})))).filter(({ shouldInclude: e }) => e).map(({ item: e }) => e) : [];
|
|
435
|
+
}
|
|
436
|
+
case "reduce": {
|
|
437
|
+
let e = await W(r[0], t);
|
|
438
|
+
if (!z(e)) return r.length > 2 ? await W(r[2], t) : null;
|
|
439
|
+
let n = r[1], i = r.length > 2 ? await W(r[2], t) : null;
|
|
440
|
+
for (let t of e) i = await W(n, {
|
|
441
|
+
current: t,
|
|
442
|
+
accumulator: i
|
|
443
|
+
});
|
|
444
|
+
return i;
|
|
445
|
+
}
|
|
446
|
+
case "all": {
|
|
447
|
+
let e = await W(r[0], t);
|
|
448
|
+
if (!z(e) || e.length === 0) return !1;
|
|
449
|
+
for (let t of e) if (!await G(await W(r[1], t))) return !1;
|
|
450
|
+
return !0;
|
|
451
|
+
}
|
|
452
|
+
case "some": {
|
|
453
|
+
let e = await W(r[0], t);
|
|
454
|
+
if (!z(e)) return !1;
|
|
455
|
+
for (let t of e) if (await G(await W(r[1], t))) return !0;
|
|
456
|
+
return !1;
|
|
457
|
+
}
|
|
458
|
+
case "none": {
|
|
459
|
+
let e = await W(r[0], t);
|
|
460
|
+
if (!z(e)) return !0;
|
|
461
|
+
for (let t of e) if (await G(await W(r[1], t))) return !1;
|
|
462
|
+
return !0;
|
|
463
|
+
}
|
|
464
|
+
case "catch": try {
|
|
465
|
+
return await W(r[0], t);
|
|
466
|
+
} catch (e) {
|
|
467
|
+
return V(e) ? await W(e, t) : r[1] ? await W(r[1], e) : e instanceof Error ? e.message : e;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
let i = await Promise.all(r.map((e) => W(e, t))), a = n ? we[n] : void 0;
|
|
471
|
+
if (!a) throw Error(`Unrecognized operation ${n}`);
|
|
472
|
+
return a.apply(t, i);
|
|
473
|
+
}
|
|
474
|
+
async function G(e) {
|
|
475
|
+
return B(e) ? G(await e) : !(Array.isArray(e) && e.length === 0) && !!e;
|
|
476
|
+
}
|
|
477
|
+
function Te(e) {
|
|
478
|
+
return Object.keys(e)[0];
|
|
479
|
+
}
|
|
480
|
+
//#endregion
|
|
481
|
+
//#region src/lifecycle/rules-logic.ts
|
|
482
|
+
var Ee = I(({ client: e }) => O({
|
|
483
|
+
source: {
|
|
484
|
+
stateSnapshot: e.stateSnapshotStore,
|
|
485
|
+
predicates: e.predicates.listStore,
|
|
486
|
+
actions: e.actions.listStore,
|
|
487
|
+
features: e.features.listStore,
|
|
488
|
+
responses: e.responses.getAllStore
|
|
489
|
+
},
|
|
490
|
+
effect: async ({ stateSnapshot: e, predicates: t, actions: n, features: r, responses: i }, { rule: a, context: o }) => {
|
|
491
|
+
let s = t.reduce((t, n) => (t[n.name] = async (...t) => await n.predicate({
|
|
492
|
+
...e,
|
|
493
|
+
args: t
|
|
494
|
+
}), t), {}), c = n.reduce((t, n) => (t[n.key] = async (...t) => await n.action({
|
|
495
|
+
...e,
|
|
496
|
+
args: t
|
|
497
|
+
}, null) ?? void 0, t), {}), l = r.reduce((e, t) => (e[t.id] = async () => {
|
|
498
|
+
let { bucket: e } = await t.getBucket();
|
|
499
|
+
return e;
|
|
500
|
+
}, e), {});
|
|
501
|
+
return await W(a, {
|
|
502
|
+
responses: i,
|
|
503
|
+
location: typeof e.location == "object" ? {
|
|
504
|
+
hash: e.location.hash,
|
|
505
|
+
host: e.location.host,
|
|
506
|
+
hostname: e.location.hostname,
|
|
507
|
+
href: e.location.href,
|
|
508
|
+
origin: e.location.origin,
|
|
509
|
+
pathname: e.location.pathname,
|
|
510
|
+
port: e.location.port,
|
|
511
|
+
protocol: e.location.protocol,
|
|
512
|
+
search: e.location.search
|
|
513
|
+
} : void 0,
|
|
514
|
+
predicates: s,
|
|
515
|
+
actions: c,
|
|
516
|
+
features: l,
|
|
517
|
+
...o
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
}));
|
|
521
|
+
function De(e) {
|
|
522
|
+
return L(Ee, e);
|
|
523
|
+
}
|
|
524
|
+
//#endregion
|
|
525
|
+
//#region src/ping.ts
|
|
526
|
+
var Oe = 6e3, ke = E("last_ping", "global"), Ae = async (e) => {
|
|
216
527
|
try {
|
|
217
|
-
let t = Date.now(), n =
|
|
218
|
-
if (n.isSet() && (r = n.json() ?? 0), r && t - r <
|
|
528
|
+
let t = Date.now(), n = w.get(ke), r = 0;
|
|
529
|
+
if (n.isSet() && (r = n.json() ?? 0), r && t - r < Oe) return !0;
|
|
219
530
|
let i = {
|
|
220
531
|
projectId: e.projectId,
|
|
221
532
|
path: window.location.pathname
|
|
222
533
|
}, a = {}, o = document.getElementById("picked_script")?.dataset.verceltoken;
|
|
223
534
|
o && (a["x-vercel-protection-bypass"] = o);
|
|
224
|
-
let s = (await
|
|
535
|
+
let s = (await D(e.apiUrl, "ping", i, a)).ok;
|
|
225
536
|
return s && n.set(t), s;
|
|
226
537
|
} catch {
|
|
227
538
|
return !1;
|
|
228
539
|
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
540
|
+
}, K = j("lifecycle"), je = I(({ client: e }) => {
|
|
541
|
+
let t = K.store(!1), r = P(void 0, {
|
|
542
|
+
skipVoid: !1,
|
|
543
|
+
domain: K
|
|
544
|
+
}), i = P(void 0, {
|
|
545
|
+
skipVoid: !1,
|
|
546
|
+
domain: K
|
|
547
|
+
}), a = K.store("idle"), o = K.store([]), s = P(void 0, {
|
|
548
|
+
skipVoid: !1,
|
|
549
|
+
domain: K
|
|
550
|
+
}), c = P(void 0, {
|
|
551
|
+
skipVoid: !1,
|
|
552
|
+
domain: K
|
|
553
|
+
}), l = N(), u = N(), d = N(), p = N(), m = N(), h = N();
|
|
554
|
+
o.on(p, (e, t) => [...e, t]), s.on(m, (e, t) => t), c.on(h, (e, t) => t), t.on(u, () => !0);
|
|
555
|
+
let g = M(() => {
|
|
556
|
+
Ae(e);
|
|
557
|
+
}), _ = M(async () => {
|
|
558
|
+
await ee();
|
|
559
|
+
}), v = M(async () => {
|
|
560
|
+
await ce(e);
|
|
561
|
+
}), y = O({ effect: v }), b = O({
|
|
562
|
+
source: o,
|
|
563
|
+
effect: async (e) => {
|
|
564
|
+
for (let t of e) await t();
|
|
565
|
+
}
|
|
566
|
+
}), x = O({
|
|
567
|
+
source: s,
|
|
568
|
+
effect: async (t) => t === void 0 ? !0 : typeof t == "boolean" ? t : await n(e, t) === !0
|
|
569
|
+
}), S = O({
|
|
570
|
+
source: c,
|
|
571
|
+
effect: async (t) => t === void 0 ? !0 : typeof t == "boolean" ? t : await n(e, t) === !0
|
|
572
|
+
}), C = F({
|
|
573
|
+
clock: l,
|
|
574
|
+
filter: () => f()
|
|
575
|
+
});
|
|
576
|
+
F({
|
|
577
|
+
clock: C,
|
|
578
|
+
fn: () => "starting",
|
|
579
|
+
target: a
|
|
580
|
+
}), F({
|
|
581
|
+
clock: C,
|
|
582
|
+
target: g
|
|
583
|
+
}), F({
|
|
584
|
+
clock: C,
|
|
585
|
+
target: b
|
|
586
|
+
}), F({
|
|
587
|
+
clock: C,
|
|
588
|
+
target: _
|
|
589
|
+
}), F({
|
|
590
|
+
clock: b.done,
|
|
591
|
+
target: x
|
|
592
|
+
}), F({
|
|
593
|
+
clock: x.doneData,
|
|
594
|
+
target: r
|
|
595
|
+
}), F({
|
|
596
|
+
clock: S.doneData,
|
|
597
|
+
target: i
|
|
598
|
+
}), F({
|
|
599
|
+
clock: x.doneData,
|
|
600
|
+
filter: (e) => e,
|
|
601
|
+
target: S
|
|
602
|
+
}), F({
|
|
603
|
+
clock: S.doneData,
|
|
604
|
+
target: e.session.setIsUser
|
|
605
|
+
}), F({
|
|
606
|
+
clock: S.doneData,
|
|
607
|
+
fn: (e) => ({
|
|
608
|
+
type: "user_decide",
|
|
609
|
+
value: e
|
|
610
|
+
}),
|
|
611
|
+
target: e.eventBus
|
|
612
|
+
}), F({
|
|
613
|
+
clock: x.doneData,
|
|
614
|
+
filter: (e) => !e,
|
|
615
|
+
fn: () => void 0,
|
|
616
|
+
target: d
|
|
617
|
+
}), F({
|
|
618
|
+
clock: S.doneData,
|
|
619
|
+
fn: () => void 0,
|
|
620
|
+
target: d
|
|
621
|
+
}), F({
|
|
622
|
+
clock: d,
|
|
623
|
+
fn: () => ({ type: "initialize" }),
|
|
624
|
+
target: e.eventBus
|
|
625
|
+
});
|
|
626
|
+
let w = P(!1).on(_.done, () => !0), T = P(!1).on(d, () => !0), E = P(!1).on(y.done, () => !0), D = k(r, i, (e, t) => e === !0 && t === !0);
|
|
627
|
+
return F({
|
|
628
|
+
clock: d,
|
|
629
|
+
source: D,
|
|
630
|
+
filter: (e) => e,
|
|
631
|
+
fn: () => void 0,
|
|
632
|
+
target: v
|
|
633
|
+
}), F({
|
|
634
|
+
clock: k(w, T, D, (e, t, n) => e && t && n),
|
|
635
|
+
filter: (e) => e,
|
|
636
|
+
fn: () => void 0,
|
|
637
|
+
target: y
|
|
638
|
+
}), F({
|
|
639
|
+
clock: k(w, T, D, E, (e, t, n, r) => e && t && (!n || r)),
|
|
640
|
+
filter: (e) => e,
|
|
641
|
+
fn: () => void 0,
|
|
642
|
+
target: u
|
|
643
|
+
}), F({
|
|
644
|
+
clock: u,
|
|
645
|
+
fn: () => "ready",
|
|
646
|
+
target: a
|
|
647
|
+
}), F({
|
|
648
|
+
clock: u,
|
|
649
|
+
fn: () => ({ type: "ready" }),
|
|
650
|
+
target: e.eventBus
|
|
651
|
+
}), F({
|
|
652
|
+
clock: u,
|
|
653
|
+
source: e.session.store,
|
|
654
|
+
fn: ({ id: e, isUser: t, identifiers: n }) => ({
|
|
655
|
+
type: "session",
|
|
656
|
+
id: e,
|
|
657
|
+
isUser: t,
|
|
658
|
+
identifiers: n
|
|
659
|
+
}),
|
|
660
|
+
target: e.eventBus
|
|
661
|
+
}), F({
|
|
662
|
+
clock: [
|
|
663
|
+
b.fail,
|
|
664
|
+
x.fail,
|
|
665
|
+
S.fail,
|
|
666
|
+
v.fail,
|
|
667
|
+
y.fail,
|
|
668
|
+
_.fail
|
|
669
|
+
],
|
|
670
|
+
fn: () => "failed",
|
|
671
|
+
target: a
|
|
672
|
+
}), {
|
|
673
|
+
start: l,
|
|
674
|
+
readyStore: t,
|
|
675
|
+
preconditionPassedStore: r,
|
|
676
|
+
conditionPassedStore: i,
|
|
677
|
+
lifecycleStageStore: a,
|
|
678
|
+
registerPluginStartHook: p,
|
|
679
|
+
setPrecondition: m,
|
|
680
|
+
setCondition: h
|
|
241
681
|
};
|
|
242
|
-
|
|
682
|
+
});
|
|
683
|
+
function Me(e) {
|
|
684
|
+
return L(je, e);
|
|
243
685
|
}
|
|
244
686
|
//#endregion
|
|
245
687
|
//#region src/entities/predicate/predicate.ts
|
|
246
|
-
var
|
|
247
|
-
let t =
|
|
688
|
+
var Ne = j("predicate"), Pe = I(({ client: e }) => {
|
|
689
|
+
let t = Ne.store({}), n = A(t, { register(e, t) {
|
|
248
690
|
return {
|
|
249
691
|
...e,
|
|
250
692
|
[t.name]: {
|
|
@@ -252,85 +694,103 @@ var be = E("predicate"), xe = j(({ client: e }) => {
|
|
|
252
694
|
predicate: t.predicate
|
|
253
695
|
}
|
|
254
696
|
};
|
|
255
|
-
} });
|
|
256
|
-
|
|
257
|
-
|
|
697
|
+
} }), i = N();
|
|
698
|
+
F({
|
|
699
|
+
clock: i,
|
|
700
|
+
source: t,
|
|
701
|
+
filter: (e, { name: t }) => e[t] !== void 0,
|
|
702
|
+
fn: (e, { name: t }) => `Predicate '${t}' already registered. Registering again will override the previous registration.`
|
|
703
|
+
}).watch((e) => /* @__PURE__ */ r("warn", e)), F({
|
|
704
|
+
clock: i,
|
|
705
|
+
fn: ({ name: e, predicate: t }) => Object.freeze({
|
|
258
706
|
name: e,
|
|
259
|
-
predicate:
|
|
260
|
-
})
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
707
|
+
predicate: t
|
|
708
|
+
}),
|
|
709
|
+
target: n.register
|
|
710
|
+
});
|
|
711
|
+
let a = t.map((e) => Object.values(e));
|
|
712
|
+
function o(e) {
|
|
264
713
|
return t.map((t) => t[e]?.predicate, { skipVoid: !1 });
|
|
265
714
|
}
|
|
266
|
-
function
|
|
267
|
-
let n =
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
715
|
+
function s(t) {
|
|
716
|
+
let n = P(() => void 0, { skipVoid: !1 }), r = O({
|
|
717
|
+
source: {
|
|
718
|
+
predicate: o(t),
|
|
719
|
+
snapshot: e.stateSnapshotStore
|
|
720
|
+
},
|
|
721
|
+
effect: ({ predicate: e, snapshot: t }) => {
|
|
722
|
+
if (e) return (...n) => e({
|
|
723
|
+
...t,
|
|
724
|
+
args: n
|
|
725
|
+
});
|
|
726
|
+
}
|
|
275
727
|
});
|
|
276
|
-
return
|
|
728
|
+
return F({
|
|
277
729
|
source: {
|
|
278
730
|
responses: e.responses.listStore,
|
|
279
731
|
fields: e.fields.listStore
|
|
280
732
|
},
|
|
281
733
|
target: r
|
|
282
|
-
}),
|
|
734
|
+
}), F({
|
|
283
735
|
clock: r.doneData,
|
|
284
736
|
filter: (e) => e !== void 0,
|
|
285
737
|
target: n
|
|
286
738
|
}), r(), n;
|
|
287
739
|
}
|
|
288
740
|
return {
|
|
289
|
-
register:
|
|
290
|
-
getByName:
|
|
291
|
-
listStore:
|
|
292
|
-
getEvokablePredicate:
|
|
741
|
+
register: i,
|
|
742
|
+
getByName: o,
|
|
743
|
+
listStore: a,
|
|
744
|
+
getEvokablePredicate: s
|
|
293
745
|
};
|
|
294
746
|
});
|
|
295
|
-
function
|
|
296
|
-
return
|
|
747
|
+
function Fe(e) {
|
|
748
|
+
return L(Pe, e);
|
|
297
749
|
}
|
|
298
|
-
var
|
|
299
|
-
n.register(
|
|
300
|
-
|
|
301
|
-
|
|
750
|
+
var Ie = (e, t, n) => {
|
|
751
|
+
n.register({
|
|
752
|
+
name: e,
|
|
753
|
+
predicate: t
|
|
754
|
+
});
|
|
755
|
+
}, Le = j("feature"), Re = I(({ client: e }) => {
|
|
756
|
+
let t = Le.store({}), n = Le.store([]), i = A(t, { register(e, t) {
|
|
302
757
|
return {
|
|
303
758
|
...e,
|
|
304
759
|
[t.id]: t.feature
|
|
305
760
|
};
|
|
306
|
-
} });
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
761
|
+
} }), a = N();
|
|
762
|
+
F({
|
|
763
|
+
clock: a,
|
|
764
|
+
source: t,
|
|
765
|
+
filter: (e, { id: t }) => e[t] !== void 0,
|
|
766
|
+
fn: (e, { id: t }) => `Feature '${t}' already registered. Registering again will override the previous registration.`
|
|
767
|
+
}).watch((e) => /* @__PURE__ */ r("warn", e)), F({
|
|
768
|
+
clock: a,
|
|
769
|
+
fn: ({ id: e, feature: t }) => Object.freeze({
|
|
310
770
|
id: e,
|
|
311
771
|
feature: {
|
|
312
|
-
|
|
313
|
-
|
|
772
|
+
id: e,
|
|
773
|
+
feature: {
|
|
774
|
+
...t,
|
|
775
|
+
id: e
|
|
776
|
+
}
|
|
314
777
|
}
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
}));
|
|
320
|
-
}
|
|
321
|
-
let a = D(async ({ id: e, key: t, storage: n = "local" }) => {
|
|
322
|
-
let r = S(`feature:${e}:${t}`, "global"), i = (n === "session" ? x : b).get(r).boolean();
|
|
778
|
+
}),
|
|
779
|
+
target: i.register
|
|
780
|
+
});
|
|
781
|
+
let o = M(async ({ id: e, key: t, storage: n = "local" }) => {
|
|
782
|
+
let r = E(`feature:${e}:${t}`, "global"), i = (n === "session" ? T : w).get(r).boolean();
|
|
323
783
|
return i === null ? null : {
|
|
324
784
|
id: e,
|
|
325
785
|
key: t,
|
|
326
786
|
bucket: i,
|
|
327
787
|
storage: n
|
|
328
788
|
};
|
|
329
|
-
}),
|
|
789
|
+
}), s = M((e) => {
|
|
330
790
|
if (!e) return null;
|
|
331
|
-
let t =
|
|
332
|
-
(e.storage === "session" ?
|
|
333
|
-
}),
|
|
791
|
+
let t = E(`feature:${e.id}:${e.key}`, "global");
|
|
792
|
+
(e.storage === "session" ? T : w).set(t, e.bucket);
|
|
793
|
+
}), c = /* @__PURE__ */ new Map(), l = O({
|
|
334
794
|
source: {
|
|
335
795
|
allFeaturesStore: t,
|
|
336
796
|
resolvedFeaturesStore: n
|
|
@@ -340,9 +800,9 @@ var Ce = (e, t, n) => {
|
|
|
340
800
|
if (a) return a;
|
|
341
801
|
let o = e[n];
|
|
342
802
|
if (!o) throw Error(`Feature with id '${n}' not found`);
|
|
343
|
-
let
|
|
344
|
-
if (
|
|
345
|
-
let e = await
|
|
803
|
+
let s = c.get(`${n}:${i}`);
|
|
804
|
+
if (s !== void 0) {
|
|
805
|
+
let e = await s;
|
|
346
806
|
return {
|
|
347
807
|
id: o.id,
|
|
348
808
|
bucket: e,
|
|
@@ -351,7 +811,7 @@ var Ce = (e, t, n) => {
|
|
|
351
811
|
};
|
|
352
812
|
}
|
|
353
813
|
let l = r();
|
|
354
|
-
|
|
814
|
+
c.set(`${n}:${i}`, l);
|
|
355
815
|
let u = await l;
|
|
356
816
|
return {
|
|
357
817
|
id: o.id,
|
|
@@ -361,8 +821,8 @@ var Ce = (e, t, n) => {
|
|
|
361
821
|
};
|
|
362
822
|
}
|
|
363
823
|
});
|
|
364
|
-
|
|
365
|
-
clock:
|
|
824
|
+
F({
|
|
825
|
+
clock: i.register,
|
|
366
826
|
fn: (e) => {
|
|
367
827
|
let { id: t, feature: n } = e;
|
|
368
828
|
return {
|
|
@@ -371,10 +831,10 @@ var Ce = (e, t, n) => {
|
|
|
371
831
|
storage: n.feature.storage
|
|
372
832
|
};
|
|
373
833
|
},
|
|
374
|
-
target:
|
|
375
|
-
}),
|
|
834
|
+
target: o
|
|
835
|
+
}), F({
|
|
376
836
|
source: t,
|
|
377
|
-
clock:
|
|
837
|
+
clock: l.doneData,
|
|
378
838
|
fn: (e, t) => {
|
|
379
839
|
let { id: n, bucket: r, storage: i } = t, a = e[n]?.feature.key;
|
|
380
840
|
return a ? {
|
|
@@ -384,9 +844,9 @@ var Ce = (e, t, n) => {
|
|
|
384
844
|
storage: i
|
|
385
845
|
} : null;
|
|
386
846
|
},
|
|
387
|
-
target:
|
|
847
|
+
target: s
|
|
388
848
|
});
|
|
389
|
-
let
|
|
849
|
+
let u = k({
|
|
390
850
|
allFeaturesStore: t,
|
|
391
851
|
resolvedFeaturesStore: n
|
|
392
852
|
}).map(({ allFeaturesStore: e, resolvedFeaturesStore: t }) => Object.values(e).map((e) => {
|
|
@@ -404,12 +864,12 @@ var Ce = (e, t, n) => {
|
|
|
404
864
|
id: e.id,
|
|
405
865
|
name: e.feature.name,
|
|
406
866
|
key: e.feature.key,
|
|
407
|
-
getBucket: async () => await
|
|
867
|
+
getBucket: async () => await l(e.feature),
|
|
408
868
|
isResolved: !1
|
|
409
869
|
};
|
|
410
870
|
}));
|
|
411
|
-
|
|
412
|
-
clock:
|
|
871
|
+
F({
|
|
872
|
+
clock: l.doneData,
|
|
413
873
|
source: { resolvedFeatures: n },
|
|
414
874
|
filter: ({ resolvedFeatures: e }, { id: t, key: n }) => !e.some((e) => e.id === t && e.key === n),
|
|
415
875
|
fn: (e, t) => t,
|
|
@@ -417,58 +877,63 @@ var Ce = (e, t, n) => {
|
|
|
417
877
|
type: "feature_decide",
|
|
418
878
|
feature: e
|
|
419
879
|
}))
|
|
420
|
-
}),
|
|
421
|
-
clock: [
|
|
880
|
+
}), F({
|
|
881
|
+
clock: [o.doneData, l.doneData],
|
|
422
882
|
source: n,
|
|
423
883
|
fn: (e, t) => !t || e.some((e) => e.id === t.id && e.key === t.key) ? e : [...e, t],
|
|
424
884
|
target: n
|
|
425
885
|
});
|
|
426
|
-
function u(e) {
|
|
427
|
-
return l.map((t) => t.find((t) => t.id === e));
|
|
428
|
-
}
|
|
429
886
|
function d(e) {
|
|
430
|
-
return
|
|
887
|
+
return u.map((t) => t.find((t) => t.id === e));
|
|
431
888
|
}
|
|
432
889
|
function f(e) {
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
890
|
+
return t.map((t) => t[e], { skipVoid: !1 });
|
|
891
|
+
}
|
|
892
|
+
function p(e) {
|
|
893
|
+
let t = P(async () => void 0, { skipVoid: !1 }), r = O({
|
|
894
|
+
source: d(e),
|
|
895
|
+
effect: async (e) => {
|
|
896
|
+
if (e) return async () => (await e.getBucket()).bucket;
|
|
897
|
+
}
|
|
436
898
|
});
|
|
437
|
-
return
|
|
899
|
+
return F({
|
|
438
900
|
source: n,
|
|
439
901
|
filter: (t) => t.some((t) => t.id === e),
|
|
440
902
|
target: r
|
|
441
|
-
}),
|
|
903
|
+
}), F({
|
|
442
904
|
clock: r.doneData,
|
|
443
905
|
filter: (e) => e !== void 0,
|
|
444
906
|
target: t
|
|
445
907
|
}), r(), t;
|
|
446
908
|
}
|
|
447
909
|
return {
|
|
448
|
-
register:
|
|
449
|
-
getById:
|
|
450
|
-
getByName:
|
|
451
|
-
listStore:
|
|
452
|
-
getEvokableFeature:
|
|
910
|
+
register: a,
|
|
911
|
+
getById: d,
|
|
912
|
+
getByName: f,
|
|
913
|
+
listStore: u,
|
|
914
|
+
getEvokableFeature: p
|
|
453
915
|
};
|
|
454
916
|
});
|
|
455
|
-
function
|
|
456
|
-
return
|
|
917
|
+
function ze(e) {
|
|
918
|
+
return L(Re, e);
|
|
457
919
|
}
|
|
458
|
-
var
|
|
459
|
-
n.register(
|
|
460
|
-
|
|
461
|
-
|
|
920
|
+
var Be = (e, t, n) => {
|
|
921
|
+
n.register({
|
|
922
|
+
id: e,
|
|
923
|
+
feature: t
|
|
924
|
+
});
|
|
925
|
+
}, q = j("history");
|
|
926
|
+
function J(e, t) {
|
|
462
927
|
return {
|
|
463
|
-
id:
|
|
928
|
+
id: ne(`history-entry-${Date.now()}-${Math.random()}}`),
|
|
464
929
|
node: t,
|
|
465
930
|
at: Date.now(),
|
|
466
931
|
experienceId: e
|
|
467
932
|
};
|
|
468
933
|
}
|
|
469
|
-
var
|
|
470
|
-
let e =
|
|
471
|
-
e.on(t, (e, t) => ({ entries: [...e.entries,
|
|
934
|
+
var Ve = I(() => {
|
|
935
|
+
let e = q.store({ entries: [] }), t = q.event(), n = q.event(), r = q.event(), i = q.event();
|
|
936
|
+
e.on(t, (e, t) => ({ entries: [...e.entries, J(t.experienceId, t.node)] })), e.on(n, (e, t) => ({ entries: [...e.entries.slice(0, -1), J(t.experienceId, t.node)] })), e.on(i, (e, t) => t);
|
|
472
937
|
function a(e, t) {
|
|
473
938
|
let n = {
|
|
474
939
|
lastStepIndex: -1,
|
|
@@ -476,7 +941,7 @@ var De = j(() => {
|
|
|
476
941
|
};
|
|
477
942
|
for (let r = e.length - 1; r >= 0; r--) {
|
|
478
943
|
let i = e[r], a = i?.node;
|
|
479
|
-
if (!(!a || !
|
|
944
|
+
if (!(!a || !b(a)) && !(t && i.experienceId !== t)) if (n.lastStepIndex === -1) n.lastStepIndex = r;
|
|
480
945
|
else {
|
|
481
946
|
n.secondLastStepIndex = r;
|
|
482
947
|
break;
|
|
@@ -498,25 +963,20 @@ var De = j(() => {
|
|
|
498
963
|
entriesStore: e.map((e) => e.entries)
|
|
499
964
|
};
|
|
500
965
|
});
|
|
501
|
-
function
|
|
502
|
-
return
|
|
966
|
+
function He() {
|
|
967
|
+
return L(Ve);
|
|
503
968
|
}
|
|
504
969
|
//#endregion
|
|
505
970
|
//#region src/utils/events.ts
|
|
506
|
-
var
|
|
507
|
-
let t =
|
|
508
|
-
return
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
}],
|
|
516
|
-
target: t
|
|
517
|
-
}), t;
|
|
518
|
-
}, je = E("field"), Me = j(() => {
|
|
519
|
-
let e = je.store({}), t = T(e, {
|
|
971
|
+
var Ue = 0, We = (e) => {
|
|
972
|
+
let t = P([]);
|
|
973
|
+
return t.on(e, (e, t) => [...e, {
|
|
974
|
+
id: Ue++,
|
|
975
|
+
at: /* @__PURE__ */ new Date(),
|
|
976
|
+
payload: t
|
|
977
|
+
}]), t;
|
|
978
|
+
}, Ge = j("field"), Ke = I(() => {
|
|
979
|
+
let e = Ge.store({}), t = A(e, {
|
|
520
980
|
register(e, t) {
|
|
521
981
|
return {
|
|
522
982
|
...e,
|
|
@@ -534,39 +994,43 @@ var ke = 0, Ae = (e) => {
|
|
|
534
994
|
function n(e) {
|
|
535
995
|
t.register({ field: e });
|
|
536
996
|
}
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
997
|
+
let r = {};
|
|
998
|
+
e.watch((e) => {
|
|
999
|
+
r = e;
|
|
1000
|
+
});
|
|
1001
|
+
function i(e, n) {
|
|
1002
|
+
let i = Object.values(r).find((t) => t.key === e)?.key;
|
|
1003
|
+
i && t.updateByKey({
|
|
1004
|
+
fieldKey: i,
|
|
1005
|
+
updates: n
|
|
542
1006
|
});
|
|
543
1007
|
}
|
|
544
|
-
let
|
|
545
|
-
function
|
|
1008
|
+
let a = e.map((e) => Object.values(e));
|
|
1009
|
+
function o(t) {
|
|
546
1010
|
return e.map((e) => e[t] ?? null, { skipVoid: !1 });
|
|
547
1011
|
}
|
|
548
|
-
function
|
|
1012
|
+
function s(t) {
|
|
549
1013
|
return e.map((e) => Object.values(e).find((e) => e.key === t) ?? null, { skipVoid: !1 });
|
|
550
1014
|
}
|
|
551
|
-
function
|
|
1015
|
+
function c(t) {
|
|
552
1016
|
return e.map((e) => Object.values(e).find((e) => e.name === t) ?? null, { skipVoid: !1 });
|
|
553
1017
|
}
|
|
554
1018
|
return {
|
|
555
1019
|
register: n,
|
|
556
|
-
update:
|
|
557
|
-
getById:
|
|
558
|
-
getByKey:
|
|
559
|
-
listStore:
|
|
560
|
-
getByName:
|
|
1020
|
+
update: i,
|
|
1021
|
+
getById: o,
|
|
1022
|
+
getByKey: s,
|
|
1023
|
+
listStore: a,
|
|
1024
|
+
getByName: c
|
|
561
1025
|
};
|
|
562
1026
|
});
|
|
563
|
-
function
|
|
564
|
-
return
|
|
1027
|
+
function qe() {
|
|
1028
|
+
return L(Ke);
|
|
565
1029
|
}
|
|
566
1030
|
//#endregion
|
|
567
1031
|
//#region src/entities/step/step.ts
|
|
568
|
-
var
|
|
569
|
-
let e =
|
|
1032
|
+
var Je = j("step"), Ye = I(() => {
|
|
1033
|
+
let e = Je.store({}), t = A(e, { register(e, t) {
|
|
570
1034
|
return {
|
|
571
1035
|
...e,
|
|
572
1036
|
[t.step.id]: t.step
|
|
@@ -590,16 +1054,16 @@ var Pe = E("step"), Fe = j(() => {
|
|
|
590
1054
|
indexStore: e
|
|
591
1055
|
};
|
|
592
1056
|
});
|
|
593
|
-
function
|
|
594
|
-
return
|
|
1057
|
+
function Xe() {
|
|
1058
|
+
return L(Ye);
|
|
595
1059
|
}
|
|
596
|
-
function
|
|
1060
|
+
function Ze(e, t) {
|
|
597
1061
|
t.register(e);
|
|
598
1062
|
}
|
|
599
1063
|
//#endregion
|
|
600
1064
|
//#region src/entities/action/action.ts
|
|
601
|
-
var
|
|
602
|
-
let t =
|
|
1065
|
+
var Qe = j("action"), $e = I(({ client: e }) => {
|
|
1066
|
+
let t = Qe.store({}), n = A(t, { register(e, t) {
|
|
603
1067
|
return {
|
|
604
1068
|
...e,
|
|
605
1069
|
[t.key]: {
|
|
@@ -607,55 +1071,68 @@ var Re = E("action"), ze = j(({ client: e }) => {
|
|
|
607
1071
|
action: t.action
|
|
608
1072
|
}
|
|
609
1073
|
};
|
|
610
|
-
} });
|
|
611
|
-
|
|
612
|
-
|
|
1074
|
+
} }), i = N();
|
|
1075
|
+
F({
|
|
1076
|
+
clock: i,
|
|
1077
|
+
source: t,
|
|
1078
|
+
filter: (e, { key: t }) => e[t] !== void 0,
|
|
1079
|
+
fn: (e, { key: t }) => `Action '${t}' already registered. Registering again will override the previous registration.`
|
|
1080
|
+
}).watch((e) => /* @__PURE__ */ r("warn", e)), F({
|
|
1081
|
+
clock: i,
|
|
1082
|
+
fn: ({ key: e, action: t }) => Object.freeze({
|
|
613
1083
|
key: e,
|
|
614
|
-
action:
|
|
615
|
-
})
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
1084
|
+
action: t
|
|
1085
|
+
}),
|
|
1086
|
+
target: n.register
|
|
1087
|
+
});
|
|
1088
|
+
let a = t.map((e) => Object.values(e));
|
|
1089
|
+
function o(e) {
|
|
619
1090
|
return t.map((t) => t[e]?.action, { skipVoid: !1 });
|
|
620
1091
|
}
|
|
621
|
-
function
|
|
622
|
-
let r =
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
1092
|
+
function s(t, n) {
|
|
1093
|
+
let r = P(() => void 0, { skipVoid: !1 }), i = n ? { experience: n.experience } : null, a = O({
|
|
1094
|
+
source: {
|
|
1095
|
+
action: o(t),
|
|
1096
|
+
snapshot: e.stateSnapshotStore
|
|
1097
|
+
},
|
|
1098
|
+
effect: ({ action: e, snapshot: t }) => {
|
|
1099
|
+
if (e) return (...n) => e({
|
|
1100
|
+
...t,
|
|
1101
|
+
args: n
|
|
1102
|
+
}, i);
|
|
1103
|
+
}
|
|
630
1104
|
});
|
|
631
|
-
return
|
|
1105
|
+
return F({
|
|
632
1106
|
source: {
|
|
633
1107
|
responses: e.responses.listStore,
|
|
634
1108
|
fields: e.fields.listStore
|
|
635
1109
|
},
|
|
636
|
-
target:
|
|
637
|
-
}),
|
|
638
|
-
clock:
|
|
1110
|
+
target: a
|
|
1111
|
+
}), F({
|
|
1112
|
+
clock: a.doneData,
|
|
639
1113
|
filter: (e) => e !== void 0,
|
|
640
1114
|
target: r
|
|
641
|
-
}),
|
|
1115
|
+
}), a(), r;
|
|
642
1116
|
}
|
|
643
1117
|
return {
|
|
644
|
-
register:
|
|
645
|
-
getByKey:
|
|
646
|
-
listStore:
|
|
647
|
-
getEvokableAction:
|
|
1118
|
+
register: i,
|
|
1119
|
+
getByKey: o,
|
|
1120
|
+
listStore: a,
|
|
1121
|
+
getEvokableAction: s
|
|
648
1122
|
};
|
|
649
1123
|
});
|
|
650
|
-
function
|
|
651
|
-
return
|
|
1124
|
+
function et(e) {
|
|
1125
|
+
return L($e, e);
|
|
652
1126
|
}
|
|
653
|
-
var
|
|
654
|
-
n.register(
|
|
1127
|
+
var tt = (e, t, n) => {
|
|
1128
|
+
n.register({
|
|
1129
|
+
key: e,
|
|
1130
|
+
action: t
|
|
1131
|
+
});
|
|
655
1132
|
};
|
|
656
1133
|
//#endregion
|
|
657
1134
|
//#region src/entities/response/response-validation.ts
|
|
658
|
-
function
|
|
1135
|
+
function Y(e, t, n, r) {
|
|
659
1136
|
return {
|
|
660
1137
|
fieldKey: e.key,
|
|
661
1138
|
userMessage: n,
|
|
@@ -663,62 +1140,62 @@ function q(e, t, n, r) {
|
|
|
663
1140
|
value: t
|
|
664
1141
|
};
|
|
665
1142
|
}
|
|
666
|
-
function
|
|
1143
|
+
function X(e) {
|
|
667
1144
|
return e === null || e === "" || Array.isArray(e) && !e.length;
|
|
668
1145
|
}
|
|
669
|
-
function
|
|
1146
|
+
function nt(e) {
|
|
670
1147
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
|
|
671
1148
|
}
|
|
672
|
-
function
|
|
1149
|
+
function Z(e) {
|
|
673
1150
|
try {
|
|
674
1151
|
return JSON.stringify(e), !0;
|
|
675
1152
|
} catch {
|
|
676
1153
|
return !1;
|
|
677
1154
|
}
|
|
678
1155
|
}
|
|
679
|
-
function
|
|
1156
|
+
function rt(e, t) {
|
|
680
1157
|
return t.find((t) => t.key === e) ?? null;
|
|
681
1158
|
}
|
|
682
|
-
function
|
|
1159
|
+
function it(e, t) {
|
|
683
1160
|
return e.multiple && (typeof t == "string" || typeof t == "number" || typeof t == "boolean") ? [t] : t;
|
|
684
1161
|
}
|
|
685
|
-
function
|
|
686
|
-
if (e.type !== "object" ||
|
|
1162
|
+
function at(e, t) {
|
|
1163
|
+
if (e.type !== "object" || X(t)) return null;
|
|
687
1164
|
if (e.multiple) {
|
|
688
|
-
if (!Array.isArray(t)) return
|
|
1165
|
+
if (!Array.isArray(t)) return Y(e, t, "This field expects multiple values", "Field expects an array of objects.");
|
|
689
1166
|
for (let n of t) {
|
|
690
|
-
if (typeof n != "object" || !n) return
|
|
691
|
-
if (!
|
|
1167
|
+
if (typeof n != "object" || !n) return Y(e, t, "This field expects object values", "Field expects an array of objects, but received non-object value.");
|
|
1168
|
+
if (!Z(n)) return Y(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
|
|
692
1169
|
}
|
|
693
1170
|
return null;
|
|
694
1171
|
}
|
|
695
|
-
return Array.isArray(t) ?
|
|
1172
|
+
return Array.isArray(t) ? Y(e, t, "This field expects a single value", "Field expects a single object, not an array.") : typeof t != "object" || !t ? Y(e, t, "This field expects an object value", "Field expects an object value.") : Z(t) ? null : Y(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
|
|
696
1173
|
}
|
|
697
|
-
function
|
|
698
|
-
if (
|
|
1174
|
+
function ot(e, t) {
|
|
1175
|
+
if (X(t) || !Array.isArray(e.options) || e.options.length === 0) return null;
|
|
699
1176
|
let n = Array.isArray(t) ? t : [t];
|
|
700
1177
|
if (e.type === "object") {
|
|
701
1178
|
let r = new Set(e.options.map((e) => JSON.stringify(e.value)));
|
|
702
|
-
return n.every((e) => r.has(JSON.stringify(e))) ? null :
|
|
1179
|
+
return n.every((e) => r.has(JSON.stringify(e))) ? null : Y(e, t, "This field expects a valid option", "Field expects a valid option from the defined choices.");
|
|
703
1180
|
}
|
|
704
1181
|
let r = e.options.map((e) => e.value);
|
|
705
|
-
return n.every((e) => !
|
|
1182
|
+
return n.every((e) => !nt(e) || e === null ? !1 : r.includes(e)) ? null : Y(e, t, "This field expects a valid option", `Field expects a valid option. Valid options are: ${r.join(", ")}`);
|
|
706
1183
|
}
|
|
707
|
-
async function
|
|
708
|
-
if (
|
|
709
|
-
let
|
|
1184
|
+
async function st(t, n, r, i) {
|
|
1185
|
+
if (n.validation && !e(n.validation) && !X(r)) {
|
|
1186
|
+
let e = i ? {
|
|
710
1187
|
$input: r,
|
|
711
1188
|
responses: i
|
|
712
|
-
} : { $input: r }, a = await
|
|
713
|
-
if (typeof a == "string") return
|
|
714
|
-
if (a === !1) return
|
|
1189
|
+
} : { $input: r }, a = await t(n.validation, e);
|
|
1190
|
+
if (typeof a == "string") return Y(n, r, a, `Field validation resulted in an error: ${a}.`);
|
|
1191
|
+
if (a === !1) return Y(n, r, "This field is invalid", "Field validation resulted in an unspecified error.");
|
|
715
1192
|
}
|
|
716
|
-
return
|
|
1193
|
+
return n.required && X(r) ? Y(n, r, "This field is required", "Field is required.") : !n.multiple && Array.isArray(r) && r.length > 1 ? Y(n, r, "This field expects a single response", "Field expects a single response.") : null;
|
|
717
1194
|
}
|
|
718
1195
|
//#endregion
|
|
719
1196
|
//#region src/entities/response/response.ts
|
|
720
|
-
var
|
|
721
|
-
let
|
|
1197
|
+
var ct = j("response"), lt = I(({ client: e }) => {
|
|
1198
|
+
let t = ct.store({}), r = N(), i = N(), a = A(t, {
|
|
722
1199
|
register(e, t) {
|
|
723
1200
|
return {
|
|
724
1201
|
...e,
|
|
@@ -747,17 +1224,17 @@ var Je = E("response"), Ye = j(({ client: e }) => {
|
|
|
747
1224
|
});
|
|
748
1225
|
} else a.registerBatch(e);
|
|
749
1226
|
}
|
|
750
|
-
let s = (
|
|
1227
|
+
let s = (t, r) => n(e, t, r), c = O({
|
|
751
1228
|
source: {
|
|
752
1229
|
allFields: e.fields.listStore,
|
|
753
|
-
existingResponses:
|
|
1230
|
+
existingResponses: t
|
|
754
1231
|
},
|
|
755
1232
|
effect: async ({ allFields: e, existingResponses: t }, n) => {
|
|
756
1233
|
let r = [], i = {}, a = {
|
|
757
1234
|
...t,
|
|
758
1235
|
...n
|
|
759
1236
|
}, o = Object.entries(n), c = await Promise.allSettled(o.map(async ([t, n]) => {
|
|
760
|
-
let o =
|
|
1237
|
+
let o = rt(t, e);
|
|
761
1238
|
if (!o) {
|
|
762
1239
|
r.push({
|
|
763
1240
|
fieldKey: t,
|
|
@@ -767,17 +1244,17 @@ var Je = E("response"), Ye = j(({ client: e }) => {
|
|
|
767
1244
|
});
|
|
768
1245
|
return;
|
|
769
1246
|
}
|
|
770
|
-
let c =
|
|
1247
|
+
let c = it(o, n), l = await st(s, o, c, a);
|
|
771
1248
|
if (l) {
|
|
772
1249
|
r.push(l);
|
|
773
1250
|
return;
|
|
774
1251
|
}
|
|
775
|
-
let u =
|
|
1252
|
+
let u = at(o, c);
|
|
776
1253
|
if (u) {
|
|
777
1254
|
r.push(u);
|
|
778
1255
|
return;
|
|
779
1256
|
}
|
|
780
|
-
let d =
|
|
1257
|
+
let d = ot(o, c);
|
|
781
1258
|
if (d) {
|
|
782
1259
|
r.push(d);
|
|
783
1260
|
return;
|
|
@@ -805,8 +1282,8 @@ var Je = E("response"), Ye = j(({ client: e }) => {
|
|
|
805
1282
|
async function l(e) {
|
|
806
1283
|
return c(e);
|
|
807
1284
|
}
|
|
808
|
-
let u =
|
|
809
|
-
source:
|
|
1285
|
+
let u = O({
|
|
1286
|
+
source: t,
|
|
810
1287
|
effect: async (e, t) => {
|
|
811
1288
|
let { responsesToCommit: n, validationErrors: r } = await c(t);
|
|
812
1289
|
return r.length ? { errors: r } : (a.registerBatch(n), { errors: [] });
|
|
@@ -815,14 +1292,14 @@ var Je = E("response"), Ye = j(({ client: e }) => {
|
|
|
815
1292
|
async function d(e) {
|
|
816
1293
|
return u(e);
|
|
817
1294
|
}
|
|
818
|
-
let f =
|
|
1295
|
+
let f = t.map((e) => e), p = t.map((e) => Object.entries(e).map(([e, t]) => ({
|
|
819
1296
|
fieldKey: e,
|
|
820
1297
|
value: t
|
|
821
1298
|
})));
|
|
822
1299
|
function m(e) {
|
|
823
|
-
return
|
|
1300
|
+
return k({
|
|
824
1301
|
f: e,
|
|
825
|
-
s:
|
|
1302
|
+
s: t
|
|
826
1303
|
}, ({ f: e, s: t }) => {
|
|
827
1304
|
let n = e ? t[e.key] ?? null : null;
|
|
828
1305
|
return n === null ? e?.defaultValue !== void 0 && e.defaultValue !== null ? e.defaultValue : null : n;
|
|
@@ -837,10 +1314,10 @@ var Je = E("response"), Ye = j(({ client: e }) => {
|
|
|
837
1314
|
function _(t) {
|
|
838
1315
|
return m(e.fields.getByName(t));
|
|
839
1316
|
}
|
|
840
|
-
return
|
|
1317
|
+
return F({
|
|
841
1318
|
clock: r,
|
|
842
1319
|
target: a.clearAll
|
|
843
|
-
}),
|
|
1320
|
+
}), F({
|
|
844
1321
|
clock: i,
|
|
845
1322
|
target: a.clear
|
|
846
1323
|
}), {
|
|
@@ -856,13 +1333,13 @@ var Je = E("response"), Ye = j(({ client: e }) => {
|
|
|
856
1333
|
getByFieldName: _
|
|
857
1334
|
};
|
|
858
1335
|
});
|
|
859
|
-
function
|
|
860
|
-
return
|
|
1336
|
+
function ut(e) {
|
|
1337
|
+
return L(lt, e);
|
|
861
1338
|
}
|
|
862
1339
|
//#endregion
|
|
863
1340
|
//#region src/entities/condition/condition.ts
|
|
864
|
-
var
|
|
865
|
-
let e =
|
|
1341
|
+
var dt = j("condition"), ft = I(() => {
|
|
1342
|
+
let e = dt.store({}), t = A(e, { register(e, t) {
|
|
866
1343
|
return {
|
|
867
1344
|
...e,
|
|
868
1345
|
[t.condition.id]: t.condition
|
|
@@ -886,12 +1363,12 @@ var Ze = E("condition"), Qe = j(() => {
|
|
|
886
1363
|
indexStore: e
|
|
887
1364
|
};
|
|
888
1365
|
});
|
|
889
|
-
function
|
|
890
|
-
return
|
|
1366
|
+
function pt() {
|
|
1367
|
+
return L(ft);
|
|
891
1368
|
}
|
|
892
1369
|
//#endregion
|
|
893
1370
|
//#region src/utils/api-url.ts
|
|
894
|
-
function
|
|
1371
|
+
function mt() {
|
|
895
1372
|
if (f()) {
|
|
896
1373
|
let e = [
|
|
897
1374
|
document.currentScript,
|
|
@@ -906,7 +1383,7 @@ function et() {
|
|
|
906
1383
|
}
|
|
907
1384
|
//#endregion
|
|
908
1385
|
//#region src/utils/search-params.ts
|
|
909
|
-
function
|
|
1386
|
+
function ht() {
|
|
910
1387
|
if (!o()) return {};
|
|
911
1388
|
let e = new URLSearchParams(window.location.search), t = {}, n = /* @__PURE__ */ new Set();
|
|
912
1389
|
for (let [t] of e.entries()) t.startsWith("picked-") && n.add(t);
|
|
@@ -914,75 +1391,104 @@ function tt() {
|
|
|
914
1391
|
let n = r.replace("picked-", "");
|
|
915
1392
|
t[n] = e.getAll(r);
|
|
916
1393
|
}
|
|
917
|
-
let r =
|
|
918
|
-
if (n.size > 0)
|
|
1394
|
+
let r = E("s");
|
|
1395
|
+
if (n.size > 0) T.set(r, t);
|
|
919
1396
|
else {
|
|
920
|
-
let e =
|
|
1397
|
+
let e = T.get(r);
|
|
921
1398
|
if (e) return e.json() || {};
|
|
922
1399
|
}
|
|
923
1400
|
return t;
|
|
924
1401
|
}
|
|
925
1402
|
//#endregion
|
|
926
|
-
//#region src/
|
|
927
|
-
|
|
1403
|
+
//#region src/entities/session/session.ts
|
|
1404
|
+
var Q = E("session", "global");
|
|
1405
|
+
function gt() {
|
|
928
1406
|
return l() ? crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).substring(2, 15)}-${Math.random().toString(36).substring(2, 15)}-${Math.random().toString(36).substring(2, 15)}`;
|
|
929
1407
|
}
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
e
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
1408
|
+
function _t() {
|
|
1409
|
+
if (!u()) return null;
|
|
1410
|
+
let e = w.get(Q);
|
|
1411
|
+
if (!e.isSet()) return null;
|
|
1412
|
+
try {
|
|
1413
|
+
return e.json();
|
|
1414
|
+
} catch {
|
|
1415
|
+
return null;
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
var vt = I(() => {
|
|
1419
|
+
let e = _t(), t = { id: e?.id ?? gt() };
|
|
1420
|
+
e?.isUser !== void 0 && (t.isUser = e.isUser), e?.identifiers && Object.keys(e.identifiers).length > 0 && (t.identifiers = e.identifiers);
|
|
1421
|
+
let n = P(t), r = A(n, {
|
|
1422
|
+
setIsUser: (e, t) => ({
|
|
1423
|
+
...e,
|
|
1424
|
+
isUser: t
|
|
1425
|
+
}),
|
|
1426
|
+
setIdentifier: (e, { key: t, value: n }) => ({
|
|
1427
|
+
...e,
|
|
1428
|
+
identifiers: {
|
|
1429
|
+
...e.identifiers ?? {},
|
|
1430
|
+
[t]: n
|
|
1431
|
+
}
|
|
1432
|
+
}),
|
|
1433
|
+
removeIdentifier: (e, t) => {
|
|
1434
|
+
let n = e.identifiers;
|
|
1435
|
+
if (!n || !(t in n)) return e;
|
|
1436
|
+
let r = {};
|
|
1437
|
+
for (let [e, i] of Object.entries(n)) e !== t && (r[e] = i);
|
|
1438
|
+
let i = { id: e.id };
|
|
1439
|
+
return e.isUser !== void 0 && (i.isUser = e.isUser), Object.keys(r).length > 0 && (i.identifiers = r), i;
|
|
952
1440
|
}
|
|
1441
|
+
});
|
|
1442
|
+
return F({
|
|
1443
|
+
source: n,
|
|
1444
|
+
target: O({
|
|
1445
|
+
source: n,
|
|
1446
|
+
effect: (e) => {
|
|
1447
|
+
if (u()) try {
|
|
1448
|
+
w.get(Q).set(e);
|
|
1449
|
+
} catch {}
|
|
1450
|
+
}
|
|
1451
|
+
})
|
|
1452
|
+
}), {
|
|
1453
|
+
store: n,
|
|
1454
|
+
setIsUser: r.setIsUser,
|
|
1455
|
+
setIdentifier: r.setIdentifier,
|
|
1456
|
+
removeIdentifier: r.removeIdentifier
|
|
953
1457
|
};
|
|
954
|
-
|
|
955
|
-
|
|
1458
|
+
});
|
|
1459
|
+
function yt() {
|
|
1460
|
+
return L(vt, void 0);
|
|
1461
|
+
}
|
|
956
1462
|
//#endregion
|
|
957
1463
|
//#region src/utils/picked-config.ts
|
|
958
|
-
function
|
|
1464
|
+
function bt() {
|
|
959
1465
|
if (o()) return globalThis.window.pickedConfig;
|
|
960
1466
|
}
|
|
961
|
-
function
|
|
962
|
-
if (o()) return
|
|
1467
|
+
function xt() {
|
|
1468
|
+
if (o()) return bt()?.projectId;
|
|
963
1469
|
}
|
|
964
|
-
function
|
|
1470
|
+
function St() {
|
|
965
1471
|
if (!f()) return;
|
|
966
1472
|
let e = document.getElementById("picked_script") || document.querySelector("script#picked") || document.getElementById("cvly");
|
|
967
1473
|
if (e) return e.dataset.projectid || e.getAttribute("project-id") || void 0;
|
|
968
1474
|
}
|
|
969
|
-
function
|
|
1475
|
+
function Ct(e) {
|
|
970
1476
|
if (e.projectId) return e.projectId;
|
|
971
|
-
let t =
|
|
1477
|
+
let t = xt();
|
|
972
1478
|
if (t) return t;
|
|
973
|
-
let n =
|
|
1479
|
+
let n = St();
|
|
974
1480
|
if (n) return n;
|
|
975
1481
|
throw Error("projectId is required. You can provide it via one of:\n (1) createClient({ projectId }) options;\n (2) window.pickedConfig = { projectId };\n (3) a <script> tag with id 'picked_script', 'picked', or 'cvly' that includes a data-projectid (or project-id) attribute.");
|
|
976
1482
|
}
|
|
977
1483
|
//#endregion
|
|
978
1484
|
//#region src/utils/render-string.ts
|
|
979
|
-
function
|
|
1485
|
+
function $(e) {
|
|
980
1486
|
return e == null || e === "" || Number.isNaN(e);
|
|
981
1487
|
}
|
|
982
|
-
var
|
|
983
|
-
default: (e, t) =>
|
|
984
|
-
append: (e, t) => t &&
|
|
985
|
-
prepend: (e, t) => t &&
|
|
1488
|
+
var wt = {
|
|
1489
|
+
default: (e, t) => $(e) ? String(t ?? "") : String(e),
|
|
1490
|
+
append: (e, t) => t && !$(e) ? `${e} ${t}` : e,
|
|
1491
|
+
prepend: (e, t) => t && !$(e) ? `${t} ${e}` : e,
|
|
986
1492
|
upper: (e) => typeof e == "string" ? e.toUpperCase() : e,
|
|
987
1493
|
lower: (e) => typeof e == "string" ? e.toLowerCase() : e,
|
|
988
1494
|
capitalize: (e) => typeof e == "string" ? e.charAt(0).toUpperCase() + e.slice(1) : e,
|
|
@@ -1000,24 +1506,24 @@ var ct = {
|
|
|
1000
1506
|
return e instanceof Set ? t.format(Array.from(e).map(String)) : e;
|
|
1001
1507
|
}
|
|
1002
1508
|
};
|
|
1003
|
-
function
|
|
1509
|
+
function Tt(e) {
|
|
1004
1510
|
return typeof e == "object" && !!e;
|
|
1005
1511
|
}
|
|
1006
|
-
function
|
|
1512
|
+
function Et(e, t) {
|
|
1007
1513
|
let n = t;
|
|
1008
|
-
for (let t of e.split(".")) if (
|
|
1514
|
+
for (let t of e.split(".")) if (Tt(n) && t in n) n = n[t];
|
|
1009
1515
|
else return;
|
|
1010
1516
|
return typeof n == "function" ? n() : n;
|
|
1011
1517
|
}
|
|
1012
|
-
function
|
|
1013
|
-
let n = e.split("|").map((e) => e.trim()), r =
|
|
1518
|
+
function Dt(e, t) {
|
|
1519
|
+
let n = e.split("|").map((e) => e.trim()), r = Et(n.shift() ?? "", t);
|
|
1014
1520
|
for (let e of n) {
|
|
1015
|
-
let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o =
|
|
1521
|
+
let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o = wt[i];
|
|
1016
1522
|
o && (r = o(r, a));
|
|
1017
1523
|
}
|
|
1018
|
-
return
|
|
1524
|
+
return $(r) ? "" : typeof r == "object" ? JSON.stringify(r) : String(r);
|
|
1019
1525
|
}
|
|
1020
|
-
function
|
|
1526
|
+
function Ot(e, t) {
|
|
1021
1527
|
let n = "", r = 0;
|
|
1022
1528
|
for (; r < e.length;) if (e[r] === "{" && e[r + 1] === "{") {
|
|
1023
1529
|
r += 2;
|
|
@@ -1029,90 +1535,77 @@ function ft(e, t) {
|
|
|
1029
1535
|
}
|
|
1030
1536
|
i += e[r++];
|
|
1031
1537
|
}
|
|
1032
|
-
n +=
|
|
1538
|
+
n += Dt(i.trim(), t);
|
|
1033
1539
|
} else n += e[r++];
|
|
1034
1540
|
return n;
|
|
1035
1541
|
}
|
|
1036
1542
|
//#endregion
|
|
1037
1543
|
//#region src/picked.ts
|
|
1038
|
-
var
|
|
1544
|
+
var kt = class {
|
|
1039
1545
|
static logger = r;
|
|
1040
1546
|
options;
|
|
1041
|
-
isReady = !1;
|
|
1042
1547
|
plugins = {};
|
|
1043
|
-
|
|
1044
|
-
eventBus = O();
|
|
1548
|
+
eventBus = N();
|
|
1045
1549
|
events;
|
|
1046
1550
|
projectId;
|
|
1047
1551
|
apiUrl;
|
|
1048
1552
|
dashboardUrl;
|
|
1049
1553
|
documentationSiteUrl;
|
|
1050
|
-
session;
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1554
|
+
session = yt();
|
|
1555
|
+
searchParams = ht();
|
|
1556
|
+
history = He();
|
|
1557
|
+
components = he({ client: this });
|
|
1558
|
+
experienceInstances = x({ client: this });
|
|
1559
|
+
experiences = se({ client: this });
|
|
1560
|
+
frameworks = ye({ client: this });
|
|
1561
|
+
predicates = Fe({ client: this });
|
|
1562
|
+
features = ze({ client: this });
|
|
1563
|
+
conditions = pt();
|
|
1564
|
+
fields = qe();
|
|
1565
|
+
responses = ut({ client: this });
|
|
1566
|
+
steps = Xe();
|
|
1567
|
+
actions = et({ client: this });
|
|
1568
|
+
stateSnapshotStore = Se({ client: this });
|
|
1569
|
+
evaluateRuleLogicFx = De({ client: this });
|
|
1570
|
+
start;
|
|
1571
|
+
readyStore;
|
|
1572
|
+
preconditionPassedStore;
|
|
1573
|
+
conditionPassedStore;
|
|
1574
|
+
lifecycleStageStore;
|
|
1575
|
+
lifecycle = Me({ client: this });
|
|
1576
|
+
renderStringFx = O({
|
|
1577
|
+
source: this.responses.listStore,
|
|
1578
|
+
effect: (e, { template: t, context: n }) => {
|
|
1579
|
+
let r = {};
|
|
1580
|
+
for (let t of e) r[t.fieldKey] = t.value;
|
|
1581
|
+
return Ot(t, {
|
|
1582
|
+
...n,
|
|
1583
|
+
responses: r
|
|
1584
|
+
});
|
|
1585
|
+
}
|
|
1586
|
+
});
|
|
1067
1587
|
constructor(e) {
|
|
1068
|
-
this.events =
|
|
1588
|
+
this.events = We(this.eventBus), this.projectId = Ct(e), this.options = Object.freeze(e), this.apiUrl = e.apiUrl || mt(), this.dashboardUrl = e.dashboardUrl ?? "https://dashboard.picked.app", this.documentationSiteUrl = e.documentationSiteUrl ?? "https://docs.picked.app", this.start = this.lifecycle.start, this.readyStore = this.lifecycle.readyStore, this.preconditionPassedStore = this.lifecycle.preconditionPassedStore, this.conditionPassedStore = this.lifecycle.conditionPassedStore, this.lifecycleStageStore = this.lifecycle.lifecycleStageStore, this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.setupActions(), this.setupComponents(), this.lifecycle.setPrecondition(e.precondition), this.lifecycle.setCondition(e.condition), this.eventBus({
|
|
1069
1589
|
type: "load",
|
|
1070
|
-
version:
|
|
1590
|
+
version: te()
|
|
1071
1591
|
});
|
|
1072
1592
|
}
|
|
1073
|
-
start = () => {
|
|
1074
|
-
ye(this), (async () => {
|
|
1075
|
-
if (!f()) return;
|
|
1076
|
-
await this.runPluginStartHooks();
|
|
1077
|
-
let e = await this.evaluateGate(this.precondition);
|
|
1078
|
-
this.preconditionPassed = e;
|
|
1079
|
-
let t;
|
|
1080
|
-
e && (t = await this.evaluateGate(this.condition));
|
|
1081
|
-
let n = e && t === !0;
|
|
1082
|
-
if (typeof t == "boolean" && this.session) {
|
|
1083
|
-
let e = t;
|
|
1084
|
-
this.session.setIsUser(e), this.eventBus({
|
|
1085
|
-
type: "user_decide",
|
|
1086
|
-
value: e
|
|
1087
|
-
});
|
|
1088
|
-
}
|
|
1089
|
-
if (this.eventBus({ type: "initialize" }), n && F(this), await ne(), n && F(this), this.eventBus({ type: "ready" }), this.isReady = !0, this.session) {
|
|
1090
|
-
let { id: e, isUser: t, identifiers: n } = this.session;
|
|
1091
|
-
this.eventBus({
|
|
1092
|
-
type: "session",
|
|
1093
|
-
id: e,
|
|
1094
|
-
isUser: t,
|
|
1095
|
-
identifiers: n
|
|
1096
|
-
});
|
|
1097
|
-
}
|
|
1098
|
-
})();
|
|
1099
|
-
};
|
|
1100
1593
|
registerFramework = (e) => {
|
|
1101
|
-
|
|
1594
|
+
be(e, this.frameworks);
|
|
1102
1595
|
};
|
|
1103
1596
|
registerComponent = (e, t) => {
|
|
1104
|
-
|
|
1597
|
+
ge(e, t, this.components);
|
|
1105
1598
|
};
|
|
1106
1599
|
registerPlugin = (e) => {
|
|
1107
|
-
|
|
1600
|
+
ue(this, e, this.plugins);
|
|
1108
1601
|
let t = this.plugins[e.name];
|
|
1109
|
-
t?.onStart && this.
|
|
1602
|
+
t?.onStart && this.lifecycle.registerPluginStartHook(t.onStart);
|
|
1110
1603
|
};
|
|
1111
1604
|
registerFeature = (e, t) => {
|
|
1112
|
-
|
|
1605
|
+
Be(e, t, this.features);
|
|
1113
1606
|
};
|
|
1114
1607
|
registerPredicate = (e, t) => {
|
|
1115
|
-
|
|
1608
|
+
Ie(e, t, this.predicates);
|
|
1116
1609
|
};
|
|
1117
1610
|
registerCondition = (e) => {
|
|
1118
1611
|
this.conditions.register(e);
|
|
@@ -1121,15 +1614,14 @@ var $ = class {
|
|
|
1121
1614
|
this.fields.register(e);
|
|
1122
1615
|
};
|
|
1123
1616
|
registerStep = (e) => {
|
|
1124
|
-
|
|
1617
|
+
Ze(e, this.steps);
|
|
1125
1618
|
};
|
|
1126
1619
|
registerAction = (e, t) => {
|
|
1127
|
-
|
|
1620
|
+
tt(e, t, this.actions);
|
|
1128
1621
|
};
|
|
1129
1622
|
registerExperience = (e) => {
|
|
1130
|
-
e.component &&
|
|
1623
|
+
e.component && ge(`experience:${e.id}`, e.component, this.components), this.experiences.register(e);
|
|
1131
1624
|
};
|
|
1132
|
-
getStateSnapshot = () => U(this);
|
|
1133
1625
|
launchExperienceById = async (e, t) => {
|
|
1134
1626
|
this.experiences.launch({
|
|
1135
1627
|
id: e,
|
|
@@ -1148,12 +1640,6 @@ var $ = class {
|
|
|
1148
1640
|
openExperienceByKey = async (e) => {
|
|
1149
1641
|
this.experiences.open({ key: e });
|
|
1150
1642
|
};
|
|
1151
|
-
async runPluginStartHooks() {
|
|
1152
|
-
for (let e of this.pluginStartHooks) await e();
|
|
1153
|
-
}
|
|
1154
|
-
async evaluateGate(e) {
|
|
1155
|
-
return e === void 0 ? !0 : typeof e == "boolean" ? e : await t(this, e) === !0;
|
|
1156
|
-
}
|
|
1157
1643
|
setupPlugins() {
|
|
1158
1644
|
this.options.plugins?.forEach((e) => {
|
|
1159
1645
|
if (Array.isArray(e)) {
|
|
@@ -1216,30 +1702,23 @@ var $ = class {
|
|
|
1216
1702
|
});
|
|
1217
1703
|
}
|
|
1218
1704
|
getPluginConfig = (e) => this.plugins[e] ?? {};
|
|
1219
|
-
renderString = (e, t) => {
|
|
1220
|
-
let n = this.responses.listStore.getState().reduce((e, t) => (e[t.fieldKey] = t.value, e), {});
|
|
1221
|
-
return ft(e, {
|
|
1222
|
-
...t,
|
|
1223
|
-
responses: n
|
|
1224
|
-
});
|
|
1225
|
-
};
|
|
1226
1705
|
};
|
|
1227
1706
|
//#endregion
|
|
1228
1707
|
//#region src/entities/component/lazyComponent.ts
|
|
1229
|
-
function
|
|
1708
|
+
function At(e) {
|
|
1230
1709
|
return {
|
|
1231
1710
|
$$type: "lazy-component",
|
|
1232
1711
|
load: e
|
|
1233
1712
|
};
|
|
1234
1713
|
}
|
|
1235
|
-
function
|
|
1714
|
+
function jt(e) {
|
|
1236
1715
|
return typeof e == "object" && !!e && "$$type" in e && e.$$type === "lazy-component";
|
|
1237
1716
|
}
|
|
1238
1717
|
//#endregion
|
|
1239
1718
|
//#region src/exports.ts
|
|
1240
|
-
var
|
|
1241
|
-
let t = new
|
|
1719
|
+
var Mt = (e) => {
|
|
1720
|
+
let t = new kt(e);
|
|
1242
1721
|
return d(t), t;
|
|
1243
1722
|
};
|
|
1244
1723
|
//#endregion
|
|
1245
|
-
export {
|
|
1724
|
+
export { kt as Picked, Mt as createClient, le as createPluginEffect, E as createStorageKey, n as evaluateRuleLogic, bt as getPickedConfig, jt as isLazyLoader, g as isPickedRoot, At as lazyComponent, w as localStore, T as sessionStore, C as subscribe, m as supportsCookies, l as supportsCryptoRandomUUID, f as supportsDocument, s as supportsHistory, i as supportsIntersectionObserver, u as supportsLocalStorage, p as supportsLocation, a as supportsSessionStorage, c as supportsShadowRoot, h as supportsWebComponents, o as supportsWindow };
|