@picked/client 0.0.1-dev.1787543060859 → 0.0.1-dev.1787788898336

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 (51) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/api-9gq3GBPF.cjs +1 -0
  3. package/dist/api-DU4j3Qw0.js +22 -0
  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/fill-and-publish-a-page.md +18 -2
  11. package/dist/docs/reference/dashboard/content/pages.mdx +25 -0
  12. package/dist/docs/reference/delivery-api/preview-caching-crawling.md +1 -1
  13. package/dist/docs/reference/sdk/fields.md +30 -16
  14. package/dist/esm/index.js +163 -152
  15. package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
  16. package/dist/esm/plugins/responses-browser-storage/index.js +2 -2
  17. package/dist/esm/plugins/responses-indexeddb/index.js +1 -1
  18. package/dist/esm/plugins/telemetry/index.js +42 -46
  19. package/dist/esm/server/index.js +1 -1
  20. package/dist/{plugin-L5y4NdFX.js → plugin-CYXHEafF.js} +2 -2
  21. package/dist/{plugin-BcFzHPC7.cjs → plugin-rwzR9hVc.cjs} +1 -1
  22. package/dist/provider-BWDd3oaq.js +94 -0
  23. package/dist/provider-lgLyP_0N.cjs +1 -0
  24. package/dist/types/data-source/api.d.ts.map +1 -1
  25. package/dist/types/data-source/provider.d.ts +3 -0
  26. package/dist/types/data-source/provider.d.ts.map +1 -1
  27. package/dist/types/data-source/request-observer.d.ts +24 -12
  28. package/dist/types/data-source/request-observer.d.ts.map +1 -1
  29. package/dist/types/entities/field/field.d.ts +6 -0
  30. package/dist/types/entities/field/field.d.ts.map +1 -1
  31. package/dist/types/entities/plugin/plugin.d.ts +3 -3
  32. package/dist/types/lifecycle/lifecycle.d.ts.map +1 -1
  33. package/dist/types/picked.d.ts +14 -7
  34. package/dist/types/picked.d.ts.map +1 -1
  35. package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +1 -1
  36. package/dist/types/plugins/responses-indexeddb/plugin.d.ts.map +1 -1
  37. package/dist/types/plugins/telemetry/emit.d.ts +3 -3
  38. package/dist/types/plugins/telemetry/emit.d.ts.map +1 -1
  39. package/dist/types/plugins/telemetry/plugin.d.ts +9 -0
  40. package/dist/types/plugins/telemetry/plugin.d.ts.map +1 -1
  41. package/dist/types/utils/user-timing.d.ts +16 -13
  42. package/dist/types/utils/user-timing.d.ts.map +1 -1
  43. package/dist/{version-BqU6f22c.cjs → version-BaI_1eQx.cjs} +1 -1
  44. package/dist/{version-DAFO6eas.js → version-DXDZM7eT.js} +1 -1
  45. package/package.json +3 -3
  46. package/dist/api-CahTmEWe.cjs +0 -1
  47. package/dist/api-DwTNwuWK.js +0 -33
  48. package/dist/provider-BLDm3i8g.cjs +0 -1
  49. package/dist/provider-Dx6VjvZg.js +0 -69
  50. package/dist/request-observer-BXDfOU0V.cjs +0 -1
  51. package/dist/request-observer-DtG0cRfz.js +0 -19
package/dist/esm/index.js CHANGED
@@ -5,7 +5,7 @@ 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
5
5
  import { a as v, i as y, r as ee, s as b, t as x } from "../dom-BqcToNL0.js";
6
6
  import { l as S, n as C, r as w, u as T } from "../experience-instance-DGk11d8a.js";
7
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-DAFO6eas.js";
8
+ import { i as ne, n as re, r as ie, t as ae } from "../version-DXDZM7eT.js";
9
9
  import { t as oe } from "../id-Bo4RBeOs.js";
10
10
  import { n as se, r as ce, t as le } from "../inert-script-report-B_bMPRzp.js";
11
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";
@@ -580,27 +580,7 @@ var ze = 6e3, Be = O("last_ping", "global"), Ve = async (e) => {
580
580
  } catch {
581
581
  return !1;
582
582
  }
583
- }, He = "picked:start:begin", Ue = "picked:start";
584
- function We() {
585
- try {
586
- return s() && !!p.window && "performance" in p;
587
- } catch {
588
- return !1;
589
- }
590
- }
591
- function Ge() {
592
- if (We()) try {
593
- performance.mark(He);
594
- } catch {}
595
- }
596
- function Ke() {
597
- if (We()) try {
598
- performance.measure(Ue, He);
599
- } catch {}
600
- }
601
- //#endregion
602
- //#region src/lifecycle/lifecycle.ts
603
- var K = M("lifecycle"), qe = L(({ client: e }) => {
583
+ }, K = M("lifecycle"), He = L(({ client: e }) => {
604
584
  let t = K.store(!1), r = F(void 0, {
605
585
  skipVoid: !1,
606
586
  domain: K
@@ -642,7 +622,7 @@ var K = M("lifecycle"), qe = L(({ client: e }) => {
642
622
  clock: C,
643
623
  fn: () => "starting",
644
624
  target: a
645
- }), C.watch(Ge), d.watch(Ke), I({
625
+ }), C.watch(e.performance.markBegin), d.watch(e.performance.measure), I({
646
626
  clock: C,
647
627
  target: g
648
628
  }), I({
@@ -749,13 +729,13 @@ var K = M("lifecycle"), qe = L(({ client: e }) => {
749
729
  setCondition: h
750
730
  };
751
731
  });
752
- function Je(e) {
753
- return R(qe, e);
732
+ function Ue(e) {
733
+ return R(He, e);
754
734
  }
755
735
  //#endregion
756
736
  //#region src/entities/predicate/predicate.ts
757
- var Ye = M("predicate"), Xe = L(({ client: e }) => {
758
- let t = Ye.store({}), n = j(t, { register(e, t) {
737
+ var We = M("predicate"), Ge = L(({ client: e }) => {
738
+ let t = We.store({}), n = j(t, { register(e, t) {
759
739
  return {
760
740
  ...e,
761
741
  [t.name]: {
@@ -813,16 +793,16 @@ var Ye = M("predicate"), Xe = L(({ client: e }) => {
813
793
  getEvokablePredicate: s
814
794
  };
815
795
  });
816
- function Ze(e) {
817
- return R(Xe, e);
796
+ function Ke(e) {
797
+ return R(Ge, e);
818
798
  }
819
- var Qe = (e, t, n) => {
799
+ var qe = (e, t, n) => {
820
800
  n.register({
821
801
  name: e,
822
802
  predicate: t
823
803
  });
824
804
  }, q = M("history");
825
- function $e(e, t) {
805
+ function Je(e, t) {
826
806
  return {
827
807
  id: oe(`history-entry-${Date.now()}-${Math.random()}}`),
828
808
  node: t,
@@ -830,9 +810,9 @@ function $e(e, t) {
830
810
  experienceId: e
831
811
  };
832
812
  }
833
- var et = L(() => {
813
+ var Ye = L(() => {
834
814
  let e = q.store({ entries: [] }), t = q.event(), n = q.event(), r = q.event(), i = q.event();
835
- e.on(t, (e, t) => ({ entries: [...e.entries, $e(t.experienceId, t.node)] })), e.on(n, (e, t) => ({ entries: [...e.entries.slice(0, -1), $e(t.experienceId, t.node)] })), e.on(i, (e, t) => t);
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);
836
816
  function a(e, t) {
837
817
  let n = {
838
818
  lastStepIndex: -1,
@@ -862,20 +842,20 @@ var et = L(() => {
862
842
  entriesStore: e.map((e) => e.entries)
863
843
  };
864
844
  });
865
- function tt() {
866
- return R(et);
845
+ function Xe() {
846
+ return R(Ye);
867
847
  }
868
848
  //#endregion
869
849
  //#region src/utils/events.ts
870
- var nt = 0, rt = (e) => {
850
+ var Ze = 0, Qe = (e) => {
871
851
  let t = F([]);
872
852
  return t.on(e, (e, t) => [...e, {
873
- id: nt++,
853
+ id: Ze++,
874
854
  at: /* @__PURE__ */ new Date(),
875
855
  payload: t
876
856
  }]), t;
877
- }, it = M("field"), at = L(() => {
878
- let e = it.store({}), t = j(e, {
857
+ }, $e = M("field"), et = L(() => {
858
+ let e = $e.store({}), t = j(e, {
879
859
  register(e, t) {
880
860
  return {
881
861
  ...e,
@@ -923,13 +903,13 @@ var nt = 0, rt = (e) => {
923
903
  getByName: c
924
904
  };
925
905
  });
926
- function ot() {
927
- return R(at);
906
+ function tt() {
907
+ return R(et);
928
908
  }
929
909
  //#endregion
930
910
  //#region src/entities/step/step.ts
931
- var st = M("step"), ct = L(() => {
932
- let e = st.store({}), t = j(e, { register(e, t) {
911
+ var nt = M("step"), rt = L(() => {
912
+ let e = nt.store({}), t = j(e, { register(e, t) {
933
913
  return {
934
914
  ...e,
935
915
  [t.step.id]: t.step
@@ -953,16 +933,16 @@ var st = M("step"), ct = L(() => {
953
933
  indexStore: e
954
934
  };
955
935
  });
956
- function lt() {
957
- return R(ct);
936
+ function it() {
937
+ return R(rt);
958
938
  }
959
- function ut(e, t) {
939
+ function at(e, t) {
960
940
  t.register(e);
961
941
  }
962
942
  //#endregion
963
943
  //#region src/entities/content/content.ts
964
- var dt = M("content"), ft = L(() => {
965
- let e = dt.store({}), t = j(e, {
944
+ var ot = M("content"), st = L(() => {
945
+ let e = ot.store({}), t = j(e, {
966
946
  register(e, t) {
967
947
  return {
968
948
  ...e,
@@ -1003,16 +983,16 @@ var dt = M("content"), ft = L(() => {
1003
983
  indexStore: e
1004
984
  };
1005
985
  });
1006
- function pt() {
1007
- return R(ft);
986
+ function ct() {
987
+ return R(st);
1008
988
  }
1009
- function mt(e, t) {
989
+ function lt(e, t) {
1010
990
  t.register(e);
1011
991
  }
1012
992
  //#endregion
1013
993
  //#region src/entities/action/action.ts
1014
- var ht = M("action"), gt = L(({ client: e }) => {
1015
- let t = ht.store({}), n = j(t, { register(e, t) {
994
+ var ut = M("action"), dt = L(({ client: e }) => {
995
+ let t = ut.store({}), n = j(t, { register(e, t) {
1016
996
  return {
1017
997
  ...e,
1018
998
  [t.key]: {
@@ -1070,10 +1050,10 @@ var ht = M("action"), gt = L(({ client: e }) => {
1070
1050
  getEvokableAction: s
1071
1051
  };
1072
1052
  });
1073
- function _t(e) {
1074
- return R(gt, e);
1053
+ function ft(e) {
1054
+ return R(dt, e);
1075
1055
  }
1076
- var vt = (e, t, n) => {
1056
+ var pt = (e, t, n) => {
1077
1057
  n.register({
1078
1058
  key: e,
1079
1059
  action: t
@@ -1092,35 +1072,35 @@ function J(e, t, n, r) {
1092
1072
  function Y(e) {
1093
1073
  return e === null || e === "" || Array.isArray(e) && !e.length;
1094
1074
  }
1095
- function yt(e) {
1075
+ function mt(e) {
1096
1076
  return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
1097
1077
  }
1098
- function bt(e) {
1078
+ function ht(e) {
1099
1079
  try {
1100
1080
  return JSON.stringify(e), !0;
1101
1081
  } catch {
1102
1082
  return !1;
1103
1083
  }
1104
1084
  }
1105
- function xt(e, t) {
1085
+ function gt(e, t) {
1106
1086
  return t.find((t) => t.key === e) ?? null;
1107
1087
  }
1108
- function St(e, t) {
1088
+ function _t(e, t) {
1109
1089
  return e.multiple && (typeof t == "string" || typeof t == "number" || typeof t == "boolean") ? [t] : t;
1110
1090
  }
1111
- function Ct(e, t) {
1091
+ function vt(e, t) {
1112
1092
  if (e.type !== "object" || Y(t)) return null;
1113
1093
  if (e.multiple) {
1114
1094
  if (!Array.isArray(t)) return J(e, t, "This field expects multiple values", "Field expects an array of objects.");
1115
1095
  for (let n of t) {
1116
1096
  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.");
1117
- if (!bt(n)) return J(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
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.).");
1118
1098
  }
1119
1099
  return null;
1120
1100
  }
1121
- 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.") : bt(t) ? null : J(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
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.).");
1122
1102
  }
1123
- function wt(e, t) {
1103
+ function yt(e, t) {
1124
1104
  if (Y(t) || !Array.isArray(e.options) || e.options.length === 0) return null;
1125
1105
  let n = Array.isArray(t) ? t : [t];
1126
1106
  if (e.type === "object") {
@@ -1128,9 +1108,9 @@ function wt(e, t) {
1128
1108
  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.");
1129
1109
  }
1130
1110
  let r = e.options.map((e) => e.value);
1131
- return n.every((e) => !yt(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(", ")}`);
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(", ")}`);
1132
1112
  }
1133
- async function Tt(t, n, r, i) {
1113
+ async function bt(t, n, r, i) {
1134
1114
  if (n.validation && !e(n.validation) && !Y(r)) {
1135
1115
  let e = i ? {
1136
1116
  $input: r,
@@ -1143,8 +1123,8 @@ async function Tt(t, n, r, i) {
1143
1123
  }
1144
1124
  //#endregion
1145
1125
  //#region src/entities/response/response.ts
1146
- var Et = M("response"), Dt = L(({ client: e }) => {
1147
- let t = Et.store({}), r = P(), i = P(), a = j(t, {
1126
+ var xt = M("response"), St = L(({ client: e }) => {
1127
+ let t = xt.store({}), r = P(), i = P(), a = j(t, {
1148
1128
  register(e, t) {
1149
1129
  return {
1150
1130
  ...e,
@@ -1183,7 +1163,7 @@ var Et = M("response"), Dt = L(({ client: e }) => {
1183
1163
  ...t,
1184
1164
  ...n
1185
1165
  }, o = Object.entries(n), c = await Promise.allSettled(o.map(async ([t, n]) => {
1186
- let o = xt(t, e);
1166
+ let o = gt(t, e);
1187
1167
  if (!o) {
1188
1168
  r.push({
1189
1169
  fieldKey: t,
@@ -1193,17 +1173,17 @@ var Et = M("response"), Dt = L(({ client: e }) => {
1193
1173
  });
1194
1174
  return;
1195
1175
  }
1196
- let c = St(o, n), l = await Tt(s, o, c, a);
1176
+ let c = _t(o, n), l = await bt(s, o, c, a);
1197
1177
  if (l) {
1198
1178
  r.push(l);
1199
1179
  return;
1200
1180
  }
1201
- let u = Ct(o, c);
1181
+ let u = vt(o, c);
1202
1182
  if (u) {
1203
1183
  r.push(u);
1204
1184
  return;
1205
1185
  }
1206
- let d = wt(o, c);
1186
+ let d = yt(o, c);
1207
1187
  if (d) {
1208
1188
  r.push(d);
1209
1189
  return;
@@ -1282,13 +1262,13 @@ var Et = M("response"), Dt = L(({ client: e }) => {
1282
1262
  getByFieldName: _
1283
1263
  };
1284
1264
  });
1285
- function Ot(e) {
1286
- return R(Dt, e);
1265
+ function Ct(e) {
1266
+ return R(St, e);
1287
1267
  }
1288
1268
  //#endregion
1289
1269
  //#region src/entities/condition/condition.ts
1290
- var kt = M("condition"), At = L(() => {
1291
- let e = kt.store({}), t = j(e, { register(e, t) {
1270
+ var wt = M("condition"), Tt = L(() => {
1271
+ let e = wt.store({}), t = j(e, { register(e, t) {
1292
1272
  return {
1293
1273
  ...e,
1294
1274
  [t.condition.id]: t.condition
@@ -1312,12 +1292,12 @@ var kt = M("condition"), At = L(() => {
1312
1292
  indexStore: e
1313
1293
  };
1314
1294
  });
1315
- function jt() {
1316
- return R(At);
1295
+ function Et() {
1296
+ return R(Tt);
1317
1297
  }
1318
1298
  //#endregion
1319
1299
  //#region src/utils/api-url.ts
1320
- function Mt() {
1300
+ function Dt() {
1321
1301
  if (c()) {
1322
1302
  let e = [
1323
1303
  document.currentScript,
@@ -1332,7 +1312,7 @@ function Mt() {
1332
1312
  }
1333
1313
  //#endregion
1334
1314
  //#region src/utils/search-params.ts
1335
- function Nt() {
1315
+ function Ot() {
1336
1316
  if (!s()) return {};
1337
1317
  let e = new URLSearchParams(window.location.search), t = {}, n = /* @__PURE__ */ new Set();
1338
1318
  for (let [t] of e.entries()) t.startsWith("picked-") && n.add(t);
@@ -1349,14 +1329,42 @@ function Nt() {
1349
1329
  return t;
1350
1330
  }
1351
1331
  //#endregion
1332
+ //#region src/utils/user-timing.ts
1333
+ var kt = "picked:start:begin", At = "picked:start";
1334
+ function jt() {
1335
+ try {
1336
+ return s() && !!p.window && "performance" in p;
1337
+ } catch {
1338
+ return !1;
1339
+ }
1340
+ }
1341
+ function Mt() {
1342
+ let e = null, t = null;
1343
+ return {
1344
+ markBegin: () => {
1345
+ if (jt()) try {
1346
+ e = performance.mark(kt).startTime;
1347
+ } catch {}
1348
+ },
1349
+ measure: () => {
1350
+ if (!(!jt() || e === null)) try {
1351
+ t = performance.measure(At, { start: e });
1352
+ } catch {}
1353
+ },
1354
+ get startMeasure() {
1355
+ return t;
1356
+ }
1357
+ };
1358
+ }
1359
+ //#endregion
1352
1360
  //#region src/entities/session/session.ts
1353
- var Pt = O("session", "global");
1354
- function Ft() {
1361
+ var Nt = O("session", "global");
1362
+ function Pt() {
1355
1363
  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)}`;
1356
1364
  }
1357
- function It() {
1365
+ function Ft() {
1358
1366
  if (!h()) return null;
1359
- let e = E.get(Pt);
1367
+ let e = E.get(Nt);
1360
1368
  if (!e.isSet()) return null;
1361
1369
  try {
1362
1370
  return e.json();
@@ -1364,8 +1372,8 @@ function It() {
1364
1372
  return null;
1365
1373
  }
1366
1374
  }
1367
- var Lt = L(() => {
1368
- let e = It(), t = { id: e?.id ?? Ft() };
1375
+ var It = L(() => {
1376
+ let e = Ft(), t = { id: e?.id ?? Pt() };
1369
1377
  e?.isUser !== void 0 && (t.isUser = e.isUser), e?.identifiers && Object.keys(e.identifiers).length > 0 && (t.identifiers = e.identifiers);
1370
1378
  let n = F(t), r = j(n, {
1371
1379
  setIsUser: (e, t) => ({
@@ -1391,7 +1399,7 @@ var Lt = L(() => {
1391
1399
  source: n,
1392
1400
  effect: (e) => {
1393
1401
  if (h()) try {
1394
- E.get(Pt).set(e);
1402
+ E.get(Nt).set(e);
1395
1403
  } catch {}
1396
1404
  }
1397
1405
  });
@@ -1405,27 +1413,27 @@ var Lt = L(() => {
1405
1413
  removeIdentifier: r.removeIdentifier
1406
1414
  };
1407
1415
  });
1408
- function Rt() {
1409
- return R(Lt, void 0);
1416
+ function Lt() {
1417
+ return R(It, void 0);
1410
1418
  }
1411
1419
  //#endregion
1412
1420
  //#region src/utils/picked-config.ts
1413
- function zt() {
1421
+ function Rt() {
1414
1422
  if (s()) return globalThis.window.pickedConfig;
1415
1423
  }
1416
- function Bt() {
1417
- if (s()) return zt()?.projectId;
1424
+ function zt() {
1425
+ if (s()) return Rt()?.projectId;
1418
1426
  }
1419
- function Vt() {
1427
+ function Bt() {
1420
1428
  if (!c()) return;
1421
1429
  let e = document.getElementById("picked_script") || document.querySelector("script#picked") || document.getElementById("cvly");
1422
1430
  if (e) return e.dataset.projectid || e.getAttribute("project-id") || void 0;
1423
1431
  }
1424
- function Ht(e) {
1432
+ function Vt(e) {
1425
1433
  if (e.projectId) return e.projectId;
1426
- let t = Bt();
1434
+ let t = zt();
1427
1435
  if (t) return t;
1428
- let n = Vt();
1436
+ let n = Bt();
1429
1437
  if (n) return n;
1430
1438
  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.");
1431
1439
  }
@@ -1434,7 +1442,7 @@ function Ht(e) {
1434
1442
  function X(e) {
1435
1443
  return e == null || e === "" || Number.isNaN(e);
1436
1444
  }
1437
- var Ut = {
1445
+ var Ht = {
1438
1446
  default: (e, t) => X(e) ? String(t ?? "") : String(e),
1439
1447
  append: (e, t) => t && !X(e) ? `${e} ${t}` : e,
1440
1448
  prepend: (e, t) => t && !X(e) ? `${t} ${e}` : e,
@@ -1455,24 +1463,24 @@ var Ut = {
1455
1463
  return e instanceof Set ? t.format(Array.from(e).map(String)) : e;
1456
1464
  }
1457
1465
  };
1458
- function Wt(e) {
1466
+ function Ut(e) {
1459
1467
  return typeof e == "object" && !!e;
1460
1468
  }
1461
- function Gt(e, t) {
1469
+ function Wt(e, t) {
1462
1470
  let n = t;
1463
- for (let t of e.split(".")) if (Wt(n) && t in n) n = n[t];
1471
+ for (let t of e.split(".")) if (Ut(n) && t in n) n = n[t];
1464
1472
  else return;
1465
1473
  return typeof n == "function" ? n() : n;
1466
1474
  }
1467
- function Kt(e, t) {
1468
- let n = e.split("|").map((e) => e.trim()), r = Gt(n.shift() ?? "", t);
1475
+ function Gt(e, t) {
1476
+ let n = e.split("|").map((e) => e.trim()), r = Wt(n.shift() ?? "", t);
1469
1477
  for (let e of n) {
1470
- let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o = Ut[i];
1478
+ let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o = Ht[i];
1471
1479
  o && (r = o(r, a));
1472
1480
  }
1473
1481
  return X(r) ? "" : typeof r == "object" ? JSON.stringify(r) : String(r);
1474
1482
  }
1475
- function qt(e, t) {
1483
+ function Kt(e, t) {
1476
1484
  let n = "", r = 0;
1477
1485
  for (; r < e.length;) if (e[r] === "{" && e[r + 1] === "{") {
1478
1486
  r += 2;
@@ -1484,19 +1492,19 @@ function qt(e, t) {
1484
1492
  }
1485
1493
  i += e[r++];
1486
1494
  }
1487
- n += Kt(i.trim(), t);
1495
+ n += Gt(i.trim(), t);
1488
1496
  } else n += e[r++];
1489
1497
  return n;
1490
1498
  }
1491
1499
  //#endregion
1492
1500
  //#region src/utils/preview-session.ts
1493
- var Jt = "preview-token";
1494
- function Yt() {
1495
- return !s() || !g() ? !1 : !!Nt()[Jt]?.[0];
1501
+ var qt = "preview-token";
1502
+ function Jt() {
1503
+ return !s() || !g() ? !1 : !!Ot()[qt]?.[0];
1496
1504
  }
1497
1505
  //#endregion
1498
1506
  //#region src/picked.ts
1499
- var Xt = class {
1507
+ var Yt = class {
1500
1508
  static logger = r;
1501
1509
  options;
1502
1510
  dataSource = null;
@@ -1505,9 +1513,10 @@ var Xt = class {
1505
1513
  contentLoader;
1506
1514
  previewEmbedderOrigins = null;
1507
1515
  plugins = {};
1508
- get pluginNames() {
1509
- return Object.keys(this.plugins);
1510
- }
1516
+ deliveryObserver = null;
1517
+ setDeliveryRequestObserver = (e) => {
1518
+ this.deliveryObserver = e;
1519
+ };
1511
1520
  dataProviders = /* @__PURE__ */ new Map();
1512
1521
  eventBus = P();
1513
1522
  events;
@@ -1515,21 +1524,22 @@ var Xt = class {
1515
1524
  apiUrl;
1516
1525
  dashboardUrl;
1517
1526
  documentationSiteUrl;
1518
- session = Rt();
1519
- searchParams = Nt();
1520
- history = tt();
1527
+ session = Lt();
1528
+ performance = Mt();
1529
+ searchParams = Ot();
1530
+ history = Xe();
1521
1531
  components = Ce({ client: this });
1522
1532
  experienceInstances = C({ client: this });
1523
1533
  experiences = he({ client: this });
1524
1534
  frameworks = De({ client: this });
1525
- predicates = Ze({ client: this });
1535
+ predicates = Ke({ client: this });
1526
1536
  features = re({ client: this });
1527
- conditions = jt();
1528
- fields = ot();
1529
- responses = Ot({ client: this });
1530
- steps = lt();
1531
- contents = pt();
1532
- actions = _t({ client: this });
1537
+ conditions = Et();
1538
+ fields = tt();
1539
+ responses = Ct({ client: this });
1540
+ steps = it();
1541
+ contents = ct();
1542
+ actions = ft({ client: this });
1533
1543
  conditionResults = w();
1534
1544
  stateSnapshotStore = Ae({ client: this });
1535
1545
  evaluateRuleLogicFx = Re({ client: this });
@@ -1538,20 +1548,20 @@ var Xt = class {
1538
1548
  preconditionPassedStore;
1539
1549
  conditionPassedStore;
1540
1550
  lifecycleStageStore;
1541
- lifecycle = Je({ client: this });
1551
+ lifecycle = Ue({ client: this });
1542
1552
  renderStringFx = k({
1543
1553
  source: this.responses.listStore,
1544
1554
  effect: (e, { template: t, context: n }) => {
1545
1555
  let r = {};
1546
1556
  for (let t of e) r[t.fieldKey] = t.value;
1547
- return qt(t, {
1557
+ return Kt(t, {
1548
1558
  ...n,
1549
1559
  responses: r
1550
1560
  });
1551
1561
  }
1552
1562
  });
1553
1563
  constructor(e) {
1554
- this.events = rt(this.eventBus), this.projectId = Ht(e), this.options = Object.freeze(e), this.apiUrl = e.apiUrl || Mt(), 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({
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({
1555
1565
  type: "load",
1556
1566
  version: ae()
1557
1567
  }), this.maybeStartPreviewChannel();
@@ -1559,9 +1569,10 @@ var Xt = class {
1559
1569
  dataProviderFor(e) {
1560
1570
  let t = e ?? "", n = this.dataProviders.get(t);
1561
1571
  if (n) return n;
1562
- let r = import("../provider-Dx6VjvZg.js").then((t) => t.createPickedDataProvider({
1572
+ let r = import("../provider-BWDd3oaq.js").then((t) => t.createPickedDataProvider({
1563
1573
  apiUrl: this.apiUrl,
1564
1574
  projectId: this.projectId,
1575
+ getRequestObserver: () => this.deliveryObserver,
1565
1576
  ...e !== void 0 && { previewToken: e }
1566
1577
  }));
1567
1578
  return this.dataProviders.set(t, r), r;
@@ -1575,7 +1586,7 @@ var Xt = class {
1575
1586
  return (await this.dataProviderFor(t?.previewToken)).getContent(e, t?.signal === void 0 ? void 0 : { signal: t.signal });
1576
1587
  }
1577
1588
  maybeStartPreviewChannel() {
1578
- Yt() && import("../preview-channel-CSr96XAo.js").then((e) => e.initPreviewChannel(this)).catch(() => void 0);
1589
+ Jt() && import("../preview-channel-CSr96XAo.js").then((e) => e.initPreviewChannel(this)).catch(() => void 0);
1579
1590
  }
1580
1591
  registerFramework = (e) => {
1581
1592
  Oe(e, this.frameworks);
@@ -1592,7 +1603,7 @@ var Xt = class {
1592
1603
  ne(e, t, this.features);
1593
1604
  };
1594
1605
  registerPredicate = (e, t) => {
1595
- Qe(e, t, this.predicates);
1606
+ qe(e, t, this.predicates);
1596
1607
  };
1597
1608
  registerCondition = (e) => {
1598
1609
  this.conditions.register(e);
@@ -1601,16 +1612,16 @@ var Xt = class {
1601
1612
  this.fields.register(e);
1602
1613
  };
1603
1614
  registerStep = (e) => {
1604
- ut(e, this.steps);
1615
+ at(e, this.steps);
1605
1616
  };
1606
1617
  registerContent = (e) => {
1607
- mt(e, this.contents);
1618
+ lt(e, this.contents);
1608
1619
  };
1609
1620
  patchContent = (e, t) => {
1610
1621
  this.contents.patch(e, t);
1611
1622
  };
1612
1623
  registerAction = (e, t) => {
1613
- vt(e, t, this.actions);
1624
+ pt(e, t, this.actions);
1614
1625
  };
1615
1626
  registerExperience = (e) => {
1616
1627
  e.component && we(`experience:${e.id}`, e.component, this.components), this.experiences.register(e);
@@ -1695,8 +1706,8 @@ var Xt = class {
1695
1706
  });
1696
1707
  }
1697
1708
  getPluginConfig = (e) => this.plugins[e] ?? {};
1698
- }, Zt = "application/picked-javascript", Qt = "application/picked-module", $t = "data-picked-hydrated";
1699
- async function en(e) {
1709
+ }, Xt = "application/picked-javascript", Zt = "application/picked-module", Qt = "data-picked-hydrated";
1710
+ async function $t(e) {
1700
1711
  if (!("document" in globalThis)) return;
1701
1712
  let t = "application/picked-module", n = "data-picked-hydrated";
1702
1713
  function r(e) {
@@ -1725,23 +1736,23 @@ async function en(e) {
1725
1736
  a && await a;
1726
1737
  }
1727
1738
  }
1728
- function tn() {
1729
- return `<script>(${en.toString()})(document)<\/script>`;
1739
+ function en() {
1740
+ return `<script>(${$t.toString()})(document)<\/script>`;
1730
1741
  }
1731
1742
  //#endregion
1732
1743
  //#region src/utils/html-asset-value.ts
1733
- function nn(e) {
1744
+ function tn(e) {
1734
1745
  return typeof e == "object" && !!e && "id" in e && typeof e.id == "string" && "content" in e && (typeof e.content == "string" || e.content === null);
1735
1746
  }
1736
1747
  //#endregion
1737
1748
  //#region src/entities/component/lazyComponent.ts
1738
- function rn(e) {
1749
+ function nn(e) {
1739
1750
  return {
1740
1751
  $$type: "lazy-component",
1741
1752
  load: e
1742
1753
  };
1743
1754
  }
1744
- function an(e) {
1755
+ function rn(e) {
1745
1756
  return typeof e == "object" && !!e && "$$type" in e && e.$$type === "lazy-component";
1746
1757
  }
1747
1758
  //#endregion
@@ -1757,10 +1768,10 @@ function $(e) {
1757
1768
  for (let e of t) Z(e) && n.push(e.contentEntryId);
1758
1769
  return n;
1759
1770
  }
1760
- function on(e, t) {
1771
+ function an(e, t) {
1761
1772
  return t === null ? null : e[t] ?? null;
1762
1773
  }
1763
- function sn(e, t) {
1774
+ function on(e, t) {
1764
1775
  let n = [];
1765
1776
  for (let r of t) {
1766
1777
  let t = e[r];
@@ -1768,29 +1779,29 @@ function sn(e, t) {
1768
1779
  }
1769
1780
  return n;
1770
1781
  }
1771
- function cn(e, t) {
1772
- if (ue.store(t)) return A(t, e.indexStore, (e, t) => on(t, Q(e)));
1782
+ function sn(e, t) {
1783
+ if (ue.store(t)) return A(t, e.indexStore, (e, t) => an(t, Q(e)));
1773
1784
  let n = Q(t);
1774
- return e.indexStore.map((e) => on(e, n), { skipVoid: !1 });
1785
+ return e.indexStore.map((e) => an(e, n), { skipVoid: !1 });
1775
1786
  }
1776
- function ln(e, t) {
1777
- if (ue.store(t)) return A(t, e.indexStore, (e, t) => sn(t, $(e)));
1787
+ function cn(e, t) {
1788
+ if (ue.store(t)) return A(t, e.indexStore, (e, t) => on(t, $(e)));
1778
1789
  let n = $(t);
1779
- return e.indexStore.map((e) => sn(e, n), { skipVoid: !1 });
1790
+ return e.indexStore.map((e) => on(e, n), { skipVoid: !1 });
1780
1791
  }
1781
1792
  //#endregion
1782
1793
  //#region src/exports.ts
1783
- var un = (e) => {
1784
- let t = new Xt(e);
1794
+ var ln = (e) => {
1795
+ let t = new Yt(e);
1785
1796
  return u(t), t;
1786
1797
  };
1787
1798
  //#endregion
1788
1799
  //#region src/typed-content.ts
1789
- function dn(e) {
1800
+ function un(e) {
1790
1801
  return typeof e.data == "object";
1791
1802
  }
1792
- function fn(e) {
1793
- return e.map((e) => !e || !dn(e) ? null : e, { skipVoid: !1 });
1803
+ function dn(e) {
1804
+ return e.map((e) => !e || !un(e) ? null : e, { skipVoid: !1 });
1794
1805
  }
1795
1806
  //#endregion
1796
- export { $t as PICKED_HYDRATED_ATTR, Qt as PICKED_MODULE_SCRIPT_TYPE, Zt as PICKED_SCRIPT_TYPE, Jt as PREVIEW_TOKEN_PARAM, Xt as Picked, tn as buildRehydrateBootstrap, un as createClient, _e as createPluginEffect, O as createStorageKey, cn as deriveReference, ln as deriveReferences, n as evaluateRuleLogic, zt as getPickedConfig, Z as isContentReference, nn as isHtmlAssetValue, g as isInsideIframe, an as isLazyLoader, v as isPickedRoot, Yt as isPreviewSession, rn as lazyComponent, E as localStore, le as onInertScriptSubtrees, Q as readReferenceId, $ as readReferenceIds, en 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, fn as toTypedContentStore };
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 };