@picked/client 0.0.1-dev.1785287094311 → 0.0.1-dev.1785305085063
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-o8w9kJwm.js → api-CPL40b7A.js} +1 -1
- package/dist/{api-BzcdC_7V.cjs → api-Dz5rgRgQ.cjs} +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
- package/dist/cjs/preview/index.js +1 -0
- package/dist/cjs/server/index.js +1 -1
- package/dist/esm/index.js +243 -211
- package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
- package/dist/esm/preview/index.js +2 -0
- package/dist/esm/server/index.js +1 -1
- package/dist/inert-script-report-B_bMPRzp.js +18 -0
- package/dist/inert-script-report-ijRHPtcY.cjs +1 -0
- package/dist/{plugin-C46DEiGE.js → plugin-CFXwbXeM.js} +3 -3
- package/dist/{plugin-nrEJGTuE.cjs → plugin-m4qekgtA.cjs} +1 -1
- package/dist/preview-channel-Cx0e6fye.cjs +1 -0
- package/dist/preview-channel-DW9J8t4B.js +98 -0
- package/dist/protocol-Bb_vpLKE.cjs +1 -0
- package/dist/protocol-DSqOlW2r.js +84 -0
- package/dist/types/entities/content/content.d.ts +10 -0
- package/dist/types/entities/content/content.d.ts.map +1 -1
- package/dist/types/exports.d.ts +2 -0
- package/dist/types/exports.d.ts.map +1 -1
- package/dist/types/picked.d.ts +39 -7
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/types.d.ts +6 -0
- package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -1
- package/dist/types/preview/index.d.ts +18 -0
- package/dist/types/preview/index.d.ts.map +1 -0
- package/dist/types/preview-channel.d.ts +12 -0
- package/dist/types/preview-channel.d.ts.map +1 -0
- package/dist/types/preview-receiver/apply-ops.d.ts +32 -0
- package/dist/types/preview-receiver/apply-ops.d.ts.map +1 -0
- package/dist/types/preview-receiver/index.d.ts +15 -0
- package/dist/types/preview-receiver/index.d.ts.map +1 -0
- package/dist/types/preview-receiver/protocol.d.ts +60 -0
- package/dist/types/preview-receiver/protocol.d.ts.map +1 -0
- package/dist/types/utils/content-path.d.ts +37 -0
- package/dist/types/utils/content-path.d.ts.map +1 -0
- package/dist/types/utils/inert-script-report.d.ts +40 -0
- package/dist/types/utils/inert-script-report.d.ts.map +1 -0
- package/dist/types/utils/preview-session.d.ts +12 -0
- package/dist/types/utils/preview-session.d.ts.map +1 -0
- package/package.json +14 -2
- package/dist/preview-bridge-CpX1BkSA.cjs +0 -1
- package/dist/preview-bridge-D76l-dPy.js +0 -33
package/dist/esm/index.js
CHANGED
|
@@ -5,12 +5,13 @@ import { a as i, c as a, d as o, f as s, i as c, l, m as u, n as d, o as f, r as
|
|
|
5
5
|
import { a as _, i as v, r as ee, s as y, t as b } from "../dom-BwmTHeT7.js";
|
|
6
6
|
import { l as x, n as S, r as C, u as w } from "../experience-instance-DOJShRk5.js";
|
|
7
7
|
import { i as T, n as E, r as D, t as O } from "../storage-1MW3-_As.js";
|
|
8
|
-
import { n as te, r as ne } from "../api-
|
|
8
|
+
import { n as te, r as ne } from "../api-CPL40b7A.js";
|
|
9
9
|
import { t as re } from "../id-Bo4RBeOs.js";
|
|
10
|
+
import { n as ie, r as ae, t as oe } from "../inert-script-report-B_bMPRzp.js";
|
|
10
11
|
import { attach as k, combine as A, createApi as j, createDomain as M, createEffect as N, createEvent as P, createStore as F, sample as I } from "effector";
|
|
11
12
|
import { createFactory as L, invoke as R } from "@withease/factories";
|
|
12
13
|
//#region src/entities/experience/experience.ts
|
|
13
|
-
var z = M("experience"),
|
|
14
|
+
var z = M("experience"), se = L(({ client: e, experience: r }) => {
|
|
14
15
|
let i = z.store(r), a = j(i, { merge(e, t) {
|
|
15
16
|
return {
|
|
16
17
|
...e,
|
|
@@ -97,17 +98,17 @@ var z = M("experience"), ie = L(({ client: e, experience: r }) => {
|
|
|
97
98
|
prepareExperienceContentFx: p
|
|
98
99
|
}, u;
|
|
99
100
|
});
|
|
100
|
-
function
|
|
101
|
-
return R(
|
|
101
|
+
function ce(e) {
|
|
102
|
+
return R(se, e);
|
|
102
103
|
}
|
|
103
|
-
var
|
|
104
|
+
var le = L(({ client: e }) => {
|
|
104
105
|
let t = z.store({}), n = j(t, { register(e, t) {
|
|
105
106
|
return {
|
|
106
107
|
...e,
|
|
107
108
|
[t.id]: t
|
|
108
109
|
};
|
|
109
110
|
} }), r = P(), i = N((t) => {
|
|
110
|
-
n.register(
|
|
111
|
+
n.register(ce({
|
|
111
112
|
client: e,
|
|
112
113
|
experience: t
|
|
113
114
|
}));
|
|
@@ -192,20 +193,20 @@ var oe = L(({ client: e }) => {
|
|
|
192
193
|
})
|
|
193
194
|
};
|
|
194
195
|
});
|
|
195
|
-
function
|
|
196
|
-
return R(
|
|
196
|
+
function ue(e) {
|
|
197
|
+
return R(le, e);
|
|
197
198
|
}
|
|
198
|
-
var
|
|
199
|
+
var de = async (e) => {
|
|
199
200
|
await e.experiences.initialiseExperiencesFx();
|
|
200
201
|
};
|
|
201
202
|
//#endregion
|
|
202
203
|
//#region src/entities/plugin/plugin.ts
|
|
203
|
-
function
|
|
204
|
+
function fe(e) {
|
|
204
205
|
return N(async () => {
|
|
205
206
|
await e();
|
|
206
207
|
});
|
|
207
208
|
}
|
|
208
|
-
var
|
|
209
|
+
var pe = (e, t, n) => {
|
|
209
210
|
let r = t.name, i = t.setup(e);
|
|
210
211
|
if (i) {
|
|
211
212
|
let e = n[r] ?? {};
|
|
@@ -214,16 +215,16 @@ var ue = (e, t, n) => {
|
|
|
214
215
|
...i
|
|
215
216
|
});
|
|
216
217
|
}
|
|
217
|
-
},
|
|
218
|
+
}, me = M("component"), he = L(({ client: e, component: t, name: n }) => ({
|
|
218
219
|
name: n,
|
|
219
220
|
component: t,
|
|
220
221
|
frameworkStore: e.frameworks.getByName(t.frameworkName)
|
|
221
222
|
}));
|
|
222
|
-
function
|
|
223
|
-
return R(
|
|
223
|
+
function ge(e) {
|
|
224
|
+
return R(he, e);
|
|
224
225
|
}
|
|
225
|
-
var
|
|
226
|
-
let t =
|
|
226
|
+
var _e = L(({ client: e }) => {
|
|
227
|
+
let t = me.store({}), n = j(t, { register(e, t) {
|
|
227
228
|
return {
|
|
228
229
|
...e,
|
|
229
230
|
[t.name]: t
|
|
@@ -236,7 +237,7 @@ var me = L(({ client: e }) => {
|
|
|
236
237
|
fn: (e, { name: t }) => `Component '${t}' already registered. Registering again will override the previous registration.`
|
|
237
238
|
}).watch((e) => /* @__PURE__ */ r("warn", e)), I({
|
|
238
239
|
clock: i,
|
|
239
|
-
fn: ({ name: t, component: n }) =>
|
|
240
|
+
fn: ({ name: t, component: n }) => ge({
|
|
240
241
|
client: e,
|
|
241
242
|
name: t,
|
|
242
243
|
component: n
|
|
@@ -253,16 +254,16 @@ var me = L(({ client: e }) => {
|
|
|
253
254
|
listStore: a
|
|
254
255
|
};
|
|
255
256
|
});
|
|
256
|
-
function
|
|
257
|
-
return R(
|
|
257
|
+
function ve(e) {
|
|
258
|
+
return R(_e, e);
|
|
258
259
|
}
|
|
259
260
|
var B = (e, t, n) => {
|
|
260
261
|
n.register({
|
|
261
262
|
name: e,
|
|
262
263
|
component: t
|
|
263
264
|
});
|
|
264
|
-
},
|
|
265
|
-
let t =
|
|
265
|
+
}, ye = M("framework"), be = L((e) => {
|
|
266
|
+
let t = ye.store({}), n = j(t, { register(e, t) {
|
|
266
267
|
return {
|
|
267
268
|
...e,
|
|
268
269
|
[t.name]: t.framework
|
|
@@ -287,15 +288,15 @@ var B = (e, t, n) => {
|
|
|
287
288
|
listStore: a
|
|
288
289
|
};
|
|
289
290
|
});
|
|
290
|
-
function
|
|
291
|
-
return R(
|
|
291
|
+
function xe(e) {
|
|
292
|
+
return R(be, e);
|
|
292
293
|
}
|
|
293
|
-
var
|
|
294
|
+
var Se = (e, t) => {
|
|
294
295
|
t.register({
|
|
295
296
|
name: e.name,
|
|
296
297
|
framework: e
|
|
297
298
|
});
|
|
298
|
-
},
|
|
299
|
+
}, Ce = L(({ client: e }) => {
|
|
299
300
|
let t = "window" in globalThis, n = {
|
|
300
301
|
location: t ? globalThis.location : void 0,
|
|
301
302
|
document: t ? globalThis.document : void 0,
|
|
@@ -309,12 +310,12 @@ var ye = (e, t) => {
|
|
|
309
310
|
...n
|
|
310
311
|
}));
|
|
311
312
|
});
|
|
312
|
-
function
|
|
313
|
-
return R(
|
|
313
|
+
function we(e) {
|
|
314
|
+
return R(Ce, e);
|
|
314
315
|
}
|
|
315
316
|
//#endregion
|
|
316
317
|
//#region src/logic-engine.ts
|
|
317
|
-
function
|
|
318
|
+
function Te(e) {
|
|
318
319
|
return typeof e == "number" && !isNaN(e);
|
|
319
320
|
}
|
|
320
321
|
function V(e) {
|
|
@@ -323,21 +324,21 @@ function V(e) {
|
|
|
323
324
|
function H(e) {
|
|
324
325
|
return Array.isArray(e);
|
|
325
326
|
}
|
|
326
|
-
function
|
|
327
|
+
function Ee(e) {
|
|
327
328
|
return e instanceof Promise;
|
|
328
329
|
}
|
|
329
|
-
function
|
|
330
|
+
function De(e) {
|
|
330
331
|
return typeof e == "object" && !!e && !Array.isArray(e) && Object.keys(e).length === 1;
|
|
331
332
|
}
|
|
332
333
|
function U(e) {
|
|
333
|
-
if (
|
|
334
|
+
if (Te(e)) return e;
|
|
334
335
|
let t = parseFloat(`${e}`);
|
|
335
336
|
return isNaN(t) ? 0 : t;
|
|
336
337
|
}
|
|
337
338
|
function W(e) {
|
|
338
339
|
return `${e}`;
|
|
339
340
|
}
|
|
340
|
-
var
|
|
341
|
+
var Oe = {
|
|
341
342
|
"==": (e, t) => e == t,
|
|
342
343
|
"===": (e, t) => e === t,
|
|
343
344
|
"!=": (e, t) => e != t,
|
|
@@ -432,10 +433,10 @@ var Te = {
|
|
|
432
433
|
};
|
|
433
434
|
async function G(e, t) {
|
|
434
435
|
if (!e) return e;
|
|
435
|
-
if (
|
|
436
|
+
if (Ee(e)) return G(await e, t);
|
|
436
437
|
if (H(e)) return Promise.all(e.map((e) => G(e, t)));
|
|
437
|
-
if (!
|
|
438
|
-
let n =
|
|
438
|
+
if (!De(e)) return e;
|
|
439
|
+
let n = ke(e), r = n ? e[n] ?? [] : [];
|
|
439
440
|
switch (H(r) || (r = [r]), n) {
|
|
440
441
|
case "if":
|
|
441
442
|
case "?:":
|
|
@@ -493,32 +494,32 @@ async function G(e, t) {
|
|
|
493
494
|
case "catch": try {
|
|
494
495
|
return await G(r[0], t);
|
|
495
496
|
} catch (e) {
|
|
496
|
-
return
|
|
497
|
+
return De(e) ? await G(e, t) : r[1] ? await G(r[1], e) : e instanceof Error ? e.message : e;
|
|
497
498
|
}
|
|
498
499
|
}
|
|
499
|
-
let i = await Promise.all(r.map((e) => G(e, t))), a = n ?
|
|
500
|
+
let i = await Promise.all(r.map((e) => G(e, t))), a = n ? Oe[n] : void 0;
|
|
500
501
|
if (!a) throw Error(`Unrecognized operation ${n}`);
|
|
501
502
|
return a.apply(t, i);
|
|
502
503
|
}
|
|
503
504
|
async function K(e) {
|
|
504
|
-
return
|
|
505
|
+
return Ee(e) ? K(await e) : !(Array.isArray(e) && e.length === 0) && !!e;
|
|
505
506
|
}
|
|
506
|
-
function
|
|
507
|
+
function ke(e) {
|
|
507
508
|
return Object.keys(e)[0];
|
|
508
509
|
}
|
|
509
510
|
//#endregion
|
|
510
511
|
//#region src/lifecycle/rules-logic.ts
|
|
511
|
-
function
|
|
512
|
+
function Ae(e, t, n) {
|
|
512
513
|
return new Proxy(Object.create(null), { get(r, i) {
|
|
513
514
|
if (typeof i != "string") return;
|
|
514
515
|
let a = e.find((e) => e.key === i);
|
|
515
516
|
if (a !== void 0) return async () => n.has(i) ? !1 : await G(a.logic, {
|
|
516
517
|
...t,
|
|
517
|
-
conditions:
|
|
518
|
+
conditions: Ae(e, t, new Set(n).add(i))
|
|
518
519
|
}) === !0;
|
|
519
520
|
} });
|
|
520
521
|
}
|
|
521
|
-
var
|
|
522
|
+
var je = L(({ client: e }) => k({
|
|
522
523
|
source: {
|
|
523
524
|
stateSnapshot: e.stateSnapshotStore,
|
|
524
525
|
predicates: e.predicates.listStore,
|
|
@@ -557,19 +558,19 @@ var De = L(({ client: e }) => k({
|
|
|
557
558
|
};
|
|
558
559
|
return await G(o, {
|
|
559
560
|
...d,
|
|
560
|
-
conditions:
|
|
561
|
+
conditions: Ae(a, d, /* @__PURE__ */ new Set())
|
|
561
562
|
});
|
|
562
563
|
}
|
|
563
564
|
}));
|
|
564
|
-
function
|
|
565
|
-
return R(
|
|
565
|
+
function Me(e) {
|
|
566
|
+
return R(je, e);
|
|
566
567
|
}
|
|
567
568
|
//#endregion
|
|
568
569
|
//#region src/ping.ts
|
|
569
|
-
var
|
|
570
|
+
var Ne = 6e3, Pe = O("last_ping", "global"), Fe = async (e) => {
|
|
570
571
|
try {
|
|
571
|
-
let t = Date.now(), n = E.get(
|
|
572
|
-
if (n.isSet() && (r = n.json() ?? 0), r && t - r <
|
|
572
|
+
let t = Date.now(), n = E.get(Pe), r = 0;
|
|
573
|
+
if (n.isSet() && (r = n.json() ?? 0), r && t - r < Ne) return !0;
|
|
573
574
|
let i = {
|
|
574
575
|
projectId: e.projectId,
|
|
575
576
|
path: window.location.pathname
|
|
@@ -580,27 +581,27 @@ var ke = 6e3, Ae = O("last_ping", "global"), je = async (e) => {
|
|
|
580
581
|
} catch {
|
|
581
582
|
return !1;
|
|
582
583
|
}
|
|
583
|
-
},
|
|
584
|
-
let t =
|
|
584
|
+
}, q = M("lifecycle"), Ie = L(({ client: e }) => {
|
|
585
|
+
let t = q.store(!1), r = F(void 0, {
|
|
585
586
|
skipVoid: !1,
|
|
586
|
-
domain:
|
|
587
|
+
domain: q
|
|
587
588
|
}), i = F(void 0, {
|
|
588
589
|
skipVoid: !1,
|
|
589
|
-
domain:
|
|
590
|
-
}), a =
|
|
590
|
+
domain: q
|
|
591
|
+
}), a = q.store("idle"), o = q.store([]), s = F(void 0, {
|
|
591
592
|
skipVoid: !1,
|
|
592
|
-
domain:
|
|
593
|
+
domain: q
|
|
593
594
|
}), l = F(void 0, {
|
|
594
595
|
skipVoid: !1,
|
|
595
|
-
domain:
|
|
596
|
+
domain: q
|
|
596
597
|
}), u = P(), d = P(), f = P(), p = P(), m = P(), h = P();
|
|
597
598
|
o.on(p, (e, t) => [...e, t]), s.on(m, (e, t) => t), l.on(h, (e, t) => t), t.on(d, () => !0);
|
|
598
599
|
let g = N(() => {
|
|
599
|
-
|
|
600
|
+
Fe(e);
|
|
600
601
|
}), _ = N(async () => {
|
|
601
602
|
await ee();
|
|
602
603
|
}), v = N(async () => {
|
|
603
|
-
await
|
|
604
|
+
await de(e);
|
|
604
605
|
}), y = k({ effect: v }), b = k({
|
|
605
606
|
source: o,
|
|
606
607
|
effect: async (e) => {
|
|
@@ -725,13 +726,13 @@ var ke = 6e3, Ae = O("last_ping", "global"), je = async (e) => {
|
|
|
725
726
|
setCondition: h
|
|
726
727
|
};
|
|
727
728
|
});
|
|
728
|
-
function
|
|
729
|
-
return R(
|
|
729
|
+
function Le(e) {
|
|
730
|
+
return R(Ie, e);
|
|
730
731
|
}
|
|
731
732
|
//#endregion
|
|
732
733
|
//#region src/entities/predicate/predicate.ts
|
|
733
|
-
var
|
|
734
|
-
let t =
|
|
734
|
+
var Re = M("predicate"), ze = L(({ client: e }) => {
|
|
735
|
+
let t = Re.store({}), n = j(t, { register(e, t) {
|
|
735
736
|
return {
|
|
736
737
|
...e,
|
|
737
738
|
[t.name]: {
|
|
@@ -789,16 +790,16 @@ var Pe = M("predicate"), Fe = L(({ client: e }) => {
|
|
|
789
790
|
getEvokablePredicate: s
|
|
790
791
|
};
|
|
791
792
|
});
|
|
792
|
-
function
|
|
793
|
-
return R(
|
|
793
|
+
function Be(e) {
|
|
794
|
+
return R(ze, e);
|
|
794
795
|
}
|
|
795
|
-
var
|
|
796
|
+
var Ve = (e, t, n) => {
|
|
796
797
|
n.register({
|
|
797
798
|
name: e,
|
|
798
799
|
predicate: t
|
|
799
800
|
});
|
|
800
|
-
},
|
|
801
|
-
let t =
|
|
801
|
+
}, He = M("feature"), Ue = L(({ client: e }) => {
|
|
802
|
+
let t = He.store({}), n = He.store([]), i = j(t, { register(e, t) {
|
|
802
803
|
return {
|
|
803
804
|
...e,
|
|
804
805
|
[t.id]: t.feature
|
|
@@ -963,16 +964,16 @@ var Le = (e, t, n) => {
|
|
|
963
964
|
getEvokableFeature: p
|
|
964
965
|
};
|
|
965
966
|
});
|
|
966
|
-
function
|
|
967
|
-
return R(
|
|
967
|
+
function We(e) {
|
|
968
|
+
return R(Ue, e);
|
|
968
969
|
}
|
|
969
|
-
var
|
|
970
|
+
var Ge = (e, t, n) => {
|
|
970
971
|
n.register({
|
|
971
972
|
id: e,
|
|
972
973
|
feature: t
|
|
973
974
|
});
|
|
974
|
-
},
|
|
975
|
-
function
|
|
975
|
+
}, J = M("history");
|
|
976
|
+
function Ke(e, t) {
|
|
976
977
|
return {
|
|
977
978
|
id: re(`history-entry-${Date.now()}-${Math.random()}}`),
|
|
978
979
|
node: t,
|
|
@@ -980,9 +981,9 @@ function Ve(e, t) {
|
|
|
980
981
|
experienceId: e
|
|
981
982
|
};
|
|
982
983
|
}
|
|
983
|
-
var
|
|
984
|
-
let e =
|
|
985
|
-
e.on(t, (e, t) => ({ entries: [...e.entries,
|
|
984
|
+
var qe = L(() => {
|
|
985
|
+
let e = J.store({ entries: [] }), t = J.event(), n = J.event(), r = J.event(), i = J.event();
|
|
986
|
+
e.on(t, (e, t) => ({ entries: [...e.entries, Ke(t.experienceId, t.node)] })), e.on(n, (e, t) => ({ entries: [...e.entries.slice(0, -1), Ke(t.experienceId, t.node)] })), e.on(i, (e, t) => t);
|
|
986
987
|
function a(e, t) {
|
|
987
988
|
let n = {
|
|
988
989
|
lastStepIndex: -1,
|
|
@@ -1012,20 +1013,20 @@ var He = L(() => {
|
|
|
1012
1013
|
entriesStore: e.map((e) => e.entries)
|
|
1013
1014
|
};
|
|
1014
1015
|
});
|
|
1015
|
-
function
|
|
1016
|
-
return R(
|
|
1016
|
+
function Je() {
|
|
1017
|
+
return R(qe);
|
|
1017
1018
|
}
|
|
1018
1019
|
//#endregion
|
|
1019
1020
|
//#region src/utils/events.ts
|
|
1020
|
-
var
|
|
1021
|
+
var Ye = 0, Xe = (e) => {
|
|
1021
1022
|
let t = F([]);
|
|
1022
1023
|
return t.on(e, (e, t) => [...e, {
|
|
1023
|
-
id:
|
|
1024
|
+
id: Ye++,
|
|
1024
1025
|
at: /* @__PURE__ */ new Date(),
|
|
1025
1026
|
payload: t
|
|
1026
1027
|
}]), t;
|
|
1027
|
-
},
|
|
1028
|
-
let e =
|
|
1028
|
+
}, Ze = M("field"), Qe = L(() => {
|
|
1029
|
+
let e = Ze.store({}), t = j(e, {
|
|
1029
1030
|
register(e, t) {
|
|
1030
1031
|
return {
|
|
1031
1032
|
...e,
|
|
@@ -1073,13 +1074,13 @@ var We = 0, Ge = (e) => {
|
|
|
1073
1074
|
getByName: c
|
|
1074
1075
|
};
|
|
1075
1076
|
});
|
|
1076
|
-
function
|
|
1077
|
-
return R(
|
|
1077
|
+
function $e() {
|
|
1078
|
+
return R(Qe);
|
|
1078
1079
|
}
|
|
1079
1080
|
//#endregion
|
|
1080
1081
|
//#region src/entities/step/step.ts
|
|
1081
|
-
var
|
|
1082
|
-
let e =
|
|
1082
|
+
var et = M("step"), tt = L(() => {
|
|
1083
|
+
let e = et.store({}), t = j(e, { register(e, t) {
|
|
1083
1084
|
return {
|
|
1084
1085
|
...e,
|
|
1085
1086
|
[t.step.id]: t.step
|
|
@@ -1103,45 +1104,66 @@ var Ye = M("step"), Xe = L(() => {
|
|
|
1103
1104
|
indexStore: e
|
|
1104
1105
|
};
|
|
1105
1106
|
});
|
|
1106
|
-
function
|
|
1107
|
-
return R(
|
|
1107
|
+
function nt() {
|
|
1108
|
+
return R(tt);
|
|
1108
1109
|
}
|
|
1109
|
-
function
|
|
1110
|
+
function rt(e, t) {
|
|
1110
1111
|
t.register(e);
|
|
1111
1112
|
}
|
|
1112
1113
|
//#endregion
|
|
1113
1114
|
//#region src/entities/content/content.ts
|
|
1114
|
-
var
|
|
1115
|
-
let e =
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1115
|
+
var it = M("content"), at = L(() => {
|
|
1116
|
+
let e = it.store({}), t = j(e, {
|
|
1117
|
+
register(e, t) {
|
|
1118
|
+
return {
|
|
1119
|
+
...e,
|
|
1120
|
+
[t.content.id]: t.content
|
|
1121
|
+
};
|
|
1122
|
+
},
|
|
1123
|
+
patch(e, t) {
|
|
1124
|
+
let n = e[t.id];
|
|
1125
|
+
if (!n) return e;
|
|
1126
|
+
let r = t.apply(n.data);
|
|
1127
|
+
return r === n.data ? e : {
|
|
1128
|
+
...e,
|
|
1129
|
+
[t.id]: {
|
|
1130
|
+
...n,
|
|
1131
|
+
data: r
|
|
1132
|
+
}
|
|
1133
|
+
};
|
|
1134
|
+
}
|
|
1135
|
+
});
|
|
1121
1136
|
function n(e) {
|
|
1122
1137
|
t.register({ content: e });
|
|
1123
1138
|
}
|
|
1124
|
-
|
|
1125
|
-
|
|
1139
|
+
function r(e, n) {
|
|
1140
|
+
t.patch({
|
|
1141
|
+
id: e,
|
|
1142
|
+
apply: n
|
|
1143
|
+
});
|
|
1144
|
+
}
|
|
1145
|
+
let i = e.map((e) => Object.values(e));
|
|
1146
|
+
function a(t) {
|
|
1126
1147
|
return e.map((e) => e[t] ?? null, { skipVoid: !1 });
|
|
1127
1148
|
}
|
|
1128
1149
|
return {
|
|
1129
1150
|
register: n,
|
|
1130
|
-
|
|
1131
|
-
|
|
1151
|
+
patch: r,
|
|
1152
|
+
getById: a,
|
|
1153
|
+
listStore: i,
|
|
1132
1154
|
indexStore: e
|
|
1133
1155
|
};
|
|
1134
1156
|
});
|
|
1135
|
-
function
|
|
1136
|
-
return R(
|
|
1157
|
+
function ot() {
|
|
1158
|
+
return R(at);
|
|
1137
1159
|
}
|
|
1138
|
-
function
|
|
1160
|
+
function st(e, t) {
|
|
1139
1161
|
t.register(e);
|
|
1140
1162
|
}
|
|
1141
1163
|
//#endregion
|
|
1142
1164
|
//#region src/entities/action/action.ts
|
|
1143
|
-
var
|
|
1144
|
-
let t =
|
|
1165
|
+
var ct = M("action"), lt = L(({ client: e }) => {
|
|
1166
|
+
let t = ct.store({}), n = j(t, { register(e, t) {
|
|
1145
1167
|
return {
|
|
1146
1168
|
...e,
|
|
1147
1169
|
[t.key]: {
|
|
@@ -1199,10 +1221,10 @@ var rt = M("action"), it = L(({ client: e }) => {
|
|
|
1199
1221
|
getEvokableAction: s
|
|
1200
1222
|
};
|
|
1201
1223
|
});
|
|
1202
|
-
function
|
|
1203
|
-
return R(
|
|
1224
|
+
function ut(e) {
|
|
1225
|
+
return R(lt, e);
|
|
1204
1226
|
}
|
|
1205
|
-
var
|
|
1227
|
+
var dt = (e, t, n) => {
|
|
1206
1228
|
n.register({
|
|
1207
1229
|
key: e,
|
|
1208
1230
|
action: t
|
|
@@ -1210,7 +1232,7 @@ var ot = (e, t, n) => {
|
|
|
1210
1232
|
};
|
|
1211
1233
|
//#endregion
|
|
1212
1234
|
//#region src/entities/response/response-validation.ts
|
|
1213
|
-
function
|
|
1235
|
+
function Y(e, t, n, r) {
|
|
1214
1236
|
return {
|
|
1215
1237
|
fieldKey: e.key,
|
|
1216
1238
|
userMessage: n,
|
|
@@ -1218,62 +1240,62 @@ function Z(e, t, n, r) {
|
|
|
1218
1240
|
value: t
|
|
1219
1241
|
};
|
|
1220
1242
|
}
|
|
1221
|
-
function
|
|
1243
|
+
function X(e) {
|
|
1222
1244
|
return e === null || e === "" || Array.isArray(e) && !e.length;
|
|
1223
1245
|
}
|
|
1224
|
-
function
|
|
1246
|
+
function ft(e) {
|
|
1225
1247
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
|
|
1226
1248
|
}
|
|
1227
|
-
function
|
|
1249
|
+
function pt(e) {
|
|
1228
1250
|
try {
|
|
1229
1251
|
return JSON.stringify(e), !0;
|
|
1230
1252
|
} catch {
|
|
1231
1253
|
return !1;
|
|
1232
1254
|
}
|
|
1233
1255
|
}
|
|
1234
|
-
function
|
|
1256
|
+
function mt(e, t) {
|
|
1235
1257
|
return t.find((t) => t.key === e) ?? null;
|
|
1236
1258
|
}
|
|
1237
|
-
function
|
|
1259
|
+
function ht(e, t) {
|
|
1238
1260
|
return e.multiple && (typeof t == "string" || typeof t == "number" || typeof t == "boolean") ? [t] : t;
|
|
1239
1261
|
}
|
|
1240
|
-
function
|
|
1241
|
-
if (e.type !== "object" ||
|
|
1262
|
+
function gt(e, t) {
|
|
1263
|
+
if (e.type !== "object" || X(t)) return null;
|
|
1242
1264
|
if (e.multiple) {
|
|
1243
|
-
if (!Array.isArray(t)) return
|
|
1265
|
+
if (!Array.isArray(t)) return Y(e, t, "This field expects multiple values", "Field expects an array of objects.");
|
|
1244
1266
|
for (let n of t) {
|
|
1245
|
-
if (typeof n != "object" || !n) return
|
|
1246
|
-
if (!
|
|
1267
|
+
if (typeof n != "object" || !n) return Y(e, t, "This field expects object values", "Field expects an array of objects, but received non-object value.");
|
|
1268
|
+
if (!pt(n)) return Y(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
|
|
1247
1269
|
}
|
|
1248
1270
|
return null;
|
|
1249
1271
|
}
|
|
1250
|
-
return Array.isArray(t) ?
|
|
1272
|
+
return Array.isArray(t) ? Y(e, t, "This field expects a single value", "Field expects a single object, not an array.") : typeof t != "object" || !t ? Y(e, t, "This field expects an object value", "Field expects an object value.") : pt(t) ? null : Y(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
|
|
1251
1273
|
}
|
|
1252
|
-
function
|
|
1253
|
-
if (
|
|
1274
|
+
function _t(e, t) {
|
|
1275
|
+
if (X(t) || !Array.isArray(e.options) || e.options.length === 0) return null;
|
|
1254
1276
|
let n = Array.isArray(t) ? t : [t];
|
|
1255
1277
|
if (e.type === "object") {
|
|
1256
1278
|
let r = new Set(e.options.map((e) => JSON.stringify(e.value)));
|
|
1257
|
-
return n.every((e) => r.has(JSON.stringify(e))) ? null :
|
|
1279
|
+
return n.every((e) => r.has(JSON.stringify(e))) ? null : Y(e, t, "This field expects a valid option", "Field expects a valid option from the defined choices.");
|
|
1258
1280
|
}
|
|
1259
1281
|
let r = e.options.map((e) => e.value);
|
|
1260
|
-
return n.every((e) => !
|
|
1282
|
+
return n.every((e) => !ft(e) || e === null ? !1 : r.includes(e)) ? null : Y(e, t, "This field expects a valid option", `Field expects a valid option. Valid options are: ${r.join(", ")}`);
|
|
1261
1283
|
}
|
|
1262
|
-
async function
|
|
1263
|
-
if (n.validation && !e(n.validation) && !
|
|
1284
|
+
async function vt(t, n, r, i) {
|
|
1285
|
+
if (n.validation && !e(n.validation) && !X(r)) {
|
|
1264
1286
|
let e = i ? {
|
|
1265
1287
|
$input: r,
|
|
1266
1288
|
responses: i
|
|
1267
1289
|
} : { $input: r }, a = await t(n.validation, e);
|
|
1268
|
-
if (typeof a == "string") return
|
|
1269
|
-
if (a === !1) return
|
|
1290
|
+
if (typeof a == "string") return Y(n, r, a, `Field validation resulted in an error: ${a}.`);
|
|
1291
|
+
if (a === !1) return Y(n, r, "This field is invalid", "Field validation resulted in an unspecified error.");
|
|
1270
1292
|
}
|
|
1271
|
-
return n.required &&
|
|
1293
|
+
return n.required && X(r) ? Y(n, r, "This field is required", "Field is required.") : !n.multiple && Array.isArray(r) && r.length > 1 ? Y(n, r, "This field expects a single response", "Field expects a single response.") : null;
|
|
1272
1294
|
}
|
|
1273
1295
|
//#endregion
|
|
1274
1296
|
//#region src/entities/response/response.ts
|
|
1275
|
-
var
|
|
1276
|
-
let t =
|
|
1297
|
+
var yt = M("response"), bt = L(({ client: e }) => {
|
|
1298
|
+
let t = yt.store({}), r = P(), i = P(), a = j(t, {
|
|
1277
1299
|
register(e, t) {
|
|
1278
1300
|
return {
|
|
1279
1301
|
...e,
|
|
@@ -1312,7 +1334,7 @@ var mt = M("response"), ht = L(({ client: e }) => {
|
|
|
1312
1334
|
...t,
|
|
1313
1335
|
...n
|
|
1314
1336
|
}, o = Object.entries(n), c = await Promise.allSettled(o.map(async ([t, n]) => {
|
|
1315
|
-
let o =
|
|
1337
|
+
let o = mt(t, e);
|
|
1316
1338
|
if (!o) {
|
|
1317
1339
|
r.push({
|
|
1318
1340
|
fieldKey: t,
|
|
@@ -1322,17 +1344,17 @@ var mt = M("response"), ht = L(({ client: e }) => {
|
|
|
1322
1344
|
});
|
|
1323
1345
|
return;
|
|
1324
1346
|
}
|
|
1325
|
-
let c =
|
|
1347
|
+
let c = ht(o, n), l = await vt(s, o, c, a);
|
|
1326
1348
|
if (l) {
|
|
1327
1349
|
r.push(l);
|
|
1328
1350
|
return;
|
|
1329
1351
|
}
|
|
1330
|
-
let u =
|
|
1352
|
+
let u = gt(o, c);
|
|
1331
1353
|
if (u) {
|
|
1332
1354
|
r.push(u);
|
|
1333
1355
|
return;
|
|
1334
1356
|
}
|
|
1335
|
-
let d =
|
|
1357
|
+
let d = _t(o, c);
|
|
1336
1358
|
if (d) {
|
|
1337
1359
|
r.push(d);
|
|
1338
1360
|
return;
|
|
@@ -1411,13 +1433,13 @@ var mt = M("response"), ht = L(({ client: e }) => {
|
|
|
1411
1433
|
getByFieldName: _
|
|
1412
1434
|
};
|
|
1413
1435
|
});
|
|
1414
|
-
function
|
|
1415
|
-
return R(
|
|
1436
|
+
function xt(e) {
|
|
1437
|
+
return R(bt, e);
|
|
1416
1438
|
}
|
|
1417
1439
|
//#endregion
|
|
1418
1440
|
//#region src/entities/condition/condition.ts
|
|
1419
|
-
var
|
|
1420
|
-
let e =
|
|
1441
|
+
var St = M("condition"), Ct = L(() => {
|
|
1442
|
+
let e = St.store({}), t = j(e, { register(e, t) {
|
|
1421
1443
|
return {
|
|
1422
1444
|
...e,
|
|
1423
1445
|
[t.condition.id]: t.condition
|
|
@@ -1441,12 +1463,12 @@ var _t = M("condition"), vt = L(() => {
|
|
|
1441
1463
|
indexStore: e
|
|
1442
1464
|
};
|
|
1443
1465
|
});
|
|
1444
|
-
function
|
|
1445
|
-
return R(
|
|
1466
|
+
function wt() {
|
|
1467
|
+
return R(Ct);
|
|
1446
1468
|
}
|
|
1447
1469
|
//#endregion
|
|
1448
1470
|
//#region src/utils/api-url.ts
|
|
1449
|
-
function
|
|
1471
|
+
function Tt() {
|
|
1450
1472
|
if (c()) {
|
|
1451
1473
|
let e = [
|
|
1452
1474
|
document.currentScript,
|
|
@@ -1461,7 +1483,7 @@ function bt() {
|
|
|
1461
1483
|
}
|
|
1462
1484
|
//#endregion
|
|
1463
1485
|
//#region src/utils/search-params.ts
|
|
1464
|
-
function
|
|
1486
|
+
function Et() {
|
|
1465
1487
|
if (!s()) return {};
|
|
1466
1488
|
let e = new URLSearchParams(window.location.search), t = {}, n = /* @__PURE__ */ new Set();
|
|
1467
1489
|
for (let [t] of e.entries()) t.startsWith("picked-") && n.add(t);
|
|
@@ -1479,13 +1501,13 @@ function xt() {
|
|
|
1479
1501
|
}
|
|
1480
1502
|
//#endregion
|
|
1481
1503
|
//#region src/entities/session/session.ts
|
|
1482
|
-
var
|
|
1483
|
-
function
|
|
1504
|
+
var Dt = O("session", "global");
|
|
1505
|
+
function Ot() {
|
|
1484
1506
|
return p() ? 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)}`;
|
|
1485
1507
|
}
|
|
1486
|
-
function
|
|
1508
|
+
function kt() {
|
|
1487
1509
|
if (!m()) return null;
|
|
1488
|
-
let e = E.get(
|
|
1510
|
+
let e = E.get(Dt);
|
|
1489
1511
|
if (!e.isSet()) return null;
|
|
1490
1512
|
try {
|
|
1491
1513
|
return e.json();
|
|
@@ -1493,8 +1515,8 @@ function wt() {
|
|
|
1493
1515
|
return null;
|
|
1494
1516
|
}
|
|
1495
1517
|
}
|
|
1496
|
-
var
|
|
1497
|
-
let e =
|
|
1518
|
+
var At = L(() => {
|
|
1519
|
+
let e = kt(), t = { id: e?.id ?? Ot() };
|
|
1498
1520
|
e?.isUser !== void 0 && (t.isUser = e.isUser), e?.identifiers && Object.keys(e.identifiers).length > 0 && (t.identifiers = e.identifiers);
|
|
1499
1521
|
let n = F(t), r = j(n, {
|
|
1500
1522
|
setIsUser: (e, t) => ({
|
|
@@ -1523,7 +1545,7 @@ var Tt = L(() => {
|
|
|
1523
1545
|
source: n,
|
|
1524
1546
|
effect: (e) => {
|
|
1525
1547
|
if (m()) try {
|
|
1526
|
-
E.get(
|
|
1548
|
+
E.get(Dt).set(e);
|
|
1527
1549
|
} catch {}
|
|
1528
1550
|
}
|
|
1529
1551
|
})
|
|
@@ -1534,39 +1556,39 @@ var Tt = L(() => {
|
|
|
1534
1556
|
removeIdentifier: r.removeIdentifier
|
|
1535
1557
|
};
|
|
1536
1558
|
});
|
|
1537
|
-
function
|
|
1538
|
-
return R(
|
|
1559
|
+
function jt() {
|
|
1560
|
+
return R(At, void 0);
|
|
1539
1561
|
}
|
|
1540
1562
|
//#endregion
|
|
1541
1563
|
//#region src/utils/picked-config.ts
|
|
1542
|
-
function
|
|
1564
|
+
function Mt() {
|
|
1543
1565
|
if (s()) return globalThis.window.pickedConfig;
|
|
1544
1566
|
}
|
|
1545
|
-
function
|
|
1546
|
-
if (s()) return
|
|
1567
|
+
function Nt() {
|
|
1568
|
+
if (s()) return Mt()?.projectId;
|
|
1547
1569
|
}
|
|
1548
|
-
function
|
|
1570
|
+
function Pt() {
|
|
1549
1571
|
if (!c()) return;
|
|
1550
1572
|
let e = document.getElementById("picked_script") || document.querySelector("script#picked") || document.getElementById("cvly");
|
|
1551
1573
|
if (e) return e.dataset.projectid || e.getAttribute("project-id") || void 0;
|
|
1552
1574
|
}
|
|
1553
|
-
function
|
|
1575
|
+
function Ft(e) {
|
|
1554
1576
|
if (e.projectId) return e.projectId;
|
|
1555
|
-
let t =
|
|
1577
|
+
let t = Nt();
|
|
1556
1578
|
if (t) return t;
|
|
1557
|
-
let n =
|
|
1579
|
+
let n = Pt();
|
|
1558
1580
|
if (n) return n;
|
|
1559
1581
|
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.");
|
|
1560
1582
|
}
|
|
1561
1583
|
//#endregion
|
|
1562
1584
|
//#region src/utils/render-string.ts
|
|
1563
|
-
function
|
|
1585
|
+
function Z(e) {
|
|
1564
1586
|
return e == null || e === "" || Number.isNaN(e);
|
|
1565
1587
|
}
|
|
1566
|
-
var
|
|
1567
|
-
default: (e, t) =>
|
|
1568
|
-
append: (e, t) => t &&
|
|
1569
|
-
prepend: (e, t) => t &&
|
|
1588
|
+
var It = {
|
|
1589
|
+
default: (e, t) => Z(e) ? String(t ?? "") : String(e),
|
|
1590
|
+
append: (e, t) => t && !Z(e) ? `${e} ${t}` : e,
|
|
1591
|
+
prepend: (e, t) => t && !Z(e) ? `${t} ${e}` : e,
|
|
1570
1592
|
upper: (e) => typeof e == "string" ? e.toUpperCase() : e,
|
|
1571
1593
|
lower: (e) => typeof e == "string" ? e.toLowerCase() : e,
|
|
1572
1594
|
capitalize: (e) => typeof e == "string" ? e.charAt(0).toUpperCase() + e.slice(1) : e,
|
|
@@ -1584,24 +1606,24 @@ var jt = {
|
|
|
1584
1606
|
return e instanceof Set ? t.format(Array.from(e).map(String)) : e;
|
|
1585
1607
|
}
|
|
1586
1608
|
};
|
|
1587
|
-
function
|
|
1609
|
+
function Lt(e) {
|
|
1588
1610
|
return typeof e == "object" && !!e;
|
|
1589
1611
|
}
|
|
1590
|
-
function
|
|
1612
|
+
function Rt(e, t) {
|
|
1591
1613
|
let n = t;
|
|
1592
|
-
for (let t of e.split(".")) if (
|
|
1614
|
+
for (let t of e.split(".")) if (Lt(n) && t in n) n = n[t];
|
|
1593
1615
|
else return;
|
|
1594
1616
|
return typeof n == "function" ? n() : n;
|
|
1595
1617
|
}
|
|
1596
|
-
function
|
|
1597
|
-
let n = e.split("|").map((e) => e.trim()), r =
|
|
1618
|
+
function zt(e, t) {
|
|
1619
|
+
let n = e.split("|").map((e) => e.trim()), r = Rt(n.shift() ?? "", t);
|
|
1598
1620
|
for (let e of n) {
|
|
1599
|
-
let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o =
|
|
1621
|
+
let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o = It[i];
|
|
1600
1622
|
o && (r = o(r, a));
|
|
1601
1623
|
}
|
|
1602
|
-
return
|
|
1624
|
+
return Z(r) ? "" : typeof r == "object" ? JSON.stringify(r) : String(r);
|
|
1603
1625
|
}
|
|
1604
|
-
function
|
|
1626
|
+
function Bt(e, t) {
|
|
1605
1627
|
let n = "", r = 0;
|
|
1606
1628
|
for (; r < e.length;) if (e[r] === "{" && e[r + 1] === "{") {
|
|
1607
1629
|
r += 2;
|
|
@@ -1613,17 +1635,24 @@ function Ft(e, t) {
|
|
|
1613
1635
|
}
|
|
1614
1636
|
i += e[r++];
|
|
1615
1637
|
}
|
|
1616
|
-
n +=
|
|
1638
|
+
n += zt(i.trim(), t);
|
|
1617
1639
|
} else n += e[r++];
|
|
1618
1640
|
return n;
|
|
1619
1641
|
}
|
|
1620
1642
|
//#endregion
|
|
1643
|
+
//#region src/utils/preview-session.ts
|
|
1644
|
+
var Q = "preview-token";
|
|
1645
|
+
function Vt() {
|
|
1646
|
+
return !s() || !h() ? !1 : !!Et()[Q]?.[0];
|
|
1647
|
+
}
|
|
1648
|
+
//#endregion
|
|
1621
1649
|
//#region src/picked.ts
|
|
1622
|
-
var
|
|
1650
|
+
var Ht = class {
|
|
1623
1651
|
static logger = r;
|
|
1624
1652
|
options;
|
|
1625
1653
|
dataSource = null;
|
|
1626
1654
|
contentLoader;
|
|
1655
|
+
previewEmbedderOrigins = null;
|
|
1627
1656
|
plugins = {};
|
|
1628
1657
|
eventBus = P();
|
|
1629
1658
|
events;
|
|
@@ -1631,66 +1660,66 @@ var It = class {
|
|
|
1631
1660
|
apiUrl;
|
|
1632
1661
|
dashboardUrl;
|
|
1633
1662
|
documentationSiteUrl;
|
|
1634
|
-
session =
|
|
1635
|
-
searchParams =
|
|
1636
|
-
history =
|
|
1637
|
-
components =
|
|
1663
|
+
session = jt();
|
|
1664
|
+
searchParams = Et();
|
|
1665
|
+
history = Je();
|
|
1666
|
+
components = ve({ client: this });
|
|
1638
1667
|
experienceInstances = S({ client: this });
|
|
1639
|
-
experiences =
|
|
1640
|
-
frameworks =
|
|
1641
|
-
predicates =
|
|
1642
|
-
features =
|
|
1643
|
-
conditions =
|
|
1644
|
-
fields =
|
|
1645
|
-
responses =
|
|
1646
|
-
steps =
|
|
1647
|
-
contents =
|
|
1648
|
-
actions =
|
|
1668
|
+
experiences = ue({ client: this });
|
|
1669
|
+
frameworks = xe({ client: this });
|
|
1670
|
+
predicates = Be({ client: this });
|
|
1671
|
+
features = We({ client: this });
|
|
1672
|
+
conditions = wt();
|
|
1673
|
+
fields = $e();
|
|
1674
|
+
responses = xt({ client: this });
|
|
1675
|
+
steps = nt();
|
|
1676
|
+
contents = ot();
|
|
1677
|
+
actions = ut({ client: this });
|
|
1649
1678
|
conditionResults = C();
|
|
1650
|
-
stateSnapshotStore =
|
|
1651
|
-
evaluateRuleLogicFx =
|
|
1679
|
+
stateSnapshotStore = we({ client: this });
|
|
1680
|
+
evaluateRuleLogicFx = Me({ client: this });
|
|
1652
1681
|
start;
|
|
1653
1682
|
readyStore;
|
|
1654
1683
|
preconditionPassedStore;
|
|
1655
1684
|
conditionPassedStore;
|
|
1656
1685
|
lifecycleStageStore;
|
|
1657
|
-
lifecycle =
|
|
1686
|
+
lifecycle = Le({ client: this });
|
|
1658
1687
|
renderStringFx = k({
|
|
1659
1688
|
source: this.responses.listStore,
|
|
1660
1689
|
effect: (e, { template: t, context: n }) => {
|
|
1661
1690
|
let r = {};
|
|
1662
1691
|
for (let t of e) r[t.fieldKey] = t.value;
|
|
1663
|
-
return
|
|
1692
|
+
return Bt(t, {
|
|
1664
1693
|
...n,
|
|
1665
1694
|
responses: r
|
|
1666
1695
|
});
|
|
1667
1696
|
}
|
|
1668
1697
|
});
|
|
1669
1698
|
constructor(e) {
|
|
1670
|
-
this.events =
|
|
1699
|
+
this.events = Xe(this.eventBus), this.projectId = Ft(e), this.options = Object.freeze(e), this.apiUrl = e.apiUrl || Tt(), 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.setupComponents(), this.lifecycle.setPrecondition(e.precondition), this.lifecycle.setCondition(e.condition), this.eventBus({
|
|
1671
1700
|
type: "load",
|
|
1672
1701
|
version: ne()
|
|
1673
|
-
}), this.
|
|
1702
|
+
}), this.maybeStartPreviewChannel();
|
|
1674
1703
|
}
|
|
1675
|
-
|
|
1676
|
-
|
|
1704
|
+
maybeStartPreviewChannel() {
|
|
1705
|
+
Vt() && import("../preview-channel-DW9J8t4B.js").then((e) => e.initPreviewChannel(this)).catch(() => void 0);
|
|
1677
1706
|
}
|
|
1678
1707
|
registerFramework = (e) => {
|
|
1679
|
-
|
|
1708
|
+
Se(e, this.frameworks);
|
|
1680
1709
|
};
|
|
1681
1710
|
registerComponent = (e, t) => {
|
|
1682
1711
|
B(e, t, this.components);
|
|
1683
1712
|
};
|
|
1684
1713
|
registerPlugin = (e) => {
|
|
1685
|
-
|
|
1714
|
+
pe(this, e, this.plugins);
|
|
1686
1715
|
let t = this.plugins[e.name];
|
|
1687
1716
|
t?.onStart && this.lifecycle.registerPluginStartHook(t.onStart);
|
|
1688
1717
|
};
|
|
1689
1718
|
registerFeature = (e, t) => {
|
|
1690
|
-
|
|
1719
|
+
Ge(e, t, this.features);
|
|
1691
1720
|
};
|
|
1692
1721
|
registerPredicate = (e, t) => {
|
|
1693
|
-
|
|
1722
|
+
Ve(e, t, this.predicates);
|
|
1694
1723
|
};
|
|
1695
1724
|
registerCondition = (e) => {
|
|
1696
1725
|
this.conditions.register(e);
|
|
@@ -1699,13 +1728,16 @@ var It = class {
|
|
|
1699
1728
|
this.fields.register(e);
|
|
1700
1729
|
};
|
|
1701
1730
|
registerStep = (e) => {
|
|
1702
|
-
|
|
1731
|
+
rt(e, this.steps);
|
|
1703
1732
|
};
|
|
1704
1733
|
registerContent = (e) => {
|
|
1705
|
-
|
|
1734
|
+
st(e, this.contents);
|
|
1735
|
+
};
|
|
1736
|
+
patchContent = (e, t) => {
|
|
1737
|
+
this.contents.patch(e, t);
|
|
1706
1738
|
};
|
|
1707
1739
|
registerAction = (e, t) => {
|
|
1708
|
-
|
|
1740
|
+
dt(e, t, this.actions);
|
|
1709
1741
|
};
|
|
1710
1742
|
registerExperience = (e) => {
|
|
1711
1743
|
e.component && B(`experience:${e.id}`, e.component, this.components), this.experiences.register(e);
|
|
@@ -1790,8 +1822,8 @@ var It = class {
|
|
|
1790
1822
|
});
|
|
1791
1823
|
}
|
|
1792
1824
|
getPluginConfig = (e) => this.plugins[e] ?? {};
|
|
1793
|
-
},
|
|
1794
|
-
async function
|
|
1825
|
+
}, Ut = "application/picked-javascript", Wt = "application/picked-module", Gt = "data-picked-hydrated";
|
|
1826
|
+
async function $(e) {
|
|
1795
1827
|
if (!("document" in globalThis)) return;
|
|
1796
1828
|
let t = "application/picked-module", n = "data-picked-hydrated";
|
|
1797
1829
|
function r(e, t) {
|
|
@@ -1810,30 +1842,30 @@ async function Bt(e) {
|
|
|
1810
1842
|
n && await n;
|
|
1811
1843
|
}
|
|
1812
1844
|
}
|
|
1813
|
-
function
|
|
1814
|
-
return `<script>(${
|
|
1845
|
+
function Kt() {
|
|
1846
|
+
return `<script>(${$.toString()})(document)<\/script>`;
|
|
1815
1847
|
}
|
|
1816
1848
|
//#endregion
|
|
1817
1849
|
//#region src/utils/html-asset-value.ts
|
|
1818
|
-
function
|
|
1850
|
+
function qt(e) {
|
|
1819
1851
|
return typeof e == "object" && !!e && "id" in e && typeof e.id == "string" && "content" in e && (typeof e.content == "string" || e.content === null);
|
|
1820
1852
|
}
|
|
1821
1853
|
//#endregion
|
|
1822
1854
|
//#region src/entities/component/lazyComponent.ts
|
|
1823
|
-
function
|
|
1855
|
+
function Jt(e) {
|
|
1824
1856
|
return {
|
|
1825
1857
|
$$type: "lazy-component",
|
|
1826
1858
|
load: e
|
|
1827
1859
|
};
|
|
1828
1860
|
}
|
|
1829
|
-
function
|
|
1861
|
+
function Yt(e) {
|
|
1830
1862
|
return typeof e == "object" && !!e && "$$type" in e && e.$$type === "lazy-component";
|
|
1831
1863
|
}
|
|
1832
1864
|
//#endregion
|
|
1833
1865
|
//#region src/exports.ts
|
|
1834
|
-
var
|
|
1835
|
-
let t = new
|
|
1866
|
+
var Xt = (e) => {
|
|
1867
|
+
let t = new Ht(e);
|
|
1836
1868
|
return u(t), t;
|
|
1837
1869
|
};
|
|
1838
1870
|
//#endregion
|
|
1839
|
-
export {
|
|
1871
|
+
export { Gt as PICKED_HYDRATED_ATTR, Wt as PICKED_MODULE_SCRIPT_TYPE, Ut as PICKED_SCRIPT_TYPE, Q as PREVIEW_TOKEN_PARAM, Ht as Picked, Kt as buildRehydrateBootstrap, Xt as createClient, fe as createPluginEffect, O as createStorageKey, n as evaluateRuleLogic, Mt as getPickedConfig, qt as isHtmlAssetValue, h as isInsideIframe, Yt as isLazyLoader, _ as isPickedRoot, Vt as isPreviewSession, Jt as lazyComponent, E as localStore, oe as onInertScriptSubtrees, $ as rehydrateScripts, ie as reportInertScriptSubtrees, ae as resetInertScriptReport, D as sessionStore, T as subscribe, d as supportsCookies, p as supportsCryptoRandomUUID, c as supportsDocument, i as supportsHistory, f as supportsIntersectionObserver, m as supportsLocalStorage, a as supportsLocation, l as supportsSessionStorage, g as supportsShadowRoot, o as supportsWebComponents, s as supportsWindow };
|