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