@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.
@@ -1,9 +1,10 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { CSSProperties, ReactNode } from 'react';
3
- import { m as PublicSurface, g as CatalogItem } from './catalog-BdOZC2nx.cjs';
4
- export { h as CatalogResult, i as CatalogSection } from './catalog-BdOZC2nx.cjs';
3
+ import { m as PublicSurface, g as CatalogItem } from './catalog-LU1sl0gc.cjs';
4
+ export { h as CatalogResult, i as CatalogSection } from './catalog-LU1sl0gc.cjs';
5
5
  import { U as PricingMode, S as PaymentIntentInfo, l as Customer } from './data-BzO2guh0.cjs';
6
- import { d as UseAccountResult } from './react-CYgFZdHO.cjs';
6
+ import { d as UseAccountResult } from './react-CX-zIAb5.cjs';
7
+ import { InquiryFormType } from '@bowlos/shared';
7
8
 
8
9
  /**
9
10
  * Themeable design tokens for the `@bowlos/reservations/components` layer.
@@ -526,4 +527,46 @@ declare function formatCents(cents: number): string;
526
527
  /** A min–max money range, collapsing to one value when they're equal. */
527
528
  declare function formatCentsRange(minCents: number, maxCents: number): string;
528
529
 
529
- export { AccountDashboard, type AccountDashboardLabels, type AccountDashboardProps, AccountMenu, type AccountMenuLabels, type AccountMenuProps, type AccountSection, AuthForm, AuthGate, type AuthGateLabels, type AuthGateProps, type AuthGateRenderContext, BOWLOS_DEFAULT_THEME, BookingCatalog, type BookingCatalogLabels, type BookingCatalogProps, BookingFlow, type BookingFlowLabels, type BookingFlowProps, BowlosTheme, type BowlosThemeTokens, CatalogItem, type FlashBrand, FlashSale, FlashSaleIndex, type FlashSaleIndexItem, type FlashSaleIndexLabels, type FlashSaleIndexProps, type FlashSaleIndexView, type FlashSaleItem, type FlashSaleLabels, type FlashSaleProps, type FlashSaleView, MaintenanceBanner, type MaintenanceBannerProps, type MyCreditEntry, type MyCredits, type MyLoyalty, type MyMembershipSummary, type MyPass, type MyReservationSummary, formatCents, formatCentsRange };
530
+ /**
531
+ * Inquiry forms ("No Dead Ends" #3) — a headless-first contact / party-inquiry
532
+ * form. Renders the fields for `formType` from the shared registry and POSTs
533
+ * `{ formType, fields }` to the center site's OWN server route (`action`), which
534
+ * signs + forwards to BowlOS via `forwardInquiry`. Intentionally minimal markup
535
+ * + a `className` passthrough so it inherits the site's design; pass `inputStyle`
536
+ * / `labelStyle` to theme without forking. Includes a hidden honeypot the server
537
+ * drops as spam.
538
+ */
539
+ interface InquiryFormProps {
540
+ formType: InquiryFormType;
541
+ /** The site's own server route that signs + forwards (calls forwardInquiry). */
542
+ action: string;
543
+ onSuccess?: () => void;
544
+ submitLabel?: string;
545
+ successMessage?: string;
546
+ className?: string;
547
+ fieldStyle?: CSSProperties;
548
+ labelStyle?: CSSProperties;
549
+ inputStyle?: CSSProperties;
550
+ }
551
+ declare function InquiryForm({ formType, action, onSuccess, submitLabel, successMessage, className, fieldStyle, labelStyle, inputStyle, }: InquiryFormProps): react_jsx_runtime.JSX.Element;
552
+
553
+ interface PricingTableLabels {
554
+ heading?: string;
555
+ walkInHeading?: string;
556
+ specialsHeading?: string;
557
+ dayCol?: string;
558
+ timeCol?: string;
559
+ loading?: string;
560
+ empty?: string;
561
+ }
562
+ interface PricingTableProps {
563
+ centerId: string;
564
+ /** Hide the walk-in matrix and show only website specials. */
565
+ specialsOnly?: boolean;
566
+ labels?: PricingTableLabels;
567
+ className?: string;
568
+ style?: CSSProperties;
569
+ }
570
+ declare function PricingTable({ centerId, specialsOnly, labels, className, style, }: PricingTableProps): react_jsx_runtime.JSX.Element | null;
571
+
572
+ export { AccountDashboard, type AccountDashboardLabels, type AccountDashboardProps, AccountMenu, type AccountMenuLabels, type AccountMenuProps, type AccountSection, AuthForm, AuthGate, type AuthGateLabels, type AuthGateProps, type AuthGateRenderContext, BOWLOS_DEFAULT_THEME, BookingCatalog, type BookingCatalogLabels, type BookingCatalogProps, BookingFlow, type BookingFlowLabels, type BookingFlowProps, BowlosTheme, type BowlosThemeTokens, CatalogItem, type FlashBrand, FlashSale, FlashSaleIndex, type FlashSaleIndexItem, type FlashSaleIndexLabels, type FlashSaleIndexProps, type FlashSaleIndexView, type FlashSaleItem, type FlashSaleLabels, type FlashSaleProps, type FlashSaleView, InquiryForm, type InquiryFormProps, MaintenanceBanner, type MaintenanceBannerProps, type MyCreditEntry, type MyCredits, type MyLoyalty, type MyMembershipSummary, type MyPass, type MyReservationSummary, PricingTable, type PricingTableLabels, type PricingTableProps, formatCents, formatCentsRange };
@@ -1,9 +1,10 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { CSSProperties, ReactNode } from 'react';
3
- import { m as PublicSurface, g as CatalogItem } from './catalog-C-YyKVk5.js';
4
- export { h as CatalogResult, i as CatalogSection } from './catalog-C-YyKVk5.js';
3
+ import { m as PublicSurface, g as CatalogItem } from './catalog-Ck_HLOff.js';
4
+ export { h as CatalogResult, i as CatalogSection } from './catalog-Ck_HLOff.js';
5
5
  import { U as PricingMode, S as PaymentIntentInfo, l as Customer } from './data-BzO2guh0.js';
6
- import { d as UseAccountResult } from './react-BQaKMnCR.js';
6
+ import { d as UseAccountResult } from './react-RNgTkCVk.js';
7
+ import { InquiryFormType } from '@bowlos/shared';
7
8
 
8
9
  /**
9
10
  * Themeable design tokens for the `@bowlos/reservations/components` layer.
@@ -526,4 +527,46 @@ declare function formatCents(cents: number): string;
526
527
  /** A min–max money range, collapsing to one value when they're equal. */
527
528
  declare function formatCentsRange(minCents: number, maxCents: number): string;
528
529
 
529
- export { AccountDashboard, type AccountDashboardLabels, type AccountDashboardProps, AccountMenu, type AccountMenuLabels, type AccountMenuProps, type AccountSection, AuthForm, AuthGate, type AuthGateLabels, type AuthGateProps, type AuthGateRenderContext, BOWLOS_DEFAULT_THEME, BookingCatalog, type BookingCatalogLabels, type BookingCatalogProps, BookingFlow, type BookingFlowLabels, type BookingFlowProps, BowlosTheme, type BowlosThemeTokens, CatalogItem, type FlashBrand, FlashSale, FlashSaleIndex, type FlashSaleIndexItem, type FlashSaleIndexLabels, type FlashSaleIndexProps, type FlashSaleIndexView, type FlashSaleItem, type FlashSaleLabels, type FlashSaleProps, type FlashSaleView, MaintenanceBanner, type MaintenanceBannerProps, type MyCreditEntry, type MyCredits, type MyLoyalty, type MyMembershipSummary, type MyPass, type MyReservationSummary, formatCents, formatCentsRange };
530
+ /**
531
+ * Inquiry forms ("No Dead Ends" #3) — a headless-first contact / party-inquiry
532
+ * form. Renders the fields for `formType` from the shared registry and POSTs
533
+ * `{ formType, fields }` to the center site's OWN server route (`action`), which
534
+ * signs + forwards to BowlOS via `forwardInquiry`. Intentionally minimal markup
535
+ * + a `className` passthrough so it inherits the site's design; pass `inputStyle`
536
+ * / `labelStyle` to theme without forking. Includes a hidden honeypot the server
537
+ * drops as spam.
538
+ */
539
+ interface InquiryFormProps {
540
+ formType: InquiryFormType;
541
+ /** The site's own server route that signs + forwards (calls forwardInquiry). */
542
+ action: string;
543
+ onSuccess?: () => void;
544
+ submitLabel?: string;
545
+ successMessage?: string;
546
+ className?: string;
547
+ fieldStyle?: CSSProperties;
548
+ labelStyle?: CSSProperties;
549
+ inputStyle?: CSSProperties;
550
+ }
551
+ declare function InquiryForm({ formType, action, onSuccess, submitLabel, successMessage, className, fieldStyle, labelStyle, inputStyle, }: InquiryFormProps): react_jsx_runtime.JSX.Element;
552
+
553
+ interface PricingTableLabels {
554
+ heading?: string;
555
+ walkInHeading?: string;
556
+ specialsHeading?: string;
557
+ dayCol?: string;
558
+ timeCol?: string;
559
+ loading?: string;
560
+ empty?: string;
561
+ }
562
+ interface PricingTableProps {
563
+ centerId: string;
564
+ /** Hide the walk-in matrix and show only website specials. */
565
+ specialsOnly?: boolean;
566
+ labels?: PricingTableLabels;
567
+ className?: string;
568
+ style?: CSSProperties;
569
+ }
570
+ declare function PricingTable({ centerId, specialsOnly, labels, className, style, }: PricingTableProps): react_jsx_runtime.JSX.Element | null;
571
+
572
+ export { AccountDashboard, type AccountDashboardLabels, type AccountDashboardProps, AccountMenu, type AccountMenuLabels, type AccountMenuProps, type AccountSection, AuthForm, AuthGate, type AuthGateLabels, type AuthGateProps, type AuthGateRenderContext, BOWLOS_DEFAULT_THEME, BookingCatalog, type BookingCatalogLabels, type BookingCatalogProps, BookingFlow, type BookingFlowLabels, type BookingFlowProps, BowlosTheme, type BowlosThemeTokens, CatalogItem, type FlashBrand, FlashSale, FlashSaleIndex, type FlashSaleIndexItem, type FlashSaleIndexLabels, type FlashSaleIndexProps, type FlashSaleIndexView, type FlashSaleItem, type FlashSaleLabels, type FlashSaleProps, type FlashSaleView, InquiryForm, type InquiryFormProps, MaintenanceBanner, type MaintenanceBannerProps, type MyCreditEntry, type MyCredits, type MyLoyalty, type MyMembershipSummary, type MyPass, type MyReservationSummary, PricingTable, type PricingTableLabels, type PricingTableProps, formatCents, formatCentsRange };
@@ -1,4 +1,5 @@
1
- import { useTestMode, useAccount, useAvailability, useBookingPreview, useAddons, useStartTimes, useBookingFlow, useMyReservations, useMyMemberships, useMyLoyalty, useMyCredits, useMyPasses, useFlashSale, useFlashSales, useCatalog } from './chunk-44AWSRIG.js';
1
+ import { INQUIRY_FORMS } from './chunk-EQH5HDYQ.js';
2
+ import { useTestMode, useAccount, useAvailability, useBookingPreview, useAddons, useStartTimes, useBookingFlow, useMyReservations, useMyMemberships, useMyLoyalty, useMyCredits, useMyPasses, useFlashSale, useFlashSales, useCatalog, useRetailPricing } from './chunk-S5GEG7SW.js';
2
3
  import { availableUnitCount } from './chunk-P5YWNLEC.js';
3
4
  import { token, styles, formatCents, formatMinuteLabel, minutesToTime, useCountdown, formatCentsRange } from './chunk-Y3YSDO3H.js';
4
5
  export { BOWLOS_DEFAULT_THEME, BowlosTheme, formatCents, formatCentsRange } from './chunk-Y3YSDO3H.js';
@@ -1154,7 +1155,223 @@ function formatDay(iso) {
1154
1155
  timeZone: "UTC"
1155
1156
  });
1156
1157
  }
1158
+ var HONEYPOT_STYLE = {
1159
+ position: "absolute",
1160
+ left: "-9999px",
1161
+ width: 1,
1162
+ height: 1,
1163
+ opacity: 0
1164
+ };
1165
+ function InquiryForm({
1166
+ formType,
1167
+ action,
1168
+ onSuccess,
1169
+ submitLabel = "Send",
1170
+ successMessage = "Thanks \u2014 we\u2019ll be in touch shortly.",
1171
+ className,
1172
+ fieldStyle,
1173
+ labelStyle,
1174
+ inputStyle
1175
+ }) {
1176
+ const def = INQUIRY_FORMS[formType];
1177
+ const [values, setValues] = useState({});
1178
+ const [status, setStatus] = useState("idle");
1179
+ const [error, setError] = useState(null);
1180
+ const set = (key, val) => setValues((v) => ({ ...v, [key]: val }));
1181
+ const onSubmit = async (e) => {
1182
+ e.preventDefault();
1183
+ setStatus("submitting");
1184
+ setError(null);
1185
+ try {
1186
+ const res = await fetch(action, {
1187
+ method: "POST",
1188
+ headers: { "content-type": "application/json" },
1189
+ body: JSON.stringify({ formType, fields: values })
1190
+ });
1191
+ if (!res.ok) {
1192
+ setStatus("error");
1193
+ setError("Something went wrong. Please try again.");
1194
+ return;
1195
+ }
1196
+ setStatus("done");
1197
+ onSuccess?.();
1198
+ } catch {
1199
+ setStatus("error");
1200
+ setError("Network error. Please try again.");
1201
+ }
1202
+ };
1203
+ if (status === "done") {
1204
+ return /* @__PURE__ */ jsx("p", { className, children: successMessage });
1205
+ }
1206
+ return /* @__PURE__ */ jsxs("form", { className, onSubmit, children: [
1207
+ def.fields.map((f) => {
1208
+ const multiline = f.key === "message" || f.key === "notes";
1209
+ return /* @__PURE__ */ jsxs("div", { style: fieldStyle, children: [
1210
+ /* @__PURE__ */ jsxs("label", { style: { display: "block", ...labelStyle }, children: [
1211
+ f.label,
1212
+ f.required ? " *" : ""
1213
+ ] }),
1214
+ multiline ? /* @__PURE__ */ jsx(
1215
+ "textarea",
1216
+ {
1217
+ required: f.required,
1218
+ value: values[f.key] ?? "",
1219
+ onChange: (e) => set(f.key, e.target.value),
1220
+ style: inputStyle
1221
+ }
1222
+ ) : /* @__PURE__ */ jsx(
1223
+ "input",
1224
+ {
1225
+ type: f.key === "email" ? "email" : "text",
1226
+ required: f.required,
1227
+ value: values[f.key] ?? "",
1228
+ onChange: (e) => set(f.key, e.target.value),
1229
+ style: inputStyle
1230
+ }
1231
+ )
1232
+ ] }, f.key);
1233
+ }),
1234
+ /* @__PURE__ */ jsx(
1235
+ "input",
1236
+ {
1237
+ type: "text",
1238
+ name: "_honeypot",
1239
+ tabIndex: -1,
1240
+ autoComplete: "off",
1241
+ "aria-hidden": "true",
1242
+ style: HONEYPOT_STYLE,
1243
+ value: values._honeypot ?? "",
1244
+ onChange: (e) => set("_honeypot", e.target.value)
1245
+ }
1246
+ ),
1247
+ error && /* @__PURE__ */ jsx("p", { role: "alert", children: error }),
1248
+ /* @__PURE__ */ jsx("button", { type: "submit", disabled: status === "submitting", children: status === "submitting" ? "Sending\u2026" : submitLabel })
1249
+ ] });
1250
+ }
1251
+ var DAY_NAMES = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
1252
+ function fmtMinute(m) {
1253
+ const hh = Math.floor(m / 60) % 24;
1254
+ const mm = m % 60;
1255
+ const ampm = hh < 12 ? "AM" : "PM";
1256
+ const h12 = hh % 12 === 0 ? 12 : hh % 12;
1257
+ return mm === 0 ? `${h12} ${ampm}` : `${h12}:${String(mm).padStart(2, "0")} ${ampm}`;
1258
+ }
1259
+ function rateForMode(r, mode) {
1260
+ switch (mode) {
1261
+ case "per_unit_per_hour":
1262
+ return r.rateUnitHourCents;
1263
+ case "per_person_per_hour":
1264
+ return r.ratePersonHourCents;
1265
+ case "per_game":
1266
+ return r.rateGameCents;
1267
+ }
1268
+ }
1269
+ function modeLabel(mode, unitPlural) {
1270
+ switch (mode) {
1271
+ case "per_unit_per_hour":
1272
+ return `Per ${unitPlural.replace(/s$/, "")}/hr`;
1273
+ case "per_person_per_hour":
1274
+ return "Per person/hr";
1275
+ case "per_game":
1276
+ return "Per game";
1277
+ }
1278
+ }
1279
+ function AttractionRates({ a }) {
1280
+ if (a.walkInRates.length === 0) return null;
1281
+ const modes = a.enabledModes;
1282
+ return /* @__PURE__ */ jsxs("div", { style: { marginBottom: "1.5rem" }, children: [
1283
+ /* @__PURE__ */ jsx("h4", { style: { margin: "0 0 0.5rem", fontSize: "1.05rem" }, children: a.name }),
1284
+ /* @__PURE__ */ jsxs("table", { style: { width: "100%", borderCollapse: "collapse", fontSize: "0.95rem" }, children: [
1285
+ /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { style: { textAlign: "left", color: token("colorMuted") }, children: [
1286
+ /* @__PURE__ */ jsx("th", { style: { padding: "0.35rem 0.5rem" }, children: "Day" }),
1287
+ /* @__PURE__ */ jsx("th", { style: { padding: "0.35rem 0.5rem" }, children: "Time" }),
1288
+ modes.map((m) => /* @__PURE__ */ jsx("th", { style: { padding: "0.35rem 0.5rem", textAlign: "right" }, children: modeLabel(m, a.unitLabelPlural) }, m))
1289
+ ] }) }),
1290
+ /* @__PURE__ */ jsx("tbody", { children: a.walkInRates.map((r, i) => /* @__PURE__ */ jsxs(
1291
+ "tr",
1292
+ {
1293
+ style: { borderTop: `1px solid ${token("colorBorder")}` },
1294
+ children: [
1295
+ /* @__PURE__ */ jsx("td", { style: { padding: "0.35rem 0.5rem" }, children: DAY_NAMES[r.dayOfWeek] }),
1296
+ /* @__PURE__ */ jsx("td", { style: { padding: "0.35rem 0.5rem" }, children: r.label ?? `${fmtMinute(r.startMinuteOfDay)} \u2013 ${fmtMinute(r.endMinuteOfDay)}` }),
1297
+ modes.map((m) => {
1298
+ const cents = rateForMode(r, m);
1299
+ return /* @__PURE__ */ jsx("td", { style: { padding: "0.35rem 0.5rem", textAlign: "right" }, children: cents === null ? "\u2014" : formatCents(cents) }, m);
1300
+ })
1301
+ ]
1302
+ },
1303
+ i
1304
+ )) })
1305
+ ] })
1306
+ ] });
1307
+ }
1308
+ function SpecialCard({ s }) {
1309
+ return /* @__PURE__ */ jsxs(
1310
+ "div",
1311
+ {
1312
+ style: {
1313
+ border: `1px solid ${token("colorBorder")}`,
1314
+ borderRadius: token("radius"),
1315
+ background: token("colorSurface"),
1316
+ padding: "0.85rem 1rem",
1317
+ display: "flex",
1318
+ justifyContent: "space-between",
1319
+ gap: "1rem",
1320
+ alignItems: "baseline"
1321
+ },
1322
+ children: [
1323
+ /* @__PURE__ */ jsxs("div", { children: [
1324
+ /* @__PURE__ */ jsx("div", { style: { fontWeight: 600 }, children: s.name }),
1325
+ /* @__PURE__ */ jsx("div", { style: { color: token("colorMuted"), fontSize: "0.9rem" }, children: s.description }),
1326
+ /* @__PURE__ */ jsx("div", { style: { color: token("colorMuted"), fontSize: "0.8rem" }, children: s.attractionName })
1327
+ ] }),
1328
+ s.priceCents !== null && /* @__PURE__ */ jsx("div", { style: { fontWeight: 700, color: token("colorPrimary"), whiteSpace: "nowrap" }, children: formatCents(s.priceCents) })
1329
+ ]
1330
+ }
1331
+ );
1332
+ }
1333
+ function PricingTable({
1334
+ centerId,
1335
+ specialsOnly = false,
1336
+ labels,
1337
+ className,
1338
+ style
1339
+ }) {
1340
+ const { data, loading } = useRetailPricing({ centerId });
1341
+ if (loading && !data) {
1342
+ return /* @__PURE__ */ jsx("div", { style: { fontFamily: token("fontFamily"), color: token("colorMuted") }, children: labels?.loading ?? "Loading pricing\u2026" });
1343
+ }
1344
+ if (!data) return null;
1345
+ const hasWalkIn = data.attractions.some((a) => a.walkInRates.length > 0);
1346
+ const hasSpecials = data.specials.length > 0;
1347
+ if (!hasWalkIn && !hasSpecials) {
1348
+ return /* @__PURE__ */ jsx("div", { style: { fontFamily: token("fontFamily"), color: token("colorMuted") }, children: labels?.empty ?? "Pricing isn't published yet." });
1349
+ }
1350
+ return /* @__PURE__ */ jsxs(
1351
+ "div",
1352
+ {
1353
+ className,
1354
+ style: {
1355
+ fontFamily: token("fontFamily"),
1356
+ color: token("colorText"),
1357
+ background: token("colorBg"),
1358
+ ...style
1359
+ },
1360
+ children: [
1361
+ labels?.heading && /* @__PURE__ */ jsx("h3", { style: { margin: "0 0 1rem" }, children: labels.heading }),
1362
+ hasSpecials && /* @__PURE__ */ jsxs("section", { style: { marginBottom: "1.75rem" }, children: [
1363
+ /* @__PURE__ */ jsx("h3", { style: { margin: "0 0 0.75rem", fontSize: "1.15rem" }, children: labels?.specialsHeading ?? "Specials" }),
1364
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: "0.6rem" }, children: data.specials.map((s) => /* @__PURE__ */ jsx(SpecialCard, { s }, s.planId)) })
1365
+ ] }),
1366
+ !specialsOnly && hasWalkIn && /* @__PURE__ */ jsxs("section", { children: [
1367
+ /* @__PURE__ */ jsx("h3", { style: { margin: "0 0 0.75rem", fontSize: "1.15rem" }, children: labels?.walkInHeading ?? "Walk-in rates" }),
1368
+ data.attractions.map((a) => /* @__PURE__ */ jsx(AttractionRates, { a }, a.attractionId))
1369
+ ] })
1370
+ ]
1371
+ }
1372
+ );
1373
+ }
1157
1374
 
1158
- export { AccountDashboard, AccountMenu, AuthForm, AuthGate, BookingCatalog, BookingFlow, FlashSale, FlashSaleIndex, MaintenanceBanner };
1375
+ export { AccountDashboard, AccountMenu, AuthForm, AuthGate, BookingCatalog, BookingFlow, FlashSale, FlashSaleIndex, InquiryForm, MaintenanceBanner, PricingTable };
1159
1376
  //# sourceMappingURL=components.js.map
1160
1377
  //# sourceMappingURL=components.js.map