@bowlos/reservations 0.29.0 → 0.31.0

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.
@@ -212,6 +212,9 @@ function useTestMode(args, options) {
212
212
  loading: res.loading
213
213
  };
214
214
  }
215
+ function useRetailPricing(args, options) {
216
+ return useBowlosQuery("listRetailPricing", args, options);
217
+ }
215
218
  var DEFAULT_MESSAGE = "We're performing maintenance \u2014 online booking is temporarily unavailable. Please check back soon.";
216
219
  function MaintenanceBanner({
217
220
  brandId,
@@ -1694,6 +1697,249 @@ function formatDay(iso) {
1694
1697
  });
1695
1698
  }
1696
1699
 
1700
+ // ../shared/src/inquiry.ts
1701
+ var INQUIRY_FORMS = {
1702
+ contact: {
1703
+ label: "Contact",
1704
+ fields: [
1705
+ { key: "contactName", label: "Contact Name", required: true },
1706
+ { key: "companyName", label: "Company Name" },
1707
+ { key: "email", label: "Email", required: true },
1708
+ { key: "mobile", label: "Mobile" },
1709
+ { key: "message", label: "Message", required: true }
1710
+ ]
1711
+ },
1712
+ event_party: {
1713
+ label: "Party / event inquiry",
1714
+ fields: [
1715
+ { key: "contactName", label: "Contact Name", required: true },
1716
+ { key: "companyName", label: "Company Name" },
1717
+ { key: "email", label: "Email", required: true },
1718
+ { key: "mobile", label: "Mobile" },
1719
+ { key: "peopleCount", label: "People count" },
1720
+ { key: "date", label: "Date" },
1721
+ { key: "time", label: "Time" },
1722
+ { key: "notes", label: "Notes" }
1723
+ ]
1724
+ }
1725
+ };
1726
+ var HONEYPOT_STYLE = {
1727
+ position: "absolute",
1728
+ left: "-9999px",
1729
+ width: 1,
1730
+ height: 1,
1731
+ opacity: 0
1732
+ };
1733
+ function InquiryForm({
1734
+ formType,
1735
+ action,
1736
+ onSuccess,
1737
+ submitLabel = "Send",
1738
+ successMessage = "Thanks \u2014 we\u2019ll be in touch shortly.",
1739
+ className,
1740
+ fieldStyle,
1741
+ labelStyle,
1742
+ inputStyle
1743
+ }) {
1744
+ const def = INQUIRY_FORMS[formType];
1745
+ const [values, setValues] = react.useState({});
1746
+ const [status, setStatus] = react.useState("idle");
1747
+ const [error, setError] = react.useState(null);
1748
+ const set = (key, val) => setValues((v) => ({ ...v, [key]: val }));
1749
+ const onSubmit = async (e) => {
1750
+ e.preventDefault();
1751
+ setStatus("submitting");
1752
+ setError(null);
1753
+ try {
1754
+ const res = await fetch(action, {
1755
+ method: "POST",
1756
+ headers: { "content-type": "application/json" },
1757
+ body: JSON.stringify({ formType, fields: values })
1758
+ });
1759
+ if (!res.ok) {
1760
+ setStatus("error");
1761
+ setError("Something went wrong. Please try again.");
1762
+ return;
1763
+ }
1764
+ setStatus("done");
1765
+ onSuccess?.();
1766
+ } catch {
1767
+ setStatus("error");
1768
+ setError("Network error. Please try again.");
1769
+ }
1770
+ };
1771
+ if (status === "done") {
1772
+ return /* @__PURE__ */ jsxRuntime.jsx("p", { className, children: successMessage });
1773
+ }
1774
+ return /* @__PURE__ */ jsxRuntime.jsxs("form", { className, onSubmit, children: [
1775
+ def.fields.map((f) => {
1776
+ const multiline = f.key === "message" || f.key === "notes";
1777
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: fieldStyle, children: [
1778
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { style: { display: "block", ...labelStyle }, children: [
1779
+ f.label,
1780
+ f.required ? " *" : ""
1781
+ ] }),
1782
+ multiline ? /* @__PURE__ */ jsxRuntime.jsx(
1783
+ "textarea",
1784
+ {
1785
+ required: f.required,
1786
+ value: values[f.key] ?? "",
1787
+ onChange: (e) => set(f.key, e.target.value),
1788
+ style: inputStyle
1789
+ }
1790
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
1791
+ "input",
1792
+ {
1793
+ type: f.key === "email" ? "email" : "text",
1794
+ required: f.required,
1795
+ value: values[f.key] ?? "",
1796
+ onChange: (e) => set(f.key, e.target.value),
1797
+ style: inputStyle
1798
+ }
1799
+ )
1800
+ ] }, f.key);
1801
+ }),
1802
+ /* @__PURE__ */ jsxRuntime.jsx(
1803
+ "input",
1804
+ {
1805
+ type: "text",
1806
+ name: "_honeypot",
1807
+ tabIndex: -1,
1808
+ autoComplete: "off",
1809
+ "aria-hidden": "true",
1810
+ style: HONEYPOT_STYLE,
1811
+ value: values._honeypot ?? "",
1812
+ onChange: (e) => set("_honeypot", e.target.value)
1813
+ }
1814
+ ),
1815
+ error && /* @__PURE__ */ jsxRuntime.jsx("p", { role: "alert", children: error }),
1816
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "submit", disabled: status === "submitting", children: status === "submitting" ? "Sending\u2026" : submitLabel })
1817
+ ] });
1818
+ }
1819
+ var DAY_NAMES = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
1820
+ function fmtMinute(m) {
1821
+ const hh = Math.floor(m / 60) % 24;
1822
+ const mm = m % 60;
1823
+ const ampm = hh < 12 ? "AM" : "PM";
1824
+ const h12 = hh % 12 === 0 ? 12 : hh % 12;
1825
+ return mm === 0 ? `${h12} ${ampm}` : `${h12}:${String(mm).padStart(2, "0")} ${ampm}`;
1826
+ }
1827
+ function rateForMode(r, mode) {
1828
+ switch (mode) {
1829
+ case "per_unit_per_hour":
1830
+ return r.rateUnitHourCents;
1831
+ case "per_person_per_hour":
1832
+ return r.ratePersonHourCents;
1833
+ case "per_game":
1834
+ return r.rateGameCents;
1835
+ }
1836
+ }
1837
+ function modeLabel(mode, unitPlural) {
1838
+ switch (mode) {
1839
+ case "per_unit_per_hour":
1840
+ return `Per ${unitPlural.replace(/s$/, "")}/hr`;
1841
+ case "per_person_per_hour":
1842
+ return "Per person/hr";
1843
+ case "per_game":
1844
+ return "Per game";
1845
+ }
1846
+ }
1847
+ function AttractionRates({ a }) {
1848
+ if (a.walkInRates.length === 0) return null;
1849
+ const modes = a.enabledModes;
1850
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { marginBottom: "1.5rem" }, children: [
1851
+ /* @__PURE__ */ jsxRuntime.jsx("h4", { style: { margin: "0 0 0.5rem", fontSize: "1.05rem" }, children: a.name }),
1852
+ /* @__PURE__ */ jsxRuntime.jsxs("table", { style: { width: "100%", borderCollapse: "collapse", fontSize: "0.95rem" }, children: [
1853
+ /* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { style: { textAlign: "left", color: token("colorMuted") }, children: [
1854
+ /* @__PURE__ */ jsxRuntime.jsx("th", { style: { padding: "0.35rem 0.5rem" }, children: "Day" }),
1855
+ /* @__PURE__ */ jsxRuntime.jsx("th", { style: { padding: "0.35rem 0.5rem" }, children: "Time" }),
1856
+ modes.map((m) => /* @__PURE__ */ jsxRuntime.jsx("th", { style: { padding: "0.35rem 0.5rem", textAlign: "right" }, children: modeLabel(m, a.unitLabelPlural) }, m))
1857
+ ] }) }),
1858
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: a.walkInRates.map((r, i) => /* @__PURE__ */ jsxRuntime.jsxs(
1859
+ "tr",
1860
+ {
1861
+ style: { borderTop: `1px solid ${token("colorBorder")}` },
1862
+ children: [
1863
+ /* @__PURE__ */ jsxRuntime.jsx("td", { style: { padding: "0.35rem 0.5rem" }, children: DAY_NAMES[r.dayOfWeek] }),
1864
+ /* @__PURE__ */ jsxRuntime.jsx("td", { style: { padding: "0.35rem 0.5rem" }, children: r.label ?? `${fmtMinute(r.startMinuteOfDay)} \u2013 ${fmtMinute(r.endMinuteOfDay)}` }),
1865
+ modes.map((m) => {
1866
+ const cents = rateForMode(r, m);
1867
+ return /* @__PURE__ */ jsxRuntime.jsx("td", { style: { padding: "0.35rem 0.5rem", textAlign: "right" }, children: cents === null ? "\u2014" : formatCents(cents) }, m);
1868
+ })
1869
+ ]
1870
+ },
1871
+ i
1872
+ )) })
1873
+ ] })
1874
+ ] });
1875
+ }
1876
+ function SpecialCard({ s }) {
1877
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1878
+ "div",
1879
+ {
1880
+ style: {
1881
+ border: `1px solid ${token("colorBorder")}`,
1882
+ borderRadius: token("radius"),
1883
+ background: token("colorSurface"),
1884
+ padding: "0.85rem 1rem",
1885
+ display: "flex",
1886
+ justifyContent: "space-between",
1887
+ gap: "1rem",
1888
+ alignItems: "baseline"
1889
+ },
1890
+ children: [
1891
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1892
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontWeight: 600 }, children: s.name }),
1893
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { color: token("colorMuted"), fontSize: "0.9rem" }, children: s.description }),
1894
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { color: token("colorMuted"), fontSize: "0.8rem" }, children: s.attractionName })
1895
+ ] }),
1896
+ s.priceCents !== null && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontWeight: 700, color: token("colorPrimary"), whiteSpace: "nowrap" }, children: formatCents(s.priceCents) })
1897
+ ]
1898
+ }
1899
+ );
1900
+ }
1901
+ function PricingTable({
1902
+ centerId,
1903
+ specialsOnly = false,
1904
+ labels,
1905
+ className,
1906
+ style
1907
+ }) {
1908
+ const { data, loading } = useRetailPricing({ centerId });
1909
+ if (loading && !data) {
1910
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontFamily: token("fontFamily"), color: token("colorMuted") }, children: labels?.loading ?? "Loading pricing\u2026" });
1911
+ }
1912
+ if (!data) return null;
1913
+ const hasWalkIn = data.attractions.some((a) => a.walkInRates.length > 0);
1914
+ const hasSpecials = data.specials.length > 0;
1915
+ if (!hasWalkIn && !hasSpecials) {
1916
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontFamily: token("fontFamily"), color: token("colorMuted") }, children: labels?.empty ?? "Pricing isn't published yet." });
1917
+ }
1918
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1919
+ "div",
1920
+ {
1921
+ className,
1922
+ style: {
1923
+ fontFamily: token("fontFamily"),
1924
+ color: token("colorText"),
1925
+ background: token("colorBg"),
1926
+ ...style
1927
+ },
1928
+ children: [
1929
+ labels?.heading && /* @__PURE__ */ jsxRuntime.jsx("h3", { style: { margin: "0 0 1rem" }, children: labels.heading }),
1930
+ hasSpecials && /* @__PURE__ */ jsxRuntime.jsxs("section", { style: { marginBottom: "1.75rem" }, children: [
1931
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { style: { margin: "0 0 0.75rem", fontSize: "1.15rem" }, children: labels?.specialsHeading ?? "Specials" }),
1932
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: "0.6rem" }, children: data.specials.map((s) => /* @__PURE__ */ jsxRuntime.jsx(SpecialCard, { s }, s.planId)) })
1933
+ ] }),
1934
+ !specialsOnly && hasWalkIn && /* @__PURE__ */ jsxRuntime.jsxs("section", { children: [
1935
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { style: { margin: "0 0 0.75rem", fontSize: "1.15rem" }, children: labels?.walkInHeading ?? "Walk-in rates" }),
1936
+ data.attractions.map((a) => /* @__PURE__ */ jsxRuntime.jsx(AttractionRates, { a }, a.attractionId))
1937
+ ] })
1938
+ ]
1939
+ }
1940
+ );
1941
+ }
1942
+
1697
1943
  exports.AccountDashboard = AccountDashboard;
1698
1944
  exports.AccountMenu = AccountMenu;
1699
1945
  exports.AuthForm = AuthForm;
@@ -1704,7 +1950,9 @@ exports.BookingFlow = BookingFlow;
1704
1950
  exports.BowlosTheme = BowlosTheme;
1705
1951
  exports.FlashSale = FlashSale;
1706
1952
  exports.FlashSaleIndex = FlashSaleIndex;
1953
+ exports.InquiryForm = InquiryForm;
1707
1954
  exports.MaintenanceBanner = MaintenanceBanner;
1955
+ exports.PricingTable = PricingTable;
1708
1956
  exports.formatCents = formatCents;
1709
1957
  exports.formatCentsRange = formatCentsRange;
1710
1958
  //# sourceMappingURL=components.cjs.map