@levo-so/react 0.1.10 → 0.1.12

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 (32) hide show
  1. package/dist/{CheckboxWidget-Cfgvj7cn.js → CheckboxWidget-BLxjrwGY.js} +1 -1
  2. package/dist/{CollectionFormBuilder-Cl75S4QY.js → CollectionFormBuilder-dqQC2Vnj.js} +17 -17
  3. package/dist/{CurrencyWidget-CIrjUd7P.js → CurrencyWidget-CAMx9DJF.js} +1 -1
  4. package/dist/{DateTimeWidget-C3ZjRkzt.js → DateTimeWidget-DaLajxcA.js} +1 -1
  5. package/dist/{DefaultFormVariant-vMPY17-9.js → DefaultFormVariant-CpnU1wDu.js} +2 -2
  6. package/dist/{DropdownWidget-CK1trfBl.js → DropdownWidget-6qBfLQ2N.js} +1 -1
  7. package/dist/{EmailWidget-BO-vqkzR.js → EmailWidget-p5rZwhuj.js} +1 -1
  8. package/dist/{GeocoderWidget-B2YFZCYX.js → GeocoderWidget-BbKp8xEY.js} +2 -2
  9. package/dist/{LevoProvider-Cp0CKrgY.js → LevoProvider-BI6g_T4E.js} +54 -54
  10. package/dist/{MultiGeocoderWidget-C_s8Zsij.js → MultiGeocoderWidget-BNHx170i.js} +2 -2
  11. package/dist/{PhoneWidget-DUaS-iYE.js → PhoneWidget-BWzgF1A0.js} +1 -1
  12. package/dist/{RadioWidget-B6_ziyPx.js → RadioWidget-DiHb1y_Q.js} +1 -1
  13. package/dist/{RichTextWidget-CgRsIwtY.js → RichTextWidget-D7o_yfwT.js} +1 -1
  14. package/dist/{StepsFormVariant-BLoWPVj3.js → StepsFormVariant-DGmREjGv.js} +2 -2
  15. package/dist/{SwitchWidget-DO-hypNx.js → SwitchWidget-CKHM9_1n.js} +1 -1
  16. package/dist/{TextWidget-LJ-qBQ4d.js → TextWidget-DU_YaDEV.js} +1 -1
  17. package/dist/{TextareaWidget-D1baKIEx.js → TextareaWidget-znTolctc.js} +1 -1
  18. package/dist/{ToggleCheckboxWidget-j7f_du6j.js → ToggleCheckboxWidget-CcNooLk3.js} +1 -1
  19. package/dist/{URLWidget-5IJ9CYEQ.js → URLWidget-BRXXKqlE.js} +2 -2
  20. package/dist/{UploadWidget-D9AcSa7N.js → UploadWidget-Dr8-x83l.js} +2 -2
  21. package/dist/audience/components/page.d.ts +0 -2
  22. package/dist/audience/components/page.d.ts.map +1 -1
  23. package/dist/audience/index.js +1 -1
  24. package/dist/collection/index.js +1 -1
  25. package/dist/index.css +1 -1
  26. package/dist/index.js +3 -3
  27. package/dist/libs.css +1 -1
  28. package/dist/membership/index.js +1 -1
  29. package/dist/page-D6IRG1XF.js +198 -0
  30. package/dist/{useLevoForm-CMcusFAD.js → useLevoForm-D8moCDuJ.js} +2 -2
  31. package/package.json +2 -2
  32. package/dist/page-YRcNFGqi.js +0 -205
@@ -0,0 +1,198 @@
1
+ "use client";
2
+ import { j as R } from "./jsx-runtime-B6kdoens.js";
3
+ import { useEffect as g, useState as j } from "react";
4
+ import { useInView as C } from "react-intersection-observer";
5
+ import { u as O } from "./LevoProvider-BI6g_T4E.js";
6
+ import { usePageLifecycle as H, LifecycleState as I } from "use-page-lifecycle";
7
+ const Te = ({ id: e, properties: r = {} }) => {
8
+ const { audience: n } = O(), { ref: t, inView: s } = C({
9
+ triggerOnce: !0
10
+ });
11
+ return g(() => {
12
+ n != null && n.instance && s && (n == null || n.track("block.view", {
13
+ ...r,
14
+ resource: "block",
15
+ identifier: e
16
+ }));
17
+ }, [s]), /* @__PURE__ */ R.jsx("div", { ref: t, style: { height: "0px" } });
18
+ }, we = ({ event: e, properties: r }) => {
19
+ const { audience: n } = O();
20
+ return g(() => {
21
+ n != null && n.instance && (n == null || n.track(e, r));
22
+ }, [n == null ? void 0 : n.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, D = F || G || Function("return this")(), w = function() {
29
+ return D.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 X = /^\s+/;
37
+ function Y(e) {
38
+ return e && e.slice(0, _(e) + 1).replace(X, "");
39
+ }
40
+ var h = D.Symbol, N = Object.prototype, Z = N.hasOwnProperty, q = N.toString, p = h ? h.toStringTag : void 0;
41
+ function z(e) {
42
+ var r = Z.call(e, p), n = e[p];
43
+ try {
44
+ e[p] = void 0;
45
+ var t = !0;
46
+ } catch {
47
+ }
48
+ var s = q.call(e);
49
+ return t && (r ? e[p] = n : 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]", $ = h ? h.toStringTag : void 0;
56
+ function ne(e) {
57
+ return e == null ? e === void 0 ? te : ee : $ && $ in Object(e) ? z(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 A = NaN, se = /^[-+]0x[0-9a-f]+$/i, ce = /^0b[01]+$/i, fe = /^0o[0-7]+$/i, ae = parseInt;
67
+ function P(e) {
68
+ if (typeof e == "number")
69
+ return e;
70
+ if (oe(e))
71
+ return A;
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 = Y(e);
79
+ var n = ce.test(e);
80
+ return n || fe.test(e) ? ae(e.slice(2), n ? 2 : 8) : se.test(e) ? A : +e;
81
+ }
82
+ var le = "Expected a function", ue = Math.max, ge = Math.min;
83
+ function de(e, r, n) {
84
+ var t, s, f, l, i, c, a = 0, x = !1, d = !1, v = !0;
85
+ if (typeof e != "function")
86
+ throw new TypeError(le);
87
+ r = P(r) || 0, S(n) && (x = !!n.leading, d = "maxWait" in n, f = d ? ue(P(n.maxWait) || 0, r) : f, v = "trailing" in n ? !!n.trailing : v);
88
+ function y(o) {
89
+ var u = t, m = s;
90
+ return t = s = void 0, a = o, l = e.apply(m, u), l;
91
+ }
92
+ function M(o) {
93
+ return a = o, i = setTimeout(b, r), x ? y(o) : l;
94
+ }
95
+ function U(o) {
96
+ var u = o - c, m = o - a, k = r - u;
97
+ return d ? ge(k, f - m) : k;
98
+ }
99
+ function E(o) {
100
+ var u = o - c, m = o - a;
101
+ return c === void 0 || u >= r || u < 0 || d && m >= f;
102
+ }
103
+ function b() {
104
+ var o = w();
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 && t ? y(o) : (t = s = void 0, l);
111
+ }
112
+ function W() {
113
+ i !== void 0 && clearTimeout(i), a = 0, t = c = s = i = void 0;
114
+ }
115
+ function B() {
116
+ return i === void 0 ? l : L(w());
117
+ }
118
+ function T() {
119
+ var o = w(), u = E(o);
120
+ if (t = arguments, s = this, c = o, u) {
121
+ if (i === void 0)
122
+ return M(c);
123
+ if (d)
124
+ return clearTimeout(i), i = setTimeout(b, r), y(c);
125
+ }
126
+ return i === void 0 && (i = setTimeout(b, r)), l;
127
+ }
128
+ return T.cancel = W, T.flush = B, T;
129
+ }
130
+ const me = () => {
131
+ const [e, r] = j(0), [n, t] = j(0), s = de((f) => {
132
+ t(f), r(f);
133
+ }, 250);
134
+ return g(() => {
135
+ const f = () => {
136
+ const l = window.scrollY, i = document.documentElement.scrollHeight, c = window.innerHeight, a = Math.round(
137
+ l / (i - c) * 100
138
+ );
139
+ a % 10 === 0 && a > n && s(a);
140
+ };
141
+ return window.addEventListener("scroll", f), () => window.removeEventListener("scroll", f);
142
+ }, [n]), e;
143
+ }, je = ({ id: e, properties: r = {} }) => {
144
+ const { client: n, audience: t } = O(), [s, f] = j(), l = me(), i = typeof window < "u" ? window.location.href : void 0;
145
+ g(() => {
146
+ i && f(i);
147
+ }, [i]), g(() => {
148
+ t != null && t.instance && (t == null || t.track("page.scroll", {
149
+ resource: "page",
150
+ identifier: e,
151
+ percent: l
152
+ }));
153
+ }, [t == null ? void 0 : t.instance, l]), g(() => {
154
+ const a = () => {
155
+ t == null || t.track("page.bounce", {
156
+ resource: "page",
157
+ identifier: e
158
+ });
159
+ };
160
+ return window && window.addEventListener("beforeunload", a), () => {
161
+ window && window.removeEventListener("beforeunload", a);
162
+ };
163
+ }, [i]);
164
+ const [c] = H();
165
+ return g(() => {
166
+ c === I.TERMINATED && (t == null || t.track("page.bounce", {
167
+ resource: "page",
168
+ identifier: e,
169
+ state: c
170
+ })), c === I.FROZEN && (t == null || t.track("page.bounce", {
171
+ resource: "page",
172
+ identifier: e,
173
+ state: c
174
+ }));
175
+ }, [c]), n != null && n.insightsUrl && s ? /* @__PURE__ */ R.jsx(
176
+ "img",
177
+ {
178
+ alt: "",
179
+ src: `${n == null ? void 0 : n.insightsUrl}/v1/insights/event/hello.gif?url=${s}`,
180
+ style: {
181
+ height: "0px"
182
+ },
183
+ onLoad: () => {
184
+ t != null && t.instance ? t == null || t.instance.page({
185
+ resource: "page",
186
+ identifier: r.id
187
+ }) : t == null || t.initiate({
188
+ properties: { ...r, id: e }
189
+ });
190
+ }
191
+ }
192
+ ) : null;
193
+ };
194
+ export {
195
+ Te as L,
196
+ we as a,
197
+ je as b
198
+ };
@@ -2,8 +2,8 @@
2
2
  import { useEffect as F, useState as O, useRef as B } from "react";
3
3
  import { useFormContext as G, useWatch as H, useForm as W } from "react-hook-form";
4
4
  import { useDebouncedCallback as q } from "use-debounce";
5
- import { u as U } from "./LevoProvider-Cp0CKrgY.js";
6
- import { l as j, b as C, s as z, f as Q } from "./CollectionFormBuilder-Cl75S4QY.js";
5
+ import { u as U } from "./LevoProvider-BI6g_T4E.js";
6
+ import { l as j, b as C, s as z, f as Q } from "./CollectionFormBuilder-dqQC2Vnj.js";
7
7
  import { s as X } from "./Sonner-t6JVKA0a.js";
8
8
  import { e as x } from "./errorHandler-_34Yv8wA.js";
9
9
  import { a as Z } from "./isEmptyObject-C5s4GzLE.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@levo-so/react",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
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.3.1",
18
18
  "react-dom": "^18.3.1",
19
- "@levo-so/core": "0.1.10"
19
+ "@levo-so/core": "0.1.12"
20
20
  },
21
21
  "dependencies": {
22
22
  "@radix-ui/react-checkbox": "1.1.1",
@@ -1,205 +0,0 @@
1
- "use client";
2
- import { j as R } from "./jsx-runtime-B6kdoens.js";
3
- import { useEffect as g, useState as S } from "react";
4
- import { useInView as H } from "react-intersection-observer";
5
- import { u as x } from "./LevoProvider-Cp0CKrgY.js";
6
- import { usePageLifecycle as F, LifecycleState as I } from "use-page-lifecycle";
7
- const Te = ({ id: e, properties: r = {} }) => {
8
- const { audience: n } = x(), { ref: s, inView: t } = H({
9
- triggerOnce: !0
10
- });
11
- return g(() => {
12
- n != null && n.instance && t && (n == null || n.track("block.view", {
13
- ...r,
14
- resource: "block",
15
- identifier: e
16
- }));
17
- }, [t]), /* @__PURE__ */ R.jsx("div", { ref: s, style: { height: "0px" } });
18
- }, we = ({ event: e, properties: r }) => {
19
- const { audience: n } = x();
20
- return g(() => {
21
- n != null && n.instance && (n == null || n.track(e, r));
22
- }, [n == null ? void 0 : n.instance, e, r]), null;
23
- };
24
- function O(e) {
25
- var r = typeof e;
26
- return e != null && (r == "object" || r == "function");
27
- }
28
- var G = typeof global == "object" && global && global.Object === Object && global, U = typeof self == "object" && self && self.Object === Object && self, D = G || U || Function("return this")(), j = function() {
29
- return D.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 X = /^\s+/;
37
- function Y(e) {
38
- return e && e.slice(0, _(e) + 1).replace(X, "");
39
- }
40
- var v = D.Symbol, N = Object.prototype, Z = N.hasOwnProperty, q = N.toString, b = v ? v.toStringTag : void 0;
41
- function z(e) {
42
- var r = Z.call(e, b), n = e[b];
43
- try {
44
- e[b] = void 0;
45
- var s = !0;
46
- } catch {
47
- }
48
- var t = q.call(e);
49
- return s && (r ? e[b] = n : delete e[b]), t;
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]", $ = v ? v.toStringTag : void 0;
56
- function ne(e) {
57
- return e == null ? e === void 0 ? te : ee : $ && $ in Object(e) ? z(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 A = NaN, se = /^[-+]0x[0-9a-f]+$/i, ce = /^0b[01]+$/i, fe = /^0o[0-7]+$/i, ae = parseInt;
67
- function P(e) {
68
- if (typeof e == "number")
69
- return e;
70
- if (oe(e))
71
- return A;
72
- if (O(e)) {
73
- var r = typeof e.valueOf == "function" ? e.valueOf() : e;
74
- e = O(r) ? r + "" : r;
75
- }
76
- if (typeof e != "string")
77
- return e === 0 ? e : +e;
78
- e = Y(e);
79
- var n = ce.test(e);
80
- return n || fe.test(e) ? ae(e.slice(2), n ? 2 : 8) : se.test(e) ? A : +e;
81
- }
82
- var le = "Expected a function", ue = Math.max, ge = Math.min;
83
- function de(e, r, n) {
84
- var s, t, f, l, o, a, c = 0, d = !1, m = !1, y = !0;
85
- if (typeof e != "function")
86
- throw new TypeError(le);
87
- r = P(r) || 0, O(n) && (d = !!n.leading, m = "maxWait" in n, f = m ? ue(P(n.maxWait) || 0, r) : f, y = "trailing" in n ? !!n.trailing : y);
88
- function T(i) {
89
- var u = s, p = t;
90
- return s = t = void 0, c = i, l = e.apply(p, u), l;
91
- }
92
- function M(i) {
93
- return c = i, o = setTimeout(h, r), d ? T(i) : l;
94
- }
95
- function W(i) {
96
- var u = i - a, p = i - c, k = r - u;
97
- return m ? ge(k, f - p) : k;
98
- }
99
- function E(i) {
100
- var u = i - a, p = i - c;
101
- return a === void 0 || u >= r || u < 0 || m && p >= f;
102
- }
103
- function h() {
104
- var i = j();
105
- if (E(i))
106
- return L(i);
107
- o = setTimeout(h, W(i));
108
- }
109
- function L(i) {
110
- return o = void 0, y && s ? T(i) : (s = t = void 0, l);
111
- }
112
- function B() {
113
- o !== void 0 && clearTimeout(o), c = 0, s = a = t = o = void 0;
114
- }
115
- function C() {
116
- return o === void 0 ? l : L(j());
117
- }
118
- function w() {
119
- var i = j(), u = E(i);
120
- if (s = arguments, t = this, a = i, u) {
121
- if (o === void 0)
122
- return M(a);
123
- if (m)
124
- return clearTimeout(o), o = setTimeout(h, r), T(a);
125
- }
126
- return o === void 0 && (o = setTimeout(h, r)), l;
127
- }
128
- return w.cancel = B, w.flush = C, w;
129
- }
130
- const me = () => {
131
- const [e, r] = S(0), [n, s] = S(0), t = de((f) => {
132
- s(f), r(f);
133
- }, 250);
134
- return g(() => {
135
- const f = () => {
136
- const l = window.scrollY, o = document.documentElement.scrollHeight, a = window.innerHeight, c = Math.round(
137
- l / (o - a) * 100
138
- );
139
- c % 10 === 0 && c > n && t(c);
140
- };
141
- return window.addEventListener("scroll", f), () => window.removeEventListener("scroll", f);
142
- }, [n]), e;
143
- }, je = ({
144
- id: e,
145
- workspace_id: r,
146
- baseUrl: n = "/.levo/insights/api",
147
- properties: s = {}
148
- }) => {
149
- const { audience: t } = x(), [f, l] = S(), o = me(), a = typeof window < "u" ? window.location.href : void 0;
150
- g(() => {
151
- a && l(a);
152
- }, [a]), g(() => {
153
- t != null && t.instance && (t == null || t.track("page.scroll", {
154
- resource: "page",
155
- identifier: e,
156
- percent: o
157
- }));
158
- }, [t == null ? void 0 : t.instance, o]), g(() => {
159
- const d = () => {
160
- t == null || t.track("page.bounce", {
161
- resource: "page",
162
- identifier: e
163
- });
164
- };
165
- return window && window.addEventListener("beforeunload", d), () => {
166
- window && window.removeEventListener("beforeunload", d);
167
- };
168
- }, [a]);
169
- const [c] = F();
170
- return g(() => {
171
- c === I.TERMINATED && (t == null || t.track("page.bounce", {
172
- resource: "page",
173
- identifier: e,
174
- state: c
175
- })), c === I.FROZEN && (t == null || t.track("page.bounce", {
176
- resource: "page",
177
- identifier: e,
178
- state: c
179
- }));
180
- }, [c]), n && f ? /* @__PURE__ */ R.jsx(
181
- "img",
182
- {
183
- alt: "",
184
- src: `${n}/v1/insights/event/hello.gif?url=${f}`,
185
- style: {
186
- height: "0px"
187
- },
188
- onLoad: () => {
189
- t != null && t.instance ? t == null || t.instance.page({
190
- resource: "page",
191
- identifier: s.id
192
- }) : t == null || t.initiate({
193
- baseUrl: n,
194
- workspace_id: r,
195
- properties: { ...s, id: e }
196
- });
197
- }
198
- }
199
- ) : null;
200
- };
201
- export {
202
- Te as L,
203
- we as a,
204
- je as b
205
- };