@levo-so/react 0.1.31 → 0.1.32
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/audience/components/page.d.ts.map +1 -1
- package/dist/audience/hooks/usePerformanceMetrics.d.ts +9 -0
- package/dist/audience/hooks/usePerformanceMetrics.d.ts.map +1 -0
- package/dist/audience/index.js +1 -1
- package/dist/audience/utils/autocapture.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/{page-jWvzWjyk.js → page-BjcgPmsH.js} +162 -136
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../src/audience/components/page.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../src/audience/components/page.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAUlE,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,WAAW,CAAC,EAAE,UAAU,CAAC;QACzB,aAAa,CAAC,EAAE,YAAY,CAAC;KAC9B;CACF;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC;IACtC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC;CACvC,CA8KA,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type PerformanceMetrics = {
|
|
2
|
+
page_loaded_at: number;
|
|
3
|
+
script_load: number;
|
|
4
|
+
first_contentful_paint: number | null;
|
|
5
|
+
window_onload: number | null;
|
|
6
|
+
};
|
|
7
|
+
declare const usePerformanceMetrics: (href: string) => PerformanceMetrics | null;
|
|
8
|
+
export default usePerformanceMetrics;
|
|
9
|
+
//# sourceMappingURL=usePerformanceMetrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePerformanceMetrics.d.ts","sourceRoot":"","sources":["../../../src/audience/hooks/usePerformanceMetrics.tsx"],"names":[],"mappings":"AAIA,KAAK,kBAAkB,GAAG;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CAAC;AAEF,QAAA,MAAM,qBAAqB,SAAU,MAAM,KAAG,kBAAkB,GAAG,IA4DlE,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
package/dist/audience/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocapture.d.ts","sourceRoot":"","sources":["../../../src/audience/utils/autocapture.ts"],"names":[],"mappings":"AAgCA,eAAO,MAAM,UAAU,OACjB,OAAO,GAAG,SAAS,GAAG,IAAI,KAC7B,EAAE,IAAI,WAER,CAAC;AA2DF,eAAO,MAAM,YAAY,MACpB,MAAM,GAAG,IAAI,GAAG,SAAS,sBAE3B,MAiBF,CAAC;AAWF,eAAO,MAAM,WAAW,OAAQ,OAAO,KAAG,MAiBzC,CAAC;AAEF,eAAO,MAAM,cAAc,MAAO,KAAK,KAAG,OAAO,GAAG,IASnD,CAAC;AAYF,eAAO,MAAM,qBAAqB,OAAQ,OAAO,SAAS,KAAK,KAAG,OA2BjE,CAAC;AAoFF,eAAO,MAAM,kBAAkB,UACtB,MAAM,8BAEZ,OAuBF,CAAC;AASF,eAAO,MAAM,kBAAkB,kBAAmB,MAAM,KAAG,OAQ1D,CAAC;AASF,eAAO,MAAM,0BAA0B,WAAY,OAAO,KAAG,MAI5D,CAAC;AA6BF,MAAM,MAAM,QAAQ,GAAG,GAAG,CAAC;AAC3B,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAIlD,eAAO,MAAM,aAAa,YAAa,OAAO,KAAG,
|
|
1
|
+
{"version":3,"file":"autocapture.d.ts","sourceRoot":"","sources":["../../../src/audience/utils/autocapture.ts"],"names":[],"mappings":"AAgCA,eAAO,MAAM,UAAU,OACjB,OAAO,GAAG,SAAS,GAAG,IAAI,KAC7B,EAAE,IAAI,WAER,CAAC;AA2DF,eAAO,MAAM,YAAY,MACpB,MAAM,GAAG,IAAI,GAAG,SAAS,sBAE3B,MAiBF,CAAC;AAWF,eAAO,MAAM,WAAW,OAAQ,OAAO,KAAG,MAiBzC,CAAC;AAEF,eAAO,MAAM,cAAc,MAAO,KAAK,KAAG,OAAO,GAAG,IASnD,CAAC;AAYF,eAAO,MAAM,qBAAqB,OAAQ,OAAO,SAAS,KAAK,KAAG,OA2BjE,CAAC;AAoFF,eAAO,MAAM,kBAAkB,UACtB,MAAM,8BAEZ,OAuBF,CAAC;AASF,eAAO,MAAM,kBAAkB,kBAAmB,MAAM,KAAG,OAQ1D,CAAC;AASF,eAAO,MAAM,0BAA0B,WAAY,OAAO,KAAG,MAI5D,CAAC;AA6BF,MAAM,MAAM,QAAQ,GAAG,GAAG,CAAC;AAC3B,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAIlD,eAAO,MAAM,aAAa,YAAa,OAAO,KAAG,UAsFhD,CAAC;AAEF,eAAO,MAAM,sBAAsB,MAAO,KAAK,aAAa,MAAM,sBA2BjE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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-
|
|
2
|
+
import { L as t, a as r, b as l } from "./page-BjcgPmsH.js";
|
|
3
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-BPzVyGLq.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-BcBoT-J5.js";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
var nt = Object.defineProperty;
|
|
3
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
|
|
4
|
+
var P = (t, n, e) => rt(t, typeof n != "symbol" ? n + "" : n, e);
|
|
5
5
|
import { j as ot } from "./jsx-runtime-B6kdoens.js";
|
|
6
|
-
import { useEffect as d, useState as
|
|
6
|
+
import { useEffect as d, useState as b } from "react";
|
|
7
7
|
import { useInView as st } from "react-intersection-observer";
|
|
8
|
-
import { u as
|
|
9
|
-
import { usePageLifecycle as it, LifecycleState as
|
|
10
|
-
const
|
|
11
|
-
const { audience: e } =
|
|
8
|
+
import { u as S } from "./LevoProvider-BAZy7_tP.js";
|
|
9
|
+
import { usePageLifecycle as it, LifecycleState as E } from "use-page-lifecycle";
|
|
10
|
+
const de = ({ id: t, properties: n = {} }) => {
|
|
11
|
+
const { audience: e } = S(), { ref: r, inView: o } = st({
|
|
12
12
|
triggerOnce: !0
|
|
13
13
|
});
|
|
14
14
|
return d(() => {
|
|
@@ -18,8 +18,8 @@ const fe = ({ id: t, properties: n = {} }) => {
|
|
|
18
18
|
identifier: t
|
|
19
19
|
}));
|
|
20
20
|
}, [o]), /* @__PURE__ */ ot.jsx("div", { ref: r, style: { height: "0px" } });
|
|
21
|
-
},
|
|
22
|
-
const { audience: e } =
|
|
21
|
+
}, le = ({ event: t, properties: n }) => {
|
|
22
|
+
const { audience: e } = S();
|
|
23
23
|
return d(() => {
|
|
24
24
|
e != null && e.instance && (e == null || e.track(t, n));
|
|
25
25
|
}, [e == null ? void 0 : e.instance, t, n]), null;
|
|
@@ -28,7 +28,7 @@ function R(t) {
|
|
|
28
28
|
var n = typeof t;
|
|
29
29
|
return t != null && (n == "object" || n == "function");
|
|
30
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")(),
|
|
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")(), N = function() {
|
|
32
32
|
return W.Date.now();
|
|
33
33
|
}, ut = /\s/;
|
|
34
34
|
function ft(t) {
|
|
@@ -40,34 +40,34 @@ var dt = /^\s+/;
|
|
|
40
40
|
function lt(t) {
|
|
41
41
|
return t && t.slice(0, ft(t) + 1).replace(dt, "");
|
|
42
42
|
}
|
|
43
|
-
var
|
|
43
|
+
var L = W.Symbol, G = Object.prototype, gt = G.hasOwnProperty, pt = G.toString, y = L ? L.toStringTag : void 0;
|
|
44
44
|
function mt(t) {
|
|
45
|
-
var n = gt.call(t,
|
|
45
|
+
var n = gt.call(t, y), e = t[y];
|
|
46
46
|
try {
|
|
47
|
-
t[
|
|
47
|
+
t[y] = void 0;
|
|
48
48
|
var r = !0;
|
|
49
49
|
} catch {
|
|
50
50
|
}
|
|
51
51
|
var o = pt.call(t);
|
|
52
|
-
return r && (n ? t[
|
|
52
|
+
return r && (n ? t[y] = e : delete t[y]), o;
|
|
53
53
|
}
|
|
54
54
|
var ht = Object.prototype, bt = ht.toString;
|
|
55
55
|
function wt(t) {
|
|
56
56
|
return bt.call(t);
|
|
57
57
|
}
|
|
58
|
-
var yt = "[object Null]",
|
|
59
|
-
function
|
|
60
|
-
return t == null ? t === void 0 ?
|
|
58
|
+
var yt = "[object Null]", vt = "[object Undefined]", U = L ? L.toStringTag : void 0;
|
|
59
|
+
function St(t) {
|
|
60
|
+
return t == null ? t === void 0 ? vt : yt : U && U in Object(t) ? mt(t) : wt(t);
|
|
61
61
|
}
|
|
62
62
|
function Tt(t) {
|
|
63
63
|
return t != null && typeof t == "object";
|
|
64
64
|
}
|
|
65
65
|
var Et = "[object Symbol]";
|
|
66
66
|
function Lt(t) {
|
|
67
|
-
return typeof t == "symbol" || Tt(t) &&
|
|
67
|
+
return typeof t == "symbol" || Tt(t) && St(t) == Et;
|
|
68
68
|
}
|
|
69
|
-
var F = NaN, xt = /^[-+]0x[0-9a-f]+$/i, Ct = /^0b[01]+$/i,
|
|
70
|
-
function
|
|
69
|
+
var F = NaN, xt = /^[-+]0x[0-9a-f]+$/i, Ct = /^0b[01]+$/i, _t = /^0o[0-7]+$/i, kt = parseInt;
|
|
70
|
+
function H(t) {
|
|
71
71
|
if (typeof t == "number")
|
|
72
72
|
return t;
|
|
73
73
|
if (Lt(t))
|
|
@@ -80,121 +80,121 @@ function B(t) {
|
|
|
80
80
|
return t === 0 ? t : +t;
|
|
81
81
|
t = lt(t);
|
|
82
82
|
var e = Ct.test(t);
|
|
83
|
-
return e ||
|
|
83
|
+
return e || _t.test(t) ? kt(t.slice(2), e ? 2 : 8) : xt.test(t) ? F : +t;
|
|
84
84
|
}
|
|
85
|
-
var
|
|
85
|
+
var Nt = "Expected a function", Ot = Math.max, It = Math.min;
|
|
86
86
|
function Rt(t, n, e) {
|
|
87
|
-
var r, o,
|
|
87
|
+
var r, o, c, a, s, i, u = 0, g = !1, l = !1, p = !0;
|
|
88
88
|
if (typeof t != "function")
|
|
89
|
-
throw new TypeError(
|
|
90
|
-
n =
|
|
91
|
-
function
|
|
92
|
-
var
|
|
93
|
-
return r = o = void 0, u = f, a = t.apply(
|
|
89
|
+
throw new TypeError(Nt);
|
|
90
|
+
n = H(n) || 0, R(e) && (g = !!e.leading, l = "maxWait" in e, c = l ? Ot(H(e.maxWait) || 0, n) : c, p = "trailing" in e ? !!e.trailing : p);
|
|
91
|
+
function _(f) {
|
|
92
|
+
var m = r, w = o;
|
|
93
|
+
return r = o = void 0, u = f, a = t.apply(w, m), a;
|
|
94
94
|
}
|
|
95
95
|
function q(f) {
|
|
96
|
-
return u = f, s = setTimeout(
|
|
96
|
+
return u = f, s = setTimeout(T, n), g ? _(f) : a;
|
|
97
97
|
}
|
|
98
98
|
function Q(f) {
|
|
99
|
-
var
|
|
100
|
-
return
|
|
99
|
+
var m = f - i, w = f - u, D = n - m;
|
|
100
|
+
return l ? It(D, c - w) : D;
|
|
101
101
|
}
|
|
102
102
|
function $(f) {
|
|
103
|
-
var
|
|
104
|
-
return
|
|
103
|
+
var m = f - i, w = f - u;
|
|
104
|
+
return i === void 0 || m >= n || m < 0 || l && w >= c;
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
var f =
|
|
106
|
+
function T() {
|
|
107
|
+
var f = N();
|
|
108
108
|
if ($(f))
|
|
109
|
-
return
|
|
110
|
-
s = setTimeout(
|
|
109
|
+
return M(f);
|
|
110
|
+
s = setTimeout(T, Q(f));
|
|
111
111
|
}
|
|
112
|
-
function
|
|
113
|
-
return s = void 0, p && r ?
|
|
112
|
+
function M(f) {
|
|
113
|
+
return s = void 0, p && r ? _(f) : (r = o = void 0, a);
|
|
114
114
|
}
|
|
115
115
|
function tt() {
|
|
116
|
-
s !== void 0 && clearTimeout(s), u = 0, r =
|
|
116
|
+
s !== void 0 && clearTimeout(s), u = 0, r = i = o = s = void 0;
|
|
117
117
|
}
|
|
118
118
|
function et() {
|
|
119
|
-
return s === void 0 ? a :
|
|
119
|
+
return s === void 0 ? a : M(N());
|
|
120
120
|
}
|
|
121
|
-
function
|
|
122
|
-
var f =
|
|
123
|
-
if (r = arguments, o = this,
|
|
121
|
+
function k() {
|
|
122
|
+
var f = N(), m = $(f);
|
|
123
|
+
if (r = arguments, o = this, i = f, m) {
|
|
124
124
|
if (s === void 0)
|
|
125
|
-
return q(
|
|
126
|
-
if (
|
|
127
|
-
return clearTimeout(s), s = setTimeout(
|
|
125
|
+
return q(i);
|
|
126
|
+
if (l)
|
|
127
|
+
return clearTimeout(s), s = setTimeout(T, n), _(i);
|
|
128
128
|
}
|
|
129
|
-
return s === void 0 && (s = setTimeout(
|
|
129
|
+
return s === void 0 && (s = setTimeout(T, n)), a;
|
|
130
130
|
}
|
|
131
|
-
return
|
|
131
|
+
return k.cancel = tt, k.flush = et, k;
|
|
132
132
|
}
|
|
133
133
|
const At = () => {
|
|
134
|
-
const [t, n] =
|
|
135
|
-
r(
|
|
134
|
+
const [t, n] = b(0), [e, r] = b(0), o = Rt((c) => {
|
|
135
|
+
r(c), n(c);
|
|
136
136
|
}, 250);
|
|
137
137
|
return d(() => {
|
|
138
|
-
const
|
|
139
|
-
const a = window.scrollY, s = document.documentElement.scrollHeight,
|
|
140
|
-
a / (s -
|
|
138
|
+
const c = () => {
|
|
139
|
+
const a = window.scrollY, s = document.documentElement.scrollHeight, i = window.innerHeight, u = Math.round(
|
|
140
|
+
a / (s - i) * 100
|
|
141
141
|
);
|
|
142
142
|
u % 10 === 0 && u > e && o(u);
|
|
143
143
|
};
|
|
144
|
-
return window.addEventListener("scroll",
|
|
144
|
+
return window.addEventListener("scroll", c), () => window.removeEventListener("scroll", c);
|
|
145
145
|
}, [e]), t;
|
|
146
|
-
},
|
|
147
|
-
const [t, n] =
|
|
146
|
+
}, v = "lv_insights_ot", jt = () => {
|
|
147
|
+
const [t, n] = b(0);
|
|
148
148
|
return d(() => {
|
|
149
|
-
const e = Number(localStorage.getItem(
|
|
150
|
-
n(e), localStorage.setItem(
|
|
151
|
-
const r = (
|
|
152
|
-
|
|
149
|
+
const e = Number(localStorage.getItem(v)) || 0;
|
|
150
|
+
n(e), localStorage.setItem(v, (e + 1).toString());
|
|
151
|
+
const r = (c) => {
|
|
152
|
+
c.key === v && n(Number(c.newValue) || 0);
|
|
153
153
|
};
|
|
154
154
|
window.addEventListener("storage", r);
|
|
155
155
|
const o = () => {
|
|
156
|
-
const
|
|
157
|
-
|
|
156
|
+
const c = Number(localStorage.getItem(v)) || 0;
|
|
157
|
+
c > 0 && localStorage.setItem(v, (c - 1).toString());
|
|
158
158
|
};
|
|
159
159
|
return window.addEventListener("beforeunload", o), () => {
|
|
160
160
|
window.removeEventListener("storage", r), window.removeEventListener("beforeunload", o);
|
|
161
161
|
};
|
|
162
162
|
}, []), t;
|
|
163
|
-
},
|
|
164
|
-
const [t, n] =
|
|
163
|
+
}, B = "lv_insights_ct", O = "lv_insights_at", $t = () => {
|
|
164
|
+
const [t, n] = b(null);
|
|
165
165
|
return d(() => {
|
|
166
|
-
let e = sessionStorage.getItem(
|
|
166
|
+
let e = sessionStorage.getItem(B);
|
|
167
167
|
const r = JSON.parse(
|
|
168
|
-
localStorage.getItem(
|
|
168
|
+
localStorage.getItem(O) || "[]"
|
|
169
169
|
);
|
|
170
|
-
e && r.includes(e) && (e = null), e || (e = `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, sessionStorage.setItem(
|
|
171
|
-
|
|
170
|
+
e && r.includes(e) && (e = null), e || (e = `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, sessionStorage.setItem(B, e)), r.includes(e) || (r.push(e), localStorage.setItem(
|
|
171
|
+
O,
|
|
172
172
|
JSON.stringify(r)
|
|
173
173
|
)), n(e);
|
|
174
174
|
const o = () => {
|
|
175
|
-
const
|
|
175
|
+
const c = r.filter(
|
|
176
176
|
(a) => a !== e
|
|
177
177
|
);
|
|
178
178
|
localStorage.setItem(
|
|
179
|
-
|
|
180
|
-
JSON.stringify(
|
|
179
|
+
O,
|
|
180
|
+
JSON.stringify(c)
|
|
181
181
|
);
|
|
182
182
|
};
|
|
183
183
|
return window.addEventListener("beforeunload", o), () => {
|
|
184
184
|
window.removeEventListener("beforeunload", o);
|
|
185
185
|
};
|
|
186
186
|
}, []), t;
|
|
187
|
-
},
|
|
188
|
-
function
|
|
187
|
+
}, x = (t) => Object.prototype.toString.call(t) == "[object String]", Mt = (t, n) => t.indexOf(n) !== -1, C = (t) => t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""), K = (t) => t === void 0, Dt = (t) => t === null, V = (t) => K(t) || Dt(t), Y = (t) => !!t && (t == null ? void 0 : t.nodeType) === 3;
|
|
188
|
+
function Pt(t) {
|
|
189
189
|
return !!t && (t == null ? void 0 : t.nodeType) === 1;
|
|
190
190
|
}
|
|
191
|
-
function
|
|
191
|
+
function Ut(t, n) {
|
|
192
192
|
return !!t && !!(t != null && t.tagName) && (t == null ? void 0 : t.tagName.toLowerCase()) === n.toLowerCase();
|
|
193
193
|
}
|
|
194
194
|
function Ft(t) {
|
|
195
195
|
return t ? C(t).split(/\s+/) : [];
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function Ht(t) {
|
|
198
198
|
let n = "";
|
|
199
199
|
switch (typeof (t == null ? void 0 : t.className)) {
|
|
200
200
|
case "string":
|
|
@@ -208,18 +208,18 @@ function Bt(t) {
|
|
|
208
208
|
}
|
|
209
209
|
return Ft(n);
|
|
210
210
|
}
|
|
211
|
-
const
|
|
211
|
+
const h = (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
212
|
let n = "";
|
|
213
213
|
if (Gt(t) && // !isSensitiveElement(el) &&
|
|
214
214
|
(t != null && t.childNodes) && (t != null && t.childNodes.length))
|
|
215
215
|
for (const e of t == null ? void 0 : t.childNodes)
|
|
216
|
-
Y(e) && e.textContent && (n +=
|
|
216
|
+
Y(e) && e.textContent && (n += h(e.textContent) ?? "");
|
|
217
217
|
return C(n);
|
|
218
|
-
},
|
|
218
|
+
}, Bt = (t) => {
|
|
219
219
|
var n, e;
|
|
220
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
221
|
}, Wt = (t, n) => {
|
|
222
|
-
if (!window || !t ||
|
|
222
|
+
if (!window || !t || Ut(t, "html") || !Pt(t))
|
|
223
223
|
return !1;
|
|
224
224
|
const e = window.getComputedStyle(t);
|
|
225
225
|
if (e && e.getPropertyValue("cursor") === "pointer" && n.type === "click")
|
|
@@ -238,10 +238,10 @@ const m = (t, n = 255) => V(t) ? "" : C(t).split(/(\s+)/).filter((e) => j(e)).jo
|
|
|
238
238
|
}
|
|
239
239
|
};
|
|
240
240
|
function Gt(t) {
|
|
241
|
-
if (
|
|
241
|
+
if (Mt(Ht(t), "ph-include"))
|
|
242
242
|
return !0;
|
|
243
243
|
const n = t.type || "";
|
|
244
|
-
if (
|
|
244
|
+
if (x(n))
|
|
245
245
|
switch (n.toLowerCase()) {
|
|
246
246
|
case "hidden":
|
|
247
247
|
return !1;
|
|
@@ -249,9 +249,9 @@ function Gt(t) {
|
|
|
249
249
|
return !1;
|
|
250
250
|
}
|
|
251
251
|
const e = t.name || (t == null ? void 0 : t.id) || "";
|
|
252
|
-
return !(
|
|
252
|
+
return !(x(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
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) ||
|
|
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) || x(t) && (t = C(t), (n ? Kt : Vt).test((t || "").replace(/[- ]/g, "")) || (n ? Yt : Jt).test(t))), Xt = (t) => x(t) ? t.substring(0, 10) === "_ngcontent" || t.substring(0, 7) === "_nghost" : !1, zt = (t) => {
|
|
255
255
|
let n = A(t);
|
|
256
256
|
return n = `${n} ${z(t)}`.trim(), j(n) ? n : "";
|
|
257
257
|
};
|
|
@@ -270,17 +270,17 @@ function z(t) {
|
|
|
270
270
|
return n;
|
|
271
271
|
}
|
|
272
272
|
const Zt = ["input", "textarea", "select"], Z = (t) => {
|
|
273
|
-
var o,
|
|
273
|
+
var o, c, a;
|
|
274
274
|
const n = t.tagName.toLowerCase(), e = {
|
|
275
275
|
element: n
|
|
276
276
|
};
|
|
277
277
|
n.toLowerCase() === "a" || n.toLowerCase() === "button" ? e.text = zt(t) : e.text = A(t);
|
|
278
278
|
const r = Array.from(t.attributes).reduce(
|
|
279
|
-
(s,
|
|
280
|
-
if (j(
|
|
281
|
-
if (
|
|
279
|
+
(s, i) => {
|
|
280
|
+
if (j(i.value) && !Xt(i.name)) {
|
|
281
|
+
if (i.name === "class")
|
|
282
282
|
return s;
|
|
283
|
-
s[
|
|
283
|
+
s[i.name] = typeof (i == null ? void 0 : i.value) == "string" ? h(i.value) : i.value;
|
|
284
284
|
}
|
|
285
285
|
return s;
|
|
286
286
|
},
|
|
@@ -288,33 +288,33 @@ const Zt = ["input", "textarea", "select"], Z = (t) => {
|
|
|
288
288
|
);
|
|
289
289
|
if (e.attributes = r, Zt.includes(n) || (t == null ? void 0 : t.getAttribute("contenteditable")) === "true") {
|
|
290
290
|
let s;
|
|
291
|
-
t.matches('input[type="checkbox"], input[type="radio"]') ? s = t
|
|
292
|
-
let
|
|
293
|
-
e != null && e.attributes.id && (
|
|
294
|
-
((
|
|
291
|
+
t.matches('input[type="checkbox"], input[type="radio"]') ? s = t.checked : t.matches("input, select, textarea") && !t.matches('input[type="password"]') && (s = t.value), s !== void 0 && (e.value = typeof s == "string" || s === null ? h(s, 1024) : s);
|
|
292
|
+
let i = "";
|
|
293
|
+
e != null && e.attributes.id && (i = h(
|
|
294
|
+
((c = (o = document.querySelector(`label[for="${e == null ? void 0 : e.attributes.id}"]`)) == null ? void 0 : o.textContent) == null ? void 0 : c.trim()) || ""
|
|
295
295
|
));
|
|
296
296
|
const u = t.closest("label");
|
|
297
|
-
|
|
297
|
+
i || (i = h(((a = u == null ? void 0 : u.textContent) == null ? void 0 : a.trim()) || "")), i && (e.label = i);
|
|
298
298
|
}
|
|
299
299
|
return e;
|
|
300
300
|
}, qt = (t, n) => {
|
|
301
301
|
var o;
|
|
302
|
-
let e =
|
|
302
|
+
let e = Bt(t);
|
|
303
303
|
Y(e) && (e = e.parentNode || null);
|
|
304
304
|
const r = ["copy", "cut"].includes(n);
|
|
305
305
|
if (e && (Wt(e, t) || r)) {
|
|
306
|
-
const
|
|
306
|
+
const c = Z(e);
|
|
307
307
|
if (r) {
|
|
308
|
-
const a =
|
|
309
|
-
|
|
308
|
+
const a = h((o = window == null ? void 0 : window.getSelection()) == null ? void 0 : o.toString()), s = (t == null ? void 0 : t.type) || "clipboard";
|
|
309
|
+
c.copy_text = a ?? "", c.copy_type = s ?? "";
|
|
310
310
|
}
|
|
311
|
-
return
|
|
311
|
+
return c;
|
|
312
312
|
}
|
|
313
313
|
return null;
|
|
314
314
|
}, Qt = 30, te = 1e3, ee = 3;
|
|
315
315
|
class ne {
|
|
316
316
|
constructor() {
|
|
317
|
-
|
|
317
|
+
P(this, "clicks");
|
|
318
318
|
this.clicks = [];
|
|
319
319
|
}
|
|
320
320
|
isRageClick(n, e, r) {
|
|
@@ -328,7 +328,7 @@ class ne {
|
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
330
|
const I = new ne(), re = () => {
|
|
331
|
-
const { audience: t } =
|
|
331
|
+
const { audience: t } = S();
|
|
332
332
|
d(() => {
|
|
333
333
|
const n = (e) => {
|
|
334
334
|
try {
|
|
@@ -351,15 +351,15 @@ const I = new ne(), re = () => {
|
|
|
351
351
|
...r,
|
|
352
352
|
...Z(o)
|
|
353
353
|
};
|
|
354
|
-
let
|
|
355
|
-
if (!
|
|
354
|
+
let c = o == null ? void 0 : o.getAttribute("href");
|
|
355
|
+
if (!c) {
|
|
356
356
|
let a = o.parentNode, s = 0;
|
|
357
357
|
for (; a && s < 8; ) {
|
|
358
|
-
const
|
|
358
|
+
const i = a == null ? void 0 : a.getAttribute(
|
|
359
359
|
"href"
|
|
360
360
|
);
|
|
361
|
-
if (
|
|
362
|
-
|
|
361
|
+
if (i) {
|
|
362
|
+
c = i;
|
|
363
363
|
break;
|
|
364
364
|
}
|
|
365
365
|
a = a.parentNode, s++;
|
|
@@ -367,7 +367,7 @@ const I = new ne(), re = () => {
|
|
|
367
367
|
}
|
|
368
368
|
t == null || t.track("page.click", {
|
|
369
369
|
...r,
|
|
370
|
-
href:
|
|
370
|
+
href: c || void 0
|
|
371
371
|
});
|
|
372
372
|
}
|
|
373
373
|
} catch (r) {
|
|
@@ -378,25 +378,51 @@ const I = new ne(), re = () => {
|
|
|
378
378
|
document.removeEventListener("click", n);
|
|
379
379
|
};
|
|
380
380
|
}, [t]);
|
|
381
|
-
},
|
|
382
|
-
const {
|
|
381
|
+
}, oe = (t) => {
|
|
382
|
+
const { audience: n } = S(), [, e] = b({
|
|
383
|
+
page_loaded_at: performance.timeOrigin,
|
|
384
|
+
script_load: performance.now(),
|
|
385
|
+
first_contentful_paint: null,
|
|
386
|
+
window_onload: null
|
|
387
|
+
}), [r, o] = b(
|
|
388
|
+
null
|
|
389
|
+
);
|
|
390
|
+
return d(() => {
|
|
391
|
+
let c = !0;
|
|
392
|
+
const a = (u) => {
|
|
393
|
+
c && e((g) => {
|
|
394
|
+
const l = { ...g, ...u };
|
|
395
|
+
return Object.values(l).every((p) => p !== null) && o(l), l;
|
|
396
|
+
});
|
|
397
|
+
}, s = new PerformanceObserver((u) => {
|
|
398
|
+
for (const g of u.getEntries())
|
|
399
|
+
g.name === "first-contentful-paint" && a({ first_contentful_paint: g.startTime });
|
|
400
|
+
});
|
|
401
|
+
s.observe({ type: "paint", buffered: !0 });
|
|
402
|
+
const i = () => a({ window_onload: performance.now() });
|
|
403
|
+
return document.readyState === "complete" ? i() : window.addEventListener("load", i), () => {
|
|
404
|
+
c = !1, s.disconnect(), window.removeEventListener("load", i);
|
|
405
|
+
};
|
|
406
|
+
}, [t]), d(() => {
|
|
407
|
+
r && n && (n == null || n.track("page.metrics", r));
|
|
408
|
+
}, [r, n]), r;
|
|
409
|
+
}, ge = ({ id: t, properties: n = {} }) => {
|
|
410
|
+
const e = typeof window < "u" ? window.location.href : "", { client: r, audience: o } = S();
|
|
383
411
|
d(() => {
|
|
384
|
-
|
|
385
|
-
}, [
|
|
386
|
-
|
|
387
|
-
}, [
|
|
388
|
-
const
|
|
389
|
-
jt(), $t(), re();
|
|
390
|
-
const i = At();
|
|
412
|
+
r && typeof window < "u" && (window.levo_client = r);
|
|
413
|
+
}, [r]), d(() => {
|
|
414
|
+
o && typeof window < "u" && (window.levo_audience = o);
|
|
415
|
+
}, [o]), jt(), $t(), re();
|
|
416
|
+
const c = At();
|
|
391
417
|
d(() => {
|
|
392
|
-
|
|
418
|
+
o != null && o.instance && o.track("page.scroll", {
|
|
393
419
|
resource: "page",
|
|
394
420
|
identifier: t,
|
|
395
|
-
percent:
|
|
421
|
+
percent: c
|
|
396
422
|
});
|
|
397
|
-
}, [
|
|
423
|
+
}, [o == null ? void 0 : o.instance, c, t]), oe(e), d(() => {
|
|
398
424
|
const s = () => {
|
|
399
|
-
|
|
425
|
+
o == null || o.bounce({
|
|
400
426
|
resource: "page",
|
|
401
427
|
identifier: t
|
|
402
428
|
});
|
|
@@ -404,49 +430,49 @@ const I = new ne(), re = () => {
|
|
|
404
430
|
return window && window.addEventListener("beforeunload", s), () => {
|
|
405
431
|
window && window.removeEventListener("beforeunload", s);
|
|
406
432
|
};
|
|
407
|
-
}, [
|
|
433
|
+
}, [o, t]);
|
|
408
434
|
const [a] = it();
|
|
409
435
|
return d(() => {
|
|
410
|
-
(a ===
|
|
436
|
+
(a === E.TERMINATED || a === E.HIDDEN || a === E.UNKNOWN || a === E.FROZEN) && (o == null || o.bounce({
|
|
411
437
|
resource: "page",
|
|
412
438
|
identifier: t,
|
|
413
439
|
state: a
|
|
414
440
|
}));
|
|
415
|
-
}, [a,
|
|
441
|
+
}, [a, o, t]), d(() => {
|
|
416
442
|
(() => {
|
|
417
|
-
|
|
443
|
+
r != null && r.insightsUrl && r.workspace && e && (o != null && o.instance ? o.instance.page({
|
|
418
444
|
resource: "page",
|
|
419
445
|
identifier: t
|
|
420
|
-
}) :
|
|
446
|
+
}) : o == null || o.initiate({
|
|
421
447
|
...n,
|
|
422
448
|
id: t,
|
|
423
449
|
created_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
424
450
|
}));
|
|
425
451
|
})();
|
|
426
|
-
}, [
|
|
452
|
+
}, [r == null ? void 0 : r.insightsUrl, r == null ? void 0 : r.workspace, e]), d(() => {
|
|
427
453
|
const s = {
|
|
428
454
|
change: "form.change",
|
|
429
455
|
submit: "form.submit",
|
|
430
456
|
copy: "page.copy",
|
|
431
457
|
cut: "page.copy"
|
|
432
|
-
},
|
|
433
|
-
const p = qt(
|
|
434
|
-
p && (
|
|
458
|
+
}, i = (g) => (l) => {
|
|
459
|
+
const p = qt(l, g);
|
|
460
|
+
p && (o == null || o.track(s[g], p));
|
|
435
461
|
}, u = {
|
|
436
|
-
change:
|
|
437
|
-
copy:
|
|
438
|
-
cut:
|
|
439
|
-
submit:
|
|
462
|
+
change: i("change"),
|
|
463
|
+
copy: i("copy"),
|
|
464
|
+
cut: i("cut"),
|
|
465
|
+
submit: i("submit")
|
|
440
466
|
};
|
|
441
467
|
return document.addEventListener("change", u.change), document.addEventListener("copy", u.copy), document.addEventListener("cut", u.cut), document.addEventListener("submit", u.submit), () => {
|
|
442
468
|
document.removeEventListener("change", u.change), document.removeEventListener("copy", u.copy), document.removeEventListener("cut", u.cut), document.removeEventListener("submit", u.submit);
|
|
443
469
|
};
|
|
444
|
-
}, []), (!(
|
|
470
|
+
}, []), (!(r != null && r.insightsUrl) || !r.workspace || !r.workspace.startsWith("W")) && console.error(
|
|
445
471
|
"[@levo-so/react] The utility could not be initialized, due to missing workspace, or endpoint for insights."
|
|
446
472
|
), null;
|
|
447
473
|
};
|
|
448
474
|
export {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
475
|
+
de as L,
|
|
476
|
+
le as a,
|
|
477
|
+
ge as b
|
|
452
478
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@levo-so/react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.32",
|
|
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.32"
|
|
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/
|
|
93
|
+
"@levo/ts-config": "0.0.0",
|
|
94
94
|
"@levo/tw-config": "0.0.0",
|
|
95
|
-
"@levo/
|
|
95
|
+
"@levo/eslint-config": "0.0.0"
|
|
96
96
|
},
|
|
97
97
|
"main": "./dist/index.js",
|
|
98
98
|
"module": "./dist/index.js",
|