@levo-so/react 0.1.24 → 0.1.26

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 (42) hide show
  1. package/dist/{CheckboxWidget-DZIHdYf_.js → CheckboxWidget-Bug2FXpG.js} +1 -1
  2. package/dist/{CollectionFormBuilder-C9clUECd.js → CollectionFormBuilder-DxViQE0w.js} +18 -18
  3. package/dist/{CurrencyWidget-BPjhIZC3.js → CurrencyWidget-BtjxmXgj.js} +1 -1
  4. package/dist/{DateTimeWidget-BHPInVmB.js → DateTimeWidget-Ds8g90-j.js} +1 -1
  5. package/dist/{DefaultFormVariant-DfM-Rnjm.js → DefaultFormVariant-ChnisPj2.js} +3 -3
  6. package/dist/{DropdownWidget-C0XD8XNO.js → DropdownWidget-B2o6wz-C.js} +1 -1
  7. package/dist/{EmailWidget-lfSEQ6Pw.js → EmailWidget-Cfyfy5OH.js} +2 -2
  8. package/dist/{FormCaptcha-QTqyITqd.js → FormCaptcha-BOjVusbv.js} +1 -1
  9. package/dist/{GeocoderWidget-PKGgCyAq.js → GeocoderWidget-B5TnEwp-.js} +2 -2
  10. package/dist/{MultiGeocoderWidget-B6tJY_NH.js → MultiGeocoderWidget-CF4HGkCg.js} +3 -3
  11. package/dist/{MultiTextWidget-BSlDBIxt.js → MultiTextWidget-fnzlopnN.js} +1 -1
  12. package/dist/{PhoneWidget-CZ613uWl.js → PhoneWidget-BVk5mhOm.js} +10 -10
  13. package/dist/{RadioWidget-q0_ddtou.js → RadioWidget-CouCg5aG.js} +2 -2
  14. package/dist/{RichTextWidget-D2D9-g4e.js → RichTextWidget-dqN--eKc.js} +2 -2
  15. package/dist/{Spinner-BnrQ9e_i.js → Spinner-CDMNP44S.js} +43 -39
  16. package/dist/{StepsFormVariant-eQuIooBH.js → StepsFormVariant-Buw3v2UB.js} +3 -3
  17. package/dist/{SwitchWidget-DJJNsK2d.js → SwitchWidget-BkBgr_nQ.js} +1 -1
  18. package/dist/{TextWidget-BUKw__Xy.js → TextWidget-I9pwxamg.js} +1 -1
  19. package/dist/{TextareaWidget-CImcGtRi.js → TextareaWidget-takl2qqW.js} +1 -1
  20. package/dist/{ToggleCheckboxWidget-BHJmd8lZ.js → ToggleCheckboxWidget-B8hL0ZhV.js} +1 -1
  21. package/dist/Tooltip-DoWyn3Ho.js +37 -0
  22. package/dist/{URLWidget-HUj8G1oS.js → URLWidget-C1S_yZ9J.js} +2 -2
  23. package/dist/{UploadWidget-Bzamcq6F.js → UploadWidget-D7USwx7q.js} +3 -3
  24. package/dist/audience/components/page.d.ts.map +1 -1
  25. package/dist/audience/hooks/useCurrentTab.d.ts +3 -0
  26. package/dist/audience/hooks/useCurrentTab.d.ts.map +1 -0
  27. package/dist/audience/hooks/useOpenTabs.d.ts +3 -0
  28. package/dist/audience/hooks/useOpenTabs.d.ts.map +1 -0
  29. package/dist/audience/hooks/useScrollDepth.d.ts.map +1 -0
  30. package/dist/audience/index.js +1 -1
  31. package/dist/collection/index.js +1 -1
  32. package/dist/components/Dialog.d.ts.map +1 -1
  33. package/dist/components/Tooltip.d.ts.map +1 -1
  34. package/dist/components/index.js +2 -2
  35. package/dist/index.css +1 -1
  36. package/dist/index.js +4 -4
  37. package/dist/page-D-1JUzts.js +268 -0
  38. package/package.json +4 -4
  39. package/dist/Tooltip-DPzkfrjl.js +0 -37
  40. package/dist/audience/components/useScrollDepth.d.ts.map +0 -1
  41. package/dist/page-sR2SWtb2.js +0 -189
  42. /package/dist/audience/{components → hooks}/useScrollDepth.d.ts +0 -0
@@ -0,0 +1,268 @@
1
+ "use client";
2
+ import { j as W } from "./jsx-runtime-B6kdoens.js";
3
+ import { useEffect as d, useState as E } from "react";
4
+ import { useInView as G } from "react-intersection-observer";
5
+ import { u as _ } from "./LevoProvider-BAZy7_tP.js";
6
+ import { usePageLifecycle as F, LifecycleState as k } from "use-page-lifecycle";
7
+ const Oe = ({ id: e, properties: r = {} }) => {
8
+ const { audience: t } = _(), { ref: n, inView: o } = G({
9
+ triggerOnce: !0
10
+ });
11
+ return d(() => {
12
+ t != null && t.instance && o && (t == null || t.track("block.view", {
13
+ ...r,
14
+ resource: "block",
15
+ identifier: e
16
+ }));
17
+ }, [o]), /* @__PURE__ */ W.jsx("div", { ref: n, style: { height: "0px" } });
18
+ }, Ie = ({ event: e, properties: r }) => {
19
+ const { audience: t } = _();
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 A(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, $ = Y || J || Function("return this")(), j = function() {
29
+ return $.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 O = $.Symbol, H = Object.prototype, Z = H.hasOwnProperty, q = H.toString, S = O ? O.toStringTag : void 0;
41
+ function Q(e) {
42
+ var r = Z.call(e, S), t = e[S];
43
+ try {
44
+ e[S] = void 0;
45
+ var n = !0;
46
+ } catch {
47
+ }
48
+ var o = q.call(e);
49
+ return n && (r ? e[S] = t : delete e[S]), 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]", R = O ? O.toStringTag : void 0;
56
+ function ie(e) {
57
+ return e == null ? e === void 0 ? oe : re : R && R 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 D = NaN, fe = /^[-+]0x[0-9a-f]+$/i, le = /^0b[01]+$/i, ue = /^0o[0-7]+$/i, de = parseInt;
67
+ function U(e) {
68
+ if (typeof e == "number")
69
+ return e;
70
+ if (ce(e))
71
+ return D;
72
+ if (A(e)) {
73
+ var r = typeof e.valueOf == "function" ? e.valueOf() : e;
74
+ e = A(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) ? D : +e;
81
+ }
82
+ var ge = "Expected a function", me = Math.max, be = Math.min;
83
+ function he(e, r, t) {
84
+ var n, o, i, f, a, c, l = 0, m = !1, b = !1, T = !0;
85
+ if (typeof e != "function")
86
+ throw new TypeError(ge);
87
+ r = U(r) || 0, A(t) && (m = !!t.leading, b = "maxWait" in t, i = b ? me(U(t.maxWait) || 0, r) : i, T = "trailing" in t ? !!t.trailing : T);
88
+ function g(s) {
89
+ var h = n, w = o;
90
+ return n = o = void 0, l = s, f = e.apply(w, h), f;
91
+ }
92
+ function p(s) {
93
+ return l = s, a = setTimeout(L, r), m ? g(s) : f;
94
+ }
95
+ function v(s) {
96
+ var h = s - c, w = s - l, N = r - h;
97
+ return b ? be(N, i - w) : N;
98
+ }
99
+ function u(s) {
100
+ var h = s - c, w = s - l;
101
+ return c === void 0 || h >= r || h < 0 || b && w >= i;
102
+ }
103
+ function L() {
104
+ var s = j();
105
+ if (u(s))
106
+ return C(s);
107
+ a = setTimeout(L, v(s));
108
+ }
109
+ function C(s) {
110
+ return a = void 0, T && n ? g(s) : (n = o = void 0, f);
111
+ }
112
+ function M() {
113
+ a !== void 0 && clearTimeout(a), l = 0, n = c = o = a = void 0;
114
+ }
115
+ function P() {
116
+ return a === void 0 ? f : C(j());
117
+ }
118
+ function I() {
119
+ var s = j(), h = u(s);
120
+ if (n = arguments, o = this, c = s, h) {
121
+ if (a === void 0)
122
+ return p(c);
123
+ if (b)
124
+ return clearTimeout(a), a = setTimeout(L, r), g(c);
125
+ }
126
+ return a === void 0 && (a = setTimeout(L, r)), f;
127
+ }
128
+ return I.cancel = M, I.flush = P, I;
129
+ }
130
+ const pe = () => {
131
+ const [e, r] = E(0), [t, n] = E(0), o = he((i) => {
132
+ n(i), r(i);
133
+ }, 250);
134
+ return d(() => {
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
+ }, y = "lv_insights_ot", Te = () => {
144
+ const [e, r] = E(0);
145
+ return d(() => {
146
+ const t = Number(localStorage.getItem(y)) || 0;
147
+ r(t), localStorage.setItem(y, (t + 1).toString());
148
+ const n = (i) => {
149
+ i.key === y && r(Number(i.newValue) || 0);
150
+ };
151
+ window.addEventListener("storage", n);
152
+ const o = () => {
153
+ const i = Number(localStorage.getItem(y)) || 0;
154
+ i > 0 && localStorage.setItem(y, (i - 1).toString());
155
+ };
156
+ return window.addEventListener("beforeunload", o), () => {
157
+ window.removeEventListener("storage", n), window.removeEventListener("beforeunload", o);
158
+ };
159
+ }, []), e;
160
+ }, B = "lv_insights_ct", x = "lv_insights_at", ve = () => {
161
+ const [e, r] = E(null);
162
+ return d(() => {
163
+ let t = sessionStorage.getItem(B);
164
+ const n = JSON.parse(
165
+ localStorage.getItem(x) || "[]"
166
+ );
167
+ t && n.includes(t) && (t = null), t || (t = `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, sessionStorage.setItem(B, t)), n.includes(t) || (n.push(t), localStorage.setItem(
168
+ x,
169
+ JSON.stringify(n)
170
+ )), r(t);
171
+ const o = () => {
172
+ const i = n.filter(
173
+ (f) => f !== t
174
+ );
175
+ localStorage.setItem(
176
+ x,
177
+ JSON.stringify(i)
178
+ );
179
+ };
180
+ return window.addEventListener("beforeunload", o), () => {
181
+ window.removeEventListener("beforeunload", o);
182
+ };
183
+ }, []), e;
184
+ }, ke = ({ id: e, properties: r = {} }) => {
185
+ const { client: t, audience: n } = _(), [o, i] = E(), f = pe(), a = typeof window < "u" ? window.location.href : void 0;
186
+ Te(), ve(), d(() => {
187
+ a && i(a);
188
+ }, [a]), d(() => {
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]), d(() => {
195
+ const m = () => {
196
+ n == null || n.bounce({
197
+ resource: "page",
198
+ identifier: e
199
+ });
200
+ };
201
+ return window && window.addEventListener("beforeunload", m), () => {
202
+ window && window.removeEventListener("beforeunload", m);
203
+ };
204
+ }, [n, e]);
205
+ const [c] = F();
206
+ d(() => {
207
+ (c === k.TERMINATED || c === k.HIDDEN || c === k.FROZEN) && (n == null || n.bounce({
208
+ resource: "page",
209
+ identifier: e,
210
+ state: c
211
+ }));
212
+ }, [c, n, e]), d(() => {
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]);
223
+ let l = !1;
224
+ return d(() => {
225
+ const m = (b) => {
226
+ if (l)
227
+ return;
228
+ if (l = !0, b.target instanceof HTMLElement) {
229
+ const g = b.target;
230
+ let p = "";
231
+ try {
232
+ if (p = g == null ? void 0 : g.getAttribute("href"), !p) {
233
+ let v = 0, u = g.parentNode;
234
+ for (; u && v < 10; ) {
235
+ if (u != null && u.getAttribute("href")) {
236
+ p = u == null ? void 0 : u.getAttribute("href");
237
+ break;
238
+ }
239
+ u = u.parentNode, v++;
240
+ }
241
+ }
242
+ } catch {
243
+ }
244
+ n == null || n.track("page.click", {
245
+ element: g.tagName,
246
+ text: g.innerText,
247
+ href: p || void 0
248
+ });
249
+ }
250
+ const T = setTimeout(() => {
251
+ l = !1;
252
+ }, 0);
253
+ return () => {
254
+ clearTimeout(T);
255
+ };
256
+ };
257
+ return document.addEventListener("click", m), () => {
258
+ document.removeEventListener("click", m);
259
+ };
260
+ }, [n]), (!(t != null && t.insightsUrl) || !t.workspace || !t.workspace.startsWith("W")) && console.error(
261
+ "[@levo-so/audience] The utility could not be initialized, due to missing workspace, or endpoint for insights."
262
+ ), null;
263
+ };
264
+ export {
265
+ Oe as L,
266
+ Ie as a,
267
+ ke as b
268
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@levo-so/react",
3
- "version": "0.1.24",
3
+ "version": "0.1.26",
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.24"
19
+ "@levo-so/core": "0.1.26"
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",
93
+ "@levo/tw-config": "0.0.0",
94
94
  "@levo/ts-config": "0.0.0",
95
- "@levo/tw-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,37 +0,0 @@
1
- "use client";
2
- import { j as t } from "./jsx-runtime-B6kdoens.js";
3
- import * as o from "@radix-ui/react-tooltip";
4
- import * as m from "react";
5
- import { c as l } from "./cn-C9QoOYNG.js";
6
- const T = o.Provider, p = o.Root, c = o.Trigger, u = o.Portal, r = m.forwardRef(({ className: a, sideOffset: e = 4, ...s }, i) => /* @__PURE__ */ t.jsx(
7
- o.Content,
8
- {
9
- ref: i,
10
- sideOffset: e,
11
- className: l(
12
- "z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-xs text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
13
- a
14
- ),
15
- ...s
16
- }
17
- ));
18
- r.displayName = o.Content.displayName;
19
- const g = ({
20
- children: a,
21
- label: e,
22
- labelClassName: s,
23
- contentClassName: i,
24
- asChild: d = !0,
25
- contentProps: n = {}
26
- }) => /* @__PURE__ */ t.jsxs(p, { children: [
27
- e && /* @__PURE__ */ t.jsx(r, { className: s, ...n, children: /* @__PURE__ */ t.jsx("p", { className: i, children: e }) }),
28
- /* @__PURE__ */ t.jsx(c, { asChild: d, children: a })
29
- ] });
30
- export {
31
- g as S,
32
- p as T,
33
- c as a,
34
- r as b,
35
- T as c,
36
- u as d
37
- };
@@ -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
- };