@bowlos/reservations 0.19.0 → 0.21.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 +331 -6
- package/README.md +23 -10
- package/dist/{catalog-Dgapnrdm.d.ts → catalog-BuafmB8y.d.cts} +67 -2
- package/dist/{catalog-Db8EdzJ2.d.cts → catalog-bpCn9klL.d.ts} +67 -2
- package/dist/{chunk-BPLYLQO3.js → chunk-FV6SROO2.js} +31 -4
- package/dist/chunk-FV6SROO2.js.map +1 -0
- package/dist/{chunk-FWPXQII5.js → chunk-S5T4OCBY.js} +61 -3
- package/dist/chunk-S5T4OCBY.js.map +1 -0
- package/dist/components.cjs +11 -6
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +10 -4
- package/dist/components.d.ts +10 -4
- package/dist/components.js +11 -6
- package/dist/components.js.map +1 -1
- package/dist/{data-DevEKBmK.d.cts → data-BKlgn8Ln.d.cts} +174 -1
- package/dist/{data-DevEKBmK.d.ts → data-BKlgn8Ln.d.ts} +174 -1
- package/dist/index.cjs +86 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +18 -3
- package/dist/index.js.map +1 -1
- package/dist/payments.d.cts +1 -1
- package/dist/payments.d.ts +1 -1
- package/dist/{react-BgP6rtBS.d.ts → react-BI2RKM5p.d.ts} +1 -1
- package/dist/{react-D73ZxxDw.d.cts → react-D2mBw_-l.d.cts} +1 -1
- package/dist/react.cjs +173 -0
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +77 -5
- package/dist/react.d.ts +77 -5
- package/dist/react.js +102 -4
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
- package/templates/center-site/package.json +1 -1
- package/dist/chunk-BPLYLQO3.js.map +0 -1
- package/dist/chunk-FWPXQII5.js.map +0 -1
package/HEADLESS.md
CHANGED
|
@@ -151,19 +151,26 @@ const chosen = (addons.data ?? [])
|
|
|
151
151
|
.map((a) => ({ ...a, quantity: qty[a.id] ?? 0 }))
|
|
152
152
|
.filter((a) => a.quantity > 0);
|
|
153
153
|
const addonsSubtotal = chosen.reduce((s, a) => s + a.priceCents * a.quantity, 0);
|
|
154
|
-
//
|
|
155
|
-
//
|
|
154
|
+
// TAX and the reservation FEE are both folded into the quote total — itemize
|
|
155
|
+
// each so neither vanishes, and subtract them from the base line below so they
|
|
156
|
+
// aren't double-counted. Tax lives in taxLinesPerPlan (NOT inside the base):
|
|
157
|
+
const plan = preview.data?.totalCentsPerPlan?.[0]; // headline plan
|
|
158
|
+
const taxLines = preview.data?.taxLinesPerPlan?.find((t) => t.pricePlanId === plan?.pricePlanId)?.taxLines ?? [];
|
|
159
|
+
const taxCents = taxLines.reduce((s, t) => s + t.taxCents, 0); // each line: { label, taxCents }
|
|
156
160
|
const fee = preview.data?.reservationFee; // { amountCents, label } | null
|
|
157
161
|
const feeCents = (fee?.amountCents as number) ?? 0;
|
|
158
|
-
const reservationCents = quoteCents != null ? quoteCents - addonsSubtotal - feeCents : null; // base
|
|
162
|
+
const reservationCents = quoteCents != null ? quoteCents - addonsSubtotal - taxCents - feeCents : null; // base only
|
|
159
163
|
// Summary rows: the reservation ({count} {label} · {date} · {start–end}) + each add-on
|
|
160
|
-
// ({name} × {qty}) +
|
|
161
|
-
//
|
|
164
|
+
// ({name} × {qty}) + one row per taxLine ({label} → {taxCents}) + a "{fee.label}" line
|
|
165
|
+
// (feeCents) when feeCents > 0 + Total = quoteCents. "Continue to payment" →
|
|
166
|
+
// flow.startHold(bookingArgs); "Edit order" → setReviewing(false).
|
|
162
167
|
```
|
|
163
168
|
|
|
164
169
|
The total shown **must** be the quote's `totalCents` — it already includes tax
|
|
165
170
|
**and** the reservation fee, so the review matches what the customer is charged.
|
|
166
|
-
Itemize `
|
|
171
|
+
Itemize **each `taxLinesPerPlan[plan].taxLines[]` row** and
|
|
172
|
+
`preview.data.reservationFee` as their own lines so neither the tax nor the fee
|
|
173
|
+
is hidden inside the reservation line (see the [Static purchase summary](#static-purchase-summary--tax--center-fee--setup-fee-every-category) field map).
|
|
167
174
|
|
|
168
175
|
### 8. Hold → pay → confirm, and pay-to-confirm
|
|
169
176
|
|
|
@@ -278,6 +285,140 @@ hold during the review step — hold on "Continue to payment" only (§7).
|
|
|
278
285
|
|
|
279
286
|
---
|
|
280
287
|
|
|
288
|
+
## Static purchase summary — tax · center fee · setup fee (every category)
|
|
289
|
+
|
|
290
|
+
Every BowlOS funnel ends in a **static, non-editable summary** the customer
|
|
291
|
+
reads before paying: itemized **tax**, the **center/booking fee**, and — for
|
|
292
|
+
memberships — the one-time **setup/joining fee**. This is the single most
|
|
293
|
+
common headless gap, so here is the exact field map. **Read it from the
|
|
294
|
+
server-computed preview; never compute tax, fee, or totals yourself** — the
|
|
295
|
+
preview is the same engine the PaymentIntent uses, so the summary and the charge
|
|
296
|
+
can never disagree.
|
|
297
|
+
|
|
298
|
+
| Category | Review hook (preview) | Base line(s) | Tax lines | Center / booking fee | Setup fee | Total(s) |
|
|
299
|
+
|---|---|---|---|---|---|---|
|
|
300
|
+
| **Bowling / other attractions** | `useBookingPreview` | reservation (count × rate, add-ons, less discount) | `taxLinesPerPlan[plan].taxLines[]` → `{ label, taxCents }` | `reservationFee` → `{ amountCents, label }` | — (n/a) | `totalCentsPerPlan[plan].totalCents` (already includes tax + fee) |
|
|
301
|
+
| **Events (ticket mode)** | `useEventTicketPreview` | `subtotalCents` ("Tickets") | `taxLines[]` → `{ label, taxCents }` | `reservationFeeCents` / `reservationFeeLabel` | — (n/a) | `grandTotalCents` |
|
|
302
|
+
| **Game passes** | `useGameCardPreview` | `subtotalCents` | `taxLines[]` | `reservationFeeCents` / `reservationFeeLabel` | — (n/a) | `grandTotalCents` |
|
|
303
|
+
| **Packages** | `usePackagePreview` | `baseTotalCents` + `addons[]` (`{ name, quantity, lineCents }`) | `taxLines[]` | `reservationFeeCents` / `reservationFeeLabel` | — (n/a) | `grandTotalCents` |
|
|
304
|
+
| **Membership (one-time)** | `useMembershipPreview` | `duesCents` | `taxLines[]` | `reservationFeeCents` / `reservationFeeLabel` | `setupFeeCents` | `grandTotalCents` |
|
|
305
|
+
| **Membership (recurring)** | `useMembershipSubscriptionPreview` | `duesCents` | `taxLines[]` | `reservationFeeCents` / `reservationFeeLabel` | `setupFeeCents` (today only) | **Due today** `grandTotalCents` **and** **Auto-renews at** `recurringTotalCents` / `cadence` |
|
|
306
|
+
|
|
307
|
+
Rules that make the summary match the charge:
|
|
308
|
+
|
|
309
|
+
- **Static, not editable.** The summary re-states the customer's choices and the
|
|
310
|
+
server's numbers; the only actions are "Continue to payment" and "Edit order"
|
|
311
|
+
(which returns to the form). No price/qty inputs live on the summary.
|
|
312
|
+
- **Show every tax line.** Each `taxLine` is `{ label, taxCents, mode, … }`.
|
|
313
|
+
Render one row per line using `label` + `taxCents`. `mode: "included"` lines
|
|
314
|
+
are informational (tax is inside the price); `"none"`/exempt → there are no
|
|
315
|
+
lines, so render nothing. Never collapse tax into the base line — for bowling
|
|
316
|
+
in particular the tax is in `taxLinesPerPlan`, **not** inside the reservation
|
|
317
|
+
line (see §7).
|
|
318
|
+
- **Show the center fee when present.** Render `reservationFeeLabel` (the
|
|
319
|
+
operator's own wording, e.g. "Facility fee") + the amount **only when**
|
|
320
|
+
`reservationFeeCents > 0` (bowling: `reservationFee != null`). It is already
|
|
321
|
+
folded into the total — itemize it so it doesn't look like a hidden add-on.
|
|
322
|
+
- **Setup fee = per-purchase joining fee.** `setupFeeCents` is a **one-time**
|
|
323
|
+
charge applied on the **first payment of every membership purchase** whose
|
|
324
|
+
template has one configured — it is **not** waived for repeat buyers. Render
|
|
325
|
+
the "Joining fee" / "Setup fee" row **only when `setupFeeCents > 0`** (a
|
|
326
|
+
template with no setup fee returns `0`) and never fabricate it. On a recurring
|
|
327
|
+
membership it is part of **Due today** but is **excluded from**
|
|
328
|
+
`recurringTotalCents` (renewals charge dues + tax/fee only).
|
|
329
|
+
- **Trust the total.** `grandTotalCents` (or bowling's `totalCentsPerPlan[].totalCents`)
|
|
330
|
+
already = base + tax + center fee (+ setup fee for a first membership). Display
|
|
331
|
+
it verbatim; do not re-sum the rows yourself.
|
|
332
|
+
|
|
333
|
+
Each category's full funnel (config, auth gate, payment) is in its section below.
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## Event offers in the catalog
|
|
338
|
+
|
|
339
|
+
Use `useEventOffers({ centerId })` for public event lineup cards and event
|
|
340
|
+
landing-page links. `useEvents()` is the legacy pricing-event/date-preset list;
|
|
341
|
+
it does **not** carry the commerce controls (lineup toggle, landing-page slug,
|
|
342
|
+
purchase mode, included add-ons, tax/fee config).
|
|
343
|
+
|
|
344
|
+
```tsx
|
|
345
|
+
const events = useEventOffers({ centerId });
|
|
346
|
+
// rows include:
|
|
347
|
+
// { id, slug, title, subtitle, description, date, startMinuteOfDay,
|
|
348
|
+
// endMinuteOfDay, purchaseMode, productId, pricePlanId, priceCents }
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
Route catalog picks by `offer.slug` to your event landing page. On that page,
|
|
352
|
+
read the full offer with `useEventOffer({ slug })`.
|
|
353
|
+
|
|
354
|
+
For `purchaseMode: "reservation"`, start the normal booking flow with the
|
|
355
|
+
offer's `productId`, preselect `date`, `startMinuteOfDay`, and duration
|
|
356
|
+
(`endMinuteOfDay - startMinuteOfDay`) when present, and preselect
|
|
357
|
+
`includedAddons`. Pass `eventOfferSlug: offer.slug` into both
|
|
358
|
+
`useBookingPreview` and the booking hold/create call (`useBookingFlow.startHold`
|
|
359
|
+
or `createBooking`). The server uses that slug to bind the quote to the offer's
|
|
360
|
+
event price plan, tax override, and Center fee override/inheritance. Then
|
|
361
|
+
continue through the same [Review step](#7-review-step--an-order-summary-before-payment)
|
|
362
|
+
and `useBookingFlow` lifecycle above. That keeps event reservations on the same
|
|
363
|
+
pricing, hold, tax, fee, credit, and Stripe Connect path as regular bookings.
|
|
364
|
+
`useBookingPreview` returns `taxLinesPerPlan` alongside `totalCentsPerPlan`;
|
|
365
|
+
render the entry matching the selected/headline price plan so event tax appears
|
|
366
|
+
as its own Review row instead of being hidden inside the base reservation line.
|
|
367
|
+
|
|
368
|
+
```tsx
|
|
369
|
+
const eventArgs = offer.purchaseMode === "reservation"
|
|
370
|
+
? { eventOfferSlug: offer.slug }
|
|
371
|
+
: {};
|
|
372
|
+
|
|
373
|
+
const preview = useBookingPreview(
|
|
374
|
+
{ centerId, productId: offer.productId!, dateISO, startMinuteOfDay, endMinuteOfDay, mode: pricingMode, ...countField(count), addons: selectedAddons, ...eventArgs },
|
|
375
|
+
{ enabled: offer.purchaseMode === "reservation" && signedIn },
|
|
376
|
+
);
|
|
377
|
+
|
|
378
|
+
// Later, after your Review step:
|
|
379
|
+
flow.startHold({
|
|
380
|
+
centerId,
|
|
381
|
+
productId: offer.productId!,
|
|
382
|
+
dateISO,
|
|
383
|
+
startMinuteOfDay,
|
|
384
|
+
endMinuteOfDay,
|
|
385
|
+
mode: pricingMode,
|
|
386
|
+
...countField(count),
|
|
387
|
+
addons: selectedAddons,
|
|
388
|
+
customer,
|
|
389
|
+
...eventArgs,
|
|
390
|
+
});
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
For `purchaseMode: "ticket"`, route the customer to the hosted tenant ticket
|
|
394
|
+
checkout at `/tenant/<slug>/events/<eventSlug>/tickets`, or mirror that flow in
|
|
395
|
+
a first-party surface with `previewEventTicket(client, { eventOfferId, quantity })`
|
|
396
|
+
or `useEventTicketPreview` → Review → `createEventTicketOrder(client, { eventOfferId, quantity })`
|
|
397
|
+
or `useEventTicketPurchase().start({ eventOfferId, quantity })` (gateway action:
|
|
398
|
+
`createEventTicketPaymentIntent`). The preview returns the itemized base, tax
|
|
399
|
+
lines, Center event fee, and `grandTotalCents`; the PaymentIntent action uses
|
|
400
|
+
the same server-side snapshot and writes an `event_orders` row. Do not charge
|
|
401
|
+
tickets from `priceCents` alone.
|
|
402
|
+
|
|
403
|
+
Headless function twins (non-React): `listEventOffers(client, { centerId })`,
|
|
404
|
+
`getEventOffer(client, { slug })`.
|
|
405
|
+
|
|
406
|
+
After payment, re-query the signed-in account reads:
|
|
407
|
+
|
|
408
|
+
- `useMyEventOrders({ brandId })` / `getMyEventOrders(client, { brandId })`
|
|
409
|
+
lists the customer's event ticket purchases for account dashboards.
|
|
410
|
+
- `useMyEventOrder({ brandId, orderId })` / `getMyEventOrder(client, { brandId, orderId })`
|
|
411
|
+
returns the frozen receipt snapshot: ticket subtotal, tax lines, Center fee,
|
|
412
|
+
included add-ons, `grandTotalCents`, and refund fields (`refundedCents`,
|
|
413
|
+
`refundedAt`, `refundReason`) when staff have refunded the ticket order.
|
|
414
|
+
|
|
415
|
+
Paid ticket orders write `transaction_ledger.source === "event"` rows, so
|
|
416
|
+
finance/reporting surfaces can break event revenue out separately from
|
|
417
|
+
reservations and packages. Stripe card refunds for those PaymentIntents reverse
|
|
418
|
+
the same ledger row and preserve the `eventOrderId` back-reference.
|
|
419
|
+
|
|
420
|
+
---
|
|
421
|
+
|
|
281
422
|
## Buying a game pass (memberships follow)
|
|
282
423
|
|
|
283
424
|
Game passes are a **direct purchase** — no inventory hold, no date/time. The buy
|
|
@@ -443,6 +584,188 @@ Headless function twins (non-React): `getPackage(client, { packageId })`,
|
|
|
443
584
|
`previewPackage(client, args)`, `createPackageOrder(client, args)`,
|
|
444
585
|
`getPackageStatus(client, orderId)`.
|
|
445
586
|
|
|
587
|
+
## Buying a one-time membership
|
|
588
|
+
|
|
589
|
+
A one-time membership is the same **direct-purchase** lifecycle as a game pass —
|
|
590
|
+
`useMembershipPurchase` on the shared `usePurchase` engine, no inventory hold, no
|
|
591
|
+
date/time. Mint a connected-account PaymentIntent → pay with `<BowlosPaymentForm>`
|
|
592
|
+
→ poll to materialization. The charge lands on the **operator's** connected
|
|
593
|
+
account (same Connect rule as everything else).
|
|
594
|
+
|
|
595
|
+
**1 — List what's for sale** (catalog read — anonymous):
|
|
596
|
+
|
|
597
|
+
```tsx
|
|
598
|
+
const memberships = useMyMemberships({ brandId }); // the signed-in customer's memberships
|
|
599
|
+
// …or the public catalog of purchasable plans:
|
|
600
|
+
const plans = useBowlosQuery("listPublicMemberships", { centerId }); // [{ id, name, priceCents, … }]
|
|
601
|
+
// (the framework-agnostic twin is `listPublicMemberships(client, { centerId })`.)
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
**2 — Show an itemized Review** (the **Select → Review → Pay** flow every BowlOS
|
|
605
|
+
surface uses; requires a signed-in customer). A membership has no config, so this
|
|
606
|
+
is a one-line read:
|
|
607
|
+
|
|
608
|
+
```tsx
|
|
609
|
+
const { data: quote } = useMembershipPreview({ templateId });
|
|
610
|
+
// quote → { duesCents, setupFeeCents, subtotalCents, taxLines:[{ label, taxCents, … }],
|
|
611
|
+
// taxTotalCents, reservationFeeCents, reservationFeeLabel, grandTotalCents }
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
Render the dues (`duesCents`), the one-time setup / joining fee (`setupFeeCents`),
|
|
615
|
+
each tax line, the booking fee (`reservationFeeLabel` / `reservationFeeCents`), and
|
|
616
|
+
the `grandTotalCents` total, then a "Continue to payment" button → step 3. This
|
|
617
|
+
quote is server-computed by the **same engine** as the PaymentIntent, so the Review
|
|
618
|
+
and the charge can never disagree (don't sum the price yourself — the setup fee +
|
|
619
|
+
tax + the booking fee are all on top of the bare dues).
|
|
620
|
+
|
|
621
|
+
> ⚠️ **The customer MUST be signed in BEFORE this step.** `useMembershipPreview` is
|
|
622
|
+
> auth-scoped (BowlOS rule: **pricing is shown after login**; it also applies tax
|
|
623
|
+
> exemptions and resolves the buyer's home Center). Gate login **before the
|
|
624
|
+
> Review** — not at payment. If you render the Review while the customer is still
|
|
625
|
+
> anonymous, `useMembershipPreview` returns `NOT_FOUND` ("Couldn't load the total").
|
|
626
|
+
> Either require login at the start of the funnel (like the booking flow) or insert
|
|
627
|
+
> a sign-in step before the Review.
|
|
628
|
+
> Guard it: `const { signedIn } = useAccount(); if (!signedIn) return <SignIn/>;`
|
|
629
|
+
> before the Review renders.
|
|
630
|
+
|
|
631
|
+
**3 — Buy it:**
|
|
632
|
+
|
|
633
|
+
```tsx
|
|
634
|
+
const buy = useMembershipPurchase();
|
|
635
|
+
// buy.start({ templateId }) → "awaitingPayment" (+ buy.paymentIntent)
|
|
636
|
+
{buy.status === "awaitingPayment" && buy.paymentIntent && (
|
|
637
|
+
<BowlosPaymentForm
|
|
638
|
+
{...buy.paymentIntent} // { clientSecret, connectedAccountId, customerSessionClientSecret }
|
|
639
|
+
publishableKey={PLATFORM_PK}
|
|
640
|
+
amountCents={buy.paymentIntent.amountCents} // == quote.grandTotalCents (authoritative)
|
|
641
|
+
onPaid={() => buy.startPolling()} // → "confirmed", buy.resultId = the new membership id
|
|
642
|
+
/>
|
|
643
|
+
)}
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
Drive the UI off `buy.status` exactly like the [Flow lifecycle](#flow-lifecycle-reset--error-handling)
|
|
647
|
+
section — the Review (step 2) before `start`, the payment on `awaitingPayment`, a
|
|
648
|
+
**confirmation** on `confirmed` (`buy.resultId` = the new membership), and an error
|
|
649
|
+
+ retry on `failed` / `expired` / `error`. Route the catalog's `membership` pick to
|
|
650
|
+
this flow **in-app** — not to the portal.
|
|
651
|
+
|
|
652
|
+
Headless function twins (non-React): `previewMembership(client, { templateId })`,
|
|
653
|
+
`createMembershipOrder(client, { templateId })`,
|
|
654
|
+
`getMembershipStatus(client, refToken)`.
|
|
655
|
+
|
|
656
|
+
## Buying a recurring membership
|
|
657
|
+
|
|
658
|
+
A recurring membership is a Stripe **subscription**, so the buy differs from the
|
|
659
|
+
one-time path in two ways: the Review shows **what's due today *and* what renews**,
|
|
660
|
+
and there is **no poll** — the subscription materializes via webhook, so you
|
|
661
|
+
re-query `useMyMemberships` after the customer pays rather than polling a refToken.
|
|
662
|
+
The first invoice (and every renewal) charges the **operator's** connected account.
|
|
663
|
+
|
|
664
|
+
**1 — Show an itemized Review** with both totals (requires a signed-in customer):
|
|
665
|
+
|
|
666
|
+
```tsx
|
|
667
|
+
const { data: quote } = useMembershipSubscriptionPreview({ templateId });
|
|
668
|
+
// quote → { duesCents, setupFeeCents, subtotalCents, taxLines, taxTotalCents,
|
|
669
|
+
// reservationFeeCents, reservationFeeLabel, grandTotalCents,
|
|
670
|
+
// recurringTotalCents, cadence: "monthly" | "annual" | "one_time" }
|
|
671
|
+
```
|
|
672
|
+
|
|
673
|
+
Render **two** totals — they are not the same number:
|
|
674
|
+
|
|
675
|
+
- **Due today** = `grandTotalCents` (dues + the one-time setup fee + tax + the
|
|
676
|
+
selling Center's booking fee — itemize the lines above it just like the one-time
|
|
677
|
+
Review).
|
|
678
|
+
- **Auto-renews at** = `recurringTotalCents` per `cadence` (dues + tax/fee on dues
|
|
679
|
+
only — **no setup fee** on renewals), e.g. "then $XX.XX / month".
|
|
680
|
+
|
|
681
|
+
Same auth + same-engine guarantees as the one-time preview (sign in **before** the
|
|
682
|
+
Review or it returns `NOT_FOUND`; the quote can't diverge from the charge). Then a
|
|
683
|
+
"Continue to payment" button → step 2.
|
|
684
|
+
|
|
685
|
+
**2 — Start the subscription + confirm the first invoice:**
|
|
686
|
+
|
|
687
|
+
```tsx
|
|
688
|
+
const checkout = useMembershipSubscriptionCheckout();
|
|
689
|
+
// checkout.start({ templateId }) → "awaitingPayment" (+ checkout.subscriptionIntent)
|
|
690
|
+
{checkout.status === "awaitingPayment" && checkout.subscriptionIntent && (
|
|
691
|
+
<BowlosPaymentForm
|
|
692
|
+
{...checkout.subscriptionIntent} // { clientSecret, connectedAccountId, customerSessionClientSecret }
|
|
693
|
+
publishableKey={PLATFORM_PK}
|
|
694
|
+
amountCents={checkout.subscriptionIntent.amountCents} // == quote.grandTotalCents (today's charge)
|
|
695
|
+
onPaid={() => {/* nothing to poll — see below */}}
|
|
696
|
+
/>
|
|
697
|
+
)}
|
|
698
|
+
// checkout.status === "error" → show checkout.error?.message + a retry (checkout.reset).
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
> ⚠️ **There is no refToken poll for a subscription.** Unlike the one-time buy,
|
|
702
|
+
> `useMembershipSubscriptionCheckout` has no `startPolling` — after the customer
|
|
703
|
+
> confirms the first invoice, the subscription **materializes via webhook**. Show
|
|
704
|
+
> the new membership by **re-querying `useMyMemberships`**: it updates reactively, so
|
|
705
|
+
> the customer's membership list fills in on its own once the webhook lands (a brief
|
|
706
|
+
> "finishing up…" state while it does is the right UX). Don't wait on a status call
|
|
707
|
+
> that will never come.
|
|
708
|
+
|
|
709
|
+
Headless function twins (non-React):
|
|
710
|
+
`previewMembershipSubscription(client, { templateId })`,
|
|
711
|
+
`createMembershipSubscriptionOrder(client, { templateId })`. (No status twin —
|
|
712
|
+
subscriptions materialize via webhook; read `getMyMemberships(client, { brandId })`.)
|
|
713
|
+
|
|
714
|
+
## The canonical catalog (visibility-aware) — `useCatalog`
|
|
715
|
+
|
|
716
|
+
`<BookingCatalog>` assembles the catalog from five per-category reads
|
|
717
|
+
(`useProducts` / `useEventOffers` / `usePackages` / `usePublicMemberships` /
|
|
718
|
+
`useGameCards`). Those reads do **not** apply the Center admin's per-surface
|
|
719
|
+
visibility settings — a category or offer the operator hid for a surface still
|
|
720
|
+
comes back.
|
|
721
|
+
|
|
722
|
+
For a visibility-aware catalog, use **`useCatalog`** (v0.21.0):
|
|
723
|
+
|
|
724
|
+
```tsx
|
|
725
|
+
import { useCatalog } from "@bowlos/reservations/react";
|
|
726
|
+
|
|
727
|
+
const { data, loading } = useCatalog({
|
|
728
|
+
brandId: "brand_…",
|
|
729
|
+
centerId: "center_…",
|
|
730
|
+
surface: "sdk_custom_site", // your surface — the backend applies its rules
|
|
731
|
+
});
|
|
732
|
+
|
|
733
|
+
// data.sections: { key, label, items: CatalogItem[] }[] (six categories, in order)
|
|
734
|
+
// Render only sections with items (empty categories are hidden on customer surfaces).
|
|
735
|
+
data?.sections
|
|
736
|
+
.filter((s) => s.items.length > 0)
|
|
737
|
+
.map((section) => (
|
|
738
|
+
<section key={section.key}>
|
|
739
|
+
<h2>{section.label}</h2>
|
|
740
|
+
{section.items.map((item) => (
|
|
741
|
+
<button key={item.id} onClick={() => route(item)}>
|
|
742
|
+
{item.title} — {item.priceLabel ?? "See times & pricing"}
|
|
743
|
+
</button>
|
|
744
|
+
))}
|
|
745
|
+
</section>
|
|
746
|
+
));
|
|
747
|
+
```
|
|
748
|
+
|
|
749
|
+
Routing — switch on `item.action.type` and use the IDs in `action.payload`:
|
|
750
|
+
|
|
751
|
+
| `action.type` | payload | route to |
|
|
752
|
+
|---|---|---|
|
|
753
|
+
| `book_reservation` | `{ productId }` | your `<BookingFlow>` for that product |
|
|
754
|
+
| `view_event` | `{ slug, purchaseMode }` | the event landing/booking by `slug` (fetch detail with `getEventOffer({ slug })` for reservation-mode presets) |
|
|
755
|
+
| `buy_package` | `{ packageId }` | your headless package buy (see "Buying a package") |
|
|
756
|
+
| `buy_membership` | `{ templateId }` | your membership buy (see "Buying a … membership") |
|
|
757
|
+
| `buy_game_pass` | `{ templateId }` | your game-pass buy (see "Buying a game pass") |
|
|
758
|
+
|
|
759
|
+
`priceLabel` is an indicative **"from $X"** only (null for products → show
|
|
760
|
+
"See times & pricing"); the binding price comes from the per-category preview
|
|
761
|
+
after login. The framework-agnostic twin is `listCatalog(client, args)`.
|
|
762
|
+
|
|
763
|
+
`useCatalog` keeps the SDK custom site consistent with the white-label web and
|
|
764
|
+
mobile surfaces (all three consume the same backend read) and honors the admin
|
|
765
|
+
Public Catalog toggles. `<BookingCatalog>` itself still uses the per-category
|
|
766
|
+
hooks; migrating it to `useCatalog` (a breaking `onSelect` shape change) is a
|
|
767
|
+
future coordinated release.
|
|
768
|
+
|
|
446
769
|
## Adopting changes by version
|
|
447
770
|
|
|
448
771
|
What each SDK release changed in `<BookingFlow>` and the headless steps to match.
|
|
@@ -462,6 +785,8 @@ Headless sites do **not** get these from a version bump — apply them by hand.
|
|
|
462
785
|
| **0.17.0** | **Headless package purchase** — `usePackagePurchase` (+ `usePackage`, `useCenterHours` reads) | "Buying a package" section. Build the package config (Center, date, start time, quantity, add-ons) from `usePackage` + `useCenterHours`, then `usePackagePurchase` + `<BowlosPaymentForm>`. **Snap the start time to a valid slot** (or the create rejects `VALIDATION_FAILED`). Route the catalog's `package` pick in-app, not to the portal. (Charges the operator's connected account.) |
|
|
463
786
|
| **0.18.0** | **Itemized package Review** — `usePackagePreview` (server-computed quote) | "Buying a package" §3. Insert a Review step between config and pay: `usePackagePreview({ packageId, centerId, quantity, optionalAddons })` returns the itemized breakdown (base, add-ons, tax lines, booking fee, `grandTotalCents`). Render it before `usePackagePurchase.start`. Same engine as the PaymentIntent, so it never diverges. (Auth required — applies tax exemptions.) |
|
|
464
787
|
| **0.19.0** | **Itemized game-pass Review** — `useGameCardPreview` (server-computed quote) | "Buying a game pass" §2. Insert a Review step before pay: `useGameCardPreview({ templateId })` returns the itemized breakdown (base, tax lines, booking fee, `grandTotalCents`). Render it before `useGameCardPurchase.start` — stop showing the bare `priceCents`, since the customer now pays base + tax + the selling Center's booking fee. Same engine as the PaymentIntent, so it never diverges. (Auth required — applies tax exemptions + resolves the home Center.) |
|
|
788
|
+
| **0.20.0** | **Membership buy hooks (one-time + recurring)** — `useMembershipPreview` / `useMembershipPurchase` and `useMembershipSubscriptionPreview` / `useMembershipSubscriptionCheckout` | "Buying a one-time membership" + "Buying a recurring membership" sections. One-time mirrors the game-pass buy (`useMembershipPreview` → `useMembershipPurchase`, poll `resultId` = membership). Recurring: `useMembershipSubscriptionPreview` shows **Due today** (`grandTotalCents`) *and* **Auto-renews at** (`recurringTotalCents` / `cadence`), then `useMembershipSubscriptionCheckout` confirms the first invoice — **no refToken poll; re-query `useMyMemberships` after payment** (the subscription materializes via webhook). Route the catalog's `membership` pick in-app, not to the portal. (Charges the operator's connected account.) |
|
|
789
|
+
| **0.21.0** | **Sellable event offers + ticket receipts** *and* **canonical visibility-aware catalog** — headless adds `useEventOffers` / `useEventOffer`, `useEventTicketPreview`, `createEventTicketOrder`, `useEventTicketPurchase`, signed-in event-order account reads, **and** `useCatalog` / `listCatalog` (one read, six categories, per-surface admin visibility applied); a consolidated [Static purchase summary](#static-purchase-summary--tax--center-fee--setup-fee-every-category) field map | "Event offers in the catalog" + "The canonical catalog" sections. Route `event` picks to an event landing page by `slug`. For reservation-mode events, preselect the event date/window/add-ons and pass `eventOfferSlug: offer.slug` into preview + hold/create so the server applies the event plan and tax/fee policy. For ticket-mode events, route to the hosted tenant ticket checkout or mirror `previewEventTicket` → Review → `createEventTicketOrder` / `useEventTicketPurchase`. After pay, re-query `useMyEventOrders` / `useMyEventOrder`. Prefer `useCatalog({ brandId, centerId, surface })` over the per-category hooks for the full, admin-controlled catalog (route each `CatalogItem` by `action.type`). `<BookingCatalog>` is unchanged. |
|
|
465
790
|
|
|
466
791
|
When you add the next release here, add its row **and** any new capability-map
|
|
467
792
|
section in the same PR.
|
package/README.md
CHANGED
|
@@ -121,20 +121,20 @@ const flow = useBookingFlow();
|
|
|
121
121
|
A complete reference site (Next.js App Router) using this flow lives in the
|
|
122
122
|
BowlOS repo under `examples/center-site`.
|
|
123
123
|
|
|
124
|
-
### Buying passes &
|
|
124
|
+
### Buying passes, packages & memberships
|
|
125
125
|
|
|
126
|
-
Direct purchases — game passes and
|
|
127
|
-
of `useBookingFlow`: mint a connected-account PaymentIntent → pay with
|
|
126
|
+
Direct purchases — game passes, packages, and memberships — use `usePurchase`, the
|
|
127
|
+
buy-flow twin of `useBookingFlow`: mint a connected-account PaymentIntent → pay with
|
|
128
128
|
`<BowlosPaymentForm>` → poll to materialization. They require a signed-in customer
|
|
129
129
|
and charge the **operator's** connected account.
|
|
130
130
|
|
|
131
131
|
```tsx
|
|
132
|
-
import { useGameCardPurchase, usePackagePurchase } from "@bowlos/reservations/react";
|
|
132
|
+
import { useGameCardPurchase, usePackagePurchase, useMembershipPurchase } from "@bowlos/reservations/react";
|
|
133
133
|
|
|
134
|
-
const buy = useGameCardPurchase(); // or usePackagePurchase()
|
|
134
|
+
const buy = useGameCardPurchase(); // or usePackagePurchase() / useMembershipPurchase()
|
|
135
135
|
// buy.start(args) → "awaitingPayment" (+ buy.paymentIntent)
|
|
136
136
|
// <BowlosPaymentForm {...buy.paymentIntent} onPaid={() => buy.startPolling()} />
|
|
137
|
-
// buy.status === "confirmed" → buy.resultId (the new card / order id)
|
|
137
|
+
// buy.status === "confirmed" → buy.resultId (the new card / order / membership id)
|
|
138
138
|
```
|
|
139
139
|
|
|
140
140
|
A game pass is one-tap (`{ templateId }`) — show an itemized **Review** with
|
|
@@ -142,10 +142,16 @@ A game pass is one-tap (`{ templateId }`) — show an itemized **Review** with
|
|
|
142
142
|
customer pays more than the bare `priceCents`. A **package** carries a config —
|
|
143
143
|
Center, date, start time, quantity, add-ons — which you read with `usePackage` +
|
|
144
144
|
`useCenterHours`, then show an itemized **Review** with `usePackagePreview` (base,
|
|
145
|
-
add-ons, tax, booking fee, total).
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
145
|
+
add-ons, tax, booking fee, total). A **one-time membership** is one-tap like a game
|
|
146
|
+
pass (`useMembershipPurchase`, Review with `useMembershipPreview` — dues + the
|
|
147
|
+
one-time setup fee + tax + booking fee). A **recurring membership** uses
|
|
148
|
+
`useMembershipSubscriptionCheckout` instead: its Review (`useMembershipSubscriptionPreview`)
|
|
149
|
+
shows **Due today** *and* **Auto-renews at**, and there's **no poll** — it
|
|
150
|
+
materializes via webhook, so re-query `useMyMemberships` after payment. All previews
|
|
151
|
+
are server-computed and never diverge from the charge. The full recipes (including
|
|
152
|
+
the package start-time **slot snap** and the recurring no-poll note) are in
|
|
153
|
+
**[HEADLESS.md](./HEADLESS.md) → "Buying a game pass" / "Buying a package" / "Buying
|
|
154
|
+
a one-time membership" / "Buying a recurring membership"**.
|
|
149
155
|
|
|
150
156
|
## Account + flash sales
|
|
151
157
|
|
|
@@ -209,6 +215,13 @@ import { BookingCatalog } from "@bowlos/reservations/components";
|
|
|
209
215
|
/>;
|
|
210
216
|
```
|
|
211
217
|
|
|
218
|
+
For a **visibility-aware** catalog (the Center admin's per-surface Public Catalog
|
|
219
|
+
toggles applied, consistent with the white-label web + mobile surfaces), build
|
|
220
|
+
your own listing from the **`useCatalog({ brandId, centerId, surface })`** hook
|
|
221
|
+
(framework-agnostic twin: `listCatalog`) instead of the per-category hooks. It
|
|
222
|
+
returns the six categories grouped; route each item by `action.type`. See
|
|
223
|
+
HEADLESS.md → "The canonical catalog".
|
|
224
|
+
|
|
212
225
|
The drop-in surfaces cover a center site end to end:
|
|
213
226
|
|
|
214
227
|
**`<BookingFlow>`** runs the whole funnel (availability + price → **review** → pay
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as BowlosClient } from './data-
|
|
1
|
+
import { g as BowlosClient } from './data-BKlgn8Ln.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Typed account + flash reads for @bowlos/reservations.
|
|
@@ -19,6 +19,10 @@ type ReservationDetailArgs = {
|
|
|
19
19
|
brandId: string;
|
|
20
20
|
displayId: string;
|
|
21
21
|
};
|
|
22
|
+
type EventOrderDetailArgs = {
|
|
23
|
+
brandId: string;
|
|
24
|
+
orderId: string;
|
|
25
|
+
};
|
|
22
26
|
type MembershipDetailArgs = {
|
|
23
27
|
brandId: string;
|
|
24
28
|
membershipId: string;
|
|
@@ -35,6 +39,8 @@ type FlashSalesArgs = {
|
|
|
35
39
|
};
|
|
36
40
|
declare function getMyReservations<T = unknown>(client: BowlosClient, args: BrandScoped): Promise<T>;
|
|
37
41
|
declare function getMyReservationDetail<T = unknown>(client: BowlosClient, args: ReservationDetailArgs): Promise<T>;
|
|
42
|
+
declare function getMyEventOrders<T = unknown>(client: BowlosClient, args: BrandScoped): Promise<T>;
|
|
43
|
+
declare function getMyEventOrder<T = unknown>(client: BowlosClient, args: EventOrderDetailArgs): Promise<T>;
|
|
38
44
|
declare function getMyMemberships<T = unknown>(client: BowlosClient, args: BrandScoped): Promise<T>;
|
|
39
45
|
declare function getMyMembershipDetail<T = unknown>(client: BowlosClient, args: MembershipDetailArgs): Promise<T>;
|
|
40
46
|
declare function getMyLoyalty<T = unknown>(client: BowlosClient, args: BrandScoped): Promise<T>;
|
|
@@ -60,6 +66,57 @@ type BrandCatalogArgs = {
|
|
|
60
66
|
brandId: string;
|
|
61
67
|
centerId?: string;
|
|
62
68
|
};
|
|
69
|
+
/** Which public surface is asking — the backend applies that surface's
|
|
70
|
+
* per-category + per-offer visibility before returning. */
|
|
71
|
+
type PublicSurface = "sdk_custom_site" | "white_label_web" | "mobile_app";
|
|
72
|
+
type CatalogCategory = "bowling" | "other_attractions" | "events" | "packages" | "memberships" | "game_passes";
|
|
73
|
+
type CatalogActionType = "book_reservation" | "view_event" | "buy_ticket" | "buy_package" | "buy_membership" | "buy_game_pass";
|
|
74
|
+
type CatalogSourceTable = "products" | "event_offers" | "packages" | "membership_templates" | "game_card_templates";
|
|
75
|
+
/** A normalized, surface-agnostic catalog item. Route by `action.type`, using
|
|
76
|
+
* the IDs in `action.payload` (e.g. `productId`, `slug`, `packageId`,
|
|
77
|
+
* `templateId`). `priceLabel` is an indicative "from $X" only (null for
|
|
78
|
+
* products — show "See times & pricing"); the binding price comes from the
|
|
79
|
+
* per-category preview after login. */
|
|
80
|
+
interface CatalogItem {
|
|
81
|
+
id: string;
|
|
82
|
+
category: CatalogCategory;
|
|
83
|
+
sourceTable: CatalogSourceTable;
|
|
84
|
+
sourceId: string;
|
|
85
|
+
title: string;
|
|
86
|
+
subtitle?: string | null;
|
|
87
|
+
description?: string | null;
|
|
88
|
+
priceLabel?: string | null;
|
|
89
|
+
imageUrl?: string | null;
|
|
90
|
+
badgeLabel?: string | null;
|
|
91
|
+
action: {
|
|
92
|
+
type: CatalogActionType;
|
|
93
|
+
payload: Record<string, string>;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
interface CatalogSection {
|
|
97
|
+
key: CatalogCategory;
|
|
98
|
+
label: string;
|
|
99
|
+
items: CatalogItem[];
|
|
100
|
+
}
|
|
101
|
+
interface CatalogResult {
|
|
102
|
+
sections: CatalogSection[];
|
|
103
|
+
}
|
|
104
|
+
/** Args for the canonical catalog read. `surface` selects which visibility
|
|
105
|
+
* rules the backend applies. */
|
|
106
|
+
type CatalogArgs = {
|
|
107
|
+
brandId: string;
|
|
108
|
+
centerId: string;
|
|
109
|
+
surface: PublicSurface;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* The canonical public catalog for a surface — every active, public,
|
|
113
|
+
* bookable/sellable item grouped into the six first-class categories, with the
|
|
114
|
+
* Center admin's per-surface category + offer visibility already applied.
|
|
115
|
+
* Anonymous. This is the recommended way to list "everything bookable here":
|
|
116
|
+
* one call, all categories, visibility-aware, consistent with the white-label
|
|
117
|
+
* web + mobile surfaces.
|
|
118
|
+
*/
|
|
119
|
+
declare function listCatalog<T = CatalogResult>(client: BowlosClient, args: CatalogArgs): Promise<T>;
|
|
63
120
|
/** One package's full detail. `shareToken` reveals a hidden/unlisted package. */
|
|
64
121
|
type PackageDetailArgs = {
|
|
65
122
|
packageId: string;
|
|
@@ -75,6 +132,14 @@ type CenterHoursArgs = {
|
|
|
75
132
|
declare function listProducts<T = unknown>(client: BowlosClient, args: CenterScoped): Promise<T>;
|
|
76
133
|
/** Upcoming pricing events (NYE Bash, tournaments…) at a Center. */
|
|
77
134
|
declare function listEvents<T = unknown>(client: BowlosClient, args: CenterScoped): Promise<T>;
|
|
135
|
+
/** Sellable event offers at a Center. These are the public lineup + event
|
|
136
|
+
* landing-page records; use this instead of `listEvents` when routing a
|
|
137
|
+
* customer to an event purchase flow. */
|
|
138
|
+
declare function listEventOffers<T = unknown>(client: BowlosClient, args: CenterScoped): Promise<T>;
|
|
139
|
+
/** One sellable event offer by landing-page slug. */
|
|
140
|
+
declare function getEventOffer<T = unknown>(client: BowlosClient, args: {
|
|
141
|
+
slug: string;
|
|
142
|
+
}): Promise<T>;
|
|
78
143
|
/** Purchasable packages at a Brand. */
|
|
79
144
|
declare function listPackages<T = unknown>(client: BowlosClient, args: BrandCatalogArgs): Promise<T>;
|
|
80
145
|
/** Full detail for one package — components, optional add-ons, allowed start
|
|
@@ -90,4 +155,4 @@ declare function listPublicMemberships<T = unknown>(client: BowlosClient, args:
|
|
|
90
155
|
/** Purchasable game cards / passes at a Brand. */
|
|
91
156
|
declare function listGameCards<T = unknown>(client: BowlosClient, args: BrandCatalogArgs): Promise<T>;
|
|
92
157
|
|
|
93
|
-
export { type BrandCatalogArgs as B, type
|
|
158
|
+
export { getPackage as A, type BrandCatalogArgs as B, type CatalogActionType as C, listCatalog as D, type EventOrderDetailArgs as E, type FlashBookingOptionsArgs as F, listEventOffers as G, listEvents as H, listGameCards as I, listPackages as J, listProducts as K, listPublicMemberships as L, type MembershipDetailArgs as M, type PackageDetailArgs as P, type ReservationDetailArgs as R, type BrandScoped as a, type CatalogArgs as b, type CatalogCategory as c, type CatalogItem as d, type CatalogResult as e, type CatalogSection as f, type CatalogSourceTable as g, type CenterHoursArgs as h, type CenterScoped as i, type FlashSaleArgs as j, type FlashSalesArgs as k, type PublicSurface as l, getCenterHours as m, getEventOffer as n, getFlashSale as o, getFlashSaleBookingOptions as p, getFlashSales as q, getMyCredits as r, getMyEventOrder as s, getMyEventOrders as t, getMyLoyalty as u, getMyMembershipDetail as v, getMyMemberships as w, getMyPasses as x, getMyReservationDetail as y, getMyReservations as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as BowlosClient } from './data-
|
|
1
|
+
import { g as BowlosClient } from './data-BKlgn8Ln.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Typed account + flash reads for @bowlos/reservations.
|
|
@@ -19,6 +19,10 @@ type ReservationDetailArgs = {
|
|
|
19
19
|
brandId: string;
|
|
20
20
|
displayId: string;
|
|
21
21
|
};
|
|
22
|
+
type EventOrderDetailArgs = {
|
|
23
|
+
brandId: string;
|
|
24
|
+
orderId: string;
|
|
25
|
+
};
|
|
22
26
|
type MembershipDetailArgs = {
|
|
23
27
|
brandId: string;
|
|
24
28
|
membershipId: string;
|
|
@@ -35,6 +39,8 @@ type FlashSalesArgs = {
|
|
|
35
39
|
};
|
|
36
40
|
declare function getMyReservations<T = unknown>(client: BowlosClient, args: BrandScoped): Promise<T>;
|
|
37
41
|
declare function getMyReservationDetail<T = unknown>(client: BowlosClient, args: ReservationDetailArgs): Promise<T>;
|
|
42
|
+
declare function getMyEventOrders<T = unknown>(client: BowlosClient, args: BrandScoped): Promise<T>;
|
|
43
|
+
declare function getMyEventOrder<T = unknown>(client: BowlosClient, args: EventOrderDetailArgs): Promise<T>;
|
|
38
44
|
declare function getMyMemberships<T = unknown>(client: BowlosClient, args: BrandScoped): Promise<T>;
|
|
39
45
|
declare function getMyMembershipDetail<T = unknown>(client: BowlosClient, args: MembershipDetailArgs): Promise<T>;
|
|
40
46
|
declare function getMyLoyalty<T = unknown>(client: BowlosClient, args: BrandScoped): Promise<T>;
|
|
@@ -60,6 +66,57 @@ type BrandCatalogArgs = {
|
|
|
60
66
|
brandId: string;
|
|
61
67
|
centerId?: string;
|
|
62
68
|
};
|
|
69
|
+
/** Which public surface is asking — the backend applies that surface's
|
|
70
|
+
* per-category + per-offer visibility before returning. */
|
|
71
|
+
type PublicSurface = "sdk_custom_site" | "white_label_web" | "mobile_app";
|
|
72
|
+
type CatalogCategory = "bowling" | "other_attractions" | "events" | "packages" | "memberships" | "game_passes";
|
|
73
|
+
type CatalogActionType = "book_reservation" | "view_event" | "buy_ticket" | "buy_package" | "buy_membership" | "buy_game_pass";
|
|
74
|
+
type CatalogSourceTable = "products" | "event_offers" | "packages" | "membership_templates" | "game_card_templates";
|
|
75
|
+
/** A normalized, surface-agnostic catalog item. Route by `action.type`, using
|
|
76
|
+
* the IDs in `action.payload` (e.g. `productId`, `slug`, `packageId`,
|
|
77
|
+
* `templateId`). `priceLabel` is an indicative "from $X" only (null for
|
|
78
|
+
* products — show "See times & pricing"); the binding price comes from the
|
|
79
|
+
* per-category preview after login. */
|
|
80
|
+
interface CatalogItem {
|
|
81
|
+
id: string;
|
|
82
|
+
category: CatalogCategory;
|
|
83
|
+
sourceTable: CatalogSourceTable;
|
|
84
|
+
sourceId: string;
|
|
85
|
+
title: string;
|
|
86
|
+
subtitle?: string | null;
|
|
87
|
+
description?: string | null;
|
|
88
|
+
priceLabel?: string | null;
|
|
89
|
+
imageUrl?: string | null;
|
|
90
|
+
badgeLabel?: string | null;
|
|
91
|
+
action: {
|
|
92
|
+
type: CatalogActionType;
|
|
93
|
+
payload: Record<string, string>;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
interface CatalogSection {
|
|
97
|
+
key: CatalogCategory;
|
|
98
|
+
label: string;
|
|
99
|
+
items: CatalogItem[];
|
|
100
|
+
}
|
|
101
|
+
interface CatalogResult {
|
|
102
|
+
sections: CatalogSection[];
|
|
103
|
+
}
|
|
104
|
+
/** Args for the canonical catalog read. `surface` selects which visibility
|
|
105
|
+
* rules the backend applies. */
|
|
106
|
+
type CatalogArgs = {
|
|
107
|
+
brandId: string;
|
|
108
|
+
centerId: string;
|
|
109
|
+
surface: PublicSurface;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* The canonical public catalog for a surface — every active, public,
|
|
113
|
+
* bookable/sellable item grouped into the six first-class categories, with the
|
|
114
|
+
* Center admin's per-surface category + offer visibility already applied.
|
|
115
|
+
* Anonymous. This is the recommended way to list "everything bookable here":
|
|
116
|
+
* one call, all categories, visibility-aware, consistent with the white-label
|
|
117
|
+
* web + mobile surfaces.
|
|
118
|
+
*/
|
|
119
|
+
declare function listCatalog<T = CatalogResult>(client: BowlosClient, args: CatalogArgs): Promise<T>;
|
|
63
120
|
/** One package's full detail. `shareToken` reveals a hidden/unlisted package. */
|
|
64
121
|
type PackageDetailArgs = {
|
|
65
122
|
packageId: string;
|
|
@@ -75,6 +132,14 @@ type CenterHoursArgs = {
|
|
|
75
132
|
declare function listProducts<T = unknown>(client: BowlosClient, args: CenterScoped): Promise<T>;
|
|
76
133
|
/** Upcoming pricing events (NYE Bash, tournaments…) at a Center. */
|
|
77
134
|
declare function listEvents<T = unknown>(client: BowlosClient, args: CenterScoped): Promise<T>;
|
|
135
|
+
/** Sellable event offers at a Center. These are the public lineup + event
|
|
136
|
+
* landing-page records; use this instead of `listEvents` when routing a
|
|
137
|
+
* customer to an event purchase flow. */
|
|
138
|
+
declare function listEventOffers<T = unknown>(client: BowlosClient, args: CenterScoped): Promise<T>;
|
|
139
|
+
/** One sellable event offer by landing-page slug. */
|
|
140
|
+
declare function getEventOffer<T = unknown>(client: BowlosClient, args: {
|
|
141
|
+
slug: string;
|
|
142
|
+
}): Promise<T>;
|
|
78
143
|
/** Purchasable packages at a Brand. */
|
|
79
144
|
declare function listPackages<T = unknown>(client: BowlosClient, args: BrandCatalogArgs): Promise<T>;
|
|
80
145
|
/** Full detail for one package — components, optional add-ons, allowed start
|
|
@@ -90,4 +155,4 @@ declare function listPublicMemberships<T = unknown>(client: BowlosClient, args:
|
|
|
90
155
|
/** Purchasable game cards / passes at a Brand. */
|
|
91
156
|
declare function listGameCards<T = unknown>(client: BowlosClient, args: BrandCatalogArgs): Promise<T>;
|
|
92
157
|
|
|
93
|
-
export { type BrandCatalogArgs as B, type
|
|
158
|
+
export { getPackage as A, type BrandCatalogArgs as B, type CatalogActionType as C, listCatalog as D, type EventOrderDetailArgs as E, type FlashBookingOptionsArgs as F, listEventOffers as G, listEvents as H, listGameCards as I, listPackages as J, listProducts as K, listPublicMemberships as L, type MembershipDetailArgs as M, type PackageDetailArgs as P, type ReservationDetailArgs as R, type BrandScoped as a, type CatalogArgs as b, type CatalogCategory as c, type CatalogItem as d, type CatalogResult as e, type CatalogSection as f, type CatalogSourceTable as g, type CenterHoursArgs as h, type CenterScoped as i, type FlashSaleArgs as j, type FlashSalesArgs as k, type PublicSurface as l, getCenterHours as m, getEventOffer as n, getFlashSale as o, getFlashSaleBookingOptions as p, getFlashSales as q, getMyCredits as r, getMyEventOrder as s, getMyEventOrders as t, getMyLoyalty as u, getMyMembershipDetail as v, getMyMemberships as w, getMyPasses as x, getMyReservationDetail as y, getMyReservations as z };
|