@bowlos/reservations 0.36.0 → 0.41.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 +300 -0
- package/HEADLESS.md +534 -10
- package/README.md +242 -2
- package/dist/{data-BJkB-tvM.d.cts → account-DEX2Lr78.d.cts} +208 -1
- package/dist/{data-BJkB-tvM.d.ts → account-DEX2Lr78.d.ts} +208 -1
- package/dist/booking-change-4DGu-B08.d.ts +1282 -0
- package/dist/booking-change-aK6P37FZ.d.cts +1282 -0
- package/dist/{chunk-3JSVEOKG.js → chunk-44WKP6MW.js} +32 -5
- package/dist/chunk-44WKP6MW.js.map +1 -0
- package/dist/{chunk-TEHRROVY.js → chunk-BWJHRJN6.js} +47 -192
- package/dist/chunk-BWJHRJN6.js.map +1 -0
- package/dist/{chunk-Y3YSDO3H.js → chunk-FMFHNBDH.js} +56 -5
- package/dist/chunk-FMFHNBDH.js.map +1 -0
- package/dist/chunk-I37IJNYU.js +139 -0
- package/dist/chunk-I37IJNYU.js.map +1 -0
- package/dist/chunk-VJIS56OO.js +717 -0
- package/dist/chunk-VJIS56OO.js.map +1 -0
- package/dist/cli.cjs +29 -3
- package/dist/cli.cjs.map +1 -1
- package/dist/components.cjs +1595 -2
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +208 -7
- package/dist/components.d.ts +208 -7
- package/dist/components.js +1045 -7
- package/dist/components.js.map +1 -1
- package/dist/index.cjs +270 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +56 -5
- package/dist/index.d.ts +56 -5
- package/dist/index.js +58 -3
- package/dist/index.js.map +1 -1
- package/dist/payments.cjs +203 -0
- package/dist/payments.cjs.map +1 -1
- package/dist/payments.d.cts +16 -2
- package/dist/payments.d.ts +16 -2
- package/dist/payments.js +78 -2
- package/dist/payments.js.map +1 -1
- package/dist/{react-0MyyTtE4.d.ts → react-CrRciA7I.d.ts} +2 -2
- package/dist/{react-CWAG4cW0.d.cts → react-QJrsaOnN.d.cts} +2 -2
- package/dist/react.cjs +758 -27
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +139 -12
- package/dist/react.d.ts +139 -12
- package/dist/react.js +72 -4
- package/dist/react.js.map +1 -1
- package/package.json +8 -2
- package/templates/center-site/README.md +5 -0
- package/templates/center-site/app/account/game-cards/page.tsx +17 -0
- package/templates/center-site/app/account/layout.tsx +16 -0
- package/templates/center-site/app/account/memberships/[id]/page.tsx +23 -0
- package/templates/center-site/app/account/memberships/page.tsx +33 -0
- package/templates/center-site/app/account/orders/page.tsx +17 -0
- package/templates/center-site/app/account/page.tsx +14 -0
- package/templates/center-site/app/account/payment-methods/page.tsx +23 -0
- package/templates/center-site/app/account/privacy/page.tsx +17 -0
- package/templates/center-site/app/account/profile/page.tsx +45 -0
- package/templates/center-site/app/account/reservations/[displayId]/change/page.tsx +46 -0
- package/templates/center-site/app/account/reservations/[displayId]/page.tsx +41 -0
- package/templates/center-site/app/account/reservations/page.tsx +35 -0
- package/templates/center-site/app/account/security/page.tsx +17 -0
- package/templates/center-site/app/events/[slug]/page.tsx +130 -0
- package/templates/center-site/app/events/page.tsx +57 -0
- package/templates/center-site/app/pay/[token]/page.tsx +53 -0
- package/templates/center-site/app/site-header.tsx +1 -0
- package/templates/center-site/lib/reservation.ts +14 -0
- package/templates/center-site/package.json +1 -1
- package/templates/center-site/tsconfig.json +7 -9
- package/dist/account-DfM2COaz.d.ts +0 -210
- package/dist/account-oCvYWmO9.d.cts +0 -210
- package/dist/catalog-DbhdwmnX.d.cts +0 -224
- package/dist/catalog-XkjgPI5C.d.ts +0 -224
- package/dist/chunk-3JSVEOKG.js.map +0 -1
- package/dist/chunk-TEHRROVY.js.map +0 -1
- package/dist/chunk-Y3YSDO3H.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @bowlos/reservations
|
|
2
2
|
|
|
3
|
+
**Building a complete customer website? Start with the [agent build guide](./AGENTS.md).**
|
|
4
|
+
|
|
3
5
|
Headless client + React hooks for the **BowlOS public API gateway** — white-label
|
|
4
6
|
booking, customer accounts, and flash-sale reads for third-party-hosted center
|
|
5
7
|
websites. Built for React/Next sites (including AI-agent-built ones) that book on
|
|
@@ -37,6 +39,10 @@ Prefer to wire it by hand, or add the SDK to an existing app? Read on.
|
|
|
37
39
|
|
|
38
40
|
## Install
|
|
39
41
|
|
|
42
|
+
**Building a complete site (or an agent doing it)?** Follow the exact copy-paste steps in
|
|
43
|
+
[AGENTS.md → Install and configure](./AGENTS.md#install-and-configure): package and peer installs,
|
|
44
|
+
every env var, doctor, init, local run, test → live, and troubleshooting.
|
|
45
|
+
|
|
40
46
|
```bash
|
|
41
47
|
npm install @bowlos/reservations
|
|
42
48
|
```
|
|
@@ -163,8 +169,8 @@ the session with `useAccount` (`signIn` / `signUp` / `link` / `signOut`).
|
|
|
163
169
|
|
|
164
170
|
**Self-serve cancel (v0.23.0):** preview → confirm → cancel for reservations,
|
|
165
171
|
event orders, package orders, and game cards — e.g. `useGameCardCancelPreview`
|
|
166
|
-
+ `useCancelMyGameCard`. Returns
|
|
167
|
-
|
|
172
|
+
+ `useCancelMyGameCard`. Returns store credit per the Center's policy; game cards cancel only while fully unused.
|
|
173
|
+
Booking changes support credit or card refunds (see the 0.40.0 section). See the
|
|
168
174
|
"Self-serve cancel" section of `HEADLESS.md`.
|
|
169
175
|
|
|
170
176
|
Every read also has a framework-agnostic function in the core entry
|
|
@@ -581,3 +587,237 @@ public sale prices. `createFlashSaleBooking().breakdown.tierDiscountCents` repor
|
|
|
581
587
|
savings already included in `baseSubtotalCents` and `amountDueCents`. Display it as
|
|
582
588
|
an informational discount line; do not subtract it a second time. Existing sales
|
|
583
589
|
with the toggle enabled begin applying this benefit when the Convex change deploys.
|
|
590
|
+
|
|
591
|
+
## Customer toolkit route wrappers (v0.37.0)
|
|
592
|
+
|
|
593
|
+
| Core helper `(client, args)` | React hook | Gateway route |
|
|
594
|
+
| -------------------------------- | ------------------------------------------------ | -------------------------------- |
|
|
595
|
+
| `updateMyProfile` | `useUpdateMyProfile()` | `updateMyProfile` |
|
|
596
|
+
| `getMyCommunicationPrefs` | `useMyCommunicationPrefs(args, options?)` | `listMyMarketingPrefs` |
|
|
597
|
+
| `setMyCommunicationPref` | `useSetMyCommunicationPref()` | `setMyMarketingPref` |
|
|
598
|
+
| `setMyMobile` | `useSetMyMobile()` | `setMyMobile` |
|
|
599
|
+
| `submitSupportRequest` | `useSubmitSupportRequest()` | `submitMySupportRequest` |
|
|
600
|
+
| `deleteMyAccount` | `useDeleteMyAccount()` | `deleteMyAccount` |
|
|
601
|
+
| `exportMyData` | `useExportMyData()` | `exportMyData` |
|
|
602
|
+
| `getMyPackageOrders` | `useMyPackageOrders(args, options?)` | `listMyPackageOrders` |
|
|
603
|
+
| `getMyPackageOrder` | `useMyPackageOrder(args, options?)` | `getMyPackageOrder` |
|
|
604
|
+
| `getMyMembershipMembers` | `useMyMembershipMembers(args, options?)` | `listMyMembershipMembers` |
|
|
605
|
+
| `addMyMembershipMember` | `useAddMyMembershipMember()` | `addMyMembershipMember` |
|
|
606
|
+
| `getMyLoyaltyHistory` | `useMyLoyaltyHistory(args, options?)` | `listMyLoyaltyHistory` |
|
|
607
|
+
| `getReceipt` | `useReceipt(args, options?)` | `getReservationByDisplayId` |
|
|
608
|
+
| `getProduct` | `useProduct(args, options?)` | `getPublicProduct` |
|
|
609
|
+
| `getMembership` | `useMembership(args, options?)` | `getPublicMembership` |
|
|
610
|
+
| `getGameCard` | `useGameCard(args, options?)` | `getPublicGameCard` |
|
|
611
|
+
| `listProductSubtypes` | `useProductSubtypes(args, options?)` | `listSubtypesForProduct` |
|
|
612
|
+
| `listBrandMemberships` | `useBrandMemberships(args, options?)` | `listBrandMemberships` |
|
|
613
|
+
| `getPackagesLabel` | `usePackagesLabel(args, options?)` | `getBrandPackagesLabelPublic` |
|
|
614
|
+
| `previewSlotPrices` | `useSlotPrices(args, options?)` | `previewSlotPrices` |
|
|
615
|
+
| `listHours` | `useHours(args, options?)` | `listPublicHours` |
|
|
616
|
+
| `getOperatingHours` | `useOperatingHours(args, options?)` | `getOperatingHours` |
|
|
617
|
+
| `getCenterOperatingHoursForType` | `useCenterOperatingHoursForType(args, options?)` | `getCenterOperatingHoursForType` |
|
|
618
|
+
| `listCenters` | `useCenters(args, options?)` | `listPublicCenters` |
|
|
619
|
+
| `cancelMyMembership` | `useCancelMyMembership()` | `cancelMyMembership` |
|
|
620
|
+
| `applyMyModification` | `useApplyMyModification()` | `applyMyModification` |
|
|
621
|
+
| `cancelCheckoutPayment` | `—` | `cancelCheckoutPaymentIntent` |
|
|
622
|
+
|
|
623
|
+
Core helpers and their concrete `XArgs` / `XResult` types are exported from
|
|
624
|
+
`@bowlos/reservations` (`X` is the helper name with its first letter capitalized,
|
|
625
|
+
for example `GetMyPackageOrdersResult`). Hooks are exported from
|
|
626
|
+
`@bowlos/reservations/react`. The wire types mirror the existing validators and
|
|
627
|
+
success payloads; IDs are strings. Mount `BowlosProvider` with your client.
|
|
628
|
+
|
|
629
|
+
Query hooks accept `(args, options?)` and return `{ data, loading, error, refetch }`.
|
|
630
|
+
Write hooks return `{ run(args), data, loading, error, reset }`.
|
|
631
|
+
`useExportMyData()` is lazy: call `run({ brandId })` when the customer requests a
|
|
632
|
+
download. It returns the existing **v1** export, including the profile, raw
|
|
633
|
+
reservation/credit/loyalty/membership/pass records and communication subscriptions;
|
|
634
|
+
it does not add the planned v2 export fields.
|
|
635
|
+
|
|
636
|
+
Profile, communication preferences, mobile, support, export, deletion, package
|
|
637
|
+
orders, membership roster, loyalty history, membership cancellation and
|
|
638
|
+
modification require a customer session. These account calls require `brandId`.
|
|
639
|
+
`updateMyProfile` requires `expectedVersion`; optional profile changes include
|
|
640
|
+
`fullName`, `mobile`, `marketingOptIn` and `preferredCenterId` (nullable mobile and
|
|
641
|
+
preferred center clear their values). Support accepts `message` and optional
|
|
642
|
+
`centerId`. Communication preferences use `channel: "email" | "sms"` and
|
|
643
|
+
`status: "subscribed" | "unsubscribed"`; SMS opt-in needs `acceptedTerms: true` and
|
|
644
|
+
a mobile number. Transactional delivery is unaffected.
|
|
645
|
+
|
|
646
|
+
`getMyPackageOrders` lists package bookings, while `getMyPackageOrder` requires
|
|
647
|
+
`orderId`. Membership roster calls take `membershipId`; adding a member also
|
|
648
|
+
takes their `email`. Loyalty history takes `brandId`. `getReceipt` takes
|
|
649
|
+
`displayId` and returns the reservation receipt with its frozen snapshot, payment
|
|
650
|
+
trail and credit entries. The receipt and catalog/hours/centers reads use the
|
|
651
|
+
existing public routes. Product/subtype reads take `productId`; membership/game
|
|
652
|
+
card reads take `templateId` and optional `shareToken`. Brand memberships, packages
|
|
653
|
+
label and centers take `brandId`. `listHours` takes `centerId`;
|
|
654
|
+
`getOperatingHours` takes `productId, dateISO`, and
|
|
655
|
+
`getCenterOperatingHoursForType` takes `centerId, attractionTypeKey, dateISO`.
|
|
656
|
+
`previewSlotPrices` takes `centerId, productId, dateISO, mode, duration, slots` and
|
|
657
|
+
optional `units, persons, games`, returning each slot's `headlinePriceCents`
|
|
658
|
+
(which can be null). `cancelCheckoutPayment` takes `{ refToken }` and returns
|
|
659
|
+
`{ cancelled }`.
|
|
660
|
+
|
|
661
|
+
`deleteMyAccount` and `useDeleteMyAccount` use the current v1
|
|
662
|
+
`{ brandId, confirmation: "DELETE" }` contract. Successful deletion then runs the
|
|
663
|
+
client's best-effort sign-out and clears local tokens; failed deletion preserves
|
|
664
|
+
the session and surfaces the existing gateway error. No new error-details channel
|
|
665
|
+
is introduced in this version.
|
|
666
|
+
|
|
667
|
+
`cancelMyMembership` requires `{ brandId, membershipId, expectedVersion,
|
|
668
|
+
idempotencyKey, reason? }`. Its result contains `id, version, status` and optional
|
|
669
|
+
`currentPeriodEndsAt`; show that end date and refresh membership reads after
|
|
670
|
+
success. `useCancelMyMembership()` supplies the idempotency key. Cancellation
|
|
671
|
+
schedules the existing end-of-period behavior; it does not request a refund.
|
|
672
|
+
|
|
673
|
+
All five `useCancelMy*` hooks and `useApplyMyModification` retain one key for
|
|
674
|
+
retries of the same inputs after network, timeout, rate-limit or server failures.
|
|
675
|
+
They rotate it after success or a terminal error, or when inputs change. `reset()`
|
|
676
|
+
explicitly begins a new action. Re-preview and refresh versions after a terminal
|
|
677
|
+
conflict before submitting again. Core functions still require caller-managed
|
|
678
|
+
`idempotencyKey`: retain it across uncertain retries. `applyMyModification` /
|
|
679
|
+
`useApplyMyModification` expose the existing apply contract (new date/time,
|
|
680
|
+
units/persons, optional games/add-ons/refund mode/credit and `expectedVersion`);
|
|
681
|
+
inspect `requiresPayment` and `pendingModificationId` in its result. For paid change
|
|
682
|
+
orchestration, use `useBookingChange` and the payment wrappers added in 0.40.0.
|
|
683
|
+
|
|
684
|
+
A non-JSON HTTP 404 now raises `ROUTE_NOT_FOUND`; a JSON route error with
|
|
685
|
+
`NOT_FOUND` still means the requested data was not found. Handle missing-route
|
|
686
|
+
errors separately in your own UI. `/ping` currently has no capabilities array,
|
|
687
|
+
so this release does not implement capability detection or probe routes to infer it.
|
|
688
|
+
|
|
689
|
+
### v0.37.0 — Existing gateway coverage (2026-10-30, unpublished)
|
|
690
|
+
|
|
691
|
+
| Version | Changes | Migration |
|
|
692
|
+
| ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
|
|
693
|
+
| 0.37.0 | Typed account/catalog/hours wrappers and hooks, package orders, membership cancellation, stable retry keys, `ROUTE_NOT_FOUND`, gateway coverage guard; shipped AGENTS.md build guide + coverage gate; completed HEADLESS v0.36.0 saved-card/password guidance | Change `^0.36.0` → `^0.37.0` explicitly; pre-1.0 caret ranges do not cross minor versions. |
|
|
694
|
+
|
|
695
|
+
Build each screen in your site's design with these hooks; no component adoption
|
|
696
|
+
is required. See [headless adoption](./HEADLESS.md#v0370--customer-toolkit-route-coverage-2026-10-30-unpublished).
|
|
697
|
+
|
|
698
|
+
For 0.37.0, migrate `^0.36.0` -> `^0.37.0` by hand. Start with [AGENTS.md](./AGENTS.md);
|
|
699
|
+
its page checklist and API/template coverage are checked by release-gate step i.
|
|
700
|
+
The [saved-card and signed-in password guidance](./HEADLESS.md#saved-cards-and-signed-in-password-changes-v0360)
|
|
701
|
+
now includes the required password-recovery link; adopt it in your own security screen.
|
|
702
|
+
|
|
703
|
+
## 0.38.0
|
|
704
|
+
|
|
705
|
+
Account deletion previews, `useAccountDeletion`, structured `BowlosApiError.details`
|
|
706
|
+
and `exportMyDataV2` short-lived downloads are available. `exportMyData` v1 is
|
|
707
|
+
now deprecated with its shape unchanged. Migration: ^0.37.0 -> ^0.38.0 by hand.
|
|
708
|
+
Adopt the consequences/token confirmation and retry contract in
|
|
709
|
+
[HEADLESS.md](./HEADLESS.md#account-deletion-and-export-v0380).
|
|
710
|
+
|
|
711
|
+
| New API | Purpose |
|
|
712
|
+
| --- | --- |
|
|
713
|
+
| `previewAccountDeletion`, `AccountDeletionPreview` | Typed consequences, phrase and preview token |
|
|
714
|
+
| `useAccountDeletion` (`/react`) | Confirmation, stale preview reload and pending Stripe retry |
|
|
715
|
+
| `exportMyDataV2`, `ExportMyDataV2Result` | Curated download URL and expiry |
|
|
716
|
+
| `BowlosApiError.details` | Optional primitive error metadata |
|
|
717
|
+
|
|
718
|
+
## 0.39.0
|
|
719
|
+
|
|
720
|
+
2026-10-30: Adds EventList and the events index template, Brand event pagination,
|
|
721
|
+
owned game-card detail/history, normalized wallet URLs, hold countdown/actions,
|
|
722
|
+
email verification, cancellation policy and typed pending cancellation.
|
|
723
|
+
See [HEADLESS.md](./HEADLESS.md#events-index-v0390) for exact contracts and adoption.
|
|
724
|
+
Migration: explicitly change `^0.38.0` → `^0.39.0`. Old wrapper arguments keep working;
|
|
725
|
+
use `includeWithoutLandingPage: false` for index links and follow every Brand cursor.
|
|
726
|
+
|
|
727
|
+
## 0.40.0
|
|
728
|
+
|
|
729
|
+
Booking changes: `previewBookingChange`, `applyBookingChange`,
|
|
730
|
+
`getPendingBookingChange`, `createBookingChangePayment` and `useBookingChange`
|
|
731
|
+
cover preview, apply, payment and webhook polling. Cheaper changes can return credit
|
|
732
|
+
or a refund; a paid change that loses its slot is automatically refunded.
|
|
733
|
+
Membership billing: `openMembershipBillingPortal` / `useOpenMembershipBillingPortal`
|
|
734
|
+
return a hosted URL. Handle `BILLING_PORTAL_UNAVAILABLE` with a venue support path.
|
|
735
|
+
Token pay links: `getPayLink`, `createPayLinkPayment`, `usePayLink`,
|
|
736
|
+
`useCreatePayLinkPayment` work without customer sign-in.
|
|
737
|
+
|
|
738
|
+
Migration: explicitly change `^0.39.0` to `^0.40.0`. Existing APIs are unchanged.
|
|
739
|
+
Use the new headless APIs with your own UI; follow the
|
|
740
|
+
[booking change](./HEADLESS.md#booking-changes-v0400) and
|
|
741
|
+
[billing and pay links](./HEADLESS.md#billing-portal-and-pay-links-v0400) contracts.
|
|
742
|
+
Version 0.41.0 adds reservation detail/change and pay-link templates;
|
|
743
|
+
0.40.0 sites can compose the same hooks in their own routes.
|
|
744
|
+
|
|
745
|
+
|
|
746
|
+
## Customer account toolkit
|
|
747
|
+
|
|
748
|
+
Build customer pages with hooks from `@bowlos/reservations/react` and core helpers
|
|
749
|
+
from `@bowlos/reservations`. Reference components are optional; keep the center's
|
|
750
|
+
own design. Mount one `BowlosProvider` for the shared customer session. The
|
|
751
|
+
[complete page checklist](./AGENTS.md#required-pages-checklist) names the shipped
|
|
752
|
+
starter file to copy or adapt for every page, including recovery and inquiry.
|
|
753
|
+
|
|
754
|
+
### Account capability map
|
|
755
|
+
|
|
756
|
+
| Capability | Headless hooks / core APIs | Optional reference | Template under `templates/center-site/app/` |
|
|
757
|
+
| --- | --- | --- | --- |
|
|
758
|
+
| Sign-in, atomic registration, recovery | `useAccount`: `signIn`, `register`, `requestPasswordReset`, `resetPassword`; `useEmailVerification` | `AuthForm`, `AuthGate` | `account/page.tsx` (adapt for a standalone recovery route) |
|
|
759
|
+
| Reservations, event orders, package orders | `useMyReservations`, `useMyEventOrders`, `useMyPackageOrders`, `useMyReservationDetail`, `useMyEventOrder`, `useMyPackageOrder`, `useReceipt` | `AccountDashboard` | `account/orders/page.tsx`, `account/reservations/[displayId]/page.tsx` |
|
|
760
|
+
| Credit, loyalty and passes | `useMyCredits`, `useMyLoyalty`, `useMyLoyaltyHistory`, `useMyPasses` | `AccountDashboard`, `AddToWalletButtons` | `account/page.tsx` |
|
|
761
|
+
| Membership members, cancellation, billing | `useMyMemberships`, `useMyMembershipDetail`, `useMyMembershipMembers`, `useAddMyMembershipMember`, `useCancelMyMembership`, `useOpenMembershipBillingPortal` | `MembershipDetail` | `account/memberships/[id]/page.tsx` |
|
|
762
|
+
| Game cards, history and wallet | `useMyGameCards`, `useMyGameCard`, `useMyGameCardHistory`, `useWalletPassUrl` | `GameCardHistory`, `AddToWalletButtons` | `account/game-cards/page.tsx` |
|
|
763
|
+
| Saved cards | `useSavedCards`, `useCreateCardSetup`, `useRemoveCard`, `useSetDefaultCard` | `SavedCards` + `AddCardForm` (`/payments`) | `account/payment-methods/page.tsx` |
|
|
764
|
+
| Password change | `useChangePassword`, `useAccount` recovery methods | `ChangePasswordForm` | `account/security/page.tsx` |
|
|
765
|
+
| Profile and consent | `useUpdateMyProfile`, `useSetMyMobile`, `useMyCommunicationPrefs`, `useSetMyCommunicationPref`, `useSubmitSupportRequest` | `ProfileForm`, `CommunicationPrefs` | `account/profile/page.tsx` |
|
|
766
|
+
| Export and deletion | `exportMyDataV2`, `useAccountDeletion` | `PrivacyCenter` | `account/privacy/page.tsx` |
|
|
767
|
+
| Cancellation and booking changes | `useReservationCancelPreview`, `useCancelMyReservation`, event/package/game-card preview and cancel hooks; `useBookingChange` | `BookingChange` | `account/reservations/[displayId]/change/page.tsx` |
|
|
768
|
+
| Token pay links | `usePayLink`, `useCreatePayLinkPayment` | `BowlosPaymentForm` (`/payments`) | `pay/[token]/page.tsx` |
|
|
769
|
+
|
|
770
|
+
`AccountDashboard` keeps its original five default sections: reservations,
|
|
771
|
+
memberships, loyalty, credit and passes. Opt in through `sections` to eventOrders,
|
|
772
|
+
packageOrders, gameCards, profile, communications, paymentMethods, security and
|
|
773
|
+
privacy; payment methods require `centerId`. `useMyPackageOrders` is a shipped
|
|
774
|
+
hook, with `getMyPackageOrders` as its core twin; open orders with `useMyPackageOrder`.
|
|
775
|
+
|
|
776
|
+
Gate wallet buttons on `pass.walletEligible`, then request a fresh normalized
|
|
777
|
+
`{ url, platform }` through `useWalletPassUrl` / `getWalletPassUrl`. Pass
|
|
778
|
+
`eligible={pass.walletEligible}` to `AddToWalletButtons`; never build a pass URL.
|
|
779
|
+
|
|
780
|
+
Cancellation routes return policy-based store credit. Booking modifications
|
|
781
|
+
separately support credit or card refunds; render the preview and resulting
|
|
782
|
+
outcome rather than promising a card refund for every cancellation. Preview is
|
|
783
|
+
read-only; apply revalidates. Paid upgrades reserve inventory while payment is
|
|
784
|
+
pending, then apply after webhook confirmation. Do not treat Stripe confirmation
|
|
785
|
+
alone as a completed change.
|
|
786
|
+
|
|
787
|
+
For `useCancelMy*` and `useApplyMyModification`, one idempotency key belongs to
|
|
788
|
+
one user action. Hooks retain it across uncertain retries, rotate after success
|
|
789
|
+
or terminal errors and when inputs change; `reset()` starts a new action. Core
|
|
790
|
+
callers retain their own key across retries. Modification/payment and pay-link
|
|
791
|
+
PaymentIntents use server-derived keys: do not supply a client key to those calls.
|
|
792
|
+
|
|
793
|
+
Keep a reachable email-code recovery page, including for signed-in customers.
|
|
794
|
+
Handle `CURRENT_PASSWORD_INCORRECT` inline without signing out. Deletion needs a
|
|
795
|
+
fresh preview, exact confirmation and a working retry/support path. Disable
|
|
796
|
+
completion, correction, capitalization and spell checking on confirmation inputs.
|
|
797
|
+
Use `err.code`, Center-local dates, server totals and returned Stripe account/key/mode.
|
|
798
|
+
Never expose secret keys. Transactional sends remain independent of marketing consent.
|
|
799
|
+
|
|
800
|
+
### Toolkit migration by release
|
|
801
|
+
|
|
802
|
+
Pre-1.0 caret ranges stay within one minor: each row requires an explicit dependency
|
|
803
|
+
range edit. Existing calls and dashboard defaults remain supported. Adopt the
|
|
804
|
+
hooks selectively; no reference component migration is required.
|
|
805
|
+
|
|
806
|
+
| Release | Dependency change | Headless adoption |
|
|
807
|
+
| --- | --- | --- |
|
|
808
|
+
| 0.37.0 | `^0.36.0` → `^0.37.0` | Add typed account/catalog reads, package-order lists/details, membership cancellation and per-action retry keys. Handle `ROUTE_NOT_FOUND` separately from missing records. |
|
|
809
|
+
| 0.38.0 | `^0.37.0` → `^0.38.0` | Add deletion preview/token/retry handling and short-lived `exportMyDataV2` downloads. Legacy export v1 retains its shape. |
|
|
810
|
+
| 0.39.0 | `^0.38.0` → `^0.39.0` | Add paginated events/history, fresh wallet URLs, hold actions and email verification. Follow cursors until `isDone`, even after an empty page. |
|
|
811
|
+
| 0.40.0 | `^0.39.0` → `^0.40.0` | Compose booking preview/apply/payment/polling, allowlisted billing returns and token pay links. Preserve loaded versions and server-derived payment keys. |
|
|
812
|
+
| 0.41.0 | `^0.40.0` → `^0.41.0` | Keep existing hook markup or copy optional account components and detail/payment templates. Explicitly select new dashboard sections and provide `centerId` for saved cards. |
|
|
813
|
+
|
|
814
|
+
## 0.41.0
|
|
815
|
+
|
|
816
|
+
2026-10-30: Customer account toolkit documentation, final agent checklist and
|
|
817
|
+
optional account reference components/templates from PR-10. Public hook contracts
|
|
818
|
+
and dashboard defaults are unchanged. This release introduces no backend routes.
|
|
819
|
+
|
|
820
|
+
Migration: explicitly update `^0.40.0` to `^0.41.0`; follow the capability map above
|
|
821
|
+
and the [reference component contracts](./HEADLESS.md#reference-account-components-v0410).
|
|
822
|
+
Keep custom headless UI or adopt individual references. Test recovery, cancellation,
|
|
823
|
+
wallet eligibility, deletion retry and payment completion in the site's own design.
|
|
@@ -775,4 +775,211 @@ declare function abandonCheckout(client: BowlosClient, refToken: string): Promis
|
|
|
775
775
|
ok: boolean;
|
|
776
776
|
}>;
|
|
777
777
|
|
|
778
|
-
|
|
778
|
+
/**
|
|
779
|
+
* Typed account + flash reads for @bowlos/reservations.
|
|
780
|
+
*
|
|
781
|
+
* Session-scoped account reads (require a signed-in customer) and the
|
|
782
|
+
* session-aware flash-sale reads. Args are typed precisely — every account read
|
|
783
|
+
* is brand-scoped. Results are generic (`<T = unknown>`): parameterize with your
|
|
784
|
+
* own shape, or read `unknown` and narrow. (The backend return shapes are rich
|
|
785
|
+
* and evolving; the SDK doesn't pin them here.) Each read has a framework-agnostic
|
|
786
|
+
* function here and a React hook in `hooks.tsx`.
|
|
787
|
+
*/
|
|
788
|
+
|
|
789
|
+
/** Every account read is scoped to the customer's Brand. */
|
|
790
|
+
type BrandScoped = {
|
|
791
|
+
brandId: string;
|
|
792
|
+
};
|
|
793
|
+
type ReservationDetailArgs = {
|
|
794
|
+
brandId: string;
|
|
795
|
+
displayId: string;
|
|
796
|
+
};
|
|
797
|
+
type EventOrderDetailArgs = {
|
|
798
|
+
brandId: string;
|
|
799
|
+
orderId: string;
|
|
800
|
+
};
|
|
801
|
+
type MembershipDetailArgs = {
|
|
802
|
+
brandId: string;
|
|
803
|
+
membershipId: string;
|
|
804
|
+
};
|
|
805
|
+
type FlashSaleArgs = {
|
|
806
|
+
slug: string;
|
|
807
|
+
};
|
|
808
|
+
type FlashBookingOptionsArgs = {
|
|
809
|
+
slug: string;
|
|
810
|
+
itemId: string;
|
|
811
|
+
};
|
|
812
|
+
type FlashSalesArgs = {
|
|
813
|
+
brandId: string;
|
|
814
|
+
};
|
|
815
|
+
declare function getMyReservations<T = unknown>(client: BowlosClient, args: BrandScoped): Promise<T>;
|
|
816
|
+
declare function getMyReservationDetail<T = unknown>(client: BowlosClient, args: ReservationDetailArgs): Promise<T>;
|
|
817
|
+
declare function getMyEventOrders<T = unknown>(client: BowlosClient, args: BrandScoped): Promise<T>;
|
|
818
|
+
declare function getMyEventOrder<T = unknown>(client: BowlosClient, args: EventOrderDetailArgs): Promise<T>;
|
|
819
|
+
declare function getMyMemberships<T = unknown>(client: BowlosClient, args: BrandScoped): Promise<T>;
|
|
820
|
+
declare function getMyMembershipDetail<T = unknown>(client: BowlosClient, args: MembershipDetailArgs): Promise<T>;
|
|
821
|
+
declare function getMyLoyalty<T = unknown>(client: BowlosClient, args: BrandScoped): Promise<T>;
|
|
822
|
+
declare function getMyCredits<T = unknown>(client: BowlosClient, args: BrandScoped): Promise<T>;
|
|
823
|
+
declare function getMyPasses<T = unknown>(client: BowlosClient, args: BrandScoped): Promise<T>;
|
|
824
|
+
declare function getMyGameCards<T = MyGameCard[]>(client: BowlosClient, args: BrandScoped): Promise<T>;
|
|
825
|
+
/** Outcome preview shared by all four cancel types. `bucket`/`hoursBeforeStart`/
|
|
826
|
+
* `forfeitCents` are inert (null/0) for game cards (no time policy). */
|
|
827
|
+
interface CancelPreview {
|
|
828
|
+
cancellable: boolean;
|
|
829
|
+
reason: string | null;
|
|
830
|
+
bucket: string | null;
|
|
831
|
+
hoursBeforeStart: number;
|
|
832
|
+
creditCents: number;
|
|
833
|
+
forfeitCents: number;
|
|
834
|
+
paidCents: number;
|
|
835
|
+
}
|
|
836
|
+
interface CancelResult {
|
|
837
|
+
id: string;
|
|
838
|
+
status: string;
|
|
839
|
+
creditCents: number;
|
|
840
|
+
bucket?: string | null;
|
|
841
|
+
hoursBeforeStart?: number;
|
|
842
|
+
forfeitCents?: number;
|
|
843
|
+
version?: number;
|
|
844
|
+
}
|
|
845
|
+
interface MyGameCard {
|
|
846
|
+
id: string;
|
|
847
|
+
displayId: string;
|
|
848
|
+
cardName: string;
|
|
849
|
+
status: "active" | "depleted" | "expired" | "cancelled" | "refunded";
|
|
850
|
+
totalGames: number;
|
|
851
|
+
remainingGames: number;
|
|
852
|
+
shoesIncluded: boolean;
|
|
853
|
+
purchasedAt: number;
|
|
854
|
+
expiresAt: number;
|
|
855
|
+
paidCents: number;
|
|
856
|
+
/** Precomputed unused-only rule; the per-card preview is the source of truth. */
|
|
857
|
+
cancellable: boolean;
|
|
858
|
+
}
|
|
859
|
+
type ReservationCancelArgs = {
|
|
860
|
+
brandId: string;
|
|
861
|
+
reservationId: string;
|
|
862
|
+
expectedVersion: number;
|
|
863
|
+
reason?: string;
|
|
864
|
+
/** Per-attempt key; safe to retry. */
|
|
865
|
+
idempotencyKey: string;
|
|
866
|
+
};
|
|
867
|
+
type OrderCancelArgs = {
|
|
868
|
+
brandId: string;
|
|
869
|
+
orderId: string;
|
|
870
|
+
reason?: string;
|
|
871
|
+
idempotencyKey: string;
|
|
872
|
+
};
|
|
873
|
+
type GameCardCancelArgs = {
|
|
874
|
+
brandId: string;
|
|
875
|
+
cardId: string;
|
|
876
|
+
reason?: string;
|
|
877
|
+
idempotencyKey: string;
|
|
878
|
+
};
|
|
879
|
+
declare function previewReservationCancellation<T = CancelPreview>(client: BowlosClient, args: {
|
|
880
|
+
brandId: string;
|
|
881
|
+
reservationId: string;
|
|
882
|
+
}): Promise<T>;
|
|
883
|
+
declare function previewEventOrderCancellation<T = CancelPreview>(client: BowlosClient, args: {
|
|
884
|
+
brandId: string;
|
|
885
|
+
orderId: string;
|
|
886
|
+
}): Promise<T>;
|
|
887
|
+
declare function previewPackageOrderCancellation<T = CancelPreview>(client: BowlosClient, args: {
|
|
888
|
+
brandId: string;
|
|
889
|
+
orderId: string;
|
|
890
|
+
}): Promise<T>;
|
|
891
|
+
declare function previewGameCardCancellation<T = CancelPreview>(client: BowlosClient, args: {
|
|
892
|
+
brandId: string;
|
|
893
|
+
cardId: string;
|
|
894
|
+
}): Promise<T>;
|
|
895
|
+
declare function cancelMyReservation<T = CancelResult>(client: BowlosClient, args: ReservationCancelArgs): Promise<T>;
|
|
896
|
+
declare function cancelMyEventOrder<T = CancelResult>(client: BowlosClient, args: OrderCancelArgs): Promise<T>;
|
|
897
|
+
declare function cancelMyPackageOrder<T = CancelResult>(client: BowlosClient, args: OrderCancelArgs): Promise<T>;
|
|
898
|
+
declare function cancelMyGameCard<T = CancelResult>(client: BowlosClient, args: GameCardCancelArgs): Promise<T>;
|
|
899
|
+
declare function getFlashSale<T = unknown>(client: BowlosClient, args: FlashSaleArgs): Promise<T>;
|
|
900
|
+
/** The public flash-sale index for a Brand (live + upcoming; no prices). Public. */
|
|
901
|
+
declare function getFlashSales<T = unknown>(client: BowlosClient, args: FlashSalesArgs): Promise<T>;
|
|
902
|
+
declare function getFlashSaleBookingOptions<T = unknown>(client: BowlosClient, args: FlashBookingOptionsArgs): Promise<T>;
|
|
903
|
+
type CreateFlashSaleBookingArgs = {
|
|
904
|
+
slug: string;
|
|
905
|
+
itemId: string;
|
|
906
|
+
dateISO: string;
|
|
907
|
+
startMinuteOfDay: number;
|
|
908
|
+
durationMinutes: number;
|
|
909
|
+
units: number;
|
|
910
|
+
/** Per-attempt key; replays return the original checkout. */
|
|
911
|
+
idempotencyKey: string;
|
|
912
|
+
};
|
|
913
|
+
interface FlashSaleBookingResult {
|
|
914
|
+
/** Handle for the rest of the checkout: mint the PaymentIntent with
|
|
915
|
+
* `createCheckoutPaymentIntent(client, { refToken })`, then poll
|
|
916
|
+
* `getCheckoutStatus(client, refToken)` to materialization. */
|
|
917
|
+
refToken: string;
|
|
918
|
+
/** The SALE-priced total the PaymentIntent charges (base at the flash
|
|
919
|
+
* price + tax + the Center fee). */
|
|
920
|
+
amountDueCents: number;
|
|
921
|
+
holdExpiresAt: number;
|
|
922
|
+
breakdown: {
|
|
923
|
+
/** Tier savings already removed from baseSubtotalCents; do not subtract again. */
|
|
924
|
+
tierDiscountCents: number;
|
|
925
|
+
baseSubtotalCents: number;
|
|
926
|
+
reservationFeeCents: number;
|
|
927
|
+
reservationFeeLabel: string | null;
|
|
928
|
+
taxAddedCents: number;
|
|
929
|
+
taxIncludedCents: number;
|
|
930
|
+
totalCents: number;
|
|
931
|
+
};
|
|
932
|
+
}
|
|
933
|
+
/**
|
|
934
|
+
* v0.22.1 — book a flash-sale reservation item at its SALE price (the flash
|
|
935
|
+
* analog of `eventOfferSlug`: the server binds the item's sale price, holds
|
|
936
|
+
* the inventory, and opens a checkout). Signed-in customers only. Pick the
|
|
937
|
+
* date/time from `getFlashSaleBookingOptions` — the purpose-built option
|
|
938
|
+
* list — never the regular booking calendar.
|
|
939
|
+
*/
|
|
940
|
+
declare function createFlashSaleBooking(client: BowlosClient, args: CreateFlashSaleBookingArgs): Promise<FlashSaleBookingResult>;
|
|
941
|
+
/** Saved cards belong to the active location's connected Stripe account. */
|
|
942
|
+
type SavedCardScope = {
|
|
943
|
+
brandId: string;
|
|
944
|
+
centerId: string;
|
|
945
|
+
};
|
|
946
|
+
type SavedCardArgs = SavedCardScope & {
|
|
947
|
+
paymentMethodId: string;
|
|
948
|
+
};
|
|
949
|
+
interface SavedCard {
|
|
950
|
+
id: string;
|
|
951
|
+
brand: string;
|
|
952
|
+
last4: string;
|
|
953
|
+
expMonth: number;
|
|
954
|
+
expYear: number;
|
|
955
|
+
isDefault: boolean;
|
|
956
|
+
}
|
|
957
|
+
interface SavedCardsResult {
|
|
958
|
+
methods: SavedCard[];
|
|
959
|
+
chargeable: boolean;
|
|
960
|
+
}
|
|
961
|
+
interface CardSetupResult {
|
|
962
|
+
clientSecret: string;
|
|
963
|
+
publishableKey: string;
|
|
964
|
+
stripeAccount: string;
|
|
965
|
+
stripeMode: "test" | "live";
|
|
966
|
+
merchantDisplayName: string;
|
|
967
|
+
}
|
|
968
|
+
type ChangePasswordArgs = {
|
|
969
|
+
currentPassword: string;
|
|
970
|
+
newPassword: string;
|
|
971
|
+
};
|
|
972
|
+
declare function listSavedCards(client: BowlosClient, args: SavedCardScope): Promise<SavedCardsResult>;
|
|
973
|
+
declare function createCardSetup(client: BowlosClient, args: SavedCardScope): Promise<CardSetupResult>;
|
|
974
|
+
declare function removeSavedCard(client: BowlosClient, args: SavedCardArgs): Promise<{
|
|
975
|
+
detached: boolean;
|
|
976
|
+
}>;
|
|
977
|
+
declare function setDefaultCard(client: BowlosClient, args: SavedCardArgs): Promise<{
|
|
978
|
+
ok: boolean;
|
|
979
|
+
}>;
|
|
980
|
+
/** Success invalidates all sessions; discard local tokens and show sign-in. */
|
|
981
|
+
declare function changePassword(client: BowlosClient, args: ChangePasswordArgs): Promise<{
|
|
982
|
+
ok: true;
|
|
983
|
+
}>;
|
|
984
|
+
|
|
985
|
+
export { type PackageCheckoutStatus as $, type AuthState as A, BowlosClient as B, type CancelPreview as C, type FlashSaleBookingResult as D, type EventOrderDetailArgs as E, type FetchLike as F, type FlashSalesArgs as G, type GameCardCancelArgs as H, type GameCardCheckoutStatus as I, type GameCardPreviewArgs as J, type GameCardPreviewResult as K, type GameCardPurchaseArgs as L, type GameCardPurchaseIntent as M, type GameCardStatusResult as N, type LinkProfile as O, type MembershipCheckoutStatus as P, type MembershipDetailArgs as Q, type MembershipPreviewArgs as R, type MembershipPreviewResult as S, type MembershipPurchaseArgs as T, type MembershipPurchaseIntent as U, type MembershipStatusResult as V, type MembershipSubscriptionArgs as W, type MembershipSubscriptionIntent as X, type MembershipSubscriptionPreviewResult as Y, type MyGameCard as Z, type OrderCancelArgs as _, type AvailabilityArgs as a, previewGameCardCancellation as a$, type PackagePreviewArgs as a0, type PackagePreviewResult as a1, type PackagePurchaseArgs as a2, type PackagePurchaseIntent as a3, type PackageStatusResult as a4, type PaymentIntentInfo as a5, type PingResult as a6, type PricingMode as a7, type PublicAddon as a8, type ReservationCancelArgs as a9, createPackageOrder as aA, generateIdempotencyKey as aB, getCheckoutStatus as aC, getEventTicketStatus as aD, getFlashSale as aE, getFlashSaleBookingOptions as aF, getFlashSales as aG, getGameCardStatus as aH, getMembershipStatus as aI, getMyCredits as aJ, getMyEventOrder as aK, getMyEventOrders as aL, getMyGameCards as aM, getMyLoyalty as aN, getMyMembershipDetail as aO, getMyMemberships as aP, getMyPasses as aQ, getMyReservationDetail as aR, getMyReservations as aS, getPackageStatus as aT, listAddons as aU, listSavedCards as aV, listStartTimes as aW, localStorageTokenStore as aX, previewEventOrderCancellation as aY, previewEventTicket as aZ, previewGameCard as a_, type ReservationDetailArgs as aa, type SavedCard as ab, type SavedCardArgs as ac, type SavedCardScope as ad, type SavedCardsResult as ae, type StartTimesArgs as af, type TokenStore as ag, type Tokens as ah, abandonCheckout as ai, availableUnitCount as aj, bookingPreview as ak, cancelMyEventOrder as al, cancelMyGameCard as am, cancelMyPackageOrder as an, cancelMyReservation as ao, changePassword as ap, checkAvailability as aq, createBooking as ar, createBowlosClient as as, createCardSetup as at, createCheckoutPaymentIntent as au, createEventTicketOrder as av, createFlashSaleBooking as aw, createGameCardOrder as ax, createMembershipOrder as ay, createMembershipSubscriptionOrder as az, type AvailabilityResult as b, previewMembership as b0, previewMembershipSubscription as b1, previewPackage as b2, previewPackageOrderCancellation as b3, previewReservationCancellation as b4, removeSavedCard as b5, setDefaultCard as b6, type BookingAddonSelection as c, type BookingCustomer as d, type BookingHold as e, type BookingPreviewArgs as f, type BookingQuote as g, type BowlosClientConfig as h, type BrandScoped as i, type CancelResult as j, type CardSetupResult as k, type ChangePasswordArgs as l, type CheckoutStatus as m, type CheckoutStatusResult as n, type ConnectedPaymentInput as o, type CreateBookingArgs as p, type CreateFlashSaleBookingArgs as q, type Customer as r, type EventTicketCheckoutStatus as s, type EventTicketPreviewArgs as t, type EventTicketPreviewResult as u, type EventTicketPurchaseArgs as v, type EventTicketPurchaseIntent as w, type EventTicketStatusResult as x, type FlashBookingOptionsArgs as y, type FlashSaleArgs as z };
|