@picked/client 0.0.1-dev.1774926578165 → 0.0.1-dev.1774948924200
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-D9V-o6-o.js → api-B63a9m85.js} +1 -1
- package/dist/{api-D4N7odga.cjs → api-Cv48NIEt.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/responses-browser-storage/index.js +1 -1
- package/dist/cjs/plugins/responses-indexeddb/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/esm/form/index.js +27 -27
- package/dist/esm/index.js +192 -196
- package/dist/esm/plugins/create-experience/index.js +1 -1
- package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
- package/dist/esm/plugins/responses-browser-storage/index.js +15 -44
- package/dist/esm/plugins/responses-indexeddb/index.js +9 -5
- package/dist/esm/server/index.js +1 -1
- package/dist/experience-instance-BYPmlrHE.cjs +1 -0
- package/dist/{experience-instance-CwwrKUI8.js → experience-instance-CR_K3Qj-.js} +36 -42
- package/dist/types/entities/experience/experience.d.ts.map +1 -1
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/field/field.d.ts +1 -1
- package/dist/types/entities/field/field.d.ts.map +1 -1
- package/dist/types/entities/response/response-validation.d.ts +0 -2
- package/dist/types/entities/response/response-validation.d.ts.map +1 -1
- package/dist/types/entities/response/response.d.ts +2 -5
- package/dist/types/entities/response/response.d.ts.map +1 -1
- package/dist/types/entities/step/step.d.ts +4 -2
- package/dist/types/entities/step/step.d.ts.map +1 -1
- package/dist/types/form/create-field-validation.d.ts +4 -4
- package/dist/types/form/create-field-validation.d.ts.map +1 -1
- package/dist/types/picked.d.ts +3 -3
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
- package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/plugins/responses-indexeddb/plugin.d.ts.map +1 -1
- package/dist/types/utils/indexed-db.d.ts +52 -0
- package/dist/types/utils/indexed-db.d.ts.map +1 -1
- package/dist/types/utils/nodes.d.ts +0 -22
- package/dist/types/utils/nodes.d.ts.map +1 -1
- package/dist/types/utils/state-snaphot.d.ts +12 -2
- package/dist/types/utils/state-snaphot.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/experience-instance-DdFUcVRd.cjs +0 -1
package/dist/esm/index.js
CHANGED
|
@@ -2,15 +2,15 @@ import { n as e, t } from "../rules-logic-BIkBWZmf.js";
|
|
|
2
2
|
import { t as n } from "../object-C82v79xc.js";
|
|
3
3
|
import { t as r } from "../logger-6z_gb4rA.js";
|
|
4
4
|
import { a as i, c as a, d as o, i as s, l as c, n as l, o as u, p as d, r as f, s as p, t as m, u as h } from "../supports-0XIfd4-R.js";
|
|
5
|
-
import { a as g, c as
|
|
6
|
-
import { i as
|
|
7
|
-
import { n as oe, r as se } from "../api-
|
|
5
|
+
import { a as g, c as ee, i as _, l as te, n as ne, o as re, r as ie, s as v } from "../experience-instance-CR_K3Qj-.js";
|
|
6
|
+
import { i as ae, n as y, r as b, t as x } from "../storage-6Xk0uAxB.js";
|
|
7
|
+
import { n as oe, r as se } from "../api-B63a9m85.js";
|
|
8
8
|
import { t as ce } from "../id-CRqy981z.js";
|
|
9
|
-
import { attach as
|
|
10
|
-
import { createFactory as
|
|
9
|
+
import { attach as S, combine as C, createApi as w, createDomain as T, createEffect as E, createEvent as D, createStore as O, sample as k } from "effector";
|
|
10
|
+
import { createFactory as A, invoke as j } from "@withease/factories";
|
|
11
11
|
//#region src/entities/experience/experience.ts
|
|
12
|
-
var
|
|
13
|
-
let n =
|
|
12
|
+
var M = T("experience"), le = A(({ client: e, experience: t }) => {
|
|
13
|
+
let n = M.store(t), r = w(n, { merge(e, t) {
|
|
14
14
|
return {
|
|
15
15
|
...e,
|
|
16
16
|
...t.experience
|
|
@@ -20,11 +20,8 @@ var N = E("experience"), le = j(({ client: e, experience: t }) => {
|
|
|
20
20
|
decisionLogic: e.condition,
|
|
21
21
|
targetSelectors: e.targets,
|
|
22
22
|
initializeOpenLogic: e.initializeOpen
|
|
23
|
-
})), a =
|
|
24
|
-
let r = e.nodes.filter(
|
|
25
|
-
let n = e.stepId;
|
|
26
|
-
return t.find((e) => e.id === n || e.key === n);
|
|
27
|
-
}).filter((e) => e !== void 0), i = e.nodes.filter(re).map((e) => n.find((t) => t.id === g(e))).filter((e) => e !== void 0);
|
|
23
|
+
})), a = C(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 = C(n, e.steps.listStore, e.conditions.listStore, (e, t, n) => {
|
|
24
|
+
let r = e.nodes.filter(_).map((e) => t.find((t) => t.id === e.stepId)).filter((e) => e !== void 0), i = e.nodes.filter(ie).map((e) => n.find((t) => t.id === e.conditionId)).filter((e) => e !== void 0);
|
|
28
25
|
return {
|
|
29
26
|
steps: r,
|
|
30
27
|
nodes: e.nodes,
|
|
@@ -44,10 +41,10 @@ var N = E("experience"), le = j(({ client: e, experience: t }) => {
|
|
|
44
41
|
};
|
|
45
42
|
});
|
|
46
43
|
function ue(e) {
|
|
47
|
-
return
|
|
44
|
+
return j(le, e);
|
|
48
45
|
}
|
|
49
|
-
var de =
|
|
50
|
-
let t =
|
|
46
|
+
var de = A(({ client: e }) => {
|
|
47
|
+
let t = M.store({}), n = w(t, { register(e, t) {
|
|
51
48
|
return {
|
|
52
49
|
...e,
|
|
53
50
|
[t.id]: t
|
|
@@ -70,9 +67,9 @@ var de = j(({ client: e }) => {
|
|
|
70
67
|
}
|
|
71
68
|
let a = t.map((e) => Object.values(e));
|
|
72
69
|
function o(e) {
|
|
73
|
-
return
|
|
70
|
+
return C(t, (t) => t[e], { skipVoid: !1 });
|
|
74
71
|
}
|
|
75
|
-
let s =
|
|
72
|
+
let s = S({
|
|
76
73
|
source: {
|
|
77
74
|
experiences: t,
|
|
78
75
|
keys: r
|
|
@@ -84,10 +81,10 @@ var de = j(({ client: e }) => {
|
|
|
84
81
|
return;
|
|
85
82
|
}
|
|
86
83
|
if (a?.bypassCondition) {
|
|
87
|
-
|
|
84
|
+
N(e, s, a);
|
|
88
85
|
return;
|
|
89
86
|
}
|
|
90
|
-
await
|
|
87
|
+
await F(e, s) && N(e, s, a);
|
|
91
88
|
}
|
|
92
89
|
});
|
|
93
90
|
return {
|
|
@@ -95,7 +92,7 @@ var de = j(({ client: e }) => {
|
|
|
95
92
|
get: o,
|
|
96
93
|
getById: o,
|
|
97
94
|
launch: s,
|
|
98
|
-
open:
|
|
95
|
+
open: S({
|
|
99
96
|
source: {
|
|
100
97
|
instances: e.experienceInstances.listStore,
|
|
101
98
|
keys: r
|
|
@@ -116,22 +113,22 @@ var de = j(({ client: e }) => {
|
|
|
116
113
|
};
|
|
117
114
|
});
|
|
118
115
|
function fe(e) {
|
|
119
|
-
return
|
|
116
|
+
return j(de, e);
|
|
120
117
|
}
|
|
121
|
-
var
|
|
122
|
-
let { targetSelectors: r } = t.configStore.getState(), i =
|
|
123
|
-
i.forEach(({ elements: e }) => e.forEach((e) =>
|
|
118
|
+
var N = (e, t, n) => {
|
|
119
|
+
let { targetSelectors: r } = t.configStore.getState(), i = v(r, t.id);
|
|
120
|
+
i.forEach(({ elements: e }) => e.forEach((e) => te(e, t.id))), g(i, t.id).forEach((r) => {
|
|
124
121
|
n ? e.experienceInstances.spawn(t, r, n) : e.experienceInstances.spawn(t, r);
|
|
125
122
|
});
|
|
126
|
-
},
|
|
123
|
+
}, P = async (e) => {
|
|
127
124
|
await Promise.all(e.experiences.listStore.getState().map(async (t) => {
|
|
128
|
-
await
|
|
125
|
+
await F(e, t) && N(e, t);
|
|
129
126
|
}));
|
|
130
|
-
},
|
|
127
|
+
}, F = async (n, r) => {
|
|
131
128
|
if (!n.preconditionPassed || !n.session?.isUser) return !1;
|
|
132
129
|
let { decisionLogic: i, targetSelectors: a } = r.configStore.getState();
|
|
133
|
-
return
|
|
134
|
-
},
|
|
130
|
+
return v(a, r.id).length < 1 || a.length === 0 ? !1 : i === void 0 ? !0 : e(i) ? await t(n, i) === !0 : !0;
|
|
131
|
+
}, I = (e, t, n) => {
|
|
135
132
|
let r = t.name, i = t.setup(e);
|
|
136
133
|
if (i) {
|
|
137
134
|
let e = n[r] ?? {};
|
|
@@ -140,16 +137,16 @@ var P = (e, t, n) => {
|
|
|
140
137
|
...i
|
|
141
138
|
});
|
|
142
139
|
}
|
|
143
|
-
},
|
|
140
|
+
}, L = T("component"), R = A(({ client: e, component: t, name: n }) => ({
|
|
144
141
|
name: n,
|
|
145
142
|
component: t,
|
|
146
143
|
frameworkStore: e.frameworks.getByName(t.frameworkName)
|
|
147
144
|
}));
|
|
148
|
-
function
|
|
149
|
-
return
|
|
145
|
+
function z(e) {
|
|
146
|
+
return j(R, e);
|
|
150
147
|
}
|
|
151
|
-
var
|
|
152
|
-
let t =
|
|
148
|
+
var B = A(({ client: e }) => {
|
|
149
|
+
let t = L.store({}), n = w(t, { register(e, t) {
|
|
153
150
|
return {
|
|
154
151
|
...e,
|
|
155
152
|
[t.name]: t
|
|
@@ -157,7 +154,7 @@ var V = j(({ client: e }) => {
|
|
|
157
154
|
} });
|
|
158
155
|
function r(r, i) {
|
|
159
156
|
t.getState()[r] && `${r}`;
|
|
160
|
-
let a =
|
|
157
|
+
let a = z({
|
|
161
158
|
client: e,
|
|
162
159
|
name: r,
|
|
163
160
|
component: i
|
|
@@ -174,13 +171,13 @@ var V = j(({ client: e }) => {
|
|
|
174
171
|
listStore: i
|
|
175
172
|
};
|
|
176
173
|
});
|
|
177
|
-
function
|
|
178
|
-
return
|
|
174
|
+
function V(e) {
|
|
175
|
+
return j(B, e);
|
|
179
176
|
}
|
|
180
177
|
var H = (e, t, n) => {
|
|
181
178
|
n.register(e, t);
|
|
182
|
-
},
|
|
183
|
-
let t =
|
|
179
|
+
}, pe = T("framework"), me = A(({ client: e }) => {
|
|
180
|
+
let t = pe.store({}), n = w(t, { register(e, t) {
|
|
184
181
|
return {
|
|
185
182
|
...e,
|
|
186
183
|
[t.name]: t.framework
|
|
@@ -202,15 +199,15 @@ var H = (e, t, n) => {
|
|
|
202
199
|
listStore: i
|
|
203
200
|
};
|
|
204
201
|
});
|
|
205
|
-
function
|
|
206
|
-
return
|
|
202
|
+
function he(e) {
|
|
203
|
+
return j(me, e);
|
|
207
204
|
}
|
|
208
|
-
var
|
|
205
|
+
var ge = (e, t) => {
|
|
209
206
|
t.register(e.name, e);
|
|
210
|
-
},
|
|
207
|
+
}, _e = 6e3, ve = x("last_ping", "global"), ye = async (e) => {
|
|
211
208
|
try {
|
|
212
|
-
let t = Date.now(), n =
|
|
213
|
-
if (n.isSet() && (r = n.json() ?? 0), r && t - r <
|
|
209
|
+
let t = Date.now(), n = y.get(ve), r = 0;
|
|
210
|
+
if (n.isSet() && (r = n.json() ?? 0), r && t - r < _e) return !0;
|
|
214
211
|
let i = {
|
|
215
212
|
projectId: e.projectId,
|
|
216
213
|
path: window.location.pathname
|
|
@@ -238,8 +235,8 @@ function U(e) {
|
|
|
238
235
|
}
|
|
239
236
|
//#endregion
|
|
240
237
|
//#region src/entities/predicate/predicate.ts
|
|
241
|
-
var
|
|
242
|
-
let t =
|
|
238
|
+
var be = T("predicate"), xe = A(({ client: e }) => {
|
|
239
|
+
let t = be.store({}), n = w(t, { register(e, t) {
|
|
243
240
|
return {
|
|
244
241
|
...e,
|
|
245
242
|
[t.name]: {
|
|
@@ -259,7 +256,7 @@ var xe = E("predicate"), Se = j(({ client: e }) => {
|
|
|
259
256
|
return t.map((t) => t[e]?.predicate, { skipVoid: !1 });
|
|
260
257
|
}
|
|
261
258
|
function o(t) {
|
|
262
|
-
let n =
|
|
259
|
+
let n = O(() => void 0, { skipVoid: !1 }), r = E(async () => {
|
|
263
260
|
let n = a(t).getState();
|
|
264
261
|
if (!n) return;
|
|
265
262
|
let r = U(e);
|
|
@@ -268,13 +265,13 @@ var xe = E("predicate"), Se = j(({ client: e }) => {
|
|
|
268
265
|
args: e
|
|
269
266
|
});
|
|
270
267
|
});
|
|
271
|
-
return
|
|
268
|
+
return k({
|
|
272
269
|
source: {
|
|
273
270
|
responses: e.responses.listStore,
|
|
274
271
|
fields: e.fields.listStore
|
|
275
272
|
},
|
|
276
273
|
target: r
|
|
277
|
-
}),
|
|
274
|
+
}), k({
|
|
278
275
|
clock: r.doneData,
|
|
279
276
|
filter: (e) => e !== void 0,
|
|
280
277
|
target: n
|
|
@@ -287,13 +284,13 @@ var xe = E("predicate"), Se = j(({ client: e }) => {
|
|
|
287
284
|
getEvokablePredicate: o
|
|
288
285
|
};
|
|
289
286
|
});
|
|
290
|
-
function
|
|
291
|
-
return
|
|
287
|
+
function Se(e) {
|
|
288
|
+
return j(xe, e);
|
|
292
289
|
}
|
|
293
|
-
var
|
|
290
|
+
var Ce = (e, t, n) => {
|
|
294
291
|
n.register(e, t);
|
|
295
|
-
}, W =
|
|
296
|
-
let t = W.store({}), n = W.store([]), r =
|
|
292
|
+
}, W = T("feature"), we = A(({ client: e }) => {
|
|
293
|
+
let t = W.store({}), n = W.store([]), r = w(t, { register(e, t) {
|
|
297
294
|
return {
|
|
298
295
|
...e,
|
|
299
296
|
[t.id]: t.feature
|
|
@@ -313,19 +310,19 @@ var we = (e, t, n) => {
|
|
|
313
310
|
feature: i
|
|
314
311
|
}));
|
|
315
312
|
}
|
|
316
|
-
let a =
|
|
317
|
-
let r =
|
|
313
|
+
let a = E(async ({ id: e, key: t, storage: n = "local" }) => {
|
|
314
|
+
let r = x(`feature:${e}:${t}`, "global"), i = (n === "session" ? b : y).get(r).boolean();
|
|
318
315
|
return i === null ? null : {
|
|
319
316
|
id: e,
|
|
320
317
|
key: t,
|
|
321
318
|
bucket: i,
|
|
322
319
|
storage: n
|
|
323
320
|
};
|
|
324
|
-
}), o =
|
|
321
|
+
}), o = E((e) => {
|
|
325
322
|
if (!e) return null;
|
|
326
|
-
let t =
|
|
327
|
-
(e.storage === "session" ?
|
|
328
|
-
}), s = /* @__PURE__ */ new Map(), c =
|
|
323
|
+
let t = x(`feature:${e.id}:${e.key}`, "global");
|
|
324
|
+
(e.storage === "session" ? b : y).set(t, e.bucket);
|
|
325
|
+
}), s = /* @__PURE__ */ new Map(), c = S({
|
|
329
326
|
source: {
|
|
330
327
|
allFeaturesStore: t,
|
|
331
328
|
resolvedFeaturesStore: n
|
|
@@ -356,7 +353,7 @@ var we = (e, t, n) => {
|
|
|
356
353
|
};
|
|
357
354
|
}
|
|
358
355
|
});
|
|
359
|
-
|
|
356
|
+
k({
|
|
360
357
|
clock: r.register,
|
|
361
358
|
fn: (e) => {
|
|
362
359
|
let { id: t, feature: n } = e;
|
|
@@ -367,7 +364,7 @@ var we = (e, t, n) => {
|
|
|
367
364
|
};
|
|
368
365
|
},
|
|
369
366
|
target: a
|
|
370
|
-
}),
|
|
367
|
+
}), k({
|
|
371
368
|
source: t,
|
|
372
369
|
clock: c.doneData,
|
|
373
370
|
fn: (e, t) => {
|
|
@@ -381,7 +378,7 @@ var we = (e, t, n) => {
|
|
|
381
378
|
},
|
|
382
379
|
target: o
|
|
383
380
|
});
|
|
384
|
-
let l =
|
|
381
|
+
let l = C({
|
|
385
382
|
allFeaturesStore: t,
|
|
386
383
|
resolvedFeaturesStore: n
|
|
387
384
|
}).map(({ allFeaturesStore: e, resolvedFeaturesStore: t }) => Object.values(e).map((e) => {
|
|
@@ -403,7 +400,7 @@ var we = (e, t, n) => {
|
|
|
403
400
|
isResolved: !1
|
|
404
401
|
};
|
|
405
402
|
}));
|
|
406
|
-
|
|
403
|
+
k({
|
|
407
404
|
clock: c.doneData,
|
|
408
405
|
source: { resolvedFeatures: n },
|
|
409
406
|
filter: ({ resolvedFeatures: e }, { id: t, key: n }) => !e.some((e) => e.id === t && e.key === n),
|
|
@@ -412,7 +409,7 @@ var we = (e, t, n) => {
|
|
|
412
409
|
type: "feature_decide",
|
|
413
410
|
feature: e
|
|
414
411
|
}))
|
|
415
|
-
}),
|
|
412
|
+
}), k({
|
|
416
413
|
clock: [a.doneData, c.doneData],
|
|
417
414
|
source: n,
|
|
418
415
|
fn: (e, t) => !t || e.some((e) => e.id === t.id && e.key === t.key) ? e : [...e, t],
|
|
@@ -425,15 +422,15 @@ var we = (e, t, n) => {
|
|
|
425
422
|
return t.map((t) => t[e], { skipVoid: !1 });
|
|
426
423
|
}
|
|
427
424
|
function f(e) {
|
|
428
|
-
let t =
|
|
425
|
+
let t = O(async () => void 0, { skipVoid: !1 }), r = E(async () => {
|
|
429
426
|
let t = u(e).getState();
|
|
430
427
|
if (t) return async () => (await t.getBucket()).bucket;
|
|
431
428
|
});
|
|
432
|
-
return
|
|
429
|
+
return k({
|
|
433
430
|
source: n,
|
|
434
431
|
filter: (t) => t.some((t) => t.id === e),
|
|
435
432
|
target: r
|
|
436
|
-
}),
|
|
433
|
+
}), k({
|
|
437
434
|
clock: r.doneData,
|
|
438
435
|
filter: (e) => e !== void 0,
|
|
439
436
|
target: t
|
|
@@ -447,12 +444,12 @@ var we = (e, t, n) => {
|
|
|
447
444
|
getEvokableFeature: f
|
|
448
445
|
};
|
|
449
446
|
});
|
|
450
|
-
function
|
|
451
|
-
return
|
|
447
|
+
function Te(e) {
|
|
448
|
+
return j(we, e);
|
|
452
449
|
}
|
|
453
|
-
var
|
|
450
|
+
var Ee = (e, t, n) => {
|
|
454
451
|
n.register(e, t);
|
|
455
|
-
}, G =
|
|
452
|
+
}, G = T("history");
|
|
456
453
|
function K(e, t) {
|
|
457
454
|
return {
|
|
458
455
|
id: ce(`history-entry-${Date.now()}-${Math.random()}}`),
|
|
@@ -461,7 +458,7 @@ function K(e, t) {
|
|
|
461
458
|
experienceId: e
|
|
462
459
|
};
|
|
463
460
|
}
|
|
464
|
-
var
|
|
461
|
+
var De = A(() => {
|
|
465
462
|
let e = G.store({ entries: [] }), t = G.event(), n = G.event(), r = G.event(), i = G.event();
|
|
466
463
|
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);
|
|
467
464
|
function a(e, t) {
|
|
@@ -471,7 +468,7 @@ var Oe = j(() => {
|
|
|
471
468
|
};
|
|
472
469
|
for (let r = e.length - 1; r >= 0; r--) {
|
|
473
470
|
let i = e[r], a = i?.node;
|
|
474
|
-
if (!(!a || !
|
|
471
|
+
if (!(!a || !_(a)) && !(t && i.experienceId !== t)) if (n.lastStepIndex === -1) n.lastStepIndex = r;
|
|
475
472
|
else {
|
|
476
473
|
n.secondLastStepIndex = r;
|
|
477
474
|
break;
|
|
@@ -493,36 +490,36 @@ var Oe = j(() => {
|
|
|
493
490
|
entriesStore: e.map((e) => e.entries)
|
|
494
491
|
};
|
|
495
492
|
});
|
|
496
|
-
function
|
|
497
|
-
return
|
|
493
|
+
function Oe() {
|
|
494
|
+
return j(De);
|
|
498
495
|
}
|
|
499
496
|
//#endregion
|
|
500
497
|
//#region src/utils/events.ts
|
|
501
|
-
var
|
|
502
|
-
let t =
|
|
503
|
-
return
|
|
498
|
+
var ke = 0, Ae = (e) => {
|
|
499
|
+
let t = O([]);
|
|
500
|
+
return k({
|
|
504
501
|
clock: e,
|
|
505
502
|
source: t,
|
|
506
503
|
fn: (e, t) => [...e, {
|
|
507
|
-
id:
|
|
504
|
+
id: ke++,
|
|
508
505
|
at: /* @__PURE__ */ new Date(),
|
|
509
506
|
payload: t
|
|
510
507
|
}],
|
|
511
508
|
target: t
|
|
512
509
|
}), t;
|
|
513
|
-
},
|
|
514
|
-
let e =
|
|
510
|
+
}, je = T("field"), Me = A(() => {
|
|
511
|
+
let e = je.store({}), t = w(e, {
|
|
515
512
|
register(e, t) {
|
|
516
513
|
return {
|
|
517
514
|
...e,
|
|
518
515
|
[t.field.id]: t.field
|
|
519
516
|
};
|
|
520
517
|
},
|
|
521
|
-
|
|
522
|
-
let n = e
|
|
518
|
+
updateByKey(e, t) {
|
|
519
|
+
let n = Object.values(e).find((e) => e.key === t.fieldKey);
|
|
523
520
|
return n ? {
|
|
524
521
|
...e,
|
|
525
|
-
[
|
|
522
|
+
[n.id]: Object.assign({}, n, t.updates)
|
|
526
523
|
} : e;
|
|
527
524
|
}
|
|
528
525
|
});
|
|
@@ -530,38 +527,38 @@ var Ae = 0, je = (e) => {
|
|
|
530
527
|
t.register({ field: e });
|
|
531
528
|
}
|
|
532
529
|
function r(n, r) {
|
|
533
|
-
let i = e.getState(), a = Object.values(i).find((e) => e.key === n)?.
|
|
534
|
-
t.
|
|
535
|
-
|
|
530
|
+
let i = e.getState(), a = Object.values(i).find((e) => e.key === n)?.key;
|
|
531
|
+
a && t.updateByKey({
|
|
532
|
+
fieldKey: a,
|
|
536
533
|
updates: r
|
|
537
534
|
});
|
|
538
535
|
}
|
|
539
536
|
let i = e.map((e) => Object.values(e));
|
|
540
537
|
function a(t) {
|
|
541
|
-
return e.map((e) => e
|
|
538
|
+
return e.map((e) => Object.values(e).find((e) => e.key === t) ?? null, { skipVoid: !1 });
|
|
542
539
|
}
|
|
543
540
|
function o(t) {
|
|
544
|
-
return e.map((e) =>
|
|
541
|
+
return e.map((e) => e[t] ?? null, { skipVoid: !1 });
|
|
545
542
|
}
|
|
546
543
|
function s(t) {
|
|
547
|
-
return e.map((e) => Object.values(e).find((e) => e.name === t) ?? null);
|
|
544
|
+
return e.map((e) => Object.values(e).find((e) => e.name === t) ?? null, { skipVoid: !1 });
|
|
548
545
|
}
|
|
549
546
|
return {
|
|
550
547
|
register: n,
|
|
551
548
|
update: r,
|
|
552
|
-
getById:
|
|
553
|
-
getByKey:
|
|
549
|
+
getById: o,
|
|
550
|
+
getByKey: a,
|
|
554
551
|
listStore: i,
|
|
555
552
|
getByName: s
|
|
556
553
|
};
|
|
557
554
|
});
|
|
558
|
-
function
|
|
559
|
-
return
|
|
555
|
+
function Ne() {
|
|
556
|
+
return j(Me);
|
|
560
557
|
}
|
|
561
558
|
//#endregion
|
|
562
559
|
//#region src/entities/step/step.ts
|
|
563
|
-
var
|
|
564
|
-
let e =
|
|
560
|
+
var Pe = T("step"), Fe = A(() => {
|
|
561
|
+
let e = Pe.store({}), t = w(e, { register(e, t) {
|
|
565
562
|
return {
|
|
566
563
|
...e,
|
|
567
564
|
[t.step.id]: t.step
|
|
@@ -572,24 +569,28 @@ var Fe = E("step"), Ie = j(() => {
|
|
|
572
569
|
}
|
|
573
570
|
let r = e.map((e) => Object.values(e));
|
|
574
571
|
function i(t) {
|
|
575
|
-
return e.map((e) => e[t] ?? null);
|
|
572
|
+
return e.map((e) => e[t] ?? null, { skipVoid: !1 });
|
|
573
|
+
}
|
|
574
|
+
function a(t) {
|
|
575
|
+
return e.map((e) => Object.values(e).find((e) => e.key === t) ?? null, { skipVoid: !1 });
|
|
576
576
|
}
|
|
577
577
|
return {
|
|
578
578
|
register: n,
|
|
579
|
+
getByKey: a,
|
|
579
580
|
getById: i,
|
|
580
581
|
listStore: r
|
|
581
582
|
};
|
|
582
583
|
});
|
|
583
|
-
function
|
|
584
|
-
return
|
|
584
|
+
function Ie() {
|
|
585
|
+
return j(Fe);
|
|
585
586
|
}
|
|
586
|
-
function
|
|
587
|
+
function Le(e, t) {
|
|
587
588
|
t.register(e);
|
|
588
589
|
}
|
|
589
590
|
//#endregion
|
|
590
591
|
//#region src/entities/action/action.ts
|
|
591
|
-
var
|
|
592
|
-
let e =
|
|
592
|
+
var Re = T("action"), ze = A(() => {
|
|
593
|
+
let e = Re.store({}), t = w(e, { register(e, t) {
|
|
593
594
|
return {
|
|
594
595
|
...e,
|
|
595
596
|
[t.name]: {
|
|
@@ -621,10 +622,10 @@ var ze = E("action"), Be = j(() => {
|
|
|
621
622
|
getEvokableAction: a
|
|
622
623
|
};
|
|
623
624
|
});
|
|
624
|
-
function
|
|
625
|
-
return
|
|
625
|
+
function Be() {
|
|
626
|
+
return j(ze);
|
|
626
627
|
}
|
|
627
|
-
var
|
|
628
|
+
var Ve = (e, t, n) => {
|
|
628
629
|
n.register(e, t);
|
|
629
630
|
};
|
|
630
631
|
//#endregion
|
|
@@ -632,7 +633,6 @@ var He = (e, t, n) => {
|
|
|
632
633
|
function q(e, t, n, r) {
|
|
633
634
|
return {
|
|
634
635
|
fieldKey: e.key,
|
|
635
|
-
fieldId: e.id,
|
|
636
636
|
userMessage: n,
|
|
637
637
|
systemMessage: r,
|
|
638
638
|
value: t
|
|
@@ -641,7 +641,7 @@ function q(e, t, n, r) {
|
|
|
641
641
|
function J(e) {
|
|
642
642
|
return e == null || e === "" || Array.isArray(e) && !e.length;
|
|
643
643
|
}
|
|
644
|
-
function
|
|
644
|
+
function He(e) {
|
|
645
645
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
|
|
646
646
|
}
|
|
647
647
|
function Y(e) {
|
|
@@ -651,13 +651,13 @@ function Y(e) {
|
|
|
651
651
|
return !1;
|
|
652
652
|
}
|
|
653
653
|
}
|
|
654
|
-
function
|
|
655
|
-
return t.find((t) => t.
|
|
654
|
+
function Ue(e, t) {
|
|
655
|
+
return t.find((t) => t.key === e) ?? null;
|
|
656
656
|
}
|
|
657
|
-
function
|
|
657
|
+
function We(e, t) {
|
|
658
658
|
return e.multiple && (typeof t == "string" || typeof t == "number" || typeof t == "boolean") ? [t] : t;
|
|
659
659
|
}
|
|
660
|
-
function
|
|
660
|
+
function Ge(e, t) {
|
|
661
661
|
if (e.type !== "object" || J(t)) return null;
|
|
662
662
|
if (e.multiple) {
|
|
663
663
|
if (!Array.isArray(t)) return q(e, t, "This field expects multiple values", "Field expects an array of objects.");
|
|
@@ -669,7 +669,7 @@ function Ke(e, t) {
|
|
|
669
669
|
}
|
|
670
670
|
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.).");
|
|
671
671
|
}
|
|
672
|
-
function
|
|
672
|
+
function Ke(e, t) {
|
|
673
673
|
if (!Array.isArray(e.options) || e.options.length === 0) return null;
|
|
674
674
|
let n = Array.isArray(t) ? t : [t];
|
|
675
675
|
if (e.type === "object") {
|
|
@@ -677,9 +677,9 @@ function qe(e, t) {
|
|
|
677
677
|
return n.every((e) => r.includes(JSON.stringify(e))) ? null : q(e, t, "This field expects a valid option", "Field expects a valid option from the defined choices.");
|
|
678
678
|
}
|
|
679
679
|
let r = e.options.map((e) => e.value);
|
|
680
|
-
return n.every((e) => !
|
|
680
|
+
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(", ")}`);
|
|
681
681
|
}
|
|
682
|
-
async function
|
|
682
|
+
async function qe(e, t, r, i) {
|
|
683
683
|
if (t.validation && !n(t.validation) && !J(r)) {
|
|
684
684
|
let n = i ? {
|
|
685
685
|
$input: r,
|
|
@@ -692,8 +692,8 @@ async function Je(e, t, r, i) {
|
|
|
692
692
|
}
|
|
693
693
|
//#endregion
|
|
694
694
|
//#region src/entities/response/response.ts
|
|
695
|
-
var
|
|
696
|
-
let n =
|
|
695
|
+
var Je = T("response"), Ye = A(({ client: e }) => {
|
|
696
|
+
let n = Je.store({}), r = D(), i = D(), a = w(n, {
|
|
697
697
|
register(e, t) {
|
|
698
698
|
return {
|
|
699
699
|
...e,
|
|
@@ -722,7 +722,7 @@ var Ye = E("response"), Xe = j(({ client: e }) => {
|
|
|
722
722
|
});
|
|
723
723
|
} else a.registerBatch(e);
|
|
724
724
|
}
|
|
725
|
-
let s = (n, r) => t(e, n, r), c =
|
|
725
|
+
let s = (n, r) => t(e, n, r), c = S({
|
|
726
726
|
source: {
|
|
727
727
|
allFields: e.fields.listStore,
|
|
728
728
|
existingResponses: n
|
|
@@ -732,7 +732,7 @@ var Ye = E("response"), Xe = j(({ client: e }) => {
|
|
|
732
732
|
...t,
|
|
733
733
|
...n
|
|
734
734
|
}, o = Object.entries(n), c = await Promise.allSettled(o.map(async ([t, n]) => {
|
|
735
|
-
let o =
|
|
735
|
+
let o = Ue(t, e);
|
|
736
736
|
if (!o) {
|
|
737
737
|
r.push({
|
|
738
738
|
fieldKey: t,
|
|
@@ -742,17 +742,17 @@ var Ye = E("response"), Xe = j(({ client: e }) => {
|
|
|
742
742
|
});
|
|
743
743
|
return;
|
|
744
744
|
}
|
|
745
|
-
let c =
|
|
745
|
+
let c = We(o, n), l = await qe(s, o, c, a);
|
|
746
746
|
if (l) {
|
|
747
747
|
r.push(l);
|
|
748
748
|
return;
|
|
749
749
|
}
|
|
750
|
-
let u =
|
|
750
|
+
let u = Ge(o, c);
|
|
751
751
|
if (u) {
|
|
752
752
|
r.push(u);
|
|
753
753
|
return;
|
|
754
754
|
}
|
|
755
|
-
let d =
|
|
755
|
+
let d = Ke(o, c);
|
|
756
756
|
if (d) {
|
|
757
757
|
r.push(d);
|
|
758
758
|
return;
|
|
@@ -780,7 +780,7 @@ var Ye = E("response"), Xe = j(({ client: e }) => {
|
|
|
780
780
|
async function l(e) {
|
|
781
781
|
return c(e);
|
|
782
782
|
}
|
|
783
|
-
let u =
|
|
783
|
+
let u = S({
|
|
784
784
|
source: n,
|
|
785
785
|
effect: async (e, t) => {
|
|
786
786
|
let { responsesToCommit: n, validationErrors: r } = await c(t);
|
|
@@ -790,17 +790,13 @@ var Ye = E("response"), Xe = j(({ client: e }) => {
|
|
|
790
790
|
async function d(e) {
|
|
791
791
|
return u(e);
|
|
792
792
|
}
|
|
793
|
-
let f = n.map((e) => e), p =
|
|
794
|
-
responses: n,
|
|
795
|
-
fields: e.fields.listStore
|
|
796
|
-
}, ({ responses: e, fields: t }) => Object.entries(e).map(([e, n]) => ({
|
|
797
|
-
fieldId: t.find((t) => t.key === e)?.id ?? e,
|
|
793
|
+
let f = n.map((e) => e), p = n.map((e) => Object.entries(e).map(([e, t]) => ({
|
|
798
794
|
fieldKey: e,
|
|
799
|
-
value:
|
|
795
|
+
value: t
|
|
800
796
|
})));
|
|
801
797
|
function m(t) {
|
|
802
|
-
return
|
|
803
|
-
f: e.fields.
|
|
798
|
+
return C({
|
|
799
|
+
f: e.fields.getById(t),
|
|
804
800
|
s: n
|
|
805
801
|
}, ({ f: e, s: t }) => {
|
|
806
802
|
let n = e ? t[e.key] ?? null : null;
|
|
@@ -808,7 +804,7 @@ var Ye = E("response"), Xe = j(({ client: e }) => {
|
|
|
808
804
|
});
|
|
809
805
|
}
|
|
810
806
|
function h(t) {
|
|
811
|
-
return
|
|
807
|
+
return C({
|
|
812
808
|
f: e.fields.getByKey(t),
|
|
813
809
|
s: n
|
|
814
810
|
}, ({ f: e, s: t }) => {
|
|
@@ -817,7 +813,7 @@ var Ye = E("response"), Xe = j(({ client: e }) => {
|
|
|
817
813
|
});
|
|
818
814
|
}
|
|
819
815
|
function g(t) {
|
|
820
|
-
return
|
|
816
|
+
return C({
|
|
821
817
|
f: e.fields.getByName(t),
|
|
822
818
|
s: n
|
|
823
819
|
}, ({ f: e, s: t }) => {
|
|
@@ -825,10 +821,10 @@ var Ye = E("response"), Xe = j(({ client: e }) => {
|
|
|
825
821
|
return n === null ? e?.defaultValue !== void 0 && e.defaultValue !== null ? e.defaultValue : null : n;
|
|
826
822
|
});
|
|
827
823
|
}
|
|
828
|
-
return
|
|
824
|
+
return k({
|
|
829
825
|
clock: r,
|
|
830
826
|
target: a.clearAll
|
|
831
|
-
}),
|
|
827
|
+
}), k({
|
|
832
828
|
clock: i,
|
|
833
829
|
target: a.clear
|
|
834
830
|
}), {
|
|
@@ -844,13 +840,13 @@ var Ye = E("response"), Xe = j(({ client: e }) => {
|
|
|
844
840
|
getByFieldName: g
|
|
845
841
|
};
|
|
846
842
|
});
|
|
847
|
-
function
|
|
848
|
-
return
|
|
843
|
+
function Xe(e) {
|
|
844
|
+
return j(Ye, e);
|
|
849
845
|
}
|
|
850
846
|
//#endregion
|
|
851
847
|
//#region src/entities/condition/condition.ts
|
|
852
|
-
var
|
|
853
|
-
let e =
|
|
848
|
+
var Ze = T("condition"), Qe = A(() => {
|
|
849
|
+
let e = Ze.store({}), t = w(e, { register(e, t) {
|
|
854
850
|
return {
|
|
855
851
|
...e,
|
|
856
852
|
[t.condition.id]: t.condition
|
|
@@ -873,12 +869,12 @@ var Qe = E("condition"), $e = j(() => {
|
|
|
873
869
|
listStore: r
|
|
874
870
|
};
|
|
875
871
|
});
|
|
876
|
-
function
|
|
877
|
-
return
|
|
872
|
+
function $e() {
|
|
873
|
+
return j(Qe);
|
|
878
874
|
}
|
|
879
875
|
//#endregion
|
|
880
876
|
//#region src/utils/api-url.ts
|
|
881
|
-
function
|
|
877
|
+
function et() {
|
|
882
878
|
if (f()) {
|
|
883
879
|
let e = [
|
|
884
880
|
document.currentScript,
|
|
@@ -893,7 +889,7 @@ function tt() {
|
|
|
893
889
|
}
|
|
894
890
|
//#endregion
|
|
895
891
|
//#region src/utils/search-params.ts
|
|
896
|
-
function
|
|
892
|
+
function tt() {
|
|
897
893
|
if (!o()) return {};
|
|
898
894
|
let e = new URLSearchParams(window.location.search), t = {}, n = /* @__PURE__ */ new Set();
|
|
899
895
|
for (let [t] of e.entries()) t.startsWith("picked-") && n.add(t);
|
|
@@ -901,28 +897,28 @@ function nt() {
|
|
|
901
897
|
let n = r.replace("picked-", "");
|
|
902
898
|
t[n] = e.getAll(r);
|
|
903
899
|
}
|
|
904
|
-
let r =
|
|
905
|
-
if (n.size > 0)
|
|
900
|
+
let r = x("s");
|
|
901
|
+
if (n.size > 0) b.set(r, t);
|
|
906
902
|
else {
|
|
907
|
-
let e =
|
|
903
|
+
let e = b.get(r);
|
|
908
904
|
if (e) return e.json() || {};
|
|
909
905
|
}
|
|
910
906
|
return t;
|
|
911
907
|
}
|
|
912
908
|
//#endregion
|
|
913
909
|
//#region src/utils/user-session.ts
|
|
914
|
-
function
|
|
910
|
+
function nt() {
|
|
915
911
|
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)}`;
|
|
916
912
|
}
|
|
917
|
-
var
|
|
918
|
-
let e =
|
|
913
|
+
var rt = x("session", "global"), it = () => {
|
|
914
|
+
let e = y.get(rt), t;
|
|
919
915
|
e.isSet() && (t = e.json());
|
|
920
916
|
let n = (t) => e.set({
|
|
921
917
|
id: t.id,
|
|
922
918
|
isUser: t.isUser,
|
|
923
919
|
identifiers: t.identifiers
|
|
924
920
|
}), r = {
|
|
925
|
-
id: t?.id ??
|
|
921
|
+
id: t?.id ?? nt(),
|
|
926
922
|
isUser: t?.isUser ?? void 0,
|
|
927
923
|
identifiers: t?.identifiers ?? void 0,
|
|
928
924
|
setIsUser(e) {
|
|
@@ -939,13 +935,13 @@ var it = S("session", "global"), X = () => {
|
|
|
939
935
|
}
|
|
940
936
|
};
|
|
941
937
|
return n(r), r;
|
|
942
|
-
},
|
|
938
|
+
}, X = () => u() ? it() : null;
|
|
943
939
|
//#endregion
|
|
944
940
|
//#region src/utils/picked-config.ts
|
|
945
941
|
function Z() {
|
|
946
942
|
if (o()) return globalThis.window.pickedConfig;
|
|
947
943
|
}
|
|
948
|
-
function
|
|
944
|
+
function at() {
|
|
949
945
|
if (!o()) return;
|
|
950
946
|
let e = Z(), t = e?.organizationId, n = e?.projectId;
|
|
951
947
|
return t && n ? {
|
|
@@ -953,7 +949,7 @@ function ot() {
|
|
|
953
949
|
projectId: n
|
|
954
950
|
} : void 0;
|
|
955
951
|
}
|
|
956
|
-
function
|
|
952
|
+
function ot() {
|
|
957
953
|
if (!f()) return;
|
|
958
954
|
let e = document.getElementById("picked_script") || document.querySelector("script#picked") || document.getElementById("cvly");
|
|
959
955
|
if (!e) return;
|
|
@@ -963,15 +959,15 @@ function st() {
|
|
|
963
959
|
projectId: n
|
|
964
960
|
} : void 0;
|
|
965
961
|
}
|
|
966
|
-
function
|
|
962
|
+
function st(e) {
|
|
967
963
|
let { organizationId: t, projectId: n } = e;
|
|
968
964
|
if (t && n) return {
|
|
969
965
|
organizationId: t,
|
|
970
966
|
projectId: n
|
|
971
967
|
};
|
|
972
|
-
let r =
|
|
968
|
+
let r = at();
|
|
973
969
|
if (r) return r;
|
|
974
|
-
let i =
|
|
970
|
+
let i = ot();
|
|
975
971
|
if (i) return i;
|
|
976
972
|
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.");
|
|
977
973
|
}
|
|
@@ -980,7 +976,7 @@ function ct(e) {
|
|
|
980
976
|
function Q(e) {
|
|
981
977
|
return e == null || e === "" || Number.isNaN(e);
|
|
982
978
|
}
|
|
983
|
-
var
|
|
979
|
+
var ct = {
|
|
984
980
|
default: (e, t) => Q(e) ? String(t ?? "") : String(e),
|
|
985
981
|
append: (e, t) => t && !Q(e) ? `${e} ${t}` : e,
|
|
986
982
|
prepend: (e, t) => t && !Q(e) ? `${t} ${e}` : e,
|
|
@@ -1001,24 +997,24 @@ var lt = {
|
|
|
1001
997
|
return e instanceof Set ? t.format(Array.from(e).map(String)) : e;
|
|
1002
998
|
}
|
|
1003
999
|
};
|
|
1004
|
-
function
|
|
1000
|
+
function lt(e) {
|
|
1005
1001
|
return typeof e == "object" && !!e;
|
|
1006
1002
|
}
|
|
1007
|
-
function
|
|
1003
|
+
function ut(e, t) {
|
|
1008
1004
|
let n = t;
|
|
1009
|
-
for (let t of e.split(".")) if (
|
|
1005
|
+
for (let t of e.split(".")) if (lt(n) && t in n) n = n[t];
|
|
1010
1006
|
else return;
|
|
1011
1007
|
return typeof n == "function" ? n() : n;
|
|
1012
1008
|
}
|
|
1013
|
-
function
|
|
1014
|
-
let n = e.split("|").map((e) => e.trim()), r =
|
|
1009
|
+
function dt(e, t) {
|
|
1010
|
+
let n = e.split("|").map((e) => e.trim()), r = ut(n.shift() ?? "", t);
|
|
1015
1011
|
for (let e of n) {
|
|
1016
|
-
let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o =
|
|
1012
|
+
let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o = ct[i];
|
|
1017
1013
|
o && (r = o(r, a));
|
|
1018
1014
|
}
|
|
1019
1015
|
return Q(r) ? "" : typeof r == "object" ? JSON.stringify(r) : String(r);
|
|
1020
1016
|
}
|
|
1021
|
-
function
|
|
1017
|
+
function ft(e, t) {
|
|
1022
1018
|
let n = "", r = 0;
|
|
1023
1019
|
for (; r < e.length;) if (e[r] === "{" && e[r + 1] === "{") {
|
|
1024
1020
|
r += 2;
|
|
@@ -1030,7 +1026,7 @@ function pt(e, t) {
|
|
|
1030
1026
|
}
|
|
1031
1027
|
i += e[r++];
|
|
1032
1028
|
}
|
|
1033
|
-
n +=
|
|
1029
|
+
n += dt(i.trim(), t);
|
|
1034
1030
|
} else n += e[r++];
|
|
1035
1031
|
return n;
|
|
1036
1032
|
}
|
|
@@ -1042,7 +1038,7 @@ var $ = class {
|
|
|
1042
1038
|
isReady = !1;
|
|
1043
1039
|
plugins = {};
|
|
1044
1040
|
pluginStartHooks = [];
|
|
1045
|
-
eventBus =
|
|
1041
|
+
eventBus = D();
|
|
1046
1042
|
events;
|
|
1047
1043
|
organizationId;
|
|
1048
1044
|
projectId;
|
|
@@ -1053,29 +1049,29 @@ var $ = class {
|
|
|
1053
1049
|
precondition;
|
|
1054
1050
|
condition;
|
|
1055
1051
|
preconditionPassed;
|
|
1056
|
-
searchParams =
|
|
1057
|
-
history =
|
|
1058
|
-
components =
|
|
1059
|
-
experienceInstances =
|
|
1052
|
+
searchParams = tt();
|
|
1053
|
+
history = Oe();
|
|
1054
|
+
components = V({ client: this });
|
|
1055
|
+
experienceInstances = ne({ client: this });
|
|
1060
1056
|
experiences = fe({ client: this });
|
|
1061
|
-
frameworks =
|
|
1062
|
-
predicates =
|
|
1063
|
-
features =
|
|
1064
|
-
conditions =
|
|
1065
|
-
fields =
|
|
1066
|
-
responses =
|
|
1067
|
-
steps =
|
|
1068
|
-
actions =
|
|
1057
|
+
frameworks = he({ client: this });
|
|
1058
|
+
predicates = Se({ client: this });
|
|
1059
|
+
features = Te({ client: this });
|
|
1060
|
+
conditions = $e();
|
|
1061
|
+
fields = Ne();
|
|
1062
|
+
responses = Xe({ client: this });
|
|
1063
|
+
steps = Ie();
|
|
1064
|
+
actions = Be();
|
|
1069
1065
|
constructor(e) {
|
|
1070
|
-
this.events =
|
|
1071
|
-
let { organizationId: t, projectId: n } =
|
|
1072
|
-
this.organizationId = t, this.projectId = n, this.options = Object.freeze(e), this.apiUrl = e.apiUrl ||
|
|
1066
|
+
this.events = Ae(this.eventBus);
|
|
1067
|
+
let { organizationId: t, projectId: n } = st(e);
|
|
1068
|
+
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({
|
|
1073
1069
|
type: "load",
|
|
1074
1070
|
version: se()
|
|
1075
1071
|
});
|
|
1076
1072
|
}
|
|
1077
1073
|
start = () => {
|
|
1078
|
-
|
|
1074
|
+
ye(this), (async () => {
|
|
1079
1075
|
if (!f()) return;
|
|
1080
1076
|
await this.runPluginStartHooks();
|
|
1081
1077
|
let e = await this.evaluateGate(this.precondition);
|
|
@@ -1090,7 +1086,7 @@ var $ = class {
|
|
|
1090
1086
|
value: e
|
|
1091
1087
|
});
|
|
1092
1088
|
}
|
|
1093
|
-
if (this.eventBus({ type: "initialize" }), n &&
|
|
1089
|
+
if (this.eventBus({ type: "initialize" }), n && P(this), await re(), n && P(this), this.eventBus({ type: "ready" }), this.isReady = !0, this.session) {
|
|
1094
1090
|
let { id: e, isUser: t, identifiers: n } = this.session;
|
|
1095
1091
|
this.eventBus({
|
|
1096
1092
|
type: "session",
|
|
@@ -1102,21 +1098,21 @@ var $ = class {
|
|
|
1102
1098
|
})();
|
|
1103
1099
|
};
|
|
1104
1100
|
registerFramework = (e) => {
|
|
1105
|
-
|
|
1101
|
+
ge(e, this.frameworks);
|
|
1106
1102
|
};
|
|
1107
1103
|
registerComponent = (e, t) => {
|
|
1108
1104
|
H(e, t, this.components);
|
|
1109
1105
|
};
|
|
1110
1106
|
registerPlugin = (e) => {
|
|
1111
|
-
|
|
1107
|
+
I(this, e, this.plugins);
|
|
1112
1108
|
let t = this.plugins[e.name];
|
|
1113
1109
|
t?.onStart && this.pluginStartHooks.push(t.onStart);
|
|
1114
1110
|
};
|
|
1115
1111
|
registerFeature = (e, t) => {
|
|
1116
|
-
|
|
1112
|
+
Ee(e, t, this.features);
|
|
1117
1113
|
};
|
|
1118
1114
|
registerPredicate = (e, t) => {
|
|
1119
|
-
|
|
1115
|
+
Ce(e, t, this.predicates);
|
|
1120
1116
|
};
|
|
1121
1117
|
registerCondition = (e) => {
|
|
1122
1118
|
this.conditions.register(e);
|
|
@@ -1125,10 +1121,10 @@ var $ = class {
|
|
|
1125
1121
|
this.fields.register(e);
|
|
1126
1122
|
};
|
|
1127
1123
|
registerStep = (e) => {
|
|
1128
|
-
|
|
1124
|
+
Le(e, this.steps);
|
|
1129
1125
|
};
|
|
1130
1126
|
registerAction = (e, t) => {
|
|
1131
|
-
|
|
1127
|
+
Ve(e, t, this.actions);
|
|
1132
1128
|
};
|
|
1133
1129
|
registerExperience = (e) => {
|
|
1134
1130
|
e.component && H(`experience:${e.id}`, e.component, this.components), this.experiences.register(e);
|
|
@@ -1212,8 +1208,8 @@ var $ = class {
|
|
|
1212
1208
|
}
|
|
1213
1209
|
getPluginConfig = (e) => this.plugins[e] ?? {};
|
|
1214
1210
|
renderString = (e, t) => {
|
|
1215
|
-
let n = this.responses.listStore.getState().reduce((e, t) => (e[t.
|
|
1216
|
-
return
|
|
1211
|
+
let n = this.responses.listStore.getState().reduce((e, t) => (e[t.fieldKey] = t.value, e), {});
|
|
1212
|
+
return ft(e, {
|
|
1217
1213
|
...t,
|
|
1218
1214
|
responses: n
|
|
1219
1215
|
});
|
|
@@ -1221,20 +1217,20 @@ var $ = class {
|
|
|
1221
1217
|
};
|
|
1222
1218
|
//#endregion
|
|
1223
1219
|
//#region src/entities/component/lazyComponent.ts
|
|
1224
|
-
function
|
|
1220
|
+
function pt(e) {
|
|
1225
1221
|
return {
|
|
1226
1222
|
$$type: "lazy-component",
|
|
1227
1223
|
load: e
|
|
1228
1224
|
};
|
|
1229
1225
|
}
|
|
1230
|
-
function
|
|
1226
|
+
function mt(e) {
|
|
1231
1227
|
return typeof e == "object" && !!e && "$$type" in e && e.$$type === "lazy-component";
|
|
1232
1228
|
}
|
|
1233
1229
|
//#endregion
|
|
1234
1230
|
//#region src/exports.ts
|
|
1235
|
-
var
|
|
1231
|
+
var ht = (e) => {
|
|
1236
1232
|
let t = new $(e);
|
|
1237
1233
|
return d(t), t;
|
|
1238
1234
|
};
|
|
1239
1235
|
//#endregion
|
|
1240
|
-
export { $ as Picked,
|
|
1236
|
+
export { $ as Picked, ht as createClient, x as createStorageKey, t as evaluateRuleLogic, Z as getPickedConfig, mt as isLazyLoader, ee as isPickedRoot, pt as lazyComponent, y as localStore, b as sessionStore, ae 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 };
|