@picked/client 0.0.116 → 0.0.117-next.1
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/.tsbuildinfo +1 -1
- package/dist/{api-Ds8Zme14.js → api-BDaS4eyt.js} +1 -1
- package/dist/{api-DXmv8xqS.cjs → api-PsTZoeZa.cjs} +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/esm/index.js +262 -253
- package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
- package/dist/esm/server/index.js +5 -5
- package/dist/{plugin-BG2qQMW8.js → plugin-BMUdg0bj.js} +10 -8
- package/dist/plugin-B_VOdWcg.cjs +1 -0
- package/dist/{preview-unavailable-CMTejkEo.js → preview-unavailable-CSJWqaE9.js} +1 -1
- package/dist/{preview-unavailable-BsIqpkl4.cjs → preview-unavailable-j3PccadR.cjs} +1 -1
- package/dist/{provider-0DGD327y.cjs → provider-BHsPrAq_.cjs} +1 -1
- package/dist/{provider-BjTSZGb5.js → provider-RW9aSckL.js} +1 -1
- package/dist/types/entities/session/session.d.ts +14 -5
- package/dist/types/entities/session/session.d.ts.map +1 -1
- package/dist/types/lifecycle/lifecycle.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/hash.d.ts +4 -4
- package/dist/types/plugins/dynamic-experiences/hash.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts +7 -3
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/plugin-_eUkxCVf.cjs +0 -1
package/dist/esm/index.js
CHANGED
|
@@ -6,14 +6,14 @@ import { a as v, i as y, r as ee, s as b, t as x } from "../dom-v6ulxr_z.js";
|
|
|
6
6
|
import { d as S, l as C, n as w, r as te, u as T } from "../experience-instance-IOIdP1Rd.js";
|
|
7
7
|
import { apply as E } from "./logic-engine.js";
|
|
8
8
|
import { i as ne, n as D, r as re, t as ie } from "../storage-1MW3-_As.js";
|
|
9
|
-
import { a as ae, c as oe, l as se, n as ce, o as le, r as ue, s as de, t as
|
|
10
|
-
import { t as
|
|
11
|
-
import { n as
|
|
12
|
-
import { attach as
|
|
9
|
+
import { a as ae, c as oe, l as se, n as ce, o as le, r as ue, s as de, t as fe } from "../preview-unavailable-CSJWqaE9.js";
|
|
10
|
+
import { t as pe } from "../id-Bo4RBeOs.js";
|
|
11
|
+
import { n as me, r as he, t as ge } from "../inert-script-report-B_bMPRzp.js";
|
|
12
|
+
import { attach as O, clearNode as _e, combine as k, createApi as A, createDomain as j, createEffect as M, createEvent as N, createNode as ve, createStore as P, is as F, sample as I, withRegion as ye } from "effector";
|
|
13
13
|
import { createFactory as L, invoke as R } from "@withease/factories";
|
|
14
14
|
//#region src/entities/experience/experience.ts
|
|
15
|
-
var z =
|
|
16
|
-
let i = z.store(r), a =
|
|
15
|
+
var z = j("experience"), be = L(({ client: e, experience: r }) => {
|
|
16
|
+
let i = z.store(r), a = A(i, { merge(e, t) {
|
|
17
17
|
return {
|
|
18
18
|
...e,
|
|
19
19
|
...t.experience
|
|
@@ -23,7 +23,7 @@ var z = M("experience"), be = L(({ client: e, experience: r }) => {
|
|
|
23
23
|
decisionLogic: e.condition,
|
|
24
24
|
targetSelectors: e.targets,
|
|
25
25
|
initializeOpenLogic: e.initializeOpen
|
|
26
|
-
})), s =
|
|
26
|
+
})), s = k(i, 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 }), c = k(i, e.steps.indexStore, e.conditions.indexStore, (e, t, n) => {
|
|
27
27
|
let r = e.nodes.filter(S).map((e) => t[e.stepId]).filter((e) => e !== void 0), i = e.nodes.filter(T).map((e) => n[e.conditionId]).filter((e) => e !== void 0);
|
|
28
28
|
return {
|
|
29
29
|
steps: r,
|
|
@@ -31,7 +31,7 @@ var z = M("experience"), be = L(({ client: e, experience: r }) => {
|
|
|
31
31
|
edges: e.edges,
|
|
32
32
|
conditions: i
|
|
33
33
|
};
|
|
34
|
-
}), l = i.map((e) => C(e.nodes, e.edges)), u = r.actions ?? [], d, f =
|
|
34
|
+
}), l = i.map((e) => C(e.nodes, e.edges)), u = r.actions ?? [], d, f = O({
|
|
35
35
|
source: o,
|
|
36
36
|
effect: (t, n) => {
|
|
37
37
|
let i = y(t.targetSelectors, r.id);
|
|
@@ -39,18 +39,18 @@ var z = M("experience"), be = L(({ client: e, experience: r }) => {
|
|
|
39
39
|
n ? e.experienceInstances.spawn(d, t, n) : e.experienceInstances.spawn(d, t);
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
}), p =
|
|
42
|
+
}), p = k({
|
|
43
43
|
preconditionPassed: e.preconditionPassedStore,
|
|
44
44
|
isUser: e.session.store.map((e) => e.isUser, { skipVoid: !1 }),
|
|
45
45
|
config: o
|
|
46
|
-
}), m =
|
|
46
|
+
}), m = O({
|
|
47
47
|
source: p,
|
|
48
48
|
effect: async ({ preconditionPassed: i, isUser: a, config: o }) => {
|
|
49
49
|
if (!i || !a) return !1;
|
|
50
50
|
let { decisionLogic: s, targetSelectors: c } = o;
|
|
51
51
|
return c.length === 0 || y(c, r.id).length < 1 ? !1 : s === void 0 || !t(s) || await n(e, s) === !0;
|
|
52
52
|
}
|
|
53
|
-
}), h =
|
|
53
|
+
}), h = M(async () => {
|
|
54
54
|
if (!e.contentLoader) return !0;
|
|
55
55
|
try {
|
|
56
56
|
await e.contentLoader({
|
|
@@ -61,7 +61,7 @@ var z = M("experience"), be = L(({ client: e, experience: r }) => {
|
|
|
61
61
|
`${r.id}`;
|
|
62
62
|
}
|
|
63
63
|
return !0;
|
|
64
|
-
}), g =
|
|
64
|
+
}), g = N(), _ = N(), v = z.createStore(void 0, { skipVoid: !1 }).on(g, (e, t) => t).on(_, (e, t) => t);
|
|
65
65
|
return I({
|
|
66
66
|
clock: g,
|
|
67
67
|
target: m
|
|
@@ -104,12 +104,12 @@ function xe(e) {
|
|
|
104
104
|
return R(be, e);
|
|
105
105
|
}
|
|
106
106
|
var Se = L(({ client: e }) => {
|
|
107
|
-
let t = z.store({}), n =
|
|
107
|
+
let t = z.store({}), n = A(t, { register(e, t) {
|
|
108
108
|
return {
|
|
109
109
|
...e,
|
|
110
110
|
[t.id]: t
|
|
111
111
|
};
|
|
112
|
-
} }), r =
|
|
112
|
+
} }), r = N(), i = M((t) => {
|
|
113
113
|
n.register(xe({
|
|
114
114
|
client: e,
|
|
115
115
|
experience: t
|
|
@@ -142,7 +142,7 @@ var Se = L(({ client: e }) => {
|
|
|
142
142
|
function s(e) {
|
|
143
143
|
return t.map((t) => Object.values(t).find((t) => t.key === e) ?? t[e], { skipVoid: !1 });
|
|
144
144
|
}
|
|
145
|
-
let c =
|
|
145
|
+
let c = O({
|
|
146
146
|
source: t,
|
|
147
147
|
effect: (e, t) => {
|
|
148
148
|
let n = "key" in t ? Object.values(e).find((e) => e.key === t.key) : e[t.id];
|
|
@@ -160,7 +160,7 @@ var Se = L(({ client: e }) => {
|
|
|
160
160
|
getById: o,
|
|
161
161
|
getByKey: s,
|
|
162
162
|
launch: c,
|
|
163
|
-
open:
|
|
163
|
+
open: O({
|
|
164
164
|
source: {
|
|
165
165
|
experiences: t,
|
|
166
166
|
instances: e.experienceInstances.listStore
|
|
@@ -188,7 +188,7 @@ var Se = L(({ client: e }) => {
|
|
|
188
188
|
}
|
|
189
189
|
}),
|
|
190
190
|
listStore: a,
|
|
191
|
-
initialiseExperiencesFx:
|
|
191
|
+
initialiseExperiencesFx: O({
|
|
192
192
|
source: a,
|
|
193
193
|
effect: (e) => {
|
|
194
194
|
for (let t of e) t.initialiseRequested(void 0);
|
|
@@ -205,7 +205,7 @@ var we = async (e) => {
|
|
|
205
205
|
//#endregion
|
|
206
206
|
//#region src/entities/plugin/plugin.ts
|
|
207
207
|
function Te(e) {
|
|
208
|
-
return
|
|
208
|
+
return M(async () => {
|
|
209
209
|
await e();
|
|
210
210
|
});
|
|
211
211
|
}
|
|
@@ -215,7 +215,7 @@ var Ee = (e, t, n) => {
|
|
|
215
215
|
...a,
|
|
216
216
|
...i
|
|
217
217
|
});
|
|
218
|
-
}, De =
|
|
218
|
+
}, De = j("component"), Oe = L(({ client: e, component: t, name: n }) => ({
|
|
219
219
|
name: n,
|
|
220
220
|
component: t,
|
|
221
221
|
frameworkStore: e.frameworks.getByName(t.frameworkName)
|
|
@@ -224,12 +224,12 @@ function ke(e) {
|
|
|
224
224
|
return R(Oe, e);
|
|
225
225
|
}
|
|
226
226
|
var Ae = L(({ client: e }) => {
|
|
227
|
-
let t = De.store({}), n =
|
|
227
|
+
let t = De.store({}), n = A(t, { register(e, t) {
|
|
228
228
|
return {
|
|
229
229
|
...e,
|
|
230
230
|
[t.name]: t
|
|
231
231
|
};
|
|
232
|
-
} }), i =
|
|
232
|
+
} }), i = N();
|
|
233
233
|
I({
|
|
234
234
|
clock: i,
|
|
235
235
|
source: t,
|
|
@@ -262,13 +262,13 @@ var Me = (e, t, n) => {
|
|
|
262
262
|
name: e,
|
|
263
263
|
component: t
|
|
264
264
|
});
|
|
265
|
-
}, Ne =
|
|
266
|
-
let t = Ne.store({}), n =
|
|
265
|
+
}, Ne = j("framework"), Pe = L((e) => {
|
|
266
|
+
let t = Ne.store({}), n = A(t, { register(e, t) {
|
|
267
267
|
return {
|
|
268
268
|
...e,
|
|
269
269
|
[t.name]: t.framework
|
|
270
270
|
};
|
|
271
|
-
} }), i =
|
|
271
|
+
} }), i = N();
|
|
272
272
|
I({
|
|
273
273
|
clock: i,
|
|
274
274
|
source: t,
|
|
@@ -303,7 +303,7 @@ var Ie = (e, t) => {
|
|
|
303
303
|
sessionStorage: t ? globalThis.sessionStorage : void 0,
|
|
304
304
|
localStorage: t ? globalThis.localStorage : void 0
|
|
305
305
|
};
|
|
306
|
-
return
|
|
306
|
+
return k(e.responses.listStore, e.fields.listStore, (t, r) => Object.freeze({
|
|
307
307
|
client: e,
|
|
308
308
|
responses: t,
|
|
309
309
|
fields: r,
|
|
@@ -325,16 +325,16 @@ function ze(e, t, n) {
|
|
|
325
325
|
}) === !0;
|
|
326
326
|
} });
|
|
327
327
|
}
|
|
328
|
-
function
|
|
328
|
+
function Be(e, t = [], n = /* @__PURE__ */ new WeakSet()) {
|
|
329
329
|
if (e == null || typeof e == "string" || typeof e == "number" || typeof e == "boolean") return !0;
|
|
330
330
|
if (typeof e != "object" || t.includes(e)) return !1;
|
|
331
331
|
if (n.has(e)) return !0;
|
|
332
332
|
let r = Object.getPrototypeOf(e);
|
|
333
333
|
if (!Array.isArray(e) && r !== Object.prototype && r !== null) return !1;
|
|
334
334
|
let i = [...t, e];
|
|
335
|
-
return Object.values(e).every((e) =>
|
|
335
|
+
return Object.values(e).every((e) => Be(e, i, n)) ? (n.add(e), !0) : !1;
|
|
336
336
|
}
|
|
337
|
-
var
|
|
337
|
+
var Ve = L(({ client: e }) => O({
|
|
338
338
|
source: {
|
|
339
339
|
stateSnapshot: e.stateSnapshotStore,
|
|
340
340
|
predicates: e.predicates.listStore,
|
|
@@ -352,7 +352,7 @@ var Be = L(({ client: e }) => k({
|
|
|
352
352
|
...e,
|
|
353
353
|
args: t
|
|
354
354
|
}, null);
|
|
355
|
-
return
|
|
355
|
+
return Be(r) ? r : void 0;
|
|
356
356
|
}, t), {}), u = r.reduce((e, t) => (e[t.id] = async () => {
|
|
357
357
|
let { bucket: e } = await t.getBucket();
|
|
358
358
|
return e;
|
|
@@ -380,39 +380,39 @@ var Be = L(({ client: e }) => k({
|
|
|
380
380
|
return await E(o, f);
|
|
381
381
|
}
|
|
382
382
|
}));
|
|
383
|
-
function
|
|
384
|
-
return R(
|
|
383
|
+
function He(e) {
|
|
384
|
+
return R(Ve, e);
|
|
385
385
|
}
|
|
386
386
|
//#endregion
|
|
387
387
|
//#region src/lifecycle/lifecycle.ts
|
|
388
|
-
var
|
|
389
|
-
let t =
|
|
388
|
+
var B = j("lifecycle"), Ue = L(({ client: e }) => {
|
|
389
|
+
let t = B.store(!1), r = P(void 0, {
|
|
390
390
|
skipVoid: !1,
|
|
391
|
-
domain:
|
|
392
|
-
}), i =
|
|
391
|
+
domain: B
|
|
392
|
+
}), i = P(void 0, {
|
|
393
393
|
skipVoid: !1,
|
|
394
|
-
domain:
|
|
395
|
-
}), a =
|
|
394
|
+
domain: B
|
|
395
|
+
}), a = B.store("idle"), o = B.store([]), s = P(void 0, {
|
|
396
396
|
skipVoid: !1,
|
|
397
|
-
domain:
|
|
398
|
-
}), l =
|
|
397
|
+
domain: B
|
|
398
|
+
}), l = P(void 0, {
|
|
399
399
|
skipVoid: !1,
|
|
400
|
-
domain:
|
|
401
|
-
}), u =
|
|
400
|
+
domain: B
|
|
401
|
+
}), u = N(), d = N(), f = N(), p = N(), m = N(), h = N();
|
|
402
402
|
o.on(p, (e, t) => [...e, t]), s.on(m, (e, t) => t), l.on(h, (e, t) => t), t.on(d, () => !0);
|
|
403
|
-
let g =
|
|
403
|
+
let g = M(async () => {
|
|
404
404
|
await ee();
|
|
405
|
-
}), _ =
|
|
405
|
+
}), _ = M(async () => {
|
|
406
406
|
await we(e);
|
|
407
|
-
}), v =
|
|
407
|
+
}), v = O({ effect: _ }), y = O({
|
|
408
408
|
source: o,
|
|
409
409
|
effect: async (e) => {
|
|
410
410
|
for (let t of e) await t();
|
|
411
411
|
}
|
|
412
|
-
}), b =
|
|
412
|
+
}), b = O({
|
|
413
413
|
source: s,
|
|
414
414
|
effect: async (t) => t === void 0 ? !0 : typeof t == "boolean" ? t : await n(e, t) === !0
|
|
415
|
-
}), x =
|
|
415
|
+
}), x = O({
|
|
416
416
|
source: l,
|
|
417
417
|
effect: async (t) => t === void 0 ? !0 : typeof t == "boolean" ? t : await n(e, t) === !0
|
|
418
418
|
}), S = I({
|
|
@@ -468,7 +468,7 @@ var V = M("lifecycle"), He = L(({ client: e }) => {
|
|
|
468
468
|
fn: () => ({ type: "initialize" }),
|
|
469
469
|
target: e.eventBus
|
|
470
470
|
});
|
|
471
|
-
let C =
|
|
471
|
+
let C = P(!1).on(g.done, () => !0), w = P(!1).on(f, () => !0), te = P(!1).on(v.done, () => !0), T = k(r, i, (e, t) => e === !0 && t === !0);
|
|
472
472
|
I({
|
|
473
473
|
clock: f,
|
|
474
474
|
source: T,
|
|
@@ -476,14 +476,14 @@ var V = M("lifecycle"), He = L(({ client: e }) => {
|
|
|
476
476
|
fn: () => void 0,
|
|
477
477
|
target: _
|
|
478
478
|
});
|
|
479
|
-
let E =
|
|
479
|
+
let E = k(C, w, T, (e, t, n) => e && t && n);
|
|
480
480
|
I({
|
|
481
481
|
clock: E,
|
|
482
482
|
filter: (e) => e,
|
|
483
483
|
fn: () => void 0,
|
|
484
484
|
target: v
|
|
485
485
|
});
|
|
486
|
-
let ne =
|
|
486
|
+
let ne = k(C, w, T, te, (e, t, n, r) => e && t && (!n || r));
|
|
487
487
|
return I({
|
|
488
488
|
clock: ne,
|
|
489
489
|
filter: (e) => e,
|
|
@@ -500,11 +500,12 @@ var V = M("lifecycle"), He = L(({ client: e }) => {
|
|
|
500
500
|
}), I({
|
|
501
501
|
clock: d,
|
|
502
502
|
source: e.session.store,
|
|
503
|
-
fn: (
|
|
503
|
+
fn: (e) => ({
|
|
504
504
|
type: "session",
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
505
|
+
pickedId: e.pickedId,
|
|
506
|
+
id: e.id,
|
|
507
|
+
isUser: e.isUser,
|
|
508
|
+
identifiers: e.identifiers
|
|
508
509
|
}),
|
|
509
510
|
target: e.eventBus
|
|
510
511
|
}), I({
|
|
@@ -529,13 +530,13 @@ var V = M("lifecycle"), He = L(({ client: e }) => {
|
|
|
529
530
|
setCondition: h
|
|
530
531
|
};
|
|
531
532
|
});
|
|
532
|
-
function
|
|
533
|
-
return R(
|
|
533
|
+
function We(e) {
|
|
534
|
+
return R(Ue, e);
|
|
534
535
|
}
|
|
535
536
|
//#endregion
|
|
536
537
|
//#region src/entities/predicate/predicate.ts
|
|
537
|
-
var
|
|
538
|
-
let t =
|
|
538
|
+
var Ge = j("predicate"), Ke = L(({ client: e }) => {
|
|
539
|
+
let t = Ge.store({}), n = A(t, { register(e, t) {
|
|
539
540
|
return {
|
|
540
541
|
...e,
|
|
541
542
|
[t.name]: {
|
|
@@ -543,7 +544,7 @@ var We = M("predicate"), Ge = L(({ client: e }) => {
|
|
|
543
544
|
predicate: t.predicate
|
|
544
545
|
}
|
|
545
546
|
};
|
|
546
|
-
} }), i =
|
|
547
|
+
} }), i = N();
|
|
547
548
|
I({
|
|
548
549
|
clock: i,
|
|
549
550
|
source: t,
|
|
@@ -562,7 +563,7 @@ var We = M("predicate"), Ge = L(({ client: e }) => {
|
|
|
562
563
|
return t.map((t) => t[e]?.predicate, { skipVoid: !1 });
|
|
563
564
|
}
|
|
564
565
|
function s(t) {
|
|
565
|
-
let n =
|
|
566
|
+
let n = P(() => void 0, { skipVoid: !1 }), r = O({
|
|
566
567
|
source: {
|
|
567
568
|
predicate: o(t),
|
|
568
569
|
snapshot: e.stateSnapshotStore
|
|
@@ -593,26 +594,26 @@ var We = M("predicate"), Ge = L(({ client: e }) => {
|
|
|
593
594
|
getEvokablePredicate: s
|
|
594
595
|
};
|
|
595
596
|
});
|
|
596
|
-
function
|
|
597
|
-
return R(
|
|
597
|
+
function qe(e) {
|
|
598
|
+
return R(Ke, e);
|
|
598
599
|
}
|
|
599
|
-
var
|
|
600
|
+
var Je = (e, t, n) => {
|
|
600
601
|
n.register({
|
|
601
602
|
name: e,
|
|
602
603
|
predicate: t
|
|
603
604
|
});
|
|
604
|
-
},
|
|
605
|
-
function
|
|
605
|
+
}, V = j("history");
|
|
606
|
+
function H(e, t) {
|
|
606
607
|
return {
|
|
607
|
-
id:
|
|
608
|
+
id: pe(`history-entry-${Date.now()}-${Math.random()}}`),
|
|
608
609
|
node: t,
|
|
609
610
|
at: Date.now(),
|
|
610
611
|
experienceId: e
|
|
611
612
|
};
|
|
612
613
|
}
|
|
613
|
-
var
|
|
614
|
-
let e =
|
|
615
|
-
e.on(t, (e, t) => ({ entries: [...e.entries,
|
|
614
|
+
var Ye = L(() => {
|
|
615
|
+
let e = V.store({ entries: [] }), t = V.event(), n = V.event(), r = V.event(), i = V.event();
|
|
616
|
+
e.on(t, (e, t) => ({ entries: [...e.entries, H(t.experienceId, t.node)] })), e.on(n, (e, t) => ({ entries: [...e.entries.slice(0, -1), H(t.experienceId, t.node)] })), e.on(i, (e, t) => t);
|
|
616
617
|
function a(e, t) {
|
|
617
618
|
let n = {
|
|
618
619
|
lastStepIndex: -1,
|
|
@@ -644,22 +645,22 @@ var Je = L(() => {
|
|
|
644
645
|
entriesStore: e.map((e) => e.entries)
|
|
645
646
|
};
|
|
646
647
|
});
|
|
647
|
-
function
|
|
648
|
-
return R(
|
|
648
|
+
function Xe() {
|
|
649
|
+
return R(Ye);
|
|
649
650
|
}
|
|
650
651
|
//#endregion
|
|
651
652
|
//#region src/utils/events.ts
|
|
652
|
-
var
|
|
653
|
-
let t =
|
|
653
|
+
var Ze = 0, Qe = (e) => {
|
|
654
|
+
let t = P([]);
|
|
654
655
|
return t.on(e, (e, t) => [...e, {
|
|
655
|
-
id:
|
|
656
|
+
id: Ze++,
|
|
656
657
|
at: /* @__PURE__ */ new Date(),
|
|
657
658
|
payload: t
|
|
658
659
|
}]), t;
|
|
659
660
|
};
|
|
660
661
|
//#endregion
|
|
661
662
|
//#region src/entities/field/policies.ts
|
|
662
|
-
function
|
|
663
|
+
function U(e) {
|
|
663
664
|
let { doNotTrackValue: t, doNotStoreValue: n } = e ?? {}, r = e?.trackValue ?? t === !1, i = e?.storeValue ?? n === !1;
|
|
664
665
|
return {
|
|
665
666
|
trackValue: r,
|
|
@@ -670,10 +671,10 @@ function W(e) {
|
|
|
670
671
|
}
|
|
671
672
|
//#endregion
|
|
672
673
|
//#region src/entities/field/field.ts
|
|
673
|
-
var
|
|
674
|
-
let e =
|
|
674
|
+
var $e = j("field"), et = L(() => {
|
|
675
|
+
let e = $e.store({}), t = A(e, {
|
|
675
676
|
register(e, t) {
|
|
676
|
-
let n = Object.assign({}, t.field, { policies:
|
|
677
|
+
let n = Object.assign({}, t.field, { policies: U(t.field.policies) });
|
|
677
678
|
return {
|
|
678
679
|
...e,
|
|
679
680
|
[n.id]: n
|
|
@@ -685,7 +686,7 @@ var Qe = M("field"), $e = L(() => {
|
|
|
685
686
|
let r = Object.assign({}, n, t.updates);
|
|
686
687
|
return {
|
|
687
688
|
...e,
|
|
688
|
-
[n.id]: Object.assign({}, r, { policies:
|
|
689
|
+
[n.id]: Object.assign({}, r, { policies: U(r.policies) })
|
|
689
690
|
};
|
|
690
691
|
}
|
|
691
692
|
});
|
|
@@ -722,13 +723,13 @@ var Qe = M("field"), $e = L(() => {
|
|
|
722
723
|
getByName: c
|
|
723
724
|
};
|
|
724
725
|
});
|
|
725
|
-
function
|
|
726
|
-
return R(
|
|
726
|
+
function tt() {
|
|
727
|
+
return R(et);
|
|
727
728
|
}
|
|
728
729
|
//#endregion
|
|
729
730
|
//#region src/entities/step/step.ts
|
|
730
|
-
var
|
|
731
|
-
let e =
|
|
731
|
+
var nt = j("step"), rt = L(() => {
|
|
732
|
+
let e = nt.store({}), t = A(e, { register(e, t) {
|
|
732
733
|
return {
|
|
733
734
|
...e,
|
|
734
735
|
[t.step.id]: t.step
|
|
@@ -752,16 +753,16 @@ var tt = M("step"), nt = L(() => {
|
|
|
752
753
|
indexStore: e
|
|
753
754
|
};
|
|
754
755
|
});
|
|
755
|
-
function
|
|
756
|
-
return R(
|
|
756
|
+
function it() {
|
|
757
|
+
return R(rt);
|
|
757
758
|
}
|
|
758
|
-
function
|
|
759
|
+
function at(e, t) {
|
|
759
760
|
t.register(e);
|
|
760
761
|
}
|
|
761
762
|
//#endregion
|
|
762
763
|
//#region src/entities/content/content.ts
|
|
763
|
-
var
|
|
764
|
-
let e =
|
|
764
|
+
var ot = j("content"), st = L(() => {
|
|
765
|
+
let e = ot.store({}), t = A(e, {
|
|
765
766
|
register(e, t) {
|
|
766
767
|
return {
|
|
767
768
|
...e,
|
|
@@ -802,34 +803,34 @@ var at = M("content"), ot = L(() => {
|
|
|
802
803
|
indexStore: e
|
|
803
804
|
};
|
|
804
805
|
});
|
|
805
|
-
function
|
|
806
|
-
return R(
|
|
806
|
+
function ct() {
|
|
807
|
+
return R(st);
|
|
807
808
|
}
|
|
808
|
-
function
|
|
809
|
+
function lt(e, t) {
|
|
809
810
|
t.register(e);
|
|
810
811
|
}
|
|
811
812
|
//#endregion
|
|
812
813
|
//#region src/entities/action/action.ts
|
|
813
|
-
var
|
|
814
|
+
var ut = j("action"), W = {
|
|
814
815
|
status: "idle",
|
|
815
816
|
response: void 0,
|
|
816
817
|
error: void 0
|
|
817
|
-
},
|
|
818
|
-
...
|
|
818
|
+
}, dt = {
|
|
819
|
+
...W,
|
|
819
820
|
status: "running"
|
|
820
|
-
},
|
|
821
|
-
function
|
|
822
|
-
let t = /* @__PURE__ */ new WeakMap(), n = (e, n) => t.get(n?.experience ??
|
|
821
|
+
}, G = {};
|
|
822
|
+
function K(e) {
|
|
823
|
+
let t = /* @__PURE__ */ new WeakMap(), n = (e, n) => t.get(n?.experience ?? G)?.get(e);
|
|
823
824
|
return Object.assign((r, i) => {
|
|
824
825
|
let a = n(r, i);
|
|
825
826
|
if (a === void 0) {
|
|
826
|
-
let n = i?.experience ??
|
|
827
|
+
let n = i?.experience ?? G;
|
|
827
828
|
a = e(r, i), t.set(n, (t.get(n) ?? /* @__PURE__ */ new Map()).set(r, a));
|
|
828
829
|
}
|
|
829
830
|
return a;
|
|
830
831
|
}, { find: n });
|
|
831
832
|
}
|
|
832
|
-
function
|
|
833
|
+
function ft(e) {
|
|
833
834
|
return e.status === "succeeded" ? {
|
|
834
835
|
status: "succeeded",
|
|
835
836
|
response: e.response,
|
|
@@ -840,8 +841,8 @@ function dt(e) {
|
|
|
840
841
|
error: e.error
|
|
841
842
|
};
|
|
842
843
|
}
|
|
843
|
-
var
|
|
844
|
-
let t =
|
|
844
|
+
var pt = L(({ client: e }) => {
|
|
845
|
+
let t = ut.store({}), n = A(t, {
|
|
845
846
|
register(e, t) {
|
|
846
847
|
return {
|
|
847
848
|
...e,
|
|
@@ -855,7 +856,7 @@ var ft = L(({ client: e }) => {
|
|
|
855
856
|
unregister(e, t) {
|
|
856
857
|
return Object.hasOwn(e, t) ? Object.fromEntries(Object.entries(e).filter(([e]) => e !== t)) : e;
|
|
857
858
|
}
|
|
858
|
-
}), i =
|
|
859
|
+
}), i = N(), a = n.unregister;
|
|
859
860
|
I({
|
|
860
861
|
clock: i,
|
|
861
862
|
source: t,
|
|
@@ -889,8 +890,8 @@ var ft = L(({ client: e }) => {
|
|
|
889
890
|
}
|
|
890
891
|
let l = /* @__PURE__ */ new WeakMap(), u = [];
|
|
891
892
|
function d(e, t, n) {
|
|
892
|
-
let r = e?.experience ??
|
|
893
|
-
region: !e || u.includes(e.experience) ?
|
|
893
|
+
let r = e?.experience ?? G, i = l.get(r) ?? {
|
|
894
|
+
region: !e || u.includes(e.experience) ? ve() : null,
|
|
894
895
|
builders: [],
|
|
895
896
|
unlinkers: []
|
|
896
897
|
};
|
|
@@ -900,24 +901,24 @@ var ft = L(({ client: e }) => {
|
|
|
900
901
|
for (let t of u) {
|
|
901
902
|
let n = l.get(t);
|
|
902
903
|
if (n?.region && !e.includes(t)) {
|
|
903
|
-
|
|
904
|
+
_e(n.region), n.region = null;
|
|
904
905
|
for (let e of n.unlinkers) e();
|
|
905
906
|
}
|
|
906
907
|
}
|
|
907
908
|
for (let t of e) {
|
|
908
909
|
let e = l.get(t);
|
|
909
910
|
if (e && !e.region) {
|
|
910
|
-
let t =
|
|
911
|
+
let t = ve();
|
|
911
912
|
e.region = t;
|
|
912
913
|
for (let n of e.builders) ye(t, n);
|
|
913
914
|
}
|
|
914
915
|
}
|
|
915
916
|
u = e;
|
|
916
917
|
});
|
|
917
|
-
let f =
|
|
918
|
-
let r =
|
|
918
|
+
let f = K((t, n) => {
|
|
919
|
+
let r = N(), i = P(c(t, n), { skipVoid: !1 }).on(r, (e, t) => t);
|
|
919
920
|
return d(n, () => {
|
|
920
|
-
let i =
|
|
921
|
+
let i = k(s(t), e.stateSnapshotStore, (e, r) => c(t, n, r));
|
|
921
922
|
I({
|
|
922
923
|
clock: i,
|
|
923
924
|
target: r
|
|
@@ -929,7 +930,7 @@ var ft = L(({ client: e }) => {
|
|
|
929
930
|
async function p(n, r = {}) {
|
|
930
931
|
let i = t.getState()[n]?.action;
|
|
931
932
|
if (!i) throw Error(`Action '${n}' is not registered`);
|
|
932
|
-
let a = r.experience ? { experience: r.experience } : null, o = e.stateSnapshotStore.getState(), s = r.args ?? [], c =
|
|
933
|
+
let a = r.experience ? { experience: r.experience } : null, o = e.stateSnapshotStore.getState(), s = r.args ?? [], c = mt(r.signal, r.timeoutMs);
|
|
933
934
|
return c ? (c.throwIfAborted(), new Promise((e, t) => {
|
|
934
935
|
let n = () => {
|
|
935
936
|
t(c.reason);
|
|
@@ -946,8 +947,8 @@ var ft = L(({ client: e }) => {
|
|
|
946
947
|
args: s
|
|
947
948
|
}, a);
|
|
948
949
|
}
|
|
949
|
-
let m =
|
|
950
|
-
let n =
|
|
950
|
+
let m = K((e, t) => {
|
|
951
|
+
let n = N(), r = N(), i = 0, a = async (...a) => {
|
|
951
952
|
i += 1;
|
|
952
953
|
let o = i;
|
|
953
954
|
n();
|
|
@@ -971,9 +972,9 @@ var ft = L(({ client: e }) => {
|
|
|
971
972
|
...n,
|
|
972
973
|
run: a
|
|
973
974
|
});
|
|
974
|
-
return
|
|
975
|
-
}), h =
|
|
976
|
-
let i = f(n, r), a =
|
|
975
|
+
return P(o(W)).on(n, () => o(dt)).on(r, (e, t) => o(ft(t)));
|
|
976
|
+
}), h = K((n, r) => {
|
|
977
|
+
let i = f(n, r), a = P(void 0, { skipVoid: !1 }), o = 0, s = !1, l = !1, u = () => [t.getState()[n]?.action, e.stateSnapshotStore.getState()], d = [], p = M(async (e) => {
|
|
977
978
|
o += 1;
|
|
978
979
|
let t = o;
|
|
979
980
|
if (d = u(), y(n)) return s || (s = !0, `${n}`), {
|
|
@@ -1039,14 +1040,14 @@ var ft = L(({ client: e }) => {
|
|
|
1039
1040
|
isPublished: y
|
|
1040
1041
|
};
|
|
1041
1042
|
});
|
|
1042
|
-
function
|
|
1043
|
+
function mt(e, t) {
|
|
1043
1044
|
let n = t === void 0 ? void 0 : AbortSignal.timeout(t);
|
|
1044
1045
|
return e && n ? AbortSignal.any([e, n]) : e ?? n;
|
|
1045
1046
|
}
|
|
1046
|
-
function
|
|
1047
|
-
return R(
|
|
1047
|
+
function ht(e) {
|
|
1048
|
+
return R(pt, e);
|
|
1048
1049
|
}
|
|
1049
|
-
var
|
|
1050
|
+
var gt = (e, t, n) => {
|
|
1050
1051
|
n.register({
|
|
1051
1052
|
key: e,
|
|
1052
1053
|
action: t
|
|
@@ -1054,7 +1055,7 @@ var ht = (e, t, n) => {
|
|
|
1054
1055
|
};
|
|
1055
1056
|
//#endregion
|
|
1056
1057
|
//#region src/entities/response/response-validation.ts
|
|
1057
|
-
function
|
|
1058
|
+
function q(e, t, n, r) {
|
|
1058
1059
|
return {
|
|
1059
1060
|
fieldKey: e.key,
|
|
1060
1061
|
userMessage: n,
|
|
@@ -1062,62 +1063,62 @@ function J(e, t, n, r) {
|
|
|
1062
1063
|
value: t
|
|
1063
1064
|
};
|
|
1064
1065
|
}
|
|
1065
|
-
function
|
|
1066
|
+
function J(e) {
|
|
1066
1067
|
return e === null || e === "" || Array.isArray(e) && !e.length;
|
|
1067
1068
|
}
|
|
1068
|
-
function
|
|
1069
|
+
function _t(e) {
|
|
1069
1070
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
|
|
1070
1071
|
}
|
|
1071
|
-
function
|
|
1072
|
+
function vt(e) {
|
|
1072
1073
|
try {
|
|
1073
1074
|
return JSON.stringify(e), !0;
|
|
1074
1075
|
} catch {
|
|
1075
1076
|
return !1;
|
|
1076
1077
|
}
|
|
1077
1078
|
}
|
|
1078
|
-
function
|
|
1079
|
+
function yt(e, t) {
|
|
1079
1080
|
return t.find((t) => t.key === e) ?? null;
|
|
1080
1081
|
}
|
|
1081
|
-
function
|
|
1082
|
+
function bt(e, t) {
|
|
1082
1083
|
return e.multiple && (typeof t == "string" || typeof t == "number" || typeof t == "boolean") ? [t] : t;
|
|
1083
1084
|
}
|
|
1084
|
-
function
|
|
1085
|
-
if (e.type !== "object" ||
|
|
1085
|
+
function xt(e, t) {
|
|
1086
|
+
if (e.type !== "object" || J(t)) return null;
|
|
1086
1087
|
if (e.multiple) {
|
|
1087
|
-
if (!Array.isArray(t)) return
|
|
1088
|
+
if (!Array.isArray(t)) return q(e, t, "This field expects multiple values", "Field expects an array of objects.");
|
|
1088
1089
|
for (let n of t) {
|
|
1089
|
-
if (typeof n != "object" || !n) return
|
|
1090
|
-
if (!
|
|
1090
|
+
if (typeof n != "object" || !n) return q(e, t, "This field expects object values", "Field expects an array of objects, but received non-object value.");
|
|
1091
|
+
if (!vt(n)) return q(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
|
|
1091
1092
|
}
|
|
1092
1093
|
return null;
|
|
1093
1094
|
}
|
|
1094
|
-
return Array.isArray(t) ?
|
|
1095
|
+
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.") : vt(t) ? null : q(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
|
|
1095
1096
|
}
|
|
1096
|
-
function
|
|
1097
|
-
if (
|
|
1097
|
+
function St(e, t) {
|
|
1098
|
+
if (J(t) || !Array.isArray(e.options) || e.options.length === 0) return null;
|
|
1098
1099
|
let n = Array.isArray(t) ? t : [t];
|
|
1099
1100
|
if (e.type === "object") {
|
|
1100
1101
|
let r = new Set(e.options.map((e) => JSON.stringify(e.value)));
|
|
1101
|
-
return n.every((e) => r.has(JSON.stringify(e))) ? null :
|
|
1102
|
+
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.");
|
|
1102
1103
|
}
|
|
1103
1104
|
let r = e.options.map((e) => e.value);
|
|
1104
|
-
return n.every((e) => !
|
|
1105
|
+
return n.every((e) => !_t(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(", ")}`);
|
|
1105
1106
|
}
|
|
1106
|
-
async function
|
|
1107
|
-
if (n.validation && !e(n.validation) && !
|
|
1107
|
+
async function Ct(t, n, r, i) {
|
|
1108
|
+
if (n.validation && !e(n.validation) && !J(r)) {
|
|
1108
1109
|
let e = i ? {
|
|
1109
1110
|
$input: r,
|
|
1110
1111
|
responses: i
|
|
1111
1112
|
} : { $input: r }, a = await t(n.validation, e);
|
|
1112
|
-
if (typeof a == "string") return
|
|
1113
|
-
if (a === !1) return
|
|
1113
|
+
if (typeof a == "string") return q(n, r, a, `Field validation resulted in an error: ${a}.`);
|
|
1114
|
+
if (a === !1) return q(n, r, "This field is invalid", "Field validation resulted in an unspecified error.");
|
|
1114
1115
|
}
|
|
1115
|
-
return n.required &&
|
|
1116
|
+
return n.required && J(r) ? q(n, r, "This field is required", "Field is required.") : !n.multiple && Array.isArray(r) && r.length > 1 ? q(n, r, "This field expects a single response", "Field expects a single response.") : null;
|
|
1116
1117
|
}
|
|
1117
1118
|
//#endregion
|
|
1118
1119
|
//#region src/entities/response/response.ts
|
|
1119
|
-
var
|
|
1120
|
-
let t =
|
|
1120
|
+
var wt = j("response"), Tt = L(({ client: e }) => {
|
|
1121
|
+
let t = wt.store({}), r = N(), i = N(), a = A(t, {
|
|
1121
1122
|
register(e, t) {
|
|
1122
1123
|
return {
|
|
1123
1124
|
...e,
|
|
@@ -1146,7 +1147,7 @@ var Ct = M("response"), wt = L(({ client: e }) => {
|
|
|
1146
1147
|
});
|
|
1147
1148
|
} else a.registerBatch(e);
|
|
1148
1149
|
}
|
|
1149
|
-
let s = (t, r) => n(e, t, r), c =
|
|
1150
|
+
let s = (t, r) => n(e, t, r), c = O({
|
|
1150
1151
|
source: {
|
|
1151
1152
|
allFields: e.fields.listStore,
|
|
1152
1153
|
existingResponses: t
|
|
@@ -1156,7 +1157,7 @@ var Ct = M("response"), wt = L(({ client: e }) => {
|
|
|
1156
1157
|
...t,
|
|
1157
1158
|
...n
|
|
1158
1159
|
}, o = Object.entries(n), c = await Promise.allSettled(o.map(async ([t, n]) => {
|
|
1159
|
-
let o =
|
|
1160
|
+
let o = yt(t, e);
|
|
1160
1161
|
if (!o) {
|
|
1161
1162
|
r.push({
|
|
1162
1163
|
fieldKey: t,
|
|
@@ -1166,17 +1167,17 @@ var Ct = M("response"), wt = L(({ client: e }) => {
|
|
|
1166
1167
|
});
|
|
1167
1168
|
return;
|
|
1168
1169
|
}
|
|
1169
|
-
let c =
|
|
1170
|
+
let c = bt(o, n), l = await Ct(s, o, c, a);
|
|
1170
1171
|
if (l) {
|
|
1171
1172
|
r.push(l);
|
|
1172
1173
|
return;
|
|
1173
1174
|
}
|
|
1174
|
-
let u =
|
|
1175
|
+
let u = xt(o, c);
|
|
1175
1176
|
if (u) {
|
|
1176
1177
|
r.push(u);
|
|
1177
1178
|
return;
|
|
1178
1179
|
}
|
|
1179
|
-
let d =
|
|
1180
|
+
let d = St(o, c);
|
|
1180
1181
|
d ? r.push(d) : i[o.key] = n;
|
|
1181
1182
|
}));
|
|
1182
1183
|
for (let [e, t] of c.entries()) {
|
|
@@ -1200,7 +1201,7 @@ var Ct = M("response"), wt = L(({ client: e }) => {
|
|
|
1200
1201
|
async function l(e) {
|
|
1201
1202
|
return c(e);
|
|
1202
1203
|
}
|
|
1203
|
-
let u =
|
|
1204
|
+
let u = O({
|
|
1204
1205
|
source: t,
|
|
1205
1206
|
effect: async (e, t) => {
|
|
1206
1207
|
let { responsesToCommit: n, validationErrors: r } = await c(t);
|
|
@@ -1215,7 +1216,7 @@ var Ct = M("response"), wt = L(({ client: e }) => {
|
|
|
1215
1216
|
value: t
|
|
1216
1217
|
})));
|
|
1217
1218
|
function m(e) {
|
|
1218
|
-
return
|
|
1219
|
+
return k({
|
|
1219
1220
|
f: e,
|
|
1220
1221
|
s: t
|
|
1221
1222
|
}, ({ f: e, s: t }) => {
|
|
@@ -1251,13 +1252,13 @@ var Ct = M("response"), wt = L(({ client: e }) => {
|
|
|
1251
1252
|
getByFieldName: _
|
|
1252
1253
|
};
|
|
1253
1254
|
});
|
|
1254
|
-
function
|
|
1255
|
-
return R(
|
|
1255
|
+
function Et(e) {
|
|
1256
|
+
return R(Tt, e);
|
|
1256
1257
|
}
|
|
1257
1258
|
//#endregion
|
|
1258
1259
|
//#region src/entities/condition/condition.ts
|
|
1259
|
-
var
|
|
1260
|
-
let e =
|
|
1260
|
+
var Dt = j("condition"), Ot = L(() => {
|
|
1261
|
+
let e = Dt.store({}), t = A(e, { register(e, t) {
|
|
1261
1262
|
return {
|
|
1262
1263
|
...e,
|
|
1263
1264
|
[t.condition.id]: t.condition
|
|
@@ -1281,12 +1282,12 @@ var Et = M("condition"), Dt = L(() => {
|
|
|
1281
1282
|
indexStore: e
|
|
1282
1283
|
};
|
|
1283
1284
|
});
|
|
1284
|
-
function
|
|
1285
|
-
return R(
|
|
1285
|
+
function kt() {
|
|
1286
|
+
return R(Ot);
|
|
1286
1287
|
}
|
|
1287
1288
|
//#endregion
|
|
1288
1289
|
//#region src/utils/api-url.ts
|
|
1289
|
-
function
|
|
1290
|
+
function At() {
|
|
1290
1291
|
if (c()) {
|
|
1291
1292
|
let e = [
|
|
1292
1293
|
document.currentScript,
|
|
@@ -1301,25 +1302,25 @@ function kt() {
|
|
|
1301
1302
|
}
|
|
1302
1303
|
//#endregion
|
|
1303
1304
|
//#region src/utils/user-timing.ts
|
|
1304
|
-
var
|
|
1305
|
-
function
|
|
1305
|
+
var jt = "picked:start:begin", Mt = "picked:start";
|
|
1306
|
+
function Nt() {
|
|
1306
1307
|
try {
|
|
1307
1308
|
return s() && !!p.window && "performance" in p;
|
|
1308
1309
|
} catch {
|
|
1309
1310
|
return !1;
|
|
1310
1311
|
}
|
|
1311
1312
|
}
|
|
1312
|
-
function
|
|
1313
|
+
function Pt() {
|
|
1313
1314
|
let e = null, t = null;
|
|
1314
1315
|
return {
|
|
1315
1316
|
markBegin: () => {
|
|
1316
|
-
if (
|
|
1317
|
-
e = performance.mark(
|
|
1317
|
+
if (Nt()) try {
|
|
1318
|
+
e = performance.mark(jt).startTime;
|
|
1318
1319
|
} catch {}
|
|
1319
1320
|
},
|
|
1320
1321
|
measure: () => {
|
|
1321
|
-
if (
|
|
1322
|
-
t = performance.measure(
|
|
1322
|
+
if (Nt() && e !== null) try {
|
|
1323
|
+
t = performance.measure(Mt, { start: e });
|
|
1323
1324
|
} catch {}
|
|
1324
1325
|
},
|
|
1325
1326
|
get startMeasure() {
|
|
@@ -1329,7 +1330,7 @@ function Nt() {
|
|
|
1329
1330
|
}
|
|
1330
1331
|
//#endregion
|
|
1331
1332
|
//#region src/utils/client-telemetry.ts
|
|
1332
|
-
function
|
|
1333
|
+
function Ft() {
|
|
1333
1334
|
let e = null;
|
|
1334
1335
|
return {
|
|
1335
1336
|
observeDeliveryAPIRequests: (t) => {
|
|
@@ -1342,13 +1343,13 @@ function Pt() {
|
|
|
1342
1343
|
}
|
|
1343
1344
|
//#endregion
|
|
1344
1345
|
//#region src/entities/session/session.ts
|
|
1345
|
-
var
|
|
1346
|
-
function
|
|
1346
|
+
var It = ie("session", "global");
|
|
1347
|
+
function Lt() {
|
|
1347
1348
|
return m() ? 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)}`;
|
|
1348
1349
|
}
|
|
1349
|
-
function
|
|
1350
|
+
function Rt() {
|
|
1350
1351
|
if (!h()) return null;
|
|
1351
|
-
let e = D.get(
|
|
1352
|
+
let e = D.get(It);
|
|
1352
1353
|
if (!e.isSet()) return null;
|
|
1353
1354
|
try {
|
|
1354
1355
|
return e.json();
|
|
@@ -1356,10 +1357,19 @@ function Lt() {
|
|
|
1356
1357
|
return null;
|
|
1357
1358
|
}
|
|
1358
1359
|
}
|
|
1359
|
-
|
|
1360
|
-
let
|
|
1361
|
-
|
|
1362
|
-
|
|
1360
|
+
function Y(e, t, n) {
|
|
1361
|
+
let r = {
|
|
1362
|
+
pickedId: e,
|
|
1363
|
+
id: e
|
|
1364
|
+
};
|
|
1365
|
+
return t !== void 0 && (r.isUser = t), n && Object.keys(n).length > 0 && (r.identifiers = n), r;
|
|
1366
|
+
}
|
|
1367
|
+
function zt(e) {
|
|
1368
|
+
let t = { id: e.pickedId };
|
|
1369
|
+
return e.isUser !== void 0 && (t.isUser = e.isUser), e.identifiers && (t.identifiers = e.identifiers), t;
|
|
1370
|
+
}
|
|
1371
|
+
var Bt = L(() => {
|
|
1372
|
+
let e = Rt(), t = P(Y(e?.id ?? Lt(), e?.isUser, e?.identifiers)), n = A(t, {
|
|
1363
1373
|
setIsUser: (e, t) => ({
|
|
1364
1374
|
...e,
|
|
1365
1375
|
isUser: t
|
|
@@ -1367,7 +1377,7 @@ var Rt = L(() => {
|
|
|
1367
1377
|
setIdentifier: (e, { key: t, value: n }) => ({
|
|
1368
1378
|
...e,
|
|
1369
1379
|
identifiers: {
|
|
1370
|
-
...e.identifiers
|
|
1380
|
+
...e.identifiers,
|
|
1371
1381
|
[t]: n
|
|
1372
1382
|
}
|
|
1373
1383
|
}),
|
|
@@ -1376,57 +1386,56 @@ var Rt = L(() => {
|
|
|
1376
1386
|
if (!n || !(t in n)) return e;
|
|
1377
1387
|
let r = {};
|
|
1378
1388
|
for (let [e, i] of Object.entries(n)) e !== t && (r[e] = i);
|
|
1379
|
-
|
|
1380
|
-
return e.isUser !== void 0 && (i.isUser = e.isUser), Object.keys(r).length > 0 && (i.identifiers = r), i;
|
|
1389
|
+
return Y(e.pickedId, e.isUser, r);
|
|
1381
1390
|
}
|
|
1382
|
-
}),
|
|
1383
|
-
source:
|
|
1391
|
+
}), r = O({
|
|
1392
|
+
source: t,
|
|
1384
1393
|
effect: (e) => {
|
|
1385
1394
|
if (h()) try {
|
|
1386
|
-
D.get(
|
|
1395
|
+
D.get(It).set(zt(e));
|
|
1387
1396
|
} catch {}
|
|
1388
1397
|
}
|
|
1389
1398
|
});
|
|
1390
1399
|
return I({
|
|
1391
|
-
source:
|
|
1392
|
-
target:
|
|
1400
|
+
source: t,
|
|
1401
|
+
target: r
|
|
1393
1402
|
}), {
|
|
1394
|
-
store:
|
|
1395
|
-
setIsUser:
|
|
1396
|
-
setIdentifier:
|
|
1397
|
-
removeIdentifier:
|
|
1403
|
+
store: t,
|
|
1404
|
+
setIsUser: n.setIsUser,
|
|
1405
|
+
setIdentifier: n.setIdentifier,
|
|
1406
|
+
removeIdentifier: n.removeIdentifier
|
|
1398
1407
|
};
|
|
1399
1408
|
});
|
|
1400
|
-
function
|
|
1401
|
-
return R(
|
|
1409
|
+
function Vt() {
|
|
1410
|
+
return R(Bt, void 0);
|
|
1402
1411
|
}
|
|
1403
1412
|
//#endregion
|
|
1404
1413
|
//#region src/entities/workspace/workspace.ts
|
|
1405
|
-
function
|
|
1406
|
-
let e =
|
|
1414
|
+
function Ht() {
|
|
1415
|
+
let e = N();
|
|
1407
1416
|
return {
|
|
1408
|
-
store:
|
|
1417
|
+
store: P(null).on(e, (e, t) => t),
|
|
1409
1418
|
set: e
|
|
1410
1419
|
};
|
|
1411
1420
|
}
|
|
1412
1421
|
//#endregion
|
|
1413
1422
|
//#region src/utils/picked-config.ts
|
|
1414
|
-
function
|
|
1423
|
+
function Ut() {
|
|
1415
1424
|
if (s()) return globalThis.window.pickedConfig;
|
|
1416
1425
|
}
|
|
1417
|
-
function
|
|
1418
|
-
if (s()) return
|
|
1426
|
+
function Wt() {
|
|
1427
|
+
if (s()) return Ut()?.projectId;
|
|
1419
1428
|
}
|
|
1420
|
-
function
|
|
1429
|
+
function Gt() {
|
|
1421
1430
|
if (!c()) return;
|
|
1422
1431
|
let e = document.getElementById("picked_script") || document.querySelector("script#picked") || document.getElementById("cvly");
|
|
1423
1432
|
if (e) return e.dataset.projectid || e.getAttribute("project-id") || void 0;
|
|
1424
1433
|
}
|
|
1425
|
-
function
|
|
1434
|
+
function Kt(e) {
|
|
1426
1435
|
if (e.projectId) return e.projectId;
|
|
1427
|
-
let t =
|
|
1436
|
+
let t = Wt();
|
|
1428
1437
|
if (t) return t;
|
|
1429
|
-
let n =
|
|
1438
|
+
let n = Gt();
|
|
1430
1439
|
if (n) return n;
|
|
1431
1440
|
throw Error("projectId is required. You can provide it via one of:\n (1) createClient({ projectId }) options;\n (2) window.pickedConfig = { projectId };\n (3) a <script> tag with id 'picked_script', 'picked', or 'cvly' that includes a data-projectid (or project-id) attribute.");
|
|
1432
1441
|
}
|
|
@@ -1435,7 +1444,7 @@ function Wt(e) {
|
|
|
1435
1444
|
function X(e) {
|
|
1436
1445
|
return e == null || e === "" || Number.isNaN(e);
|
|
1437
1446
|
}
|
|
1438
|
-
var
|
|
1447
|
+
var qt = {
|
|
1439
1448
|
default: (e, t) => X(e) ? String(t ?? "") : String(e),
|
|
1440
1449
|
append: (e, t) => t && !X(e) ? `${e} ${t}` : e,
|
|
1441
1450
|
prepend: (e, t) => t && !X(e) ? `${t} ${e}` : e,
|
|
@@ -1456,24 +1465,24 @@ var Gt = {
|
|
|
1456
1465
|
return e instanceof Set ? t.format(Array.from(e).map(String)) : e;
|
|
1457
1466
|
}
|
|
1458
1467
|
};
|
|
1459
|
-
function
|
|
1468
|
+
function Jt(e) {
|
|
1460
1469
|
return typeof e == "object" && !!e;
|
|
1461
1470
|
}
|
|
1462
|
-
function
|
|
1471
|
+
function Yt(e, t) {
|
|
1463
1472
|
let n = t;
|
|
1464
|
-
for (let t of e.split(".")) if (
|
|
1473
|
+
for (let t of e.split(".")) if (Jt(n) && t in n) n = n[t];
|
|
1465
1474
|
else return;
|
|
1466
1475
|
return typeof n == "function" ? n() : n;
|
|
1467
1476
|
}
|
|
1468
|
-
function
|
|
1469
|
-
let n = e.split("|").map((e) => e.trim()), r =
|
|
1477
|
+
function Xt(e, t) {
|
|
1478
|
+
let n = e.split("|").map((e) => e.trim()), r = Yt(n.shift() ?? "", t);
|
|
1470
1479
|
for (let e of n) {
|
|
1471
|
-
let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o =
|
|
1480
|
+
let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o = qt[i];
|
|
1472
1481
|
o && (r = o(r, a));
|
|
1473
1482
|
}
|
|
1474
1483
|
return X(r) ? "" : typeof r == "object" ? JSON.stringify(r) : String(r);
|
|
1475
1484
|
}
|
|
1476
|
-
function
|
|
1485
|
+
function Zt(e, t) {
|
|
1477
1486
|
let n = "", r = 0;
|
|
1478
1487
|
for (; r < e.length;) if (e[r] === "{" && e[r + 1] === "{") {
|
|
1479
1488
|
r += 2;
|
|
@@ -1485,13 +1494,13 @@ function Yt(e, t) {
|
|
|
1485
1494
|
}
|
|
1486
1495
|
i += e[r++];
|
|
1487
1496
|
}
|
|
1488
|
-
n +=
|
|
1497
|
+
n += Xt(i.trim(), t);
|
|
1489
1498
|
} else n += e[r++];
|
|
1490
1499
|
return n;
|
|
1491
1500
|
}
|
|
1492
1501
|
//#endregion
|
|
1493
1502
|
//#region src/picked.ts
|
|
1494
|
-
var
|
|
1503
|
+
var Qt = class {
|
|
1495
1504
|
static logger = r;
|
|
1496
1505
|
options;
|
|
1497
1506
|
dataSource = null;
|
|
@@ -1500,57 +1509,57 @@ var Xt = class {
|
|
|
1500
1509
|
previewUnavailable = !1;
|
|
1501
1510
|
contentLoader;
|
|
1502
1511
|
previewEmbedderOrigins = null;
|
|
1503
|
-
setPreviewEmbedderOrigins =
|
|
1512
|
+
setPreviewEmbedderOrigins = N();
|
|
1504
1513
|
plugins = {};
|
|
1505
|
-
telemetry =
|
|
1514
|
+
telemetry = Ft();
|
|
1506
1515
|
dataProviders = /* @__PURE__ */ new Map();
|
|
1507
|
-
eventBus =
|
|
1516
|
+
eventBus = N();
|
|
1508
1517
|
events;
|
|
1509
1518
|
projectId;
|
|
1510
1519
|
apiUrl;
|
|
1511
1520
|
dashboardUrl;
|
|
1512
1521
|
documentationSiteUrl;
|
|
1513
|
-
session =
|
|
1514
|
-
workspace =
|
|
1515
|
-
performance =
|
|
1522
|
+
session = Vt();
|
|
1523
|
+
workspace = Ht();
|
|
1524
|
+
performance = Pt();
|
|
1516
1525
|
searchParams = ae();
|
|
1517
|
-
history =
|
|
1526
|
+
history = Xe();
|
|
1518
1527
|
components = je({ client: this });
|
|
1519
1528
|
experienceInstances = w({ client: this });
|
|
1520
1529
|
experiences = Ce({ client: this });
|
|
1521
1530
|
frameworks = Fe({ client: this });
|
|
1522
|
-
predicates =
|
|
1531
|
+
predicates = qe({ client: this });
|
|
1523
1532
|
features = de({ client: this });
|
|
1524
|
-
conditions =
|
|
1525
|
-
fields =
|
|
1526
|
-
responses =
|
|
1527
|
-
steps =
|
|
1528
|
-
contents =
|
|
1529
|
-
actions =
|
|
1533
|
+
conditions = kt();
|
|
1534
|
+
fields = tt();
|
|
1535
|
+
responses = Et({ client: this });
|
|
1536
|
+
steps = it();
|
|
1537
|
+
contents = ct();
|
|
1538
|
+
actions = ht({ client: this });
|
|
1530
1539
|
conditionResults = te();
|
|
1531
1540
|
stateSnapshotStore = Re({ client: this });
|
|
1532
|
-
evaluateRuleLogicFx =
|
|
1541
|
+
evaluateRuleLogicFx = He({ client: this });
|
|
1533
1542
|
start;
|
|
1534
1543
|
readyStore;
|
|
1535
1544
|
preconditionPassedStore;
|
|
1536
1545
|
conditionPassedStore;
|
|
1537
1546
|
lifecycleStageStore;
|
|
1538
|
-
lifecycle =
|
|
1539
|
-
renderStringFx =
|
|
1547
|
+
lifecycle = We({ client: this });
|
|
1548
|
+
renderStringFx = O({
|
|
1540
1549
|
source: this.responses.listStore,
|
|
1541
1550
|
effect: (e, { template: t, context: n }) => {
|
|
1542
1551
|
let r = {};
|
|
1543
1552
|
for (let t of e) r[t.fieldKey] = t.value;
|
|
1544
|
-
return
|
|
1553
|
+
return Zt(t, {
|
|
1545
1554
|
...n,
|
|
1546
1555
|
responses: r
|
|
1547
1556
|
});
|
|
1548
1557
|
}
|
|
1549
1558
|
});
|
|
1550
1559
|
constructor(e) {
|
|
1551
|
-
this.events =
|
|
1560
|
+
this.events = Qe(this.eventBus), this.setPreviewEmbedderOrigins.watch((e) => {
|
|
1552
1561
|
this.previewEmbedderOrigins = e;
|
|
1553
|
-
}), this.projectId =
|
|
1562
|
+
}), this.projectId = Kt(e), this.options = Object.freeze(e), this.apiUrl = e.apiUrl || At(), this.dashboardUrl = e.dashboardUrl ?? "https://dashboard.picked.app", this.documentationSiteUrl = e.documentationSiteUrl ?? "https://docs.picked.app", this.start = this.lifecycle.start, this.readyStore = this.lifecycle.readyStore, this.preconditionPassedStore = this.lifecycle.preconditionPassedStore, this.conditionPassedStore = this.lifecycle.conditionPassedStore, this.lifecycleStageStore = this.lifecycle.lifecycleStageStore, this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.setupActions(), this.setupFields(), this.setupComponents(), this.lifecycle.setPrecondition(e.precondition), this.lifecycle.setCondition(e.condition), this.eventBus({
|
|
1554
1563
|
type: "load",
|
|
1555
1564
|
version: le()
|
|
1556
1565
|
}), this.maybeStartPreviewChannel();
|
|
@@ -1558,7 +1567,7 @@ var Xt = class {
|
|
|
1558
1567
|
dataProviderFor(e) {
|
|
1559
1568
|
let t = e ?? "", n = this.dataProviders.get(t);
|
|
1560
1569
|
if (n) return n;
|
|
1561
|
-
let r = import("../provider-
|
|
1570
|
+
let r = import("../provider-RW9aSckL.js").then((t) => t.createPickedDataProvider({
|
|
1562
1571
|
apiUrl: this.apiUrl,
|
|
1563
1572
|
projectId: this.projectId,
|
|
1564
1573
|
getRequestObserver: () => this.telemetry.deliveryAPIRequestObserver,
|
|
@@ -1568,7 +1577,7 @@ var Xt = class {
|
|
|
1568
1577
|
}
|
|
1569
1578
|
async getProjectConfig(e) {
|
|
1570
1579
|
let t = await this.dataProviderFor(e?.previewToken), n = await t.getProjectConfig();
|
|
1571
|
-
if (this.dataSource = t.meta.manifest, n === null && t.meta.previewUnavailable) throw new
|
|
1580
|
+
if (this.dataSource = t.meta.manifest, n === null && t.meta.previewUnavailable) throw new fe(this.projectId);
|
|
1572
1581
|
if (n === null) throw Error(`Picked could not resolve the configuration for project "${this.projectId}" from ${this.apiUrl}.`);
|
|
1573
1582
|
return n;
|
|
1574
1583
|
}
|
|
@@ -1593,7 +1602,7 @@ var Xt = class {
|
|
|
1593
1602
|
se(e, t, this.features);
|
|
1594
1603
|
};
|
|
1595
1604
|
registerPredicate = (e, t) => {
|
|
1596
|
-
|
|
1605
|
+
Je(e, t, this.predicates);
|
|
1597
1606
|
};
|
|
1598
1607
|
registerCondition = (e) => {
|
|
1599
1608
|
this.conditions.register(e);
|
|
@@ -1602,16 +1611,16 @@ var Xt = class {
|
|
|
1602
1611
|
this.fields.register(e);
|
|
1603
1612
|
};
|
|
1604
1613
|
registerStep = (e) => {
|
|
1605
|
-
|
|
1614
|
+
at(e, this.steps);
|
|
1606
1615
|
};
|
|
1607
1616
|
registerContent = (e) => {
|
|
1608
|
-
|
|
1617
|
+
lt(e, this.contents);
|
|
1609
1618
|
};
|
|
1610
1619
|
patchContent = (e, t) => {
|
|
1611
1620
|
this.contents.patch(e, t);
|
|
1612
1621
|
};
|
|
1613
1622
|
registerAction = (e, t) => {
|
|
1614
|
-
|
|
1623
|
+
gt(e, t, this.actions);
|
|
1615
1624
|
};
|
|
1616
1625
|
registerExperience = (e) => {
|
|
1617
1626
|
e.component && Me(`experience:${e.id}`, e.component, this.components), this.experiences.register(e);
|
|
@@ -1695,8 +1704,8 @@ var Xt = class {
|
|
|
1695
1704
|
});
|
|
1696
1705
|
}
|
|
1697
1706
|
getPluginConfig = (e) => this.plugins[e] ?? {};
|
|
1698
|
-
},
|
|
1699
|
-
async function
|
|
1707
|
+
}, $t = "application/picked-javascript", en = "application/picked-module", tn = "data-picked-hydrated";
|
|
1708
|
+
async function nn(e) {
|
|
1700
1709
|
if (!("document" in globalThis)) return;
|
|
1701
1710
|
let t = "application/picked-module", n = "data-picked-hydrated";
|
|
1702
1711
|
function r(e) {
|
|
@@ -1725,23 +1734,23 @@ async function en(e) {
|
|
|
1725
1734
|
a && await a;
|
|
1726
1735
|
}
|
|
1727
1736
|
}
|
|
1728
|
-
function
|
|
1729
|
-
return `<script>(${
|
|
1737
|
+
function rn() {
|
|
1738
|
+
return `<script>(${nn.toString()})(document)<\/script>`;
|
|
1730
1739
|
}
|
|
1731
1740
|
//#endregion
|
|
1732
1741
|
//#region src/utils/html-asset-value.ts
|
|
1733
|
-
function
|
|
1742
|
+
function an(e) {
|
|
1734
1743
|
return typeof e == "object" && !!e && "id" in e && typeof e.id == "string" && "content" in e && (typeof e.content == "string" || e.content === null);
|
|
1735
1744
|
}
|
|
1736
1745
|
//#endregion
|
|
1737
1746
|
//#region src/entities/component/lazyComponent.ts
|
|
1738
|
-
function
|
|
1747
|
+
function on(e) {
|
|
1739
1748
|
return {
|
|
1740
1749
|
$$type: "lazy-component",
|
|
1741
1750
|
load: e
|
|
1742
1751
|
};
|
|
1743
1752
|
}
|
|
1744
|
-
function
|
|
1753
|
+
function sn(e) {
|
|
1745
1754
|
return typeof e == "object" && !!e && "$$type" in e && e.$$type === "lazy-component";
|
|
1746
1755
|
}
|
|
1747
1756
|
//#endregion
|
|
@@ -1757,10 +1766,10 @@ function $(e) {
|
|
|
1757
1766
|
for (let e of t) Z(e) && n.push(e.contentEntryId);
|
|
1758
1767
|
return n;
|
|
1759
1768
|
}
|
|
1760
|
-
function
|
|
1769
|
+
function cn(e, t) {
|
|
1761
1770
|
return t === null ? null : e[t] ?? null;
|
|
1762
1771
|
}
|
|
1763
|
-
function
|
|
1772
|
+
function ln(e, t) {
|
|
1764
1773
|
let n = [];
|
|
1765
1774
|
for (let r of t) {
|
|
1766
1775
|
let t = e[r];
|
|
@@ -1768,32 +1777,32 @@ function sn(e, t) {
|
|
|
1768
1777
|
}
|
|
1769
1778
|
return n;
|
|
1770
1779
|
}
|
|
1771
|
-
function
|
|
1772
|
-
if (
|
|
1780
|
+
function un(e, t) {
|
|
1781
|
+
if (F.store(t)) return k(t, e.indexStore, (e, t) => cn(t, Q(e)));
|
|
1773
1782
|
let n = Q(t);
|
|
1774
|
-
return e.indexStore.map((e) =>
|
|
1783
|
+
return e.indexStore.map((e) => cn(e, n), { skipVoid: !1 });
|
|
1775
1784
|
}
|
|
1776
|
-
function
|
|
1777
|
-
if (
|
|
1785
|
+
function dn(e, t) {
|
|
1786
|
+
if (F.store(t)) return k(t, e.indexStore, (e, t) => ln(t, $(e)));
|
|
1778
1787
|
let n = $(t);
|
|
1779
|
-
return e.indexStore.map((e) =>
|
|
1788
|
+
return e.indexStore.map((e) => ln(e, n), { skipVoid: !1 });
|
|
1780
1789
|
}
|
|
1781
1790
|
//#endregion
|
|
1782
1791
|
//#region src/exports.ts
|
|
1783
|
-
var
|
|
1784
|
-
let t = new
|
|
1792
|
+
var fn = (e) => {
|
|
1793
|
+
let t = new Qt(e);
|
|
1785
1794
|
return u(t), t;
|
|
1786
1795
|
};
|
|
1787
1796
|
//#endregion
|
|
1788
1797
|
//#region src/typed-content.ts
|
|
1789
|
-
function
|
|
1798
|
+
function pn(e) {
|
|
1790
1799
|
return typeof e.data == "object";
|
|
1791
1800
|
}
|
|
1792
|
-
function
|
|
1793
|
-
return e.map((e) => !e || !
|
|
1801
|
+
function mn(e) {
|
|
1802
|
+
return e.map((e) => !e || !pn(e) ? null : e, { skipVoid: !1 });
|
|
1794
1803
|
}
|
|
1795
|
-
function
|
|
1804
|
+
function hn(e, t) {
|
|
1796
1805
|
return e.contentModelKey === t;
|
|
1797
1806
|
}
|
|
1798
1807
|
//#endregion
|
|
1799
|
-
export {
|
|
1808
|
+
export { tn as PICKED_HYDRATED_ATTR, en as PICKED_MODULE_SCRIPT_TYPE, $t as PICKED_SCRIPT_TYPE, ce as PREVIEW_TOKEN_PARAM, Qt as Picked, fe as PreviewUnavailableError, rn as buildRehydrateBootstrap, fn as createClient, Te as createPluginEffect, ie as createStorageKey, un as deriveReference, dn as deriveReferences, n as evaluateRuleLogic, Ut as getPickedConfig, hn as isContentOfModel, Z as isContentReference, an as isHtmlAssetValue, g as isInsideIframe, sn as isLazyLoader, v as isPickedRoot, ue as isPreviewSession, on as lazyComponent, D as localStore, ge as onInertScriptSubtrees, Q as readReferenceId, $ as readReferenceIds, nn as rehydrateScripts, me as reportInertScriptSubtrees, he as resetInertScriptReport, re as sessionStore, ne as subscribe, d as supportsCookies, m as supportsCryptoRandomUUID, c as supportsDocument, i as supportsHistory, f as supportsIntersectionObserver, h as supportsLocalStorage, a as supportsLocation, l as supportsSessionStorage, _ as supportsShadowRoot, o as supportsWebComponents, s as supportsWindow, mn as toTypedContentStore };
|