@levo-so/site-runtime 0.3.27 → 0.3.28

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.
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { s as e } from "./dist-B_29IiED.js";
2
+ import { s as e } from "./dist-ZKuRfAWn.js";
3
3
  import { n as t, t as n } from "./CollectionLabel-CmUFfc_7.js";
4
4
  import { m as ee } from "./theme.cssm-iXnQwMCp.js";
5
5
  import { c as te } from "react/compiler-runtime";
@@ -1,8 +1,8 @@
1
1
  "use client";
2
- import { c as e, r as t } from "./dist-B_29IiED.js";
2
+ import { c as e, r as t } from "./dist-ZKuRfAWn.js";
3
3
  import { m as n } from "./theme.cssm-iXnQwMCp.js";
4
4
  import { a as r } from "./inlineBaseTheme-DcNdMEYp.js";
5
- import { BillingStep as i } from "./BillingStep-OT3ayt8x.js";
5
+ import { BillingStep as i } from "./BillingStep-CzrxHzkA.js";
6
6
  import a from "dayjs";
7
7
  import { c as o } from "react/compiler-runtime";
8
8
  import { useCallback as s, useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
package/CHANGELOG.md CHANGED
@@ -1,12 +1,20 @@
1
1
  # @levo-so/site-runtime
2
2
 
3
+ ## 0.3.28
4
+
5
+ ### Patch Changes
6
+
7
+ - Collection field public visibility flags synced with backend architecture
8
+ - @levo-so/core@0.3.28
9
+ - @levo-so/insights@0.3.28
10
+
3
11
  ## 0.3.27
4
12
 
5
13
  ### Patch Changes
6
14
 
7
15
  - Event registration suggests the event's public coupons and applies the best one on its own. It works in both the one-ticket sheet and the multi-ticket cart, and needs no new props or backend change: it uses the existing public-coupon list and coupon validation. **A visible change on every site that sells paid tickets.** Nothing to change in site code.
8
16
 
9
- - **The best public coupon is already applied when the price appears.** A green banner shows the code and the saving, with "Finding your best offer…" while it validates. A failed auto-apply stays silent and leaves the price as it was.
17
+ - **The best public coupon applies on its own once the server accepts it.** "Finding your best offer…" holds its place while it validates, then a green banner shows the code and the saving. A failed auto-apply stays silent and leaves the price as it was.
10
18
  - **The other public coupons the order qualifies for show as cards with their saving worked out**, e.g. "Save ₹300 · 10% off, up to ₹300". With nothing applied, the top card is marked "Best". Once a coupon is applied, the rest fold under "N more offers", and "Switch" moves to one of them.
11
19
  - **Only coupons the order qualifies for are offered.** Archived, not-yet-started, expired and fully redeemed coupons are left out, as are coupons whose minimum order is not met and coupons that cover none of the chosen tickets. Offers are ranked by estimated saving, capped at the coupon's maximum discount. The applied banner always shows the server's figure, not the estimate.
12
20
  - **Typing a code still works**, under "Have a code?", or "Have a different code?" once a coupon is applied. It is the only way to use a private code. A code that fails shows an inline error and leaves the applied coupon in place. Codes are upper-cased before they are checked.
@@ -1,4 +1,4 @@
1
- import { h as e, p as t, s as n } from "./dist-B_29IiED.js";
1
+ import { h as e, p as t, s as n } from "./dist-ZKuRfAWn.js";
2
2
  import { m as r } from "./theme.cssm-iXnQwMCp.js";
3
3
  import { a as i, i as a, n as o, r as s, t as c } from "./Popover-MSrVDAzg.js";
4
4
  import { FieldInterfaces as l } from "@levo-so/core";
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { h as e, o as t, p as ee, s as n } from "./dist-B_29IiED.js";
2
+ import { h as e, o as t, p as ee, s as n } from "./dist-ZKuRfAWn.js";
3
3
  import { c as te } from "react/compiler-runtime";
4
4
  import { useState as r } from "react";
5
5
  import { useController as i } from "react-hook-form";
@@ -1,5 +1,5 @@
1
1
  import { a as e, i as t, m as n, n as r } from "./theme.cssm-iXnQwMCp.js";
2
- import { a as i, i as a, l as o, n as s, o as c, r as l, u } from "./PopupDialog-DwAAJ8JS-DzVJh1br.js";
2
+ import { a as i, i as a, l as o, n as s, o as c, r as l, u } from "./PopupDialog-DwAAJ8JS-niDho4kU.js";
3
3
  import { o as d } from "./inlineBaseTheme-DcNdMEYp.js";
4
4
  import { t as f } from "./inlineCollectionTheme-DjXuH3bK.js";
5
5
  import { _ as p, a as m, c as h, d as g, f as _, g as v, h as y, i as b, l as x, m as S, n as C, o as w, p as T, r as E, s as D, t as O, u as k, v as A } from "./react-CENbCy5d.js";
@@ -59,7 +59,7 @@ var Z = [
59
59
  ...r,
60
60
  children: a
61
61
  }) : null;
62
- }, $ = /* @__PURE__ */ u({ PopupBody: () => oe }), ne = F(() => import("./dist-B_29IiED.js").then((e) => e.t).then((e) => ({ default: e.CollectionFormBuilder }))), re = N({ baseSpacing: ".625rem" }), ie = { style: f({ form: { gap: "1rem" } }) }, ae = {
62
+ }, $ = /* @__PURE__ */ u({ PopupBody: () => oe }), ne = F(() => import("./dist-ZKuRfAWn.js").then((e) => e.t).then((e) => ({ default: e.CollectionFormBuilder }))), re = N({ baseSpacing: ".625rem" }), ie = { style: f({ form: { gap: "1rem" } }) }, ae = {
63
63
  left: s,
64
64
  center: a,
65
65
  right: o
@@ -1,5 +1,5 @@
1
1
  import { c as e, d as t, l as n, o as r, p as i, s as a, t as o, u as s } from "./theme.cssm-iXnQwMCp.js";
2
- import { a as c, c as l, f as u, i as d, o as f, p, r as m, s as h } from "./dist-DTszGV-P.js";
2
+ import { a as c, c as l, f as u, i as d, o as f, p, r as m, s as h } from "./dist-DZ9NFwK3.js";
3
3
  import { t as g } from "./rteTheme.cssm-BRxusHY4.js";
4
4
  import { c as _ } from "react/compiler-runtime";
5
5
  import { Suspense as v, createContext as y, lazy as b, useContext as x, useEffect as S, useRef as C } from "react";
@@ -171,7 +171,7 @@ var R = Object.defineProperty, z = (e, t) => {
171
171
  ...a,
172
172
  children: n
173
173
  }), t[15] = n, t[16] = a, t[17] = h, t[18] = v) : v = t[18], v;
174
- }, ce = b(() => import("./PopupBody-DWM55Zh5-BaxCgy8c.js").then((e) => e.n).then((e) => ({ default: e.PopupBody }))), le = (e) => {
174
+ }, ce = b(() => import("./PopupBody-DWM55Zh5-Cy9rnVZv.js").then((e) => e.n).then((e) => ({ default: e.PopupBody }))), le = (e) => {
175
175
  let t = _(7), { size: n } = e, r = n ?? "medium", i;
176
176
  t[0] === r ? i = t[1] : (i = U({ size: r }), t[0] = r, t[1] = i);
177
177
  let a, o, s;
@@ -1,6 +1,6 @@
1
- import { c as e, r as t, s as n, t as r, u as i } from "./PopupDialog-DwAAJ8JS-DzVJh1br.js";
1
+ import { c as e, r as t, s as n, t as r, u as i } from "./PopupDialog-DwAAJ8JS-niDho4kU.js";
2
2
  import { a, c as o } from "./inlineBaseTheme-DcNdMEYp.js";
3
- import { d as s, l as c, r as l, u } from "./dist-DTszGV-P.js";
3
+ import { d as s, l as c, r as l, u } from "./dist-DZ9NFwK3.js";
4
4
  import { c as d } from "react/compiler-runtime";
5
5
  import { useEffect as f, useRef as p } from "react";
6
6
  import { Fragment as m, jsx as h } from "react/jsx-runtime";
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { d as e, f as t, h as n, l as r, m as i, p as a, u as o } from "./dist-B_29IiED.js";
2
+ import { d as e, f as t, h as n, l as r, m as i, p as a, u as o } from "./dist-ZKuRfAWn.js";
3
3
  import { m as s } from "./theme.cssm-iXnQwMCp.js";
4
4
  import { n as c, t as l } from "./content.cssm-D_LSloGW.js";
5
5
  import { t as u } from "./inlineRteTheme-BYGIJM7P.js";
package/blog-content.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
- import { i as e } from "./dist-B_29IiED.js";
2
+ import { i as e } from "./dist-ZKuRfAWn.js";
3
3
  import { a as t, t as n } from "./inlineBaseTheme-DcNdMEYp.js";
4
- import { t as r } from "./dist-DTszGV-P.js";
4
+ import { t as r } from "./dist-DZ9NFwK3.js";
5
5
  import { _ as i, a, c as o, d as s, f as c, g as l, h as u, i as d, l as f, m as p, n as m, o as h, p as g, r as _, s as v, t as y, u as b, v as x } from "./react-CENbCy5d.js";
6
6
  import { i as S, n as C, r as w, t as T } from "./content.cssm-D_LSloGW.js";
7
7
  import { t as E } from "./RteThemeProvider-DtTXGcCT.js";
@@ -311,7 +311,7 @@ var he = /* @__PURE__ */ e({
311
311
  }), Q = async (e, t) => {
312
312
  let n = {};
313
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-Z7QWR6y6.js").then((e) => e.t).then((e) => ({ default: e.PopupRenderer }))), _e = (e) => {
314
+ }, ge = a(() => import("./PopupRenderer-BVtV4b9I-S7vK9JNa.js").then((e) => e.t).then((e) => ({ default: e.PopupRenderer }))), _e = (e) => {
315
315
  let n = r(9), { siteId: a, pageId: o } = e, { fetch: u, logger: p } = t(), [m, h] = l(null), g = c(!1), _, v;
316
316
  if (n[0] !== u || n[1] !== p || n[2] !== a ? (_ = () => {
317
317
  if (g.current) return;
@@ -2638,7 +2638,7 @@ var ki = "_156u72w0", Ai = "_156u72w1", ji = (e) => Array.isArray(e) && e.every(
2638
2638
  leftIcon: n,
2639
2639
  ...e
2640
2640
  }), t[1] = e, t[2] = r), r;
2641
- }, Pi = M(() => import("./DateTimeWidget-DcsuQf6T.js")), Fi = M(() => import("./PhoneWidget-DbhgbvKH.js")), Ii = M(() => import("./RichTextWidget-B_olC979.js")), Li = {
2641
+ }, Pi = M(() => import("./DateTimeWidget-B7p-A0FY.js")), Fi = M(() => import("./PhoneWidget-Rh1eP4pP.js")), Ii = M(() => import("./RichTextWidget-ClgWi7ZW.js")), Li = {
2642
2642
  TextWidget: $((e) => /* @__PURE__ */ X($r, { ...e })),
2643
2643
  NumberWidget: $((e) => /* @__PURE__ */ X($r, {
2644
2644
  type: "number",
@@ -2870,7 +2870,7 @@ var Ui = ((e) => (t) => t ? Hi(e, t) : e)({
2870
2870
  }), t[23] = p, t[24] = h, t[25] = i, t[26] = a, t[27] = o, t[28] = v, t[29] = y) : y = t[29], y;
2871
2871
  }, Yi = (e, t) => e?.map((e) => ({
2872
2872
  ...e,
2873
- hidden: e.hidden || t.includes(e.key) || t.includes(e.id) || e.allow_public_view === !1 || e.allow_public_submit === !1,
2873
+ hidden: e.hidden || t.includes(e.key) || t.includes(e.id) || e.allow_public_submit === !1,
2874
2874
  fields: Yi(e.fields, t)
2875
2875
  })), Xi = (e, t = []) => ({
2876
2876
  ...e,
@@ -4386,7 +4386,7 @@ var Bo = (e) => e && typeof e == "object" && "_id" in e ? e._id : e, Vo = (e) =>
4386
4386
  } catch {
4387
4387
  return !0;
4388
4388
  }
4389
- }, Uo = (e) => e ? { headers: { Origin: e } } : {}, Wo = "_165z1im3", Go = "_165z1im4", Ko = M(() => import("./BillingStep-OT3ayt8x.js").then((e) => ({ default: e.BillingStep }))), qo = M(() => import("./BookingCard-mqroL-wV.js").then((e) => ({ default: e.BookingCard }))), Jo = "We couldn't start your booking. Please try again.", Yo = ({ hiddenFields: e, fetchedSchema: t, isLoading: n, enableVerification: r = !0, workspace_id: i, workspace_name: a, onBookingComplete: o, onSuccess: s, ...c }) => {
4389
+ }, Uo = (e) => e ? { headers: { Origin: e } } : {}, Wo = "_165z1im3", Go = "_165z1im4", Ko = M(() => import("./BillingStep-CzrxHzkA.js").then((e) => ({ default: e.BillingStep }))), qo = M(() => import("./BookingCard-DOHYKI_6.js").then((e) => ({ default: e.BookingCard }))), Jo = "We couldn't start your booking. Please try again.", Yo = ({ hiddenFields: e, fetchedSchema: t, isLoading: n, enableVerification: r = !0, workspace_id: i, workspace_name: a, onBookingComplete: o, onSuccess: s, ...c }) => {
4390
4390
  let { fetch: l, collection: u, logger: d } = f(), [p, m] = R({ name: "form" }), [h, g] = R(null), [_, v] = R(null), y = I(() => t ? Xi(t, e) : null, [t, e]), b = y?.settings?.booking_config ?? {}, x = async (e) => {
4391
4391
  let t = e?.meta?.booking_config;
4392
4392
  if (t?.enabled && e?.response?._id && await Ho({
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { a as e, n as t } from "./dist-B_29IiED.js";
2
+ import { a as e, n as t } from "./dist-ZKuRfAWn.js";
3
3
  import { c as n, o as r, s as i, t as a } from "./inlineBaseTheme-DcNdMEYp.js";
4
4
  import { t as o } from "./inlineCollectionTheme-DjXuH3bK.js";
5
5
  import { a as s, c, d as l, f as u, i as d, l as f, n as p, o as m, r as h, s as g, t as _, u as v } from "./routes-DO1BLfh9.js";
@@ -1897,7 +1897,7 @@ var $n = "levo-made-with", er = `.${$n}{opacity:.2;transition:opacity 150ms,tran
1897
1897
  if (typeof document > "u") return null;
1898
1898
  let e = document.querySelectorAll(`meta[name="${nr}"]`);
1899
1899
  return e[e.length - 1]?.getAttribute("content")?.trim() || null;
1900
- }, ir = C(() => import("./dist-DTszGV-P.js").then((e) => e.n).then((e) => ({ default: e.PopupLoader }))), ar = ({ siteId: e, pageId: t }) => {
1900
+ }, ir = C(() => import("./dist-DZ9NFwK3.js").then((e) => e.n).then((e) => ({ default: e.PopupLoader }))), ar = ({ siteId: e, pageId: t }) => {
1901
1901
  let n = K(), r = i();
1902
1902
  return !n || !r ? null : /* @__PURE__ */ M(x, {
1903
1903
  fallback: null,
@@ -3378,12 +3378,12 @@ var X = (...e) => e.filter(Boolean).join(" "), kr = ({ open: e, className: t, ch
3378
3378
  saving: o
3379
3379
  }] : [];
3380
3380
  }).sort((e, t) => t.saving - e.saving), Oi = ({ eventID: e, tickets: t, enabled: n }) => {
3381
- let r = i(), a = t.map((e) => e._id).join(","), [o, s] = A(null), [c, l] = A(null), [u, d] = A(null), [f, p] = A([]), m = k(0), h = k(null), g = Di(f, t), _ = g[0]?.coupon.code;
3381
+ let r = i(), a = t.map((e) => e._id).join(","), [o, s] = A(null), [c, l] = A(null), [u, d] = A(null), [f, p] = A(null), m = k(0), h = k(null), g = Di(f ?? [], t), _ = g[0]?.coupon.code;
3382
3382
  E(() => {
3383
3383
  !n || !e || !r || r.fetch?.url(`/v1/event/event/${e}/coupon/list-public-coupons`)?.get().json().then((e) => {
3384
- e?.status && e?.content?.data && p(e.content.data);
3384
+ p(e?.status ? e.content?.data ?? [] : []);
3385
3385
  }).catch((e) => {
3386
- r.logger?.error("Failed to fetch public coupons", { exception: b(e) });
3386
+ p([]), r.logger?.error("Failed to fetch public coupons", { exception: b(e) });
3387
3387
  });
3388
3388
  }, [
3389
3389
  n,
@@ -3433,8 +3433,8 @@ var X = (...e) => e.filter(Boolean).join(" "), kr = ({ open: e, className: t, ch
3433
3433
  a,
3434
3434
  v
3435
3435
  ]);
3436
- let y = w(() => {
3437
- m.current += 1, l(null), s(null), d(null);
3436
+ let y = w(({ rearm: e = !1 } = {}) => {
3437
+ e && (h.current = null), m.current += 1, l(null), s(null), d(null);
3438
3438
  }, []);
3439
3439
  return {
3440
3440
  applied: o,
@@ -3442,6 +3442,7 @@ var X = (...e) => e.filter(Boolean).join(" "), kr = ({ open: e, className: t, ch
3442
3442
  pending: c,
3443
3443
  error: u,
3444
3444
  offers: g,
3445
+ isFindingBestOffer: n && !!e && !!r && (f === null || !!c?.auto),
3445
3446
  apply: v,
3446
3447
  reset: y
3447
3448
  };
@@ -3791,7 +3792,7 @@ var X = (...e) => e.filter(Boolean).join(" "), kr = ({ open: e, className: t, ch
3791
3792
  [e]: t
3792
3793
  }));
3793
3794
  }, R = () => {
3794
- S.clear(), I.reset(), D.reset(), b.reset(), u(_ ? { [_]: 1 } : {}), f("tickets"), g(null);
3795
+ S.clear(), I.reset(), D.reset({ rearm: !0 }), b.reset(), u(_ ? { [_]: 1 } : {}), f("tickets"), g(null);
3795
3796
  }, te = (t) => {
3796
3797
  if (t.preventDefault(), d === "tickets") {
3797
3798
  if (y === 0) {
@@ -3811,7 +3812,7 @@ var X = (...e) => e.filter(Boolean).join(" "), kr = ({ open: e, className: t, ch
3811
3812
  return;
3812
3813
  }
3813
3814
  }
3814
- I.register({
3815
+ D.isFindingBestOffer || I.register({
3815
3816
  event: e,
3816
3817
  coupon: D.applied?.code ?? "",
3817
3818
  attendees: b.slots.map((e) => {
@@ -3870,7 +3871,7 @@ var X = (...e) => e.filter(Boolean).join(" "), kr = ({ open: e, className: t, ch
3870
3871
  payment: I,
3871
3872
  label: ne,
3872
3873
  isPaid: ee,
3873
- blockedReason: d === "details" ? V : void 0
3874
+ blockedReason: d === "details" ? V : D.isFindingBestOffer ? "Finding your best offer…" : void 0
3874
3875
  });
3875
3876
  return /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ M(ci, {
3876
3877
  buttonText: n,
@@ -4108,7 +4109,7 @@ var X = (...e) => e.filter(Boolean).join(" "), kr = ({ open: e, className: t, ch
4108
4109
  }, E = () => {
4109
4110
  p.clear(), w.reset(), d.reset();
4110
4111
  }, D = (t) => {
4111
- t.preventDefault(), d.markSubmitted(), !(!l.selectedTicket || !d.isValid) && w.register({
4112
+ t.preventDefault(), d.markSubmitted(), !(!l.selectedTicket || !d.isValid || _.isFindingBestOffer) && w.register({
4112
4113
  event: e,
4113
4114
  coupon: _.applied?.code ?? "",
4114
4115
  attendees: [{
@@ -4160,7 +4161,8 @@ var X = (...e) => e.filter(Boolean).join(" "), kr = ({ open: e, className: t, ch
4160
4161
  footer: m ? void 0 : /* @__PURE__ */ M(Xr, {
4161
4162
  payment: w,
4162
4163
  label: A,
4163
- isPaid: y
4164
+ isPaid: y,
4165
+ blockedReason: _.isFindingBestOffer ? "Finding your best offer…" : void 0
4164
4166
  }),
4165
4167
  children: m ? /* @__PURE__ */ M(pi, {
4166
4168
  email: d.values.email.trim(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@levo-so/site-runtime",
3
- "version": "0.3.27",
3
+ "version": "0.3.28",
4
4
  "description": "Runtime for Levo Studio v3 sites — the editor preview inspector, page head metadata, and the Levo data client.",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -82,8 +82,8 @@
82
82
  "@assistant-ui/store": "0.3.13",
83
83
  "@assistant-ui/tap": "0.9.17",
84
84
  "remark-gfm": "4.0.1",
85
- "@levo-so/core": "0.3.27",
86
- "@levo-so/insights": "0.3.27",
85
+ "@levo-so/core": "0.3.28",
86
+ "@levo-so/insights": "0.3.28",
87
87
  "@stripe/react-stripe-js": "3.1.1",
88
88
  "@stripe/stripe-js": "5.5.0",
89
89
  "react-razorpay": "3.0.1"
package/popups.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as e } from "./dist-DTszGV-P.js";
1
+ import { t as e } from "./dist-DZ9NFwK3.js";
2
2
  //#region src/popups/usePopup.ts
3
3
  var t = () => e();
4
4
  //#endregion