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