@levo-so/site-runtime 0.3.1 → 0.3.8
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/CollectionField-C-6a1ud4.js +270 -0
- package/{CollectionInput-B1qV4QEH.js → CollectionInput-BJ__qcbk.js} +40 -40
- package/DateTimeWidget-hFjcn3o6.js +255 -0
- package/Dialog-dT7y641z.js +130 -0
- package/KBChatWidget-ClHFDgJ5.js +1026 -0
- package/LevoProvider-Bsjkcwc8.js +20 -0
- package/PhoneWidget-BmBO-kvA.js +99 -0
- package/{Popover-q5dL7y0W.js → Popover-3N88sRp4.js} +20 -20
- package/{PopupRenderer-Bncp54gB-DuCULkBK.js → PopupBody-DZVwDLkg-Cfy3lWGs.js} +201 -910
- package/PopupRenderer-BjW1jg70-W2y-PEPH.js +387 -0
- package/{RichTextWidget-D-mGlES0.js → RichTextWidget-DkKHEq4j.js} +142 -141
- package/ThemeProvider-DutrjSTF.js +116 -0
- package/{Tooltip-BIgrpetu.js → Tooltip-CQB0LyxK.js} +20 -20
- package/VerifyButton-BUT70lgz.js +192 -0
- package/{theme.cssm-2YTdd8Yh.js → createThemeExtension-4AUn51iJ.js} +2 -2
- package/dist-CRDgdAkQ.js +3631 -0
- package/dist-DPmVG7VB.js +79 -0
- package/index.d.ts +575 -3
- package/index.js +1217 -722
- package/inlineBaseTheme-BB9e6h5f.js +9 -0
- package/inlineCollectionTheme-CWcMCUti.js +19 -0
- package/{kbChat-AUJxjURc.js → kbChat-C00LVlxP.js} +53 -48
- package/{nodeAlignment-Cn6xNtOP.js → nodeAlignment-BnJljFlw.js} +13 -13
- package/package.json +9 -9
- package/pillChrome-BAu5AfCT.js +30 -0
- package/popupState-JmpeKzgM-qhNTV79U.js +229 -0
- package/popups.js +1 -1
- package/react-CV3jf2mc.js +74 -0
- package/rteTheme.cssm-xg0gJ28J.js +4 -0
- package/styles.css +1 -1
- package/theme.cssm-DUzmx76l.js +4 -0
- package/{inlineCollectionTheme-D2w17LHX.js → themeVars.cssm-ByhhC2Jm.js} +18 -33
- package/usePopupRedirect-BThP_YPW-COUseDik.js +80 -0
- package/CollectionField-CzS-34zx.js +0 -270
- package/DateTimeWidget-C1jHOtz7.js +0 -255
- package/Dialog-CzVhHLEY.js +0 -145
- package/KBChatWidget-D7F9LRwI.js +0 -1078
- package/PhoneWidget-_nw97rkI.js +0 -99
- package/ThemeProvider-BQmIB5tr.js +0 -116
- package/VerifyButton-BkP98H17.js +0 -191
- package/dist-CJknSbJK.js +0 -80
- package/dist-DBbiX2ST.js +0 -3556
- package/inlineBaseTheme-DS-AfUHi.js +0 -9
- package/pillChrome-AhXOWXIb.js +0 -20
- /package/{es-iCqKQf1c.js → es-CztjLuNy.js} +0 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { c as e } from "react/compiler-runtime";
|
|
2
|
+
import t from "clsx";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
import { createRuntimeFn as r } from "@vanilla-extract/recipes/createRuntimeFn";
|
|
5
|
+
import { createContext as i, useContext as a, useEffect as o, useMemo as s, useRef as c } from "react";
|
|
6
|
+
//#region ../../libraries/levocn/dist/ui/button/Button.cssm.js
|
|
7
|
+
var l = r({
|
|
8
|
+
defaultClassName: "_1a7d0ek1 _1a7d0ek0",
|
|
9
|
+
variantClassNames: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: "_1a7d0ek2",
|
|
12
|
+
outline: "_1a7d0ek3",
|
|
13
|
+
secondary: "_1a7d0ek4",
|
|
14
|
+
ghost: "_1a7d0ek5",
|
|
15
|
+
destructive: "_1a7d0ek6",
|
|
16
|
+
link: "_1a7d0ek7"
|
|
17
|
+
},
|
|
18
|
+
size: {
|
|
19
|
+
default: "_1a7d0ek8",
|
|
20
|
+
xs: "_1a7d0ek9",
|
|
21
|
+
sm: "_1a7d0eka",
|
|
22
|
+
lg: "_1a7d0ekb",
|
|
23
|
+
icon: "_1a7d0ekc",
|
|
24
|
+
"icon-xs": "_1a7d0ekd",
|
|
25
|
+
"icon-sm": "_1a7d0eke",
|
|
26
|
+
"icon-lg": "_1a7d0ekf"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
defaultVariants: {
|
|
30
|
+
variant: "default",
|
|
31
|
+
size: "default"
|
|
32
|
+
},
|
|
33
|
+
compoundVariants: []
|
|
34
|
+
}), u = (r) => {
|
|
35
|
+
let i = e(14), a, o, s, c, u;
|
|
36
|
+
i[0] === r ? (a = i[1], o = i[2], s = i[3], c = i[4], u = i[5]) : ({className: a, variant: u, size: s, type: c, ...o} = r, i[0] = r, i[1] = a, i[2] = o, i[3] = s, i[4] = c, i[5] = u);
|
|
37
|
+
let d = c === void 0 ? "button" : c, f;
|
|
38
|
+
i[6] !== a || i[7] !== s || i[8] !== u ? (f = t(l({
|
|
39
|
+
variant: u,
|
|
40
|
+
size: s
|
|
41
|
+
}), a), i[6] = a, i[7] = s, i[8] = u, i[9] = f) : f = i[9];
|
|
42
|
+
let p;
|
|
43
|
+
return i[10] !== o || i[11] !== f || i[12] !== d ? (p = /* @__PURE__ */ n("button", {
|
|
44
|
+
"data-slot": "button",
|
|
45
|
+
type: d,
|
|
46
|
+
className: f,
|
|
47
|
+
...o
|
|
48
|
+
}), i[10] = o, i[11] = f, i[12] = d, i[13] = p) : p = i[13], p;
|
|
49
|
+
}, d = "_1er5g5a0", f = /* @__PURE__ */ new Set(), p = {}, m = i(null), h = () => {
|
|
50
|
+
let t = e(1), n = a(m);
|
|
51
|
+
if (!n) {
|
|
52
|
+
let e;
|
|
53
|
+
return t[0] === Symbol.for("react.memo_cache_sentinel") ? (e = {
|
|
54
|
+
portalRef: { current: null },
|
|
55
|
+
classes: f,
|
|
56
|
+
overrides: p
|
|
57
|
+
}, t[0] = e) : e = t[0], e;
|
|
58
|
+
}
|
|
59
|
+
return n;
|
|
60
|
+
}, g = ({ children: e, cssReset: r, className: i, style: l, portalToThemeRoot: u, ...h }) => {
|
|
61
|
+
let g = a(m), _ = c(null), v = !g && r !== !1 ? d : "", y = g?.classes ?? f, b = g?.overrides ?? p, x = s(() => {
|
|
62
|
+
let e = i ? i.split(/\s+/).filter(Boolean) : [], t = new Set(y);
|
|
63
|
+
for (let n of e) t.add(n);
|
|
64
|
+
return {
|
|
65
|
+
portalRef: _,
|
|
66
|
+
classes: t,
|
|
67
|
+
overrides: {
|
|
68
|
+
...b,
|
|
69
|
+
...l
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}, [
|
|
73
|
+
y,
|
|
74
|
+
i,
|
|
75
|
+
b,
|
|
76
|
+
l
|
|
77
|
+
]);
|
|
78
|
+
o(() => {
|
|
79
|
+
if (u) return;
|
|
80
|
+
let e = document.createElement("div");
|
|
81
|
+
return document.body.appendChild(e), _.current = e, () => {
|
|
82
|
+
document.body.removeChild(e), _.current = null;
|
|
83
|
+
};
|
|
84
|
+
}, [u]), o(() => {
|
|
85
|
+
if (u) return;
|
|
86
|
+
let e = _.current;
|
|
87
|
+
if (!e) return;
|
|
88
|
+
e.className = t(v, ...x.classes), e.style.cssText = "";
|
|
89
|
+
let n = {
|
|
90
|
+
display: "contents",
|
|
91
|
+
...x.overrides
|
|
92
|
+
};
|
|
93
|
+
for (let [t, r] of Object.entries(n)) r != null && e.style.setProperty(t, String(r));
|
|
94
|
+
}, [
|
|
95
|
+
x.classes,
|
|
96
|
+
x.overrides,
|
|
97
|
+
v,
|
|
98
|
+
u
|
|
99
|
+
]);
|
|
100
|
+
let S = t(v, ...i ? i.split(/\s+/).filter((e) => e && !y.has(e)) : []);
|
|
101
|
+
return /* @__PURE__ */ n(m.Provider, {
|
|
102
|
+
value: x,
|
|
103
|
+
children: /* @__PURE__ */ n("div", {
|
|
104
|
+
...u ? { ref: _ } : {},
|
|
105
|
+
...S ? { className: S } : {},
|
|
106
|
+
style: {
|
|
107
|
+
display: "contents",
|
|
108
|
+
...l
|
|
109
|
+
},
|
|
110
|
+
...h,
|
|
111
|
+
children: e
|
|
112
|
+
})
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
//#endregion
|
|
116
|
+
export { l as i, g as n, u as r, h as t };
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { i as e, t } from "./ThemeProvider-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import a from "
|
|
1
|
+
import { i as e, t } from "./ThemeProvider-DutrjSTF.js";
|
|
2
|
+
import { c as n } from "react/compiler-runtime";
|
|
3
|
+
import r from "clsx";
|
|
4
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
5
|
import { Tooltip as o } from "@base-ui/react/tooltip";
|
|
6
6
|
//#region ../../libraries/levocn/dist/ui/tooltip/Tooltip.cssm.js
|
|
7
7
|
var s = "_3zwjqd0", c = "_3zwjqd1", l = "_3zwjqd2", u = (e) => {
|
|
8
|
-
let t =
|
|
8
|
+
let t = n(6), r, a;
|
|
9
9
|
t[0] === e ? (r = t[1], a = t[2]) : ({delay: a, ...r} = e, t[0] = e, t[1] = r, t[2] = a);
|
|
10
10
|
let s = a === void 0 ? 0 : a, c;
|
|
11
|
-
return t[3] !== s || t[4] !== r ? (c = /* @__PURE__ */
|
|
11
|
+
return t[3] !== s || t[4] !== r ? (c = /* @__PURE__ */ i(o.Provider, {
|
|
12
12
|
"data-slot": "tooltip-provider",
|
|
13
13
|
delay: s,
|
|
14
14
|
...r
|
|
15
15
|
}), t[3] = s, t[4] = r, t[5] = c) : c = t[5], c;
|
|
16
16
|
}, d = (e) => {
|
|
17
|
-
let t =
|
|
17
|
+
let t = n(4), r;
|
|
18
18
|
t[0] === e ? r = t[1] : ({...r} = e, t[0] = e, t[1] = r);
|
|
19
19
|
let a;
|
|
20
|
-
return t[2] === r ? a = t[3] : (a = /* @__PURE__ */
|
|
20
|
+
return t[2] === r ? a = t[3] : (a = /* @__PURE__ */ i(o.Root, {
|
|
21
21
|
"data-slot": "tooltip",
|
|
22
22
|
...r
|
|
23
23
|
}), t[2] = r, t[3] = a), a;
|
|
24
24
|
}, f = (t) => {
|
|
25
|
-
let
|
|
26
|
-
|
|
25
|
+
let a = n(12), s, c, l, u;
|
|
26
|
+
a[0] === t ? (s = a[1], c = a[2], l = a[3], u = a[4]) : ({className: s, variant: u, size: l, ...c} = t, a[0] = t, a[1] = s, a[2] = c, a[3] = l, a[4] = u);
|
|
27
27
|
let d;
|
|
28
|
-
|
|
28
|
+
a[5] !== s || a[6] !== l || a[7] !== u ? (d = r(e({
|
|
29
29
|
variant: u,
|
|
30
30
|
size: l
|
|
31
|
-
}), s),
|
|
31
|
+
}), s), a[5] = s, a[6] = l, a[7] = u, a[8] = d) : d = a[8];
|
|
32
32
|
let f;
|
|
33
|
-
return
|
|
33
|
+
return a[9] !== c || a[10] !== d ? (f = /* @__PURE__ */ i(o.Trigger, {
|
|
34
34
|
className: d,
|
|
35
35
|
...c
|
|
36
|
-
}),
|
|
36
|
+
}), a[9] = c, a[10] = d, a[11] = f) : f = a[11], f;
|
|
37
37
|
}, p = (e) => {
|
|
38
|
-
let u =
|
|
38
|
+
let u = n(24), d, f, p, m, h, g, _;
|
|
39
39
|
u[0] === e ? (d = u[1], f = u[2], p = u[3], m = u[4], h = u[5], g = u[6], _ = u[7]) : ({className: f, side: m, sideOffset: h, align: g, alignOffset: _, children: d, ...p} = e, u[0] = e, u[1] = d, u[2] = f, u[3] = p, u[4] = m, u[5] = h, u[6] = g, u[7] = _);
|
|
40
40
|
let v = m === void 0 ? "top" : m, y = h === void 0 ? 8 : h, b = g === void 0 ? "center" : g, x = _ === void 0 ? 0 : _, { portalRef: S } = t(), C;
|
|
41
|
-
u[8] === f ? C = u[9] : (C =
|
|
41
|
+
u[8] === f ? C = u[9] : (C = r(s, f), u[8] = f, u[9] = C);
|
|
42
42
|
let w;
|
|
43
|
-
u[10] === Symbol.for("react.memo_cache_sentinel") ? (w = /* @__PURE__ */
|
|
43
|
+
u[10] === Symbol.for("react.memo_cache_sentinel") ? (w = /* @__PURE__ */ i(o.Arrow, { className: c }), u[10] = w) : w = u[10];
|
|
44
44
|
let T;
|
|
45
|
-
u[11] !== d || u[12] !== p || u[13] !== C ? (T = /* @__PURE__ */
|
|
45
|
+
u[11] !== d || u[12] !== p || u[13] !== C ? (T = /* @__PURE__ */ a(o.Popup, {
|
|
46
46
|
"data-slot": "tooltip-content",
|
|
47
47
|
className: C,
|
|
48
48
|
...p,
|
|
49
49
|
children: [d, w]
|
|
50
50
|
}), u[11] = d, u[12] = p, u[13] = C, u[14] = T) : T = u[14];
|
|
51
51
|
let E;
|
|
52
|
-
u[15] !== b || u[16] !== x || u[17] !== v || u[18] !== y || u[19] !== T ? (E = /* @__PURE__ */
|
|
52
|
+
u[15] !== b || u[16] !== x || u[17] !== v || u[18] !== y || u[19] !== T ? (E = /* @__PURE__ */ i(o.Positioner, {
|
|
53
53
|
align: b,
|
|
54
54
|
alignOffset: x,
|
|
55
55
|
side: v,
|
|
@@ -58,7 +58,7 @@ var s = "_3zwjqd0", c = "_3zwjqd1", l = "_3zwjqd2", u = (e) => {
|
|
|
58
58
|
children: T
|
|
59
59
|
}), u[15] = b, u[16] = x, u[17] = v, u[18] = y, u[19] = T, u[20] = E) : E = u[20];
|
|
60
60
|
let D;
|
|
61
|
-
return u[21] !== S || u[22] !== E ? (D = /* @__PURE__ */
|
|
61
|
+
return u[21] !== S || u[22] !== E ? (D = /* @__PURE__ */ i(o.Portal, {
|
|
62
62
|
container: S,
|
|
63
63
|
children: E
|
|
64
64
|
}), u[21] = S, u[22] = E, u[23] = D) : D = u[23], D;
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { r as e } from "./ThemeProvider-DutrjSTF.js";
|
|
3
|
+
import { t } from "./LevoProvider-Bsjkcwc8.js";
|
|
4
|
+
import { t as n } from "./CollectionInput-BJ__qcbk.js";
|
|
5
|
+
import { i as r, n as i, o as a, t as o } from "./Dialog-dT7y641z.js";
|
|
6
|
+
import { c as s } from "react/compiler-runtime";
|
|
7
|
+
import c from "clsx";
|
|
8
|
+
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
9
|
+
import { useEffect as f, useState as p } from "react";
|
|
10
|
+
import { IconCircleCheck as m, IconLoader as h } from "@tabler/icons-react";
|
|
11
|
+
import { toast as g } from "sonner";
|
|
12
|
+
//#region ../../libraries/levocn/dist/ui/spinner/Spinner.cssm.js
|
|
13
|
+
var _ = "_1k4xirc1", v = (e) => {
|
|
14
|
+
let t = s(8), n, r;
|
|
15
|
+
t[0] === e ? (n = t[1], r = t[2]) : ({className: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r);
|
|
16
|
+
let i;
|
|
17
|
+
t[3] === n ? i = t[4] : (i = c(_, n), t[3] = n, t[4] = i);
|
|
18
|
+
let a;
|
|
19
|
+
return t[5] !== r || t[6] !== i ? (a = /* @__PURE__ */ u(h, {
|
|
20
|
+
role: "status",
|
|
21
|
+
"aria-label": "Loading",
|
|
22
|
+
className: i,
|
|
23
|
+
...r
|
|
24
|
+
}), t[5] = r, t[6] = i, t[7] = a) : a = t[7], a;
|
|
25
|
+
}, y = (e, t = "Error", n = {}) => {
|
|
26
|
+
g.error(t, {
|
|
27
|
+
description: e,
|
|
28
|
+
duration: 4e3,
|
|
29
|
+
position: "bottom-right",
|
|
30
|
+
...n
|
|
31
|
+
});
|
|
32
|
+
}, b = (e, t = "Success", n = {}) => {
|
|
33
|
+
n?.id && g.dismiss(n?.id), g.success(t, {
|
|
34
|
+
description: e,
|
|
35
|
+
duration: 4e3,
|
|
36
|
+
position: "bottom-right",
|
|
37
|
+
...n
|
|
38
|
+
});
|
|
39
|
+
}, x = "_6o7s4x0", S = "qkytrb0", C = "qkytrb1", w = "qkytrb2", T = "qkytrb3", E = "qkytrb4", D = "qkytrb5", O = "qkytrb6", k = ({ isOpen: s, onClose: c, value: l, type: m = "email", onVerifySuccess: h }) => {
|
|
40
|
+
let { membership: g } = t(), [_, v] = p(""), [k, A] = p(!1), [j, M] = p(!1), [N, P] = p(30);
|
|
41
|
+
return f(() => {
|
|
42
|
+
let e;
|
|
43
|
+
return s && N > 0 && (e = setInterval(() => {
|
|
44
|
+
P((e) => e - 1);
|
|
45
|
+
}, 1e3)), () => clearInterval(e);
|
|
46
|
+
}, [s, N]), f(() => {
|
|
47
|
+
s && (v(""), P(30), A(!1), M(!1));
|
|
48
|
+
}, [s]), /* @__PURE__ */ u(a, {
|
|
49
|
+
open: s,
|
|
50
|
+
onOpenChange: (e) => {
|
|
51
|
+
e || c();
|
|
52
|
+
},
|
|
53
|
+
children: /* @__PURE__ */ d(i, {
|
|
54
|
+
className: x,
|
|
55
|
+
children: [/* @__PURE__ */ u(o, { children: /* @__PURE__ */ u(r, { children: `Verify ${m === "email" ? "Email" : "Phone"}` }) }), /* @__PURE__ */ d("div", {
|
|
56
|
+
className: S,
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ d("div", {
|
|
59
|
+
className: C,
|
|
60
|
+
children: [
|
|
61
|
+
"Enter the 4-digit code sent to ",
|
|
62
|
+
/* @__PURE__ */ u("strong", { children: l }),
|
|
63
|
+
".",
|
|
64
|
+
" ",
|
|
65
|
+
/* @__PURE__ */ u("button", {
|
|
66
|
+
onClick: () => c(),
|
|
67
|
+
className: w,
|
|
68
|
+
children: "Change?"
|
|
69
|
+
})
|
|
70
|
+
]
|
|
71
|
+
}),
|
|
72
|
+
/* @__PURE__ */ u("div", {
|
|
73
|
+
className: T,
|
|
74
|
+
children: /* @__PURE__ */ u(n, {
|
|
75
|
+
value: _,
|
|
76
|
+
onChange: (e) => {
|
|
77
|
+
v(e.target.value.replace(/\D/g, "").slice(0, 4));
|
|
78
|
+
},
|
|
79
|
+
placeholder: "0000",
|
|
80
|
+
maxLength: 4,
|
|
81
|
+
className: D
|
|
82
|
+
})
|
|
83
|
+
}),
|
|
84
|
+
/* @__PURE__ */ d("div", {
|
|
85
|
+
className: E,
|
|
86
|
+
children: [/* @__PURE__ */ u(e, {
|
|
87
|
+
onClick: async () => {
|
|
88
|
+
if (!(!_ || _.length !== 4)) {
|
|
89
|
+
A(!0);
|
|
90
|
+
try {
|
|
91
|
+
await g?.signInWithOtp({
|
|
92
|
+
content: l,
|
|
93
|
+
code: _
|
|
94
|
+
}), b("Verification successful"), h(l), c();
|
|
95
|
+
} catch (e) {
|
|
96
|
+
let t = e;
|
|
97
|
+
y(t?.message || "Invalid OTP", t?.title || "Verification Failed");
|
|
98
|
+
} finally {
|
|
99
|
+
A(!1);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
disabled: _.length !== 4 || k,
|
|
104
|
+
className: "w-full",
|
|
105
|
+
children: k ? "Verifying..." : "Verify"
|
|
106
|
+
}), /* @__PURE__ */ u("div", {
|
|
107
|
+
className: O,
|
|
108
|
+
children: N > 0 ? /* @__PURE__ */ d("span", { children: [
|
|
109
|
+
"Resend code in ",
|
|
110
|
+
N,
|
|
111
|
+
"s"
|
|
112
|
+
] }) : /* @__PURE__ */ u("button", {
|
|
113
|
+
onClick: async () => {
|
|
114
|
+
if (!(N > 0)) {
|
|
115
|
+
M(!0);
|
|
116
|
+
try {
|
|
117
|
+
await g?.requestOtp({
|
|
118
|
+
content: l,
|
|
119
|
+
medium: m === "phone" ? "whatsapp" : "email"
|
|
120
|
+
}), b("OTP resent successfully"), P(30);
|
|
121
|
+
} catch (e) {
|
|
122
|
+
let t = e;
|
|
123
|
+
y(t?.message || "Failed to resend OTP", t?.title || "Error");
|
|
124
|
+
} finally {
|
|
125
|
+
M(!1);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
disabled: j,
|
|
130
|
+
className: w,
|
|
131
|
+
children: j ? "Resending..." : "Resend Code"
|
|
132
|
+
})
|
|
133
|
+
})]
|
|
134
|
+
})
|
|
135
|
+
]
|
|
136
|
+
})]
|
|
137
|
+
})
|
|
138
|
+
});
|
|
139
|
+
}, A = "jfrbe10", j = "jfrbe11", M = "jfrbe12", N = ({ value: n, type: r, isVerified: i, onVerifySuccess: a, onStateChange: o }) => {
|
|
140
|
+
let { membership: s } = t(), [c, f] = p(!1), [h, g] = p(!1), _ = (e) => {
|
|
141
|
+
o && o(e);
|
|
142
|
+
}, b = async () => {
|
|
143
|
+
let e = n?.trim()?.toLowerCase();
|
|
144
|
+
if (!e) {
|
|
145
|
+
y(`Please enter a ${r}`);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (r === "email" && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)) {
|
|
149
|
+
y("Please enter a valid email address");
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
g(!0), _(!0);
|
|
153
|
+
try {
|
|
154
|
+
await s?.requestOtp({
|
|
155
|
+
content: e,
|
|
156
|
+
medium: r === "phone" ? "whatsapp" : "email"
|
|
157
|
+
}), f(!0);
|
|
158
|
+
} catch (e) {
|
|
159
|
+
let t = e;
|
|
160
|
+
y(t?.message || "Failed to send OTP", t?.title || "Error"), _(!1);
|
|
161
|
+
} finally {
|
|
162
|
+
g(!1);
|
|
163
|
+
}
|
|
164
|
+
}, x = () => {
|
|
165
|
+
f(!1), _(!1);
|
|
166
|
+
};
|
|
167
|
+
return i ? /* @__PURE__ */ d("div", {
|
|
168
|
+
className: A,
|
|
169
|
+
children: [/* @__PURE__ */ u(m, { className: M }), /* @__PURE__ */ u("span", {
|
|
170
|
+
className: j,
|
|
171
|
+
children: "Verified"
|
|
172
|
+
})]
|
|
173
|
+
}) : /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u(e, {
|
|
174
|
+
size: "default",
|
|
175
|
+
variant: "ghost",
|
|
176
|
+
onClick: b,
|
|
177
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
178
|
+
disabled: !n || h,
|
|
179
|
+
type: "button",
|
|
180
|
+
children: h ? /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u(v, { size: 14 }), "Sending..."] }) : "Verify"
|
|
181
|
+
}), c && /* @__PURE__ */ u(k, {
|
|
182
|
+
isOpen: c,
|
|
183
|
+
onClose: x,
|
|
184
|
+
value: n?.trim()?.toLowerCase() || "",
|
|
185
|
+
type: r,
|
|
186
|
+
onVerifySuccess: (e) => {
|
|
187
|
+
a(e), x();
|
|
188
|
+
}
|
|
189
|
+
})] });
|
|
190
|
+
};
|
|
191
|
+
//#endregion
|
|
192
|
+
export { v as a, y as i, x as n, b as r, N as t };
|