@levo-so/react 0.1.22 → 0.1.25

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 (35) hide show
  1. package/dist/{CheckboxWidget-nJO8XlGD.js → CheckboxWidget-DZIHdYf_.js} +1 -1
  2. package/dist/{CollectionFormBuilder-DeGyMEXJ.js → CollectionFormBuilder-C9clUECd.js} +18 -18
  3. package/dist/{CurrencyWidget-BaMho9Pw.js → CurrencyWidget-BPjhIZC3.js} +1 -1
  4. package/dist/{DateTimeWidget-VCmX__cv.js → DateTimeWidget-BHPInVmB.js} +1 -1
  5. package/dist/{DefaultFormVariant-fTWKRYI_.js → DefaultFormVariant-DfM-Rnjm.js} +3 -3
  6. package/dist/{DropdownWidget-zAr9v_IY.js → DropdownWidget-C0XD8XNO.js} +1 -1
  7. package/dist/{EmailWidget-d3hSxbAS.js → EmailWidget-lfSEQ6Pw.js} +1 -1
  8. package/dist/{FormCaptcha-YeElu90S.js → FormCaptcha-QTqyITqd.js} +1 -1
  9. package/dist/{GeocoderWidget-BOqaJMm1.js → GeocoderWidget-PKGgCyAq.js} +7 -7
  10. package/dist/{MultiGeocoderWidget-BTffSkJX.js → MultiGeocoderWidget-B6tJY_NH.js} +2 -2
  11. package/dist/{MultiTextWidget-L2Eoz2Zv.js → MultiTextWidget-BSlDBIxt.js} +1 -1
  12. package/dist/{PhoneWidget-CnDhiovx.js → PhoneWidget-CZ613uWl.js} +1 -1
  13. package/dist/{RadioWidget-CG01ys9E.js → RadioWidget-q0_ddtou.js} +1 -1
  14. package/dist/{RichTextWidget-DCX1Vpw4.js → RichTextWidget-D2D9-g4e.js} +1 -1
  15. package/dist/{StepsFormVariant-eW9O8rik.js → StepsFormVariant-eQuIooBH.js} +21 -21
  16. package/dist/{SwitchWidget-CstjQ_nx.js → SwitchWidget-DJJNsK2d.js} +1 -1
  17. package/dist/{TextWidget-D4uLMuLS.js → TextWidget-BUKw__Xy.js} +1 -1
  18. package/dist/{TextareaWidget-CHgyJUuy.js → TextareaWidget-CImcGtRi.js} +1 -1
  19. package/dist/{ToggleCheckboxWidget-Cfwlrjn7.js → ToggleCheckboxWidget-BHJmd8lZ.js} +1 -1
  20. package/dist/{URLWidget-CZE68DgS.js → URLWidget-HUj8G1oS.js} +2 -2
  21. package/dist/{UploadWidget-Dstuk_qo.js → UploadWidget-Bzamcq6F.js} +1 -1
  22. package/dist/audience/components/page.d.ts.map +1 -1
  23. package/dist/audience/hooks/useCurrentTab.d.ts +3 -0
  24. package/dist/audience/hooks/useCurrentTab.d.ts.map +1 -0
  25. package/dist/audience/hooks/useOpenTabs.d.ts +3 -0
  26. package/dist/audience/hooks/useOpenTabs.d.ts.map +1 -0
  27. package/dist/audience/hooks/useScrollDepth.d.ts.map +1 -0
  28. package/dist/audience/index.js +1 -1
  29. package/dist/collection/index.js +1 -1
  30. package/dist/index.js +2 -2
  31. package/dist/page-nOk3Od6l.js +230 -0
  32. package/package.json +4 -4
  33. package/dist/audience/components/useScrollDepth.d.ts.map +0 -1
  34. package/dist/page-sR2SWtb2.js +0 -189
  35. /package/dist/audience/{components → hooks}/useScrollDepth.d.ts +0 -0
@@ -3,7 +3,7 @@ import { j as a } from "./jsx-runtime-B6kdoens.js";
3
3
  import { useState as w, useEffect as B } from "react";
4
4
  import { useController as E } from "react-hook-form";
5
5
  import { c as C } from "./cn-C9QoOYNG.js";
6
- import { z as O, A as I, B as x } from "./CollectionFormBuilder-DeGyMEXJ.js";
6
+ import { z as O, A as I, B as x } from "./CollectionFormBuilder-C9clUECd.js";
7
7
  import { C as g } from "./Checbox-sq-atGlJ.js";
8
8
  import { I as S } from "./Input-2CvZ90f8.js";
9
9
  const L = ({ field: i }) => {
@@ -247,7 +247,7 @@ const q = ({
247
247
  "label",
248
248
  {
249
249
  className: b(
250
- "block text-sm font-medium leading-normal peer-disabled:cursor-not-allowed peer-disabled:opacity-70 select-none flex-1",
250
+ "block text-sm font-medium leading-normal peer-disabled:cursor-not-allowed peer-disabled:opacity-70 select-none flex-1 text-text-1",
251
251
  "mb-2",
252
252
  t
253
253
  ),
@@ -915,26 +915,26 @@ const dt = E.lazy(
915
915
  }
916
916
  );
917
917
  }, pt = v(
918
- () => import("./MultiTextWidget-L2Eoz2Zv.js")
919
- ), ie = v(() => import("./TextWidget-D4uLMuLS.js")), xt = v(
920
- () => import("./CurrencyWidget-BaMho9Pw.js")
918
+ () => import("./MultiTextWidget-BSlDBIxt.js")
919
+ ), ie = v(() => import("./TextWidget-BUKw__Xy.js")), xt = v(
920
+ () => import("./CurrencyWidget-BPjhIZC3.js")
921
921
  ), ht = v(
922
- () => import("./CheckboxWidget-nJO8XlGD.js")
922
+ () => import("./CheckboxWidget-DZIHdYf_.js")
923
923
  ), ce = v(
924
- () => import("./DateTimeWidget-VCmX__cv.js")
924
+ () => import("./DateTimeWidget-BHPInVmB.js")
925
925
  ), de = v(
926
- () => import("./DropdownWidget-zAr9v_IY.js")
927
- ), yt = v(() => import("./EmailWidget-d3hSxbAS.js")), ft = v(
928
- () => import("./GeocoderWidget-BOqaJMm1.js")
926
+ () => import("./DropdownWidget-C0XD8XNO.js")
927
+ ), yt = v(() => import("./EmailWidget-lfSEQ6Pw.js")), ft = v(
928
+ () => import("./GeocoderWidget-PKGgCyAq.js")
929
929
  ), jt = v(
930
- () => import("./MultiGeocoderWidget-BTffSkJX.js")
931
- ), bt = v(() => import("./PhoneWidget-CnDhiovx.js")), vt = v(() => import("./RadioWidget-CG01ys9E.js")), Ct = v(
932
- () => import("./RichTextWidget-DCX1Vpw4.js")
933
- ), wt = v(() => import("./SwitchWidget-CstjQ_nx.js")), kt = v(
934
- () => import("./TextareaWidget-CHgyJUuy.js")
930
+ () => import("./MultiGeocoderWidget-B6tJY_NH.js")
931
+ ), bt = v(() => import("./PhoneWidget-CZ613uWl.js")), vt = v(() => import("./RadioWidget-q0_ddtou.js")), Ct = v(
932
+ () => import("./RichTextWidget-D2D9-g4e.js")
933
+ ), wt = v(() => import("./SwitchWidget-DJJNsK2d.js")), kt = v(
934
+ () => import("./TextareaWidget-CImcGtRi.js")
935
935
  ), Wt = v(
936
- () => import("./ToggleCheckboxWidget-Cfwlrjn7.js")
937
- ), _t = v(() => import("./URLWidget-CZE68DgS.js")), K = v(() => import("./UploadWidget-Dstuk_qo.js")), Nt = ({
936
+ () => import("./ToggleCheckboxWidget-BHJmd8lZ.js")
937
+ ), _t = v(() => import("./URLWidget-HUj8G1oS.js")), K = v(() => import("./UploadWidget-Bzamcq6F.js")), Nt = ({
938
938
  field: e,
939
939
  isInternal: n
940
940
  }) => {
@@ -1103,9 +1103,9 @@ const dt = E.lazy(
1103
1103
  e
1104
1104
  ] });
1105
1105
  }, ns = () => E.useContext(Ce), Tt = E.lazy(
1106
- () => import("./DefaultFormVariant-fTWKRYI_.js")
1106
+ () => import("./DefaultFormVariant-DfM-Rnjm.js")
1107
1107
  ), Mt = E.lazy(
1108
- () => import("./StepsFormVariant-eW9O8rik.js")
1108
+ () => import("./StepsFormVariant-eQuIooBH.js")
1109
1109
  ), It = ({
1110
1110
  formVariant: e,
1111
1111
  ...n
@@ -2,7 +2,7 @@ import { j as t } from "./jsx-runtime-B6kdoens.js";
2
2
  import { useController as j } from "react-hook-form";
3
3
  import { NumericFormat as F } from "react-number-format";
4
4
  import { c as w } from "./cn-C9QoOYNG.js";
5
- import { z as C, A as B, B as N } from "./CollectionFormBuilder-DeGyMEXJ.js";
5
+ import { z as C, A as B, B as N } from "./CollectionFormBuilder-C9clUECd.js";
6
6
  const V = ({
7
7
  field: r,
8
8
  ...m
@@ -4,7 +4,7 @@ import { Calendar as w, X as N } from "lucide-react";
4
4
  import * as l from "react-datepicker";
5
5
  import { useController as v } from "react-hook-form";
6
6
  import { c as p } from "./cn-C9QoOYNG.js";
7
- import { z as M, A as D, B as C } from "./CollectionFormBuilder-DeGyMEXJ.js";
7
+ import { z as M, A as D, B as C } from "./CollectionFormBuilder-C9clUECd.js";
8
8
  import { I as F } from "./Input-2CvZ90f8.js";
9
9
  const T = l.default.default || l.default || l, I = (e) => {
10
10
  if (e) {
@@ -1,8 +1,8 @@
1
1
  import { j as e } from "./jsx-runtime-B6kdoens.js";
2
2
  import { FormProvider as y } from "react-hook-form";
3
3
  import { c as t } from "./cn-C9QoOYNG.js";
4
- import { D as F, F as N } from "./CollectionFormBuilder-DeGyMEXJ.js";
5
- import { u as g, S as w, F as b } from "./FormCaptcha-YeElu90S.js";
4
+ import { D as F, F as N } from "./CollectionFormBuilder-C9clUECd.js";
5
+ import { u as g, S as w, F as b } from "./FormCaptcha-QTqyITqd.js";
6
6
  import { B as D } from "./Spinner-BnrQ9e_i.js";
7
7
  const _ = () => {
8
8
  var n;
@@ -39,7 +39,7 @@ const _ = () => {
39
39
  "form",
40
40
  {
41
41
  className: t(
42
- "w-full rounded-md flex flex-col gap-6 px-4 md:px-8 py-6",
42
+ "w-full rounded-md flex text-text-1 flex-col gap-6 px-4 md:px-8 py-6",
43
43
  u && "opacity-50 pointer-events-none"
44
44
  ),
45
45
  id: "collection-form",
@@ -4,7 +4,7 @@ import { useState as f, useEffect as w } from "react";
4
4
  import { useController as R } from "react-hook-form";
5
5
  import B from "react-select";
6
6
  import { c as y } from "./cn-C9QoOYNG.js";
7
- import { z as D, A as N, B as q } from "./CollectionFormBuilder-DeGyMEXJ.js";
7
+ import { z as D, A as N, B as q } from "./CollectionFormBuilder-C9clUECd.js";
8
8
  import { I as L } from "./Input-2CvZ90f8.js";
9
9
  const G = ({
10
10
  field: s,
@@ -1,7 +1,7 @@
1
1
  import { j as r } from "./jsx-runtime-B6kdoens.js";
2
2
  import { useController as y } from "react-hook-form";
3
3
  import { G as C } from "./Spinner-BnrQ9e_i.js";
4
- import { z as F, A as I, B as V } from "./CollectionFormBuilder-DeGyMEXJ.js";
4
+ import { z as F, A as I, B as V } from "./CollectionFormBuilder-C9clUECd.js";
5
5
  import { I as b } from "./Input-2CvZ90f8.js";
6
6
  function w(e) {
7
7
  return C({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M1.75 3h20.5c.966 0 1.75.784 1.75 1.75v14a1.75 1.75 0 0 1-1.75 1.75H1.75A1.75 1.75 0 0 1 0 18.75v-14C0 3.784.784 3 1.75 3ZM1.5 7.412V18.75c0 .138.112.25.25.25h20.5a.25.25 0 0 0 .25-.25V7.412l-9.52 6.433c-.592.4-1.368.4-1.96 0Zm0-2.662v.852l10.36 7a.25.25 0 0 0 .28 0l10.36-7V4.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25Z" }, child: [] }] })(e);
@@ -3,7 +3,7 @@ import { useEffect as k, useState as b, useRef as J } from "react";
3
3
  import { useFormContext as W, useWatch as Y, useForm as B, useController as G } from "react-hook-form";
4
4
  import { useDebouncedCallback as H } from "use-debounce";
5
5
  import { u as x } from "./LevoProvider-BAZy7_tP.js";
6
- import { D as C, s as z, h as Q, c as X, A as Z } from "./CollectionFormBuilder-DeGyMEXJ.js";
6
+ import { D as C, s as z, h as Q, c as X, A as Z } from "./CollectionFormBuilder-C9clUECd.js";
7
7
  import { s as m } from "./Sonner-t6JVKA0a.js";
8
8
  import { e as D } from "./errorHandler-_34Yv8wA.js";
9
9
  import { a as h } from "./isEmptyObject-C5s4GzLE.js";
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { j as o } from "./jsx-runtime-B6kdoens.js";
3
3
  import { useState as p, useEffect as v } from "react";
4
- import { useController as z } from "react-hook-form";
5
- import { o as T } from "./Spinner-BnrQ9e_i.js";
6
- import { z as k, A as q, B as A } from "./CollectionFormBuilder-DeGyMEXJ.js";
4
+ import { useController as k } from "react-hook-form";
5
+ import { o as z } from "./Spinner-BnrQ9e_i.js";
6
+ import { z as T, A as q, B as A } from "./CollectionFormBuilder-C9clUECd.js";
7
7
  import { I as E } from "./Input-2CvZ90f8.js";
8
8
  import { u as O } from "./LevoProvider-BAZy7_tP.js";
9
9
  const $ = ({ field: t }) => {
@@ -11,9 +11,9 @@ const $ = ({ field: t }) => {
11
11
  const [c, h] = p(""), [m, u] = p(!1), [l, N] = p([]), [g, i] = p(!1), { client: a } = O(), { key: d = "", label: f = "", helper_text: w = "", readonly: j = !1 } = t, {
12
12
  field: { value: s, onBlur: F, onChange: y, ...L },
13
13
  fieldState: x
14
- } = z({
14
+ } = k({
15
15
  name: d,
16
- rules: k(t)
16
+ rules: T(t)
17
17
  }), B = !!(t != null && t.required), C = (_ = x == null ? void 0 : x.error) == null ? void 0 : _.message, I = (e) => {
18
18
  i(!0), u(!0), a == null || a.fetch.url(`/v1/bevy/content/location/${e == null ? void 0 : e.place_id}/get-location-details`).get().json().then((n) => {
19
19
  var r;
@@ -46,7 +46,7 @@ const $ = ({ field: t }) => {
46
46
  onBlur: () => {
47
47
  F();
48
48
  },
49
- rightIcon: g && /* @__PURE__ */ o.jsx(T, { size: "20px", className: "animate-spin" }),
49
+ rightIcon: g && /* @__PURE__ */ o.jsx(z, { size: "20px", className: "animate-spin" }),
50
50
  readOnly: j,
51
51
  ...L
52
52
  }
@@ -54,7 +54,7 @@ const $ = ({ field: t }) => {
54
54
  c && !g && !m && /* @__PURE__ */ o.jsx("div", { className: "absolute bg-white left-[-1px] z-50 p-[4px] w-full shadow-[0_0_8px_rgba(0,0,0,0.25)] rounded-[6px]", children: l != null && l.length ? l.map((e) => /* @__PURE__ */ o.jsx(
55
55
  "p",
56
56
  {
57
- className: "text-md p-[8px] cursor-pointer rounded-[6px] hover:bg-gray-200",
57
+ className: "text-md p-[8px] cursor-pointer rounded-[6px] hover:bg-gray-200 text-black",
58
58
  onClick: () => I(e),
59
59
  children: e.description
60
60
  },
@@ -2,8 +2,8 @@
2
2
  import { j as e } from "./jsx-runtime-B6kdoens.js";
3
3
  import { Plus as m } from "lucide-react";
4
4
  import { useFieldArray as n } from "react-hook-form";
5
- import { B as c } from "./CollectionFormBuilder-DeGyMEXJ.js";
6
- import { GeocoderWidget as d } from "./GeocoderWidget-BOqaJMm1.js";
5
+ import { B as c } from "./CollectionFormBuilder-C9clUECd.js";
6
+ import { GeocoderWidget as d } from "./GeocoderWidget-PKGgCyAq.js";
7
7
  import { B as p } from "./Spinner-BnrQ9e_i.js";
8
8
  const k = ({
9
9
  field: l
@@ -1,6 +1,6 @@
1
1
  import { j as a } from "./jsx-runtime-B6kdoens.js";
2
2
  import { useController as A } from "react-hook-form";
3
- import { z as C, A as b, B as q } from "./CollectionFormBuilder-DeGyMEXJ.js";
3
+ import { z as C, A as b, B as q } from "./CollectionFormBuilder-C9clUECd.js";
4
4
  import { I } from "./Input-2CvZ90f8.js";
5
5
  const f = ({ field: r }) => {
6
6
  var l;
@@ -3,7 +3,7 @@ import { j as o } from "./jsx-runtime-B6kdoens.js";
3
3
  import { useController as f } from "react-hook-form";
4
4
  import { PhoneInput as g } from "react-international-phone";
5
5
  import { c as l } from "./cn-C9QoOYNG.js";
6
- import { z as x, A as v, B as y } from "./CollectionFormBuilder-DeGyMEXJ.js";
6
+ import { z as x, A as v, B as y } from "./CollectionFormBuilder-C9clUECd.js";
7
7
  const P = ({ field: e }) => {
8
8
  const { key: u = "", label: t = "", helper_text: c = "", readonly: n = !1 } = e, s = u, {
9
9
  field: { value: d, onBlur: a, onChange: i, ...m },
@@ -5,7 +5,7 @@ import * as d from "react";
5
5
  import { useController as F } from "react-hook-form";
6
6
  import { G as B } from "./Spinner-BnrQ9e_i.js";
7
7
  import { c as N } from "./cn-C9QoOYNG.js";
8
- import { z as E, A as G, B as f } from "./CollectionFormBuilder-DeGyMEXJ.js";
8
+ import { z as E, A as G, B as f } from "./CollectionFormBuilder-C9clUECd.js";
9
9
  import { I as V } from "./Input-2CvZ90f8.js";
10
10
  function q(s) {
11
11
  return B({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "32", d: "M416 128 192 384l-96-96" }, child: [] }] })(s);
@@ -19,7 +19,7 @@ import { useState as q, useEffect as D } from "react";
19
19
  import { useController as G } from "react-hook-form";
20
20
  import { G as p, p as J, q as V, r as W, s as Z, t as _, u as P, v as K, w as Q, x as X, y as Y, z as $, A as nn } from "./Spinner-BnrQ9e_i.js";
21
21
  import { c as j } from "./cn-C9QoOYNG.js";
22
- import { z as ln, A as en, B as sn } from "./CollectionFormBuilder-DeGyMEXJ.js";
22
+ import { z as ln, A as en, B as sn } from "./CollectionFormBuilder-C9clUECd.js";
23
23
  function an(n) {
24
24
  return p({ tag: "svg", attr: { viewBox: "0 0 1024 1024" }, child: [{ tag: "path", attr: { d: "M758.2 839.1C851.8 765.9 912 651.9 912 523.9 912 303 733.5 124.3 512.6 124 291.4 123.7 112 302.8 112 523.9c0 125.2 57.5 236.9 147.6 310.2 3.5 2.8 8.6 2.2 11.4-1.3l39.4-50.5c2.7-3.4 2.1-8.3-1.2-11.1-8.1-6.6-15.9-13.7-23.4-21.2a318.64 318.64 0 0 1-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 0 1-68.6 101.7c-9.3 9.3-19.1 18-29.3 26L668.2 724a8 8 0 0 0-14.1 3l-39.6 162.2c-1.2 5 2.6 9.9 7.7 9.9l167 .8c6.7 0 10.5-7.7 6.3-12.9l-37.3-47.9z" }, child: [] }] })(n);
25
25
  }
@@ -3,13 +3,13 @@ import { j as t } from "./jsx-runtime-B6kdoens.js";
3
3
  import { useState as I, useMemo as y } from "react";
4
4
  import { FormProvider as T } from "react-hook-form";
5
5
  import { c as F } from "./cn-C9QoOYNG.js";
6
- import { D as N, F as _ } from "./CollectionFormBuilder-DeGyMEXJ.js";
7
- import { u as C, S as H, F as M } from "./FormCaptcha-YeElu90S.js";
6
+ import { D as N, F as _ } from "./CollectionFormBuilder-C9clUECd.js";
7
+ import { u as C, S as H, F as M } from "./FormCaptcha-QTqyITqd.js";
8
8
  import { B as g } from "./Spinner-BnrQ9e_i.js";
9
9
  const Y = () => {
10
10
  const [n, a] = I(0), { containerStyles: m } = N(), l = () => {
11
11
  a((o) => o - 1);
12
- }, e = () => {
12
+ }, s = () => {
13
13
  a((o) => o + 1);
14
14
  }, c = (o) => {
15
15
  a(o);
@@ -18,26 +18,26 @@ const Y = () => {
18
18
  q,
19
19
  {
20
20
  currentSectionIndex: n,
21
- handleNext: e,
21
+ handleNext: s,
22
22
  handlePrev: l,
23
23
  goToIndex: c
24
24
  }
25
25
  ) });
26
26
  }, q = ({ currentSectionIndex: n, handleNext: a, handlePrev: m, goToIndex: l }) => {
27
27
  var h, j, v;
28
- const { schema: e, isInternal: c, isDisabled: o, submitButtonConfig: i, uiConfig: d } = N(), r = y(
28
+ const { schema: s, isInternal: c, isDisabled: o, submitButtonConfig: i, uiConfig: d } = N(), r = y(
29
29
  () => {
30
- var s;
31
- return (s = e == null ? void 0 : e.sections) == null ? void 0 : s[n];
30
+ var e;
31
+ return (e = s == null ? void 0 : s.sections) == null ? void 0 : e[n];
32
32
  },
33
33
  [n]
34
34
  ), w = y(() => {
35
- if (e) {
36
- const s = { ...e };
37
- return r && s && (s.sections = [r]), s;
35
+ if (s) {
36
+ const e = { ...s };
37
+ return r && e && (e.sections = [r]), e;
38
38
  }
39
39
  return null;
40
- }, [r]), x = n === Number((h = e == null ? void 0 : e.sections) == null ? void 0 : h.length) - 1, {
40
+ }, [r]), x = n === Number((h = s == null ? void 0 : s.sections) == null ? void 0 : h.length) - 1, {
41
41
  methods: u,
42
42
  handleSubmit: E,
43
43
  isLoading: L,
@@ -53,11 +53,11 @@ const Y = () => {
53
53
  onSubmitSuccess: () => {
54
54
  l(0);
55
55
  },
56
- onSubmitError: (s) => {
56
+ onSubmitError: (e) => {
57
57
  var S;
58
- if (Array.isArray(s) && (s != null && s[0])) {
59
- const R = s == null ? void 0 : s[0];
60
- (S = e == null ? void 0 : e.sections) == null || S.forEach((p, z) => {
58
+ if (Array.isArray(e) && (e != null && e[0])) {
59
+ const R = e == null ? void 0 : e[0];
60
+ (S = s == null ? void 0 : s.sections) == null || S.forEach((p, z) => {
61
61
  var b;
62
62
  ((b = p == null ? void 0 : p.fields) == null ? void 0 : b.find((A) => A.key === R.param)) && l(z);
63
63
  });
@@ -70,7 +70,7 @@ const Y = () => {
70
70
  /* @__PURE__ */ t.jsx(
71
71
  H,
72
72
  {
73
- getContentId: (s) => D(s),
73
+ getContentId: (e) => D(e),
74
74
  isError: P,
75
75
  currentValues: V
76
76
  }
@@ -79,7 +79,7 @@ const Y = () => {
79
79
  "form",
80
80
  {
81
81
  className: F(
82
- "w-full rounded-md border border-[rgb(229, 231, 235)] min-h-12 px-4 md:px-8 py-6",
82
+ "w-full rounded-md border border-[rgb(229, 231, 235)] min-h-12 px-4 md:px-8 py-6 text-text-1",
83
83
  L && "opacity-50 pointer-events-none"
84
84
  ),
85
85
  id: "collection-form",
@@ -91,17 +91,17 @@ const Y = () => {
91
91
  "Step ",
92
92
  n + 1,
93
93
  "/",
94
- ((j = e == null ? void 0 : e.sections) == null ? void 0 : j.length) || 1
94
+ ((j = s == null ? void 0 : s.sections) == null ? void 0 : j.length) || 1
95
95
  ] })
96
96
  ] }),
97
97
  /* @__PURE__ */ t.jsxs("div", { className: "w-full flex flex-col gap-6", children: [
98
- (v = r == null ? void 0 : r.fields) == null ? void 0 : v.map((s) => s && !s.hidden ? /* @__PURE__ */ t.jsx(
98
+ (v = r == null ? void 0 : r.fields) == null ? void 0 : v.map((e) => e && !e.hidden ? /* @__PURE__ */ t.jsx(
99
99
  _,
100
100
  {
101
- field: s,
101
+ field: e,
102
102
  isInternal: c
103
103
  },
104
- s == null ? void 0 : s.key
104
+ e == null ? void 0 : e.key
105
105
  ) : null),
106
106
  !c && x && /* @__PURE__ */ t.jsx(M, {})
107
107
  ] }),
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { j as r } from "./jsx-runtime-B6kdoens.js";
3
3
  import { useController as k } from "react-hook-form";
4
- import { z as w, A as j, B as v } from "./CollectionFormBuilder-DeGyMEXJ.js";
4
+ import { z as w, A as j, B as v } from "./CollectionFormBuilder-C9clUECd.js";
5
5
  import * as c from "@radix-ui/react-switch";
6
6
  import * as y from "react";
7
7
  import { c as d } from "./cn-C9QoOYNG.js";
@@ -1,7 +1,7 @@
1
1
  import { j as t } from "./jsx-runtime-B6kdoens.js";
2
2
  import { useFormContext as g, get as h } from "react-hook-form";
3
3
  import { c as j } from "./cn-C9QoOYNG.js";
4
- import { A as F, B as b, z as y } from "./CollectionFormBuilder-DeGyMEXJ.js";
4
+ import { A as F, B as b, z as y } from "./CollectionFormBuilder-C9clUECd.js";
5
5
  import { I as f } from "./Input-2CvZ90f8.js";
6
6
  const k = ({
7
7
  field: r,
@@ -1,7 +1,7 @@
1
1
  import { j as s } from "./jsx-runtime-B6kdoens.js";
2
2
  import { useFormContext as u, get as x } from "react-hook-form";
3
3
  import { c as b } from "./cn-C9QoOYNG.js";
4
- import { A as g, B as f, z as h } from "./CollectionFormBuilder-DeGyMEXJ.js";
4
+ import { A as g, B as f, z as h } from "./CollectionFormBuilder-C9clUECd.js";
5
5
  const w = ({ field: e }) => {
6
6
  var a;
7
7
  const {
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { j as r } from "./jsx-runtime-B6kdoens.js";
3
3
  import { useController as p } from "react-hook-form";
4
- import { z as u, A as g, B as C } from "./CollectionFormBuilder-DeGyMEXJ.js";
4
+ import { z as u, A as g, B as C } from "./CollectionFormBuilder-C9clUECd.js";
5
5
  import { C as f } from "./Checbox-sq-atGlJ.js";
6
6
  const y = ({
7
7
  field: e
@@ -1,6 +1,6 @@
1
1
  import { j as e } from "./jsx-runtime-B6kdoens.js";
2
- import { H as s } from "./CollectionFormBuilder-DeGyMEXJ.js";
3
- import r from "./TextWidget-D4uLMuLS.js";
2
+ import { H as s } from "./CollectionFormBuilder-C9clUECd.js";
3
+ import r from "./TextWidget-BUKw__Xy.js";
4
4
  const a = (t) => /* @__PURE__ */ e.jsx(
5
5
  r,
6
6
  {
@@ -5,7 +5,7 @@ import { Upload as Z, X as at, ExternalLink as et } from "lucide-react";
5
5
  import { useState as B, useMemo as D, useRef as st, useEffect as R } from "react";
6
6
  import { useController as ot } from "react-hook-form";
7
7
  import { G as q, S as W, B as F, k as nt, T as ct, l as lt, m as V, n as H } from "./Spinner-BnrQ9e_i.js";
8
- import { t as it, g as dt, z as xt, w as J, A as ut, B as mt } from "./CollectionFormBuilder-DeGyMEXJ.js";
8
+ import { t as it, g as dt, z as xt, w as J, A as ut, B as mt } from "./CollectionFormBuilder-C9clUECd.js";
9
9
  import { u as G } from "./LevoProvider-BAZy7_tP.js";
10
10
  import { e as k } from "./errorHandler-_34Yv8wA.js";
11
11
  import { I as Q } from "./Input-2CvZ90f8.js";
@@ -1 +1 @@
1
- {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../src/audience/components/page.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAMnD,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC;IACtC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC;CACvC,CA4FA,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../src/audience/components/page.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAOnD,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC;IACtC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC;CACvC,CAuGA,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const useCurrentTab: () => string | null;
2
+ export default useCurrentTab;
3
+ //# sourceMappingURL=useCurrentTab.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCurrentTab.d.ts","sourceRoot":"","sources":["../../../src/audience/hooks/useCurrentTab.tsx"],"names":[],"mappings":"AAOA,QAAA,MAAM,aAAa,QAAO,MAAM,GAAG,IAsDlC,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const useOpenTabs: () => number;
2
+ export default useOpenTabs;
3
+ //# sourceMappingURL=useOpenTabs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useOpenTabs.d.ts","sourceRoot":"","sources":["../../../src/audience/hooks/useOpenTabs.tsx"],"names":[],"mappings":"AAMA,QAAA,MAAM,WAAW,QAAO,MAuCvB,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useScrollDepth.d.ts","sourceRoot":"","sources":["../../../src/audience/hooks/useScrollDepth.tsx"],"names":[],"mappings":"AAKA;;;GAGG;AACH,eAAO,MAAM,cAAc,cAwC1B,CAAC"}
@@ -1,4 +1,4 @@
1
- import { L as e, a, b as n } from "../page-sR2SWtb2.js";
1
+ import { L as e, a, b as n } from "../page-nOk3Od6l.js";
2
2
  export {
3
3
  e as LevoInsightsBlock,
4
4
  a as LevoInsightsComponent,
@@ -1,4 +1,4 @@
1
- import { C as s, F as r, e as t, b as i, c as l, f as o, g as d, d as m, i as u, a as n, p as f, h as F, s as g, u as p, v as V } from "../CollectionFormBuilder-DeGyMEXJ.js";
1
+ import { C as s, F as r, e as t, b as i, c as l, f as o, g as d, d as m, i as u, a as n, p as f, h as F, s as g, u as p, v as V } from "../CollectionFormBuilder-C9clUECd.js";
2
2
  import { default as h } from "validatorjs";
3
3
  export {
4
4
  s as CollectionFormBuilder,
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { L as s, u as o } from "./LevoProvider-BAZy7_tP.js";
2
- import { L as t, a as r, b as l } from "./page-sR2SWtb2.js";
3
- import { C as m, F as p, x as d, y as g, m as T, r as f, j as u, n as c, e as x, b, c as D, f as y, g as F, d as v, k as h, o as L, i as M, a as E, w as P, t as B, p as C, h as O, s as V, u as j, v as I, l as S, q as K } from "./CollectionFormBuilder-DeGyMEXJ.js";
2
+ import { L as t, a as r, b as l } from "./page-nOk3Od6l.js";
3
+ import { C as m, F as p, x as d, y as g, m as T, r as f, j as u, n as c, e as x, b, c as D, f as y, g as F, d as v, k as h, o as L, i as M, a as E, w as P, t as B, p as C, h as O, s as V, u as j, v as I, l as S, q as K } from "./CollectionFormBuilder-C9clUECd.js";
4
4
  import { LevoOAuth as U } from "./membership/index.js";
5
5
  import { B as H, D as N, j as q, e as w, i as z, g as A, f as R, c as G, a as J, h as Q, d as X, k as Y, S as Z, T as _, n as $, l as aa, m as ea, b as sa } from "./Spinner-BnrQ9e_i.js";
6
6
  import { T as ia, e as ta, s as ra } from "./Sonner-t6JVKA0a.js";
@@ -0,0 +1,230 @@
1
+ "use client";
2
+ import { j as H } from "./jsx-runtime-B6kdoens.js";
3
+ import { useEffect as u, useState as h } from "react";
4
+ import { useInView as G } from "react-intersection-observer";
5
+ import { u as j } from "./LevoProvider-BAZy7_tP.js";
6
+ import { usePageLifecycle as F, LifecycleState as O } from "use-page-lifecycle";
7
+ const Le = ({ id: e, properties: r = {} }) => {
8
+ const { audience: t } = j(), { ref: n, inView: o } = G({
9
+ triggerOnce: !0
10
+ });
11
+ return u(() => {
12
+ t != null && t.instance && o && (t == null || t.track("block.view", {
13
+ ...r,
14
+ resource: "block",
15
+ identifier: e
16
+ }));
17
+ }, [o]), /* @__PURE__ */ H.jsx("div", { ref: n, style: { height: "0px" } });
18
+ }, Ie = ({ event: e, properties: r }) => {
19
+ const { audience: t } = j();
20
+ return u(() => {
21
+ t != null && t.instance && (t == null || t.track(e, r));
22
+ }, [t == null ? void 0 : t.instance, e, r]), null;
23
+ };
24
+ function I(e) {
25
+ var r = typeof e;
26
+ return e != null && (r == "object" || r == "function");
27
+ }
28
+ var Y = typeof global == "object" && global && global.Object === Object && global, J = typeof self == "object" && self && self.Object === Object && self, U = Y || J || Function("return this")(), E = function() {
29
+ return U.Date.now();
30
+ }, K = /\s/;
31
+ function V(e) {
32
+ for (var r = e.length; r-- && K.test(e.charAt(r)); )
33
+ ;
34
+ return r;
35
+ }
36
+ var z = /^\s+/;
37
+ function X(e) {
38
+ return e && e.slice(0, V(e) + 1).replace(z, "");
39
+ }
40
+ var w = U.Symbol, B = Object.prototype, Z = B.hasOwnProperty, q = B.toString, b = w ? w.toStringTag : void 0;
41
+ function Q(e) {
42
+ var r = Z.call(e, b), t = e[b];
43
+ try {
44
+ e[b] = void 0;
45
+ var n = !0;
46
+ } catch {
47
+ }
48
+ var o = q.call(e);
49
+ return n && (r ? e[b] = t : delete e[b]), o;
50
+ }
51
+ var ee = Object.prototype, te = ee.toString;
52
+ function ne(e) {
53
+ return te.call(e);
54
+ }
55
+ var re = "[object Null]", oe = "[object Undefined]", N = w ? w.toStringTag : void 0;
56
+ function ie(e) {
57
+ return e == null ? e === void 0 ? oe : re : N && N in Object(e) ? Q(e) : ne(e);
58
+ }
59
+ function se(e) {
60
+ return e != null && typeof e == "object";
61
+ }
62
+ var ae = "[object Symbol]";
63
+ function ce(e) {
64
+ return typeof e == "symbol" || se(e) && ie(e) == ae;
65
+ }
66
+ var R = NaN, fe = /^[-+]0x[0-9a-f]+$/i, le = /^0b[01]+$/i, ue = /^0o[0-7]+$/i, de = parseInt;
67
+ function C(e) {
68
+ if (typeof e == "number")
69
+ return e;
70
+ if (ce(e))
71
+ return R;
72
+ if (I(e)) {
73
+ var r = typeof e.valueOf == "function" ? e.valueOf() : e;
74
+ e = I(r) ? r + "" : r;
75
+ }
76
+ if (typeof e != "string")
77
+ return e === 0 ? e : +e;
78
+ e = X(e);
79
+ var t = le.test(e);
80
+ return t || ue.test(e) ? de(e.slice(2), t ? 2 : 8) : fe.test(e) ? R : +e;
81
+ }
82
+ var ge = "Expected a function", me = Math.max, be = Math.min;
83
+ function pe(e, r, t) {
84
+ var n, o, i, f, a, c, l = 0, k = !1, g = !1, v = !0;
85
+ if (typeof e != "function")
86
+ throw new TypeError(ge);
87
+ r = C(r) || 0, I(t) && (k = !!t.leading, g = "maxWait" in t, i = g ? me(C(t.maxWait) || 0, r) : i, v = "trailing" in t ? !!t.trailing : v);
88
+ function S(s) {
89
+ var d = n, m = o;
90
+ return n = o = void 0, l = s, f = e.apply(m, d), f;
91
+ }
92
+ function $(s) {
93
+ return l = s, a = setTimeout(T, r), k ? S(s) : f;
94
+ }
95
+ function P(s) {
96
+ var d = s - c, m = s - l, A = r - d;
97
+ return g ? be(A, i - m) : A;
98
+ }
99
+ function x(s) {
100
+ var d = s - c, m = s - l;
101
+ return c === void 0 || d >= r || d < 0 || g && m >= i;
102
+ }
103
+ function T() {
104
+ var s = E();
105
+ if (x(s))
106
+ return _(s);
107
+ a = setTimeout(T, P(s));
108
+ }
109
+ function _(s) {
110
+ return a = void 0, v && n ? S(s) : (n = o = void 0, f);
111
+ }
112
+ function W() {
113
+ a !== void 0 && clearTimeout(a), l = 0, n = c = o = a = void 0;
114
+ }
115
+ function M() {
116
+ return a === void 0 ? f : _(E());
117
+ }
118
+ function y() {
119
+ var s = E(), d = x(s);
120
+ if (n = arguments, o = this, c = s, d) {
121
+ if (a === void 0)
122
+ return $(c);
123
+ if (g)
124
+ return clearTimeout(a), a = setTimeout(T, r), S(c);
125
+ }
126
+ return a === void 0 && (a = setTimeout(T, r)), f;
127
+ }
128
+ return y.cancel = W, y.flush = M, y;
129
+ }
130
+ const he = () => {
131
+ const [e, r] = h(0), [t, n] = h(0), o = pe((i) => {
132
+ n(i), r(i);
133
+ }, 250);
134
+ return u(() => {
135
+ const i = () => {
136
+ const f = window.scrollY, a = document.documentElement.scrollHeight, c = window.innerHeight, l = Math.round(
137
+ f / (a - c) * 100
138
+ );
139
+ l % 10 === 0 && l > t && o(l);
140
+ };
141
+ return window.addEventListener("scroll", i), () => window.removeEventListener("scroll", i);
142
+ }, [t]), e;
143
+ }, p = "lv_insights_ot", Te = () => {
144
+ const [e, r] = h(0);
145
+ return u(() => {
146
+ const t = Number(localStorage.getItem(p)) || 0;
147
+ r(t), localStorage.setItem(p, (t + 1).toString());
148
+ const n = (i) => {
149
+ i.key === p && r(Number(i.newValue) || 0);
150
+ };
151
+ window.addEventListener("storage", n);
152
+ const o = () => {
153
+ const i = Number(localStorage.getItem(p)) || 0;
154
+ i > 0 && localStorage.setItem(p, (i - 1).toString());
155
+ };
156
+ return window.addEventListener("beforeunload", o), () => {
157
+ window.removeEventListener("storage", n), window.removeEventListener("beforeunload", o);
158
+ };
159
+ }, []), e;
160
+ }, D = "lv_insights_ct", L = "lv_insights_at", we = () => {
161
+ const [e, r] = h(null);
162
+ return u(() => {
163
+ let t = sessionStorage.getItem(D);
164
+ const n = JSON.parse(
165
+ localStorage.getItem(L) || "[]"
166
+ );
167
+ t && n.includes(t) && (t = null), t || (t = `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, sessionStorage.setItem(D, t)), n.includes(t) || (n.push(t), localStorage.setItem(
168
+ L,
169
+ JSON.stringify(n)
170
+ )), r(t);
171
+ const o = () => {
172
+ const i = n.filter(
173
+ (f) => f !== t
174
+ );
175
+ localStorage.setItem(
176
+ L,
177
+ JSON.stringify(i)
178
+ );
179
+ };
180
+ return window.addEventListener("beforeunload", o), () => {
181
+ window.removeEventListener("beforeunload", o);
182
+ };
183
+ }, []), e;
184
+ }, je = ({ id: e, properties: r = {} }) => {
185
+ const { client: t, audience: n } = j(), [o, i] = h(), f = he(), a = typeof window < "u" ? window.location.href : void 0;
186
+ Te(), we(), u(() => {
187
+ a && i(a);
188
+ }, [a]), u(() => {
189
+ n != null && n.instance && f > 0 && n.track("page.scroll", {
190
+ resource: "page",
191
+ identifier: e,
192
+ percent: f
193
+ });
194
+ }, [n == null ? void 0 : n.instance, f, e]), u(() => {
195
+ const l = () => {
196
+ n == null || n.bounce({
197
+ resource: "page",
198
+ identifier: e
199
+ });
200
+ };
201
+ return window && window.addEventListener("beforeunload", l), () => {
202
+ window && window.removeEventListener("beforeunload", l);
203
+ };
204
+ }, [n, e]);
205
+ const [c] = F();
206
+ return u(() => {
207
+ (c === O.TERMINATED || c === O.HIDDEN || c === O.FROZEN) && (n == null || n.bounce({
208
+ resource: "page",
209
+ identifier: e,
210
+ state: c
211
+ }));
212
+ }, [c, n, e]), u(() => {
213
+ (() => {
214
+ t != null && t.insightsUrl && t.workspace && o && (n != null && n.instance ? n.instance.page({
215
+ resource: "page",
216
+ identifier: e
217
+ }) : n == null || n.initiate({
218
+ ...r,
219
+ id: e
220
+ }));
221
+ })();
222
+ }, [t == null ? void 0 : t.insightsUrl, t == null ? void 0 : t.workspace, o]), (!(t != null && t.insightsUrl) || !t.workspace || !t.workspace.startsWith("W")) && console.error(
223
+ "[@levo-so/audience] The utility could not be initialized, due to missing workspace, or endpoint for insights."
224
+ ), null;
225
+ };
226
+ export {
227
+ Le as L,
228
+ Ie as a,
229
+ je as b
230
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@levo-so/react",
3
- "version": "0.1.22",
3
+ "version": "0.1.25",
4
4
  "author": "Levo Engineering <devs@theinternetfolks.com>",
5
5
  "description": "Levo suite for React based applications",
6
6
  "type": "module",
@@ -16,7 +16,7 @@
16
16
  "peerDependencies": {
17
17
  "react": ">=18",
18
18
  "react-dom": ">=18",
19
- "@levo-so/core": "0.1.22"
19
+ "@levo-so/core": "0.1.25"
20
20
  },
21
21
  "dependencies": {
22
22
  "@radix-ui/react-checkbox": "1.1.1",
@@ -90,9 +90,9 @@
90
90
  "typescript": "5.5.4",
91
91
  "vite": "5.4.3",
92
92
  "vite-plugin-dts": "4.1.0",
93
- "@levo/eslint-config": "0.0.0",
94
93
  "@levo/tw-config": "0.0.0",
95
- "@levo/ts-config": "0.0.0"
94
+ "@levo/ts-config": "0.0.0",
95
+ "@levo/eslint-config": "0.0.0"
96
96
  },
97
97
  "main": "./dist/index.js",
98
98
  "module": "./dist/index.js",
@@ -1 +0,0 @@
1
- {"version":3,"file":"useScrollDepth.d.ts","sourceRoot":"","sources":["../../../src/audience/components/useScrollDepth.tsx"],"names":[],"mappings":"AAKA;;;GAGG;AACH,eAAO,MAAM,cAAc,cAwC1B,CAAC"}
@@ -1,189 +0,0 @@
1
- "use client";
2
- import { j as B } from "./jsx-runtime-B6kdoens.js";
3
- import { useEffect as d, useState as j } from "react";
4
- import { useInView as C } from "react-intersection-observer";
5
- import { u as O } from "./LevoProvider-BAZy7_tP.js";
6
- import { usePageLifecycle as H, LifecycleState as I } from "use-page-lifecycle";
7
- const we = ({ id: e, properties: r = {} }) => {
8
- const { audience: t } = O(), { ref: n, inView: s } = C({
9
- triggerOnce: !0
10
- });
11
- return d(() => {
12
- t != null && t.instance && s && (t == null || t.track("block.view", {
13
- ...r,
14
- resource: "block",
15
- identifier: e
16
- }));
17
- }, [s]), /* @__PURE__ */ B.jsx("div", { ref: n, style: { height: "0px" } });
18
- }, Te = ({ event: e, properties: r }) => {
19
- const { audience: t } = O();
20
- return d(() => {
21
- t != null && t.instance && (t == null || t.track(e, r));
22
- }, [t == null ? void 0 : t.instance, e, r]), null;
23
- };
24
- function S(e) {
25
- var r = typeof e;
26
- return e != null && (r == "object" || r == "function");
27
- }
28
- var F = typeof global == "object" && global && global.Object === Object && global, G = typeof self == "object" && self && self.Object === Object && self, W = F || G || Function("return this")(), T = function() {
29
- return W.Date.now();
30
- }, V = /\s/;
31
- function _(e) {
32
- for (var r = e.length; r-- && V.test(e.charAt(r)); )
33
- ;
34
- return r;
35
- }
36
- var z = /^\s+/;
37
- function X(e) {
38
- return e && e.slice(0, _(e) + 1).replace(z, "");
39
- }
40
- var h = W.Symbol, D = Object.prototype, Y = D.hasOwnProperty, Z = D.toString, p = h ? h.toStringTag : void 0;
41
- function q(e) {
42
- var r = Y.call(e, p), t = e[p];
43
- try {
44
- e[p] = void 0;
45
- var n = !0;
46
- } catch {
47
- }
48
- var s = Z.call(e);
49
- return n && (r ? e[p] = t : delete e[p]), s;
50
- }
51
- var J = Object.prototype, K = J.toString;
52
- function Q(e) {
53
- return K.call(e);
54
- }
55
- var ee = "[object Null]", te = "[object Undefined]", A = h ? h.toStringTag : void 0;
56
- function ne(e) {
57
- return e == null ? e === void 0 ? te : ee : A && A in Object(e) ? q(e) : Q(e);
58
- }
59
- function re(e) {
60
- return e != null && typeof e == "object";
61
- }
62
- var ie = "[object Symbol]";
63
- function oe(e) {
64
- return typeof e == "symbol" || re(e) && ne(e) == ie;
65
- }
66
- var P = NaN, se = /^[-+]0x[0-9a-f]+$/i, ce = /^0b[01]+$/i, ae = /^0o[0-7]+$/i, fe = parseInt;
67
- function R(e) {
68
- if (typeof e == "number")
69
- return e;
70
- if (oe(e))
71
- return P;
72
- if (S(e)) {
73
- var r = typeof e.valueOf == "function" ? e.valueOf() : e;
74
- e = S(r) ? r + "" : r;
75
- }
76
- if (typeof e != "string")
77
- return e === 0 ? e : +e;
78
- e = X(e);
79
- var t = ce.test(e);
80
- return t || ae.test(e) ? fe(e.slice(2), t ? 2 : 8) : se.test(e) ? P : +e;
81
- }
82
- var le = "Expected a function", ue = Math.max, de = Math.min;
83
- function ge(e, r, t) {
84
- var n, s, a, l, i, c, f = 0, k = !1, g = !1, v = !0;
85
- if (typeof e != "function")
86
- throw new TypeError(le);
87
- r = R(r) || 0, S(t) && (k = !!t.leading, g = "maxWait" in t, a = g ? ue(R(t.maxWait) || 0, r) : a, v = "trailing" in t ? !!t.trailing : v);
88
- function y(o) {
89
- var u = n, m = s;
90
- return n = s = void 0, f = o, l = e.apply(m, u), l;
91
- }
92
- function N(o) {
93
- return f = o, i = setTimeout(b, r), k ? y(o) : l;
94
- }
95
- function U(o) {
96
- var u = o - c, m = o - f, x = r - u;
97
- return g ? de(x, a - m) : x;
98
- }
99
- function E(o) {
100
- var u = o - c, m = o - f;
101
- return c === void 0 || u >= r || u < 0 || g && m >= a;
102
- }
103
- function b() {
104
- var o = T();
105
- if (E(o))
106
- return L(o);
107
- i = setTimeout(b, U(o));
108
- }
109
- function L(o) {
110
- return i = void 0, v && n ? y(o) : (n = s = void 0, l);
111
- }
112
- function $() {
113
- i !== void 0 && clearTimeout(i), f = 0, n = c = s = i = void 0;
114
- }
115
- function M() {
116
- return i === void 0 ? l : L(T());
117
- }
118
- function w() {
119
- var o = T(), u = E(o);
120
- if (n = arguments, s = this, c = o, u) {
121
- if (i === void 0)
122
- return N(c);
123
- if (g)
124
- return clearTimeout(i), i = setTimeout(b, r), y(c);
125
- }
126
- return i === void 0 && (i = setTimeout(b, r)), l;
127
- }
128
- return w.cancel = $, w.flush = M, w;
129
- }
130
- const me = () => {
131
- const [e, r] = j(0), [t, n] = j(0), s = ge((a) => {
132
- n(a), r(a);
133
- }, 250);
134
- return d(() => {
135
- const a = () => {
136
- const l = window.scrollY, i = document.documentElement.scrollHeight, c = window.innerHeight, f = Math.round(
137
- l / (i - c) * 100
138
- );
139
- f % 10 === 0 && f > t && s(f);
140
- };
141
- return window.addEventListener("scroll", a), () => window.removeEventListener("scroll", a);
142
- }, [t]), e;
143
- }, je = ({ id: e, properties: r = {} }) => {
144
- const { client: t, audience: n } = O(), [s, a] = j(), l = me(), i = typeof window < "u" ? window.location.href : void 0;
145
- d(() => {
146
- i && a(i);
147
- }, [i]), d(() => {
148
- n != null && n.instance && n.track("page.scroll", {
149
- resource: "page",
150
- identifier: e,
151
- percent: l
152
- });
153
- }, [n == null ? void 0 : n.instance, l, e]), d(() => {
154
- const f = () => {
155
- n == null || n.bounce({
156
- resource: "page",
157
- identifier: e
158
- });
159
- };
160
- return window && window.addEventListener("beforeunload", f), () => {
161
- window && window.removeEventListener("beforeunload", f);
162
- };
163
- }, [i, n, e]);
164
- const [c] = H();
165
- return d(() => {
166
- (c === I.TERMINATED || c === I.FROZEN) && (n == null || n.bounce({
167
- resource: "page",
168
- identifier: e,
169
- state: c
170
- }));
171
- }, [c, n, e]), d(() => {
172
- (() => {
173
- t != null && t.insightsUrl && t.workspace && s && (n != null && n.instance ? n.instance.page({
174
- resource: "page",
175
- identifier: e
176
- }) : n == null || n.initiate({
177
- ...r,
178
- id: e
179
- }));
180
- })();
181
- }, [t == null ? void 0 : t.insightsUrl, t == null ? void 0 : t.workspace, s]), (!(t != null && t.insightsUrl) || !t.workspace || !t.workspace.startsWith("W")) && console.error(
182
- "[@levo-so/audience] The utility could not be initialized, due to missing workspace, or endpoint for insights."
183
- ), null;
184
- };
185
- export {
186
- we as L,
187
- Te as a,
188
- je as b
189
- };