@levo-so/site-runtime 0.3.19 → 0.3.21

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 (55) hide show
  1. package/BillingStep-ByiYjJ0S.js +251 -0
  2. package/BookingCard-DdwLHVGw.js +816 -0
  3. package/CollectionLabel-CmUFfc_7.js +35 -0
  4. package/DateTimeWidget-Bk2tk_CT.js +254 -0
  5. package/{KBChatWidget-GRi6sLpp.js → KBChatWidget-BXRRgelS.js} +223 -223
  6. package/PhoneWidget-FWE3jD_L.js +97 -0
  7. package/{Popover-C29yJ7rz.js → Popover-MSrVDAzg.js} +7 -7
  8. package/PopupBody-DWM55Zh5-B3ysApDM.js +158 -0
  9. package/PopupDialog-DwAAJ8JS-DkxjZaJL.js +260 -0
  10. package/PopupRenderer-BVtV4b9I-Dot4Syse.js +207 -0
  11. package/{RichTextWidget-DfakML79.js → RichTextWidget-KnIKESAD.js} +189 -190
  12. package/{RteThemeProvider-BQmfSXSl.js → RteThemeProvider-DtTXGcCT.js} +2 -3
  13. package/Sonner-BsE4Y_t4.js +21 -0
  14. package/blog-content.js +71 -72
  15. package/dist-BVFCdirT.js +4471 -0
  16. package/dist-DEXGyFeH.js +376 -0
  17. package/index.d.ts +21 -11
  18. package/index.js +1702 -1390
  19. package/{themeVars.cssm-ByhhC2Jm.js → inlineBaseTheme-DcNdMEYp.js} +35 -5
  20. package/{inlineCollectionTheme-CWcMCUti.js → inlineCollectionTheme-DjXuH3bK.js} +1 -1
  21. package/{inlineRteTheme-CRPtkNXy.js → inlineRteTheme-BYGIJM7P.js} +1 -1
  22. package/{kbChat-a2dXSeRc.js → kbChat-eFsau7hG.js} +27 -27
  23. package/package.json +23 -23
  24. package/{pillChrome-CEpWGNZB.js → pillChrome-Dy3ApFI5.js} +5 -5
  25. package/popups.js +1 -1
  26. package/{react-Cj_U6VZQ.js → react-CENbCy5d.js} +6 -5
  27. package/script.esm-D4nvz3-k.js +62 -0
  28. package/script.esm-uVCZU25S.js +62 -0
  29. package/start.js +1 -1
  30. package/styles.css +1 -1
  31. package/theme.cssm-iXnQwMCp.js +238 -0
  32. package/CollectionField-C-6a1ud4.js +0 -270
  33. package/CollectionInput-BJ__qcbk.js +0 -147
  34. package/DateTimeWidget-U3lD0q1q.js +0 -255
  35. package/Dialog-dT7y641z.js +0 -130
  36. package/LevoProvider-Bsjkcwc8.js +0 -20
  37. package/PhoneWidget-DQQa4bL6.js +0 -99
  38. package/PopupBody-BI-MJqmd-DgTQEzda.js +0 -159
  39. package/PopupRenderer-D66Gx63H-Cd9xJv33.js +0 -388
  40. package/ThemeProvider-DutrjSTF.js +0 -116
  41. package/Tooltip-CQB0LyxK.js +0 -67
  42. package/VerifyButton-BUT70lgz.js +0 -192
  43. package/createThemeExtension-4AUn51iJ.js +0 -15
  44. package/dist-6AIgW_iB.js +0 -79
  45. package/dist-CEdznbFW.js +0 -3668
  46. package/inlineBaseTheme-BB9e6h5f.js +0 -9
  47. package/popupState-JmpeKzgM-D_77LiAa.js +0 -229
  48. package/react-B9yvlbH0.js +0 -74
  49. package/theme.cssm-DUzmx76l.js +0 -4
  50. package/usePopupRedirect-CAAdcpaW-Ddjyf4KK.js +0 -82
  51. /package/{content.cssm-XdMsTGIB.js → content.cssm-D_LSloGW.js} +0 -0
  52. /package/{es-ByBbirnH.js → es-CK20DkgT.js} +0 -0
  53. /package/{rolldown-runtime-CAFD8bLK.js → rolldown-runtime-Dy4uBu1J.js} +0 -0
  54. /package/{routes-CyKmkoRM.js → routes-DO1BLfh9.js} +0 -0
  55. /package/{rteTheme.cssm-W4gTOijw.js → rteTheme.cssm-BRxusHY4.js} +0 -0
@@ -0,0 +1,376 @@
1
+ import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
+ import { a as t, t as n } from "./inlineBaseTheme-DcNdMEYp.js";
3
+ import { c as r } from "react/compiler-runtime";
4
+ import { Suspense as i, lazy as a, useCallback as o, useEffect as s, useRef as c, useState as l, useSyncExternalStore as u } from "react";
5
+ import { jsx as d } from "react/jsx-runtime";
6
+ import { $isIdentityContextReady as f } from "@levo-so/insights/stores";
7
+ //#region ../../node_modules/.pnpm/nanostores@0.11.4/node_modules/nanostores/clean-stores/index.js
8
+ var p = Symbol("clean"), m = [], h = 0, g = 4, _ = 0, v = (e) => {
9
+ let t = [], n = {
10
+ get() {
11
+ return n.lc || n.listen(() => {})(), n.value;
12
+ },
13
+ lc: 0,
14
+ listen(e) {
15
+ return n.lc = t.push(e), () => {
16
+ for (let t = h + g; t < m.length;) m[t] === e ? m.splice(t, g) : t += g;
17
+ let r = t.indexOf(e);
18
+ ~r && (t.splice(r, 1), --n.lc || n.off());
19
+ };
20
+ },
21
+ notify(e, r) {
22
+ _++;
23
+ let i = !m.length;
24
+ for (let i of t) m.push(i, n.value, e, r);
25
+ if (i) {
26
+ for (h = 0; h < m.length; h += g) m[h](m[h + 1], m[h + 2], m[h + 3]);
27
+ m.length = 0;
28
+ }
29
+ },
30
+ off() {},
31
+ set(e) {
32
+ let t = n.value;
33
+ t !== e && (n.value = e, n.notify(t));
34
+ },
35
+ subscribe(e) {
36
+ let t = n.listen(e);
37
+ return e(n.value), t;
38
+ },
39
+ value: e
40
+ };
41
+ return process.env.NODE_ENV !== "production" && (n[p] = () => {
42
+ t = [], n.lc = 0, n.off();
43
+ }), n;
44
+ }, y = 5, b = 6, x = 10, ee = (e, t, n, r) => (e.events = e.events || {}, e.events[n + x] || (e.events[n + x] = r((t) => {
45
+ e.events[n].reduceRight((e, t) => (t(e), e), {
46
+ shared: {},
47
+ ...t
48
+ });
49
+ })), e.events[n] = e.events[n] || [], e.events[n].push(t), () => {
50
+ let r = e.events[n], i = r.indexOf(t);
51
+ r.splice(i, 1), r.length || (delete e.events[n], e.events[n + x](), delete e.events[n + x]);
52
+ }), te = 1e3, S = (e, t) => ee(e, (n) => {
53
+ let r = t(n);
54
+ r && e.events[b].push(r);
55
+ }, y, (t) => {
56
+ let n = e.listen;
57
+ e.listen = (...r) => (!e.lc && !e.active && (e.active = !0, t()), n(...r));
58
+ let r = e.off;
59
+ if (e.events[b] = [], e.off = () => {
60
+ r(), setTimeout(() => {
61
+ if (e.active && !e.lc) {
62
+ e.active = !1;
63
+ for (let t of e.events[b]) t();
64
+ e.events[b] = [];
65
+ }
66
+ }, te);
67
+ }, process.env.NODE_ENV !== "production") {
68
+ let t = e[p];
69
+ e[p] = () => {
70
+ for (let t of e.events[b]) t();
71
+ e.events[b] = [], e.active = !1, t();
72
+ };
73
+ }
74
+ return () => {
75
+ e.listen = n, e.off = r;
76
+ };
77
+ }), ne = (e, t, n) => {
78
+ Array.isArray(e) || (e = [e]);
79
+ let r, i, a = () => {
80
+ if (i === _) return;
81
+ i = _;
82
+ let n = e.map((e) => e.get());
83
+ if (!r || n.some((e, t) => e !== r[t])) {
84
+ r = n;
85
+ let e = t(...n);
86
+ e && e.then && e.t ? e.then((e) => {
87
+ r === n && o.set(e);
88
+ }) : (o.set(e), i = _);
89
+ }
90
+ }, o = v(void 0), s = o.get;
91
+ o.get = () => (a(), s());
92
+ let c, l = n ? () => {
93
+ clearTimeout(c), c = setTimeout(a);
94
+ } : a;
95
+ return S(o, () => {
96
+ let t = e.map((e) => e.listen(l));
97
+ return a(), () => {
98
+ for (let e of t) e();
99
+ };
100
+ }), o;
101
+ }, C = (e, t) => ne(e, t);
102
+ //#endregion
103
+ //#region ../../node_modules/.pnpm/nanostores@0.11.4/node_modules/nanostores/listen-keys/index.js
104
+ function re(e, t, n) {
105
+ let r = new Set(t).add(void 0);
106
+ return e.listen((e, t, i) => {
107
+ r.has(i) && n(e, t, i);
108
+ });
109
+ }
110
+ //#endregion
111
+ //#region ../../node_modules/.pnpm/@nanostores+persistent@1.3.3_nanostores@0.11.4/node_modules/@nanostores/persistent/index.js
112
+ var w = (e) => e, T = {}, E = {
113
+ addEventListener() {},
114
+ removeEventListener() {}
115
+ };
116
+ function ie() {
117
+ try {
118
+ return typeof localStorage < "u";
119
+ } catch {
120
+ return !1;
121
+ }
122
+ }
123
+ ie() && (T = localStorage), typeof window < "u" && (E = {
124
+ addEventListener(e, t, n) {
125
+ window.addEventListener("storage", t), window.addEventListener("pageshow", n);
126
+ },
127
+ removeEventListener(e, t, n) {
128
+ window.removeEventListener("storage", t), window.removeEventListener("pageshow", n);
129
+ }
130
+ });
131
+ function D(e, t = void 0, n = {}) {
132
+ let r = n.encode || w, i = n.decode || w, a = T[e], o = v(e in T ? i(a) : t), s = o.set;
133
+ o.set = (t) => {
134
+ a = r(t), a === void 0 ? delete T[e] : T[e] = a, s(t);
135
+ };
136
+ function c(n) {
137
+ n.key === e ? n.newValue === null ? s(t) : s(i(n.newValue)) : T[e] || s(t);
138
+ }
139
+ function l() {
140
+ a !== T[e] && o.set(e in T ? i(T[e]) : t);
141
+ }
142
+ return S(o, () => {
143
+ if (l(), n.listen !== !1) return E.addEventListener(e, c, l), () => {
144
+ E.removeEventListener(e, c, l);
145
+ };
146
+ }), o;
147
+ }
148
+ //#endregion
149
+ //#region ../../libraries/popups/dist/themeMapping-DH_NoXK8.js
150
+ var O = 6e4, k = "lv_popups_session", A = {
151
+ active_popup_id: null,
152
+ shown_popup_ids: [],
153
+ last_closed_at: null
154
+ }, j = D("lv_popups_state", {}, {
155
+ encode: JSON.stringify,
156
+ decode: JSON.parse
157
+ }), ae = (e) => {
158
+ if (!e) return A;
159
+ try {
160
+ return {
161
+ ...JSON.parse(e),
162
+ active_popup_id: null
163
+ };
164
+ } catch {
165
+ return A;
166
+ }
167
+ }, M = v((() => {
168
+ if (typeof sessionStorage > "u") return A;
169
+ try {
170
+ return ae(sessionStorage.getItem(k));
171
+ } catch {
172
+ return A;
173
+ }
174
+ })()), N = M.set;
175
+ M.set = (e) => {
176
+ N(e);
177
+ try {
178
+ sessionStorage.setItem(k, JSON.stringify(e));
179
+ } catch {}
180
+ };
181
+ var P = C([M, j], (e, t) => ({
182
+ active_popup_id: e.active_popup_id,
183
+ shown_popup_ids: e.shown_popup_ids,
184
+ last_closed_at: e.last_closed_at,
185
+ previous_popups: t
186
+ })), F = v([]), I = (e) => {
187
+ F.set(e);
188
+ }, L = v(!0), R = (e) => {
189
+ L.set(e);
190
+ }, z = () => P.get(), oe = (e, t) => e.includes(t) ? e : [...e, t], B = "manual", se = () => B, V = null, ce = () => V, H = [], U = null, W = () => {
191
+ if (U) return;
192
+ let { last_closed_at: e } = M.get();
193
+ if (!e) return;
194
+ let t = O - (Date.now() - e);
195
+ if (t <= 0) {
196
+ G();
197
+ return;
198
+ }
199
+ U = setTimeout(() => {
200
+ U = null, G();
201
+ }, t);
202
+ }, G = () => {
203
+ let e = M.get();
204
+ if (!e.active_popup_id) {
205
+ if (e.last_closed_at && Date.now() - e.last_closed_at < 6e4) {
206
+ W();
207
+ return;
208
+ }
209
+ for (; H.length > 0;) {
210
+ let e = H.shift();
211
+ if (q(e.popup, { trigger_type: e.trigger_type })) return;
212
+ }
213
+ }
214
+ }, le = (e, t) => {
215
+ H.some((t) => t.popup.id === e.id) || (H.push({
216
+ popup: e,
217
+ trigger_type: t
218
+ }), W());
219
+ }, K = (e, t) => {
220
+ let n = z();
221
+ if (t?.type === "always") return !n.shown_popup_ids.includes(e);
222
+ let r = n.previous_popups[e];
223
+ return r ? !t || t.type === "once" ? !1 : t.type === "interval" && t.interval_ms ? Date.now() - r.triggered_at >= t.interval_ms : !0 : !0;
224
+ }, q = (e, t = {}) => {
225
+ let { force: n = !1, trigger_type: r = "manual" } = t, i = e.id, a = e.settings?.display_frequency, o = M.get();
226
+ return o.active_popup_id === i ? !0 : !n && (o.active_popup_id || o.last_closed_at && Date.now() - o.last_closed_at < 6e4 || !K(i, a)) ? !1 : (U &&= (clearTimeout(U), null), B = r, V = Date.now(), M.set({
227
+ active_popup_id: i,
228
+ shown_popup_ids: oe(o.shown_popup_ids, i),
229
+ last_closed_at: o.last_closed_at
230
+ }), a?.type !== "always" && j.set({
231
+ ...j.get(),
232
+ [i]: { triggered_at: Date.now() }
233
+ }), !0);
234
+ }, ue = (e, t = {}) => {
235
+ let { trigger_type: n = "manual" } = t;
236
+ return q(e, { trigger_type: n }) ? !0 : (K(e.id, e.settings?.display_frequency) && le(e, n), !1);
237
+ }, J = (e) => {
238
+ let t = M.get();
239
+ t.active_popup_id === e && (B = "manual", V = null, M.set({
240
+ ...t,
241
+ active_popup_id: null,
242
+ last_closed_at: Date.now()
243
+ }), setTimeout(G, 0));
244
+ }, Y = (e) => {
245
+ if (e == null) return;
246
+ if (typeof e == "string") return e;
247
+ if (typeof e != "object") return;
248
+ let t = e;
249
+ if (typeof t.l != "number" || typeof t.c != "number" || typeof t.h != "number") return;
250
+ let n = (e) => Math.round(e * 1e4) / 1e4, r = n(t.l), i = n(t.c), a = n(t.h), o = typeof t.alpha == "number" ? n(t.alpha) : 1;
251
+ return o < 1 ? `oklch(${r} ${i} ${a} / ${o})` : `oklch(${r} ${i} ${a})`;
252
+ }, de = (e) => {
253
+ let t = e.colors;
254
+ return !t || typeof t != "object" ? !1 : Object.values(t).some((e) => e != null);
255
+ }, fe = (e) => {
256
+ if (!e || !de(e)) return null;
257
+ let t = e.colors, n = t?.brand ?? {}, r = e.fonts, i = e.sizes;
258
+ return {
259
+ colors: {
260
+ brand: {
261
+ main: Y(n.main) ?? "",
262
+ foreground: Y(n.foreground) ?? ""
263
+ },
264
+ text1: Y(t.text1) ?? "",
265
+ text2: Y(t.text2) ?? "",
266
+ page: Y(t.page) ?? "",
267
+ border: Y(t.border) ?? ""
268
+ },
269
+ fonts: {
270
+ heading: r?.heading ?? "inherit",
271
+ body: r?.body ?? "inherit"
272
+ },
273
+ sizes: { radius: i?.radius ?? "4px" }
274
+ };
275
+ }, pe = (e) => {
276
+ if (e) return {
277
+ colors: {
278
+ primary: e.colors?.brand?.main,
279
+ primaryForeground: e.colors?.brand?.foreground,
280
+ foreground: e.colors?.text1,
281
+ text: e.colors?.text1,
282
+ heading: e.colors?.text1,
283
+ mutedForeground: e.colors?.text2,
284
+ background: e.colors?.page,
285
+ card: e.colors?.page,
286
+ cardForeground: e.colors?.text1,
287
+ popover: e.colors?.page,
288
+ popoverForeground: e.colors?.text1,
289
+ border: e.colors?.border,
290
+ input: e.colors?.page,
291
+ inputForeground: e.colors?.text1
292
+ },
293
+ fonts: e.fonts,
294
+ radius: e.sizes?.radius
295
+ };
296
+ }, me = (e) => n(pe(e)), X = (e, t) => (n) => {
297
+ e.current !== n && (e.current = n, t());
298
+ };
299
+ function Z(e, { keys: t, deps: n = [e, t] } = {}) {
300
+ let r = c();
301
+ r.current = e.get();
302
+ let i = o((n) => (X(r, n)(e.value), t?.length > 0 ? re(e, t, X(r, n)) : e.listen(X(r, n))), n), a = () => r.current;
303
+ return u(i, a, a);
304
+ }
305
+ //#endregion
306
+ //#region ../../libraries/popups/dist/index.js
307
+ var he = /* @__PURE__ */ e({
308
+ PopupLoader: () => _e,
309
+ fetchActivePopups: () => Q,
310
+ usePopup: () => $
311
+ }), Q = async (e, t) => {
312
+ let n = {};
313
+ return t?.site_id && (n.site_id = t.site_id), t?.locale && (n.locale = t.locale), t?.country && (n.country = t.country), (await e.url("/v1/studio/popup/list-active").query(n).get().json())?.content?.data ?? [];
314
+ }, ge = a(() => import("./PopupRenderer-BVtV4b9I-Dot4Syse.js").then((e) => e.t).then((e) => ({ default: e.PopupRenderer }))), _e = (e) => {
315
+ let n = r(9), { siteId: a, pageId: o } = e, { fetch: u, logger: p } = t(), [m, h] = l(null), g = c(!1), _, v;
316
+ if (n[0] !== u || n[1] !== p || n[2] !== a ? (_ = () => {
317
+ if (g.current) return;
318
+ let e = () => {
319
+ g.current || (g.current = !0, Q(u, a ? { site_id: a } : void 0).then((e) => {
320
+ I(e), h(e);
321
+ }).catch((e) => {
322
+ p?.error("Failed to fetch popups", { exception: e }), I([]), h([]);
323
+ }).finally(ve));
324
+ };
325
+ if (f.get()) {
326
+ e();
327
+ return;
328
+ }
329
+ let t = f.listen((n) => {
330
+ n && (t(), e());
331
+ });
332
+ return () => t();
333
+ }, v = [
334
+ u,
335
+ p,
336
+ a
337
+ ], n[0] = u, n[1] = p, n[2] = a, n[3] = _, n[4] = v) : (_ = n[3], v = n[4]), s(_, v), !m || m.length === 0) return null;
338
+ let y;
339
+ n[5] === Symbol.for("react.memo_cache_sentinel") ? (y = {
340
+ position: "relative",
341
+ zIndex: 99999
342
+ }, n[5] = y) : y = n[5];
343
+ let b;
344
+ return n[6] !== o || n[7] !== m ? (b = /* @__PURE__ */ d("div", {
345
+ style: y,
346
+ children: /* @__PURE__ */ d(i, { children: /* @__PURE__ */ d(ge, {
347
+ popups: m,
348
+ pageId: o
349
+ }) })
350
+ }), n[6] = o, n[7] = m, n[8] = b) : b = n[8], b;
351
+ };
352
+ function ve() {
353
+ return R(!1);
354
+ }
355
+ var $ = () => {
356
+ let e = r(3), t = Z(F), n = Z(L), i = ye, a = be, o;
357
+ return e[0] !== n || e[1] !== t ? (o = {
358
+ popups: t,
359
+ isLoading: n,
360
+ openPopup: i,
361
+ closePopup: a
362
+ }, e[0] = n, e[1] = t, e[2] = o) : o = e[2], o;
363
+ };
364
+ function ye(e) {
365
+ let t = F.get().find((t) => t.id === e);
366
+ t && q(t, {
367
+ force: !0,
368
+ trigger_type: "manual"
369
+ });
370
+ }
371
+ function be() {
372
+ let e = M.get().active_popup_id;
373
+ e && J(e);
374
+ }
375
+ //#endregion
376
+ export { me as a, z as c, I as d, ce as f, J as i, R as l, he as n, fe as o, se as p, Z as r, P as s, $ as t, ue as u };
package/index.d.ts CHANGED
@@ -635,6 +635,21 @@ export declare interface ILevoEntryFormProps {
635
635
  className?: string;
636
636
  }
637
637
 
638
+ declare interface ILevoEventRegisterProps {
639
+ /** Event id (or slug the single-event endpoint resolves). */
640
+ eventID: string;
641
+ /** Event name, shown in the sheet header and on the calendar entry. */
642
+ title?: string;
643
+ /** External ticketing URL — when set, renders a link out instead of the sheet. */
644
+ external?: string;
645
+ buttonText?: string;
646
+ /** Event start/end (`starts_at` / `ends_at`), shown in the viewer's own timezone and used for the calendar entry. */
647
+ startsAt?: string | Date | null;
648
+ endsAt?: string | Date | null;
649
+ /** Joining link (`url`), attached to the calendar entry so it is one tap away at start time. */
650
+ eventUrl?: string | null;
651
+ }
652
+
638
653
  /**
639
654
  * A form binding — the fields + submit for a collection. `LevoForm` renders it (the schema
640
655
  * drives which inputs appear); submissions go to the collection. Forms only bind to
@@ -1709,23 +1724,18 @@ export declare const LevoEntryForm: React.FC<ILevoEntryFormProps>;
1709
1724
 
1710
1725
  /**
1711
1726
  * Self-contained event registration widget for generated Studio v3 sites — ticket
1712
- * selection, coupons, attendee details, payment (Razorpay by default; Stripe Embedded
1713
- * Checkout when the booking API returns `provider: "stripe"`), and a booking confirmation.
1727
+ * choice, coupons, attendee details, payment (Razorpay by default; Stripe Embedded
1728
+ * Checkout when the booking API returns `provider: "stripe"`), and the confirmation, all
1729
+ * on one sheet that stays open from the first tap to "You're in".
1714
1730
  *
1715
1731
  * The AI drops this onto an event page and NEVER rebuilds the flow: it owns the entire
1716
1732
  * booking + payment path against the Levo event API. The site client (`useLevoClient`)
1717
1733
  * auto-stamps the workspace on every request, so no auth/workspace wiring is needed.
1718
1734
  * `external` turns it into a plain link out to a third-party ticketing URL.
1735
+ *
1736
+ * `?register=1` on the page URL opens the sheet on load, for campaign links and second CTAs.
1719
1737
  */
1720
- export declare const LevoEventRegister: ({ eventID, title, external, buttonText, }: {
1721
- /** Event id (or slug the single-event endpoint resolves). */
1722
- eventID: string;
1723
- /** Event name, shown in the modal header. */
1724
- title?: string;
1725
- /** External ticketing URL — when set, renders a link out instead of the modal flow. */
1726
- external?: string;
1727
- buttonText?: string;
1728
- }) => JSX.Element;
1738
+ export declare const LevoEventRegister: ({ eventID, title, external, buttonText, startsAt, endsAt, eventUrl, }: ILevoEventRegisterProps) => JSX.Element;
1729
1739
 
1730
1740
  /**
1731
1741
  * A collection-backed form for generated Studio v3 sites — renders the collection's fields