@picked/client 0.0.1-dev.1777612433193 → 0.0.1-dev.1777616114652
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-DzvLjSVi.cjs → api-BryLRI2Y.cjs} +1 -1
- package/dist/{api-BITDxiKp.js → api-Dn57QBPm.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/dom-observer/index.js +1 -0
- package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
- package/dist/cjs/plugins/experience-browser-storage/index.js +1 -1
- package/dist/cjs/plugins/history-browser-storage/index.js +1 -1
- package/dist/cjs/plugins/responses-browser-storage/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/esm/form/index.js +32 -38
- package/dist/esm/index.js +174 -298
- package/dist/esm/plugins/create-experience/index.js +1 -1
- package/dist/esm/plugins/dom-observer/index.js +81 -0
- package/dist/esm/plugins/dynamic-experiences/index.js +1 -1
- package/dist/esm/plugins/experience-browser-storage/index.js +1 -1
- 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/server/index.js +1 -1
- package/dist/experience-BhteyYBl.cjs +1 -0
- package/dist/experience-CoMdlvyn.js +136 -0
- package/dist/experience-instance-CZDcicPj.cjs +1 -0
- package/dist/experience-instance-IkIw31Cg.js +387 -0
- package/dist/nodes-ChVU1VZO.js +101 -0
- package/dist/nodes-DDDs-rC2.cjs +1 -0
- package/dist/types/entities/history/history.d.ts +3 -0
- package/dist/types/entities/history/history.d.ts.map +1 -1
- package/dist/types/form/create-form.d.ts +0 -55
- package/dist/types/form/create-form.d.ts.map +1 -1
- package/dist/types/picked.d.ts +3 -0
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/dom-observer/index.d.ts +3 -0
- package/dist/types/plugins/dom-observer/index.d.ts.map +1 -0
- package/dist/types/plugins/dom-observer/plugin.d.ts +39 -0
- package/dist/types/plugins/dom-observer/plugin.d.ts.map +1 -0
- package/package.json +11 -1
- package/dist/experience-instance-DC2gKwA6.cjs +0 -1
- package/dist/experience-instance-DJaNc5Ob.js +0 -486
- /package/dist/{id-CRqy981z.js → id-B-N2zNbS.js} +0 -0
- /package/dist/{id-Bv44ilEo.cjs → id-Bbodazn8.cjs} +0 -0
- /package/dist/{storage-B6lQtc4-.cjs → storage-BXSlLTRa.cjs} +0 -0
- /package/dist/{storage-6Xk0uAxB.js → storage-hOHCCXvP.js} +0 -0
package/dist/esm/index.js
CHANGED
|
@@ -1,142 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t
|
|
3
|
-
import { t as
|
|
4
|
-
import { a as
|
|
5
|
-
import { a as
|
|
6
|
-
import {
|
|
7
|
-
import { n as
|
|
8
|
-
import {
|
|
1
|
+
import { t as e } from "../rules-logic-BTIxfrJJ.js";
|
|
2
|
+
import { t } from "../object-C82v79xc.js";
|
|
3
|
+
import { t as n } from "../logger-6z_gb4rA.js";
|
|
4
|
+
import { a as r, c as i, d as a, i as o, l as s, n as c, o as l, p as u, r as d, s as f, t as p, u as m } from "../supports-0XIfd4-R.js";
|
|
5
|
+
import { a as h, c as g, u as _ } from "../nodes-ChVU1VZO.js";
|
|
6
|
+
import { n as v, t as ee } from "../experience-CoMdlvyn.js";
|
|
7
|
+
import { i as te, n as y, r as b, t as x } from "../storage-hOHCCXvP.js";
|
|
8
|
+
import { n as ne, r as re } from "../api-Dn57QBPm.js";
|
|
9
|
+
import { n as ie } from "../experience-instance-IkIw31Cg.js";
|
|
10
|
+
import { t as S } from "../id-B-N2zNbS.js";
|
|
9
11
|
import { attach as C, combine as w, createApi as T, createDomain as E, createEffect as D, createEvent as O, createStore as k, sample as A } from "effector";
|
|
10
12
|
import { createFactory as j, invoke as M } from "@withease/factories";
|
|
11
|
-
//#region src/entities/
|
|
12
|
-
var
|
|
13
|
-
let n = N.store(t), r = T(n, { merge(e, t) {
|
|
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) => {
|
|
13
|
+
//#region src/entities/plugin/plugin.ts
|
|
14
|
+
var ae = (e, t, n) => {
|
|
140
15
|
let r = t.name, i = t.setup(e);
|
|
141
16
|
if (i) {
|
|
142
17
|
let e = n[r] ?? {};
|
|
@@ -145,16 +20,16 @@ var P = (e, t, n) => {
|
|
|
145
20
|
...i
|
|
146
21
|
});
|
|
147
22
|
}
|
|
148
|
-
},
|
|
23
|
+
}, oe = E("component"), se = j(({ client: e, component: t, name: n }) => ({
|
|
149
24
|
name: n,
|
|
150
25
|
component: t,
|
|
151
26
|
frameworkStore: e.frameworks.getByName(t.frameworkName)
|
|
152
27
|
}));
|
|
153
|
-
function
|
|
154
|
-
return M(
|
|
28
|
+
function ce(e) {
|
|
29
|
+
return M(se, e);
|
|
155
30
|
}
|
|
156
|
-
var
|
|
157
|
-
let t =
|
|
31
|
+
var le = j(({ client: e }) => {
|
|
32
|
+
let t = oe.store({}), n = T(t, { register(e, t) {
|
|
158
33
|
return {
|
|
159
34
|
...e,
|
|
160
35
|
[t.name]: t
|
|
@@ -162,7 +37,7 @@ var B = j(({ client: e }) => {
|
|
|
162
37
|
} });
|
|
163
38
|
function r(r, i) {
|
|
164
39
|
t.getState()[r] && `${r}`;
|
|
165
|
-
let a =
|
|
40
|
+
let a = ce({
|
|
166
41
|
client: e,
|
|
167
42
|
name: r,
|
|
168
43
|
component: i
|
|
@@ -179,13 +54,13 @@ var B = j(({ client: e }) => {
|
|
|
179
54
|
listStore: i
|
|
180
55
|
};
|
|
181
56
|
});
|
|
182
|
-
function
|
|
183
|
-
return M(
|
|
57
|
+
function ue(e) {
|
|
58
|
+
return M(le, e);
|
|
184
59
|
}
|
|
185
|
-
var
|
|
60
|
+
var N = (e, t, n) => {
|
|
186
61
|
n.register(e, t);
|
|
187
|
-
},
|
|
188
|
-
let t =
|
|
62
|
+
}, P = E("framework"), F = j(({ client: e }) => {
|
|
63
|
+
let t = P.store({}), n = T(t, { register(e, t) {
|
|
189
64
|
return {
|
|
190
65
|
...e,
|
|
191
66
|
[t.name]: t.framework
|
|
@@ -207,21 +82,21 @@ var H = (e, t, n) => {
|
|
|
207
82
|
listStore: i
|
|
208
83
|
};
|
|
209
84
|
});
|
|
210
|
-
function
|
|
211
|
-
return M(
|
|
85
|
+
function I(e) {
|
|
86
|
+
return M(F, e);
|
|
212
87
|
}
|
|
213
|
-
var
|
|
88
|
+
var L = (e, t) => {
|
|
214
89
|
t.register(e.name, e);
|
|
215
|
-
},
|
|
90
|
+
}, R = 6e3, z = x("last_ping", "global"), B = async (e) => {
|
|
216
91
|
try {
|
|
217
|
-
let t = Date.now(), n =
|
|
218
|
-
if (n.isSet() && (r = n.json() ?? 0), r && t - r <
|
|
92
|
+
let t = Date.now(), n = y.get(z), r = 0;
|
|
93
|
+
if (n.isSet() && (r = n.json() ?? 0), r && t - r < R) return !0;
|
|
219
94
|
let i = {
|
|
220
95
|
projectId: e.projectId,
|
|
221
96
|
path: window.location.pathname
|
|
222
97
|
}, a = {}, o = document.getElementById("picked_script")?.dataset.verceltoken;
|
|
223
98
|
o && (a["x-vercel-protection-bypass"] = o);
|
|
224
|
-
let s = (await
|
|
99
|
+
let s = (await ne(e.apiUrl, "ping", i, a)).ok;
|
|
225
100
|
return s && n.set(t), s;
|
|
226
101
|
} catch {
|
|
227
102
|
return !1;
|
|
@@ -229,7 +104,7 @@ var ge = (e, t) => {
|
|
|
229
104
|
};
|
|
230
105
|
//#endregion
|
|
231
106
|
//#region src/utils/state-snaphot.ts
|
|
232
|
-
function
|
|
107
|
+
function V(e) {
|
|
233
108
|
let t = typeof window < "u", n = {
|
|
234
109
|
client: e,
|
|
235
110
|
responses: e.responses.listStore.getState(),
|
|
@@ -243,8 +118,8 @@ function U(e) {
|
|
|
243
118
|
}
|
|
244
119
|
//#endregion
|
|
245
120
|
//#region src/entities/predicate/predicate.ts
|
|
246
|
-
var
|
|
247
|
-
let t =
|
|
121
|
+
var H = E("predicate"), U = j(({ client: e }) => {
|
|
122
|
+
let t = H.store({}), n = T(t, { register(e, t) {
|
|
248
123
|
return {
|
|
249
124
|
...e,
|
|
250
125
|
[t.name]: {
|
|
@@ -267,7 +142,7 @@ var be = E("predicate"), xe = j(({ client: e }) => {
|
|
|
267
142
|
let n = k(() => void 0, { skipVoid: !1 }), r = D(async () => {
|
|
268
143
|
let n = a(t).getState();
|
|
269
144
|
if (!n) return;
|
|
270
|
-
let r =
|
|
145
|
+
let r = V(e);
|
|
271
146
|
return (...e) => n({
|
|
272
147
|
...r,
|
|
273
148
|
args: e
|
|
@@ -292,12 +167,12 @@ var be = E("predicate"), xe = j(({ client: e }) => {
|
|
|
292
167
|
getEvokablePredicate: o
|
|
293
168
|
};
|
|
294
169
|
});
|
|
295
|
-
function
|
|
296
|
-
return M(
|
|
170
|
+
function de(e) {
|
|
171
|
+
return M(U, e);
|
|
297
172
|
}
|
|
298
|
-
var
|
|
173
|
+
var fe = (e, t, n) => {
|
|
299
174
|
n.register(e, t);
|
|
300
|
-
}, W = E("feature"),
|
|
175
|
+
}, W = E("feature"), pe = j(({ client: e }) => {
|
|
301
176
|
let t = W.store({}), n = W.store([]), r = T(t, { register(e, t) {
|
|
302
177
|
return {
|
|
303
178
|
...e,
|
|
@@ -319,7 +194,7 @@ var Ce = (e, t, n) => {
|
|
|
319
194
|
}));
|
|
320
195
|
}
|
|
321
196
|
let a = D(async ({ id: e, key: t, storage: n = "local" }) => {
|
|
322
|
-
let r =
|
|
197
|
+
let r = x(`feature:${e}:${t}`, "global"), i = (n === "session" ? b : y).get(r).boolean();
|
|
323
198
|
return i === null ? null : {
|
|
324
199
|
id: e,
|
|
325
200
|
key: t,
|
|
@@ -328,8 +203,8 @@ var Ce = (e, t, n) => {
|
|
|
328
203
|
};
|
|
329
204
|
}), o = D((e) => {
|
|
330
205
|
if (!e) return null;
|
|
331
|
-
let t =
|
|
332
|
-
(e.storage === "session" ?
|
|
206
|
+
let t = x(`feature:${e.id}:${e.key}`, "global");
|
|
207
|
+
(e.storage === "session" ? b : y).set(t, e.bucket);
|
|
333
208
|
}), s = /* @__PURE__ */ new Map(), c = C({
|
|
334
209
|
source: {
|
|
335
210
|
allFeaturesStore: t,
|
|
@@ -452,31 +327,31 @@ var Ce = (e, t, n) => {
|
|
|
452
327
|
getEvokableFeature: f
|
|
453
328
|
};
|
|
454
329
|
});
|
|
455
|
-
function
|
|
456
|
-
return M(
|
|
330
|
+
function me(e) {
|
|
331
|
+
return M(pe, e);
|
|
457
332
|
}
|
|
458
|
-
var
|
|
333
|
+
var he = (e, t, n) => {
|
|
459
334
|
n.register(e, t);
|
|
460
335
|
}, G = E("history");
|
|
461
336
|
function K(e, t) {
|
|
462
337
|
return {
|
|
463
|
-
id:
|
|
338
|
+
id: S(`history-entry-${Date.now()}-${Math.random()}}`),
|
|
464
339
|
node: t,
|
|
465
340
|
at: Date.now(),
|
|
466
341
|
experienceId: e
|
|
467
342
|
};
|
|
468
343
|
}
|
|
469
|
-
var
|
|
470
|
-
let e = G.store({ entries: [] }), t = G.event(), n = G.event(), r = G.event(), i = G.event();
|
|
471
|
-
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
|
-
function
|
|
344
|
+
var ge = j(() => {
|
|
345
|
+
let e = G.store({ entries: [] }), t = G.event(), n = G.event(), r = G.event(), i = G.event(), a = G.event();
|
|
346
|
+
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), e.on(a, (e, t) => ({ entries: e.entries.filter((e) => e.experienceId !== t.experienceId) }));
|
|
347
|
+
function o(e, t) {
|
|
473
348
|
let n = {
|
|
474
349
|
lastStepIndex: -1,
|
|
475
350
|
secondLastStepIndex: -1
|
|
476
351
|
};
|
|
477
352
|
for (let r = e.length - 1; r >= 0; r--) {
|
|
478
353
|
let i = e[r], a = i?.node;
|
|
479
|
-
if (!(!a || !
|
|
354
|
+
if (!(!a || !h(a)) && !(t && i.experienceId !== t)) if (n.lastStepIndex === -1) n.lastStepIndex = r;
|
|
480
355
|
else {
|
|
481
356
|
n.secondLastStepIndex = r;
|
|
482
357
|
break;
|
|
@@ -485,7 +360,7 @@ var De = j(() => {
|
|
|
485
360
|
return n;
|
|
486
361
|
}
|
|
487
362
|
return e.on(r, (e, t) => {
|
|
488
|
-
let { secondLastStepIndex: n } =
|
|
363
|
+
let { secondLastStepIndex: n } = o(e.entries, t.experienceId), r = n === -1 ? e.entries : e.entries.slice(0, n + 1);
|
|
489
364
|
return {
|
|
490
365
|
...e,
|
|
491
366
|
entries: r
|
|
@@ -495,28 +370,29 @@ var De = j(() => {
|
|
|
495
370
|
replace: n,
|
|
496
371
|
back: r,
|
|
497
372
|
restore: i,
|
|
373
|
+
clearForExperience: a,
|
|
498
374
|
entriesStore: e.map((e) => e.entries)
|
|
499
375
|
};
|
|
500
376
|
});
|
|
501
|
-
function
|
|
502
|
-
return M(
|
|
377
|
+
function _e() {
|
|
378
|
+
return M(ge);
|
|
503
379
|
}
|
|
504
380
|
//#endregion
|
|
505
381
|
//#region src/utils/events.ts
|
|
506
|
-
var
|
|
382
|
+
var ve = 0, ye = (e) => {
|
|
507
383
|
let t = k([]);
|
|
508
384
|
return A({
|
|
509
385
|
clock: e,
|
|
510
386
|
source: t,
|
|
511
387
|
fn: (e, t) => [...e, {
|
|
512
|
-
id:
|
|
388
|
+
id: ve++,
|
|
513
389
|
at: /* @__PURE__ */ new Date(),
|
|
514
390
|
payload: t
|
|
515
391
|
}],
|
|
516
392
|
target: t
|
|
517
393
|
}), t;
|
|
518
|
-
},
|
|
519
|
-
let e =
|
|
394
|
+
}, be = E("field"), xe = j(() => {
|
|
395
|
+
let e = be.store({}), t = T(e, {
|
|
520
396
|
register(e, t) {
|
|
521
397
|
return {
|
|
522
398
|
...e,
|
|
@@ -560,13 +436,13 @@ var ke = 0, Ae = (e) => {
|
|
|
560
436
|
getByName: s
|
|
561
437
|
};
|
|
562
438
|
});
|
|
563
|
-
function
|
|
564
|
-
return M(
|
|
439
|
+
function Se() {
|
|
440
|
+
return M(xe);
|
|
565
441
|
}
|
|
566
442
|
//#endregion
|
|
567
443
|
//#region src/entities/step/step.ts
|
|
568
|
-
var
|
|
569
|
-
let e =
|
|
444
|
+
var Ce = E("step"), we = j(() => {
|
|
445
|
+
let e = Ce.store({}), t = T(e, { register(e, t) {
|
|
570
446
|
return {
|
|
571
447
|
...e,
|
|
572
448
|
[t.step.id]: t.step
|
|
@@ -590,16 +466,16 @@ var Pe = E("step"), Fe = j(() => {
|
|
|
590
466
|
indexStore: e
|
|
591
467
|
};
|
|
592
468
|
});
|
|
593
|
-
function
|
|
594
|
-
return M(
|
|
469
|
+
function Te() {
|
|
470
|
+
return M(we);
|
|
595
471
|
}
|
|
596
|
-
function
|
|
472
|
+
function Ee(e, t) {
|
|
597
473
|
t.register(e);
|
|
598
474
|
}
|
|
599
475
|
//#endregion
|
|
600
476
|
//#region src/entities/action/action.ts
|
|
601
|
-
var
|
|
602
|
-
let t =
|
|
477
|
+
var De = E("action"), Oe = j(({ client: e }) => {
|
|
478
|
+
let t = De.store({}), n = T(t, { register(e, t) {
|
|
603
479
|
return {
|
|
604
480
|
...e,
|
|
605
481
|
[t.key]: {
|
|
@@ -622,7 +498,7 @@ var Re = E("action"), ze = j(({ client: e }) => {
|
|
|
622
498
|
let r = k(() => void 0, { skipVoid: !1 }), i = n ? { experience: n.experience } : null, o = D(async () => {
|
|
623
499
|
let n = a(t).getState();
|
|
624
500
|
if (!n) return;
|
|
625
|
-
let r =
|
|
501
|
+
let r = V(e);
|
|
626
502
|
return (...e) => n({
|
|
627
503
|
...r,
|
|
628
504
|
args: e
|
|
@@ -647,10 +523,10 @@ var Re = E("action"), ze = j(({ client: e }) => {
|
|
|
647
523
|
getEvokableAction: o
|
|
648
524
|
};
|
|
649
525
|
});
|
|
650
|
-
function
|
|
651
|
-
return M(
|
|
526
|
+
function ke(e) {
|
|
527
|
+
return M(Oe, e);
|
|
652
528
|
}
|
|
653
|
-
var
|
|
529
|
+
var Ae = (e, t, n) => {
|
|
654
530
|
n.register(e, t);
|
|
655
531
|
};
|
|
656
532
|
//#endregion
|
|
@@ -666,7 +542,7 @@ function q(e, t, n, r) {
|
|
|
666
542
|
function J(e) {
|
|
667
543
|
return e === null || e === "" || Array.isArray(e) && !e.length;
|
|
668
544
|
}
|
|
669
|
-
function
|
|
545
|
+
function je(e) {
|
|
670
546
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
|
|
671
547
|
}
|
|
672
548
|
function Y(e) {
|
|
@@ -676,13 +552,13 @@ function Y(e) {
|
|
|
676
552
|
return !1;
|
|
677
553
|
}
|
|
678
554
|
}
|
|
679
|
-
function
|
|
555
|
+
function Me(e, t) {
|
|
680
556
|
return t.find((t) => t.key === e) ?? null;
|
|
681
557
|
}
|
|
682
|
-
function
|
|
558
|
+
function Ne(e, t) {
|
|
683
559
|
return e.multiple && (typeof t == "string" || typeof t == "number" || typeof t == "boolean") ? [t] : t;
|
|
684
560
|
}
|
|
685
|
-
function
|
|
561
|
+
function Pe(e, t) {
|
|
686
562
|
if (e.type !== "object" || J(t)) return null;
|
|
687
563
|
if (e.multiple) {
|
|
688
564
|
if (!Array.isArray(t)) return q(e, t, "This field expects multiple values", "Field expects an array of objects.");
|
|
@@ -694,7 +570,7 @@ function Ge(e, t) {
|
|
|
694
570
|
}
|
|
695
571
|
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
572
|
}
|
|
697
|
-
function
|
|
573
|
+
function Fe(e, t) {
|
|
698
574
|
if (J(t) || !Array.isArray(e.options) || e.options.length === 0) return null;
|
|
699
575
|
let n = Array.isArray(t) ? t : [t];
|
|
700
576
|
if (e.type === "object") {
|
|
@@ -702,23 +578,23 @@ function Ke(e, t) {
|
|
|
702
578
|
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
579
|
}
|
|
704
580
|
let r = e.options.map((e) => e.value);
|
|
705
|
-
return n.every((e) => !
|
|
581
|
+
return n.every((e) => !je(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
582
|
}
|
|
707
|
-
async function
|
|
708
|
-
if (
|
|
709
|
-
let
|
|
583
|
+
async function Ie(e, n, r, i) {
|
|
584
|
+
if (n.validation && !t(n.validation) && !J(r)) {
|
|
585
|
+
let t = i ? {
|
|
710
586
|
$input: r,
|
|
711
587
|
responses: i
|
|
712
|
-
} : { $input: r }, a = await e(
|
|
713
|
-
if (typeof a == "string") return q(
|
|
714
|
-
if (a === !1) return q(
|
|
588
|
+
} : { $input: r }, a = await e(n.validation, t);
|
|
589
|
+
if (typeof a == "string") return q(n, r, a, `Field validation resulted in an error: ${a}.`);
|
|
590
|
+
if (a === !1) return q(n, r, "This field is invalid", "Field validation resulted in an unspecified error.");
|
|
715
591
|
}
|
|
716
|
-
return
|
|
592
|
+
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
593
|
}
|
|
718
594
|
//#endregion
|
|
719
595
|
//#region src/entities/response/response.ts
|
|
720
|
-
var
|
|
721
|
-
let n =
|
|
596
|
+
var Le = E("response"), Re = j(({ client: t }) => {
|
|
597
|
+
let n = Le.store({}), r = O(), i = O(), a = T(n, {
|
|
722
598
|
register(e, t) {
|
|
723
599
|
return {
|
|
724
600
|
...e,
|
|
@@ -747,9 +623,9 @@ var Je = E("response"), Ye = j(({ client: e }) => {
|
|
|
747
623
|
});
|
|
748
624
|
} else a.registerBatch(e);
|
|
749
625
|
}
|
|
750
|
-
let s = (n, r) => t
|
|
626
|
+
let s = (n, r) => e(t, n, r), c = C({
|
|
751
627
|
source: {
|
|
752
|
-
allFields:
|
|
628
|
+
allFields: t.fields.listStore,
|
|
753
629
|
existingResponses: n
|
|
754
630
|
},
|
|
755
631
|
effect: async ({ allFields: e, existingResponses: t }, n) => {
|
|
@@ -757,7 +633,7 @@ var Je = E("response"), Ye = j(({ client: e }) => {
|
|
|
757
633
|
...t,
|
|
758
634
|
...n
|
|
759
635
|
}, o = Object.entries(n), c = await Promise.allSettled(o.map(async ([t, n]) => {
|
|
760
|
-
let o =
|
|
636
|
+
let o = Me(t, e);
|
|
761
637
|
if (!o) {
|
|
762
638
|
r.push({
|
|
763
639
|
fieldKey: t,
|
|
@@ -767,17 +643,17 @@ var Je = E("response"), Ye = j(({ client: e }) => {
|
|
|
767
643
|
});
|
|
768
644
|
return;
|
|
769
645
|
}
|
|
770
|
-
let c =
|
|
646
|
+
let c = Ne(o, n), l = await Ie(s, o, c, a);
|
|
771
647
|
if (l) {
|
|
772
648
|
r.push(l);
|
|
773
649
|
return;
|
|
774
650
|
}
|
|
775
|
-
let u =
|
|
651
|
+
let u = Pe(o, c);
|
|
776
652
|
if (u) {
|
|
777
653
|
r.push(u);
|
|
778
654
|
return;
|
|
779
655
|
}
|
|
780
|
-
let d =
|
|
656
|
+
let d = Fe(o, c);
|
|
781
657
|
if (d) {
|
|
782
658
|
r.push(d);
|
|
783
659
|
return;
|
|
@@ -828,14 +704,14 @@ var Je = E("response"), Ye = j(({ client: e }) => {
|
|
|
828
704
|
return n === null ? e?.defaultValue !== void 0 && e.defaultValue !== null ? e.defaultValue : null : n;
|
|
829
705
|
});
|
|
830
706
|
}
|
|
831
|
-
function h(
|
|
832
|
-
return m(
|
|
707
|
+
function h(e) {
|
|
708
|
+
return m(t.fields.getById(e));
|
|
833
709
|
}
|
|
834
|
-
function g(
|
|
835
|
-
return m(
|
|
710
|
+
function g(e) {
|
|
711
|
+
return m(t.fields.getByKey(e));
|
|
836
712
|
}
|
|
837
|
-
function _(
|
|
838
|
-
return m(
|
|
713
|
+
function _(e) {
|
|
714
|
+
return m(t.fields.getByName(e));
|
|
839
715
|
}
|
|
840
716
|
return A({
|
|
841
717
|
clock: r,
|
|
@@ -856,13 +732,13 @@ var Je = E("response"), Ye = j(({ client: e }) => {
|
|
|
856
732
|
getByFieldName: _
|
|
857
733
|
};
|
|
858
734
|
});
|
|
859
|
-
function
|
|
860
|
-
return M(
|
|
735
|
+
function ze(e) {
|
|
736
|
+
return M(Re, e);
|
|
861
737
|
}
|
|
862
738
|
//#endregion
|
|
863
739
|
//#region src/entities/condition/condition.ts
|
|
864
|
-
var
|
|
865
|
-
let e =
|
|
740
|
+
var Be = E("condition"), Ve = j(() => {
|
|
741
|
+
let e = Be.store({}), t = T(e, { register(e, t) {
|
|
866
742
|
return {
|
|
867
743
|
...e,
|
|
868
744
|
[t.condition.id]: t.condition
|
|
@@ -886,13 +762,13 @@ var Ze = E("condition"), Qe = j(() => {
|
|
|
886
762
|
indexStore: e
|
|
887
763
|
};
|
|
888
764
|
});
|
|
889
|
-
function
|
|
890
|
-
return M(
|
|
765
|
+
function He() {
|
|
766
|
+
return M(Ve);
|
|
891
767
|
}
|
|
892
768
|
//#endregion
|
|
893
769
|
//#region src/utils/api-url.ts
|
|
894
|
-
function
|
|
895
|
-
if (
|
|
770
|
+
function Ue() {
|
|
771
|
+
if (d()) {
|
|
896
772
|
let e = [
|
|
897
773
|
document.currentScript,
|
|
898
774
|
document.getElementById("picked_script"),
|
|
@@ -906,36 +782,36 @@ function et() {
|
|
|
906
782
|
}
|
|
907
783
|
//#endregion
|
|
908
784
|
//#region src/utils/search-params.ts
|
|
909
|
-
function
|
|
910
|
-
if (!
|
|
785
|
+
function We() {
|
|
786
|
+
if (!a()) return {};
|
|
911
787
|
let e = new URLSearchParams(window.location.search), t = {}, n = /* @__PURE__ */ new Set();
|
|
912
788
|
for (let [t] of e.entries()) t.startsWith("picked-") && n.add(t);
|
|
913
789
|
for (let r of n) {
|
|
914
790
|
let n = r.replace("picked-", "");
|
|
915
791
|
t[n] = e.getAll(r);
|
|
916
792
|
}
|
|
917
|
-
let r =
|
|
918
|
-
if (n.size > 0)
|
|
793
|
+
let r = x("s");
|
|
794
|
+
if (n.size > 0) b.set(r, t);
|
|
919
795
|
else {
|
|
920
|
-
let e =
|
|
796
|
+
let e = b.get(r);
|
|
921
797
|
if (e) return e.json() || {};
|
|
922
798
|
}
|
|
923
799
|
return t;
|
|
924
800
|
}
|
|
925
801
|
//#endregion
|
|
926
802
|
//#region src/utils/user-session.ts
|
|
927
|
-
function
|
|
928
|
-
return
|
|
803
|
+
function Ge() {
|
|
804
|
+
return c() ? 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
805
|
}
|
|
930
|
-
var
|
|
931
|
-
let e =
|
|
806
|
+
var Ke = x("session", "global"), qe = () => {
|
|
807
|
+
let e = y.get(Ke), t;
|
|
932
808
|
e.isSet() && (t = e.json());
|
|
933
809
|
let n = (t) => e.set({
|
|
934
810
|
id: t.id,
|
|
935
811
|
isUser: t.isUser,
|
|
936
812
|
identifiers: t.identifiers
|
|
937
813
|
}), r = {
|
|
938
|
-
id: t?.id ??
|
|
814
|
+
id: t?.id ?? Ge(),
|
|
939
815
|
isUser: t?.isUser ?? void 0,
|
|
940
816
|
identifiers: t?.identifiers ?? void 0,
|
|
941
817
|
setIsUser(e) {
|
|
@@ -952,22 +828,22 @@ var rt = S("session", "global"), it = () => {
|
|
|
952
828
|
}
|
|
953
829
|
};
|
|
954
830
|
return n(r), r;
|
|
955
|
-
},
|
|
831
|
+
}, Je = () => l() ? qe() : null;
|
|
956
832
|
//#endregion
|
|
957
833
|
//#region src/utils/picked-config.ts
|
|
958
|
-
function
|
|
959
|
-
if (
|
|
834
|
+
function X() {
|
|
835
|
+
if (a()) return globalThis.window.pickedConfig;
|
|
960
836
|
}
|
|
961
|
-
function
|
|
962
|
-
if (!
|
|
963
|
-
let e =
|
|
837
|
+
function Ye() {
|
|
838
|
+
if (!a()) return;
|
|
839
|
+
let e = X(), t = e?.organizationId, n = e?.projectId;
|
|
964
840
|
return t && n ? {
|
|
965
841
|
organizationId: t,
|
|
966
842
|
projectId: n
|
|
967
843
|
} : void 0;
|
|
968
844
|
}
|
|
969
|
-
function
|
|
970
|
-
if (!
|
|
845
|
+
function Xe() {
|
|
846
|
+
if (!d()) return;
|
|
971
847
|
let e = document.getElementById("picked_script") || document.querySelector("script#picked") || document.getElementById("cvly");
|
|
972
848
|
if (!e) return;
|
|
973
849
|
let t = e.dataset.organizationid || e.getAttribute("organization-id"), n = e.dataset.projectid || e.getAttribute("project-id");
|
|
@@ -976,15 +852,15 @@ function ot() {
|
|
|
976
852
|
projectId: n
|
|
977
853
|
} : void 0;
|
|
978
854
|
}
|
|
979
|
-
function
|
|
855
|
+
function Z(e) {
|
|
980
856
|
let { organizationId: t, projectId: n } = e;
|
|
981
857
|
if (t && n) return {
|
|
982
858
|
organizationId: t,
|
|
983
859
|
projectId: n
|
|
984
860
|
};
|
|
985
|
-
let r =
|
|
861
|
+
let r = Ye();
|
|
986
862
|
if (r) return r;
|
|
987
|
-
let i =
|
|
863
|
+
let i = Xe();
|
|
988
864
|
if (i) return i;
|
|
989
865
|
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
866
|
}
|
|
@@ -993,7 +869,7 @@ function st(e) {
|
|
|
993
869
|
function Q(e) {
|
|
994
870
|
return e == null || e === "" || Number.isNaN(e);
|
|
995
871
|
}
|
|
996
|
-
var
|
|
872
|
+
var Ze = {
|
|
997
873
|
default: (e, t) => Q(e) ? String(t ?? "") : String(e),
|
|
998
874
|
append: (e, t) => t && !Q(e) ? `${e} ${t}` : e,
|
|
999
875
|
prepend: (e, t) => t && !Q(e) ? `${t} ${e}` : e,
|
|
@@ -1014,24 +890,24 @@ var ct = {
|
|
|
1014
890
|
return e instanceof Set ? t.format(Array.from(e).map(String)) : e;
|
|
1015
891
|
}
|
|
1016
892
|
};
|
|
1017
|
-
function
|
|
893
|
+
function Qe(e) {
|
|
1018
894
|
return typeof e == "object" && !!e;
|
|
1019
895
|
}
|
|
1020
|
-
function
|
|
896
|
+
function $e(e, t) {
|
|
1021
897
|
let n = t;
|
|
1022
|
-
for (let t of e.split(".")) if (
|
|
898
|
+
for (let t of e.split(".")) if (Qe(n) && t in n) n = n[t];
|
|
1023
899
|
else return;
|
|
1024
900
|
return typeof n == "function" ? n() : n;
|
|
1025
901
|
}
|
|
1026
|
-
function
|
|
1027
|
-
let n = e.split("|").map((e) => e.trim()), r =
|
|
902
|
+
function et(e, t) {
|
|
903
|
+
let n = e.split("|").map((e) => e.trim()), r = $e(n.shift() ?? "", t);
|
|
1028
904
|
for (let e of n) {
|
|
1029
|
-
let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o =
|
|
905
|
+
let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o = Ze[i];
|
|
1030
906
|
o && (r = o(r, a));
|
|
1031
907
|
}
|
|
1032
908
|
return Q(r) ? "" : typeof r == "object" ? JSON.stringify(r) : String(r);
|
|
1033
909
|
}
|
|
1034
|
-
function
|
|
910
|
+
function tt(e, t) {
|
|
1035
911
|
let n = "", r = 0;
|
|
1036
912
|
for (; r < e.length;) if (e[r] === "{" && e[r + 1] === "{") {
|
|
1037
913
|
r += 2;
|
|
@@ -1043,14 +919,14 @@ function ft(e, t) {
|
|
|
1043
919
|
}
|
|
1044
920
|
i += e[r++];
|
|
1045
921
|
}
|
|
1046
|
-
n +=
|
|
922
|
+
n += et(i.trim(), t);
|
|
1047
923
|
} else n += e[r++];
|
|
1048
924
|
return n;
|
|
1049
925
|
}
|
|
1050
926
|
//#endregion
|
|
1051
927
|
//#region src/picked.ts
|
|
1052
928
|
var $ = class {
|
|
1053
|
-
static logger =
|
|
929
|
+
static logger = n;
|
|
1054
930
|
options;
|
|
1055
931
|
isReady = !1;
|
|
1056
932
|
plugins = {};
|
|
@@ -1066,30 +942,30 @@ var $ = class {
|
|
|
1066
942
|
precondition;
|
|
1067
943
|
condition;
|
|
1068
944
|
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 =
|
|
945
|
+
searchParams = We();
|
|
946
|
+
history = _e();
|
|
947
|
+
components = ue({ client: this });
|
|
948
|
+
experienceInstances = ie({ client: this });
|
|
949
|
+
experiences = ee({ client: this });
|
|
950
|
+
frameworks = I({ client: this });
|
|
951
|
+
predicates = de({ client: this });
|
|
952
|
+
features = me({ client: this });
|
|
953
|
+
conditions = He();
|
|
954
|
+
fields = Se();
|
|
955
|
+
responses = ze({ client: this });
|
|
956
|
+
steps = Te();
|
|
957
|
+
actions = ke({ client: this });
|
|
1082
958
|
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 ||
|
|
959
|
+
this.events = ye(this.eventBus);
|
|
960
|
+
let { organizationId: t, projectId: n } = Z(e);
|
|
961
|
+
this.organizationId = t, this.projectId = n, this.options = Object.freeze(e), this.apiUrl = e.apiUrl || Ue(), this.dashboardUrl = e.dashboardUrl ?? "https://dashboard.picked.app", this.documentationSiteUrl = e.documentationSiteUrl ?? "https://docs.picked.app", this.session = Je(), this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.setupActions(), this.setupComponents(), this.precondition = e.precondition, this.condition = e.condition, this.eventBus({
|
|
1086
962
|
type: "load",
|
|
1087
|
-
version:
|
|
963
|
+
version: re()
|
|
1088
964
|
});
|
|
1089
965
|
}
|
|
1090
966
|
start = () => {
|
|
1091
|
-
|
|
1092
|
-
if (!
|
|
967
|
+
B(this), (async () => {
|
|
968
|
+
if (!d()) return;
|
|
1093
969
|
await this.runPluginStartHooks();
|
|
1094
970
|
let e = await this.evaluateGate(this.precondition);
|
|
1095
971
|
this.preconditionPassed = e;
|
|
@@ -1103,7 +979,7 @@ var $ = class {
|
|
|
1103
979
|
value: e
|
|
1104
980
|
});
|
|
1105
981
|
}
|
|
1106
|
-
if (this.eventBus({ type: "initialize" }), n &&
|
|
982
|
+
if (this.eventBus({ type: "initialize" }), n && v(this), await g(), n && v(this), this.eventBus({ type: "ready" }), this.isReady = !0, this.session) {
|
|
1107
983
|
let { id: e, isUser: t, identifiers: n } = this.session;
|
|
1108
984
|
this.eventBus({
|
|
1109
985
|
type: "session",
|
|
@@ -1115,21 +991,21 @@ var $ = class {
|
|
|
1115
991
|
})();
|
|
1116
992
|
};
|
|
1117
993
|
registerFramework = (e) => {
|
|
1118
|
-
|
|
994
|
+
L(e, this.frameworks);
|
|
1119
995
|
};
|
|
1120
996
|
registerComponent = (e, t) => {
|
|
1121
|
-
|
|
997
|
+
N(e, t, this.components);
|
|
1122
998
|
};
|
|
1123
999
|
registerPlugin = (e) => {
|
|
1124
|
-
|
|
1000
|
+
ae(this, e, this.plugins);
|
|
1125
1001
|
let t = this.plugins[e.name];
|
|
1126
1002
|
t?.onStart && this.pluginStartHooks.push(t.onStart);
|
|
1127
1003
|
};
|
|
1128
1004
|
registerFeature = (e, t) => {
|
|
1129
|
-
|
|
1005
|
+
he(e, t, this.features);
|
|
1130
1006
|
};
|
|
1131
1007
|
registerPredicate = (e, t) => {
|
|
1132
|
-
|
|
1008
|
+
fe(e, t, this.predicates);
|
|
1133
1009
|
};
|
|
1134
1010
|
registerCondition = (e) => {
|
|
1135
1011
|
this.conditions.register(e);
|
|
@@ -1138,15 +1014,15 @@ var $ = class {
|
|
|
1138
1014
|
this.fields.register(e);
|
|
1139
1015
|
};
|
|
1140
1016
|
registerStep = (e) => {
|
|
1141
|
-
|
|
1017
|
+
Ee(e, this.steps);
|
|
1142
1018
|
};
|
|
1143
1019
|
registerAction = (e, t) => {
|
|
1144
|
-
|
|
1020
|
+
Ae(e, t, this.actions);
|
|
1145
1021
|
};
|
|
1146
1022
|
registerExperience = (e) => {
|
|
1147
|
-
e.component &&
|
|
1023
|
+
e.component && N(`experience:${e.id}`, e.component, this.components), this.experiences.register(e);
|
|
1148
1024
|
};
|
|
1149
|
-
getStateSnapshot = () =>
|
|
1025
|
+
getStateSnapshot = () => V(this);
|
|
1150
1026
|
launchExperienceById = async (e, t) => {
|
|
1151
1027
|
this.experiences.launch({
|
|
1152
1028
|
id: e,
|
|
@@ -1168,8 +1044,8 @@ var $ = class {
|
|
|
1168
1044
|
async runPluginStartHooks() {
|
|
1169
1045
|
for (let e of this.pluginStartHooks) await e();
|
|
1170
1046
|
}
|
|
1171
|
-
async evaluateGate(
|
|
1172
|
-
return
|
|
1047
|
+
async evaluateGate(t) {
|
|
1048
|
+
return t === void 0 ? !0 : typeof t == "boolean" ? t : await e(this, t) === !0;
|
|
1173
1049
|
}
|
|
1174
1050
|
setupPlugins() {
|
|
1175
1051
|
this.options.plugins?.forEach((e) => {
|
|
@@ -1235,7 +1111,7 @@ var $ = class {
|
|
|
1235
1111
|
getPluginConfig = (e) => this.plugins[e] ?? {};
|
|
1236
1112
|
renderString = (e, t) => {
|
|
1237
1113
|
let n = this.responses.listStore.getState().reduce((e, t) => (e[t.fieldKey] = t.value, e), {});
|
|
1238
|
-
return
|
|
1114
|
+
return tt(e, {
|
|
1239
1115
|
...t,
|
|
1240
1116
|
responses: n
|
|
1241
1117
|
});
|
|
@@ -1243,20 +1119,20 @@ var $ = class {
|
|
|
1243
1119
|
};
|
|
1244
1120
|
//#endregion
|
|
1245
1121
|
//#region src/entities/component/lazyComponent.ts
|
|
1246
|
-
function
|
|
1122
|
+
function nt(e) {
|
|
1247
1123
|
return {
|
|
1248
1124
|
$$type: "lazy-component",
|
|
1249
1125
|
load: e
|
|
1250
1126
|
};
|
|
1251
1127
|
}
|
|
1252
|
-
function
|
|
1128
|
+
function rt(e) {
|
|
1253
1129
|
return typeof e == "object" && !!e && "$$type" in e && e.$$type === "lazy-component";
|
|
1254
1130
|
}
|
|
1255
1131
|
//#endregion
|
|
1256
1132
|
//#region src/exports.ts
|
|
1257
|
-
var
|
|
1133
|
+
var it = (e) => {
|
|
1258
1134
|
let t = new $(e);
|
|
1259
|
-
return
|
|
1135
|
+
return u(t), t;
|
|
1260
1136
|
};
|
|
1261
1137
|
//#endregion
|
|
1262
|
-
export { $ as Picked,
|
|
1138
|
+
export { $ as Picked, it as createClient, x as createStorageKey, e as evaluateRuleLogic, X as getPickedConfig, rt as isLazyLoader, _ as isPickedRoot, nt as lazyComponent, y as localStore, b as sessionStore, te as subscribe, p as supportsCookies, c as supportsCryptoRandomUUID, d as supportsDocument, o as supportsHistory, r as supportsIntersectionObserver, l as supportsLocalStorage, f as supportsLocation, i as supportsSessionStorage, s as supportsShadowRoot, m as supportsWebComponents, a as supportsWindow };
|