@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.
Files changed (72) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/{api-DU4j3Qw0.js → api-C7q_7vxn.js} +1 -1
  3. package/dist/{api-9gq3GBPF.cjs → api-Ctvh1qkk.cjs} +1 -1
  4. package/dist/cjs/index.js +2 -2
  5. package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
  6. package/dist/cjs/plugins/responses-browser-storage/index.js +1 -1
  7. package/dist/cjs/plugins/responses-indexeddb/index.js +1 -1
  8. package/dist/cjs/plugins/telemetry/index.js +1 -1
  9. package/dist/cjs/server/index.js +1 -1
  10. package/dist/docs/how-to/invite-and-remove-members.md +3 -2
  11. package/dist/docs/reference/dashboard/fields.mdx +17 -11
  12. package/dist/docs/reference/sdk/features.md +5 -0
  13. package/dist/docs/reference/sdk/fields.md +38 -6
  14. package/dist/docs/reference/sdk/type-generation.md +18 -7
  15. package/dist/docs/reference/tools/mcp.md +3 -1
  16. package/dist/esm/index.js +258 -239
  17. package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
  18. package/dist/esm/plugins/responses-browser-storage/index.js +50 -16
  19. package/dist/esm/plugins/responses-indexeddb/index.js +1 -1
  20. package/dist/esm/plugins/telemetry/index.js +6 -3
  21. package/dist/esm/server/index.js +13 -13
  22. package/dist/{experience-instance-DGk11d8a.js → experience-instance-B9S6Yf0N.js} +302 -154
  23. package/dist/experience-instance-D8rOg6We.cjs +1 -0
  24. package/dist/{plugin-CYXHEafF.js → plugin-ChafFq6S.js} +3 -2
  25. package/dist/{plugin-rwzR9hVc.cjs → plugin-Dn25Gffy.cjs} +1 -1
  26. package/dist/{provider-BWDd3oaq.js → provider-B8wvmeC8.js} +15 -11
  27. package/dist/provider-BBLlQOjV.cjs +1 -0
  28. package/dist/types/client.d.ts +21 -0
  29. package/dist/types/client.d.ts.map +1 -1
  30. package/dist/types/data-source/provider.d.ts +3 -3
  31. package/dist/types/data-source/provider.d.ts.map +1 -1
  32. package/dist/types/data-source/request-observer.d.ts +23 -19
  33. package/dist/types/data-source/request-observer.d.ts.map +1 -1
  34. package/dist/types/entities/experience/experience.d.ts +8 -0
  35. package/dist/types/entities/experience/experience.d.ts.map +1 -1
  36. package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
  37. package/dist/types/entities/feature/feature.d.ts.map +1 -1
  38. package/dist/types/entities/field/field.d.ts +26 -7
  39. package/dist/types/entities/field/field.d.ts.map +1 -1
  40. package/dist/types/entities/field/policies.d.ts +35 -0
  41. package/dist/types/entities/field/policies.d.ts.map +1 -0
  42. package/dist/types/index.d.ts +1 -0
  43. package/dist/types/index.d.ts.map +1 -1
  44. package/dist/types/lifecycle/lifecycle.d.ts +1 -1
  45. package/dist/types/lifecycle/lifecycle.d.ts.map +1 -1
  46. package/dist/types/picked.d.ts +4 -13
  47. package/dist/types/picked.d.ts.map +1 -1
  48. package/dist/types/plugins/create-experience/create-experience.d.ts +3 -8
  49. package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
  50. package/dist/types/plugins/responses-browser-storage/plugin.d.ts +11 -0
  51. package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +1 -1
  52. package/dist/types/plugins/telemetry/plugin.d.ts +2 -2
  53. package/dist/types/plugins/telemetry/plugin.d.ts.map +1 -1
  54. package/dist/types/utils/client-telemetry.d.ts +25 -0
  55. package/dist/types/utils/client-telemetry.d.ts.map +1 -0
  56. package/dist/types/utils/node-tree/min-max-steps-to-leaf.d.ts +16 -6
  57. package/dist/types/utils/node-tree/min-max-steps-to-leaf.d.ts.map +1 -1
  58. package/dist/types/utils/node-tree/min-max-steps-to-origin.d.ts +18 -7
  59. package/dist/types/utils/node-tree/min-max-steps-to-origin.d.ts.map +1 -1
  60. package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts +30 -6
  61. package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts.map +1 -1
  62. package/dist/types/utils/node-tree/node-adjacency.d.ts +50 -0
  63. package/dist/types/utils/node-tree/node-adjacency.d.ts.map +1 -0
  64. package/dist/types/utils/node-tree/node-tree-index.d.ts +57 -0
  65. package/dist/types/utils/node-tree/node-tree-index.d.ts.map +1 -0
  66. package/dist/{version-BaI_1eQx.cjs → version-CLjPfmxk.cjs} +1 -1
  67. package/dist/{version-DXDZM7eT.js → version-CPKulHMH.js} +2 -2
  68. package/package.json +5 -5
  69. package/dist/experience-instance-Dej3P1sE.cjs +0 -1
  70. package/dist/provider-lgLyP_0N.cjs +0 -1
  71. package/dist/types/ping.d.ts +0 -11
  72. 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 { l as S, n as C, r as w, u as T } from "../experience-instance-DGk11d8a.js";
7
- import { i as te, n as E, r as D, t as O } from "../storage-1MW3-_As.js";
8
- import { i as ne, n as re, r as ie, t as ae } from "../version-DXDZM7eT.js";
9
- import { t as oe } from "../id-Bo4RBeOs.js";
10
- import { n as se, r as ce, t as le } 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 ue, sample as I } from "effector";
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(T).map((e) => t[e.stepId]).filter((e) => e !== void 0), i = e.nodes.filter(S).map((e) => n[e.conditionId]).filter((e) => e !== void 0);
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 ?? [], u, d = k({
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(u, t, n) : e.experienceInstances.spawn(u, t);
38
+ n ? e.experienceInstances.spawn(d, t, n) : e.experienceInstances.spawn(d, t);
40
39
  });
41
40
  }
42
- }), f = A({
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
- }), p = k({
47
- source: f,
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
- }), m = N(async () => {
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
- }), h = P(), g = P(), _ = z.createStore(void 0, { skipVoid: !1 }).on(h, (e, t) => t).on(g, (e, t) => t);
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: h,
67
- target: p
65
+ clock: g,
66
+ target: m
68
67
  }), I({
69
- clock: p.doneData,
70
- source: _,
68
+ clock: m.doneData,
69
+ source: v,
71
70
  filter: (e, t) => t,
72
71
  fn: (e) => e,
73
- target: d
72
+ target: f
74
73
  }), I({
75
- clock: p.doneData,
74
+ clock: m.doneData,
76
75
  filter: Boolean,
77
- target: m
76
+ target: h
78
77
  }), I({
79
- clock: g,
80
- source: _,
78
+ clock: _,
79
+ source: v,
81
80
  fn: (e) => e,
82
- target: d
81
+ target: f
83
82
  }), I({
84
- clock: g,
85
- target: m
86
- }), u = {
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: l,
93
+ actions: u,
94
94
  merge: a.merge,
95
- initialiseFx: d,
96
- shouldInitialiseFx: p,
97
- initialiseRequested: h,
98
- initialiseDirectly: g,
99
- prepareExperienceContentFx: m
100
- }, u;
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/ping.ts
569
- var ze = 6e3, Be = O("last_ping", "global"), Ve = async (e) => {
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
- }), v = N(async () => {
586
+ }), _ = N(async () => {
603
587
  await ge(e);
604
- }), y = k({ effect: v }), b = k({
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
- }), x = k({
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
- }), S = k({
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
- }), C = I({
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: C,
606
+ clock: S,
623
607
  fn: () => "starting",
624
608
  target: a
625
- }), C.watch(e.performance.markBegin), d.watch(e.performance.measure), I({
626
- clock: C,
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: C,
616
+ clock: y.done,
630
617
  target: b
631
618
  }), I({
632
- clock: C,
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: S.doneData,
622
+ clock: x.doneData,
642
623
  target: i
643
624
  }), I({
644
- clock: x.doneData,
625
+ clock: b.doneData,
645
626
  filter: (e) => e,
646
- target: S
627
+ target: x
647
628
  }), I({
648
- clock: S.doneData,
629
+ clock: x.doneData,
649
630
  target: e.session.setIsUser
650
631
  }), I({
651
- clock: S.doneData,
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: x.doneData,
639
+ clock: b.doneData,
659
640
  filter: (e) => !e,
660
641
  fn: () => void 0,
661
642
  target: f
662
643
  }), I({
663
- clock: S.doneData,
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 w = F(!1).on(_.done, () => !0), T = F(!1).on(f, () => !0), te = F(!1).on(y.done, () => !0), E = A(r, i, (e, t) => e === !0 && t === !0);
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: E,
655
+ source: T,
675
656
  filter: (e) => e,
676
657
  fn: () => void 0,
677
- target: v
658
+ target: _
678
659
  });
679
- let D = A(w, T, E, (e, t, n) => e && t && n);
660
+ let ne = A(C, w, T, (e, t, n) => e && t && n);
680
661
  I({
681
- clock: D,
662
+ clock: ne,
682
663
  filter: (e) => e,
683
664
  fn: () => void 0,
684
- target: y
665
+ target: v
685
666
  });
686
- let O = A(w, T, E, te, (e, t, n, r) => e && t && (!n || r));
667
+ let E = A(C, w, T, te, (e, t, n, r) => e && t && (!n || r));
687
668
  return I({
688
- clock: O,
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
- S.fail,
696
+ _.fail,
715
697
  v.fail,
716
- y.fail,
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 Ue(e) {
733
- return R(He, e);
713
+ function Be(e) {
714
+ return R(ze, e);
734
715
  }
735
716
  //#endregion
736
717
  //#region src/entities/predicate/predicate.ts
737
- var We = M("predicate"), Ge = L(({ client: e }) => {
738
- let t = We.store({}), n = j(t, { register(e, 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 Ke(e) {
797
- return R(Ge, e);
777
+ function Ue(e) {
778
+ return R(He, e);
798
779
  }
799
- var qe = (e, t, n) => {
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 Je(e, t) {
786
+ function Ge(e, t) {
806
787
  return {
807
- id: oe(`history-entry-${Date.now()}-${Math.random()}}`),
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 Ye = L(() => {
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, Je(t.experienceId, t.node)] })), e.on(n, (e, t) => ({ entries: [...e.entries.slice(0, -1), Je(t.experienceId, t.node)] })), e.on(i, (e, t) => t);
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 || !T(a)) && !(t && i.experienceId !== t)) if (n.lastStepIndex === -1) n.lastStepIndex = r;
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 Xe() {
846
- return R(Ye);
826
+ function qe() {
827
+ return R(Ke);
847
828
  }
848
829
  //#endregion
849
830
  //#region src/utils/events.ts
850
- var Ze = 0, Qe = (e) => {
831
+ var Je = 0, Ye = (e) => {
851
832
  let t = F([]);
852
833
  return t.on(e, (e, t) => [...e, {
853
- id: Ze++,
834
+ id: Je++,
854
835
  at: /* @__PURE__ */ new Date(),
855
836
  payload: t
856
837
  }]), t;
857
- }, $e = M("field"), et = L(() => {
858
- let e = $e.store({}), t = j(e, {
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
- [t.field.id]: t.field
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
- return n ? {
863
+ if (!n) return e;
864
+ let r = Object.assign({}, n, t.updates);
865
+ return {
868
866
  ...e,
869
- [n.id]: Object.assign({}, n, t.updates)
870
- } : e;
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 tt() {
907
- return R(et);
904
+ function $e() {
905
+ return R(Qe);
908
906
  }
909
907
  //#endregion
910
908
  //#region src/entities/step/step.ts
911
- var nt = M("step"), rt = L(() => {
912
- let e = nt.store({}), t = j(e, { register(e, t) {
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 it() {
937
- return R(rt);
934
+ function nt() {
935
+ return R(tt);
938
936
  }
939
- function at(e, t) {
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 ot = M("content"), st = L(() => {
945
- let e = ot.store({}), t = j(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 ct() {
987
- return R(st);
984
+ function ot() {
985
+ return R(at);
988
986
  }
989
- function lt(e, t) {
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 ut = M("action"), dt = L(({ client: e }) => {
995
- let t = ut.store({}), n = j(t, { register(e, 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 ft(e) {
1054
- return R(dt, e);
1051
+ function ut(e) {
1052
+ return R(lt, e);
1055
1053
  }
1056
- var pt = (e, t, n) => {
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 mt(e) {
1073
+ function ft(e) {
1076
1074
  return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
1077
1075
  }
1078
- function ht(e) {
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 gt(e, t) {
1083
+ function mt(e, t) {
1086
1084
  return t.find((t) => t.key === e) ?? null;
1087
1085
  }
1088
- function _t(e, t) {
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 vt(e, t) {
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 (!ht(n)) return J(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
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.") : ht(t) ? null : J(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
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 yt(e, t) {
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) => !mt(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(", ")}`);
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 bt(t, n, r, i) {
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 xt = M("response"), St = L(({ client: e }) => {
1127
- let t = xt.store({}), r = P(), i = P(), a = j(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 = gt(t, e);
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 = _t(o, n), l = await bt(s, o, c, a);
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 = vt(o, c);
1179
+ let u = gt(o, c);
1182
1180
  if (u) {
1183
1181
  r.push(u);
1184
1182
  return;
1185
1183
  }
1186
- let d = yt(o, c);
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 Ct(e) {
1266
- return R(St, e);
1263
+ function xt(e) {
1264
+ return R(bt, e);
1267
1265
  }
1268
1266
  //#endregion
1269
1267
  //#region src/entities/condition/condition.ts
1270
- var wt = M("condition"), Tt = L(() => {
1271
- let e = wt.store({}), t = j(e, { register(e, t) {
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 Et() {
1296
- return R(Tt);
1293
+ function wt() {
1294
+ return R(Ct);
1297
1295
  }
1298
1296
  //#endregion
1299
1297
  //#region src/utils/api-url.ts
1300
- function Dt() {
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 Ot() {
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 kt = "picked:start:begin", At = "picked:start";
1334
- function jt() {
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 Mt() {
1339
+ function At() {
1342
1340
  let e = null, t = null;
1343
1341
  return {
1344
1342
  markBegin: () => {
1345
- if (jt()) try {
1346
- e = performance.mark(kt).startTime;
1343
+ if (kt()) try {
1344
+ e = performance.mark(Dt).startTime;
1347
1345
  } catch {}
1348
1346
  },
1349
1347
  measure: () => {
1350
- if (!(!jt() || e === null)) try {
1351
- t = performance.measure(At, { start: e });
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 Nt = O("session", "global");
1362
- function Pt() {
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 Ft() {
1376
+ function Pt() {
1366
1377
  if (!h()) return null;
1367
- let e = E.get(Nt);
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 It = L(() => {
1376
- let e = Ft(), t = { id: e?.id ?? Pt() };
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(Nt).set(e);
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 Lt() {
1417
- return R(It, void 0);
1427
+ function It() {
1428
+ return R(Ft, void 0);
1418
1429
  }
1419
1430
  //#endregion
1420
1431
  //#region src/utils/picked-config.ts
1421
- function Rt() {
1432
+ function Lt() {
1422
1433
  if (s()) return globalThis.window.pickedConfig;
1423
1434
  }
1424
- function zt() {
1425
- if (s()) return Rt()?.projectId;
1435
+ function Rt() {
1436
+ if (s()) return Lt()?.projectId;
1426
1437
  }
1427
- function Bt() {
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 Vt(e) {
1443
+ function Bt(e) {
1433
1444
  if (e.projectId) return e.projectId;
1434
- let t = zt();
1445
+ let t = Rt();
1435
1446
  if (t) return t;
1436
- let n = Bt();
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 Ht = {
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 Ut(e) {
1477
+ function Ht(e) {
1467
1478
  return typeof e == "object" && !!e;
1468
1479
  }
1469
- function Wt(e, t) {
1480
+ function Ut(e, t) {
1470
1481
  let n = t;
1471
- for (let t of e.split(".")) if (Ut(n) && t in n) n = n[t];
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 Gt(e, t) {
1476
- let n = e.split("|").map((e) => e.trim()), r = Wt(n.shift() ?? "", t);
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 = Ht[i];
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 Kt(e, t) {
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 += Gt(i.trim(), t);
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 qt = "preview-token";
1502
- function Jt() {
1503
- return !s() || !g() ? !1 : !!Ot()[qt]?.[0];
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 Yt = class {
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
- deliveryObserver = null;
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 = Lt();
1528
- performance = Mt();
1529
- searchParams = Ot();
1530
- history = Xe();
1535
+ session = It();
1536
+ performance = At();
1537
+ searchParams = Et();
1538
+ history = qe();
1531
1539
  components = Ce({ client: this });
1532
- experienceInstances = C({ client: this });
1540
+ experienceInstances = w({ client: this });
1533
1541
  experiences = he({ client: this });
1534
1542
  frameworks = De({ client: this });
1535
- predicates = Ke({ client: this });
1536
- features = re({ client: this });
1537
- conditions = Et();
1538
- fields = tt();
1539
- responses = Ct({ client: this });
1540
- steps = it();
1541
- contents = ct();
1542
- actions = ft({ client: this });
1543
- conditionResults = w();
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 = Ue({ client: this });
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 Kt(t, {
1565
+ return Gt(t, {
1558
1566
  ...n,
1559
1567
  responses: r
1560
1568
  });
1561
1569
  }
1562
1570
  });
1563
1571
  constructor(e) {
1564
- this.events = Qe(this.eventBus), this.projectId = Vt(e), this.options = Object.freeze(e), this.apiUrl = e.apiUrl || Dt(), 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({
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: ae()
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-BWDd3oaq.js").then((t) => t.createPickedDataProvider({
1580
+ let r = import("../provider-B8wvmeC8.js").then((t) => t.createPickedDataProvider({
1573
1581
  apiUrl: this.apiUrl,
1574
1582
  projectId: this.projectId,
1575
- getRequestObserver: () => this.deliveryObserver,
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
- Jt() && import("../preview-channel-CSr96XAo.js").then((e) => e.initPreviewChannel(this)).catch(() => void 0);
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
- ne(e, t, this.features);
1611
+ re(e, t, this.features);
1604
1612
  };
1605
1613
  registerPredicate = (e, t) => {
1606
- qe(e, t, this.predicates);
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
- at(e, this.steps);
1623
+ rt(e, this.steps);
1616
1624
  };
1617
1625
  registerContent = (e) => {
1618
- lt(e, this.contents);
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
- pt(e, t, this.actions);
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 = ie(e);
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
- }, Xt = "application/picked-javascript", Zt = "application/picked-module", Qt = "data-picked-hydrated";
1710
- async function $t(e) {
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 en() {
1740
- return `<script>(${$t.toString()})(document)<\/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 tn(e) {
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 nn(e) {
1768
+ function tn(e) {
1750
1769
  return {
1751
1770
  $$type: "lazy-component",
1752
1771
  load: e
1753
1772
  };
1754
1773
  }
1755
- function rn(e) {
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 an(e, t) {
1790
+ function rn(e, t) {
1772
1791
  return t === null ? null : e[t] ?? null;
1773
1792
  }
1774
- function on(e, t) {
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 sn(e, t) {
1783
- if (ue.store(t)) return A(t, e.indexStore, (e, t) => an(t, Q(e)));
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) => an(e, n), { skipVoid: !1 });
1804
+ return e.indexStore.map((e) => rn(e, n), { skipVoid: !1 });
1786
1805
  }
1787
- function cn(e, t) {
1788
- if (ue.store(t)) return A(t, e.indexStore, (e, t) => on(t, $(e)));
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) => on(e, n), { skipVoid: !1 });
1809
+ return e.indexStore.map((e) => an(e, n), { skipVoid: !1 });
1791
1810
  }
1792
1811
  //#endregion
1793
1812
  //#region src/exports.ts
1794
- var ln = (e) => {
1795
- let t = new Yt(e);
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 un(e) {
1819
+ function ln(e) {
1801
1820
  return typeof e.data == "object";
1802
1821
  }
1803
- function dn(e) {
1804
- return e.map((e) => !e || !un(e) ? null : e, { skipVoid: !1 });
1822
+ function un(e) {
1823
+ return e.map((e) => !e || !ln(e) ? null : e, { skipVoid: !1 });
1805
1824
  }
1806
1825
  //#endregion
1807
- export { Qt as PICKED_HYDRATED_ATTR, Zt as PICKED_MODULE_SCRIPT_TYPE, Xt as PICKED_SCRIPT_TYPE, qt as PREVIEW_TOKEN_PARAM, Yt as Picked, en as buildRehydrateBootstrap, ln as createClient, _e as createPluginEffect, O as createStorageKey, sn as deriveReference, cn as deriveReferences, n as evaluateRuleLogic, Rt as getPickedConfig, Z as isContentReference, tn as isHtmlAssetValue, g as isInsideIframe, rn as isLazyLoader, v as isPickedRoot, Jt as isPreviewSession, nn as lazyComponent, E as localStore, le as onInertScriptSubtrees, Q as readReferenceId, $ as readReferenceIds, $t as rehydrateScripts, se as reportInertScriptSubtrees, ce as resetInertScriptReport, D as sessionStore, te 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, dn as toTypedContentStore };
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 };