@picked/client 0.0.1-dev.1787788898336 → 0.0.1-dev.1789541668638
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-DU4j3Qw0.js → api-C7q_7vxn.js} +1 -1
- package/dist/{api-9gq3GBPF.cjs → api-Ctvh1qkk.cjs} +1 -1
- package/dist/cjs/index.js +2 -2
- 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/plugins/telemetry/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/docs/how-to/invite-and-remove-members.md +3 -2
- package/dist/docs/reference/dashboard/fields.mdx +17 -11
- package/dist/docs/reference/sdk/features.md +5 -0
- package/dist/docs/reference/sdk/fields.md +38 -6
- package/dist/docs/reference/sdk/type-generation.md +18 -7
- package/dist/docs/reference/tools/mcp.md +3 -1
- package/dist/esm/index.js +258 -239
- package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
- package/dist/esm/plugins/responses-browser-storage/index.js +50 -16
- package/dist/esm/plugins/responses-indexeddb/index.js +1 -1
- package/dist/esm/plugins/telemetry/index.js +6 -3
- package/dist/esm/server/index.js +13 -13
- package/dist/{experience-instance-DGk11d8a.js → experience-instance-B9S6Yf0N.js} +302 -154
- package/dist/experience-instance-D8rOg6We.cjs +1 -0
- package/dist/{plugin-CYXHEafF.js → plugin-ChafFq6S.js} +3 -2
- package/dist/{plugin-rwzR9hVc.cjs → plugin-Dn25Gffy.cjs} +1 -1
- package/dist/{provider-BWDd3oaq.js → provider-B8wvmeC8.js} +15 -11
- package/dist/provider-BBLlQOjV.cjs +1 -0
- package/dist/types/client.d.ts +21 -0
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/data-source/provider.d.ts +3 -3
- package/dist/types/data-source/provider.d.ts.map +1 -1
- package/dist/types/data-source/request-observer.d.ts +23 -19
- package/dist/types/data-source/request-observer.d.ts.map +1 -1
- package/dist/types/entities/experience/experience.d.ts +8 -0
- 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/feature/feature.d.ts.map +1 -1
- package/dist/types/entities/field/field.d.ts +26 -7
- package/dist/types/entities/field/field.d.ts.map +1 -1
- package/dist/types/entities/field/policies.d.ts +35 -0
- package/dist/types/entities/field/policies.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lifecycle/lifecycle.d.ts +1 -1
- package/dist/types/lifecycle/lifecycle.d.ts.map +1 -1
- package/dist/types/picked.d.ts +4 -13
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +3 -8
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/dist/types/plugins/responses-browser-storage/plugin.d.ts +11 -0
- package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/plugins/telemetry/plugin.d.ts +2 -2
- package/dist/types/plugins/telemetry/plugin.d.ts.map +1 -1
- package/dist/types/utils/client-telemetry.d.ts +25 -0
- package/dist/types/utils/client-telemetry.d.ts.map +1 -0
- package/dist/types/utils/node-tree/min-max-steps-to-leaf.d.ts +16 -6
- package/dist/types/utils/node-tree/min-max-steps-to-leaf.d.ts.map +1 -1
- package/dist/types/utils/node-tree/min-max-steps-to-origin.d.ts +18 -7
- package/dist/types/utils/node-tree/min-max-steps-to-origin.d.ts.map +1 -1
- package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts +30 -6
- package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts.map +1 -1
- package/dist/types/utils/node-tree/node-adjacency.d.ts +50 -0
- package/dist/types/utils/node-tree/node-adjacency.d.ts.map +1 -0
- package/dist/types/utils/node-tree/node-tree-index.d.ts +57 -0
- package/dist/types/utils/node-tree/node-tree-index.d.ts.map +1 -0
- package/dist/{version-BaI_1eQx.cjs → version-CLjPfmxk.cjs} +1 -1
- package/dist/{version-DXDZM7eT.js → version-CPKulHMH.js} +2 -2
- package/package.json +5 -5
- package/dist/experience-instance-Dej3P1sE.cjs +0 -1
- package/dist/provider-lgLyP_0N.cjs +0 -1
- package/dist/types/ping.d.ts +0 -11
- package/dist/types/ping.d.ts.map +0 -1
package/dist/esm/index.js
CHANGED
|
@@ -3,14 +3,13 @@ import { n as t, t as n } from "../rules-logic-HesIUCu6.js";
|
|
|
3
3
|
import { t as r } from "../logger-DMN6TxJJ.js";
|
|
4
4
|
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, p, r as m, s as h, t as g, u as _ } from "../supports-CO9bJGNl.js";
|
|
5
5
|
import { a as v, i as y, r as ee, s as b, t as x } from "../dom-BqcToNL0.js";
|
|
6
|
-
import {
|
|
7
|
-
import { i as
|
|
8
|
-
import { i as
|
|
9
|
-
import { t as
|
|
10
|
-
import { n as
|
|
11
|
-
import { attach as k, combine as A, createApi as j, createDomain as M, createEffect as N, createEvent as P, createStore as F, is as
|
|
6
|
+
import { d as S, l as C, n as w, r as te, u as T } from "../experience-instance-B9S6Yf0N.js";
|
|
7
|
+
import { i as ne, n as E, r as D, t as O } from "../storage-1MW3-_As.js";
|
|
8
|
+
import { i as re, n as ie, r as ae, t as oe } from "../version-CPKulHMH.js";
|
|
9
|
+
import { t as se } from "../id-Bo4RBeOs.js";
|
|
10
|
+
import { n as ce, r as le, t as ue } from "../inert-script-report-B_bMPRzp.js";
|
|
11
|
+
import { attach as k, combine as A, createApi as j, createDomain as M, createEffect as N, createEvent as P, createStore as F, is as de, sample as I } from "effector";
|
|
12
12
|
import { createFactory as L, invoke as R } from "@withease/factories";
|
|
13
|
-
import { sendPing as de } from "@picked/delivery-api-client";
|
|
14
13
|
//#region src/entities/experience/experience.ts
|
|
15
14
|
var z = M("experience"), fe = L(({ client: e, experience: r }) => {
|
|
16
15
|
let i = z.store(r), a = j(i, { merge(e, t) {
|
|
@@ -24,33 +23,33 @@ var z = M("experience"), fe = L(({ client: e, experience: r }) => {
|
|
|
24
23
|
targetSelectors: e.targets,
|
|
25
24
|
initializeOpenLogic: e.initializeOpen
|
|
26
25
|
})), s = A(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 = A(i, e.steps.indexStore, e.conditions.indexStore, (e, t, n) => {
|
|
27
|
-
let r = e.nodes.filter(
|
|
26
|
+
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
27
|
return {
|
|
29
28
|
steps: r,
|
|
30
29
|
nodes: e.nodes,
|
|
31
30
|
edges: e.edges,
|
|
32
31
|
conditions: i
|
|
33
32
|
};
|
|
34
|
-
}), l = r.actions ?? [],
|
|
33
|
+
}), l = i.map((e) => C(e.nodes, e.edges)), u = r.actions ?? [], d, f = k({
|
|
35
34
|
source: o,
|
|
36
35
|
effect: (t, n) => {
|
|
37
36
|
let i = y(t.targetSelectors, r.id);
|
|
38
37
|
i.forEach(({ elements: e }) => e.forEach((e) => b(e, r.id))), x(i, r.id, r.key).forEach((t) => {
|
|
39
|
-
n ? e.experienceInstances.spawn(
|
|
38
|
+
n ? e.experienceInstances.spawn(d, t, n) : e.experienceInstances.spawn(d, t);
|
|
40
39
|
});
|
|
41
40
|
}
|
|
42
|
-
}),
|
|
41
|
+
}), p = A({
|
|
43
42
|
preconditionPassed: e.preconditionPassedStore,
|
|
44
43
|
isUser: e.session.store.map((e) => e.isUser, { skipVoid: !1 }),
|
|
45
44
|
config: o
|
|
46
|
-
}),
|
|
47
|
-
source:
|
|
45
|
+
}), m = k({
|
|
46
|
+
source: p,
|
|
48
47
|
effect: async ({ preconditionPassed: i, isUser: a, config: o }) => {
|
|
49
48
|
if (!i || !a) return !1;
|
|
50
49
|
let { decisionLogic: s, targetSelectors: c } = o;
|
|
51
50
|
return c.length === 0 || y(c, r.id).length < 1 ? !1 : s === void 0 || !t(s) || await n(e, s) === !0;
|
|
52
51
|
}
|
|
53
|
-
}),
|
|
52
|
+
}), h = N(async () => {
|
|
54
53
|
if (!e.contentLoader) return !0;
|
|
55
54
|
try {
|
|
56
55
|
await e.contentLoader({
|
|
@@ -61,43 +60,44 @@ var z = M("experience"), fe = L(({ client: e, experience: r }) => {
|
|
|
61
60
|
`${r.id}`;
|
|
62
61
|
}
|
|
63
62
|
return !0;
|
|
64
|
-
}),
|
|
63
|
+
}), g = P(), _ = P(), v = z.createStore(void 0, { skipVoid: !1 }).on(g, (e, t) => t).on(_, (e, t) => t);
|
|
65
64
|
return I({
|
|
66
|
-
clock:
|
|
67
|
-
target:
|
|
65
|
+
clock: g,
|
|
66
|
+
target: m
|
|
68
67
|
}), I({
|
|
69
|
-
clock:
|
|
70
|
-
source:
|
|
68
|
+
clock: m.doneData,
|
|
69
|
+
source: v,
|
|
71
70
|
filter: (e, t) => t,
|
|
72
71
|
fn: (e) => e,
|
|
73
|
-
target:
|
|
72
|
+
target: f
|
|
74
73
|
}), I({
|
|
75
|
-
clock:
|
|
74
|
+
clock: m.doneData,
|
|
76
75
|
filter: Boolean,
|
|
77
|
-
target:
|
|
76
|
+
target: h
|
|
78
77
|
}), I({
|
|
79
|
-
clock:
|
|
80
|
-
source:
|
|
78
|
+
clock: _,
|
|
79
|
+
source: v,
|
|
81
80
|
fn: (e) => e,
|
|
82
|
-
target:
|
|
81
|
+
target: f
|
|
83
82
|
}), I({
|
|
84
|
-
clock:
|
|
85
|
-
target:
|
|
86
|
-
}),
|
|
83
|
+
clock: _,
|
|
84
|
+
target: h
|
|
85
|
+
}), d = {
|
|
87
86
|
id: r.id,
|
|
88
87
|
key: r.key,
|
|
89
88
|
name: r.name,
|
|
90
89
|
configStore: o,
|
|
91
90
|
treeStore: c,
|
|
91
|
+
nodeTreeStore: l,
|
|
92
92
|
componentStore: s,
|
|
93
|
-
actions:
|
|
93
|
+
actions: u,
|
|
94
94
|
merge: a.merge,
|
|
95
|
-
initialiseFx:
|
|
96
|
-
shouldInitialiseFx:
|
|
97
|
-
initialiseRequested:
|
|
98
|
-
initialiseDirectly:
|
|
99
|
-
prepareExperienceContentFx:
|
|
100
|
-
},
|
|
95
|
+
initialiseFx: f,
|
|
96
|
+
shouldInitialiseFx: m,
|
|
97
|
+
initialiseRequested: g,
|
|
98
|
+
initialiseDirectly: _,
|
|
99
|
+
prepareExperienceContentFx: h
|
|
100
|
+
}, d;
|
|
101
101
|
});
|
|
102
102
|
function pe(e) {
|
|
103
103
|
return R(fe, e);
|
|
@@ -565,22 +565,8 @@ function Re(e) {
|
|
|
565
565
|
return R(Le, e);
|
|
566
566
|
}
|
|
567
567
|
//#endregion
|
|
568
|
-
//#region src/
|
|
569
|
-
var
|
|
570
|
-
try {
|
|
571
|
-
let t = Date.now(), n = E.get(Be), r = 0;
|
|
572
|
-
if (n.isSet() && (r = n.json() ?? 0), r && t - r < ze) return !0;
|
|
573
|
-
let i = {}, a = document.getElementById("picked_script")?.dataset.verceltoken;
|
|
574
|
-
a && (i["x-vercel-protection-bypass"] = a);
|
|
575
|
-
let o = await de(e.apiUrl, {
|
|
576
|
-
projectId: e.projectId,
|
|
577
|
-
path: window.location.pathname
|
|
578
|
-
}, { headers: i });
|
|
579
|
-
return o && n.set(t), o;
|
|
580
|
-
} catch {
|
|
581
|
-
return !1;
|
|
582
|
-
}
|
|
583
|
-
}, K = M("lifecycle"), He = L(({ client: e }) => {
|
|
568
|
+
//#region src/lifecycle/lifecycle.ts
|
|
569
|
+
var K = M("lifecycle"), ze = L(({ client: e }) => {
|
|
584
570
|
let t = K.store(!1), r = F(void 0, {
|
|
585
571
|
skipVoid: !1,
|
|
586
572
|
domain: K
|
|
@@ -595,72 +581,67 @@ var ze = 6e3, Be = O("last_ping", "global"), Ve = async (e) => {
|
|
|
595
581
|
domain: K
|
|
596
582
|
}), u = P(), d = P(), f = P(), p = P(), m = P(), h = P();
|
|
597
583
|
o.on(p, (e, t) => [...e, t]), s.on(m, (e, t) => t), l.on(h, (e, t) => t), t.on(d, () => !0);
|
|
598
|
-
let g = N(() => {
|
|
599
|
-
Ve(e);
|
|
600
|
-
}), _ = N(async () => {
|
|
584
|
+
let g = N(async () => {
|
|
601
585
|
await ee();
|
|
602
|
-
}),
|
|
586
|
+
}), _ = N(async () => {
|
|
603
587
|
await ge(e);
|
|
604
|
-
}),
|
|
588
|
+
}), v = k({ effect: _ }), y = k({
|
|
605
589
|
source: o,
|
|
606
590
|
effect: async (e) => {
|
|
607
591
|
for (let t of e) await t();
|
|
608
592
|
}
|
|
609
|
-
}),
|
|
593
|
+
}), b = k({
|
|
610
594
|
source: s,
|
|
611
595
|
effect: async (t) => t === void 0 ? !0 : typeof t == "boolean" ? t : await n(e, t) === !0
|
|
612
|
-
}),
|
|
596
|
+
}), x = k({
|
|
613
597
|
source: l,
|
|
614
598
|
effect: async (t) => t === void 0 ? !0 : typeof t == "boolean" ? t : await n(e, t) === !0
|
|
615
|
-
}),
|
|
599
|
+
}), S = I({
|
|
616
600
|
clock: u,
|
|
617
601
|
source: a,
|
|
618
602
|
filter: (e) => e === "idle" && c(),
|
|
619
603
|
fn: () => void 0
|
|
620
604
|
});
|
|
621
605
|
I({
|
|
622
|
-
clock:
|
|
606
|
+
clock: S,
|
|
623
607
|
fn: () => "starting",
|
|
624
608
|
target: a
|
|
625
|
-
}),
|
|
626
|
-
clock:
|
|
609
|
+
}), S.watch(e.performance.markBegin), d.watch(e.performance.measure), I({
|
|
610
|
+
clock: S,
|
|
611
|
+
target: y
|
|
612
|
+
}), I({
|
|
613
|
+
clock: S,
|
|
627
614
|
target: g
|
|
628
615
|
}), I({
|
|
629
|
-
clock:
|
|
616
|
+
clock: y.done,
|
|
630
617
|
target: b
|
|
631
618
|
}), I({
|
|
632
|
-
clock:
|
|
633
|
-
target: _
|
|
634
|
-
}), I({
|
|
635
|
-
clock: b.done,
|
|
636
|
-
target: x
|
|
637
|
-
}), I({
|
|
638
|
-
clock: x.doneData,
|
|
619
|
+
clock: b.doneData,
|
|
639
620
|
target: r
|
|
640
621
|
}), I({
|
|
641
|
-
clock:
|
|
622
|
+
clock: x.doneData,
|
|
642
623
|
target: i
|
|
643
624
|
}), I({
|
|
644
|
-
clock:
|
|
625
|
+
clock: b.doneData,
|
|
645
626
|
filter: (e) => e,
|
|
646
|
-
target:
|
|
627
|
+
target: x
|
|
647
628
|
}), I({
|
|
648
|
-
clock:
|
|
629
|
+
clock: x.doneData,
|
|
649
630
|
target: e.session.setIsUser
|
|
650
631
|
}), I({
|
|
651
|
-
clock:
|
|
632
|
+
clock: x.doneData,
|
|
652
633
|
fn: (e) => ({
|
|
653
634
|
type: "user_decide",
|
|
654
635
|
value: e
|
|
655
636
|
}),
|
|
656
637
|
target: e.eventBus
|
|
657
638
|
}), I({
|
|
658
|
-
clock:
|
|
639
|
+
clock: b.doneData,
|
|
659
640
|
filter: (e) => !e,
|
|
660
641
|
fn: () => void 0,
|
|
661
642
|
target: f
|
|
662
643
|
}), I({
|
|
663
|
-
clock:
|
|
644
|
+
clock: x.doneData,
|
|
664
645
|
fn: () => void 0,
|
|
665
646
|
target: f
|
|
666
647
|
}), I({
|
|
@@ -668,24 +649,24 @@ var ze = 6e3, Be = O("last_ping", "global"), Ve = async (e) => {
|
|
|
668
649
|
fn: () => ({ type: "initialize" }),
|
|
669
650
|
target: e.eventBus
|
|
670
651
|
});
|
|
671
|
-
let
|
|
652
|
+
let C = F(!1).on(g.done, () => !0), w = F(!1).on(f, () => !0), te = F(!1).on(v.done, () => !0), T = A(r, i, (e, t) => e === !0 && t === !0);
|
|
672
653
|
I({
|
|
673
654
|
clock: f,
|
|
674
|
-
source:
|
|
655
|
+
source: T,
|
|
675
656
|
filter: (e) => e,
|
|
676
657
|
fn: () => void 0,
|
|
677
|
-
target:
|
|
658
|
+
target: _
|
|
678
659
|
});
|
|
679
|
-
let
|
|
660
|
+
let ne = A(C, w, T, (e, t, n) => e && t && n);
|
|
680
661
|
I({
|
|
681
|
-
clock:
|
|
662
|
+
clock: ne,
|
|
682
663
|
filter: (e) => e,
|
|
683
664
|
fn: () => void 0,
|
|
684
|
-
target:
|
|
665
|
+
target: v
|
|
685
666
|
});
|
|
686
|
-
let
|
|
667
|
+
let E = A(C, w, T, te, (e, t, n, r) => e && t && (!n || r));
|
|
687
668
|
return I({
|
|
688
|
-
clock:
|
|
669
|
+
clock: E,
|
|
689
670
|
filter: (e) => e,
|
|
690
671
|
fn: () => void 0,
|
|
691
672
|
target: d
|
|
@@ -709,12 +690,12 @@ var ze = 6e3, Be = O("last_ping", "global"), Ve = async (e) => {
|
|
|
709
690
|
target: e.eventBus
|
|
710
691
|
}), I({
|
|
711
692
|
clock: [
|
|
693
|
+
y.fail,
|
|
712
694
|
b.fail,
|
|
713
695
|
x.fail,
|
|
714
|
-
|
|
696
|
+
_.fail,
|
|
715
697
|
v.fail,
|
|
716
|
-
|
|
717
|
-
_.fail
|
|
698
|
+
g.fail
|
|
718
699
|
],
|
|
719
700
|
fn: () => "failed",
|
|
720
701
|
target: a
|
|
@@ -729,13 +710,13 @@ var ze = 6e3, Be = O("last_ping", "global"), Ve = async (e) => {
|
|
|
729
710
|
setCondition: h
|
|
730
711
|
};
|
|
731
712
|
});
|
|
732
|
-
function
|
|
733
|
-
return R(
|
|
713
|
+
function Be(e) {
|
|
714
|
+
return R(ze, e);
|
|
734
715
|
}
|
|
735
716
|
//#endregion
|
|
736
717
|
//#region src/entities/predicate/predicate.ts
|
|
737
|
-
var
|
|
738
|
-
let t =
|
|
718
|
+
var Ve = M("predicate"), He = L(({ client: e }) => {
|
|
719
|
+
let t = Ve.store({}), n = j(t, { register(e, t) {
|
|
739
720
|
return {
|
|
740
721
|
...e,
|
|
741
722
|
[t.name]: {
|
|
@@ -793,26 +774,26 @@ var We = M("predicate"), Ge = L(({ client: e }) => {
|
|
|
793
774
|
getEvokablePredicate: s
|
|
794
775
|
};
|
|
795
776
|
});
|
|
796
|
-
function
|
|
797
|
-
return R(
|
|
777
|
+
function Ue(e) {
|
|
778
|
+
return R(He, e);
|
|
798
779
|
}
|
|
799
|
-
var
|
|
780
|
+
var We = (e, t, n) => {
|
|
800
781
|
n.register({
|
|
801
782
|
name: e,
|
|
802
783
|
predicate: t
|
|
803
784
|
});
|
|
804
785
|
}, q = M("history");
|
|
805
|
-
function
|
|
786
|
+
function Ge(e, t) {
|
|
806
787
|
return {
|
|
807
|
-
id:
|
|
788
|
+
id: se(`history-entry-${Date.now()}-${Math.random()}}`),
|
|
808
789
|
node: t,
|
|
809
790
|
at: Date.now(),
|
|
810
791
|
experienceId: e
|
|
811
792
|
};
|
|
812
793
|
}
|
|
813
|
-
var
|
|
794
|
+
var Ke = L(() => {
|
|
814
795
|
let e = q.store({ entries: [] }), t = q.event(), n = q.event(), r = q.event(), i = q.event();
|
|
815
|
-
e.on(t, (e, t) => ({ entries: [...e.entries,
|
|
796
|
+
e.on(t, (e, t) => ({ entries: [...e.entries, Ge(t.experienceId, t.node)] })), e.on(n, (e, t) => ({ entries: [...e.entries.slice(0, -1), Ge(t.experienceId, t.node)] })), e.on(i, (e, t) => t);
|
|
816
797
|
function a(e, t) {
|
|
817
798
|
let n = {
|
|
818
799
|
lastStepIndex: -1,
|
|
@@ -820,7 +801,7 @@ var Ye = L(() => {
|
|
|
820
801
|
};
|
|
821
802
|
for (let r = e.length - 1; r >= 0; r--) {
|
|
822
803
|
let i = e[r], a = i?.node;
|
|
823
|
-
if (!(!a || !
|
|
804
|
+
if (!(!a || !S(a)) && !(t && i.experienceId !== t)) if (n.lastStepIndex === -1) n.lastStepIndex = r;
|
|
824
805
|
else {
|
|
825
806
|
n.secondLastStepIndex = r;
|
|
826
807
|
break;
|
|
@@ -842,32 +823,49 @@ var Ye = L(() => {
|
|
|
842
823
|
entriesStore: e.map((e) => e.entries)
|
|
843
824
|
};
|
|
844
825
|
});
|
|
845
|
-
function
|
|
846
|
-
return R(
|
|
826
|
+
function qe() {
|
|
827
|
+
return R(Ke);
|
|
847
828
|
}
|
|
848
829
|
//#endregion
|
|
849
830
|
//#region src/utils/events.ts
|
|
850
|
-
var
|
|
831
|
+
var Je = 0, Ye = (e) => {
|
|
851
832
|
let t = F([]);
|
|
852
833
|
return t.on(e, (e, t) => [...e, {
|
|
853
|
-
id:
|
|
834
|
+
id: Je++,
|
|
854
835
|
at: /* @__PURE__ */ new Date(),
|
|
855
836
|
payload: t
|
|
856
837
|
}]), t;
|
|
857
|
-
}
|
|
858
|
-
|
|
838
|
+
};
|
|
839
|
+
//#endregion
|
|
840
|
+
//#region src/entities/field/policies.ts
|
|
841
|
+
function Xe(e) {
|
|
842
|
+
let { doNotTrackValue: t, doNotStoreValue: n } = e ?? {}, r = e?.trackValue ?? t === !1, i = e?.storeValue ?? n === !1;
|
|
843
|
+
return {
|
|
844
|
+
trackValue: r,
|
|
845
|
+
storeValue: i,
|
|
846
|
+
doNotTrackValue: !r,
|
|
847
|
+
doNotStoreValue: !i
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
//#endregion
|
|
851
|
+
//#region src/entities/field/field.ts
|
|
852
|
+
var Ze = M("field"), Qe = L(() => {
|
|
853
|
+
let e = Ze.store({}), t = j(e, {
|
|
859
854
|
register(e, t) {
|
|
855
|
+
let n = Object.assign({}, t.field, { policies: Xe(t.field.policies) });
|
|
860
856
|
return {
|
|
861
857
|
...e,
|
|
862
|
-
[
|
|
858
|
+
[n.id]: n
|
|
863
859
|
};
|
|
864
860
|
},
|
|
865
861
|
updateByKey(e, t) {
|
|
866
862
|
let n = Object.values(e).find((e) => e.key === t.fieldKey);
|
|
867
|
-
|
|
863
|
+
if (!n) return e;
|
|
864
|
+
let r = Object.assign({}, n, t.updates);
|
|
865
|
+
return {
|
|
868
866
|
...e,
|
|
869
|
-
[n.id]: Object.assign({},
|
|
870
|
-
}
|
|
867
|
+
[n.id]: Object.assign({}, r, { policies: Xe(r.policies) })
|
|
868
|
+
};
|
|
871
869
|
}
|
|
872
870
|
});
|
|
873
871
|
function n(e) {
|
|
@@ -903,13 +901,13 @@ var Ze = 0, Qe = (e) => {
|
|
|
903
901
|
getByName: c
|
|
904
902
|
};
|
|
905
903
|
});
|
|
906
|
-
function
|
|
907
|
-
return R(
|
|
904
|
+
function $e() {
|
|
905
|
+
return R(Qe);
|
|
908
906
|
}
|
|
909
907
|
//#endregion
|
|
910
908
|
//#region src/entities/step/step.ts
|
|
911
|
-
var
|
|
912
|
-
let e =
|
|
909
|
+
var et = M("step"), tt = L(() => {
|
|
910
|
+
let e = et.store({}), t = j(e, { register(e, t) {
|
|
913
911
|
return {
|
|
914
912
|
...e,
|
|
915
913
|
[t.step.id]: t.step
|
|
@@ -933,16 +931,16 @@ var nt = M("step"), rt = L(() => {
|
|
|
933
931
|
indexStore: e
|
|
934
932
|
};
|
|
935
933
|
});
|
|
936
|
-
function
|
|
937
|
-
return R(
|
|
934
|
+
function nt() {
|
|
935
|
+
return R(tt);
|
|
938
936
|
}
|
|
939
|
-
function
|
|
937
|
+
function rt(e, t) {
|
|
940
938
|
t.register(e);
|
|
941
939
|
}
|
|
942
940
|
//#endregion
|
|
943
941
|
//#region src/entities/content/content.ts
|
|
944
|
-
var
|
|
945
|
-
let e =
|
|
942
|
+
var it = M("content"), at = L(() => {
|
|
943
|
+
let e = it.store({}), t = j(e, {
|
|
946
944
|
register(e, t) {
|
|
947
945
|
return {
|
|
948
946
|
...e,
|
|
@@ -983,16 +981,16 @@ var ot = M("content"), st = L(() => {
|
|
|
983
981
|
indexStore: e
|
|
984
982
|
};
|
|
985
983
|
});
|
|
986
|
-
function
|
|
987
|
-
return R(
|
|
984
|
+
function ot() {
|
|
985
|
+
return R(at);
|
|
988
986
|
}
|
|
989
|
-
function
|
|
987
|
+
function st(e, t) {
|
|
990
988
|
t.register(e);
|
|
991
989
|
}
|
|
992
990
|
//#endregion
|
|
993
991
|
//#region src/entities/action/action.ts
|
|
994
|
-
var
|
|
995
|
-
let t =
|
|
992
|
+
var ct = M("action"), lt = L(({ client: e }) => {
|
|
993
|
+
let t = ct.store({}), n = j(t, { register(e, t) {
|
|
996
994
|
return {
|
|
997
995
|
...e,
|
|
998
996
|
[t.key]: {
|
|
@@ -1050,10 +1048,10 @@ var ut = M("action"), dt = L(({ client: e }) => {
|
|
|
1050
1048
|
getEvokableAction: s
|
|
1051
1049
|
};
|
|
1052
1050
|
});
|
|
1053
|
-
function
|
|
1054
|
-
return R(
|
|
1051
|
+
function ut(e) {
|
|
1052
|
+
return R(lt, e);
|
|
1055
1053
|
}
|
|
1056
|
-
var
|
|
1054
|
+
var dt = (e, t, n) => {
|
|
1057
1055
|
n.register({
|
|
1058
1056
|
key: e,
|
|
1059
1057
|
action: t
|
|
@@ -1072,35 +1070,35 @@ function J(e, t, n, r) {
|
|
|
1072
1070
|
function Y(e) {
|
|
1073
1071
|
return e === null || e === "" || Array.isArray(e) && !e.length;
|
|
1074
1072
|
}
|
|
1075
|
-
function
|
|
1073
|
+
function ft(e) {
|
|
1076
1074
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
|
|
1077
1075
|
}
|
|
1078
|
-
function
|
|
1076
|
+
function pt(e) {
|
|
1079
1077
|
try {
|
|
1080
1078
|
return JSON.stringify(e), !0;
|
|
1081
1079
|
} catch {
|
|
1082
1080
|
return !1;
|
|
1083
1081
|
}
|
|
1084
1082
|
}
|
|
1085
|
-
function
|
|
1083
|
+
function mt(e, t) {
|
|
1086
1084
|
return t.find((t) => t.key === e) ?? null;
|
|
1087
1085
|
}
|
|
1088
|
-
function
|
|
1086
|
+
function ht(e, t) {
|
|
1089
1087
|
return e.multiple && (typeof t == "string" || typeof t == "number" || typeof t == "boolean") ? [t] : t;
|
|
1090
1088
|
}
|
|
1091
|
-
function
|
|
1089
|
+
function gt(e, t) {
|
|
1092
1090
|
if (e.type !== "object" || Y(t)) return null;
|
|
1093
1091
|
if (e.multiple) {
|
|
1094
1092
|
if (!Array.isArray(t)) return J(e, t, "This field expects multiple values", "Field expects an array of objects.");
|
|
1095
1093
|
for (let n of t) {
|
|
1096
1094
|
if (typeof n != "object" || !n) return J(e, t, "This field expects object values", "Field expects an array of objects, but received non-object value.");
|
|
1097
|
-
if (!
|
|
1095
|
+
if (!pt(n)) return J(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
|
|
1098
1096
|
}
|
|
1099
1097
|
return null;
|
|
1100
1098
|
}
|
|
1101
|
-
return Array.isArray(t) ? J(e, t, "This field expects a single value", "Field expects a single object, not an array.") : typeof t != "object" || !t ? J(e, t, "This field expects an object value", "Field expects an object value.") :
|
|
1099
|
+
return Array.isArray(t) ? J(e, t, "This field expects a single value", "Field expects a single object, not an array.") : typeof t != "object" || !t ? J(e, t, "This field expects an object value", "Field expects an object value.") : pt(t) ? null : J(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
|
|
1102
1100
|
}
|
|
1103
|
-
function
|
|
1101
|
+
function _t(e, t) {
|
|
1104
1102
|
if (Y(t) || !Array.isArray(e.options) || e.options.length === 0) return null;
|
|
1105
1103
|
let n = Array.isArray(t) ? t : [t];
|
|
1106
1104
|
if (e.type === "object") {
|
|
@@ -1108,9 +1106,9 @@ function yt(e, t) {
|
|
|
1108
1106
|
return n.every((e) => r.has(JSON.stringify(e))) ? null : J(e, t, "This field expects a valid option", "Field expects a valid option from the defined choices.");
|
|
1109
1107
|
}
|
|
1110
1108
|
let r = e.options.map((e) => e.value);
|
|
1111
|
-
return n.every((e) => !
|
|
1109
|
+
return n.every((e) => !ft(e) || e === null ? !1 : r.includes(e)) ? null : J(e, t, "This field expects a valid option", `Field expects a valid option. Valid options are: ${r.join(", ")}`);
|
|
1112
1110
|
}
|
|
1113
|
-
async function
|
|
1111
|
+
async function vt(t, n, r, i) {
|
|
1114
1112
|
if (n.validation && !e(n.validation) && !Y(r)) {
|
|
1115
1113
|
let e = i ? {
|
|
1116
1114
|
$input: r,
|
|
@@ -1123,8 +1121,8 @@ async function bt(t, n, r, i) {
|
|
|
1123
1121
|
}
|
|
1124
1122
|
//#endregion
|
|
1125
1123
|
//#region src/entities/response/response.ts
|
|
1126
|
-
var
|
|
1127
|
-
let t =
|
|
1124
|
+
var yt = M("response"), bt = L(({ client: e }) => {
|
|
1125
|
+
let t = yt.store({}), r = P(), i = P(), a = j(t, {
|
|
1128
1126
|
register(e, t) {
|
|
1129
1127
|
return {
|
|
1130
1128
|
...e,
|
|
@@ -1163,7 +1161,7 @@ var xt = M("response"), St = L(({ client: e }) => {
|
|
|
1163
1161
|
...t,
|
|
1164
1162
|
...n
|
|
1165
1163
|
}, o = Object.entries(n), c = await Promise.allSettled(o.map(async ([t, n]) => {
|
|
1166
|
-
let o =
|
|
1164
|
+
let o = mt(t, e);
|
|
1167
1165
|
if (!o) {
|
|
1168
1166
|
r.push({
|
|
1169
1167
|
fieldKey: t,
|
|
@@ -1173,17 +1171,17 @@ var xt = M("response"), St = L(({ client: e }) => {
|
|
|
1173
1171
|
});
|
|
1174
1172
|
return;
|
|
1175
1173
|
}
|
|
1176
|
-
let c =
|
|
1174
|
+
let c = ht(o, n), l = await vt(s, o, c, a);
|
|
1177
1175
|
if (l) {
|
|
1178
1176
|
r.push(l);
|
|
1179
1177
|
return;
|
|
1180
1178
|
}
|
|
1181
|
-
let u =
|
|
1179
|
+
let u = gt(o, c);
|
|
1182
1180
|
if (u) {
|
|
1183
1181
|
r.push(u);
|
|
1184
1182
|
return;
|
|
1185
1183
|
}
|
|
1186
|
-
let d =
|
|
1184
|
+
let d = _t(o, c);
|
|
1187
1185
|
if (d) {
|
|
1188
1186
|
r.push(d);
|
|
1189
1187
|
return;
|
|
@@ -1262,13 +1260,13 @@ var xt = M("response"), St = L(({ client: e }) => {
|
|
|
1262
1260
|
getByFieldName: _
|
|
1263
1261
|
};
|
|
1264
1262
|
});
|
|
1265
|
-
function
|
|
1266
|
-
return R(
|
|
1263
|
+
function xt(e) {
|
|
1264
|
+
return R(bt, e);
|
|
1267
1265
|
}
|
|
1268
1266
|
//#endregion
|
|
1269
1267
|
//#region src/entities/condition/condition.ts
|
|
1270
|
-
var
|
|
1271
|
-
let e =
|
|
1268
|
+
var St = M("condition"), Ct = L(() => {
|
|
1269
|
+
let e = St.store({}), t = j(e, { register(e, t) {
|
|
1272
1270
|
return {
|
|
1273
1271
|
...e,
|
|
1274
1272
|
[t.condition.id]: t.condition
|
|
@@ -1292,12 +1290,12 @@ var wt = M("condition"), Tt = L(() => {
|
|
|
1292
1290
|
indexStore: e
|
|
1293
1291
|
};
|
|
1294
1292
|
});
|
|
1295
|
-
function
|
|
1296
|
-
return R(
|
|
1293
|
+
function wt() {
|
|
1294
|
+
return R(Ct);
|
|
1297
1295
|
}
|
|
1298
1296
|
//#endregion
|
|
1299
1297
|
//#region src/utils/api-url.ts
|
|
1300
|
-
function
|
|
1298
|
+
function Tt() {
|
|
1301
1299
|
if (c()) {
|
|
1302
1300
|
let e = [
|
|
1303
1301
|
document.currentScript,
|
|
@@ -1312,7 +1310,7 @@ function Dt() {
|
|
|
1312
1310
|
}
|
|
1313
1311
|
//#endregion
|
|
1314
1312
|
//#region src/utils/search-params.ts
|
|
1315
|
-
function
|
|
1313
|
+
function Et() {
|
|
1316
1314
|
if (!s()) return {};
|
|
1317
1315
|
let e = new URLSearchParams(window.location.search), t = {}, n = /* @__PURE__ */ new Set();
|
|
1318
1316
|
for (let [t] of e.entries()) t.startsWith("picked-") && n.add(t);
|
|
@@ -1330,25 +1328,25 @@ function Ot() {
|
|
|
1330
1328
|
}
|
|
1331
1329
|
//#endregion
|
|
1332
1330
|
//#region src/utils/user-timing.ts
|
|
1333
|
-
var
|
|
1334
|
-
function
|
|
1331
|
+
var Dt = "picked:start:begin", Ot = "picked:start";
|
|
1332
|
+
function kt() {
|
|
1335
1333
|
try {
|
|
1336
1334
|
return s() && !!p.window && "performance" in p;
|
|
1337
1335
|
} catch {
|
|
1338
1336
|
return !1;
|
|
1339
1337
|
}
|
|
1340
1338
|
}
|
|
1341
|
-
function
|
|
1339
|
+
function At() {
|
|
1342
1340
|
let e = null, t = null;
|
|
1343
1341
|
return {
|
|
1344
1342
|
markBegin: () => {
|
|
1345
|
-
if (
|
|
1346
|
-
e = performance.mark(
|
|
1343
|
+
if (kt()) try {
|
|
1344
|
+
e = performance.mark(Dt).startTime;
|
|
1347
1345
|
} catch {}
|
|
1348
1346
|
},
|
|
1349
1347
|
measure: () => {
|
|
1350
|
-
if (!(!
|
|
1351
|
-
t = performance.measure(
|
|
1348
|
+
if (!(!kt() || e === null)) try {
|
|
1349
|
+
t = performance.measure(Ot, { start: e });
|
|
1352
1350
|
} catch {}
|
|
1353
1351
|
},
|
|
1354
1352
|
get startMeasure() {
|
|
@@ -1357,14 +1355,27 @@ function Mt() {
|
|
|
1357
1355
|
};
|
|
1358
1356
|
}
|
|
1359
1357
|
//#endregion
|
|
1358
|
+
//#region src/utils/client-telemetry.ts
|
|
1359
|
+
function jt() {
|
|
1360
|
+
let e = null;
|
|
1361
|
+
return {
|
|
1362
|
+
observeDeliveryAPIRequests: (t) => {
|
|
1363
|
+
e = t;
|
|
1364
|
+
},
|
|
1365
|
+
get deliveryAPIRequestObserver() {
|
|
1366
|
+
return e;
|
|
1367
|
+
}
|
|
1368
|
+
};
|
|
1369
|
+
}
|
|
1370
|
+
//#endregion
|
|
1360
1371
|
//#region src/entities/session/session.ts
|
|
1361
|
-
var
|
|
1362
|
-
function
|
|
1372
|
+
var Mt = O("session", "global");
|
|
1373
|
+
function Nt() {
|
|
1363
1374
|
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)}`;
|
|
1364
1375
|
}
|
|
1365
|
-
function
|
|
1376
|
+
function Pt() {
|
|
1366
1377
|
if (!h()) return null;
|
|
1367
|
-
let e = E.get(
|
|
1378
|
+
let e = E.get(Mt);
|
|
1368
1379
|
if (!e.isSet()) return null;
|
|
1369
1380
|
try {
|
|
1370
1381
|
return e.json();
|
|
@@ -1372,8 +1383,8 @@ function Ft() {
|
|
|
1372
1383
|
return null;
|
|
1373
1384
|
}
|
|
1374
1385
|
}
|
|
1375
|
-
var
|
|
1376
|
-
let e =
|
|
1386
|
+
var Ft = L(() => {
|
|
1387
|
+
let e = Pt(), t = { id: e?.id ?? Nt() };
|
|
1377
1388
|
e?.isUser !== void 0 && (t.isUser = e.isUser), e?.identifiers && Object.keys(e.identifiers).length > 0 && (t.identifiers = e.identifiers);
|
|
1378
1389
|
let n = F(t), r = j(n, {
|
|
1379
1390
|
setIsUser: (e, t) => ({
|
|
@@ -1399,7 +1410,7 @@ var It = L(() => {
|
|
|
1399
1410
|
source: n,
|
|
1400
1411
|
effect: (e) => {
|
|
1401
1412
|
if (h()) try {
|
|
1402
|
-
E.get(
|
|
1413
|
+
E.get(Mt).set(e);
|
|
1403
1414
|
} catch {}
|
|
1404
1415
|
}
|
|
1405
1416
|
});
|
|
@@ -1413,27 +1424,27 @@ var It = L(() => {
|
|
|
1413
1424
|
removeIdentifier: r.removeIdentifier
|
|
1414
1425
|
};
|
|
1415
1426
|
});
|
|
1416
|
-
function
|
|
1417
|
-
return R(
|
|
1427
|
+
function It() {
|
|
1428
|
+
return R(Ft, void 0);
|
|
1418
1429
|
}
|
|
1419
1430
|
//#endregion
|
|
1420
1431
|
//#region src/utils/picked-config.ts
|
|
1421
|
-
function
|
|
1432
|
+
function Lt() {
|
|
1422
1433
|
if (s()) return globalThis.window.pickedConfig;
|
|
1423
1434
|
}
|
|
1424
|
-
function
|
|
1425
|
-
if (s()) return
|
|
1435
|
+
function Rt() {
|
|
1436
|
+
if (s()) return Lt()?.projectId;
|
|
1426
1437
|
}
|
|
1427
|
-
function
|
|
1438
|
+
function zt() {
|
|
1428
1439
|
if (!c()) return;
|
|
1429
1440
|
let e = document.getElementById("picked_script") || document.querySelector("script#picked") || document.getElementById("cvly");
|
|
1430
1441
|
if (e) return e.dataset.projectid || e.getAttribute("project-id") || void 0;
|
|
1431
1442
|
}
|
|
1432
|
-
function
|
|
1443
|
+
function Bt(e) {
|
|
1433
1444
|
if (e.projectId) return e.projectId;
|
|
1434
|
-
let t =
|
|
1445
|
+
let t = Rt();
|
|
1435
1446
|
if (t) return t;
|
|
1436
|
-
let n =
|
|
1447
|
+
let n = zt();
|
|
1437
1448
|
if (n) return n;
|
|
1438
1449
|
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.");
|
|
1439
1450
|
}
|
|
@@ -1442,7 +1453,7 @@ function Vt(e) {
|
|
|
1442
1453
|
function X(e) {
|
|
1443
1454
|
return e == null || e === "" || Number.isNaN(e);
|
|
1444
1455
|
}
|
|
1445
|
-
var
|
|
1456
|
+
var Vt = {
|
|
1446
1457
|
default: (e, t) => X(e) ? String(t ?? "") : String(e),
|
|
1447
1458
|
append: (e, t) => t && !X(e) ? `${e} ${t}` : e,
|
|
1448
1459
|
prepend: (e, t) => t && !X(e) ? `${t} ${e}` : e,
|
|
@@ -1463,24 +1474,24 @@ var Ht = {
|
|
|
1463
1474
|
return e instanceof Set ? t.format(Array.from(e).map(String)) : e;
|
|
1464
1475
|
}
|
|
1465
1476
|
};
|
|
1466
|
-
function
|
|
1477
|
+
function Ht(e) {
|
|
1467
1478
|
return typeof e == "object" && !!e;
|
|
1468
1479
|
}
|
|
1469
|
-
function
|
|
1480
|
+
function Ut(e, t) {
|
|
1470
1481
|
let n = t;
|
|
1471
|
-
for (let t of e.split(".")) if (
|
|
1482
|
+
for (let t of e.split(".")) if (Ht(n) && t in n) n = n[t];
|
|
1472
1483
|
else return;
|
|
1473
1484
|
return typeof n == "function" ? n() : n;
|
|
1474
1485
|
}
|
|
1475
|
-
function
|
|
1476
|
-
let n = e.split("|").map((e) => e.trim()), r =
|
|
1486
|
+
function Wt(e, t) {
|
|
1487
|
+
let n = e.split("|").map((e) => e.trim()), r = Ut(n.shift() ?? "", t);
|
|
1477
1488
|
for (let e of n) {
|
|
1478
|
-
let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o =
|
|
1489
|
+
let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o = Vt[i];
|
|
1479
1490
|
o && (r = o(r, a));
|
|
1480
1491
|
}
|
|
1481
1492
|
return X(r) ? "" : typeof r == "object" ? JSON.stringify(r) : String(r);
|
|
1482
1493
|
}
|
|
1483
|
-
function
|
|
1494
|
+
function Gt(e, t) {
|
|
1484
1495
|
let n = "", r = 0;
|
|
1485
1496
|
for (; r < e.length;) if (e[r] === "{" && e[r + 1] === "{") {
|
|
1486
1497
|
r += 2;
|
|
@@ -1492,19 +1503,19 @@ function Kt(e, t) {
|
|
|
1492
1503
|
}
|
|
1493
1504
|
i += e[r++];
|
|
1494
1505
|
}
|
|
1495
|
-
n +=
|
|
1506
|
+
n += Wt(i.trim(), t);
|
|
1496
1507
|
} else n += e[r++];
|
|
1497
1508
|
return n;
|
|
1498
1509
|
}
|
|
1499
1510
|
//#endregion
|
|
1500
1511
|
//#region src/utils/preview-session.ts
|
|
1501
|
-
var
|
|
1502
|
-
function
|
|
1503
|
-
return !s() || !g() ? !1 : !!
|
|
1512
|
+
var Kt = "preview-token";
|
|
1513
|
+
function qt() {
|
|
1514
|
+
return !s() || !g() ? !1 : !!Et()[Kt]?.[0];
|
|
1504
1515
|
}
|
|
1505
1516
|
//#endregion
|
|
1506
1517
|
//#region src/picked.ts
|
|
1507
|
-
var
|
|
1518
|
+
var Jt = class {
|
|
1508
1519
|
static logger = r;
|
|
1509
1520
|
options;
|
|
1510
1521
|
dataSource = null;
|
|
@@ -1513,10 +1524,7 @@ var Yt = class {
|
|
|
1513
1524
|
contentLoader;
|
|
1514
1525
|
previewEmbedderOrigins = null;
|
|
1515
1526
|
plugins = {};
|
|
1516
|
-
|
|
1517
|
-
setDeliveryRequestObserver = (e) => {
|
|
1518
|
-
this.deliveryObserver = e;
|
|
1519
|
-
};
|
|
1527
|
+
telemetry = jt();
|
|
1520
1528
|
dataProviders = /* @__PURE__ */ new Map();
|
|
1521
1529
|
eventBus = P();
|
|
1522
1530
|
events;
|
|
@@ -1524,23 +1532,23 @@ var Yt = class {
|
|
|
1524
1532
|
apiUrl;
|
|
1525
1533
|
dashboardUrl;
|
|
1526
1534
|
documentationSiteUrl;
|
|
1527
|
-
session =
|
|
1528
|
-
performance =
|
|
1529
|
-
searchParams =
|
|
1530
|
-
history =
|
|
1535
|
+
session = It();
|
|
1536
|
+
performance = At();
|
|
1537
|
+
searchParams = Et();
|
|
1538
|
+
history = qe();
|
|
1531
1539
|
components = Ce({ client: this });
|
|
1532
|
-
experienceInstances =
|
|
1540
|
+
experienceInstances = w({ client: this });
|
|
1533
1541
|
experiences = he({ client: this });
|
|
1534
1542
|
frameworks = De({ client: this });
|
|
1535
|
-
predicates =
|
|
1536
|
-
features =
|
|
1537
|
-
conditions =
|
|
1538
|
-
fields =
|
|
1539
|
-
responses =
|
|
1540
|
-
steps =
|
|
1541
|
-
contents =
|
|
1542
|
-
actions =
|
|
1543
|
-
conditionResults =
|
|
1543
|
+
predicates = Ue({ client: this });
|
|
1544
|
+
features = ie({ client: this });
|
|
1545
|
+
conditions = wt();
|
|
1546
|
+
fields = $e();
|
|
1547
|
+
responses = xt({ client: this });
|
|
1548
|
+
steps = nt();
|
|
1549
|
+
contents = ot();
|
|
1550
|
+
actions = ut({ client: this });
|
|
1551
|
+
conditionResults = te();
|
|
1544
1552
|
stateSnapshotStore = Ae({ client: this });
|
|
1545
1553
|
evaluateRuleLogicFx = Re({ client: this });
|
|
1546
1554
|
start;
|
|
@@ -1548,31 +1556,31 @@ var Yt = class {
|
|
|
1548
1556
|
preconditionPassedStore;
|
|
1549
1557
|
conditionPassedStore;
|
|
1550
1558
|
lifecycleStageStore;
|
|
1551
|
-
lifecycle =
|
|
1559
|
+
lifecycle = Be({ client: this });
|
|
1552
1560
|
renderStringFx = k({
|
|
1553
1561
|
source: this.responses.listStore,
|
|
1554
1562
|
effect: (e, { template: t, context: n }) => {
|
|
1555
1563
|
let r = {};
|
|
1556
1564
|
for (let t of e) r[t.fieldKey] = t.value;
|
|
1557
|
-
return
|
|
1565
|
+
return Gt(t, {
|
|
1558
1566
|
...n,
|
|
1559
1567
|
responses: r
|
|
1560
1568
|
});
|
|
1561
1569
|
}
|
|
1562
1570
|
});
|
|
1563
1571
|
constructor(e) {
|
|
1564
|
-
this.events =
|
|
1572
|
+
this.events = Ye(this.eventBus), this.projectId = Bt(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.setupFields(), this.setupComponents(), this.lifecycle.setPrecondition(e.precondition), this.lifecycle.setCondition(e.condition), this.eventBus({
|
|
1565
1573
|
type: "load",
|
|
1566
|
-
version:
|
|
1574
|
+
version: oe()
|
|
1567
1575
|
}), this.maybeStartPreviewChannel();
|
|
1568
1576
|
}
|
|
1569
1577
|
dataProviderFor(e) {
|
|
1570
1578
|
let t = e ?? "", n = this.dataProviders.get(t);
|
|
1571
1579
|
if (n) return n;
|
|
1572
|
-
let r = import("../provider-
|
|
1580
|
+
let r = import("../provider-B8wvmeC8.js").then((t) => t.createPickedDataProvider({
|
|
1573
1581
|
apiUrl: this.apiUrl,
|
|
1574
1582
|
projectId: this.projectId,
|
|
1575
|
-
getRequestObserver: () => this.
|
|
1583
|
+
getRequestObserver: () => this.telemetry.deliveryAPIRequestObserver,
|
|
1576
1584
|
...e !== void 0 && { previewToken: e }
|
|
1577
1585
|
}));
|
|
1578
1586
|
return this.dataProviders.set(t, r), r;
|
|
@@ -1586,7 +1594,7 @@ var Yt = class {
|
|
|
1586
1594
|
return (await this.dataProviderFor(t?.previewToken)).getContent(e, t?.signal === void 0 ? void 0 : { signal: t.signal });
|
|
1587
1595
|
}
|
|
1588
1596
|
maybeStartPreviewChannel() {
|
|
1589
|
-
|
|
1597
|
+
qt() && import("../preview-channel-CSr96XAo.js").then((e) => e.initPreviewChannel(this)).catch(() => void 0);
|
|
1590
1598
|
}
|
|
1591
1599
|
registerFramework = (e) => {
|
|
1592
1600
|
Oe(e, this.frameworks);
|
|
@@ -1600,10 +1608,10 @@ var Yt = class {
|
|
|
1600
1608
|
t?.onStart && this.lifecycle.registerPluginStartHook(t.onStart);
|
|
1601
1609
|
};
|
|
1602
1610
|
registerFeature = (e, t) => {
|
|
1603
|
-
|
|
1611
|
+
re(e, t, this.features);
|
|
1604
1612
|
};
|
|
1605
1613
|
registerPredicate = (e, t) => {
|
|
1606
|
-
|
|
1614
|
+
We(e, t, this.predicates);
|
|
1607
1615
|
};
|
|
1608
1616
|
registerCondition = (e) => {
|
|
1609
1617
|
this.conditions.register(e);
|
|
@@ -1612,16 +1620,16 @@ var Yt = class {
|
|
|
1612
1620
|
this.fields.register(e);
|
|
1613
1621
|
};
|
|
1614
1622
|
registerStep = (e) => {
|
|
1615
|
-
|
|
1623
|
+
rt(e, this.steps);
|
|
1616
1624
|
};
|
|
1617
1625
|
registerContent = (e) => {
|
|
1618
|
-
|
|
1626
|
+
st(e, this.contents);
|
|
1619
1627
|
};
|
|
1620
1628
|
patchContent = (e, t) => {
|
|
1621
1629
|
this.contents.patch(e, t);
|
|
1622
1630
|
};
|
|
1623
1631
|
registerAction = (e, t) => {
|
|
1624
|
-
|
|
1632
|
+
dt(e, t, this.actions);
|
|
1625
1633
|
};
|
|
1626
1634
|
registerExperience = (e) => {
|
|
1627
1635
|
e.component && we(`experience:${e.id}`, e.component, this.components), this.experiences.register(e);
|
|
@@ -1667,12 +1675,13 @@ var Yt = class {
|
|
|
1667
1675
|
this.registerFeature(e, n);
|
|
1668
1676
|
}), this.searchParams.feature && this.searchParams.feature.forEach((e) => {
|
|
1669
1677
|
try {
|
|
1670
|
-
let t =
|
|
1678
|
+
let t = ae(e);
|
|
1671
1679
|
if (!t) return;
|
|
1672
1680
|
let { id: n, bucket: r } = t;
|
|
1673
1681
|
this.registerFeature(n, {
|
|
1674
1682
|
key: `${r}`,
|
|
1675
1683
|
name: n,
|
|
1684
|
+
enabled: !0,
|
|
1676
1685
|
decide: () => r,
|
|
1677
1686
|
storage: "session"
|
|
1678
1687
|
});
|
|
@@ -1699,6 +1708,16 @@ var Yt = class {
|
|
|
1699
1708
|
this.registerAction(e, t);
|
|
1700
1709
|
});
|
|
1701
1710
|
}
|
|
1711
|
+
setupFields() {
|
|
1712
|
+
let e = this.options.fields;
|
|
1713
|
+
e && Object.entries(e).forEach(([e, t]) => {
|
|
1714
|
+
let n = typeof t == "function" ? t() : t;
|
|
1715
|
+
this.registerField({
|
|
1716
|
+
...n,
|
|
1717
|
+
key: n.key ?? e
|
|
1718
|
+
});
|
|
1719
|
+
});
|
|
1720
|
+
}
|
|
1702
1721
|
setupComponents() {
|
|
1703
1722
|
let e = this.options.components;
|
|
1704
1723
|
e && Object.entries(e).forEach(([e, t]) => {
|
|
@@ -1706,8 +1725,8 @@ var Yt = class {
|
|
|
1706
1725
|
});
|
|
1707
1726
|
}
|
|
1708
1727
|
getPluginConfig = (e) => this.plugins[e] ?? {};
|
|
1709
|
-
},
|
|
1710
|
-
async function
|
|
1728
|
+
}, Yt = "application/picked-javascript", Xt = "application/picked-module", Zt = "data-picked-hydrated";
|
|
1729
|
+
async function Qt(e) {
|
|
1711
1730
|
if (!("document" in globalThis)) return;
|
|
1712
1731
|
let t = "application/picked-module", n = "data-picked-hydrated";
|
|
1713
1732
|
function r(e) {
|
|
@@ -1736,23 +1755,23 @@ async function $t(e) {
|
|
|
1736
1755
|
a && await a;
|
|
1737
1756
|
}
|
|
1738
1757
|
}
|
|
1739
|
-
function
|
|
1740
|
-
return `<script>(${
|
|
1758
|
+
function $t() {
|
|
1759
|
+
return `<script>(${Qt.toString()})(document)<\/script>`;
|
|
1741
1760
|
}
|
|
1742
1761
|
//#endregion
|
|
1743
1762
|
//#region src/utils/html-asset-value.ts
|
|
1744
|
-
function
|
|
1763
|
+
function en(e) {
|
|
1745
1764
|
return typeof e == "object" && !!e && "id" in e && typeof e.id == "string" && "content" in e && (typeof e.content == "string" || e.content === null);
|
|
1746
1765
|
}
|
|
1747
1766
|
//#endregion
|
|
1748
1767
|
//#region src/entities/component/lazyComponent.ts
|
|
1749
|
-
function
|
|
1768
|
+
function tn(e) {
|
|
1750
1769
|
return {
|
|
1751
1770
|
$$type: "lazy-component",
|
|
1752
1771
|
load: e
|
|
1753
1772
|
};
|
|
1754
1773
|
}
|
|
1755
|
-
function
|
|
1774
|
+
function nn(e) {
|
|
1756
1775
|
return typeof e == "object" && !!e && "$$type" in e && e.$$type === "lazy-component";
|
|
1757
1776
|
}
|
|
1758
1777
|
//#endregion
|
|
@@ -1768,10 +1787,10 @@ function $(e) {
|
|
|
1768
1787
|
for (let e of t) Z(e) && n.push(e.contentEntryId);
|
|
1769
1788
|
return n;
|
|
1770
1789
|
}
|
|
1771
|
-
function
|
|
1790
|
+
function rn(e, t) {
|
|
1772
1791
|
return t === null ? null : e[t] ?? null;
|
|
1773
1792
|
}
|
|
1774
|
-
function
|
|
1793
|
+
function an(e, t) {
|
|
1775
1794
|
let n = [];
|
|
1776
1795
|
for (let r of t) {
|
|
1777
1796
|
let t = e[r];
|
|
@@ -1779,29 +1798,29 @@ function on(e, t) {
|
|
|
1779
1798
|
}
|
|
1780
1799
|
return n;
|
|
1781
1800
|
}
|
|
1782
|
-
function
|
|
1783
|
-
if (
|
|
1801
|
+
function on(e, t) {
|
|
1802
|
+
if (de.store(t)) return A(t, e.indexStore, (e, t) => rn(t, Q(e)));
|
|
1784
1803
|
let n = Q(t);
|
|
1785
|
-
return e.indexStore.map((e) =>
|
|
1804
|
+
return e.indexStore.map((e) => rn(e, n), { skipVoid: !1 });
|
|
1786
1805
|
}
|
|
1787
|
-
function
|
|
1788
|
-
if (
|
|
1806
|
+
function sn(e, t) {
|
|
1807
|
+
if (de.store(t)) return A(t, e.indexStore, (e, t) => an(t, $(e)));
|
|
1789
1808
|
let n = $(t);
|
|
1790
|
-
return e.indexStore.map((e) =>
|
|
1809
|
+
return e.indexStore.map((e) => an(e, n), { skipVoid: !1 });
|
|
1791
1810
|
}
|
|
1792
1811
|
//#endregion
|
|
1793
1812
|
//#region src/exports.ts
|
|
1794
|
-
var
|
|
1795
|
-
let t = new
|
|
1813
|
+
var cn = (e) => {
|
|
1814
|
+
let t = new Jt(e);
|
|
1796
1815
|
return u(t), t;
|
|
1797
1816
|
};
|
|
1798
1817
|
//#endregion
|
|
1799
1818
|
//#region src/typed-content.ts
|
|
1800
|
-
function
|
|
1819
|
+
function ln(e) {
|
|
1801
1820
|
return typeof e.data == "object";
|
|
1802
1821
|
}
|
|
1803
|
-
function
|
|
1804
|
-
return e.map((e) => !e || !
|
|
1822
|
+
function un(e) {
|
|
1823
|
+
return e.map((e) => !e || !ln(e) ? null : e, { skipVoid: !1 });
|
|
1805
1824
|
}
|
|
1806
1825
|
//#endregion
|
|
1807
|
-
export {
|
|
1826
|
+
export { Zt as PICKED_HYDRATED_ATTR, Xt as PICKED_MODULE_SCRIPT_TYPE, Yt as PICKED_SCRIPT_TYPE, Kt as PREVIEW_TOKEN_PARAM, Jt as Picked, $t as buildRehydrateBootstrap, cn as createClient, _e as createPluginEffect, O as createStorageKey, on as deriveReference, sn as deriveReferences, n as evaluateRuleLogic, Lt as getPickedConfig, Z as isContentReference, en as isHtmlAssetValue, g as isInsideIframe, nn as isLazyLoader, v as isPickedRoot, qt as isPreviewSession, tn as lazyComponent, E as localStore, ue as onInertScriptSubtrees, Q as readReferenceId, $ as readReferenceIds, Qt as rehydrateScripts, ce as reportInertScriptSubtrees, le as resetInertScriptReport, D 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, un as toTypedContentStore };
|