@picked/client 0.0.1-dev.1777597464369 → 0.0.1-dev.1777601813342
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{api-DHbW5EXc.cjs → api-BAOO2VZv.cjs} +1 -1
- package/dist/{api-BvbkpgoT.js → api-CiR56vZg.js} +1 -1
- package/dist/cjs/form/index.js +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/plugins/create-experience/index.js +1 -1
- package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
- package/dist/cjs/plugins/experience-browser-storage/index.js +1 -1
- package/dist/cjs/plugins/history-browser-storage/index.js +1 -1
- package/dist/cjs/plugins/responses-browser-storage/index.js +1 -1
- package/dist/cjs/plugins/responses-indexeddb/index.js +1 -1
- package/dist/cjs/plugins/single-page-app/index.js +1 -1
- package/dist/cjs/plugins/web-components/index.js +1 -1
- package/dist/cjs/plugins/window-object/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/esm/form/index.js +8 -16
- package/dist/esm/index.js +181 -307
- package/dist/esm/plugins/create-experience/index.js +1 -1
- package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
- package/dist/esm/plugins/experience-browser-storage/index.js +2 -2
- 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/responses-indexeddb/index.js +1 -1
- package/dist/esm/plugins/single-page-app/index.js +93 -25
- package/dist/esm/plugins/web-components/index.js +2 -2
- package/dist/esm/plugins/window-object/index.js +1 -1
- package/dist/esm/server/index.js +1 -1
- package/dist/experience-CR19HpPg.js +136 -0
- package/dist/experience-DOWnsvA1.cjs +1 -0
- package/dist/experience-instance-C2jZU8ho.cjs +1 -0
- package/dist/experience-instance-CGLdwg--.js +400 -0
- package/dist/nodes-Bmzx3TP_.js +101 -0
- package/dist/nodes-Dx9bxj35.cjs +1 -0
- package/dist/rules-logic-CvILqbhz.js +266 -0
- package/dist/rules-logic-DV5SUr5M.cjs +1 -0
- package/dist/supports-DFDQ6eJO.cjs +1 -0
- package/dist/{supports-0XIfd4-R.js → supports-DUJbucFW.js} +18 -9
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/framework/framework.d.ts +12 -0
- package/dist/types/entities/framework/framework.d.ts.map +1 -1
- package/dist/types/form/create-form.d.ts +0 -22
- package/dist/types/form/create-form.d.ts.map +1 -1
- package/dist/types/plugins/single-page-app/index.d.ts +2 -1
- package/dist/types/plugins/single-page-app/index.d.ts.map +1 -1
- package/dist/types/plugins/single-page-app/plugin.d.ts +92 -9
- package/dist/types/plugins/single-page-app/plugin.d.ts.map +1 -1
- package/dist/types/utils/global-obj.d.ts +5 -0
- package/dist/types/utils/global-obj.d.ts.map +1 -1
- package/dist/types/utils/supports.d.ts +113 -0
- package/dist/types/utils/supports.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/experience-instance-DC2gKwA6.cjs +0 -1
- package/dist/experience-instance-DJaNc5Ob.js +0 -486
- package/dist/object-C82v79xc.js +0 -25
- package/dist/object-CUJOjanb.cjs +0 -1
- package/dist/rules-logic-BTIxfrJJ.js +0 -240
- package/dist/rules-logic-DNLOv90w.cjs +0 -1
- package/dist/supports-Dsjg-82e.cjs +0 -1
- /package/dist/{id-Bv44ilEo.cjs → id-Cg7fVl1O.cjs} +0 -0
- /package/dist/{id-CRqy981z.js → id-n2yrHvNo.js} +0 -0
- /package/dist/{logger-6z_gb4rA.js → logger-C44jSdYl.js} +0 -0
- /package/dist/{logger-fbvQC40v.cjs → logger-CJUj90QX.cjs} +0 -0
package/dist/esm/index.js
CHANGED
|
@@ -1,142 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as n } from "../
|
|
3
|
-
import {
|
|
4
|
-
import { a as
|
|
5
|
-
import {
|
|
6
|
-
import { i as
|
|
7
|
-
import { n as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return {
|
|
15
|
-
...e,
|
|
16
|
-
...t.experience
|
|
17
|
-
};
|
|
18
|
-
} }), i = n.map((e) => ({
|
|
19
|
-
name: e.name,
|
|
20
|
-
decisionLogic: e.condition,
|
|
21
|
-
targetSelectors: e.targets,
|
|
22
|
-
initializeOpenLogic: e.initializeOpen
|
|
23
|
-
})), a = w(n, 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 }), o = w(n, 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(re).map((e) => n[e.conditionId]).filter((e) => e !== void 0);
|
|
25
|
-
return {
|
|
26
|
-
steps: r,
|
|
27
|
-
nodes: e.nodes,
|
|
28
|
-
edges: e.edges,
|
|
29
|
-
conditions: i
|
|
30
|
-
};
|
|
31
|
-
}), s = t.actions ?? [];
|
|
32
|
-
return {
|
|
33
|
-
id: t.id,
|
|
34
|
-
key: t.key,
|
|
35
|
-
name: t.name,
|
|
36
|
-
configStore: i,
|
|
37
|
-
treeStore: o,
|
|
38
|
-
componentStore: a,
|
|
39
|
-
actions: s,
|
|
40
|
-
merge: r.merge
|
|
41
|
-
};
|
|
42
|
-
});
|
|
43
|
-
function le(e) {
|
|
44
|
-
return M(ce, e);
|
|
45
|
-
}
|
|
46
|
-
var ue = j(({ client: e }) => {
|
|
47
|
-
let t = N.store({}), n = T(t, { register(e, t) {
|
|
48
|
-
return {
|
|
49
|
-
...e,
|
|
50
|
-
[t.id]: t
|
|
51
|
-
};
|
|
52
|
-
} });
|
|
53
|
-
function r(r) {
|
|
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({
|
|
63
|
-
client: e,
|
|
64
|
-
experience: r
|
|
65
|
-
});
|
|
66
|
-
n.register(a);
|
|
67
|
-
}
|
|
68
|
-
let i = t.map((e) => Object.values(e));
|
|
69
|
-
function a(e) {
|
|
70
|
-
return t.map((t) => t[e], { skipVoid: !1 });
|
|
71
|
-
}
|
|
72
|
-
function o(e) {
|
|
73
|
-
return t.map((t) => Object.values(t).find((t) => t.key === e) ?? t[e], { skipVoid: !1 });
|
|
74
|
-
}
|
|
75
|
-
let s = C({
|
|
76
|
-
source: t,
|
|
77
|
-
effect: async (t, n) => {
|
|
78
|
-
let r = "key" in n ? Object.values(t).find((e) => e.key === n.key) : t[n.id];
|
|
79
|
-
if (!r) {
|
|
80
|
-
"key" in n ? `${n.key}` : `${n.id}`;
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
let { options: i } = n;
|
|
84
|
-
if (i?.bypassCondition) {
|
|
85
|
-
P(e, r, i);
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
await I(e, r) && P(e, r, i);
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
return {
|
|
92
|
-
register: r,
|
|
93
|
-
get: a,
|
|
94
|
-
getById: a,
|
|
95
|
-
getByKey: o,
|
|
96
|
-
launch: s,
|
|
97
|
-
open: C({
|
|
98
|
-
source: {
|
|
99
|
-
experiences: t,
|
|
100
|
-
instances: e.experienceInstances.listStore
|
|
101
|
-
},
|
|
102
|
-
effect: ({ experiences: e, instances: t }, n) => {
|
|
103
|
-
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) for (let e of i) e.open();
|
|
105
|
-
else s("key" in n ? {
|
|
106
|
-
key: n.key,
|
|
107
|
-
options: {
|
|
108
|
-
...n.options,
|
|
109
|
-
initialiseOpen: !0
|
|
110
|
-
}
|
|
111
|
-
} : {
|
|
112
|
-
id: n.id,
|
|
113
|
-
options: {
|
|
114
|
-
...n.options,
|
|
115
|
-
initialiseOpen: !0
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}),
|
|
120
|
-
listStore: i
|
|
121
|
-
};
|
|
122
|
-
});
|
|
123
|
-
function de(e) {
|
|
124
|
-
return M(ue, e);
|
|
125
|
-
}
|
|
126
|
-
var P = (e, t, n) => {
|
|
127
|
-
let { targetSelectors: r } = t.configStore.getState(), i = y(r, t.id);
|
|
128
|
-
i.forEach(({ elements: e }) => e.forEach((e) => ee(e, t.id))), g(i, t.id, t.key).forEach((r) => {
|
|
129
|
-
n ? e.experienceInstances.spawn(t, r, n) : e.experienceInstances.spawn(t, r);
|
|
130
|
-
});
|
|
131
|
-
}, F = async (e) => {
|
|
132
|
-
await Promise.all(e.experiences.listStore.getState().map(async (t) => {
|
|
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) => {
|
|
1
|
+
import { r as e, t } from "../rules-logic-CvILqbhz.js";
|
|
2
|
+
import { t as n } from "../logger-C44jSdYl.js";
|
|
3
|
+
import { a as r, c as i, d as a, f as o, i as s, l as c, m as l, n as u, o as d, r as f, s as p, t as m, u as h } from "../supports-DUJbucFW.js";
|
|
4
|
+
import { a as g, c as _, u as ee } from "../nodes-Bmzx3TP_.js";
|
|
5
|
+
import { n as v, t as te } from "../experience-CR19HpPg.js";
|
|
6
|
+
import { i as ne, n as y, r as b, t as x } from "../storage-6Xk0uAxB.js";
|
|
7
|
+
import { n as S, r as C } from "../api-CiR56vZg.js";
|
|
8
|
+
import { n as re } from "../experience-instance-CGLdwg--.js";
|
|
9
|
+
import { t as ie } from "../id-n2yrHvNo.js";
|
|
10
|
+
import { attach as w, combine as T, createApi as E, createDomain as D, createEffect as O, createEvent as k, createStore as A, sample as j } from "effector";
|
|
11
|
+
import { createFactory as M, invoke as N } from "@withease/factories";
|
|
12
|
+
//#region src/entities/plugin/plugin.ts
|
|
13
|
+
var ae = (e, t, n) => {
|
|
140
14
|
let r = t.name, i = t.setup(e);
|
|
141
15
|
if (i) {
|
|
142
16
|
let e = n[r] ?? {};
|
|
@@ -145,16 +19,16 @@ var P = (e, t, n) => {
|
|
|
145
19
|
...i
|
|
146
20
|
});
|
|
147
21
|
}
|
|
148
|
-
},
|
|
22
|
+
}, oe = D("component"), se = M(({ client: e, component: t, name: n }) => ({
|
|
149
23
|
name: n,
|
|
150
24
|
component: t,
|
|
151
25
|
frameworkStore: e.frameworks.getByName(t.frameworkName)
|
|
152
26
|
}));
|
|
153
|
-
function
|
|
154
|
-
return
|
|
27
|
+
function ce(e) {
|
|
28
|
+
return N(se, e);
|
|
155
29
|
}
|
|
156
|
-
var
|
|
157
|
-
let t =
|
|
30
|
+
var le = M(({ client: e }) => {
|
|
31
|
+
let t = oe.store({}), n = E(t, { register(e, t) {
|
|
158
32
|
return {
|
|
159
33
|
...e,
|
|
160
34
|
[t.name]: t
|
|
@@ -162,7 +36,7 @@ var B = j(({ client: e }) => {
|
|
|
162
36
|
} });
|
|
163
37
|
function r(r, i) {
|
|
164
38
|
t.getState()[r] && `${r}`;
|
|
165
|
-
let a =
|
|
39
|
+
let a = ce({
|
|
166
40
|
client: e,
|
|
167
41
|
name: r,
|
|
168
42
|
component: i
|
|
@@ -179,13 +53,13 @@ var B = j(({ client: e }) => {
|
|
|
179
53
|
listStore: i
|
|
180
54
|
};
|
|
181
55
|
});
|
|
182
|
-
function
|
|
183
|
-
return
|
|
56
|
+
function ue(e) {
|
|
57
|
+
return N(le, e);
|
|
184
58
|
}
|
|
185
|
-
var
|
|
59
|
+
var P = (e, t, n) => {
|
|
186
60
|
n.register(e, t);
|
|
187
|
-
},
|
|
188
|
-
let t =
|
|
61
|
+
}, F = D("framework"), I = M(({ client: e }) => {
|
|
62
|
+
let t = F.store({}), n = E(t, { register(e, t) {
|
|
189
63
|
return {
|
|
190
64
|
...e,
|
|
191
65
|
[t.name]: t.framework
|
|
@@ -207,21 +81,21 @@ var H = (e, t, n) => {
|
|
|
207
81
|
listStore: i
|
|
208
82
|
};
|
|
209
83
|
});
|
|
210
|
-
function
|
|
211
|
-
return
|
|
84
|
+
function L(e) {
|
|
85
|
+
return N(I, e);
|
|
212
86
|
}
|
|
213
|
-
var
|
|
87
|
+
var R = (e, t) => {
|
|
214
88
|
t.register(e.name, e);
|
|
215
|
-
},
|
|
89
|
+
}, z = 6e3, B = x("last_ping", "global"), V = async (e) => {
|
|
216
90
|
try {
|
|
217
|
-
let t = Date.now(), n =
|
|
218
|
-
if (n.isSet() && (r = n.json() ?? 0), r && t - r <
|
|
91
|
+
let t = Date.now(), n = y.get(B), r = 0;
|
|
92
|
+
if (n.isSet() && (r = n.json() ?? 0), r && t - r < z) return !0;
|
|
219
93
|
let i = {
|
|
220
94
|
projectId: e.projectId,
|
|
221
95
|
path: window.location.pathname
|
|
222
96
|
}, a = {}, o = document.getElementById("picked_script")?.dataset.verceltoken;
|
|
223
97
|
o && (a["x-vercel-protection-bypass"] = o);
|
|
224
|
-
let s = (await
|
|
98
|
+
let s = (await S(e.apiUrl, "ping", i, a)).ok;
|
|
225
99
|
return s && n.set(t), s;
|
|
226
100
|
} catch {
|
|
227
101
|
return !1;
|
|
@@ -229,7 +103,7 @@ var ge = (e, t) => {
|
|
|
229
103
|
};
|
|
230
104
|
//#endregion
|
|
231
105
|
//#region src/utils/state-snaphot.ts
|
|
232
|
-
function
|
|
106
|
+
function H(e) {
|
|
233
107
|
let t = typeof window < "u", n = {
|
|
234
108
|
client: e,
|
|
235
109
|
responses: e.responses.listStore.getState(),
|
|
@@ -243,8 +117,8 @@ function U(e) {
|
|
|
243
117
|
}
|
|
244
118
|
//#endregion
|
|
245
119
|
//#region src/entities/predicate/predicate.ts
|
|
246
|
-
var
|
|
247
|
-
let t =
|
|
120
|
+
var U = D("predicate"), de = M(({ client: e }) => {
|
|
121
|
+
let t = U.store({}), n = E(t, { register(e, t) {
|
|
248
122
|
return {
|
|
249
123
|
...e,
|
|
250
124
|
[t.name]: {
|
|
@@ -264,22 +138,22 @@ var be = E("predicate"), xe = j(({ client: e }) => {
|
|
|
264
138
|
return t.map((t) => t[e]?.predicate, { skipVoid: !1 });
|
|
265
139
|
}
|
|
266
140
|
function o(t) {
|
|
267
|
-
let n =
|
|
141
|
+
let n = A(() => void 0, { skipVoid: !1 }), r = O(async () => {
|
|
268
142
|
let n = a(t).getState();
|
|
269
143
|
if (!n) return;
|
|
270
|
-
let r =
|
|
144
|
+
let r = H(e);
|
|
271
145
|
return (...e) => n({
|
|
272
146
|
...r,
|
|
273
147
|
args: e
|
|
274
148
|
});
|
|
275
149
|
});
|
|
276
|
-
return
|
|
150
|
+
return j({
|
|
277
151
|
source: {
|
|
278
152
|
responses: e.responses.listStore,
|
|
279
153
|
fields: e.fields.listStore
|
|
280
154
|
},
|
|
281
155
|
target: r
|
|
282
|
-
}),
|
|
156
|
+
}), j({
|
|
283
157
|
clock: r.doneData,
|
|
284
158
|
filter: (e) => e !== void 0,
|
|
285
159
|
target: n
|
|
@@ -292,13 +166,13 @@ var be = E("predicate"), xe = j(({ client: e }) => {
|
|
|
292
166
|
getEvokablePredicate: o
|
|
293
167
|
};
|
|
294
168
|
});
|
|
295
|
-
function
|
|
296
|
-
return
|
|
169
|
+
function fe(e) {
|
|
170
|
+
return N(de, e);
|
|
297
171
|
}
|
|
298
|
-
var
|
|
172
|
+
var pe = (e, t, n) => {
|
|
299
173
|
n.register(e, t);
|
|
300
|
-
}, W =
|
|
301
|
-
let t = W.store({}), n = W.store([]), r =
|
|
174
|
+
}, W = D("feature"), me = M(({ client: e }) => {
|
|
175
|
+
let t = W.store({}), n = W.store([]), r = E(t, { register(e, t) {
|
|
302
176
|
return {
|
|
303
177
|
...e,
|
|
304
178
|
[t.id]: t.feature
|
|
@@ -318,19 +192,19 @@ var Ce = (e, t, n) => {
|
|
|
318
192
|
feature: i
|
|
319
193
|
}));
|
|
320
194
|
}
|
|
321
|
-
let a =
|
|
322
|
-
let r =
|
|
195
|
+
let a = O(async ({ id: e, key: t, storage: n = "local" }) => {
|
|
196
|
+
let r = x(`feature:${e}:${t}`, "global"), i = (n === "session" ? b : y).get(r).boolean();
|
|
323
197
|
return i === null ? null : {
|
|
324
198
|
id: e,
|
|
325
199
|
key: t,
|
|
326
200
|
bucket: i,
|
|
327
201
|
storage: n
|
|
328
202
|
};
|
|
329
|
-
}), o =
|
|
203
|
+
}), o = O((e) => {
|
|
330
204
|
if (!e) return null;
|
|
331
|
-
let t =
|
|
332
|
-
(e.storage === "session" ?
|
|
333
|
-
}), s = /* @__PURE__ */ new Map(), c =
|
|
205
|
+
let t = x(`feature:${e.id}:${e.key}`, "global");
|
|
206
|
+
(e.storage === "session" ? b : y).set(t, e.bucket);
|
|
207
|
+
}), s = /* @__PURE__ */ new Map(), c = w({
|
|
334
208
|
source: {
|
|
335
209
|
allFeaturesStore: t,
|
|
336
210
|
resolvedFeaturesStore: n
|
|
@@ -361,7 +235,7 @@ var Ce = (e, t, n) => {
|
|
|
361
235
|
};
|
|
362
236
|
}
|
|
363
237
|
});
|
|
364
|
-
|
|
238
|
+
j({
|
|
365
239
|
clock: r.register,
|
|
366
240
|
fn: (e) => {
|
|
367
241
|
let { id: t, feature: n } = e;
|
|
@@ -372,7 +246,7 @@ var Ce = (e, t, n) => {
|
|
|
372
246
|
};
|
|
373
247
|
},
|
|
374
248
|
target: a
|
|
375
|
-
}),
|
|
249
|
+
}), j({
|
|
376
250
|
source: t,
|
|
377
251
|
clock: c.doneData,
|
|
378
252
|
fn: (e, t) => {
|
|
@@ -386,7 +260,7 @@ var Ce = (e, t, n) => {
|
|
|
386
260
|
},
|
|
387
261
|
target: o
|
|
388
262
|
});
|
|
389
|
-
let l =
|
|
263
|
+
let l = T({
|
|
390
264
|
allFeaturesStore: t,
|
|
391
265
|
resolvedFeaturesStore: n
|
|
392
266
|
}).map(({ allFeaturesStore: e, resolvedFeaturesStore: t }) => Object.values(e).map((e) => {
|
|
@@ -408,7 +282,7 @@ var Ce = (e, t, n) => {
|
|
|
408
282
|
isResolved: !1
|
|
409
283
|
};
|
|
410
284
|
}));
|
|
411
|
-
|
|
285
|
+
j({
|
|
412
286
|
clock: c.doneData,
|
|
413
287
|
source: { resolvedFeatures: n },
|
|
414
288
|
filter: ({ resolvedFeatures: e }, { id: t, key: n }) => !e.some((e) => e.id === t && e.key === n),
|
|
@@ -417,7 +291,7 @@ var Ce = (e, t, n) => {
|
|
|
417
291
|
type: "feature_decide",
|
|
418
292
|
feature: e
|
|
419
293
|
}))
|
|
420
|
-
}),
|
|
294
|
+
}), j({
|
|
421
295
|
clock: [a.doneData, c.doneData],
|
|
422
296
|
source: n,
|
|
423
297
|
fn: (e, t) => !t || e.some((e) => e.id === t.id && e.key === t.key) ? e : [...e, t],
|
|
@@ -430,15 +304,15 @@ var Ce = (e, t, n) => {
|
|
|
430
304
|
return t.map((t) => t[e], { skipVoid: !1 });
|
|
431
305
|
}
|
|
432
306
|
function f(e) {
|
|
433
|
-
let t =
|
|
307
|
+
let t = A(async () => void 0, { skipVoid: !1 }), r = O(async () => {
|
|
434
308
|
let t = u(e).getState();
|
|
435
309
|
if (t) return async () => (await t.getBucket()).bucket;
|
|
436
310
|
});
|
|
437
|
-
return
|
|
311
|
+
return j({
|
|
438
312
|
source: n,
|
|
439
313
|
filter: (t) => t.some((t) => t.id === e),
|
|
440
314
|
target: r
|
|
441
|
-
}),
|
|
315
|
+
}), j({
|
|
442
316
|
clock: r.doneData,
|
|
443
317
|
filter: (e) => e !== void 0,
|
|
444
318
|
target: t
|
|
@@ -452,21 +326,21 @@ var Ce = (e, t, n) => {
|
|
|
452
326
|
getEvokableFeature: f
|
|
453
327
|
};
|
|
454
328
|
});
|
|
455
|
-
function
|
|
456
|
-
return
|
|
329
|
+
function he(e) {
|
|
330
|
+
return N(me, e);
|
|
457
331
|
}
|
|
458
|
-
var
|
|
332
|
+
var ge = (e, t, n) => {
|
|
459
333
|
n.register(e, t);
|
|
460
|
-
}, G =
|
|
334
|
+
}, G = D("history");
|
|
461
335
|
function K(e, t) {
|
|
462
336
|
return {
|
|
463
|
-
id:
|
|
337
|
+
id: ie(`history-entry-${Date.now()}-${Math.random()}}`),
|
|
464
338
|
node: t,
|
|
465
339
|
at: Date.now(),
|
|
466
340
|
experienceId: e
|
|
467
341
|
};
|
|
468
342
|
}
|
|
469
|
-
var
|
|
343
|
+
var _e = M(() => {
|
|
470
344
|
let e = G.store({ entries: [] }), t = G.event(), n = G.event(), r = G.event(), i = G.event();
|
|
471
345
|
e.on(t, (e, t) => ({ entries: [...e.entries, K(t.experienceId, t.node)] })), e.on(n, (e, t) => ({ entries: [...e.entries.slice(0, -1), K(t.experienceId, t.node)] })), e.on(i, (e, t) => t);
|
|
472
346
|
function a(e, t) {
|
|
@@ -476,7 +350,7 @@ var De = j(() => {
|
|
|
476
350
|
};
|
|
477
351
|
for (let r = e.length - 1; r >= 0; r--) {
|
|
478
352
|
let i = e[r], a = i?.node;
|
|
479
|
-
if (!(!a || !
|
|
353
|
+
if (!(!a || !g(a)) && !(t && i.experienceId !== t)) if (n.lastStepIndex === -1) n.lastStepIndex = r;
|
|
480
354
|
else {
|
|
481
355
|
n.secondLastStepIndex = r;
|
|
482
356
|
break;
|
|
@@ -498,25 +372,25 @@ var De = j(() => {
|
|
|
498
372
|
entriesStore: e.map((e) => e.entries)
|
|
499
373
|
};
|
|
500
374
|
});
|
|
501
|
-
function
|
|
502
|
-
return
|
|
375
|
+
function ve() {
|
|
376
|
+
return N(_e);
|
|
503
377
|
}
|
|
504
378
|
//#endregion
|
|
505
379
|
//#region src/utils/events.ts
|
|
506
|
-
var
|
|
507
|
-
let t =
|
|
508
|
-
return
|
|
380
|
+
var ye = 0, be = (e) => {
|
|
381
|
+
let t = A([]);
|
|
382
|
+
return j({
|
|
509
383
|
clock: e,
|
|
510
384
|
source: t,
|
|
511
385
|
fn: (e, t) => [...e, {
|
|
512
|
-
id:
|
|
386
|
+
id: ye++,
|
|
513
387
|
at: /* @__PURE__ */ new Date(),
|
|
514
388
|
payload: t
|
|
515
389
|
}],
|
|
516
390
|
target: t
|
|
517
391
|
}), t;
|
|
518
|
-
},
|
|
519
|
-
let e =
|
|
392
|
+
}, xe = D("field"), Se = M(() => {
|
|
393
|
+
let e = xe.store({}), t = E(e, {
|
|
520
394
|
register(e, t) {
|
|
521
395
|
return {
|
|
522
396
|
...e,
|
|
@@ -560,13 +434,13 @@ var ke = 0, Ae = (e) => {
|
|
|
560
434
|
getByName: s
|
|
561
435
|
};
|
|
562
436
|
});
|
|
563
|
-
function
|
|
564
|
-
return
|
|
437
|
+
function Ce() {
|
|
438
|
+
return N(Se);
|
|
565
439
|
}
|
|
566
440
|
//#endregion
|
|
567
441
|
//#region src/entities/step/step.ts
|
|
568
|
-
var
|
|
569
|
-
let e =
|
|
442
|
+
var we = D("step"), Te = M(() => {
|
|
443
|
+
let e = we.store({}), t = E(e, { register(e, t) {
|
|
570
444
|
return {
|
|
571
445
|
...e,
|
|
572
446
|
[t.step.id]: t.step
|
|
@@ -590,16 +464,16 @@ var Pe = E("step"), Fe = j(() => {
|
|
|
590
464
|
indexStore: e
|
|
591
465
|
};
|
|
592
466
|
});
|
|
593
|
-
function
|
|
594
|
-
return
|
|
467
|
+
function Ee() {
|
|
468
|
+
return N(Te);
|
|
595
469
|
}
|
|
596
|
-
function
|
|
470
|
+
function De(e, t) {
|
|
597
471
|
t.register(e);
|
|
598
472
|
}
|
|
599
473
|
//#endregion
|
|
600
474
|
//#region src/entities/action/action.ts
|
|
601
|
-
var
|
|
602
|
-
let t =
|
|
475
|
+
var Oe = D("action"), ke = M(({ client: e }) => {
|
|
476
|
+
let t = Oe.store({}), n = E(t, { register(e, t) {
|
|
603
477
|
return {
|
|
604
478
|
...e,
|
|
605
479
|
[t.key]: {
|
|
@@ -619,22 +493,22 @@ var Re = E("action"), ze = j(({ client: e }) => {
|
|
|
619
493
|
return t.map((t) => t[e]?.action, { skipVoid: !1 });
|
|
620
494
|
}
|
|
621
495
|
function o(t, n) {
|
|
622
|
-
let r =
|
|
496
|
+
let r = A(() => void 0, { skipVoid: !1 }), i = n ? { experience: n.experience } : null, o = O(async () => {
|
|
623
497
|
let n = a(t).getState();
|
|
624
498
|
if (!n) return;
|
|
625
|
-
let r =
|
|
499
|
+
let r = H(e);
|
|
626
500
|
return (...e) => n({
|
|
627
501
|
...r,
|
|
628
502
|
args: e
|
|
629
503
|
}, i);
|
|
630
504
|
});
|
|
631
|
-
return
|
|
505
|
+
return j({
|
|
632
506
|
source: {
|
|
633
507
|
responses: e.responses.listStore,
|
|
634
508
|
fields: e.fields.listStore
|
|
635
509
|
},
|
|
636
510
|
target: o
|
|
637
|
-
}),
|
|
511
|
+
}), j({
|
|
638
512
|
clock: o.doneData,
|
|
639
513
|
filter: (e) => e !== void 0,
|
|
640
514
|
target: r
|
|
@@ -647,10 +521,10 @@ var Re = E("action"), ze = j(({ client: e }) => {
|
|
|
647
521
|
getEvokableAction: o
|
|
648
522
|
};
|
|
649
523
|
});
|
|
650
|
-
function
|
|
651
|
-
return
|
|
524
|
+
function Ae(e) {
|
|
525
|
+
return N(ke, e);
|
|
652
526
|
}
|
|
653
|
-
var
|
|
527
|
+
var je = (e, t, n) => {
|
|
654
528
|
n.register(e, t);
|
|
655
529
|
};
|
|
656
530
|
//#endregion
|
|
@@ -666,7 +540,7 @@ function q(e, t, n, r) {
|
|
|
666
540
|
function J(e) {
|
|
667
541
|
return e === null || e === "" || Array.isArray(e) && !e.length;
|
|
668
542
|
}
|
|
669
|
-
function
|
|
543
|
+
function Me(e) {
|
|
670
544
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
|
|
671
545
|
}
|
|
672
546
|
function Y(e) {
|
|
@@ -676,13 +550,13 @@ function Y(e) {
|
|
|
676
550
|
return !1;
|
|
677
551
|
}
|
|
678
552
|
}
|
|
679
|
-
function
|
|
553
|
+
function Ne(e, t) {
|
|
680
554
|
return t.find((t) => t.key === e) ?? null;
|
|
681
555
|
}
|
|
682
|
-
function
|
|
556
|
+
function Pe(e, t) {
|
|
683
557
|
return e.multiple && (typeof t == "string" || typeof t == "number" || typeof t == "boolean") ? [t] : t;
|
|
684
558
|
}
|
|
685
|
-
function
|
|
559
|
+
function Fe(e, t) {
|
|
686
560
|
if (e.type !== "object" || J(t)) return null;
|
|
687
561
|
if (e.multiple) {
|
|
688
562
|
if (!Array.isArray(t)) return q(e, t, "This field expects multiple values", "Field expects an array of objects.");
|
|
@@ -694,7 +568,7 @@ function Ge(e, t) {
|
|
|
694
568
|
}
|
|
695
569
|
return Array.isArray(t) ? q(e, t, "This field expects a single value", "Field expects a single object, not an array.") : typeof t != "object" || !t ? q(e, t, "This field expects an object value", "Field expects an object value.") : Y(t) ? null : q(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
|
|
696
570
|
}
|
|
697
|
-
function
|
|
571
|
+
function Ie(e, t) {
|
|
698
572
|
if (J(t) || !Array.isArray(e.options) || e.options.length === 0) return null;
|
|
699
573
|
let n = Array.isArray(t) ? t : [t];
|
|
700
574
|
if (e.type === "object") {
|
|
@@ -702,23 +576,23 @@ function Ke(e, t) {
|
|
|
702
576
|
return n.every((e) => r.has(JSON.stringify(e))) ? null : q(e, t, "This field expects a valid option", "Field expects a valid option from the defined choices.");
|
|
703
577
|
}
|
|
704
578
|
let r = e.options.map((e) => e.value);
|
|
705
|
-
return n.every((e) => !
|
|
579
|
+
return n.every((e) => !Me(e) || e === null ? !1 : r.includes(e)) ? null : q(e, t, "This field expects a valid option", `Field expects a valid option. Valid options are: ${r.join(", ")}`);
|
|
706
580
|
}
|
|
707
|
-
async function
|
|
708
|
-
if (
|
|
709
|
-
let
|
|
581
|
+
async function Le(t, n, r, i) {
|
|
582
|
+
if (n.validation && !e(n.validation) && !J(r)) {
|
|
583
|
+
let e = i ? {
|
|
710
584
|
$input: r,
|
|
711
585
|
responses: i
|
|
712
|
-
} : { $input: r }, a = await
|
|
713
|
-
if (typeof a == "string") return q(
|
|
714
|
-
if (a === !1) return q(
|
|
586
|
+
} : { $input: r }, a = await t(n.validation, e);
|
|
587
|
+
if (typeof a == "string") return q(n, r, a, `Field validation resulted in an error: ${a}.`);
|
|
588
|
+
if (a === !1) return q(n, r, "This field is invalid", "Field validation resulted in an unspecified error.");
|
|
715
589
|
}
|
|
716
|
-
return
|
|
590
|
+
return n.required && J(r) ? q(n, r, "This field is required", "Field is required.") : !n.multiple && Array.isArray(r) && r.length > 1 ? q(n, r, "This field expects a single response", "Field expects a single response.") : null;
|
|
717
591
|
}
|
|
718
592
|
//#endregion
|
|
719
593
|
//#region src/entities/response/response.ts
|
|
720
|
-
var
|
|
721
|
-
let n =
|
|
594
|
+
var Re = D("response"), ze = M(({ client: e }) => {
|
|
595
|
+
let n = Re.store({}), r = k(), i = k(), a = E(n, {
|
|
722
596
|
register(e, t) {
|
|
723
597
|
return {
|
|
724
598
|
...e,
|
|
@@ -747,7 +621,7 @@ var Je = E("response"), Ye = j(({ client: e }) => {
|
|
|
747
621
|
});
|
|
748
622
|
} else a.registerBatch(e);
|
|
749
623
|
}
|
|
750
|
-
let s = (n, r) => t(e, n, r), c =
|
|
624
|
+
let s = (n, r) => t(e, n, r), c = w({
|
|
751
625
|
source: {
|
|
752
626
|
allFields: e.fields.listStore,
|
|
753
627
|
existingResponses: n
|
|
@@ -757,7 +631,7 @@ var Je = E("response"), Ye = j(({ client: e }) => {
|
|
|
757
631
|
...t,
|
|
758
632
|
...n
|
|
759
633
|
}, o = Object.entries(n), c = await Promise.allSettled(o.map(async ([t, n]) => {
|
|
760
|
-
let o =
|
|
634
|
+
let o = Ne(t, e);
|
|
761
635
|
if (!o) {
|
|
762
636
|
r.push({
|
|
763
637
|
fieldKey: t,
|
|
@@ -767,17 +641,17 @@ var Je = E("response"), Ye = j(({ client: e }) => {
|
|
|
767
641
|
});
|
|
768
642
|
return;
|
|
769
643
|
}
|
|
770
|
-
let c =
|
|
644
|
+
let c = Pe(o, n), l = await Le(s, o, c, a);
|
|
771
645
|
if (l) {
|
|
772
646
|
r.push(l);
|
|
773
647
|
return;
|
|
774
648
|
}
|
|
775
|
-
let u =
|
|
649
|
+
let u = Fe(o, c);
|
|
776
650
|
if (u) {
|
|
777
651
|
r.push(u);
|
|
778
652
|
return;
|
|
779
653
|
}
|
|
780
|
-
let d =
|
|
654
|
+
let d = Ie(o, c);
|
|
781
655
|
if (d) {
|
|
782
656
|
r.push(d);
|
|
783
657
|
return;
|
|
@@ -805,7 +679,7 @@ var Je = E("response"), Ye = j(({ client: e }) => {
|
|
|
805
679
|
async function l(e) {
|
|
806
680
|
return c(e);
|
|
807
681
|
}
|
|
808
|
-
let u =
|
|
682
|
+
let u = w({
|
|
809
683
|
source: n,
|
|
810
684
|
effect: async (e, t) => {
|
|
811
685
|
let { responsesToCommit: n, validationErrors: r } = await c(t);
|
|
@@ -820,7 +694,7 @@ var Je = E("response"), Ye = j(({ client: e }) => {
|
|
|
820
694
|
value: t
|
|
821
695
|
})));
|
|
822
696
|
function m(e) {
|
|
823
|
-
return
|
|
697
|
+
return T({
|
|
824
698
|
f: e,
|
|
825
699
|
s: n
|
|
826
700
|
}, ({ f: e, s: t }) => {
|
|
@@ -837,10 +711,10 @@ var Je = E("response"), Ye = j(({ client: e }) => {
|
|
|
837
711
|
function _(t) {
|
|
838
712
|
return m(e.fields.getByName(t));
|
|
839
713
|
}
|
|
840
|
-
return
|
|
714
|
+
return j({
|
|
841
715
|
clock: r,
|
|
842
716
|
target: a.clearAll
|
|
843
|
-
}),
|
|
717
|
+
}), j({
|
|
844
718
|
clock: i,
|
|
845
719
|
target: a.clear
|
|
846
720
|
}), {
|
|
@@ -856,13 +730,13 @@ var Je = E("response"), Ye = j(({ client: e }) => {
|
|
|
856
730
|
getByFieldName: _
|
|
857
731
|
};
|
|
858
732
|
});
|
|
859
|
-
function
|
|
860
|
-
return
|
|
733
|
+
function Be(e) {
|
|
734
|
+
return N(ze, e);
|
|
861
735
|
}
|
|
862
736
|
//#endregion
|
|
863
737
|
//#region src/entities/condition/condition.ts
|
|
864
|
-
var
|
|
865
|
-
let e =
|
|
738
|
+
var Ve = D("condition"), He = M(() => {
|
|
739
|
+
let e = Ve.store({}), t = E(e, { register(e, t) {
|
|
866
740
|
return {
|
|
867
741
|
...e,
|
|
868
742
|
[t.condition.id]: t.condition
|
|
@@ -886,12 +760,12 @@ var Ze = E("condition"), Qe = j(() => {
|
|
|
886
760
|
indexStore: e
|
|
887
761
|
};
|
|
888
762
|
});
|
|
889
|
-
function
|
|
890
|
-
return
|
|
763
|
+
function Ue() {
|
|
764
|
+
return N(He);
|
|
891
765
|
}
|
|
892
766
|
//#endregion
|
|
893
767
|
//#region src/utils/api-url.ts
|
|
894
|
-
function
|
|
768
|
+
function We() {
|
|
895
769
|
if (f()) {
|
|
896
770
|
let e = [
|
|
897
771
|
document.currentScript,
|
|
@@ -906,7 +780,7 @@ function et() {
|
|
|
906
780
|
}
|
|
907
781
|
//#endregion
|
|
908
782
|
//#region src/utils/search-params.ts
|
|
909
|
-
function
|
|
783
|
+
function Ge() {
|
|
910
784
|
if (!o()) return {};
|
|
911
785
|
let e = new URLSearchParams(window.location.search), t = {}, n = /* @__PURE__ */ new Set();
|
|
912
786
|
for (let [t] of e.entries()) t.startsWith("picked-") && n.add(t);
|
|
@@ -914,28 +788,28 @@ function tt() {
|
|
|
914
788
|
let n = r.replace("picked-", "");
|
|
915
789
|
t[n] = e.getAll(r);
|
|
916
790
|
}
|
|
917
|
-
let r =
|
|
918
|
-
if (n.size > 0)
|
|
791
|
+
let r = x("s");
|
|
792
|
+
if (n.size > 0) b.set(r, t);
|
|
919
793
|
else {
|
|
920
|
-
let e =
|
|
794
|
+
let e = b.get(r);
|
|
921
795
|
if (e) return e.json() || {};
|
|
922
796
|
}
|
|
923
797
|
return t;
|
|
924
798
|
}
|
|
925
799
|
//#endregion
|
|
926
800
|
//#region src/utils/user-session.ts
|
|
927
|
-
function
|
|
928
|
-
return
|
|
801
|
+
function Ke() {
|
|
802
|
+
return u() ? 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
803
|
}
|
|
930
|
-
var
|
|
931
|
-
let e =
|
|
804
|
+
var qe = x("session", "global"), Je = () => {
|
|
805
|
+
let e = y.get(qe), t;
|
|
932
806
|
e.isSet() && (t = e.json());
|
|
933
807
|
let n = (t) => e.set({
|
|
934
808
|
id: t.id,
|
|
935
809
|
isUser: t.isUser,
|
|
936
810
|
identifiers: t.identifiers
|
|
937
811
|
}), r = {
|
|
938
|
-
id: t?.id ??
|
|
812
|
+
id: t?.id ?? Ke(),
|
|
939
813
|
isUser: t?.isUser ?? void 0,
|
|
940
814
|
identifiers: t?.identifiers ?? void 0,
|
|
941
815
|
setIsUser(e) {
|
|
@@ -952,21 +826,21 @@ var rt = S("session", "global"), it = () => {
|
|
|
952
826
|
}
|
|
953
827
|
};
|
|
954
828
|
return n(r), r;
|
|
955
|
-
},
|
|
829
|
+
}, Ye = () => d() ? Je() : null;
|
|
956
830
|
//#endregion
|
|
957
831
|
//#region src/utils/picked-config.ts
|
|
958
|
-
function
|
|
832
|
+
function X() {
|
|
959
833
|
if (o()) return globalThis.window.pickedConfig;
|
|
960
834
|
}
|
|
961
|
-
function
|
|
835
|
+
function Xe() {
|
|
962
836
|
if (!o()) return;
|
|
963
|
-
let e =
|
|
837
|
+
let e = X(), t = e?.organizationId, n = e?.projectId;
|
|
964
838
|
return t && n ? {
|
|
965
839
|
organizationId: t,
|
|
966
840
|
projectId: n
|
|
967
841
|
} : void 0;
|
|
968
842
|
}
|
|
969
|
-
function
|
|
843
|
+
function Z() {
|
|
970
844
|
if (!f()) return;
|
|
971
845
|
let e = document.getElementById("picked_script") || document.querySelector("script#picked") || document.getElementById("cvly");
|
|
972
846
|
if (!e) return;
|
|
@@ -976,15 +850,15 @@ function ot() {
|
|
|
976
850
|
projectId: n
|
|
977
851
|
} : void 0;
|
|
978
852
|
}
|
|
979
|
-
function
|
|
853
|
+
function Ze(e) {
|
|
980
854
|
let { organizationId: t, projectId: n } = e;
|
|
981
855
|
if (t && n) return {
|
|
982
856
|
organizationId: t,
|
|
983
857
|
projectId: n
|
|
984
858
|
};
|
|
985
|
-
let r =
|
|
859
|
+
let r = Xe();
|
|
986
860
|
if (r) return r;
|
|
987
|
-
let i =
|
|
861
|
+
let i = Z();
|
|
988
862
|
if (i) return i;
|
|
989
863
|
throw Error("organizationId and projectId are required. You can provide them via one of:\n (1) createClient({ organizationId, projectId }) options;\n (2) window.pickedConfig = { organizationId, projectId };\n (3) a <script> tag with id 'picked_script', 'picked', or 'cvly' that includes data-organizationid/data-projectid (or organization-id/project-id) attributes.");
|
|
990
864
|
}
|
|
@@ -993,7 +867,7 @@ function st(e) {
|
|
|
993
867
|
function Q(e) {
|
|
994
868
|
return e == null || e === "" || Number.isNaN(e);
|
|
995
869
|
}
|
|
996
|
-
var
|
|
870
|
+
var Qe = {
|
|
997
871
|
default: (e, t) => Q(e) ? String(t ?? "") : String(e),
|
|
998
872
|
append: (e, t) => t && !Q(e) ? `${e} ${t}` : e,
|
|
999
873
|
prepend: (e, t) => t && !Q(e) ? `${t} ${e}` : e,
|
|
@@ -1014,24 +888,24 @@ var ct = {
|
|
|
1014
888
|
return e instanceof Set ? t.format(Array.from(e).map(String)) : e;
|
|
1015
889
|
}
|
|
1016
890
|
};
|
|
1017
|
-
function
|
|
891
|
+
function $e(e) {
|
|
1018
892
|
return typeof e == "object" && !!e;
|
|
1019
893
|
}
|
|
1020
|
-
function
|
|
894
|
+
function et(e, t) {
|
|
1021
895
|
let n = t;
|
|
1022
|
-
for (let t of e.split(".")) if (
|
|
896
|
+
for (let t of e.split(".")) if ($e(n) && t in n) n = n[t];
|
|
1023
897
|
else return;
|
|
1024
898
|
return typeof n == "function" ? n() : n;
|
|
1025
899
|
}
|
|
1026
|
-
function
|
|
1027
|
-
let n = e.split("|").map((e) => e.trim()), r =
|
|
900
|
+
function tt(e, t) {
|
|
901
|
+
let n = e.split("|").map((e) => e.trim()), r = et(n.shift() ?? "", t);
|
|
1028
902
|
for (let e of n) {
|
|
1029
|
-
let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o =
|
|
903
|
+
let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o = Qe[i];
|
|
1030
904
|
o && (r = o(r, a));
|
|
1031
905
|
}
|
|
1032
906
|
return Q(r) ? "" : typeof r == "object" ? JSON.stringify(r) : String(r);
|
|
1033
907
|
}
|
|
1034
|
-
function
|
|
908
|
+
function nt(e, t) {
|
|
1035
909
|
let n = "", r = 0;
|
|
1036
910
|
for (; r < e.length;) if (e[r] === "{" && e[r + 1] === "{") {
|
|
1037
911
|
r += 2;
|
|
@@ -1043,19 +917,19 @@ function ft(e, t) {
|
|
|
1043
917
|
}
|
|
1044
918
|
i += e[r++];
|
|
1045
919
|
}
|
|
1046
|
-
n +=
|
|
920
|
+
n += tt(i.trim(), t);
|
|
1047
921
|
} else n += e[r++];
|
|
1048
922
|
return n;
|
|
1049
923
|
}
|
|
1050
924
|
//#endregion
|
|
1051
925
|
//#region src/picked.ts
|
|
1052
926
|
var $ = class {
|
|
1053
|
-
static logger =
|
|
927
|
+
static logger = n;
|
|
1054
928
|
options;
|
|
1055
929
|
isReady = !1;
|
|
1056
930
|
plugins = {};
|
|
1057
931
|
pluginStartHooks = [];
|
|
1058
|
-
eventBus =
|
|
932
|
+
eventBus = k();
|
|
1059
933
|
events;
|
|
1060
934
|
organizationId;
|
|
1061
935
|
projectId;
|
|
@@ -1066,29 +940,29 @@ var $ = class {
|
|
|
1066
940
|
precondition;
|
|
1067
941
|
condition;
|
|
1068
942
|
preconditionPassed;
|
|
1069
|
-
searchParams =
|
|
1070
|
-
history =
|
|
1071
|
-
components =
|
|
1072
|
-
experienceInstances =
|
|
1073
|
-
experiences =
|
|
1074
|
-
frameworks =
|
|
1075
|
-
predicates =
|
|
1076
|
-
features =
|
|
1077
|
-
conditions =
|
|
1078
|
-
fields =
|
|
1079
|
-
responses =
|
|
1080
|
-
steps =
|
|
1081
|
-
actions =
|
|
943
|
+
searchParams = Ge();
|
|
944
|
+
history = ve();
|
|
945
|
+
components = ue({ client: this });
|
|
946
|
+
experienceInstances = re({ client: this });
|
|
947
|
+
experiences = te({ client: this });
|
|
948
|
+
frameworks = L({ client: this });
|
|
949
|
+
predicates = fe({ client: this });
|
|
950
|
+
features = he({ client: this });
|
|
951
|
+
conditions = Ue();
|
|
952
|
+
fields = Ce();
|
|
953
|
+
responses = Be({ client: this });
|
|
954
|
+
steps = Ee();
|
|
955
|
+
actions = Ae({ client: this });
|
|
1082
956
|
constructor(e) {
|
|
1083
|
-
this.events =
|
|
1084
|
-
let { organizationId: t, projectId: n } =
|
|
1085
|
-
this.organizationId = t, this.projectId = n, this.options = Object.freeze(e), this.apiUrl = e.apiUrl ||
|
|
957
|
+
this.events = be(this.eventBus);
|
|
958
|
+
let { organizationId: t, projectId: n } = Ze(e);
|
|
959
|
+
this.organizationId = t, this.projectId = n, this.options = Object.freeze(e), this.apiUrl = e.apiUrl || We(), this.dashboardUrl = e.dashboardUrl ?? "https://dashboard.picked.app", this.documentationSiteUrl = e.documentationSiteUrl ?? "https://docs.picked.app", this.session = Ye(), this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.setupActions(), this.setupComponents(), this.precondition = e.precondition, this.condition = e.condition, this.eventBus({
|
|
1086
960
|
type: "load",
|
|
1087
|
-
version:
|
|
961
|
+
version: C()
|
|
1088
962
|
});
|
|
1089
963
|
}
|
|
1090
964
|
start = () => {
|
|
1091
|
-
|
|
965
|
+
V(this), (async () => {
|
|
1092
966
|
if (!f()) return;
|
|
1093
967
|
await this.runPluginStartHooks();
|
|
1094
968
|
let e = await this.evaluateGate(this.precondition);
|
|
@@ -1103,7 +977,7 @@ var $ = class {
|
|
|
1103
977
|
value: e
|
|
1104
978
|
});
|
|
1105
979
|
}
|
|
1106
|
-
if (this.eventBus({ type: "initialize" }), n &&
|
|
980
|
+
if (this.eventBus({ type: "initialize" }), n && v(this), await _(), n && v(this), this.eventBus({ type: "ready" }), this.isReady = !0, this.session) {
|
|
1107
981
|
let { id: e, isUser: t, identifiers: n } = this.session;
|
|
1108
982
|
this.eventBus({
|
|
1109
983
|
type: "session",
|
|
@@ -1115,21 +989,21 @@ var $ = class {
|
|
|
1115
989
|
})();
|
|
1116
990
|
};
|
|
1117
991
|
registerFramework = (e) => {
|
|
1118
|
-
|
|
992
|
+
R(e, this.frameworks);
|
|
1119
993
|
};
|
|
1120
994
|
registerComponent = (e, t) => {
|
|
1121
|
-
|
|
995
|
+
P(e, t, this.components);
|
|
1122
996
|
};
|
|
1123
997
|
registerPlugin = (e) => {
|
|
1124
|
-
|
|
998
|
+
ae(this, e, this.plugins);
|
|
1125
999
|
let t = this.plugins[e.name];
|
|
1126
1000
|
t?.onStart && this.pluginStartHooks.push(t.onStart);
|
|
1127
1001
|
};
|
|
1128
1002
|
registerFeature = (e, t) => {
|
|
1129
|
-
|
|
1003
|
+
ge(e, t, this.features);
|
|
1130
1004
|
};
|
|
1131
1005
|
registerPredicate = (e, t) => {
|
|
1132
|
-
|
|
1006
|
+
pe(e, t, this.predicates);
|
|
1133
1007
|
};
|
|
1134
1008
|
registerCondition = (e) => {
|
|
1135
1009
|
this.conditions.register(e);
|
|
@@ -1138,15 +1012,15 @@ var $ = class {
|
|
|
1138
1012
|
this.fields.register(e);
|
|
1139
1013
|
};
|
|
1140
1014
|
registerStep = (e) => {
|
|
1141
|
-
|
|
1015
|
+
De(e, this.steps);
|
|
1142
1016
|
};
|
|
1143
1017
|
registerAction = (e, t) => {
|
|
1144
|
-
|
|
1018
|
+
je(e, t, this.actions);
|
|
1145
1019
|
};
|
|
1146
1020
|
registerExperience = (e) => {
|
|
1147
|
-
e.component &&
|
|
1021
|
+
e.component && P(`experience:${e.id}`, e.component, this.components), this.experiences.register(e);
|
|
1148
1022
|
};
|
|
1149
|
-
getStateSnapshot = () =>
|
|
1023
|
+
getStateSnapshot = () => H(this);
|
|
1150
1024
|
launchExperienceById = async (e, t) => {
|
|
1151
1025
|
this.experiences.launch({
|
|
1152
1026
|
id: e,
|
|
@@ -1235,7 +1109,7 @@ var $ = class {
|
|
|
1235
1109
|
getPluginConfig = (e) => this.plugins[e] ?? {};
|
|
1236
1110
|
renderString = (e, t) => {
|
|
1237
1111
|
let n = this.responses.listStore.getState().reduce((e, t) => (e[t.fieldKey] = t.value, e), {});
|
|
1238
|
-
return
|
|
1112
|
+
return nt(e, {
|
|
1239
1113
|
...t,
|
|
1240
1114
|
responses: n
|
|
1241
1115
|
});
|
|
@@ -1243,20 +1117,20 @@ var $ = class {
|
|
|
1243
1117
|
};
|
|
1244
1118
|
//#endregion
|
|
1245
1119
|
//#region src/entities/component/lazyComponent.ts
|
|
1246
|
-
function
|
|
1120
|
+
function rt(e) {
|
|
1247
1121
|
return {
|
|
1248
1122
|
$$type: "lazy-component",
|
|
1249
1123
|
load: e
|
|
1250
1124
|
};
|
|
1251
1125
|
}
|
|
1252
|
-
function
|
|
1126
|
+
function it(e) {
|
|
1253
1127
|
return typeof e == "object" && !!e && "$$type" in e && e.$$type === "lazy-component";
|
|
1254
1128
|
}
|
|
1255
1129
|
//#endregion
|
|
1256
1130
|
//#region src/exports.ts
|
|
1257
|
-
var
|
|
1131
|
+
var at = (e) => {
|
|
1258
1132
|
let t = new $(e);
|
|
1259
|
-
return
|
|
1133
|
+
return l(t), t;
|
|
1260
1134
|
};
|
|
1261
1135
|
//#endregion
|
|
1262
|
-
export { $ as Picked,
|
|
1136
|
+
export { $ as Picked, at as createClient, x as createStorageKey, t as evaluateRuleLogic, X as getPickedConfig, it as isLazyLoader, ee as isPickedRoot, rt as lazyComponent, y as localStore, b as sessionStore, ne as subscribe, m as supportsCookies, u as supportsCryptoRandomUUID, f as supportsDocument, s as supportsHistory, r as supportsIntersectionObserver, d as supportsLocalStorage, p as supportsLocation, i as supportsNavigation, c as supportsSessionStorage, h as supportsShadowRoot, a as supportsWebComponents, o as supportsWindow };
|