@levo-so/react 0.1.29 → 0.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{CheckboxWidget-Bug2FXpG.js → CheckboxWidget-Dedx-7Wy.js} +6 -6
- package/dist/{CollectionFormBuilder-DxViQE0w.js → CollectionFormBuilder-BPzVyGLq.js} +36 -36
- package/dist/{CurrencyWidget-BtjxmXgj.js → CurrencyWidget-CW3cMoYn.js} +1 -1
- package/dist/{DateTimeWidget-Ds8g90-j.js → DateTimeWidget-eKbj2Q86.js} +5 -5
- package/dist/{DefaultFormVariant-ChnisPj2.js → DefaultFormVariant-DGecA_SF.js} +6 -6
- package/dist/{DropdownWidget-B2o6wz-C.js → DropdownWidget-DJ6rBFE0.js} +2 -2
- package/dist/{EmailWidget-Cfyfy5OH.js → EmailWidget-Bx3LTBSb.js} +4 -4
- package/dist/{FormCaptcha-BOjVusbv.js → FormCaptcha-BVawlT6h.js} +1 -1
- package/dist/{GeocoderWidget-B5TnEwp-.js → GeocoderWidget-C_8wJijA.js} +6 -6
- package/dist/{Input-2CvZ90f8.js → Input-Vv7mKQFt.js} +4 -4
- package/dist/{MultiGeocoderWidget-CF4HGkCg.js → MultiGeocoderWidget-0uUFNNoH.js} +6 -6
- package/dist/{MultiTextWidget-fnzlopnN.js → MultiTextWidget-BluGgZVP.js} +2 -2
- package/dist/{PhoneWidget-BVk5mhOm.js → PhoneWidget-Mm6DmCsK.js} +2 -2
- package/dist/{RadioWidget-CouCg5aG.js → RadioWidget-BkYAbg4o.js} +7 -7
- package/dist/{RichTextWidget-dqN--eKc.js → RichTextWidget-CbyT-y1E.js} +10 -10
- package/dist/{Spinner-CDMNP44S.js → Spinner-BcBoT-J5.js} +3 -3
- package/dist/{StepsFormVariant-Buw3v2UB.js → StepsFormVariant-Bk_rc3R7.js} +8 -8
- package/dist/{SwitchWidget-BkBgr_nQ.js → SwitchWidget-DeCIh2Vm.js} +2 -2
- package/dist/{TextWidget-I9pwxamg.js → TextWidget-Di_db2UE.js} +2 -2
- package/dist/{TextareaWidget-takl2qqW.js → TextareaWidget-CZqLQQAK.js} +1 -1
- package/dist/{ToggleCheckboxWidget-B8hL0ZhV.js → ToggleCheckboxWidget-Dynr-C0Y.js} +2 -2
- package/dist/{URLWidget-C1S_yZ9J.js → URLWidget-BvQvn0aZ.js} +3 -3
- package/dist/{UploadWidget-D7USwx7q.js → UploadWidget-mRgEWRVS.js} +29 -29
- package/dist/audience/hooks/useTrackClicks.d.ts.map +1 -1
- package/dist/audience/index.js +1 -1
- package/dist/audience/utils/autocapture.d.ts +2 -3
- package/dist/audience/utils/autocapture.d.ts.map +1 -1
- package/dist/collection/index.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/index.js +3 -3
- package/dist/page-jWvzWjyk.js +452 -0
- package/package.json +2 -2
- package/dist/page-Bgl12goV.js +0 -449
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var nt = Object.defineProperty;
|
|
3
|
+
var rt = (t, n, e) => n in t ? nt(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
|
|
4
|
+
var U = (t, n, e) => rt(t, typeof n != "symbol" ? n + "" : n, e);
|
|
5
|
+
import { j as ot } from "./jsx-runtime-B6kdoens.js";
|
|
6
|
+
import { useEffect as d, useState as T } from "react";
|
|
7
|
+
import { useInView as st } from "react-intersection-observer";
|
|
8
|
+
import { u as x } from "./LevoProvider-BAZy7_tP.js";
|
|
9
|
+
import { usePageLifecycle as it, LifecycleState as v } from "use-page-lifecycle";
|
|
10
|
+
const fe = ({ id: t, properties: n = {} }) => {
|
|
11
|
+
const { audience: e } = x(), { ref: r, inView: o } = st({
|
|
12
|
+
triggerOnce: !0
|
|
13
|
+
});
|
|
14
|
+
return d(() => {
|
|
15
|
+
e != null && e.instance && o && (e == null || e.track("block.view", {
|
|
16
|
+
...n,
|
|
17
|
+
resource: "block",
|
|
18
|
+
identifier: t
|
|
19
|
+
}));
|
|
20
|
+
}, [o]), /* @__PURE__ */ ot.jsx("div", { ref: r, style: { height: "0px" } });
|
|
21
|
+
}, de = ({ event: t, properties: n }) => {
|
|
22
|
+
const { audience: e } = x();
|
|
23
|
+
return d(() => {
|
|
24
|
+
e != null && e.instance && (e == null || e.track(t, n));
|
|
25
|
+
}, [e == null ? void 0 : e.instance, t, n]), null;
|
|
26
|
+
};
|
|
27
|
+
function R(t) {
|
|
28
|
+
var n = typeof t;
|
|
29
|
+
return t != null && (n == "object" || n == "function");
|
|
30
|
+
}
|
|
31
|
+
var ct = typeof global == "object" && global && global.Object === Object && global, at = typeof self == "object" && self && self.Object === Object && self, W = ct || at || Function("return this")(), O = function() {
|
|
32
|
+
return W.Date.now();
|
|
33
|
+
}, ut = /\s/;
|
|
34
|
+
function ft(t) {
|
|
35
|
+
for (var n = t.length; n-- && ut.test(t.charAt(n)); )
|
|
36
|
+
;
|
|
37
|
+
return n;
|
|
38
|
+
}
|
|
39
|
+
var dt = /^\s+/;
|
|
40
|
+
function lt(t) {
|
|
41
|
+
return t && t.slice(0, ft(t) + 1).replace(dt, "");
|
|
42
|
+
}
|
|
43
|
+
var E = W.Symbol, G = Object.prototype, gt = G.hasOwnProperty, pt = G.toString, w = E ? E.toStringTag : void 0;
|
|
44
|
+
function mt(t) {
|
|
45
|
+
var n = gt.call(t, w), e = t[w];
|
|
46
|
+
try {
|
|
47
|
+
t[w] = void 0;
|
|
48
|
+
var r = !0;
|
|
49
|
+
} catch {
|
|
50
|
+
}
|
|
51
|
+
var o = pt.call(t);
|
|
52
|
+
return r && (n ? t[w] = e : delete t[w]), o;
|
|
53
|
+
}
|
|
54
|
+
var ht = Object.prototype, bt = ht.toString;
|
|
55
|
+
function wt(t) {
|
|
56
|
+
return bt.call(t);
|
|
57
|
+
}
|
|
58
|
+
var yt = "[object Null]", St = "[object Undefined]", M = E ? E.toStringTag : void 0;
|
|
59
|
+
function vt(t) {
|
|
60
|
+
return t == null ? t === void 0 ? St : yt : M && M in Object(t) ? mt(t) : wt(t);
|
|
61
|
+
}
|
|
62
|
+
function Tt(t) {
|
|
63
|
+
return t != null && typeof t == "object";
|
|
64
|
+
}
|
|
65
|
+
var Et = "[object Symbol]";
|
|
66
|
+
function Lt(t) {
|
|
67
|
+
return typeof t == "symbol" || Tt(t) && vt(t) == Et;
|
|
68
|
+
}
|
|
69
|
+
var F = NaN, xt = /^[-+]0x[0-9a-f]+$/i, Ct = /^0b[01]+$/i, kt = /^0o[0-7]+$/i, Nt = parseInt;
|
|
70
|
+
function B(t) {
|
|
71
|
+
if (typeof t == "number")
|
|
72
|
+
return t;
|
|
73
|
+
if (Lt(t))
|
|
74
|
+
return F;
|
|
75
|
+
if (R(t)) {
|
|
76
|
+
var n = typeof t.valueOf == "function" ? t.valueOf() : t;
|
|
77
|
+
t = R(n) ? n + "" : n;
|
|
78
|
+
}
|
|
79
|
+
if (typeof t != "string")
|
|
80
|
+
return t === 0 ? t : +t;
|
|
81
|
+
t = lt(t);
|
|
82
|
+
var e = Ct.test(t);
|
|
83
|
+
return e || kt.test(t) ? Nt(t.slice(2), e ? 2 : 8) : xt.test(t) ? F : +t;
|
|
84
|
+
}
|
|
85
|
+
var Ot = "Expected a function", _t = Math.max, It = Math.min;
|
|
86
|
+
function Rt(t, n, e) {
|
|
87
|
+
var r, o, i, a, s, c, u = 0, h = !1, g = !1, p = !0;
|
|
88
|
+
if (typeof t != "function")
|
|
89
|
+
throw new TypeError(Ot);
|
|
90
|
+
n = B(n) || 0, R(e) && (h = !!e.leading, g = "maxWait" in e, i = g ? _t(B(e.maxWait) || 0, n) : i, p = "trailing" in e ? !!e.trailing : p);
|
|
91
|
+
function k(f) {
|
|
92
|
+
var l = r, b = o;
|
|
93
|
+
return r = o = void 0, u = f, a = t.apply(b, l), a;
|
|
94
|
+
}
|
|
95
|
+
function q(f) {
|
|
96
|
+
return u = f, s = setTimeout(S, n), h ? k(f) : a;
|
|
97
|
+
}
|
|
98
|
+
function Q(f) {
|
|
99
|
+
var l = f - c, b = f - u, P = n - l;
|
|
100
|
+
return g ? It(P, i - b) : P;
|
|
101
|
+
}
|
|
102
|
+
function $(f) {
|
|
103
|
+
var l = f - c, b = f - u;
|
|
104
|
+
return c === void 0 || l >= n || l < 0 || g && b >= i;
|
|
105
|
+
}
|
|
106
|
+
function S() {
|
|
107
|
+
var f = O();
|
|
108
|
+
if ($(f))
|
|
109
|
+
return D(f);
|
|
110
|
+
s = setTimeout(S, Q(f));
|
|
111
|
+
}
|
|
112
|
+
function D(f) {
|
|
113
|
+
return s = void 0, p && r ? k(f) : (r = o = void 0, a);
|
|
114
|
+
}
|
|
115
|
+
function tt() {
|
|
116
|
+
s !== void 0 && clearTimeout(s), u = 0, r = c = o = s = void 0;
|
|
117
|
+
}
|
|
118
|
+
function et() {
|
|
119
|
+
return s === void 0 ? a : D(O());
|
|
120
|
+
}
|
|
121
|
+
function N() {
|
|
122
|
+
var f = O(), l = $(f);
|
|
123
|
+
if (r = arguments, o = this, c = f, l) {
|
|
124
|
+
if (s === void 0)
|
|
125
|
+
return q(c);
|
|
126
|
+
if (g)
|
|
127
|
+
return clearTimeout(s), s = setTimeout(S, n), k(c);
|
|
128
|
+
}
|
|
129
|
+
return s === void 0 && (s = setTimeout(S, n)), a;
|
|
130
|
+
}
|
|
131
|
+
return N.cancel = tt, N.flush = et, N;
|
|
132
|
+
}
|
|
133
|
+
const At = () => {
|
|
134
|
+
const [t, n] = T(0), [e, r] = T(0), o = Rt((i) => {
|
|
135
|
+
r(i), n(i);
|
|
136
|
+
}, 250);
|
|
137
|
+
return d(() => {
|
|
138
|
+
const i = () => {
|
|
139
|
+
const a = window.scrollY, s = document.documentElement.scrollHeight, c = window.innerHeight, u = Math.round(
|
|
140
|
+
a / (s - c) * 100
|
|
141
|
+
);
|
|
142
|
+
u % 10 === 0 && u > e && o(u);
|
|
143
|
+
};
|
|
144
|
+
return window.addEventListener("scroll", i), () => window.removeEventListener("scroll", i);
|
|
145
|
+
}, [e]), t;
|
|
146
|
+
}, y = "lv_insights_ot", jt = () => {
|
|
147
|
+
const [t, n] = T(0);
|
|
148
|
+
return d(() => {
|
|
149
|
+
const e = Number(localStorage.getItem(y)) || 0;
|
|
150
|
+
n(e), localStorage.setItem(y, (e + 1).toString());
|
|
151
|
+
const r = (i) => {
|
|
152
|
+
i.key === y && n(Number(i.newValue) || 0);
|
|
153
|
+
};
|
|
154
|
+
window.addEventListener("storage", r);
|
|
155
|
+
const o = () => {
|
|
156
|
+
const i = Number(localStorage.getItem(y)) || 0;
|
|
157
|
+
i > 0 && localStorage.setItem(y, (i - 1).toString());
|
|
158
|
+
};
|
|
159
|
+
return window.addEventListener("beforeunload", o), () => {
|
|
160
|
+
window.removeEventListener("storage", r), window.removeEventListener("beforeunload", o);
|
|
161
|
+
};
|
|
162
|
+
}, []), t;
|
|
163
|
+
}, H = "lv_insights_ct", _ = "lv_insights_at", $t = () => {
|
|
164
|
+
const [t, n] = T(null);
|
|
165
|
+
return d(() => {
|
|
166
|
+
let e = sessionStorage.getItem(H);
|
|
167
|
+
const r = JSON.parse(
|
|
168
|
+
localStorage.getItem(_) || "[]"
|
|
169
|
+
);
|
|
170
|
+
e && r.includes(e) && (e = null), e || (e = `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, sessionStorage.setItem(H, e)), r.includes(e) || (r.push(e), localStorage.setItem(
|
|
171
|
+
_,
|
|
172
|
+
JSON.stringify(r)
|
|
173
|
+
)), n(e);
|
|
174
|
+
const o = () => {
|
|
175
|
+
const i = r.filter(
|
|
176
|
+
(a) => a !== e
|
|
177
|
+
);
|
|
178
|
+
localStorage.setItem(
|
|
179
|
+
_,
|
|
180
|
+
JSON.stringify(i)
|
|
181
|
+
);
|
|
182
|
+
};
|
|
183
|
+
return window.addEventListener("beforeunload", o), () => {
|
|
184
|
+
window.removeEventListener("beforeunload", o);
|
|
185
|
+
};
|
|
186
|
+
}, []), t;
|
|
187
|
+
}, L = (t) => Object.prototype.toString.call(t) == "[object String]", Dt = (t, n) => t.indexOf(n) !== -1, C = (t) => t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""), K = (t) => t === void 0, Pt = (t) => t === null, V = (t) => K(t) || Pt(t), Y = (t) => !!t && (t == null ? void 0 : t.nodeType) === 3;
|
|
188
|
+
function Ut(t) {
|
|
189
|
+
return !!t && (t == null ? void 0 : t.nodeType) === 1;
|
|
190
|
+
}
|
|
191
|
+
function Mt(t, n) {
|
|
192
|
+
return !!t && !!(t != null && t.tagName) && (t == null ? void 0 : t.tagName.toLowerCase()) === n.toLowerCase();
|
|
193
|
+
}
|
|
194
|
+
function Ft(t) {
|
|
195
|
+
return t ? C(t).split(/\s+/) : [];
|
|
196
|
+
}
|
|
197
|
+
function Bt(t) {
|
|
198
|
+
let n = "";
|
|
199
|
+
switch (typeof (t == null ? void 0 : t.className)) {
|
|
200
|
+
case "string":
|
|
201
|
+
n = t == null ? void 0 : t.className;
|
|
202
|
+
break;
|
|
203
|
+
case "object":
|
|
204
|
+
n = (t != null && t.className && "baseVal" in (t == null ? void 0 : t.className) ? (t == null ? void 0 : t.className).baseVal : null) || (t == null ? void 0 : t.getAttribute("class")) || "";
|
|
205
|
+
break;
|
|
206
|
+
default:
|
|
207
|
+
n = "";
|
|
208
|
+
}
|
|
209
|
+
return Ft(n);
|
|
210
|
+
}
|
|
211
|
+
const m = (t, n = 255) => V(t) ? "" : C(t).split(/(\s+)/).filter((e) => j(e)).join("").replace(/[\r\n]/g, " ").replace(/[ ]+/g, " ").substring(0, n), A = (t) => {
|
|
212
|
+
let n = "";
|
|
213
|
+
if (Gt(t) && // !isSensitiveElement(el) &&
|
|
214
|
+
(t != null && t.childNodes) && (t != null && t.childNodes.length))
|
|
215
|
+
for (const e of t == null ? void 0 : t.childNodes)
|
|
216
|
+
Y(e) && e.textContent && (n += m(e.textContent) ?? "");
|
|
217
|
+
return C(n);
|
|
218
|
+
}, Ht = (t) => {
|
|
219
|
+
var n, e;
|
|
220
|
+
return K(t.target) ? (t == null ? void 0 : t.srcElement) || null : (n = t == null ? void 0 : t.target) != null && n.shadowRoot ? ((e = t == null ? void 0 : t.composedPath()) == null ? void 0 : e[0]) || null : (t == null ? void 0 : t.target) || null;
|
|
221
|
+
}, Wt = (t, n) => {
|
|
222
|
+
if (!window || !t || Mt(t, "html") || !Ut(t))
|
|
223
|
+
return !1;
|
|
224
|
+
const e = window.getComputedStyle(t);
|
|
225
|
+
if (e && e.getPropertyValue("cursor") === "pointer" && n.type === "click")
|
|
226
|
+
return !0;
|
|
227
|
+
switch (t == null ? void 0 : t.tagName.toLowerCase()) {
|
|
228
|
+
case "html":
|
|
229
|
+
return !1;
|
|
230
|
+
case "form":
|
|
231
|
+
return n.type === "submit";
|
|
232
|
+
case "input":
|
|
233
|
+
case "select":
|
|
234
|
+
case "textarea":
|
|
235
|
+
return ["change", "click"].includes(n.type);
|
|
236
|
+
default:
|
|
237
|
+
return n.type === "click";
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
function Gt(t) {
|
|
241
|
+
if (Dt(Bt(t), "ph-include"))
|
|
242
|
+
return !0;
|
|
243
|
+
const n = t.type || "";
|
|
244
|
+
if (L(n))
|
|
245
|
+
switch (n.toLowerCase()) {
|
|
246
|
+
case "hidden":
|
|
247
|
+
return !1;
|
|
248
|
+
case "password":
|
|
249
|
+
return !1;
|
|
250
|
+
}
|
|
251
|
+
const e = t.name || (t == null ? void 0 : t.id) || "";
|
|
252
|
+
return !(L(e) && /^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(e.replace(/[^a-zA-Z0-9]/g, "")));
|
|
253
|
+
}
|
|
254
|
+
const J = "(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})", Kt = new RegExp(`^(?:${J})$`), Vt = new RegExp(J), X = "\\d{3}-?\\d{2}-?\\d{4}", Yt = new RegExp(`^(${X})$`), Jt = new RegExp(`(${X})`), j = (t, n = !0) => !(V(t) || L(t) && (t = C(t), (n ? Kt : Vt).test((t || "").replace(/[- ]/g, "")) || (n ? Yt : Jt).test(t))), Xt = (t) => L(t) ? t.substring(0, 10) === "_ngcontent" || t.substring(0, 7) === "_nghost" : !1, zt = (t) => {
|
|
255
|
+
let n = A(t);
|
|
256
|
+
return n = `${n} ${z(t)}`.trim(), j(n) ? n : "";
|
|
257
|
+
};
|
|
258
|
+
function z(t) {
|
|
259
|
+
var e;
|
|
260
|
+
let n = "";
|
|
261
|
+
if (t != null && t.childNodes.length) {
|
|
262
|
+
for (const r of t.childNodes)
|
|
263
|
+
if (r && ((e = r.tagName) == null ? void 0 : e.toLowerCase()) === "span")
|
|
264
|
+
try {
|
|
265
|
+
const o = A(r);
|
|
266
|
+
n = `${n} ${o}`.trim(), r != null && r.childNodes.length && (n = `${n} ${z(r)}`.trim());
|
|
267
|
+
} catch {
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return n;
|
|
271
|
+
}
|
|
272
|
+
const Zt = ["input", "textarea", "select"], Z = (t) => {
|
|
273
|
+
var o, i, a;
|
|
274
|
+
const n = t.tagName.toLowerCase(), e = {
|
|
275
|
+
element: n
|
|
276
|
+
};
|
|
277
|
+
n.toLowerCase() === "a" || n.toLowerCase() === "button" ? e.text = zt(t) : e.text = A(t);
|
|
278
|
+
const r = Array.from(t.attributes).reduce(
|
|
279
|
+
(s, c) => {
|
|
280
|
+
if (j(c.value) && !Xt(c.name)) {
|
|
281
|
+
if (c.name === "class")
|
|
282
|
+
return s;
|
|
283
|
+
s[c.name] = typeof (c == null ? void 0 : c.value) == "string" ? m(c.value) : c.value;
|
|
284
|
+
}
|
|
285
|
+
return s;
|
|
286
|
+
},
|
|
287
|
+
{}
|
|
288
|
+
);
|
|
289
|
+
if (e.attributes = r, Zt.includes(n) || (t == null ? void 0 : t.getAttribute("contenteditable")) === "true") {
|
|
290
|
+
let s;
|
|
291
|
+
t.matches('input[type="checkbox"], input[type="radio"]') ? s = t == null ? void 0 : t.checked : t.matches("input, select, textarea") && (s = t == null ? void 0 : t.value), s !== void 0 && (e.value = typeof s == "string" || s === null ? m(s, 1024) : s);
|
|
292
|
+
let c = "";
|
|
293
|
+
e != null && e.attributes.id && (c = m(
|
|
294
|
+
((i = (o = document.querySelector(`label[for="${e == null ? void 0 : e.attributes.id}"]`)) == null ? void 0 : o.textContent) == null ? void 0 : i.trim()) || ""
|
|
295
|
+
));
|
|
296
|
+
const u = t.closest("label");
|
|
297
|
+
c || (c = m(((a = u == null ? void 0 : u.textContent) == null ? void 0 : a.trim()) || "")), c && (e.label = c);
|
|
298
|
+
}
|
|
299
|
+
return e;
|
|
300
|
+
}, qt = (t, n) => {
|
|
301
|
+
var o;
|
|
302
|
+
let e = Ht(t);
|
|
303
|
+
Y(e) && (e = e.parentNode || null);
|
|
304
|
+
const r = ["copy", "cut"].includes(n);
|
|
305
|
+
if (e && (Wt(e, t) || r)) {
|
|
306
|
+
const i = Z(e);
|
|
307
|
+
if (r) {
|
|
308
|
+
const a = m((o = window == null ? void 0 : window.getSelection()) == null ? void 0 : o.toString()), s = (t == null ? void 0 : t.type) || "clipboard";
|
|
309
|
+
i.copy_text = a ?? "", i.copy_type = s ?? "";
|
|
310
|
+
}
|
|
311
|
+
return i;
|
|
312
|
+
}
|
|
313
|
+
return null;
|
|
314
|
+
}, Qt = 30, te = 1e3, ee = 3;
|
|
315
|
+
class ne {
|
|
316
|
+
constructor() {
|
|
317
|
+
U(this, "clicks");
|
|
318
|
+
this.clicks = [];
|
|
319
|
+
}
|
|
320
|
+
isRageClick(n, e, r) {
|
|
321
|
+
const o = this.clicks[this.clicks.length - 1];
|
|
322
|
+
if (o && Math.abs(n - o.x) + Math.abs(e - o.y) < Qt && r - o.timestamp < te) {
|
|
323
|
+
if (this.clicks.push({ x: n, y: e, timestamp: r }), this.clicks.length === ee)
|
|
324
|
+
return !0;
|
|
325
|
+
} else
|
|
326
|
+
this.clicks = [{ x: n, y: e, timestamp: r }];
|
|
327
|
+
return !1;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
const I = new ne(), re = () => {
|
|
331
|
+
const { audience: t } = x();
|
|
332
|
+
d(() => {
|
|
333
|
+
const n = (e) => {
|
|
334
|
+
try {
|
|
335
|
+
let r = {
|
|
336
|
+
hostname: window.location.hostname,
|
|
337
|
+
pathname: window.location.pathname,
|
|
338
|
+
page_title: document.title,
|
|
339
|
+
url: window.location.href,
|
|
340
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
341
|
+
event_type: e.type,
|
|
342
|
+
button_type: e.button
|
|
343
|
+
};
|
|
344
|
+
if (e.target instanceof HTMLElement) {
|
|
345
|
+
const o = e.target;
|
|
346
|
+
r.rage_click = I == null ? void 0 : I.isRageClick(
|
|
347
|
+
e.clientX,
|
|
348
|
+
e.clientY,
|
|
349
|
+
(/* @__PURE__ */ new Date()).getTime()
|
|
350
|
+
), r = {
|
|
351
|
+
...r,
|
|
352
|
+
...Z(o)
|
|
353
|
+
};
|
|
354
|
+
let i = o == null ? void 0 : o.getAttribute("href");
|
|
355
|
+
if (!i) {
|
|
356
|
+
let a = o.parentNode, s = 0;
|
|
357
|
+
for (; a && s < 8; ) {
|
|
358
|
+
const c = a == null ? void 0 : a.getAttribute(
|
|
359
|
+
"href"
|
|
360
|
+
);
|
|
361
|
+
if (c) {
|
|
362
|
+
i = c;
|
|
363
|
+
break;
|
|
364
|
+
}
|
|
365
|
+
a = a.parentNode, s++;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
t == null || t.track("page.click", {
|
|
369
|
+
...r,
|
|
370
|
+
href: i || void 0
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
} catch (r) {
|
|
374
|
+
console.error(r);
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
return document.addEventListener("click", n), () => {
|
|
378
|
+
document.removeEventListener("click", n);
|
|
379
|
+
};
|
|
380
|
+
}, [t]);
|
|
381
|
+
}, le = ({ id: t, properties: n = {} }) => {
|
|
382
|
+
const { client: e, audience: r } = x();
|
|
383
|
+
d(() => {
|
|
384
|
+
e && typeof window < "u" && (window.levo_client = e);
|
|
385
|
+
}, [e]), d(() => {
|
|
386
|
+
r && typeof window < "u" && (window.levo_audience = r);
|
|
387
|
+
}, [r]);
|
|
388
|
+
const o = typeof window < "u" ? window.location.href : void 0;
|
|
389
|
+
jt(), $t(), re();
|
|
390
|
+
const i = At();
|
|
391
|
+
d(() => {
|
|
392
|
+
r != null && r.instance && i > 0 && r.track("page.scroll", {
|
|
393
|
+
resource: "page",
|
|
394
|
+
identifier: t,
|
|
395
|
+
percent: i
|
|
396
|
+
});
|
|
397
|
+
}, [r == null ? void 0 : r.instance, i, t]), d(() => {
|
|
398
|
+
const s = () => {
|
|
399
|
+
r == null || r.track("page.bounce", {
|
|
400
|
+
resource: "page",
|
|
401
|
+
identifier: t
|
|
402
|
+
});
|
|
403
|
+
};
|
|
404
|
+
return window && window.addEventListener("beforeunload", s), () => {
|
|
405
|
+
window && window.removeEventListener("beforeunload", s);
|
|
406
|
+
};
|
|
407
|
+
}, [r, t]);
|
|
408
|
+
const [a] = it();
|
|
409
|
+
return d(() => {
|
|
410
|
+
(a === v.TERMINATED || a === v.HIDDEN || a === v.UNKNOWN || a === v.FROZEN) && (r == null || r.track("page.bounce", {
|
|
411
|
+
resource: "page",
|
|
412
|
+
identifier: t,
|
|
413
|
+
state: a
|
|
414
|
+
}));
|
|
415
|
+
}, [a, r, t]), d(() => {
|
|
416
|
+
(() => {
|
|
417
|
+
e != null && e.insightsUrl && e.workspace && o && (r != null && r.instance ? r.instance.page({
|
|
418
|
+
resource: "page",
|
|
419
|
+
identifier: t
|
|
420
|
+
}) : r == null || r.initiate({
|
|
421
|
+
...n,
|
|
422
|
+
id: t,
|
|
423
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
424
|
+
}));
|
|
425
|
+
})();
|
|
426
|
+
}, [e == null ? void 0 : e.insightsUrl, e == null ? void 0 : e.workspace, o]), d(() => {
|
|
427
|
+
const s = {
|
|
428
|
+
change: "form.change",
|
|
429
|
+
submit: "form.submit",
|
|
430
|
+
copy: "page.copy",
|
|
431
|
+
cut: "page.copy"
|
|
432
|
+
}, c = (h) => (g) => {
|
|
433
|
+
const p = qt(g, h);
|
|
434
|
+
p && (r == null || r.track(s[h], p));
|
|
435
|
+
}, u = {
|
|
436
|
+
change: c("change"),
|
|
437
|
+
copy: c("copy"),
|
|
438
|
+
cut: c("cut"),
|
|
439
|
+
submit: c("submit")
|
|
440
|
+
};
|
|
441
|
+
return document.addEventListener("change", u.change), document.addEventListener("copy", u.copy), document.addEventListener("cut", u.cut), document.addEventListener("submit", u.submit), () => {
|
|
442
|
+
document.removeEventListener("change", u.change), document.removeEventListener("copy", u.copy), document.removeEventListener("cut", u.cut), document.removeEventListener("submit", u.submit);
|
|
443
|
+
};
|
|
444
|
+
}, []), (!(e != null && e.insightsUrl) || !e.workspace || !e.workspace.startsWith("W")) && console.error(
|
|
445
|
+
"[@levo-so/react] The utility could not be initialized, due to missing workspace, or endpoint for insights."
|
|
446
|
+
), null;
|
|
447
|
+
};
|
|
448
|
+
export {
|
|
449
|
+
fe as L,
|
|
450
|
+
de as a,
|
|
451
|
+
le as b
|
|
452
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@levo-so/react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.31",
|
|
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.
|
|
19
|
+
"@levo-so/core": "0.1.30"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@radix-ui/react-checkbox": "1.1.1",
|