@picked/client 0.0.1-dev.1774928205822 → 0.0.1-dev.1774950356669
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-BU10Fnoi.js → api-BHJlUOFk.js} +1 -1
- package/dist/{api-CnVCFux0.cjs → api-QaRyNOq-.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 +189 -203
- package/dist/esm/plugins/create-experience/index.js +1 -1
- package/dist/esm/plugins/dynamic-experiences/index.js +1 -1
- 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-CwwrKUI8.js → experience-instance-Bl0OlS-y.js} +37 -43
- package/dist/experience-instance-eacAapPl.cjs +1 -0
- package/dist/types/entities/condition/condition.d.ts +1 -2
- package/dist/types/entities/condition/condition.d.ts.map +1 -1
- 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 +3 -3
- 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 +7 -8
- 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/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-Bl0OlS-y.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-BHJlUOFk.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,35 @@ 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) => Object.values(e).find((e) => e.
|
|
545
|
-
}
|
|
546
|
-
function s(t) {
|
|
547
|
-
return e.map((e) => Object.values(e).find((e) => e.name === t) ?? null);
|
|
541
|
+
return e.map((e) => Object.values(e).find((e) => e.name === t) ?? null, { skipVoid: !1 });
|
|
548
542
|
}
|
|
549
543
|
return {
|
|
550
544
|
register: n,
|
|
551
545
|
update: r,
|
|
552
546
|
getById: a,
|
|
553
|
-
|
|
547
|
+
get: a,
|
|
554
548
|
listStore: i,
|
|
555
|
-
getByName:
|
|
549
|
+
getByName: o
|
|
556
550
|
};
|
|
557
551
|
});
|
|
558
|
-
function
|
|
559
|
-
return
|
|
552
|
+
function Ne() {
|
|
553
|
+
return j(Me);
|
|
560
554
|
}
|
|
561
555
|
//#endregion
|
|
562
556
|
//#region src/entities/step/step.ts
|
|
563
|
-
var
|
|
564
|
-
let e =
|
|
557
|
+
var Pe = T("step"), Fe = A(() => {
|
|
558
|
+
let e = Pe.store({}), t = w(e, { register(e, t) {
|
|
565
559
|
return {
|
|
566
560
|
...e,
|
|
567
561
|
[t.step.id]: t.step
|
|
@@ -572,24 +566,25 @@ var Fe = E("step"), Ie = j(() => {
|
|
|
572
566
|
}
|
|
573
567
|
let r = e.map((e) => Object.values(e));
|
|
574
568
|
function i(t) {
|
|
575
|
-
return e.map((e) => e
|
|
569
|
+
return e.map((e) => Object.values(e).find((e) => e.key === t) ?? null, { skipVoid: !1 });
|
|
576
570
|
}
|
|
577
571
|
return {
|
|
578
572
|
register: n,
|
|
573
|
+
get: i,
|
|
579
574
|
getById: i,
|
|
580
575
|
listStore: r
|
|
581
576
|
};
|
|
582
577
|
});
|
|
583
|
-
function
|
|
584
|
-
return
|
|
578
|
+
function Ie() {
|
|
579
|
+
return j(Fe);
|
|
585
580
|
}
|
|
586
|
-
function
|
|
581
|
+
function Le(e, t) {
|
|
587
582
|
t.register(e);
|
|
588
583
|
}
|
|
589
584
|
//#endregion
|
|
590
585
|
//#region src/entities/action/action.ts
|
|
591
|
-
var
|
|
592
|
-
let e =
|
|
586
|
+
var Re = T("action"), ze = A(() => {
|
|
587
|
+
let e = Re.store({}), t = w(e, { register(e, t) {
|
|
593
588
|
return {
|
|
594
589
|
...e,
|
|
595
590
|
[t.name]: {
|
|
@@ -621,10 +616,10 @@ var ze = E("action"), Be = j(() => {
|
|
|
621
616
|
getEvokableAction: a
|
|
622
617
|
};
|
|
623
618
|
});
|
|
624
|
-
function
|
|
625
|
-
return
|
|
619
|
+
function Be() {
|
|
620
|
+
return j(ze);
|
|
626
621
|
}
|
|
627
|
-
var
|
|
622
|
+
var Ve = (e, t, n) => {
|
|
628
623
|
n.register(e, t);
|
|
629
624
|
};
|
|
630
625
|
//#endregion
|
|
@@ -632,7 +627,6 @@ var He = (e, t, n) => {
|
|
|
632
627
|
function q(e, t, n, r) {
|
|
633
628
|
return {
|
|
634
629
|
fieldKey: e.key,
|
|
635
|
-
fieldId: e.id,
|
|
636
630
|
userMessage: n,
|
|
637
631
|
systemMessage: r,
|
|
638
632
|
value: t
|
|
@@ -641,7 +635,7 @@ function q(e, t, n, r) {
|
|
|
641
635
|
function J(e) {
|
|
642
636
|
return e == null || e === "" || Array.isArray(e) && !e.length;
|
|
643
637
|
}
|
|
644
|
-
function
|
|
638
|
+
function He(e) {
|
|
645
639
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
|
|
646
640
|
}
|
|
647
641
|
function Y(e) {
|
|
@@ -651,13 +645,13 @@ function Y(e) {
|
|
|
651
645
|
return !1;
|
|
652
646
|
}
|
|
653
647
|
}
|
|
654
|
-
function
|
|
655
|
-
return t.find((t) => t.
|
|
648
|
+
function Ue(e, t) {
|
|
649
|
+
return t.find((t) => t.key === e) ?? null;
|
|
656
650
|
}
|
|
657
|
-
function
|
|
651
|
+
function We(e, t) {
|
|
658
652
|
return e.multiple && (typeof t == "string" || typeof t == "number" || typeof t == "boolean") ? [t] : t;
|
|
659
653
|
}
|
|
660
|
-
function
|
|
654
|
+
function Ge(e, t) {
|
|
661
655
|
if (e.type !== "object" || J(t)) return null;
|
|
662
656
|
if (e.multiple) {
|
|
663
657
|
if (!Array.isArray(t)) return q(e, t, "This field expects multiple values", "Field expects an array of objects.");
|
|
@@ -669,7 +663,7 @@ function Ke(e, t) {
|
|
|
669
663
|
}
|
|
670
664
|
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
665
|
}
|
|
672
|
-
function
|
|
666
|
+
function Ke(e, t) {
|
|
673
667
|
if (!Array.isArray(e.options) || e.options.length === 0) return null;
|
|
674
668
|
let n = Array.isArray(t) ? t : [t];
|
|
675
669
|
if (e.type === "object") {
|
|
@@ -677,9 +671,9 @@ function qe(e, t) {
|
|
|
677
671
|
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
672
|
}
|
|
679
673
|
let r = e.options.map((e) => e.value);
|
|
680
|
-
return n.every((e) => !
|
|
674
|
+
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
675
|
}
|
|
682
|
-
async function
|
|
676
|
+
async function qe(e, t, r, i) {
|
|
683
677
|
if (t.validation && !n(t.validation) && !J(r)) {
|
|
684
678
|
let n = i ? {
|
|
685
679
|
$input: r,
|
|
@@ -692,8 +686,8 @@ async function Je(e, t, r, i) {
|
|
|
692
686
|
}
|
|
693
687
|
//#endregion
|
|
694
688
|
//#region src/entities/response/response.ts
|
|
695
|
-
var
|
|
696
|
-
let n =
|
|
689
|
+
var Je = T("response"), Ye = A(({ client: e }) => {
|
|
690
|
+
let n = Je.store({}), r = D(), i = D(), a = w(n, {
|
|
697
691
|
register(e, t) {
|
|
698
692
|
return {
|
|
699
693
|
...e,
|
|
@@ -722,7 +716,7 @@ var Ye = E("response"), Xe = j(({ client: e }) => {
|
|
|
722
716
|
});
|
|
723
717
|
} else a.registerBatch(e);
|
|
724
718
|
}
|
|
725
|
-
let s = (n, r) => t(e, n, r), c =
|
|
719
|
+
let s = (n, r) => t(e, n, r), c = S({
|
|
726
720
|
source: {
|
|
727
721
|
allFields: e.fields.listStore,
|
|
728
722
|
existingResponses: n
|
|
@@ -732,7 +726,7 @@ var Ye = E("response"), Xe = j(({ client: e }) => {
|
|
|
732
726
|
...t,
|
|
733
727
|
...n
|
|
734
728
|
}, o = Object.entries(n), c = await Promise.allSettled(o.map(async ([t, n]) => {
|
|
735
|
-
let o =
|
|
729
|
+
let o = Ue(t, e);
|
|
736
730
|
if (!o) {
|
|
737
731
|
r.push({
|
|
738
732
|
fieldKey: t,
|
|
@@ -742,17 +736,17 @@ var Ye = E("response"), Xe = j(({ client: e }) => {
|
|
|
742
736
|
});
|
|
743
737
|
return;
|
|
744
738
|
}
|
|
745
|
-
let c =
|
|
739
|
+
let c = We(o, n), l = await qe(s, o, c, a);
|
|
746
740
|
if (l) {
|
|
747
741
|
r.push(l);
|
|
748
742
|
return;
|
|
749
743
|
}
|
|
750
|
-
let u =
|
|
744
|
+
let u = Ge(o, c);
|
|
751
745
|
if (u) {
|
|
752
746
|
r.push(u);
|
|
753
747
|
return;
|
|
754
748
|
}
|
|
755
|
-
let d =
|
|
749
|
+
let d = Ke(o, c);
|
|
756
750
|
if (d) {
|
|
757
751
|
r.push(d);
|
|
758
752
|
return;
|
|
@@ -780,7 +774,7 @@ var Ye = E("response"), Xe = j(({ client: e }) => {
|
|
|
780
774
|
async function l(e) {
|
|
781
775
|
return c(e);
|
|
782
776
|
}
|
|
783
|
-
let u =
|
|
777
|
+
let u = S({
|
|
784
778
|
source: n,
|
|
785
779
|
effect: async (e, t) => {
|
|
786
780
|
let { responsesToCommit: n, validationErrors: r } = await c(t);
|
|
@@ -790,17 +784,13 @@ var Ye = E("response"), Xe = j(({ client: e }) => {
|
|
|
790
784
|
async function d(e) {
|
|
791
785
|
return u(e);
|
|
792
786
|
}
|
|
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,
|
|
787
|
+
let f = n.map((e) => e), p = n.map((e) => Object.entries(e).map(([e, t]) => ({
|
|
798
788
|
fieldKey: e,
|
|
799
|
-
value:
|
|
789
|
+
value: t
|
|
800
790
|
})));
|
|
801
791
|
function m(t) {
|
|
802
|
-
return
|
|
803
|
-
f: e.fields.
|
|
792
|
+
return C({
|
|
793
|
+
f: e.fields.getById(t),
|
|
804
794
|
s: n
|
|
805
795
|
}, ({ f: e, s: t }) => {
|
|
806
796
|
let n = e ? t[e.key] ?? null : null;
|
|
@@ -808,7 +798,7 @@ var Ye = E("response"), Xe = j(({ client: e }) => {
|
|
|
808
798
|
});
|
|
809
799
|
}
|
|
810
800
|
function h(t) {
|
|
811
|
-
return
|
|
801
|
+
return C({
|
|
812
802
|
f: e.fields.getByKey(t),
|
|
813
803
|
s: n
|
|
814
804
|
}, ({ f: e, s: t }) => {
|
|
@@ -817,7 +807,7 @@ var Ye = E("response"), Xe = j(({ client: e }) => {
|
|
|
817
807
|
});
|
|
818
808
|
}
|
|
819
809
|
function g(t) {
|
|
820
|
-
return
|
|
810
|
+
return C({
|
|
821
811
|
f: e.fields.getByName(t),
|
|
822
812
|
s: n
|
|
823
813
|
}, ({ f: e, s: t }) => {
|
|
@@ -825,10 +815,10 @@ var Ye = E("response"), Xe = j(({ client: e }) => {
|
|
|
825
815
|
return n === null ? e?.defaultValue !== void 0 && e.defaultValue !== null ? e.defaultValue : null : n;
|
|
826
816
|
});
|
|
827
817
|
}
|
|
828
|
-
return
|
|
818
|
+
return k({
|
|
829
819
|
clock: r,
|
|
830
820
|
target: a.clearAll
|
|
831
|
-
}),
|
|
821
|
+
}), k({
|
|
832
822
|
clock: i,
|
|
833
823
|
target: a.clear
|
|
834
824
|
}), {
|
|
@@ -844,13 +834,13 @@ var Ye = E("response"), Xe = j(({ client: e }) => {
|
|
|
844
834
|
getByFieldName: g
|
|
845
835
|
};
|
|
846
836
|
});
|
|
847
|
-
function
|
|
848
|
-
return
|
|
837
|
+
function Xe(e) {
|
|
838
|
+
return j(Ye, e);
|
|
849
839
|
}
|
|
850
840
|
//#endregion
|
|
851
841
|
//#region src/entities/condition/condition.ts
|
|
852
|
-
var
|
|
853
|
-
let e =
|
|
842
|
+
var Ze = T("condition"), Qe = A(() => {
|
|
843
|
+
let e = Ze.store({}), t = w(e, { register(e, t) {
|
|
854
844
|
return {
|
|
855
845
|
...e,
|
|
856
846
|
[t.condition.id]: t.condition
|
|
@@ -861,24 +851,20 @@ var Qe = E("condition"), $e = j(() => {
|
|
|
861
851
|
}
|
|
862
852
|
let r = e.map((e) => Object.values(e));
|
|
863
853
|
function i(t) {
|
|
864
|
-
return e.map((e) => e[t] ?? null);
|
|
865
|
-
}
|
|
866
|
-
function a(t) {
|
|
867
854
|
return e.map((e) => Object.values(e).find((e) => e.key === t) ?? null);
|
|
868
855
|
}
|
|
869
856
|
return {
|
|
870
857
|
register: n,
|
|
871
|
-
|
|
872
|
-
getByKey: a,
|
|
858
|
+
get: i,
|
|
873
859
|
listStore: r
|
|
874
860
|
};
|
|
875
861
|
});
|
|
876
|
-
function
|
|
877
|
-
return
|
|
862
|
+
function $e() {
|
|
863
|
+
return j(Qe);
|
|
878
864
|
}
|
|
879
865
|
//#endregion
|
|
880
866
|
//#region src/utils/api-url.ts
|
|
881
|
-
function
|
|
867
|
+
function et() {
|
|
882
868
|
if (f()) {
|
|
883
869
|
let e = [
|
|
884
870
|
document.currentScript,
|
|
@@ -893,7 +879,7 @@ function tt() {
|
|
|
893
879
|
}
|
|
894
880
|
//#endregion
|
|
895
881
|
//#region src/utils/search-params.ts
|
|
896
|
-
function
|
|
882
|
+
function tt() {
|
|
897
883
|
if (!o()) return {};
|
|
898
884
|
let e = new URLSearchParams(window.location.search), t = {}, n = /* @__PURE__ */ new Set();
|
|
899
885
|
for (let [t] of e.entries()) t.startsWith("picked-") && n.add(t);
|
|
@@ -901,28 +887,28 @@ function nt() {
|
|
|
901
887
|
let n = r.replace("picked-", "");
|
|
902
888
|
t[n] = e.getAll(r);
|
|
903
889
|
}
|
|
904
|
-
let r =
|
|
905
|
-
if (n.size > 0)
|
|
890
|
+
let r = x("s");
|
|
891
|
+
if (n.size > 0) b.set(r, t);
|
|
906
892
|
else {
|
|
907
|
-
let e =
|
|
893
|
+
let e = b.get(r);
|
|
908
894
|
if (e) return e.json() || {};
|
|
909
895
|
}
|
|
910
896
|
return t;
|
|
911
897
|
}
|
|
912
898
|
//#endregion
|
|
913
899
|
//#region src/utils/user-session.ts
|
|
914
|
-
function
|
|
900
|
+
function nt() {
|
|
915
901
|
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
902
|
}
|
|
917
|
-
var
|
|
918
|
-
let e =
|
|
903
|
+
var rt = x("session", "global"), it = () => {
|
|
904
|
+
let e = y.get(rt), t;
|
|
919
905
|
e.isSet() && (t = e.json());
|
|
920
906
|
let n = (t) => e.set({
|
|
921
907
|
id: t.id,
|
|
922
908
|
isUser: t.isUser,
|
|
923
909
|
identifiers: t.identifiers
|
|
924
910
|
}), r = {
|
|
925
|
-
id: t?.id ??
|
|
911
|
+
id: t?.id ?? nt(),
|
|
926
912
|
isUser: t?.isUser ?? void 0,
|
|
927
913
|
identifiers: t?.identifiers ?? void 0,
|
|
928
914
|
setIsUser(e) {
|
|
@@ -939,13 +925,13 @@ var it = S("session", "global"), X = () => {
|
|
|
939
925
|
}
|
|
940
926
|
};
|
|
941
927
|
return n(r), r;
|
|
942
|
-
},
|
|
928
|
+
}, X = () => u() ? it() : null;
|
|
943
929
|
//#endregion
|
|
944
930
|
//#region src/utils/picked-config.ts
|
|
945
931
|
function Z() {
|
|
946
932
|
if (o()) return globalThis.window.pickedConfig;
|
|
947
933
|
}
|
|
948
|
-
function
|
|
934
|
+
function at() {
|
|
949
935
|
if (!o()) return;
|
|
950
936
|
let e = Z(), t = e?.organizationId, n = e?.projectId;
|
|
951
937
|
return t && n ? {
|
|
@@ -953,7 +939,7 @@ function ot() {
|
|
|
953
939
|
projectId: n
|
|
954
940
|
} : void 0;
|
|
955
941
|
}
|
|
956
|
-
function
|
|
942
|
+
function ot() {
|
|
957
943
|
if (!f()) return;
|
|
958
944
|
let e = document.getElementById("picked_script") || document.querySelector("script#picked") || document.getElementById("cvly");
|
|
959
945
|
if (!e) return;
|
|
@@ -963,15 +949,15 @@ function st() {
|
|
|
963
949
|
projectId: n
|
|
964
950
|
} : void 0;
|
|
965
951
|
}
|
|
966
|
-
function
|
|
952
|
+
function st(e) {
|
|
967
953
|
let { organizationId: t, projectId: n } = e;
|
|
968
954
|
if (t && n) return {
|
|
969
955
|
organizationId: t,
|
|
970
956
|
projectId: n
|
|
971
957
|
};
|
|
972
|
-
let r =
|
|
958
|
+
let r = at();
|
|
973
959
|
if (r) return r;
|
|
974
|
-
let i =
|
|
960
|
+
let i = ot();
|
|
975
961
|
if (i) return i;
|
|
976
962
|
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
963
|
}
|
|
@@ -980,7 +966,7 @@ function ct(e) {
|
|
|
980
966
|
function Q(e) {
|
|
981
967
|
return e == null || e === "" || Number.isNaN(e);
|
|
982
968
|
}
|
|
983
|
-
var
|
|
969
|
+
var ct = {
|
|
984
970
|
default: (e, t) => Q(e) ? String(t ?? "") : String(e),
|
|
985
971
|
append: (e, t) => t && !Q(e) ? `${e} ${t}` : e,
|
|
986
972
|
prepend: (e, t) => t && !Q(e) ? `${t} ${e}` : e,
|
|
@@ -1001,24 +987,24 @@ var lt = {
|
|
|
1001
987
|
return e instanceof Set ? t.format(Array.from(e).map(String)) : e;
|
|
1002
988
|
}
|
|
1003
989
|
};
|
|
1004
|
-
function
|
|
990
|
+
function lt(e) {
|
|
1005
991
|
return typeof e == "object" && !!e;
|
|
1006
992
|
}
|
|
1007
|
-
function
|
|
993
|
+
function ut(e, t) {
|
|
1008
994
|
let n = t;
|
|
1009
|
-
for (let t of e.split(".")) if (
|
|
995
|
+
for (let t of e.split(".")) if (lt(n) && t in n) n = n[t];
|
|
1010
996
|
else return;
|
|
1011
997
|
return typeof n == "function" ? n() : n;
|
|
1012
998
|
}
|
|
1013
|
-
function
|
|
1014
|
-
let n = e.split("|").map((e) => e.trim()), r =
|
|
999
|
+
function dt(e, t) {
|
|
1000
|
+
let n = e.split("|").map((e) => e.trim()), r = ut(n.shift() ?? "", t);
|
|
1015
1001
|
for (let e of n) {
|
|
1016
|
-
let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o =
|
|
1002
|
+
let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o = ct[i];
|
|
1017
1003
|
o && (r = o(r, a));
|
|
1018
1004
|
}
|
|
1019
1005
|
return Q(r) ? "" : typeof r == "object" ? JSON.stringify(r) : String(r);
|
|
1020
1006
|
}
|
|
1021
|
-
function
|
|
1007
|
+
function ft(e, t) {
|
|
1022
1008
|
let n = "", r = 0;
|
|
1023
1009
|
for (; r < e.length;) if (e[r] === "{" && e[r + 1] === "{") {
|
|
1024
1010
|
r += 2;
|
|
@@ -1030,7 +1016,7 @@ function pt(e, t) {
|
|
|
1030
1016
|
}
|
|
1031
1017
|
i += e[r++];
|
|
1032
1018
|
}
|
|
1033
|
-
n +=
|
|
1019
|
+
n += dt(i.trim(), t);
|
|
1034
1020
|
} else n += e[r++];
|
|
1035
1021
|
return n;
|
|
1036
1022
|
}
|
|
@@ -1042,7 +1028,7 @@ var $ = class {
|
|
|
1042
1028
|
isReady = !1;
|
|
1043
1029
|
plugins = {};
|
|
1044
1030
|
pluginStartHooks = [];
|
|
1045
|
-
eventBus =
|
|
1031
|
+
eventBus = D();
|
|
1046
1032
|
events;
|
|
1047
1033
|
organizationId;
|
|
1048
1034
|
projectId;
|
|
@@ -1053,29 +1039,29 @@ var $ = class {
|
|
|
1053
1039
|
precondition;
|
|
1054
1040
|
condition;
|
|
1055
1041
|
preconditionPassed;
|
|
1056
|
-
searchParams =
|
|
1057
|
-
history =
|
|
1058
|
-
components =
|
|
1059
|
-
experienceInstances =
|
|
1042
|
+
searchParams = tt();
|
|
1043
|
+
history = Oe();
|
|
1044
|
+
components = V({ client: this });
|
|
1045
|
+
experienceInstances = ne({ client: this });
|
|
1060
1046
|
experiences = fe({ client: this });
|
|
1061
|
-
frameworks =
|
|
1062
|
-
predicates =
|
|
1063
|
-
features =
|
|
1064
|
-
conditions =
|
|
1065
|
-
fields =
|
|
1066
|
-
responses =
|
|
1067
|
-
steps =
|
|
1068
|
-
actions =
|
|
1047
|
+
frameworks = he({ client: this });
|
|
1048
|
+
predicates = Se({ client: this });
|
|
1049
|
+
features = Te({ client: this });
|
|
1050
|
+
conditions = $e();
|
|
1051
|
+
fields = Ne();
|
|
1052
|
+
responses = Xe({ client: this });
|
|
1053
|
+
steps = Ie();
|
|
1054
|
+
actions = Be();
|
|
1069
1055
|
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 ||
|
|
1056
|
+
this.events = Ae(this.eventBus);
|
|
1057
|
+
let { organizationId: t, projectId: n } = st(e);
|
|
1058
|
+
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
1059
|
type: "load",
|
|
1074
1060
|
version: se()
|
|
1075
1061
|
});
|
|
1076
1062
|
}
|
|
1077
1063
|
start = () => {
|
|
1078
|
-
|
|
1064
|
+
ye(this), (async () => {
|
|
1079
1065
|
if (!f()) return;
|
|
1080
1066
|
await this.runPluginStartHooks();
|
|
1081
1067
|
let e = await this.evaluateGate(this.precondition);
|
|
@@ -1090,7 +1076,7 @@ var $ = class {
|
|
|
1090
1076
|
value: e
|
|
1091
1077
|
});
|
|
1092
1078
|
}
|
|
1093
|
-
if (this.eventBus({ type: "initialize" }), n &&
|
|
1079
|
+
if (this.eventBus({ type: "initialize" }), n && P(this), await re(), n && P(this), this.eventBus({ type: "ready" }), this.isReady = !0, this.session) {
|
|
1094
1080
|
let { id: e, isUser: t, identifiers: n } = this.session;
|
|
1095
1081
|
this.eventBus({
|
|
1096
1082
|
type: "session",
|
|
@@ -1102,21 +1088,21 @@ var $ = class {
|
|
|
1102
1088
|
})();
|
|
1103
1089
|
};
|
|
1104
1090
|
registerFramework = (e) => {
|
|
1105
|
-
|
|
1091
|
+
ge(e, this.frameworks);
|
|
1106
1092
|
};
|
|
1107
1093
|
registerComponent = (e, t) => {
|
|
1108
1094
|
H(e, t, this.components);
|
|
1109
1095
|
};
|
|
1110
1096
|
registerPlugin = (e) => {
|
|
1111
|
-
|
|
1097
|
+
I(this, e, this.plugins);
|
|
1112
1098
|
let t = this.plugins[e.name];
|
|
1113
1099
|
t?.onStart && this.pluginStartHooks.push(t.onStart);
|
|
1114
1100
|
};
|
|
1115
1101
|
registerFeature = (e, t) => {
|
|
1116
|
-
|
|
1102
|
+
Ee(e, t, this.features);
|
|
1117
1103
|
};
|
|
1118
1104
|
registerPredicate = (e, t) => {
|
|
1119
|
-
|
|
1105
|
+
Ce(e, t, this.predicates);
|
|
1120
1106
|
};
|
|
1121
1107
|
registerCondition = (e) => {
|
|
1122
1108
|
this.conditions.register(e);
|
|
@@ -1125,10 +1111,10 @@ var $ = class {
|
|
|
1125
1111
|
this.fields.register(e);
|
|
1126
1112
|
};
|
|
1127
1113
|
registerStep = (e) => {
|
|
1128
|
-
|
|
1114
|
+
Le(e, this.steps);
|
|
1129
1115
|
};
|
|
1130
1116
|
registerAction = (e, t) => {
|
|
1131
|
-
|
|
1117
|
+
Ve(e, t, this.actions);
|
|
1132
1118
|
};
|
|
1133
1119
|
registerExperience = (e) => {
|
|
1134
1120
|
e.component && H(`experience:${e.id}`, e.component, this.components), this.experiences.register(e);
|
|
@@ -1212,8 +1198,8 @@ var $ = class {
|
|
|
1212
1198
|
}
|
|
1213
1199
|
getPluginConfig = (e) => this.plugins[e] ?? {};
|
|
1214
1200
|
renderString = (e, t) => {
|
|
1215
|
-
let n = this.responses.listStore.getState().reduce((e, t) => (e[t.
|
|
1216
|
-
return
|
|
1201
|
+
let n = this.responses.listStore.getState().reduce((e, t) => (e[t.fieldKey] = t.value, e), {});
|
|
1202
|
+
return ft(e, {
|
|
1217
1203
|
...t,
|
|
1218
1204
|
responses: n
|
|
1219
1205
|
});
|
|
@@ -1221,20 +1207,20 @@ var $ = class {
|
|
|
1221
1207
|
};
|
|
1222
1208
|
//#endregion
|
|
1223
1209
|
//#region src/entities/component/lazyComponent.ts
|
|
1224
|
-
function
|
|
1210
|
+
function pt(e) {
|
|
1225
1211
|
return {
|
|
1226
1212
|
$$type: "lazy-component",
|
|
1227
1213
|
load: e
|
|
1228
1214
|
};
|
|
1229
1215
|
}
|
|
1230
|
-
function
|
|
1216
|
+
function mt(e) {
|
|
1231
1217
|
return typeof e == "object" && !!e && "$$type" in e && e.$$type === "lazy-component";
|
|
1232
1218
|
}
|
|
1233
1219
|
//#endregion
|
|
1234
1220
|
//#region src/exports.ts
|
|
1235
|
-
var
|
|
1221
|
+
var ht = (e) => {
|
|
1236
1222
|
let t = new $(e);
|
|
1237
1223
|
return d(t), t;
|
|
1238
1224
|
};
|
|
1239
1225
|
//#endregion
|
|
1240
|
-
export { $ as Picked,
|
|
1226
|
+
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 };
|