@bowlos/reservations 0.12.0 → 0.14.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/HEADLESS.md ADDED
@@ -0,0 +1,294 @@
1
+ # Headless integration guide
2
+
3
+ **Center sites are headless-first.** The booking engine must match the center's
4
+ own design and never look like a themed plugin, so real sites build the funnel
5
+ from the SDK's **hooks** — not the drop-in `<BookingFlow>`. The drop-in
6
+ components (`@bowlos/reservations/components`) are a *reference implementation*:
7
+ this guide maps **every behavior they bake in to the hook + pattern** you use to
8
+ reproduce it inside your own UI.
9
+
10
+ > **Maintainers:** `<BookingFlow>` is the reference for this document. Any change
11
+ > to a component's booking behavior must be mirrored here in the same PR — the
12
+ > capability map below **and** a dated entry under [Adopting changes by
13
+ > version](#adopting-changes-by-version). A component feature with no headless
14
+ > instructions is incomplete (AGENTS.md → "SDK Headless Parity").
15
+
16
+ All hooks come from `@bowlos/reservations/react`; the framework-agnostic twins
17
+ (`listStartTimes`, `listAddons`, `bookingPreview`, …) come from
18
+ `@bowlos/reservations`. Mount one `<BowlosProvider>` at your app root so
19
+ `useAccount()` shares a single session everywhere.
20
+
21
+ ---
22
+
23
+ ## Capability map
24
+
25
+ ### 1. Login gate — online booking requires login
26
+
27
+ Online booking **requires a signed-in customer** (anonymous is the walk-in /
28
+ staff path only). Do not render the booking form, fetch pricing, or collect a
29
+ name/email for an anonymous visitor — show your sign-in / create-account UI and
30
+ drive it from `useAccount()`.
31
+
32
+ ```tsx
33
+ const account = useAccount();
34
+ const signedIn = account.status === "linked" && account.customer !== null;
35
+
36
+ if (!signedIn) {
37
+ // Your themed sign-in / create-account form, wired to:
38
+ // account.signIn(email, password) / account.signUp(email, password) / account.link({...})
39
+ return <YourAuthForm account={account} />;
40
+ }
41
+ const customer = account.customer!; // { fullName, email, ... }
42
+ ```
43
+
44
+ Gate **every** read below on `signedIn` (member rates + credit only resolve once
45
+ authenticated).
46
+
47
+ ### 2. Date — default to today
48
+
49
+ Default the date to the visitor's local today, set in an effect (not initial
50
+ state) so SSR and the first client render agree.
51
+
52
+ ```tsx
53
+ const [dateISO, setDateISO] = useState(defaultDateISO ?? "");
54
+ useEffect(() => {
55
+ if (!defaultDateISO && dateISO === "") {
56
+ const d = new Date();
57
+ setDateISO(`${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`);
58
+ }
59
+ }, [defaultDateISO, dateISO]);
60
+ ```
61
+
62
+ ### 3. Quantity — mode-aware (never hardcode `units`)
63
+
64
+ The count is `units`, `persons`, or `games` depending on the product's
65
+ `pricingMode`. Sending `units` for a per-person product books **lanes instead of
66
+ bowlers** and misprices. Label it accordingly.
67
+
68
+ ```tsx
69
+ const COUNT_LABEL = { per_unit_per_hour: "Lanes", per_person_per_hour: "Bowlers", per_game: "Games" };
70
+ const countField = (n: number) =>
71
+ pricingMode === "per_person_per_hour" ? { persons: n }
72
+ : pricingMode === "per_game" ? { games: n }
73
+ : { units: n };
74
+ // label: COUNT_LABEL[pricingMode]; spread countField(count) into preview + booking args.
75
+ ```
76
+
77
+ `pricingMode` comes from the product (the catalog read exposes it) — pass it in,
78
+ don't assume bowling.
79
+
80
+ ### 4. Live availability + price
81
+
82
+ ```tsx
83
+ const endMinuteOfDay = startMinuteOfDay + durationMinutes;
84
+ const availability = useAvailability(
85
+ { productId, dateISO, startMinuteOfDay, endMinuteOfDay },
86
+ { enabled: dateISO !== "" && signedIn },
87
+ );
88
+ const preview = useBookingPreview(
89
+ { centerId, productId, dateISO, startMinuteOfDay, endMinuteOfDay, mode: pricingMode, ...countField(count), addons: selectedAddons },
90
+ { enabled: dateISO !== "" && signedIn },
91
+ );
92
+ const freeUnits = availability.data ? availableUnitCount(availability.data) : null;
93
+ const quoteCents = preview.data?.totalCentsPerPlan?.[0]?.totalCents ?? null; // includes add-ons + tax + credit
94
+ ```
95
+
96
+ ### 5. Start time — a dropdown of bookable slots (not a free-form clock)
97
+
98
+ `useStartTimes` returns the minute-of-day slots that are within open hours, clear
99
+ the booking buffer, **and** have a real price plan (decided by the same pricing
100
+ engine the quote uses). Render them as a `<select>`; never offer a free-form time
101
+ input.
102
+
103
+ ```tsx
104
+ const startTimes = useStartTimes(
105
+ { productId, dateISO, durationMinutes, mode: pricingMode },
106
+ { enabled: dateISO !== "" && signedIn },
107
+ );
108
+ const slots = startTimes.data ?? [];
109
+
110
+ // Keep the selection valid as the list loads / the date changes:
111
+ useEffect(() => {
112
+ if (slots.length > 0 && !slots.includes(startMinuteOfDay)) setStartMinuteOfDay(slots[0]);
113
+ }, [startTimes.data]); // eslint-disable-line
114
+
115
+ // 12-hour label:
116
+ const label = (m: number) => {
117
+ const h = Math.floor(m / 60) % 24, min = m % 60;
118
+ return `${h % 12 === 0 ? 12 : h % 12}:${String(min).padStart(2, "0")} ${h < 12 ? "AM" : "PM"}`;
119
+ };
120
+ // startTimes.loading → "Finding times…"; slots.length === 0 → "No times available" + disable submit.
121
+ ```
122
+
123
+ ### 6. Add-ons (shoes, upgrades)
124
+
125
+ `useAddons` lists the product's add-ons; collect quantities and pass them as
126
+ `addons: [{ addonId, quantity }]` to **both** the preview and the booking. The
127
+ server re-validates and the quote total already reflects them.
128
+
129
+ ```tsx
130
+ const addons = useAddons({ productId }, { enabled: signedIn });
131
+ const [qty, setQty] = useState<Record<string, number>>({}); // addonId → quantity
132
+ const selectedAddons = Object.entries(qty).filter(([, q]) => q > 0).map(([addonId, quantity]) => ({ addonId, quantity }));
133
+
134
+ // Each addon: { id, name, description, priceCents, rateMode: "per_person"|"per_unit"|"flat", defaultQuantityRule }
135
+ // Show priceCents with a rate suffix (/ person, / unit, flat) + a quantity stepper per addon.
136
+ ```
137
+
138
+ ### 7. Review step — an order summary before payment
139
+
140
+ Match the branded portal: selection → **review** → payment. After the customer
141
+ has picked everything and the quote has loaded, show a summary of the order and a
142
+ "Continue to payment" action — don't hold inventory or jump to the card until they
143
+ confirm. The button that opens this reads **"Review order"** (not "Book now"); the
144
+ hold + payment happen on **"Continue to payment"**.
145
+
146
+ ```tsx
147
+ const [reviewing, setReviewing] = useState(false);
148
+ // Form's primary button → setReviewing(true) (enable it only once quoteCents is loaded).
149
+ // Render the summary from data you already have — no extra call:
150
+ const chosen = (addons.data ?? [])
151
+ .map((a) => ({ ...a, quantity: qty[a.id] ?? 0 }))
152
+ .filter((a) => a.quantity > 0);
153
+ const addonsSubtotal = chosen.reduce((s, a) => s + a.priceCents * a.quantity, 0);
154
+ // The reservation FEE is folded into the quote total — itemize it (don't let it
155
+ // vanish) and subtract it from the line below so it isn't double-counted:
156
+ const fee = preview.data?.reservationFee; // { amountCents, label } | null
157
+ const feeCents = (fee?.amountCents as number) ?? 0;
158
+ const reservationCents = quoteCents != null ? quoteCents - addonsSubtotal - feeCents : null; // base + tax
159
+ // Summary rows: the reservation ({count} {label} · {date} · {start–end}) + each add-on
160
+ // ({name} × {qty}) + a "{fee.label}" line (feeCents) when feeCents > 0 + Total = quoteCents.
161
+ // "Continue to payment" → flow.startHold(bookingArgs); "Edit order" → setReviewing(false).
162
+ ```
163
+
164
+ The total shown **must** be the quote's `totalCents` — it already includes tax
165
+ **and** the reservation fee, so the review matches what the customer is charged.
166
+ Itemize `preview.data.reservationFee` as its own line so the fee is visible.
167
+
168
+ ### 8. Hold → pay → confirm, and pay-to-confirm
169
+
170
+ `useBookingFlow` is the state machine. To mirror the component's **complete-sale-
171
+ only** default (no held-but-unpaid screen), advance straight to payment the
172
+ moment the hold lands.
173
+
174
+ ```tsx
175
+ const flow = useBookingFlow();
176
+ // flow.status: "idle" | "holding" | "held" | "preparingPayment" | "awaitingPayment" | "confirmed"
177
+ flow.startHold(bookingArgs); // → "held"
178
+ useEffect(() => { // complete-sale-only
179
+ if (flow.status === "held") void flow.preparePayment(); // → "awaitingPayment" (+ flow.paymentIntent)
180
+ }, [flow.status]);
181
+ // after payment confirms on the client: flow.startPolling() → "confirmed" (flow.reservation)
182
+ // flow.abandon() releases the hold; flow.reset() starts over.
183
+ ```
184
+
185
+ `bookingArgs` (a `CreateBookingArgs`) — always the signed-in customer:
186
+
187
+ ```tsx
188
+ const bookingArgs = {
189
+ centerId, productId, dateISO, startMinuteOfDay, endMinuteOfDay,
190
+ mode: pricingMode, ...countField(count), addons: selectedAddons,
191
+ customer: { fullName: customer.fullName, email: customer.email, marketingOptIn: false },
192
+ };
193
+ ```
194
+
195
+ ### 9. Payment (Stripe Connect)
196
+
197
+ `preparePayment()` gives you `flow.paymentIntent` (a `PaymentIntentInfo` with
198
+ `clientSecret`, `connectedAccountId`, `customerSessionClientSecret`,
199
+ `amountCents`). The SDK core never loads Stripe.js. Two options:
200
+
201
+ - **Keep your own Stripe Elements** (full control of the Stripe `appearance` — the
202
+ headless choice). Initialize with your **platform** publishable key scoped to
203
+ the operator's connected account, and pass the **customer session** so saved
204
+ cards work:
205
+
206
+ ```tsx
207
+ const stripe = useMemo(
208
+ () => loadStripe(PLATFORM_PK, { stripeAccount: flow.paymentIntent.connectedAccountId }),
209
+ [flow.paymentIntent.connectedAccountId],
210
+ );
211
+ <Elements stripe={stripe} options={{
212
+ clientSecret: flow.paymentIntent.clientSecret,
213
+ customerSessionClientSecret: flow.paymentIntent.customerSessionClientSecret, // saved cards / save-for-future
214
+ appearance: { /* your theme */ },
215
+ }}>
216
+ {/* <PaymentElement/> → stripe.confirmPayment({ elements, redirect: "if_required" }) → flow.startPolling() */}
217
+ </Elements>
218
+ ```
219
+
220
+ - **Or drop in `<BowlosPaymentForm>`** from `@bowlos/reservations/payments` if you
221
+ don't need a custom Stripe appearance (`{...ctx} publishableKey={PLATFORM_PK}`).
222
+
223
+ Either way: it's the **platform** key scoped to `connectedAccountId`, and saved
224
+ cards require `customerSessionClientSecret`.
225
+
226
+ ---
227
+
228
+ ## Flow lifecycle, reset & error handling — required for a clean install
229
+
230
+ `useBookingFlow` is **in-memory** (no persistence, no resume). It starts at
231
+ `"idle"` and moves through statuses; **your UI is driven entirely by
232
+ `flow.status`.** Most "stuck booking" / "nothing happened on submit" / "no
233
+ confirmation" bugs come from skipping a status. Handle **all** of them — never let
234
+ an unhandled status fall through to your catalog/landing page.
235
+
236
+ ```tsx
237
+ switch (flow.status) {
238
+ case "idle": return <Form/>; // (or your review panel once reviewing)
239
+ case "holding":
240
+ case "preparingPayment": return <Securing/>; // brief loading
241
+ case "held": /* completeSaleOnly effect calls preparePayment → awaitingPayment */ return <Securing/>;
242
+ case "awaitingPayment": return <YourStripeForm intent={flow.paymentIntent!}/>;
243
+ case "confirmed": return <Confirmation id={flow.reservation?.reservationDisplayId}/>; // REQUIRED
244
+ case "error":
245
+ case "failed": return <Problem msg={flow.error?.message} onRetry={flow.reset}/>; // do NOT bounce to catalog
246
+ case "expired":
247
+ case "abandoned": return <Expired onStartOver={flow.reset}/>;
248
+ }
249
+ ```
250
+
251
+ **The confirmation is mandatory.** After the customer pays, `startPolling()` →
252
+ `"confirmed"` is the moment the reservation actually exists (the webhook
253
+ materializes it). **Render the confirmation from `flow.reservation`.** If you
254
+ navigate away on submit/pay instead, the customer sees no confirmation and may
255
+ think it failed — even though it booked. Conversely, if `startHold` errors and you
256
+ *don't* handle `"error"`, your page falls back to "what are you booking?" and the
257
+ booking silently never happens. **Both are the same bug: an unhandled status.**
258
+
259
+ **Reset when leaving or restarting a booking.** Because the state is in-memory and
260
+ the flow component often stays mounted across in-app navigation:
261
+
262
+ - **"Back" / "All offers" / pick a different product** → `flow.abandon()` (if a
263
+ hold is active) then `flow.reset()` *before* navigating, and clear the
264
+ `productId` from the route. A stale in-progress flow is what makes "Book" keep
265
+ reopening the previous reservation.
266
+ - **Sign out** → `flow.reset()` (the in-progress booking belongs to that session).
267
+ Wire this wherever you call `account.signOut()`.
268
+ - **Starting a fresh booking** must begin at `"idle"` — if you reuse a mounted
269
+ flow, call `reset()` first.
270
+
271
+ **Holds are server-side + TTL-bound.** `startHold` places a hold; if it errors
272
+ (slot taken, or a *prior* hold of yours still occupies the slot), surface
273
+ `flow.error` and offer "start over" (which should `abandon()` + `reset()`). Don't
274
+ hold during the review step — hold on "Continue to payment" only (§7).
275
+
276
+ ---
277
+
278
+ ## Adopting changes by version
279
+
280
+ What each SDK release changed in `<BookingFlow>` and the headless steps to match.
281
+ Headless sites do **not** get these from a version bump — apply them by hand.
282
+
283
+ | Version | Change | Headless adoption |
284
+ |---|---|---|
285
+ | **0.8.0** | Date defaults to today; primary button "Book Now"; count labels Lanes/Bowlers/Games and sends `units`/`persons`/`games` by mode | §2 (today default), §3 (mode-aware quantity). Stop hardcoding `mode: "per_unit_per_hour"` + `units`. |
286
+ | **0.9.0** | **Login required** — anonymous booking path removed | §1. Gate the funnel behind `useAccount()`; remove any anonymous name/email booking path; gate availability/preview on `signedIn`. |
287
+ | **0.10.0** | Add-ons UI | §6. Add `useAddons`; pass `addons` to preview + booking. |
288
+ | **0.11.0** | Start-time **dropdown** (new `availableStartTimes` endpoint) | §5. Replace any `<input type="time">` with a `<select>` from `useStartTimes`. |
289
+ | **0.12.0** | `<BowlosPaymentForm>` in a new `@bowlos/reservations/payments` entry | §9. Optional. Keep your custom Elements for a custom Stripe `appearance`; make sure you pass `customerSessionClientSecret` for saved cards. |
290
+ | **0.13.0** | **Review step** — selection now goes through an order summary before payment; primary button is "Review order" | §7. Insert a review summary between the form and the hold; relabel the submit "Review order"; only `startHold` on "Continue to payment". |
291
+ | **0.14.0** | Review **itemizes the reservation fee**; docs now spell out the full **flow lifecycle / reset / error handling** | §7 (show `reservationFee` as a line; total stays `totalCents`, which includes it) + the new **Flow lifecycle** section (handle every `flow.status`, render the confirmation, reset on navigation/sign-out). |
292
+
293
+ When you add the next release here, add its row **and** any new capability-map
294
+ section in the same PR.
package/README.md CHANGED
@@ -6,7 +6,11 @@ websites. Built for React/Next sites (including AI-agent-built ones) that book o
6
6
  a BowlOS operator's behalf, with **Stripe Connect** payments landing on the
7
7
  operator's own account.
8
8
 
9
- - **Headless-first.** A typed client + hooks; you own the UI.
9
+ - **Headless-first.** A typed client + hooks; you own the UI. The booking engine
10
+ is meant to match your site's design, not look like a themed plugin — so the
11
+ primary path is the hooks. **→ [HEADLESS.md](./HEADLESS.md)** maps every
12
+ built-in booking behavior to its hook + pattern (and how to adopt each SDK
13
+ release). The drop-in components below are a *reference*, not the product.
10
14
  - **Two entry points.** `@bowlos/reservations` (React-free core) and
11
15
  `@bowlos/reservations/react` (provider + hooks). React is an optional peer.
12
16
  - **Dual ESM + CJS**, fully typed.
@@ -130,8 +134,13 @@ non-React or server use.
130
134
 
131
135
  ## Drop-in components (`@bowlos/reservations/components`)
132
136
 
133
- Don't want to build the UI from hooks? A **themeable, white-label** component
134
- layer sits on top of them:
137
+ > These are a **reference / fast-start**, not the delivered product. Center sites
138
+ > are headless-first (your design, not a themed plugin) — build from the hooks per
139
+ > **[HEADLESS.md](./HEADLESS.md)**. Use these to prototype or to read how a
140
+ > behavior is wired.
141
+
142
+ Want a head start? A **themeable, white-label** component layer sits on top of
143
+ the hooks:
135
144
 
136
145
  ```tsx
137
146
  import { BowlosProvider } from "@bowlos/reservations/react";
@@ -176,8 +185,8 @@ import { BookingCatalog } from "@bowlos/reservations/components";
176
185
 
177
186
  The drop-in surfaces cover a center site end to end:
178
187
 
179
- **`<BookingFlow>`** runs the whole funnel (availability + price → book → pay →
180
- confirm). **Online booking requires login** — there is **no anonymous path**.
188
+ **`<BookingFlow>`** runs the whole funnel (availability + price → **review** → pay
189
+ → confirm). **Online booking requires login** — there is **no anonymous path**.
181
190
  A signed-out visitor sees a sign-in / create-account form (the built-in
182
191
  `<AuthForm>`); availability and pricing stay hidden until they authenticate,
183
192
  then the flow books as them (member rates apply). Anonymous booking is the
@@ -199,8 +208,14 @@ itself from `pricingMode` — **Lanes** (`per_unit_per_hour`), **Bowlers**
199
208
  (`per_person_per_hour`), **Games** (`per_game`) — and is sent to the API as the
200
209
  matching field (`units` / `persons` / `games`), so a per-bowler product books
201
210
  **bowlers, not lanes**. The page **auto-scrolls to the top** as the flow advances
202
- past the form. The primary button reads **"Book Now"** by default (override with
203
- `labels={{ hold: "…" }}`).
211
+ past the form.
212
+
213
+ The primary button reads **"Review order"** — submitting the form opens an
214
+ **order-summary review** (the reservation + each add-on + the authoritative total)
215
+ *before* anything is held or charged, matching the branded portal's select →
216
+ review → pay flow. **"Continue to payment"** then places the hold and advances to
217
+ payment; **"Edit order"** returns to the form. (Override copy via
218
+ `labels={{ reviewOrder, reviewHeading, orderTotal, editOrder, … }}`.)
204
219
 
205
220
  **Add-ons** (shoe rental, upgrades) render automatically: any add-ons configured
206
221
  on the product appear as a quantity-per-item list, each showing its unit price
@@ -686,6 +686,12 @@ var DEFAULT_LABELS2 = {
686
686
  addonsHeading: "Add-ons",
687
687
  name: "Name",
688
688
  email: "Email",
689
+ reviewOrder: "Review order",
690
+ reviewHeading: "Review your order",
691
+ reservationLineLabel: "{count} {unit} \xB7 {date} \xB7 {time}",
692
+ reservationFeeLabel: "Reservation fee",
693
+ orderTotal: "Total",
694
+ editOrder: "Edit order",
689
695
  hold: "Book Now",
690
696
  holding: "Booking\u2026",
691
697
  continueToPayment: "Continue to payment",
@@ -721,6 +727,15 @@ function todayISO() {
721
727
  const day = String(d.getDate()).padStart(2, "0");
722
728
  return `${y}-${m}-${day}`;
723
729
  }
730
+ function formatDateLabel(dateISO) {
731
+ const [y, m, d] = dateISO.split("-").map(Number);
732
+ if (!y || !m || !d) return dateISO;
733
+ return new Date(y, m - 1, d).toLocaleDateString(void 0, {
734
+ weekday: "short",
735
+ month: "short",
736
+ day: "numeric"
737
+ });
738
+ }
724
739
  function BookingFlow({
725
740
  centerId,
726
741
  productId,
@@ -749,6 +764,7 @@ function BookingFlow({
749
764
  const endMinuteOfDay = startMinuteOfDay + durationMinutes;
750
765
  const [count, setCount] = react.useState(1);
751
766
  const [payMessage, setPayMessage] = react.useState(null);
767
+ const [reviewing, setReviewing] = react.useState(false);
752
768
  const [addonQtys, setAddonQtys] = react.useState({});
753
769
  const selectedAddons = react.useMemo(
754
770
  () => Object.entries(addonQtys).filter(([, q]) => q > 0).map(([addonId, quantity]) => ({ addonId, quantity })),
@@ -831,7 +847,18 @@ function BookingFlow({
831
847
  ": ",
832
848
  /* @__PURE__ */ jsxRuntime.jsx("strong", { children: flow.reservation?.reservationDisplayId ?? "\u2014" })
833
849
  ] }),
834
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", style: s.primaryBtn, onClick: flow.reset, children: t.bookAnother })
850
+ /* @__PURE__ */ jsxRuntime.jsx(
851
+ "button",
852
+ {
853
+ type: "button",
854
+ style: s.primaryBtn,
855
+ onClick: () => {
856
+ setReviewing(false);
857
+ flow.reset();
858
+ },
859
+ children: t.bookAnother
860
+ }
861
+ )
835
862
  ] });
836
863
  }
837
864
  if (flow.status === "awaitingPayment" && flow.paymentIntent) {
@@ -872,9 +899,60 @@ function BookingFlow({
872
899
  return /* @__PURE__ */ jsxRuntime.jsx(AuthForm, { account, className });
873
900
  }
874
901
  const holding = flow.status === "holding";
902
+ if (reviewing) {
903
+ const chosenAddons = addonList.map((a) => ({ ...a, quantity: addonQtys[a.id] ?? 0 })).filter((a) => a.quantity > 0);
904
+ const addonsSubtotalCents = chosenAddons.reduce(
905
+ (sum, a) => sum + a.priceCents * a.quantity,
906
+ 0
907
+ );
908
+ const fee = preview.data?.reservationFee;
909
+ const feeCents = typeof fee?.amountCents === "number" ? fee.amountCents : 0;
910
+ const feeLabel = typeof fee?.label === "string" && fee.label ? fee.label : t.reservationFeeLabel;
911
+ const reservationCents = quoteCents != null ? quoteCents - addonsSubtotalCents - feeCents : null;
912
+ const reservationLine = t.reservationLineLabel.replace("{count}", String(count)).replace("{unit}", COUNT_LABEL[pricingMode]).replace("{date}", formatDateLabel(dateISO)).replace("{time}", `${formatMinuteLabel(startMinuteOfDay)}\u2013${formatMinuteLabel(endMinuteOfDay)}`);
913
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, style: s.card, children: [
914
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { style: s.heading, children: t.reviewHeading }),
915
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.rowBetween, children: [
916
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: s.body, children: reservationLine }),
917
+ reservationCents != null ? /* @__PURE__ */ jsxRuntime.jsx("span", { style: s.body, children: formatCents(reservationCents) }) : null
918
+ ] }),
919
+ chosenAddons.map((a) => /* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.rowBetween, children: [
920
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { style: s.muted, children: [
921
+ a.name,
922
+ " \xD7 ",
923
+ a.quantity
924
+ ] }),
925
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: s.muted, children: formatCents(a.priceCents * a.quantity) })
926
+ ] }, a.id)),
927
+ feeCents > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.rowBetween, children: [
928
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: s.muted, children: feeLabel }),
929
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: s.muted, children: formatCents(feeCents) })
930
+ ] }) : null,
931
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.rowBetween, children: [
932
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { children: t.orderTotal }),
933
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { children: quoteCents != null ? formatCents(quoteCents) : "\u2014" })
934
+ ] }),
935
+ /* @__PURE__ */ jsxRuntime.jsx(
936
+ "button",
937
+ {
938
+ type: "button",
939
+ style: s.primaryBtn,
940
+ disabled: holding || quoteCents == null,
941
+ onClick: () => void flow.startHold(bookingArgs),
942
+ children: holding ? t.securing : t.continueToPayment
943
+ }
944
+ ),
945
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", style: s.linkBtn, disabled: holding, onClick: () => setReviewing(false), children: t.editOrder }),
946
+ flow.error && /* @__PURE__ */ jsxRuntime.jsxs("p", { style: s.error, children: [
947
+ flow.error.code,
948
+ " \u2014 ",
949
+ flow.error.message
950
+ ] })
951
+ ] });
952
+ }
875
953
  const onSubmit = (e) => {
876
954
  e.preventDefault();
877
- void flow.startHold(bookingArgs);
955
+ setReviewing(true);
878
956
  };
879
957
  return /* @__PURE__ */ jsxRuntime.jsxs("form", { className, style: s.card, onSubmit, children: [
880
958
  /* @__PURE__ */ jsxRuntime.jsx("h3", { style: s.heading, children: t.heading }),
@@ -954,8 +1032,8 @@ function BookingFlow({
954
1032
  {
955
1033
  type: "submit",
956
1034
  style: s.primaryBtn,
957
- disabled: holding || dateISO === "" || startOptions.length === 0,
958
- children: holding ? t.holding : t.hold
1035
+ disabled: dateISO === "" || startOptions.length === 0 || quoteCents === null,
1036
+ children: t.reviewOrder
959
1037
  }
960
1038
  ),
961
1039
  flow.error && /* @__PURE__ */ jsxRuntime.jsxs("p", { style: s.error, children: [