@levo-so/react 0.1.35 → 0.1.36
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-BrVNbP0R.js → CheckboxWidget-3qTjxIlp.js} +1 -1
- package/dist/{CollectionFormBuilder-CkD8uVKZ.js → CollectionFormBuilder-CUzpwIva.js} +17 -17
- package/dist/{CurrencyWidget-D_q2AYWu.js → CurrencyWidget-DgH4uCpg.js} +1 -1
- package/dist/{DateTimeWidget-CsuCisSs.js → DateTimeWidget-C2hLHKU6.js} +1 -1
- package/dist/{DefaultFormVariant-rv38sBOZ.js → DefaultFormVariant-Cm9i2BBn.js} +2 -2
- package/dist/{DropdownWidget-CsTQ0Ojo.js → DropdownWidget-B6mRXcTa.js} +1 -1
- package/dist/{EmailWidget-Did2OUyB.js → EmailWidget-CBFnvo9z.js} +1 -1
- package/dist/{FormCaptcha-C_DxR2za.js → FormCaptcha-btA0HfMx.js} +3 -3
- package/dist/{GeocoderWidget-CyzcaWxa.js → GeocoderWidget-DZGXm9Ji.js} +2 -2
- package/dist/{MultiGeocoderWidget-DgwiZ330.js → MultiGeocoderWidget-D7ogTcWu.js} +2 -2
- package/dist/{MultiTextWidget-Dic46WBU.js → MultiTextWidget-DYxi8PHm.js} +1 -1
- package/dist/{PhoneWidget-DKH-Wzgz.js → PhoneWidget-BxaGCfLs.js} +1 -1
- package/dist/{RadioWidget-CTgWKCg2.js → RadioWidget-Bkq1Oudi.js} +1 -1
- package/dist/{RichTextWidget-C30H7mVF.js → RichTextWidget-Caqhw4GK.js} +1 -1
- package/dist/{StepsFormVariant-myT97AwJ.js → StepsFormVariant-D-m93LMv.js} +2 -2
- package/dist/{SwitchWidget-BS-rmHiq.js → SwitchWidget-BpAzgVui.js} +1 -1
- package/dist/{TextWidget-aNB-0vc-.js → TextWidget-CHkFlxmT.js} +1 -1
- package/dist/{TextareaWidget-CEH-97Oj.js → TextareaWidget-B0htlijX.js} +1 -1
- package/dist/{ToggleCheckboxWidget-C0buyS29.js → ToggleCheckboxWidget-DLrS6ax4.js} +1 -1
- package/dist/{URLWidget-DrZlRAD7.js → URLWidget-CnWKNlOF.js} +2 -2
- package/dist/{UploadWidget-Bw7urh-7.js → UploadWidget-DSvWOBuR.js} +1 -1
- package/dist/audience/components/page.d.ts +3 -4
- package/dist/audience/components/page.d.ts.map +1 -1
- package/dist/audience/index.js +1 -1
- package/dist/collection/index.js +1 -1
- package/dist/index.js +2 -2
- package/dist/membership/index.js +70 -69
- package/dist/page-C1-z2EsC.js +574 -0
- package/dist/providers/LevoProvider.d.ts +4 -19
- package/dist/providers/LevoProvider.d.ts.map +1 -1
- package/dist/providers/index.js +8 -164
- package/package.json +4 -4
- package/dist/Checbox-sq-atGlJ.js.map +0 -1
- package/dist/CheckboxWidget-BrVNbP0R.js.map +0 -1
- package/dist/CollectionFormBuilder-CkD8uVKZ.js.map +0 -1
- package/dist/CurrencyWidget-D_q2AYWu.js.map +0 -1
- package/dist/DateTimeWidget-CsuCisSs.js.map +0 -1
- package/dist/DefaultFormVariant-rv38sBOZ.js.map +0 -1
- package/dist/DropdownWidget-CsTQ0Ojo.js.map +0 -1
- package/dist/EmailWidget-Did2OUyB.js.map +0 -1
- package/dist/FormCaptcha-C_DxR2za.js.map +0 -1
- package/dist/GeocoderWidget-CyzcaWxa.js.map +0 -1
- package/dist/Input-Vv7mKQFt.js.map +0 -1
- package/dist/MultiGeocoderWidget-DgwiZ330.js.map +0 -1
- package/dist/MultiTextWidget-Dic46WBU.js.map +0 -1
- package/dist/PhoneWidget-DKH-Wzgz.js.map +0 -1
- package/dist/RadioWidget-CTgWKCg2.js.map +0 -1
- package/dist/RichTextWidget-C30H7mVF.js.map +0 -1
- package/dist/Sonner-t6JVKA0a.js.map +0 -1
- package/dist/Spinner-BcBoT-J5.js.map +0 -1
- package/dist/StepsFormVariant-myT97AwJ.js.map +0 -1
- package/dist/SwitchWidget-BS-rmHiq.js.map +0 -1
- package/dist/TextWidget-aNB-0vc-.js.map +0 -1
- package/dist/TextareaWidget-CEH-97Oj.js.map +0 -1
- package/dist/ToggleCheckboxWidget-C0buyS29.js.map +0 -1
- package/dist/Tooltip-DoWyn3Ho.js.map +0 -1
- package/dist/URLWidget-DrZlRAD7.js.map +0 -1
- package/dist/UploadWidget-Bw7urh-7.js.map +0 -1
- package/dist/audience/index.js.map +0 -1
- package/dist/byteToSize-BFKZSBu1.js.map +0 -1
- package/dist/cn-C9QoOYNG.js.map +0 -1
- package/dist/collection/index.js.map +0 -1
- package/dist/components/index.js.map +0 -1
- package/dist/errorHandler-_34Yv8wA.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/isEmptyObject-C5s4GzLE.js.map +0 -1
- package/dist/jsx-runtime-B6kdoens.js.map +0 -1
- package/dist/membership/index.js.map +0 -1
- package/dist/page-t8PpNiSB.js +0 -567
- package/dist/page-t8PpNiSB.js.map +0 -1
- package/dist/providers/index.js.map +0 -1
- package/dist/utils/index.js.map +0 -1
|
@@ -0,0 +1,574 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var re = Object.defineProperty;
|
|
3
|
+
var se = (e, t, o) => t in e ? re(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
|
|
4
|
+
var H = (e, t, o) => se(e, typeof t != "symbol" ? t + "" : t, o);
|
|
5
|
+
import { j as ie } from "./jsx-runtime-B6kdoens.js";
|
|
6
|
+
import { useEffect as f, useState as h } from "react";
|
|
7
|
+
import { useInView as ce } from "react-intersection-observer";
|
|
8
|
+
import { useLevo as S } from "./providers/index.js";
|
|
9
|
+
import { usePageLifecycle as ae, LifecycleState as x } from "use-page-lifecycle";
|
|
10
|
+
import { LocalStorageLock as ue } from "@levo-so/core";
|
|
11
|
+
const bt = ({ id: e, properties: t = {} }) => {
|
|
12
|
+
const { audience: o } = S(), { ref: n, inView: s } = ce({
|
|
13
|
+
triggerOnce: !0
|
|
14
|
+
});
|
|
15
|
+
return f(() => {
|
|
16
|
+
o != null && o.instance && s && (o == null || o.track("block.view", {
|
|
17
|
+
...t,
|
|
18
|
+
resource: "block",
|
|
19
|
+
identifier: e
|
|
20
|
+
}));
|
|
21
|
+
}, [s]), /* @__PURE__ */ ie.jsx("div", { ref: n, style: { height: "0px" } });
|
|
22
|
+
}, vt = ({ event: e, properties: t }) => {
|
|
23
|
+
const { audience: o } = S();
|
|
24
|
+
return f(() => {
|
|
25
|
+
o != null && o.instance && (o == null || o.track(e, t));
|
|
26
|
+
}, [o == null ? void 0 : o.instance, e, t]), null;
|
|
27
|
+
};
|
|
28
|
+
function P(e) {
|
|
29
|
+
var t = typeof e;
|
|
30
|
+
return e != null && (t == "object" || t == "function");
|
|
31
|
+
}
|
|
32
|
+
var de = typeof global == "object" && global && global.Object === Object && global, le = typeof self == "object" && self && self.Object === Object && self, J = de || le || Function("return this")(), M = function() {
|
|
33
|
+
return J.Date.now();
|
|
34
|
+
}, fe = /\s/;
|
|
35
|
+
function me(e) {
|
|
36
|
+
for (var t = e.length; t-- && fe.test(e.charAt(t)); )
|
|
37
|
+
;
|
|
38
|
+
return t;
|
|
39
|
+
}
|
|
40
|
+
var pe = /^\s+/;
|
|
41
|
+
function ge(e) {
|
|
42
|
+
return e && e.slice(0, me(e) + 1).replace(pe, "");
|
|
43
|
+
}
|
|
44
|
+
var N = J.Symbol, z = Object.prototype, he = z.hasOwnProperty, we = z.toString, k = N ? N.toStringTag : void 0;
|
|
45
|
+
function be(e) {
|
|
46
|
+
var t = he.call(e, k), o = e[k];
|
|
47
|
+
try {
|
|
48
|
+
e[k] = void 0;
|
|
49
|
+
var n = !0;
|
|
50
|
+
} catch {
|
|
51
|
+
}
|
|
52
|
+
var s = we.call(e);
|
|
53
|
+
return n && (t ? e[k] = o : delete e[k]), s;
|
|
54
|
+
}
|
|
55
|
+
var ve = Object.prototype, ye = ve.toString;
|
|
56
|
+
function Se(e) {
|
|
57
|
+
return ye.call(e);
|
|
58
|
+
}
|
|
59
|
+
var Te = "[object Null]", Ee = "[object Undefined]", Y = N ? N.toStringTag : void 0;
|
|
60
|
+
function Le(e) {
|
|
61
|
+
return e == null ? e === void 0 ? Ee : Te : Y && Y in Object(e) ? be(e) : Se(e);
|
|
62
|
+
}
|
|
63
|
+
function ke(e) {
|
|
64
|
+
return e != null && typeof e == "object";
|
|
65
|
+
}
|
|
66
|
+
var Ce = "[object Symbol]";
|
|
67
|
+
function xe(e) {
|
|
68
|
+
return typeof e == "symbol" || ke(e) && Le(e) == Ce;
|
|
69
|
+
}
|
|
70
|
+
var W = NaN, _e = /^[-+]0x[0-9a-f]+$/i, Ne = /^0b[01]+$/i, Oe = /^0o[0-7]+$/i, Ie = parseInt;
|
|
71
|
+
function K(e) {
|
|
72
|
+
if (typeof e == "number")
|
|
73
|
+
return e;
|
|
74
|
+
if (xe(e))
|
|
75
|
+
return W;
|
|
76
|
+
if (P(e)) {
|
|
77
|
+
var t = typeof e.valueOf == "function" ? e.valueOf() : e;
|
|
78
|
+
e = P(t) ? t + "" : t;
|
|
79
|
+
}
|
|
80
|
+
if (typeof e != "string")
|
|
81
|
+
return e === 0 ? e : +e;
|
|
82
|
+
e = ge(e);
|
|
83
|
+
var o = Ne.test(e);
|
|
84
|
+
return o || Oe.test(e) ? Ie(e.slice(2), o ? 2 : 8) : _e.test(e) ? W : +e;
|
|
85
|
+
}
|
|
86
|
+
var Re = "Expected a function", Ae = Math.max, je = Math.min;
|
|
87
|
+
function Me(e, t, o) {
|
|
88
|
+
var n, s, i, a, u, r, c = 0, d = !1, l = !1, p = !0;
|
|
89
|
+
if (typeof e != "function")
|
|
90
|
+
throw new TypeError(Re);
|
|
91
|
+
t = K(t) || 0, P(o) && (d = !!o.leading, l = "maxWait" in o, i = l ? Ae(K(o.maxWait) || 0, t) : i, p = "trailing" in o ? !!o.trailing : p);
|
|
92
|
+
function g(m) {
|
|
93
|
+
var w = n, L = s;
|
|
94
|
+
return n = s = void 0, c = m, a = e.apply(L, w), a;
|
|
95
|
+
}
|
|
96
|
+
function v(m) {
|
|
97
|
+
return c = m, u = setTimeout(y, t), d ? g(m) : a;
|
|
98
|
+
}
|
|
99
|
+
function T(m) {
|
|
100
|
+
var w = m - r, L = m - c, B = t - w;
|
|
101
|
+
return l ? je(B, i - L) : B;
|
|
102
|
+
}
|
|
103
|
+
function E(m) {
|
|
104
|
+
var w = m - r, L = m - c;
|
|
105
|
+
return r === void 0 || w >= t || w < 0 || l && L >= i;
|
|
106
|
+
}
|
|
107
|
+
function y() {
|
|
108
|
+
var m = M();
|
|
109
|
+
if (E(m))
|
|
110
|
+
return R(m);
|
|
111
|
+
u = setTimeout(y, T(m));
|
|
112
|
+
}
|
|
113
|
+
function R(m) {
|
|
114
|
+
return u = void 0, p && n ? g(m) : (n = s = void 0, a);
|
|
115
|
+
}
|
|
116
|
+
function A() {
|
|
117
|
+
u !== void 0 && clearTimeout(u), c = 0, n = r = s = u = void 0;
|
|
118
|
+
}
|
|
119
|
+
function oe() {
|
|
120
|
+
return u === void 0 ? a : R(M());
|
|
121
|
+
}
|
|
122
|
+
function j() {
|
|
123
|
+
var m = M(), w = E(m);
|
|
124
|
+
if (n = arguments, s = this, r = m, w) {
|
|
125
|
+
if (u === void 0)
|
|
126
|
+
return v(r);
|
|
127
|
+
if (l)
|
|
128
|
+
return clearTimeout(u), u = setTimeout(y, t), g(r);
|
|
129
|
+
}
|
|
130
|
+
return u === void 0 && (u = setTimeout(y, t)), a;
|
|
131
|
+
}
|
|
132
|
+
return j.cancel = A, j.flush = oe, j;
|
|
133
|
+
}
|
|
134
|
+
const De = () => {
|
|
135
|
+
const [e, t] = h(0), [o, n] = h(0), [s, i] = h(0), [a, u] = h(Date.now()), [r, c] = h("read"), d = Me(() => {
|
|
136
|
+
const l = window.scrollY, p = document.documentElement.scrollHeight, g = window.innerHeight, v = Math.round(
|
|
137
|
+
l / (p - g) * 100
|
|
138
|
+
), T = Math.floor(v / 5) * 5;
|
|
139
|
+
if (T <= o)
|
|
140
|
+
return;
|
|
141
|
+
const E = Date.now(), y = (E - a) / 1e3, A = Math.abs(l - s) / y;
|
|
142
|
+
c(A > 300 ? "scan" : "read"), i(l), u(E), n(T), t(T);
|
|
143
|
+
}, 250);
|
|
144
|
+
return f(() => (window.addEventListener("scroll", d), () => window.removeEventListener("scroll", d)), []), { depth: e, speedCategory: r };
|
|
145
|
+
}, C = "lv_insights_ot", $e = () => {
|
|
146
|
+
const [e, t] = h(0);
|
|
147
|
+
return f(() => {
|
|
148
|
+
const o = Number(localStorage.getItem(C)) || 0;
|
|
149
|
+
t(o), localStorage.setItem(C, (o + 1).toString());
|
|
150
|
+
const n = (i) => {
|
|
151
|
+
i.key === C && t(Number(i.newValue) || 0);
|
|
152
|
+
};
|
|
153
|
+
window.addEventListener("storage", n);
|
|
154
|
+
const s = () => {
|
|
155
|
+
const i = Number(localStorage.getItem(C)) || 0;
|
|
156
|
+
i > 0 && localStorage.setItem(C, (i - 1).toString());
|
|
157
|
+
};
|
|
158
|
+
return window.addEventListener("beforeunload", s), () => {
|
|
159
|
+
window.removeEventListener("storage", n), window.removeEventListener("beforeunload", s);
|
|
160
|
+
};
|
|
161
|
+
}, []), e;
|
|
162
|
+
}, G = "lv_insights_ct", D = "lv_insights_at", Pe = () => {
|
|
163
|
+
const [e, t] = h(null);
|
|
164
|
+
return f(() => {
|
|
165
|
+
let o = sessionStorage.getItem(G);
|
|
166
|
+
const n = JSON.parse(
|
|
167
|
+
localStorage.getItem(D) || "[]"
|
|
168
|
+
);
|
|
169
|
+
o && n.includes(o) && (o = null), o || (o = `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, sessionStorage.setItem(G, o)), n.includes(o) || (n.push(o), localStorage.setItem(
|
|
170
|
+
D,
|
|
171
|
+
JSON.stringify(n)
|
|
172
|
+
)), t(o);
|
|
173
|
+
const s = () => {
|
|
174
|
+
const i = n.filter(
|
|
175
|
+
(a) => a !== o
|
|
176
|
+
);
|
|
177
|
+
localStorage.setItem(
|
|
178
|
+
D,
|
|
179
|
+
JSON.stringify(i)
|
|
180
|
+
);
|
|
181
|
+
};
|
|
182
|
+
return window.addEventListener("beforeunload", s), () => {
|
|
183
|
+
window.removeEventListener("beforeunload", s);
|
|
184
|
+
};
|
|
185
|
+
}, []), e;
|
|
186
|
+
}, O = (e) => Object.prototype.toString.call(e) == "[object String]", Fe = (e, t) => e.indexOf(t) !== -1, I = (e) => e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""), X = (e) => e === void 0, Ue = (e) => e === null, q = (e) => X(e) || Ue(e), Z = (e) => !!e && (e == null ? void 0 : e.nodeType) === 3;
|
|
187
|
+
function Be(e) {
|
|
188
|
+
return !!e && (e == null ? void 0 : e.nodeType) === 1;
|
|
189
|
+
}
|
|
190
|
+
function He(e, t) {
|
|
191
|
+
return !!e && !!(e != null && e.tagName) && (e == null ? void 0 : e.tagName.toLowerCase()) === t.toLowerCase();
|
|
192
|
+
}
|
|
193
|
+
function Ye(e) {
|
|
194
|
+
return e ? I(e).split(/\s+/) : [];
|
|
195
|
+
}
|
|
196
|
+
function We(e) {
|
|
197
|
+
let t = "";
|
|
198
|
+
switch (typeof (e == null ? void 0 : e.className)) {
|
|
199
|
+
case "string":
|
|
200
|
+
t = e == null ? void 0 : e.className;
|
|
201
|
+
break;
|
|
202
|
+
case "object":
|
|
203
|
+
t = (e != null && e.className && "baseVal" in (e == null ? void 0 : e.className) ? (e == null ? void 0 : e.className).baseVal : null) || (e == null ? void 0 : e.getAttribute("class")) || "";
|
|
204
|
+
break;
|
|
205
|
+
default:
|
|
206
|
+
t = "";
|
|
207
|
+
}
|
|
208
|
+
return Ye(t);
|
|
209
|
+
}
|
|
210
|
+
const b = (e, t = 255) => q(e) ? "" : I(e).split(/(\s+)/).filter((o) => U(o)).join("").replace(/[\r\n]/g, " ").replace(/[ ]+/g, " ").substring(0, t), F = (e) => {
|
|
211
|
+
let t = "";
|
|
212
|
+
if (Ve(e) && // !isSensitiveElement(el) &&
|
|
213
|
+
(e != null && e.childNodes) && (e != null && e.childNodes.length))
|
|
214
|
+
for (const o of e == null ? void 0 : e.childNodes)
|
|
215
|
+
Z(o) && o.textContent && (t += b(o.textContent) ?? "");
|
|
216
|
+
return I(t);
|
|
217
|
+
}, Ke = (e) => {
|
|
218
|
+
var t, o;
|
|
219
|
+
return X(e.target) ? (e == null ? void 0 : e.srcElement) || null : (t = e == null ? void 0 : e.target) != null && t.shadowRoot ? ((o = e == null ? void 0 : e.composedPath()) == null ? void 0 : o[0]) || null : (e == null ? void 0 : e.target) || null;
|
|
220
|
+
}, Ge = (e, t) => {
|
|
221
|
+
if (!window || !e || He(e, "html") || !Be(e))
|
|
222
|
+
return !1;
|
|
223
|
+
const o = window.getComputedStyle(e);
|
|
224
|
+
if (o && o.getPropertyValue("cursor") === "pointer" && t.type === "click")
|
|
225
|
+
return !0;
|
|
226
|
+
switch (e == null ? void 0 : e.tagName.toLowerCase()) {
|
|
227
|
+
case "html":
|
|
228
|
+
return !1;
|
|
229
|
+
case "form":
|
|
230
|
+
return t.type === "submit";
|
|
231
|
+
case "input":
|
|
232
|
+
case "select":
|
|
233
|
+
case "textarea":
|
|
234
|
+
return ["change", "click"].includes(t.type);
|
|
235
|
+
default:
|
|
236
|
+
return t.type === "click";
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
function Ve(e) {
|
|
240
|
+
if (Fe(We(e), "ph-include"))
|
|
241
|
+
return !0;
|
|
242
|
+
const t = e.type || "";
|
|
243
|
+
if (O(t))
|
|
244
|
+
switch (t.toLowerCase()) {
|
|
245
|
+
case "hidden":
|
|
246
|
+
return !1;
|
|
247
|
+
case "password":
|
|
248
|
+
return !1;
|
|
249
|
+
}
|
|
250
|
+
const o = e.name || (e == null ? void 0 : e.id) || "";
|
|
251
|
+
return !(O(o) && /^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g, "")));
|
|
252
|
+
}
|
|
253
|
+
const Q = "(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})", Je = new RegExp(`^(?:${Q})$`), ze = new RegExp(Q), ee = "\\d{3}-?\\d{2}-?\\d{4}", Xe = new RegExp(`^(${ee})$`), qe = new RegExp(`(${ee})`), U = (e, t = !0) => !(q(e) || O(e) && (e = I(e), (t ? Je : ze).test((e || "").replace(/[- ]/g, "")) || (t ? Xe : qe).test(e))), Ze = (e) => O(e) ? e.substring(0, 10) === "_ngcontent" || e.substring(0, 7) === "_nghost" : !1, Qe = (e) => {
|
|
254
|
+
let t = F(e);
|
|
255
|
+
return t = `${t} ${te(e)}`.trim(), U(t) ? t : "";
|
|
256
|
+
};
|
|
257
|
+
function te(e) {
|
|
258
|
+
var o;
|
|
259
|
+
let t = "";
|
|
260
|
+
if (e != null && e.childNodes.length) {
|
|
261
|
+
for (const n of e.childNodes)
|
|
262
|
+
if (n && ((o = n.tagName) == null ? void 0 : o.toLowerCase()) === "span")
|
|
263
|
+
try {
|
|
264
|
+
const s = F(n);
|
|
265
|
+
t = `${t} ${s}`.trim(), n != null && n.childNodes.length && (t = `${t} ${te(n)}`.trim());
|
|
266
|
+
} catch {
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return t;
|
|
270
|
+
}
|
|
271
|
+
const et = ["input", "textarea", "select"], ne = (e) => {
|
|
272
|
+
var s, i, a, u;
|
|
273
|
+
const t = (s = e == null ? void 0 : e.tagName) == null ? void 0 : s.toLowerCase(), o = {
|
|
274
|
+
element: t
|
|
275
|
+
};
|
|
276
|
+
(t == null ? void 0 : t.toLowerCase()) === "a" || (t == null ? void 0 : t.toLowerCase()) === "button" ? o.text = Qe(e) : o.text = F(e);
|
|
277
|
+
const n = Array.from(e.attributes).reduce(
|
|
278
|
+
(r, c) => {
|
|
279
|
+
if (U(c.value) && !Ze(c.name)) {
|
|
280
|
+
if (c.name === "class")
|
|
281
|
+
return r;
|
|
282
|
+
r[c.name] = typeof (c == null ? void 0 : c.value) == "string" ? b(c.value) : c.value;
|
|
283
|
+
}
|
|
284
|
+
return r;
|
|
285
|
+
},
|
|
286
|
+
{}
|
|
287
|
+
);
|
|
288
|
+
if (o.attributes = n, et.includes(t) || (e == null ? void 0 : e.getAttribute("contenteditable")) === "true") {
|
|
289
|
+
let r;
|
|
290
|
+
e.matches('input[type="checkbox"], input[type="radio"]') ? r = e.checked : e.matches("input, select, textarea") && !e.matches('input[type="password"]') && (r = e.value), r !== void 0 && (o.value = typeof r == "string" || r === null ? b(r, 1024) : r);
|
|
291
|
+
let c = "";
|
|
292
|
+
o != null && o.attributes.id && (c = b(
|
|
293
|
+
((a = (i = document.querySelector(`label[for="${o == null ? void 0 : o.attributes.id}"]`)) == null ? void 0 : i.textContent) == null ? void 0 : a.trim()) || ""
|
|
294
|
+
));
|
|
295
|
+
const d = e.closest("label");
|
|
296
|
+
c || (c = b(((u = d == null ? void 0 : d.textContent) == null ? void 0 : u.trim()) || "")), c && (o.label = c);
|
|
297
|
+
}
|
|
298
|
+
return o;
|
|
299
|
+
}, tt = (e, t) => {
|
|
300
|
+
var s;
|
|
301
|
+
let o = Ke(e);
|
|
302
|
+
Z(o) && (o = o.parentNode || null);
|
|
303
|
+
const n = ["copy", "cut"].includes(t);
|
|
304
|
+
if (o && (n || Ge(o, e))) {
|
|
305
|
+
const i = ne(o);
|
|
306
|
+
if (n) {
|
|
307
|
+
const a = b((s = window == null ? void 0 : window.getSelection()) == null ? void 0 : s.toString()), u = (e == null ? void 0 : e.type) || "clipboard";
|
|
308
|
+
i.copy_text = a ?? "", i.copy_type = u ?? "";
|
|
309
|
+
}
|
|
310
|
+
return i;
|
|
311
|
+
}
|
|
312
|
+
return null;
|
|
313
|
+
}, nt = 30, ot = 1e3, rt = 3;
|
|
314
|
+
class st {
|
|
315
|
+
constructor() {
|
|
316
|
+
H(this, "clicks");
|
|
317
|
+
this.clicks = [];
|
|
318
|
+
}
|
|
319
|
+
isRageClick(t, o, n) {
|
|
320
|
+
const s = this.clicks[this.clicks.length - 1];
|
|
321
|
+
if (s && Math.abs(t - s.x) + Math.abs(o - s.y) < nt && n - s.timestamp < ot) {
|
|
322
|
+
if (this.clicks.push({ x: t, y: o, timestamp: n }), this.clicks.length === rt)
|
|
323
|
+
return !0;
|
|
324
|
+
} else
|
|
325
|
+
this.clicks = [{ x: t, y: o, timestamp: n }];
|
|
326
|
+
return !1;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
const $ = new st(), it = () => {
|
|
330
|
+
const { audience: e } = S();
|
|
331
|
+
f(() => {
|
|
332
|
+
let t = null;
|
|
333
|
+
const o = (i) => {
|
|
334
|
+
if (t) {
|
|
335
|
+
clearTimeout(t), t = null;
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
t = setTimeout(() => {
|
|
339
|
+
s(i, !1), t = null;
|
|
340
|
+
}, 250);
|
|
341
|
+
}, n = (i) => {
|
|
342
|
+
t && (clearTimeout(t), t = null), s(i, !0);
|
|
343
|
+
}, s = (i, a = !1) => {
|
|
344
|
+
var u;
|
|
345
|
+
try {
|
|
346
|
+
let r = {
|
|
347
|
+
hostname: window.location.hostname,
|
|
348
|
+
pathname: window.location.pathname,
|
|
349
|
+
page_title: document.title,
|
|
350
|
+
url: window.location.href,
|
|
351
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
352
|
+
event_type: a ? "dblclick" : "click",
|
|
353
|
+
button_type: i.button
|
|
354
|
+
};
|
|
355
|
+
if (i.target instanceof HTMLElement) {
|
|
356
|
+
const c = i.target;
|
|
357
|
+
r.rage_click = $ == null ? void 0 : $.isRageClick(
|
|
358
|
+
i.clientX,
|
|
359
|
+
i.clientY,
|
|
360
|
+
(/* @__PURE__ */ new Date()).getTime()
|
|
361
|
+
), r = {
|
|
362
|
+
...r,
|
|
363
|
+
...ne(c)
|
|
364
|
+
};
|
|
365
|
+
let d = c == null ? void 0 : c.getAttribute("href");
|
|
366
|
+
if (!d) {
|
|
367
|
+
let l = c.parentNode, p = 0;
|
|
368
|
+
for (; l && p < 8; ) {
|
|
369
|
+
const g = (u = l == null ? void 0 : l.parentElement) == null ? void 0 : u.getAttribute("href");
|
|
370
|
+
if (g) {
|
|
371
|
+
d = g;
|
|
372
|
+
break;
|
|
373
|
+
}
|
|
374
|
+
l = l.parentNode, p++;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
e == null || e.track("page.click", {
|
|
378
|
+
...r,
|
|
379
|
+
href: d || void 0
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
} catch {
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
return document.addEventListener("click", o), document.addEventListener("dblclick", n), () => {
|
|
386
|
+
document.removeEventListener("click", o), document.removeEventListener("dblclick", n);
|
|
387
|
+
};
|
|
388
|
+
}, [e]);
|
|
389
|
+
}, _ = (e) => Number(e.toFixed(0)), ct = (e) => {
|
|
390
|
+
const { audience: t } = S(), [o] = h({
|
|
391
|
+
value: _(performance.now()),
|
|
392
|
+
timestamp: _(Date.now())
|
|
393
|
+
}), [n, s] = h({
|
|
394
|
+
value: null,
|
|
395
|
+
timestamp: null
|
|
396
|
+
}), [i, a] = h({
|
|
397
|
+
value: null,
|
|
398
|
+
timestamp: null
|
|
399
|
+
});
|
|
400
|
+
return f(() => {
|
|
401
|
+
let u = !0;
|
|
402
|
+
const r = (l, p) => {
|
|
403
|
+
u && l({ value: _(p), timestamp: _(Date.now()) });
|
|
404
|
+
}, c = new PerformanceObserver((l) => {
|
|
405
|
+
for (const p of l.getEntries())
|
|
406
|
+
p.name === "first-contentful-paint" && r(s, p.startTime);
|
|
407
|
+
});
|
|
408
|
+
c.observe({ type: "paint", buffered: !0 });
|
|
409
|
+
const d = () => r(a, performance.now());
|
|
410
|
+
return document.readyState === "complete" ? r(a, performance.now()) : window.addEventListener("load", d), () => {
|
|
411
|
+
u = !1, c.disconnect(), window.removeEventListener("load", d);
|
|
412
|
+
};
|
|
413
|
+
}, []), f(() => {
|
|
414
|
+
o && t && (t == null || t.track("page.metrics", {
|
|
415
|
+
script_load: o.value,
|
|
416
|
+
script_load_at: o.timestamp,
|
|
417
|
+
version: 2
|
|
418
|
+
}));
|
|
419
|
+
}, [o, t]), f(() => {
|
|
420
|
+
n.value !== null && t && (t == null || t.track("page.metrics", {
|
|
421
|
+
first_contentful_paint: n.value,
|
|
422
|
+
first_contentful_paint_at: n.timestamp,
|
|
423
|
+
version: 2
|
|
424
|
+
}));
|
|
425
|
+
}, [n, t]), f(() => {
|
|
426
|
+
i.value !== null && t && (t == null || t.track("page.metrics", {
|
|
427
|
+
window_onload: i.value,
|
|
428
|
+
window_onload_at: i.timestamp,
|
|
429
|
+
version: 2
|
|
430
|
+
}));
|
|
431
|
+
}, [i, t]), { script: o, fcp: n, window_onload: i };
|
|
432
|
+
}, at = () => {
|
|
433
|
+
const { audience: e } = S();
|
|
434
|
+
f(() => {
|
|
435
|
+
let t;
|
|
436
|
+
const o = () => {
|
|
437
|
+
clearTimeout(t), t = setTimeout(() => {
|
|
438
|
+
const n = window.getSelection();
|
|
439
|
+
if (n && (n == null ? void 0 : n.rangeCount) > 0) {
|
|
440
|
+
const s = n == null ? void 0 : n.toString();
|
|
441
|
+
s && (e == null || e.track("page.selection", {
|
|
442
|
+
text: b(s)
|
|
443
|
+
}));
|
|
444
|
+
}
|
|
445
|
+
}, 1e3);
|
|
446
|
+
};
|
|
447
|
+
return document.addEventListener("selectionchange", o), () => {
|
|
448
|
+
clearTimeout(t), document.removeEventListener("selectionchange", o);
|
|
449
|
+
};
|
|
450
|
+
}, []);
|
|
451
|
+
}, V = "lv_insights_st", ut = 15 * 60 * 1e3, dt = (e = "https://cachefly.cachefly.net/1mb.test") => {
|
|
452
|
+
const [t, o] = h(null);
|
|
453
|
+
return f(() => {
|
|
454
|
+
const n = localStorage.getItem(V);
|
|
455
|
+
if (n) {
|
|
456
|
+
const { speed: u, timestamp: r } = JSON.parse(n);
|
|
457
|
+
if (Date.now() - r < ut) {
|
|
458
|
+
o(u);
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
let s = null;
|
|
463
|
+
const i = async () => {
|
|
464
|
+
const u = new ue("download_speed");
|
|
465
|
+
if (u.acquireLock())
|
|
466
|
+
try {
|
|
467
|
+
const c = performance.now();
|
|
468
|
+
await fetch(e, { cache: "no-store" });
|
|
469
|
+
const l = (performance.now() - c) / 1e3, p = Math.round(8 / l);
|
|
470
|
+
o(p), localStorage.setItem(
|
|
471
|
+
V,
|
|
472
|
+
JSON.stringify({ speed: p, timestamp: Date.now() })
|
|
473
|
+
);
|
|
474
|
+
} catch {
|
|
475
|
+
} finally {
|
|
476
|
+
u.releaseLock();
|
|
477
|
+
}
|
|
478
|
+
}, a = () => {
|
|
479
|
+
document.removeEventListener("mousemove", a), document.removeEventListener("keydown", a), document.removeEventListener("scroll", a), s = setTimeout(i, 5e3);
|
|
480
|
+
};
|
|
481
|
+
return document.addEventListener("mousemove", a, { once: !0 }), document.addEventListener("keydown", a, { once: !0 }), document.addEventListener("scroll", a, { once: !0 }), () => {
|
|
482
|
+
s && clearTimeout(s), document.removeEventListener("mousemove", a), document.removeEventListener("keydown", a), document.removeEventListener("scroll", a);
|
|
483
|
+
};
|
|
484
|
+
}, [e]), t;
|
|
485
|
+
}, yt = ({ id: e, properties: t = {} }) => {
|
|
486
|
+
var u;
|
|
487
|
+
const o = typeof window < "u" ? window.location.href : "", n = S();
|
|
488
|
+
f(() => {
|
|
489
|
+
n && typeof window < "u" && (window.levo_client = n);
|
|
490
|
+
}, [n]), f(() => {
|
|
491
|
+
n != null && n.audience && typeof window < "u" && (window.levo_audience = n == null ? void 0 : n.audience);
|
|
492
|
+
}, []), $e(), Pe(), it();
|
|
493
|
+
const s = dt();
|
|
494
|
+
f(() => {
|
|
495
|
+
var r;
|
|
496
|
+
(r = n == null ? void 0 : n.audience) != null && r.instance && s && (n == null || n.audience.track("user.speedtest", {
|
|
497
|
+
speed: s,
|
|
498
|
+
unit: "Mbps"
|
|
499
|
+
}));
|
|
500
|
+
}, [s]);
|
|
501
|
+
const i = De();
|
|
502
|
+
f(() => {
|
|
503
|
+
var r;
|
|
504
|
+
(r = n == null ? void 0 : n.audience) != null && r.instance && (n == null || n.audience.track("page.scroll", {
|
|
505
|
+
resource: "page",
|
|
506
|
+
identifier: e,
|
|
507
|
+
percent: i.depth,
|
|
508
|
+
speed_category: i.speedCategory
|
|
509
|
+
}));
|
|
510
|
+
}, [
|
|
511
|
+
(u = n == null ? void 0 : n.audience) == null ? void 0 : u.instance,
|
|
512
|
+
i.depth,
|
|
513
|
+
i.speedCategory,
|
|
514
|
+
e
|
|
515
|
+
]), ct(), at(), f(() => {
|
|
516
|
+
const r = () => {
|
|
517
|
+
var c;
|
|
518
|
+
(c = n == null ? void 0 : n.audience) == null || c.bounce({
|
|
519
|
+
resource: "page",
|
|
520
|
+
identifier: e
|
|
521
|
+
});
|
|
522
|
+
};
|
|
523
|
+
return window && window.addEventListener("beforeunload", r), () => {
|
|
524
|
+
window && window.removeEventListener("beforeunload", r);
|
|
525
|
+
};
|
|
526
|
+
}, [n == null ? void 0 : n.audience, e]);
|
|
527
|
+
const [a] = ae();
|
|
528
|
+
return f(() => {
|
|
529
|
+
var r;
|
|
530
|
+
(a === x.TERMINATED || a === x.HIDDEN || a === x.UNKNOWN || a === x.FROZEN) && ((r = n == null ? void 0 : n.audience) == null || r.bounce({
|
|
531
|
+
resource: "page",
|
|
532
|
+
identifier: e,
|
|
533
|
+
state: a
|
|
534
|
+
}));
|
|
535
|
+
}, [a, n == null ? void 0 : n.audience, e]), f(() => {
|
|
536
|
+
(() => {
|
|
537
|
+
var c, d;
|
|
538
|
+
n != null && n.insightsUrl && n.workspace && o && ((c = n == null ? void 0 : n.audience) != null && c.instance ? n == null || n.audience.instance.page({
|
|
539
|
+
resource: "page",
|
|
540
|
+
identifier: e
|
|
541
|
+
}) : (d = n == null ? void 0 : n.audience) == null || d.initiate({
|
|
542
|
+
...t,
|
|
543
|
+
id: e,
|
|
544
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
545
|
+
}));
|
|
546
|
+
})();
|
|
547
|
+
}, [n == null ? void 0 : n.insightsUrl, n == null ? void 0 : n.workspace, o]), f(() => {
|
|
548
|
+
const r = {
|
|
549
|
+
change: "form.change",
|
|
550
|
+
submit: "form.submit",
|
|
551
|
+
copy: "page.copy",
|
|
552
|
+
cut: "page.copy"
|
|
553
|
+
}, c = (l) => (p) => {
|
|
554
|
+
var v;
|
|
555
|
+
const g = tt(p, l);
|
|
556
|
+
g && ((v = n == null ? void 0 : n.audience) == null || v.track(r[l], g));
|
|
557
|
+
}, d = {
|
|
558
|
+
change: c("change"),
|
|
559
|
+
copy: c("copy"),
|
|
560
|
+
cut: c("cut"),
|
|
561
|
+
submit: c("submit")
|
|
562
|
+
};
|
|
563
|
+
return document.addEventListener("change", d.change), document.addEventListener("copy", d.copy), document.addEventListener("cut", d.cut), document.addEventListener("submit", d.submit), () => {
|
|
564
|
+
document.removeEventListener("change", d.change), document.removeEventListener("copy", d.copy), document.removeEventListener("cut", d.cut), document.removeEventListener("submit", d.submit);
|
|
565
|
+
};
|
|
566
|
+
}, []), (!(n != null && n.insightsUrl) || !n.workspace || !n.workspace.startsWith("W")) && console.error(
|
|
567
|
+
"[@levo-so/react] The utility could not be initialized, due to missing workspace, or endpoint for insights."
|
|
568
|
+
), null;
|
|
569
|
+
};
|
|
570
|
+
export {
|
|
571
|
+
bt as L,
|
|
572
|
+
vt as a,
|
|
573
|
+
yt as b
|
|
574
|
+
};
|
|
@@ -1,25 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { LevoBlog } from '@levo-so/core/blog-plugin';
|
|
3
|
-
import { LevoCollection } from '@levo-so/core/collection-plugin';
|
|
4
|
-
import { LevoAudience } from '@levo-so/core/audience-plugin';
|
|
5
|
-
import { LevoLogger } from '@levo-so/core/logger-plugin';
|
|
6
|
-
import { LevoMedia } from '@levo-so/core/media-plugin';
|
|
7
|
-
import { LevoMembership } from '@levo-so/core/membership-plugin';
|
|
1
|
+
import { ILevoClient } from '@levo-so/core';
|
|
8
2
|
import { default as React } from 'react';
|
|
9
|
-
interface
|
|
10
|
-
client:
|
|
11
|
-
audience?: LevoAudience;
|
|
12
|
-
membership?: LevoMembership;
|
|
13
|
-
collection?: LevoCollection;
|
|
14
|
-
blog?: LevoBlog;
|
|
15
|
-
media: LevoMedia;
|
|
16
|
-
logger: LevoLogger;
|
|
17
|
-
}
|
|
18
|
-
interface ILevoProps extends Partial<Omit<ILevoContext, "media" | "logger">> {
|
|
19
|
-
client: LevoClient;
|
|
3
|
+
interface ILevoProps {
|
|
4
|
+
client: ILevoClient;
|
|
20
5
|
children: React.ReactNode;
|
|
21
6
|
}
|
|
22
7
|
export declare const LevoProvider: React.FC<ILevoProps>;
|
|
23
|
-
export declare const useLevo: () =>
|
|
8
|
+
export declare const useLevo: () => ILevoClient;
|
|
24
9
|
export {};
|
|
25
10
|
//# sourceMappingURL=LevoProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LevoProvider.d.ts","sourceRoot":"","sources":["../../src/providers/LevoProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"LevoProvider.d.ts","sourceRoot":"","sources":["../../src/providers/LevoProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,UAAU,UAAU;IAClB,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAE7C,CAAC;AAEF,eAAO,MAAM,OAAO,QAOS,WAC5B,CAAC"}
|