@levo-so/site-runtime 0.1.113 → 0.2.1
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/CollectionInput-5QMoXahu.js +147 -0
- package/DateTimeWidget-CARoq7bQ.js +254 -0
- package/PhoneWidget-vtDO9CFq.js +99 -0
- package/Popover-B76-bN-a.js +57 -0
- package/RichTextWidget-CafZBEKI.js +912 -0
- package/ThemeProvider-Cm2jJC7a.js +381 -0
- package/Tooltip-Bx-BfR7T.js +78 -0
- package/VerifyButton-D1Mwk04d.js +299 -0
- package/index.d.ts +674 -0
- package/index.js +5752 -0
- package/package.json +63 -31
- package/styles.css +2 -0
- package/README.md +0 -93
- package/dist/LevoSiteProvider.d.ts +0 -25
- package/dist/LevoSiteProvider.js +0 -23
- package/dist/client.d.ts +0 -26
- package/dist/client.js +0 -14
- package/dist/data/index.d.ts +0 -101
- package/dist/data/index.js +0 -79
- package/dist/index.d.ts +0 -26
- package/dist/index.js +0 -6
- package/dist/inspector/dom.d.ts +0 -56
- package/dist/inspector/dom.js +0 -224
- package/dist/inspector/editorChannel.d.ts +0 -7
- package/dist/inspector/editorChannel.js +0 -19
- package/dist/inspector/historyWatcher.d.ts +0 -8
- package/dist/inspector/historyWatcher.js +0 -24
- package/dist/inspector/index.d.ts +0 -2
- package/dist/inspector/index.js +0 -191
- package/dist/inspector/messageRouter.d.ts +0 -38
- package/dist/inspector/messageRouter.js +0 -134
- package/dist/inspector/originalsStash.d.ts +0 -12
- package/dist/inspector/originalsStash.js +0 -24
- package/dist/inspector/protocol.d.ts +0 -180
- package/dist/inspector/stagedOverrides.d.ts +0 -28
- package/dist/inspector/stagedOverrides.js +0 -60
- package/dist/inspector/textEditController.d.ts +0 -24
- package/dist/inspector/textEditController.js +0 -62
- package/dist/pageHead.d.ts +0 -75
- package/dist/pageHead.js +0 -102
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { a as e, t } from "./ThemeProvider-Cm2jJC7a.js";
|
|
3
|
+
import { t as n } from "./CollectionInput-5QMoXahu.js";
|
|
4
|
+
import { createContext as r, useContext as i, useEffect as a, useState as o } from "react";
|
|
5
|
+
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
6
|
+
import { toast as u } from "sonner";
|
|
7
|
+
import { c as d } from "react/compiler-runtime";
|
|
8
|
+
import f from "clsx";
|
|
9
|
+
import { IconCircleCheck as p, IconLoader as m, IconX as h } from "@tabler/icons-react";
|
|
10
|
+
import { Dialog as g } from "@base-ui/react/dialog";
|
|
11
|
+
//#region ../react/dist/providers/LevoProvider.js
|
|
12
|
+
var _ = r({
|
|
13
|
+
client: null,
|
|
14
|
+
insights: null
|
|
15
|
+
}), v = ({ children: e, client: t, insights: n = null }) => /* @__PURE__ */ c(_.Provider, {
|
|
16
|
+
value: {
|
|
17
|
+
client: t,
|
|
18
|
+
insights: n
|
|
19
|
+
},
|
|
20
|
+
children: e
|
|
21
|
+
}), y = () => {
|
|
22
|
+
let e = i(_);
|
|
23
|
+
if (!e.client) throw Error("useLevo must be used within a LevoProvider. Please ensure you have wrapped your component tree with LevoProvider.");
|
|
24
|
+
return e.client;
|
|
25
|
+
}, b = () => i(_).client, x = () => i(_).insights, S = (e, t = "Error", n = {}) => {
|
|
26
|
+
u.error(t, {
|
|
27
|
+
description: e,
|
|
28
|
+
duration: 4e3,
|
|
29
|
+
position: "bottom-right",
|
|
30
|
+
...n
|
|
31
|
+
});
|
|
32
|
+
}, C = (e, t = "Success", n = {}) => {
|
|
33
|
+
n?.id && u.dismiss(n?.id), u.success(t, {
|
|
34
|
+
description: e,
|
|
35
|
+
duration: 4e3,
|
|
36
|
+
position: "bottom-right",
|
|
37
|
+
...n
|
|
38
|
+
});
|
|
39
|
+
}, w = "_1k4xirc1", T = (e) => {
|
|
40
|
+
let t = d(8), n, r;
|
|
41
|
+
t[0] === e ? (n = t[1], r = t[2]) : ({className: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r);
|
|
42
|
+
let i;
|
|
43
|
+
t[3] === n ? i = t[4] : (i = f(w, n), t[3] = n, t[4] = i);
|
|
44
|
+
let a;
|
|
45
|
+
return t[5] !== r || t[6] !== i ? (a = /* @__PURE__ */ c(m, {
|
|
46
|
+
role: "status",
|
|
47
|
+
"aria-label": "Loading",
|
|
48
|
+
className: i,
|
|
49
|
+
...r
|
|
50
|
+
}), t[5] = r, t[6] = i, t[7] = a) : a = t[7], a;
|
|
51
|
+
}, E = "_6o7s4x0", D = "qkytrb0", O = "qkytrb1", k = "qkytrb2", A = "qkytrb3", j = "qkytrb4", M = "qkytrb5", N = "qkytrb6", P = "ch8h0x0", F = "ch8h0x1", I = "ch8h0x2", L = "ch8h0x3", R = "ch8h0x5", z = (e) => {
|
|
52
|
+
let t = d(4), n;
|
|
53
|
+
t[0] === e ? n = t[1] : ({...n} = e, t[0] = e, t[1] = n);
|
|
54
|
+
let r;
|
|
55
|
+
return t[2] === n ? r = t[3] : (r = /* @__PURE__ */ c(g.Root, {
|
|
56
|
+
"data-slot": "dialog",
|
|
57
|
+
...n
|
|
58
|
+
}), t[2] = n, t[3] = r), r;
|
|
59
|
+
}, B = (e) => {
|
|
60
|
+
let n = d(5), r;
|
|
61
|
+
n[0] === e ? r = n[1] : ({...r} = e, n[0] = e, n[1] = r);
|
|
62
|
+
let { portalRef: i } = t(), a;
|
|
63
|
+
return n[2] !== i || n[3] !== r ? (a = /* @__PURE__ */ c(g.Portal, {
|
|
64
|
+
container: i,
|
|
65
|
+
...r
|
|
66
|
+
}), n[2] = i, n[3] = r, n[4] = a) : a = n[4], a;
|
|
67
|
+
}, V = (e) => {
|
|
68
|
+
let t = d(8), n, r;
|
|
69
|
+
t[0] === e ? (n = t[1], r = t[2]) : ({className: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r);
|
|
70
|
+
let i;
|
|
71
|
+
t[3] === n ? i = t[4] : (i = f(F, n), t[3] = n, t[4] = i);
|
|
72
|
+
let a;
|
|
73
|
+
return t[5] !== r || t[6] !== i ? (a = /* @__PURE__ */ c(g.Viewport, {
|
|
74
|
+
"data-slot": "dialog-viewport",
|
|
75
|
+
className: i,
|
|
76
|
+
...r
|
|
77
|
+
}), t[5] = r, t[6] = i, t[7] = a) : a = t[7], a;
|
|
78
|
+
}, H = (e) => {
|
|
79
|
+
let t = d(8), n, r;
|
|
80
|
+
t[0] === e ? (n = t[1], r = t[2]) : ({className: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r);
|
|
81
|
+
let i;
|
|
82
|
+
t[3] === n ? i = t[4] : (i = f(P, n), t[3] = n, t[4] = i);
|
|
83
|
+
let a;
|
|
84
|
+
return t[5] !== r || t[6] !== i ? (a = /* @__PURE__ */ c(g.Backdrop, {
|
|
85
|
+
"data-slot": "dialog-backdrop",
|
|
86
|
+
className: i,
|
|
87
|
+
...r
|
|
88
|
+
}), t[5] = r, t[6] = i, t[7] = a) : a = t[7], a;
|
|
89
|
+
}, U = (t) => {
|
|
90
|
+
let n = d(14), r, i, a, o;
|
|
91
|
+
n[0] === t ? (r = n[1], i = n[2], a = n[3], o = n[4]) : ({className: i, children: r, showCloseButton: o, ...a} = t, n[0] = t, n[1] = r, n[2] = i, n[3] = a, n[4] = o);
|
|
92
|
+
let s = o === void 0 ? !0 : o, u;
|
|
93
|
+
n[5] === i ? u = n[6] : (u = f(I, i), n[5] = i, n[6] = u);
|
|
94
|
+
let p;
|
|
95
|
+
n[7] === s ? p = n[8] : (p = s && /* @__PURE__ */ c(g.Close, {
|
|
96
|
+
"data-slot": "dialog-close",
|
|
97
|
+
render: /* @__PURE__ */ c(e, {
|
|
98
|
+
variant: "ghost",
|
|
99
|
+
size: "icon-sm",
|
|
100
|
+
className: "ch8h0x7",
|
|
101
|
+
"aria-label": "Close"
|
|
102
|
+
}),
|
|
103
|
+
children: /* @__PURE__ */ c(h, { size: 16 })
|
|
104
|
+
}), n[7] = s, n[8] = p);
|
|
105
|
+
let m;
|
|
106
|
+
return n[9] !== r || n[10] !== a || n[11] !== u || n[12] !== p ? (m = /* @__PURE__ */ l(g.Popup, {
|
|
107
|
+
"data-slot": "dialog-popup",
|
|
108
|
+
className: u,
|
|
109
|
+
...a,
|
|
110
|
+
children: [r, p]
|
|
111
|
+
}), n[9] = r, n[10] = a, n[11] = u, n[12] = p, n[13] = m) : m = n[13], m;
|
|
112
|
+
}, W = (e) => {
|
|
113
|
+
let t = d(8), n, r;
|
|
114
|
+
t[0] === e ? (n = t[1], r = t[2]) : ({className: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r);
|
|
115
|
+
let i;
|
|
116
|
+
t[3] === n ? i = t[4] : (i = f(L, n), t[3] = n, t[4] = i);
|
|
117
|
+
let a;
|
|
118
|
+
return t[5] !== r || t[6] !== i ? (a = /* @__PURE__ */ c("div", {
|
|
119
|
+
"data-slot": "dialog-header",
|
|
120
|
+
className: i,
|
|
121
|
+
...r
|
|
122
|
+
}), t[5] = r, t[6] = i, t[7] = a) : a = t[7], a;
|
|
123
|
+
}, G = (e) => {
|
|
124
|
+
let t = d(8), n, r;
|
|
125
|
+
t[0] === e ? (n = t[1], r = t[2]) : ({className: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r);
|
|
126
|
+
let i;
|
|
127
|
+
t[3] === n ? i = t[4] : (i = f(R, n), t[3] = n, t[4] = i);
|
|
128
|
+
let a;
|
|
129
|
+
return t[5] !== r || t[6] !== i ? (a = /* @__PURE__ */ c(g.Title, {
|
|
130
|
+
"data-slot": "dialog-title",
|
|
131
|
+
className: i,
|
|
132
|
+
...r
|
|
133
|
+
}), t[5] = r, t[6] = i, t[7] = a) : a = t[7], a;
|
|
134
|
+
}, K = (e) => {
|
|
135
|
+
let t = d(11), n, r, i, a;
|
|
136
|
+
t[0] === e ? (n = t[1], r = t[2], i = t[3], a = t[4]) : ({className: r, children: n, showCloseButton: a, ...i} = e, t[0] = e, t[1] = n, t[2] = r, t[3] = i, t[4] = a);
|
|
137
|
+
let o = a === void 0 ? !0 : a, s;
|
|
138
|
+
t[5] === Symbol.for("react.memo_cache_sentinel") ? (s = /* @__PURE__ */ c(H, {}), t[5] = s) : s = t[5];
|
|
139
|
+
let u;
|
|
140
|
+
return t[6] !== n || t[7] !== r || t[8] !== i || t[9] !== o ? (u = /* @__PURE__ */ l(B, { children: [s, /* @__PURE__ */ c(V, { children: /* @__PURE__ */ c(U, {
|
|
141
|
+
className: r,
|
|
142
|
+
showCloseButton: o,
|
|
143
|
+
...i,
|
|
144
|
+
children: n
|
|
145
|
+
}) })] }), t[6] = n, t[7] = r, t[8] = i, t[9] = o, t[10] = u) : u = t[10], u;
|
|
146
|
+
}, q = ({ isOpen: t, onClose: r, value: i, type: s = "email", onVerifySuccess: u }) => {
|
|
147
|
+
let { membership: d } = y(), [f, p] = o(""), [m, h] = o(!1), [g, _] = o(!1), [v, b] = o(30);
|
|
148
|
+
return a(() => {
|
|
149
|
+
let e;
|
|
150
|
+
return t && v > 0 && (e = setInterval(() => {
|
|
151
|
+
b((e) => e - 1);
|
|
152
|
+
}, 1e3)), () => clearInterval(e);
|
|
153
|
+
}, [t, v]), a(() => {
|
|
154
|
+
t && (p(""), b(30), h(!1), _(!1));
|
|
155
|
+
}, [t]), /* @__PURE__ */ c(z, {
|
|
156
|
+
open: t,
|
|
157
|
+
onOpenChange: (e) => {
|
|
158
|
+
e || r();
|
|
159
|
+
},
|
|
160
|
+
children: /* @__PURE__ */ l(K, {
|
|
161
|
+
className: E,
|
|
162
|
+
children: [/* @__PURE__ */ c(W, { children: /* @__PURE__ */ c(G, { children: `Verify ${s === "email" ? "Email" : "Phone"}` }) }), /* @__PURE__ */ l("div", {
|
|
163
|
+
className: D,
|
|
164
|
+
children: [
|
|
165
|
+
/* @__PURE__ */ l("div", {
|
|
166
|
+
className: O,
|
|
167
|
+
children: [
|
|
168
|
+
"Enter the 4-digit code sent to ",
|
|
169
|
+
/* @__PURE__ */ c("strong", { children: i }),
|
|
170
|
+
".",
|
|
171
|
+
" ",
|
|
172
|
+
/* @__PURE__ */ c("button", {
|
|
173
|
+
onClick: () => r(),
|
|
174
|
+
className: k,
|
|
175
|
+
children: "Change?"
|
|
176
|
+
})
|
|
177
|
+
]
|
|
178
|
+
}),
|
|
179
|
+
/* @__PURE__ */ c("div", {
|
|
180
|
+
className: A,
|
|
181
|
+
children: /* @__PURE__ */ c(n, {
|
|
182
|
+
value: f,
|
|
183
|
+
onChange: (e) => {
|
|
184
|
+
p(e.target.value.replace(/\D/g, "").slice(0, 4));
|
|
185
|
+
},
|
|
186
|
+
placeholder: "0000",
|
|
187
|
+
maxLength: 4,
|
|
188
|
+
className: M
|
|
189
|
+
})
|
|
190
|
+
}),
|
|
191
|
+
/* @__PURE__ */ l("div", {
|
|
192
|
+
className: j,
|
|
193
|
+
children: [/* @__PURE__ */ c(e, {
|
|
194
|
+
onClick: async () => {
|
|
195
|
+
if (!(!f || f.length !== 4)) {
|
|
196
|
+
h(!0);
|
|
197
|
+
try {
|
|
198
|
+
await d?.signInWithOtp({
|
|
199
|
+
content: i,
|
|
200
|
+
code: f
|
|
201
|
+
}), C("Verification successful"), u(i), r();
|
|
202
|
+
} catch (e) {
|
|
203
|
+
let t = e;
|
|
204
|
+
S(t?.message || "Invalid OTP", t?.title || "Verification Failed");
|
|
205
|
+
} finally {
|
|
206
|
+
h(!1);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
disabled: f.length !== 4 || m,
|
|
211
|
+
className: "w-full",
|
|
212
|
+
children: m ? "Verifying..." : "Verify"
|
|
213
|
+
}), /* @__PURE__ */ c("div", {
|
|
214
|
+
className: N,
|
|
215
|
+
children: v > 0 ? /* @__PURE__ */ l("span", { children: [
|
|
216
|
+
"Resend code in ",
|
|
217
|
+
v,
|
|
218
|
+
"s"
|
|
219
|
+
] }) : /* @__PURE__ */ c("button", {
|
|
220
|
+
onClick: async () => {
|
|
221
|
+
if (!(v > 0)) {
|
|
222
|
+
_(!0);
|
|
223
|
+
try {
|
|
224
|
+
await d?.requestOtp({
|
|
225
|
+
content: i,
|
|
226
|
+
medium: s === "phone" ? "whatsapp" : "email"
|
|
227
|
+
}), C("OTP resent successfully"), b(30);
|
|
228
|
+
} catch (e) {
|
|
229
|
+
let t = e;
|
|
230
|
+
S(t?.message || "Failed to resend OTP", t?.title || "Error");
|
|
231
|
+
} finally {
|
|
232
|
+
_(!1);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
disabled: g,
|
|
237
|
+
className: k,
|
|
238
|
+
children: g ? "Resending..." : "Resend Code"
|
|
239
|
+
})
|
|
240
|
+
})]
|
|
241
|
+
})
|
|
242
|
+
]
|
|
243
|
+
})]
|
|
244
|
+
})
|
|
245
|
+
});
|
|
246
|
+
}, J = "jfrbe10", Y = "jfrbe11", X = "jfrbe12", Z = ({ value: t, type: n, isVerified: r, onVerifySuccess: i, onStateChange: a }) => {
|
|
247
|
+
let { membership: u } = y(), [d, f] = o(!1), [m, h] = o(!1), g = (e) => {
|
|
248
|
+
a && a(e);
|
|
249
|
+
}, _ = async () => {
|
|
250
|
+
let e = t?.trim()?.toLowerCase();
|
|
251
|
+
if (!e) {
|
|
252
|
+
S(`Please enter a ${n}`);
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
if (n === "email" && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)) {
|
|
256
|
+
S("Please enter a valid email address");
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
h(!0), g(!0);
|
|
260
|
+
try {
|
|
261
|
+
await u?.requestOtp({
|
|
262
|
+
content: e,
|
|
263
|
+
medium: n === "phone" ? "whatsapp" : "email"
|
|
264
|
+
}), f(!0);
|
|
265
|
+
} catch (e) {
|
|
266
|
+
let t = e;
|
|
267
|
+
S(t?.message || "Failed to send OTP", t?.title || "Error"), g(!1);
|
|
268
|
+
} finally {
|
|
269
|
+
h(!1);
|
|
270
|
+
}
|
|
271
|
+
}, v = () => {
|
|
272
|
+
f(!1), g(!1);
|
|
273
|
+
};
|
|
274
|
+
return r ? /* @__PURE__ */ l("div", {
|
|
275
|
+
className: J,
|
|
276
|
+
children: [/* @__PURE__ */ c(p, { className: X }), /* @__PURE__ */ c("span", {
|
|
277
|
+
className: Y,
|
|
278
|
+
children: "Verified"
|
|
279
|
+
})]
|
|
280
|
+
}) : /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c(e, {
|
|
281
|
+
size: "default",
|
|
282
|
+
variant: "ghost",
|
|
283
|
+
onClick: _,
|
|
284
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
285
|
+
disabled: !t || m,
|
|
286
|
+
type: "button",
|
|
287
|
+
children: m ? /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c(T, { size: 14 }), "Sending..."] }) : "Verify"
|
|
288
|
+
}), d && /* @__PURE__ */ c(q, {
|
|
289
|
+
isOpen: d,
|
|
290
|
+
onClose: v,
|
|
291
|
+
value: t?.trim()?.toLowerCase() || "",
|
|
292
|
+
type: n,
|
|
293
|
+
onVerifySuccess: (e) => {
|
|
294
|
+
i(e), v();
|
|
295
|
+
}
|
|
296
|
+
})] });
|
|
297
|
+
};
|
|
298
|
+
//#endregion
|
|
299
|
+
export { z as a, C as c, v as d, b as f, G as i, S as l, W as n, E as o, x as p, K as r, T as s, Z as t, y as u };
|