@bowlos/reservations 0.43.0 → 1.0.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.
Files changed (56) hide show
  1. package/AGENTS.md +14 -5
  2. package/CHANGELOG.md +22 -0
  3. package/HEADLESS.md +126 -41
  4. package/README.md +16 -0
  5. package/dist/{account-B4sZBmPI.d.cts → account-b8chVpED.d.cts} +27 -1
  6. package/dist/{account-B4sZBmPI.d.ts → account-b8chVpED.d.ts} +27 -1
  7. package/dist/{booking-change-DzYs9133.d.ts → booking-change-B-ADuVEz.d.cts} +77 -2
  8. package/dist/{booking-change-Dd4PVgd3.d.cts → booking-change-BrJ-XESC.d.ts} +77 -2
  9. package/dist/chunk-43WZ6TLQ.js +12 -0
  10. package/dist/chunk-43WZ6TLQ.js.map +1 -0
  11. package/dist/{chunk-4JMGS4YB.js → chunk-CTJODEHR.js} +27 -6
  12. package/dist/chunk-CTJODEHR.js.map +1 -0
  13. package/dist/{chunk-YAXBZJMI.js → chunk-EPYGIJRJ.js} +20 -3
  14. package/dist/chunk-EPYGIJRJ.js.map +1 -0
  15. package/dist/{chunk-YQRTBGXU.js → chunk-EXEKCMQ2.js} +57 -22
  16. package/dist/chunk-EXEKCMQ2.js.map +1 -0
  17. package/dist/{chunk-V4JRDYW4.js → chunk-IDRTMFJJ.js} +8 -3
  18. package/dist/chunk-IDRTMFJJ.js.map +1 -0
  19. package/dist/{chunk-T2E6AEC7.js → chunk-LFFANITL.js} +4 -11
  20. package/dist/chunk-LFFANITL.js.map +1 -0
  21. package/dist/components.cjs +357 -131
  22. package/dist/components.cjs.map +1 -1
  23. package/dist/components.d.cts +11 -5
  24. package/dist/components.d.ts +11 -5
  25. package/dist/components.js +200 -65
  26. package/dist/components.js.map +1 -1
  27. package/dist/index.cjs +34 -0
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.d.cts +4 -4
  30. package/dist/index.d.ts +4 -4
  31. package/dist/index.js +5 -4
  32. package/dist/index.js.map +1 -1
  33. package/dist/payments.cjs.map +1 -1
  34. package/dist/payments.d.cts +1 -1
  35. package/dist/payments.d.ts +1 -1
  36. package/dist/payments.js +5 -4
  37. package/dist/payments.js.map +1 -1
  38. package/dist/{react-C6NWC80d.d.cts → react-cqGEohr0.d.cts} +4 -2
  39. package/dist/{react-DVdtpw5n.d.ts → react-s4J-e10i.d.ts} +4 -2
  40. package/dist/react.cjs +90 -19
  41. package/dist/react.cjs.map +1 -1
  42. package/dist/react.d.cts +11 -5
  43. package/dist/react.d.ts +11 -5
  44. package/dist/react.js +5 -5
  45. package/package.json +2 -1
  46. package/templates/center-site/README.md +1 -0
  47. package/templates/center-site/app/book/event-reservation-form.tsx +276 -0
  48. package/templates/center-site/app/book/page.tsx +107 -49
  49. package/templates/center-site/app/catalog/page.tsx +3 -1
  50. package/templates/center-site/app/events/[slug]/page.tsx +7 -10
  51. package/templates/center-site/package.json +1 -1
  52. package/dist/chunk-4JMGS4YB.js.map +0 -1
  53. package/dist/chunk-T2E6AEC7.js.map +0 -1
  54. package/dist/chunk-V4JRDYW4.js.map +0 -1
  55. package/dist/chunk-YAXBZJMI.js.map +0 -1
  56. package/dist/chunk-YQRTBGXU.js.map +0 -1
@@ -1,9 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { CSSProperties, ReactNode } from 'react';
3
- import { Y as PublicSurface, D as CatalogItem, N as EventOffer, l as GetWalletPassUrlArgs, p as BookingChangePayment } from './booking-change-Dd4PVgd3.cjs';
4
- export { F as CatalogResult, H as CatalogSection } from './booking-change-Dd4PVgd3.cjs';
5
- import { b3 as PricingMode, b1 as PaymentIntentInfo, an as Customer, b9 as SavedCardScope, aG as JoinWaitlistArgs } from './account-B4sZBmPI.cjs';
6
- import { d as UseAccountResult } from './react-C6NWC80d.cjs';
3
+ import { a1 as PublicSurface, N as EventOffer, D as CatalogItem, l as GetWalletPassUrlArgs, p as BookingChangePayment } from './booking-change-B-ADuVEz.cjs';
4
+ export { F as CatalogResult, H as CatalogSection } from './booking-change-B-ADuVEz.cjs';
5
+ import { b5 as PricingMode, a7 as BookingAddonSelection, b3 as PaymentIntentInfo, an as Customer, bb as SavedCardScope, aI as JoinWaitlistArgs } from './account-b8chVpED.cjs';
6
+ import { d as UseAccountResult } from './react-cqGEohr0.cjs';
7
7
  import { InquiryFormType } from '@bowlos/shared';
8
8
 
9
9
  /**
@@ -102,6 +102,12 @@ interface BookingFlowProps {
102
102
  productId: string;
103
103
  pricingMode?: PricingMode;
104
104
  durationMinutes?: number;
105
+ /** Reservation-mode offer from the gateway. Pass the offer even when its session is unavailable. */
106
+ eventOffer?: Pick<EventOffer, "slug" | "session"> & {
107
+ includedAddons?: readonly BookingAddonSelection[];
108
+ /** Supply the configured shoe add-on ID when the product has no public detail. */
109
+ defaultShoeAddonId?: string | null;
110
+ };
105
111
  defaultDateISO?: string;
106
112
  defaultStartMinuteOfDay?: number;
107
113
  /**
@@ -147,7 +153,7 @@ interface BookingFlowProps {
147
153
  * signed-in customer) and pay-to-confirm by default. Built on `useBookingFlow`.
148
154
  * Must render inside a `<BowlosProvider>`; theme with `<BowlosTheme>`. White-label.
149
155
  */
150
- declare function BookingFlow({ centerId, productId, pricingMode, durationMinutes, defaultDateISO, defaultStartMinuteOfDay, renderPayment, onConfirmed, unitLabel, completeSaleOnly, accountHref, labels, className, }: BookingFlowProps): react_jsx_runtime.JSX.Element;
156
+ declare function BookingFlow(props: BookingFlowProps): react_jsx_runtime.JSX.Element;
151
157
 
152
158
  /** Visible strings — override any subset for copy/i18n. */
153
159
  interface AuthGateLabels {
@@ -1,9 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { CSSProperties, ReactNode } from 'react';
3
- import { Y as PublicSurface, D as CatalogItem, N as EventOffer, l as GetWalletPassUrlArgs, p as BookingChangePayment } from './booking-change-DzYs9133.js';
4
- export { F as CatalogResult, H as CatalogSection } from './booking-change-DzYs9133.js';
5
- import { b3 as PricingMode, b1 as PaymentIntentInfo, an as Customer, b9 as SavedCardScope, aG as JoinWaitlistArgs } from './account-B4sZBmPI.js';
6
- import { d as UseAccountResult } from './react-DVdtpw5n.js';
3
+ import { a1 as PublicSurface, N as EventOffer, D as CatalogItem, l as GetWalletPassUrlArgs, p as BookingChangePayment } from './booking-change-BrJ-XESC.js';
4
+ export { F as CatalogResult, H as CatalogSection } from './booking-change-BrJ-XESC.js';
5
+ import { b5 as PricingMode, a7 as BookingAddonSelection, b3 as PaymentIntentInfo, an as Customer, bb as SavedCardScope, aI as JoinWaitlistArgs } from './account-b8chVpED.js';
6
+ import { d as UseAccountResult } from './react-s4J-e10i.js';
7
7
  import { InquiryFormType } from '@bowlos/shared';
8
8
 
9
9
  /**
@@ -102,6 +102,12 @@ interface BookingFlowProps {
102
102
  productId: string;
103
103
  pricingMode?: PricingMode;
104
104
  durationMinutes?: number;
105
+ /** Reservation-mode offer from the gateway. Pass the offer even when its session is unavailable. */
106
+ eventOffer?: Pick<EventOffer, "slug" | "session"> & {
107
+ includedAddons?: readonly BookingAddonSelection[];
108
+ /** Supply the configured shoe add-on ID when the product has no public detail. */
109
+ defaultShoeAddonId?: string | null;
110
+ };
105
111
  defaultDateISO?: string;
106
112
  defaultStartMinuteOfDay?: number;
107
113
  /**
@@ -147,7 +153,7 @@ interface BookingFlowProps {
147
153
  * signed-in customer) and pay-to-confirm by default. Built on `useBookingFlow`.
148
154
  * Must render inside a `<BowlosProvider>`; theme with `<BowlosTheme>`. White-label.
149
155
  */
150
- declare function BookingFlow({ centerId, productId, pricingMode, durationMinutes, defaultDateISO, defaultStartMinuteOfDay, renderPayment, onConfirmed, unitLabel, completeSaleOnly, accountHref, labels, className, }: BookingFlowProps): react_jsx_runtime.JSX.Element;
156
+ declare function BookingFlow(props: BookingFlowProps): react_jsx_runtime.JSX.Element;
151
157
 
152
158
  /** Visible strings — override any subset for copy/i18n. */
153
159
  interface AuthGateLabels {
@@ -1,12 +1,13 @@
1
- import { INQUIRY_FORMS } from './chunk-YAXBZJMI.js';
2
- import { useBookingFlow, useCenters, useMyGameCardHistory, useWalletPassUrl, useUpdateMyProfile, useMyCommunicationPrefs, useSetMyCommunicationPref, useAccountDeletion, useMyMembershipMembers, useAddMyMembershipMember, useCancelMyMembership, useOpenMembershipBillingPortal, useBookingChange, useWaitlistJoin, useMyPackageOrders } from './chunk-4JMGS4YB.js';
1
+ import { durationsForStart, isFixedSession, formatSessionRange, INQUIRY_FORMS } from './chunk-EPYGIJRJ.js';
2
+ import { useSlotPrices, useProduct, useBookingFlow, useCenters, useMyGameCardHistory, useWalletPassUrl, useUpdateMyProfile, useMyCommunicationPrefs, useSetMyCommunicationPref, useAccountDeletion, useMyMembershipMembers, useAddMyMembershipMember, useCancelMyMembership, useOpenMembershipBillingPortal, useBookingChange, useWaitlistJoin, useMyPackageOrders } from './chunk-CTJODEHR.js';
3
3
  import './chunk-I37IJNYU.js';
4
- import { token, styles, formatCents, formatMinuteLabel, AccountPanel, QueryState, useAccountAction, minutesToTime, useCountdown, formatCentsRange, timeToMinutes, AddCardForm } from './chunk-T2E6AEC7.js';
5
- export { BOWLOS_DEFAULT_THEME, BowlosTheme, formatCents, formatCentsRange } from './chunk-T2E6AEC7.js';
6
- import { useTestMode, useAccount, useAvailability, useBookingPreview, useAddons, useStartTimes, useSavedCards, useRemoveCard, useSetDefaultCard, useChangePassword, useBowlosMutation, useMyReservations, useMyMemberships, useMyLoyalty, useMyCredits, useMyPasses, useFlashSale, useFlashSales, useCatalog, useRetailPricing, useMyMembershipDetail, useMyGameCards, useMyEventOrders, useBowlosQuery } from './chunk-YQRTBGXU.js';
7
- import { availableUnitCount } from './chunk-V4JRDYW4.js';
4
+ import { token, styles, formatCents, AccountPanel, QueryState, useAccountAction, minutesToTime, useCountdown, formatCentsRange, timeToMinutes, AddCardForm } from './chunk-LFFANITL.js';
5
+ export { BOWLOS_DEFAULT_THEME, BowlosTheme, formatCents, formatCentsRange } from './chunk-LFFANITL.js';
6
+ import { formatMinuteLabel } from './chunk-43WZ6TLQ.js';
7
+ import { useTestMode, useAccount, useEventOfferOptions, useAddons, useAvailability, useBookingPreview, useStartTimes, useSavedCards, useRemoveCard, useSetDefaultCard, useChangePassword, useBowlosMutation, useMyReservations, useMyMemberships, useMyLoyalty, useMyCredits, useMyPasses, useFlashSale, useFlashSales, useCatalog, useRetailPricing, useMyMembershipDetail, useMyGameCards, useMyEventOrders, useBowlosQuery } from './chunk-EXEKCMQ2.js';
8
+ import { availableUnitCount } from './chunk-IDRTMFJJ.js';
8
9
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
9
- import { useState, useEffect, useMemo, useRef } from 'react';
10
+ import { useState, useEffect, useRef } from 'react';
10
11
 
11
12
  var DEFAULT_MESSAGE = "We're performing maintenance \u2014 online booking is temporarily unavailable. Please check back soon.";
12
13
  function MaintenanceBanner({
@@ -353,11 +354,22 @@ function formatDateLabel(dateISO) {
353
354
  day: "numeric"
354
355
  });
355
356
  }
356
- function BookingFlow({
357
+ function BookingFlow(props) {
358
+ const offer = props.eventOffer;
359
+ return /* @__PURE__ */ jsx(
360
+ BookingFlowContent,
361
+ {
362
+ ...props
363
+ },
364
+ offer ? JSON.stringify([offer.slug, props.centerId, props.productId, offer.session?.dateISO]) : "regular"
365
+ );
366
+ }
367
+ function BookingFlowContent({
357
368
  centerId,
358
369
  productId,
359
- pricingMode = "per_unit_per_hour",
360
- durationMinutes = 60,
370
+ pricingMode: defaultPricingMode = "per_unit_per_hour",
371
+ durationMinutes: defaultDurationMinutes = 60,
372
+ eventOffer,
361
373
  defaultDateISO = "",
362
374
  defaultStartMinuteOfDay = 18 * 60,
363
375
  renderPayment,
@@ -373,24 +385,71 @@ function BookingFlow({
373
385
  const signedIn = account.status === "linked" && account.customer !== null;
374
386
  const acctName = account.customer?.fullName ?? "";
375
387
  const acctEmail = account.customer?.email ?? "";
376
- const [dateISO, setDateISO] = useState(defaultDateISO);
388
+ const session = eventOffer?.session;
389
+ const eventOfferSlug = eventOffer?.slug.trim();
390
+ const pricingMode = session?.pricingMode ?? defaultPricingMode;
391
+ const [regularDate, setDateISO] = useState(defaultDateISO);
392
+ const dateISO = eventOffer ? session?.dateISO ?? "" : regularDate;
377
393
  useEffect(() => {
378
- if (!defaultDateISO && dateISO === "") setDateISO(todayISO());
379
- }, [defaultDateISO, dateISO]);
380
- const [startMinuteOfDay, setStartMinuteOfDay] = useState(defaultStartMinuteOfDay);
381
- const endMinuteOfDay = startMinuteOfDay + durationMinutes;
394
+ if (!eventOffer && !defaultDateISO && dateISO === "") setDateISO(todayISO());
395
+ }, [eventOffer, defaultDateISO, dateISO]);
396
+ const [pickedStart, setStartMinuteOfDay] = useState(defaultStartMinuteOfDay);
397
+ const [pickedDuration, setDuration] = useState(0);
382
398
  const [count, setCount] = useState(1);
399
+ const [bowlers, setBowlers] = useState(1);
400
+ const [games, setGames] = useState(1);
401
+ const partyCap = session?.maxPartySizePerUnit == null ? void 0 : session.maxPartySizePerUnit * count;
402
+ const persons = Math.min(bowlers, partyCap ?? Infinity);
403
+ const eventArgs = {
404
+ centerId,
405
+ productId,
406
+ dateISO,
407
+ eventOfferSlug: eventOfferSlug ?? "",
408
+ mode: pricingMode,
409
+ units: count,
410
+ persons,
411
+ ...pricingMode === "per_game" ? { games } : {}
412
+ };
413
+ const discovery = useEventOfferOptions(eventArgs, {
414
+ enabled: Boolean(session && eventOfferSlug),
415
+ auth: signedIn
416
+ });
417
+ const eventOptions = discovery.loading || discovery.error ? [] : discovery.data ?? [];
418
+ const eventStart = eventOptions.some((option) => option.startMinuteOfDay === pickedStart) ? pickedStart : eventOptions[0]?.startMinuteOfDay;
419
+ const startMinuteOfDay = eventOffer ? eventStart ?? 0 : pickedStart;
420
+ const durations = durationsForStart(eventOptions, startMinuteOfDay);
421
+ const durationMinutes = eventOffer ? durations.includes(pickedDuration) ? pickedDuration : durations[0] ?? 0 : defaultDurationMinutes;
422
+ const endMinuteOfDay = startMinuteOfDay + durationMinutes;
423
+ const eventSlotReady = Boolean(session && eventOfferSlug && eventStart !== void 0 && durationMinutes > 0);
424
+ const fixed = session != null && isFixedSession(session);
425
+ const slotPrices = useSlotPrices(
426
+ { ...eventArgs, duration: durationMinutes, slots: [startMinuteOfDay] },
427
+ { enabled: eventSlotReady, auth: signedIn }
428
+ );
429
+ const eventSlotUnavailable = slotPrices.data !== null && slotPrices.data[0]?.headlinePriceCents == null;
383
430
  const [payMessage, setPayMessage] = useState(null);
384
431
  const [reviewing, setReviewing] = useState(false);
385
- const [addonQtys, setAddonQtys] = useState({});
386
- const selectedAddons = useMemo(
387
- () => Object.entries(addonQtys).filter(([, q]) => q > 0).map(([addonId, quantity]) => ({ addonId, quantity })),
388
- [addonQtys]
432
+ const [addonQtys, setAddonQtys] = useState(
433
+ () => Object.fromEntries((eventOffer?.includedAddons ?? []).map(({ addonId, quantity }) => [addonId, quantity]))
434
+ );
435
+ const addons = useAddons({ productId }, { enabled: !eventOffer || Boolean(session && eventOfferSlug) });
436
+ const knownShoeId = session?.defaultShoeAddonId !== void 0 ? session.defaultShoeAddonId : eventOffer?.defaultShoeAddonId;
437
+ const needsShoeId = Boolean(
438
+ session?.shoesIncluded && knownShoeId === void 0 && addons.data?.length
389
439
  );
390
- const countArgs = pricingMode === "per_person_per_hour" ? { persons: count } : pricingMode === "per_game" ? { games: count } : { units: count };
440
+ const product = useProduct({ productId }, {
441
+ enabled: needsShoeId,
442
+ keepPreviousData: false
443
+ });
444
+ const shoeAddonId = knownShoeId !== void 0 ? knownShoeId : product.data?.defaultShoeAddonId;
445
+ const addonList = (addons.data ?? []).filter(
446
+ (addon) => !session?.shoesIncluded || shoeAddonId !== void 0 && addon.id !== shoeAddonId
447
+ );
448
+ const selectedAddons = Object.entries(addonQtys).filter(([id, quantity]) => quantity > 0 && (!eventOffer || addonList.some((addon) => addon.id === id))).map(([addonId, quantity]) => ({ addonId, quantity }));
449
+ const countArgs = eventOffer ? { units: count, persons, ...pricingMode === "per_game" ? { games } : {} } : pricingMode === "per_person_per_hour" ? { persons: count } : pricingMode === "per_game" ? { games: count } : { units: count };
391
450
  const availability = useAvailability(
392
451
  { productId, dateISO, startMinuteOfDay, endMinuteOfDay },
393
- { enabled: dateISO !== "" }
452
+ { enabled: !eventOffer && dateISO !== "" }
394
453
  );
395
454
  const preview = useBookingPreview(
396
455
  {
@@ -401,14 +460,14 @@ function BookingFlow({
401
460
  endMinuteOfDay,
402
461
  mode: pricingMode,
403
462
  ...countArgs,
463
+ ...eventOffer ? { eventOfferSlug } : {},
404
464
  addons: selectedAddons
405
465
  },
406
- { enabled: dateISO !== "", auth: signedIn }
466
+ { enabled: eventOffer ? eventSlotReady : dateISO !== "", auth: signedIn }
407
467
  );
408
- const addons = useAddons({ productId }, { enabled: true });
409
468
  const startTimes = useStartTimes(
410
469
  { productId, dateISO, durationMinutes, mode: pricingMode },
411
- { enabled: dateISO !== "" }
470
+ { enabled: !eventOffer && dateISO !== "" }
412
471
  );
413
472
  const flow = useBookingFlow();
414
473
  const onConfirmedRef = useRef(onConfirmed);
@@ -436,25 +495,25 @@ function BookingFlow({
436
495
  void prepareRef.current();
437
496
  }
438
497
  }, [completeSaleOnly, flow.status]);
439
- const bookingArgs = useMemo(
440
- () => ({
441
- centerId,
442
- productId,
443
- dateISO,
444
- startMinuteOfDay,
445
- endMinuteOfDay,
446
- mode: pricingMode,
447
- ...pricingMode === "per_person_per_hour" ? { persons: count } : pricingMode === "per_game" ? { games: count } : { units: count },
448
- addons: selectedAddons,
449
- // Always the signed-in customer — online booking requires login.
450
- customer: { fullName: acctName, email: acctEmail, marketingOptIn: false }
451
- }),
452
- [centerId, productId, dateISO, startMinuteOfDay, endMinuteOfDay, pricingMode, count, selectedAddons, acctName, acctEmail]
453
- );
498
+ const bookingArgs = {
499
+ centerId,
500
+ productId,
501
+ dateISO,
502
+ startMinuteOfDay,
503
+ endMinuteOfDay,
504
+ mode: pricingMode,
505
+ ...countArgs,
506
+ ...eventOffer ? { eventOfferSlug } : {},
507
+ addons: selectedAddons,
508
+ customer: { fullName: acctName, email: acctEmail, marketingOptIn: false }
509
+ };
454
510
  const availableUnits = availability.data ? availableUnitCount(availability.data) : null;
455
511
  const quoteCents = preview.data?.totalCentsPerPlan?.[0]?.totalCents ?? null;
456
- const addonList = addons.data ?? [];
457
- const startOptions = startTimes.data ?? [];
512
+ const startOptions = eventOffer ? eventOptions.map((option) => option.startMinuteOfDay) : startTimes.data ?? [];
513
+ const addonsSettled = (addons.data !== null || addons.error !== null) && (!needsShoeId || product.data !== null || product.error !== null);
514
+ const eventReady = eventSlotReady && addonsSettled && slotPrices.data !== null && !eventSlotUnavailable && !slotPrices.loading && !slotPrices.error && !preview.loading && !preview.error;
515
+ const eventReadError = discovery.error ?? slotPrices.error ?? preview.error;
516
+ const eventUnavailable = !session || !eventOfferSlug || eventSlotUnavailable || eventReadError?.code === "NOT_FOUND";
458
517
  const s = styles();
459
518
  if (flow.status === "confirmed") {
460
519
  return /* @__PURE__ */ jsxs("div", { className, style: s.card, children: [
@@ -523,7 +582,7 @@ function BookingFlow({
523
582
  const fee = preview.data?.reservationFee;
524
583
  const feeCents = typeof fee?.amountCents === "number" ? fee.amountCents : 0;
525
584
  const feeLabel = typeof fee?.label === "string" && fee.label ? fee.label : t.reservationFeeLabel;
526
- const reservationLine = t.reservationLineLabel.replace("{count}", String(count)).replace("{unit}", countNoun(preview.data?.unitNoun, count, COUNT_LABEL[pricingMode])).replace("{date}", formatDateLabel(dateISO)).replace("{time}", `${formatMinuteLabel(startMinuteOfDay)}\u2013${formatMinuteLabel(endMinuteOfDay)}`);
585
+ const reservationLine = t.reservationLineLabel.replace("{count}", String(count)).replace("{unit}", countNoun(preview.data?.unitNoun, count, eventOffer ? unitLabel.plural : COUNT_LABEL[pricingMode])).replace("{date}", formatDateLabel(dateISO)).replace("{time}", eventOffer ? formatSessionRange(startMinuteOfDay, endMinuteOfDay) : `${formatMinuteLabel(startMinuteOfDay)}\u2013${formatMinuteLabel(endMinuteOfDay)}`);
527
586
  const chosenAddons = addonList.map((a) => ({ ...a, quantity: addonQtys[a.id] ?? 0 })).filter((a) => a.quantity > 0);
528
587
  const fallbackAddonsCents = chosenAddons.reduce(
529
588
  (sum, a) => sum + a.priceCents * a.quantity,
@@ -546,7 +605,7 @@ function BookingFlow({
546
605
  ] }),
547
606
  /* @__PURE__ */ jsx("span", { style: s.muted, children: formatCents(a.lineSubtotalCents) })
548
607
  ] }, a.addonId)),
549
- plan.shoesIncluded ? /* @__PURE__ */ jsxs("div", { style: s.rowBetween, children: [
608
+ session?.shoesIncluded || plan.shoesIncluded ? /* @__PURE__ */ jsxs("div", { style: s.rowBetween, children: [
550
609
  /* @__PURE__ */ jsx("span", { style: s.muted, children: "Shoes included" }),
551
610
  /* @__PURE__ */ jsx("span", { style: s.muted, children: "\u2014" })
552
611
  ] }) : null,
@@ -593,7 +652,7 @@ function BookingFlow({
593
652
  {
594
653
  type: "button",
595
654
  style: s.primaryBtn,
596
- disabled: holding || preview.loading || quoteCents == null,
655
+ disabled: holding || preview.loading || quoteCents == null || Boolean(eventOffer && !eventReady),
597
656
  onClick: () => void flow.startHold(bookingArgs),
598
657
  children: holding ? t.securing : t.continueToPayment
599
658
  }
@@ -608,6 +667,7 @@ function BookingFlow({
608
667
  ] })
609
668
  ),
610
669
  /* @__PURE__ */ jsx("button", { type: "button", style: s.linkBtn, disabled: holding, onClick: () => setReviewing(false), children: t.editOrder }),
670
+ eventOffer && eventReadError && /* @__PURE__ */ jsx("p", { role: "alert", style: s.error, children: eventUnavailable ? "This event session is unavailable." : eventReadError.message }),
611
671
  flow.error && /* @__PURE__ */ jsxs("p", { style: s.error, children: [
612
672
  flow.error.code,
613
673
  " \u2014 ",
@@ -617,29 +677,68 @@ function BookingFlow({
617
677
  }
618
678
  const onSubmit = (e) => {
619
679
  e.preventDefault();
620
- setReviewing(true);
680
+ if (!eventOffer || eventReady && quoteCents !== null) setReviewing(true);
621
681
  };
622
682
  return /* @__PURE__ */ jsxs("form", { className, style: s.card, onSubmit, children: [
623
683
  /* @__PURE__ */ jsx("h3", { style: s.heading, children: t.heading }),
624
- /* @__PURE__ */ jsxs("label", { style: s.label, children: [
625
- t.date,
626
- /* @__PURE__ */ jsx("input", { type: "date", value: dateISO, onChange: (e) => setDateISO(e.target.value), style: s.input, required: true })
627
- ] }),
628
- /* @__PURE__ */ jsxs("label", { style: s.label, children: [
629
- t.start,
630
- startTimes.loading ? /* @__PURE__ */ jsx("span", { style: s.meta, children: t.loadingTimes }) : startOptions.length === 0 ? /* @__PURE__ */ jsx("span", { style: s.meta, children: t.noTimes }) : /* @__PURE__ */ jsx(
631
- "select",
632
- {
633
- value: startMinuteOfDay,
634
- onChange: (e) => setStartMinuteOfDay(Number(e.target.value)),
635
- style: s.input,
636
- children: startOptions.map((min) => /* @__PURE__ */ jsx("option", { value: min, children: formatMinuteLabel(min) }, min))
637
- }
638
- )
684
+ eventOffer ? /* @__PURE__ */ jsxs(Fragment, { children: [
685
+ session && /* @__PURE__ */ jsxs("p", { style: s.body, children: [
686
+ t.date,
687
+ " \xB7 ",
688
+ /* @__PURE__ */ jsx("time", { dateTime: dateISO, children: formatDateLabel(dateISO) })
689
+ ] }),
690
+ eventUnavailable && /* @__PURE__ */ jsx("p", { role: "status", style: s.meta, children: "This event session is unavailable." }),
691
+ !eventUnavailable && eventReadError && /* @__PURE__ */ jsx("p", { role: "alert", style: s.error, children: eventReadError.message }),
692
+ discovery.loading ? /* @__PURE__ */ jsx("p", { role: "status", style: s.meta, children: t.loadingTimes }) : startOptions.length === 0 ? !eventUnavailable && !eventReadError && /* @__PURE__ */ jsx("p", { role: "status", style: s.meta, children: "No event sessions available for this party." }) : /* @__PURE__ */ jsxs(Fragment, { children: [
693
+ fixed && startOptions.length === 1 ? /* @__PURE__ */ jsx("p", { style: s.body, children: formatSessionRange(startMinuteOfDay, endMinuteOfDay) }) : /* @__PURE__ */ jsxs("label", { style: s.label, children: [
694
+ t.start,
695
+ /* @__PURE__ */ jsx(
696
+ "select",
697
+ {
698
+ value: startMinuteOfDay,
699
+ style: s.input,
700
+ onChange: (e) => setStartMinuteOfDay(Number(e.target.value)),
701
+ children: startOptions.map((start) => /* @__PURE__ */ jsx("option", { value: start, children: fixed ? formatSessionRange(start, start + durationMinutes) : formatMinuteLabel(start) }, start))
702
+ }
703
+ )
704
+ ] }),
705
+ !fixed && /* @__PURE__ */ jsxs("label", { style: s.label, children: [
706
+ "Duration",
707
+ /* @__PURE__ */ jsx(
708
+ "select",
709
+ {
710
+ value: durationMinutes,
711
+ style: s.input,
712
+ onChange: (e) => setDuration(Number(e.target.value)),
713
+ children: durations.map((duration) => /* @__PURE__ */ jsxs("option", { value: duration, children: [
714
+ duration,
715
+ " minutes"
716
+ ] }, duration))
717
+ }
718
+ )
719
+ ] })
720
+ ] })
721
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
722
+ /* @__PURE__ */ jsxs("label", { style: s.label, children: [
723
+ t.date,
724
+ /* @__PURE__ */ jsx("input", { type: "date", value: dateISO, onChange: (e) => setDateISO(e.target.value), style: s.input, required: true })
725
+ ] }),
726
+ /* @__PURE__ */ jsxs("label", { style: s.label, children: [
727
+ t.start,
728
+ startTimes.loading ? /* @__PURE__ */ jsx("span", { style: s.meta, children: t.loadingTimes }) : startOptions.length === 0 ? /* @__PURE__ */ jsx("span", { style: s.meta, children: t.noTimes }) : /* @__PURE__ */ jsx(
729
+ "select",
730
+ {
731
+ value: startMinuteOfDay,
732
+ onChange: (e) => setStartMinuteOfDay(Number(e.target.value)),
733
+ style: s.input,
734
+ children: startOptions.map((min) => /* @__PURE__ */ jsx("option", { value: min, children: formatMinuteLabel(min) }, min))
735
+ }
736
+ )
737
+ ] })
639
738
  ] }),
640
739
  /* @__PURE__ */ jsxs("label", { style: s.label, children: [
641
740
  titleCase(
642
- (availability.data?.unitNoun ?? preview.data?.unitNoun)?.plural ?? COUNT_LABEL[pricingMode]
741
+ (availability.data?.unitNoun ?? preview.data?.unitNoun)?.plural ?? (eventOffer ? unitLabel.plural : COUNT_LABEL[pricingMode])
643
742
  ),
644
743
  /* @__PURE__ */ jsx(
645
744
  "input",
@@ -647,11 +746,47 @@ function BookingFlow({
647
746
  type: "number",
648
747
  min: 1,
649
748
  value: count,
650
- onChange: (e) => setCount(Math.max(1, Number(e.target.value) || 1)),
749
+ onChange: (e) => {
750
+ const next = Math.max(1, Number(e.target.value) || 1);
751
+ setCount(eventOffer ? Math.floor(next) : next);
752
+ const cap = session?.maxPartySizePerUnit;
753
+ if (cap != null) setBowlers(Math.min(persons, Math.floor(next) * cap));
754
+ },
651
755
  style: s.input
652
756
  }
653
757
  )
654
758
  ] }),
759
+ session && /* @__PURE__ */ jsxs(Fragment, { children: [
760
+ /* @__PURE__ */ jsxs("label", { style: s.label, children: [
761
+ "Bowlers",
762
+ /* @__PURE__ */ jsx(
763
+ "input",
764
+ {
765
+ style: s.input,
766
+ type: "number",
767
+ min: 1,
768
+ max: partyCap,
769
+ value: persons,
770
+ onChange: (e) => setBowlers(Math.min(partyCap ?? Infinity, Math.max(1, Math.floor(Number(e.target.value) || 1))))
771
+ }
772
+ )
773
+ ] }),
774
+ pricingMode === "per_game" && /* @__PURE__ */ jsxs("label", { style: s.label, children: [
775
+ "Games",
776
+ /* @__PURE__ */ jsx(
777
+ "input",
778
+ {
779
+ style: s.input,
780
+ type: "number",
781
+ min: 1,
782
+ value: games,
783
+ onChange: (e) => setGames(Math.max(1, Math.floor(Number(e.target.value) || 1)))
784
+ }
785
+ )
786
+ ] }),
787
+ session.shoesIncluded && /* @__PURE__ */ jsx("p", { style: s.meta, children: "Shoes included" }),
788
+ (product.error || addons.error) && /* @__PURE__ */ jsx("p", { role: "alert", style: s.error, children: "Unable to load add-ons." })
789
+ ] }),
655
790
  addonList.length > 0 ? /* @__PURE__ */ jsxs("div", { style: s.stack, children: [
656
791
  /* @__PURE__ */ jsx("p", { style: s.sectionTitle, children: t.addonsHeading }),
657
792
  addonList.map((addon) => /* @__PURE__ */ jsxs("div", { style: s.rowBetween, children: [
@@ -690,16 +825,16 @@ function BookingFlow({
690
825
  /* @__PURE__ */ jsx("a", { href: accountHref, style: s.linkBtn, children: t.notYou })
691
826
  ] }) : null
692
827
  ] }) : t.signInAtCheckout }),
693
- /* @__PURE__ */ jsxs("p", { style: s.meta, "aria-live": "polite", children: [
828
+ /* @__PURE__ */ jsx("p", { style: s.meta, "aria-live": "polite", children: eventOffer ? eventReady && quoteCents !== null ? formatCents(quoteCents) : "" : /* @__PURE__ */ jsxs(Fragment, { children: [
694
829
  dateISO === "" || startOptions.length === 0 ? "" : availability.loading ? t.checkingAvailability : availableUnits !== null ? `${availableUnits} ${countNoun(availability.data?.unitNoun ?? unitLabel, availableUnits, unitLabel.plural)} available` : availability.error ? availability.error.code : "",
695
830
  startOptions.length > 0 && quoteCents !== null ? ` \xB7 ${formatCents(quoteCents)}` : ""
696
- ] }),
831
+ ] }) }),
697
832
  /* @__PURE__ */ jsx(
698
833
  "button",
699
834
  {
700
835
  type: "submit",
701
836
  style: s.primaryBtn,
702
- disabled: dateISO === "" || startOptions.length === 0 || quoteCents === null,
837
+ disabled: dateISO === "" || startOptions.length === 0 || quoteCents === null || Boolean(eventOffer && !eventReady),
703
838
  children: t.reviewOrder
704
839
  }
705
840
  ),