@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.
- package/AGENTS.md +14 -5
- package/CHANGELOG.md +22 -0
- package/HEADLESS.md +126 -41
- package/README.md +16 -0
- package/dist/{account-B4sZBmPI.d.cts → account-b8chVpED.d.cts} +27 -1
- package/dist/{account-B4sZBmPI.d.ts → account-b8chVpED.d.ts} +27 -1
- package/dist/{booking-change-DzYs9133.d.ts → booking-change-B-ADuVEz.d.cts} +77 -2
- package/dist/{booking-change-Dd4PVgd3.d.cts → booking-change-BrJ-XESC.d.ts} +77 -2
- package/dist/chunk-43WZ6TLQ.js +12 -0
- package/dist/chunk-43WZ6TLQ.js.map +1 -0
- package/dist/{chunk-4JMGS4YB.js → chunk-CTJODEHR.js} +27 -6
- package/dist/chunk-CTJODEHR.js.map +1 -0
- package/dist/{chunk-YAXBZJMI.js → chunk-EPYGIJRJ.js} +20 -3
- package/dist/chunk-EPYGIJRJ.js.map +1 -0
- package/dist/{chunk-YQRTBGXU.js → chunk-EXEKCMQ2.js} +57 -22
- package/dist/chunk-EXEKCMQ2.js.map +1 -0
- package/dist/{chunk-V4JRDYW4.js → chunk-IDRTMFJJ.js} +8 -3
- package/dist/chunk-IDRTMFJJ.js.map +1 -0
- package/dist/{chunk-T2E6AEC7.js → chunk-LFFANITL.js} +4 -11
- package/dist/chunk-LFFANITL.js.map +1 -0
- package/dist/components.cjs +357 -131
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +11 -5
- package/dist/components.d.ts +11 -5
- package/dist/components.js +200 -65
- package/dist/components.js.map +1 -1
- package/dist/index.cjs +34 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/payments.cjs.map +1 -1
- package/dist/payments.d.cts +1 -1
- package/dist/payments.d.ts +1 -1
- package/dist/payments.js +5 -4
- package/dist/payments.js.map +1 -1
- package/dist/{react-C6NWC80d.d.cts → react-cqGEohr0.d.cts} +4 -2
- package/dist/{react-DVdtpw5n.d.ts → react-s4J-e10i.d.ts} +4 -2
- package/dist/react.cjs +90 -19
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +11 -5
- package/dist/react.d.ts +11 -5
- package/dist/react.js +5 -5
- package/package.json +2 -1
- package/templates/center-site/README.md +1 -0
- package/templates/center-site/app/book/event-reservation-form.tsx +276 -0
- package/templates/center-site/app/book/page.tsx +107 -49
- package/templates/center-site/app/catalog/page.tsx +3 -1
- package/templates/center-site/app/events/[slug]/page.tsx +7 -10
- package/templates/center-site/package.json +1 -1
- package/dist/chunk-4JMGS4YB.js.map +0 -1
- package/dist/chunk-T2E6AEC7.js.map +0 -1
- package/dist/chunk-V4JRDYW4.js.map +0 -1
- package/dist/chunk-YAXBZJMI.js.map +0 -1
- package/dist/chunk-YQRTBGXU.js.map +0 -1
package/dist/components.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { CSSProperties, ReactNode } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
export { F as CatalogResult, H as CatalogSection } from './booking-change-
|
|
5
|
-
import {
|
|
6
|
-
import { d as UseAccountResult } from './react-
|
|
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(
|
|
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 {
|
package/dist/components.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { CSSProperties, ReactNode } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
export { F as CatalogResult, H as CatalogSection } from './booking-change-
|
|
5
|
-
import {
|
|
6
|
-
import { d as UseAccountResult } from './react-
|
|
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(
|
|
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 {
|
package/dist/components.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { INQUIRY_FORMS } from './chunk-
|
|
2
|
-
import { useBookingFlow, useCenters, useMyGameCardHistory, useWalletPassUrl, useUpdateMyProfile, useMyCommunicationPrefs, useSetMyCommunicationPref, useAccountDeletion, useMyMembershipMembers, useAddMyMembershipMember, useCancelMyMembership, useOpenMembershipBillingPortal, useBookingChange, useWaitlistJoin, useMyPackageOrders } from './chunk-
|
|
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,
|
|
5
|
-
export { BOWLOS_DEFAULT_THEME, BowlosTheme, formatCents, formatCentsRange } from './chunk-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
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,
|
|
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
|
|
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 [
|
|
381
|
-
const
|
|
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
|
-
|
|
387
|
-
|
|
388
|
-
|
|
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
|
|
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 =
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
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
|
|
457
|
-
const
|
|
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(
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
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) =>
|
|
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__ */
|
|
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
|
),
|