@bowlos/reservations 0.36.0 → 0.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/AGENTS.md +306 -0
  2. package/HEADLESS.md +595 -10
  3. package/README.md +303 -2
  4. package/dist/account-B4sZBmPI.d.cts +1837 -0
  5. package/dist/account-B4sZBmPI.d.ts +1837 -0
  6. package/dist/booking-change-Dd4PVgd3.d.cts +487 -0
  7. package/dist/booking-change-DzYs9133.d.ts +487 -0
  8. package/dist/chunk-4JMGS4YB.js +808 -0
  9. package/dist/chunk-4JMGS4YB.js.map +1 -0
  10. package/dist/chunk-I37IJNYU.js +139 -0
  11. package/dist/chunk-I37IJNYU.js.map +1 -0
  12. package/dist/{chunk-Y3YSDO3H.js → chunk-T2E6AEC7.js} +150 -6
  13. package/dist/chunk-T2E6AEC7.js.map +1 -0
  14. package/dist/{chunk-3JSVEOKG.js → chunk-V4JRDYW4.js} +61 -6
  15. package/dist/chunk-V4JRDYW4.js.map +1 -0
  16. package/dist/{chunk-TEHRROVY.js → chunk-YQRTBGXU.js} +47 -192
  17. package/dist/chunk-YQRTBGXU.js.map +1 -0
  18. package/dist/cli.cjs +34 -3
  19. package/dist/cli.cjs.map +1 -1
  20. package/dist/components.cjs +2059 -153
  21. package/dist/components.cjs.map +1 -1
  22. package/dist/components.d.cts +214 -7
  23. package/dist/components.d.ts +214 -7
  24. package/dist/components.js +1148 -7
  25. package/dist/components.js.map +1 -1
  26. package/dist/index.cjs +303 -3
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +56 -5
  29. package/dist/index.d.ts +56 -5
  30. package/dist/index.js +58 -3
  31. package/dist/index.js.map +1 -1
  32. package/dist/payments.cjs +225 -0
  33. package/dist/payments.cjs.map +1 -1
  34. package/dist/payments.d.cts +24 -2
  35. package/dist/payments.d.ts +24 -2
  36. package/dist/payments.js +4 -1
  37. package/dist/payments.js.map +1 -1
  38. package/dist/{react-CWAG4cW0.d.cts → react-C6NWC80d.d.cts} +2 -2
  39. package/dist/{react-0MyyTtE4.d.ts → react-DVdtpw5n.d.ts} +2 -2
  40. package/dist/react.cjs +870 -27
  41. package/dist/react.cjs.map +1 -1
  42. package/dist/react.d.cts +155 -12
  43. package/dist/react.d.ts +155 -12
  44. package/dist/react.js +72 -4
  45. package/dist/react.js.map +1 -1
  46. package/package.json +8 -2
  47. package/templates/center-site/README.md +5 -0
  48. package/templates/center-site/app/account/game-cards/page.tsx +17 -0
  49. package/templates/center-site/app/account/layout.tsx +16 -0
  50. package/templates/center-site/app/account/memberships/[id]/page.tsx +23 -0
  51. package/templates/center-site/app/account/memberships/page.tsx +33 -0
  52. package/templates/center-site/app/account/orders/page.tsx +17 -0
  53. package/templates/center-site/app/account/page.tsx +14 -0
  54. package/templates/center-site/app/account/payment-methods/page.tsx +23 -0
  55. package/templates/center-site/app/account/privacy/page.tsx +17 -0
  56. package/templates/center-site/app/account/profile/page.tsx +45 -0
  57. package/templates/center-site/app/account/reservations/[displayId]/change/page.tsx +46 -0
  58. package/templates/center-site/app/account/reservations/[displayId]/page.tsx +41 -0
  59. package/templates/center-site/app/account/reservations/page.tsx +35 -0
  60. package/templates/center-site/app/account/security/page.tsx +17 -0
  61. package/templates/center-site/app/events/[slug]/page.tsx +130 -0
  62. package/templates/center-site/app/events/page.tsx +57 -0
  63. package/templates/center-site/app/pay/[token]/page.tsx +53 -0
  64. package/templates/center-site/app/site-header.tsx +1 -0
  65. package/templates/center-site/lib/reservation.ts +14 -0
  66. package/templates/center-site/package.json +1 -1
  67. package/templates/center-site/tsconfig.json +7 -9
  68. package/dist/account-DfM2COaz.d.ts +0 -210
  69. package/dist/account-oCvYWmO9.d.cts +0 -210
  70. package/dist/catalog-DbhdwmnX.d.cts +0 -224
  71. package/dist/catalog-XkjgPI5C.d.ts +0 -224
  72. package/dist/chunk-3JSVEOKG.js.map +0 -1
  73. package/dist/chunk-TEHRROVY.js.map +0 -1
  74. package/dist/chunk-Y3YSDO3H.js.map +0 -1
  75. package/dist/data-BJkB-tvM.d.cts +0 -778
  76. package/dist/data-BJkB-tvM.d.ts +0 -778
package/HEADLESS.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Headless integration guide
2
2
 
3
+ **Building a complete customer website? Start with the [agent build guide](./AGENTS.md).**
4
+
3
5
  **Center sites are headless-first.** The booking engine must match the center's
4
6
  own design and never look like a themed plugin, so real sites build the funnel
5
7
  from the SDK's **hooks** — not the drop-in `<BookingFlow>`. The drop-in
@@ -12,6 +14,7 @@ reproduce it inside your own UI.
12
14
  > capability map below **and** a dated entry under [Adopting changes by
13
15
  > version](#adopting-changes-by-version). A component feature with no headless
14
16
  > instructions is incomplete (AGENTS.md → "SDK Headless Parity").
17
+ > A feature with no package AGENTS.md checklist entry is incomplete.
15
18
 
16
19
  All hooks come from `@bowlos/reservations/react`; the framework-agnostic twins
17
20
  (`listStartTimes`, `listAddons`, `bookingPreview`, …) come from
@@ -22,6 +25,130 @@ All hooks come from `@bowlos/reservations/react`; the framework-agnostic twins
22
25
 
23
26
  ## Capability map
24
27
 
28
+ ### Customer toolkit additions (v0.39.0)
29
+
30
+ | Core helper | React hook | Gateway route |
31
+ | --- | --- | --- |
32
+ | `listBrandEventOffers` | `useBrandEventOffers` | `listPublicEventOffersForBrand` |
33
+ | `getMyGameCard` | `useMyGameCard` | `getMyGameCard` |
34
+ | `getMyGameCardRedemptions` | `useMyGameCardRedemptions` | `getMyGameCardRedemptions` |
35
+ | `getMyGameCardHistory` | `useMyGameCardHistory` | `getMyGameCardRedemptionsPage` |
36
+ | `getWalletPassUrl` | `useWalletPassUrl` | `getMyWalletPassUrl` |
37
+ | `getMyHold` | `useMyHold` | `getMyHoldGroup` |
38
+ | `extendMyHold` | `useExtendMyHold` | `customerExtendMyHold` |
39
+ | `releaseMyHold` | `useReleaseMyHold` | `customerReleaseMyHold` |
40
+ | `requestEmailVerification` | `useRequestEmailVerification` | `requestEmailVerification` |
41
+ | `confirmEmailVerification` | `useConfirmEmailVerification` | `confirmEmailVerification` |
42
+ | `getEmailVerificationStatus` | `useEmailVerificationStatus` | `getEmailVerificationStatus` |
43
+ | `getEmailVerificationSendState` | `useEmailVerificationSendState` | `getEmailVerificationSendState` |
44
+ | `getCancellationPolicy` | `useCancellationPolicy` | `getCancellationPolicy` |
45
+ | `cancelMyPendingBooking` | `useCancelMyPendingBooking` | `cancelMyPendingReservation` |
46
+ | `listEventOffers` | `useEventOffers` | `listPublicEventOffers` |
47
+ | Hold state and actions | `useHoldCountdown` | Hold routes above |
48
+ | Email state and actions | `useEmailVerification` | Verification routes above |
49
+
50
+
51
+ ### Customer toolkit routes (v0.37.0)
52
+
53
+ | Core helper `(client, args)` | React hook | Gateway route |
54
+ | -------------------------------- | ------------------------------------------------ | -------------------------------- |
55
+ | `updateMyProfile` | `useUpdateMyProfile()` | `updateMyProfile` |
56
+ | `getMyCommunicationPrefs` | `useMyCommunicationPrefs(args, options?)` | `listMyMarketingPrefs` |
57
+ | `setMyCommunicationPref` | `useSetMyCommunicationPref()` | `setMyMarketingPref` |
58
+ | `setMyMobile` | `useSetMyMobile()` | `setMyMobile` |
59
+ | `submitSupportRequest` | `useSubmitSupportRequest()` | `submitMySupportRequest` |
60
+ | `deleteMyAccount` | `useDeleteMyAccount()` | `deleteMyAccount` |
61
+ | `previewAccountDeletion` | `useAccountDeletion({ brandId })` | `previewMyAccountDeletion` |
62
+ | `exportMyDataV2` | Core async wrapper | `exportMyDataV2` |
63
+ | `exportMyData` (deprecated) | `useExportMyData()` | `exportMyData` |
64
+ | `getMyPackageOrders` | `useMyPackageOrders(args, options?)` | `listMyPackageOrders` |
65
+ | `getMyPackageOrder` | `useMyPackageOrder(args, options?)` | `getMyPackageOrder` |
66
+ | `getMyMembershipMembers` | `useMyMembershipMembers(args, options?)` | `listMyMembershipMembers` |
67
+ | `addMyMembershipMember` | `useAddMyMembershipMember()` | `addMyMembershipMember` |
68
+ | `getMyLoyaltyHistory` | `useMyLoyaltyHistory(args, options?)` | `listMyLoyaltyHistory` |
69
+ | `getReceipt` | `useReceipt(args, options?)` | `getReservationByDisplayId` |
70
+ | `getProduct` | `useProduct(args, options?)` | `getPublicProduct` |
71
+ | `getMembership` | `useMembership(args, options?)` | `getPublicMembership` |
72
+ | `getGameCard` | `useGameCard(args, options?)` | `getPublicGameCard` |
73
+ | `listProductSubtypes` | `useProductSubtypes(args, options?)` | `listSubtypesForProduct` |
74
+ | `listBrandMemberships` | `useBrandMemberships(args, options?)` | `listBrandMemberships` |
75
+ | `getPackagesLabel` | `usePackagesLabel(args, options?)` | `getBrandPackagesLabelPublic` |
76
+ | `previewSlotPrices` | `useSlotPrices(args, options?)` | `previewSlotPrices` |
77
+ | `listHours` | `useHours(args, options?)` | `listPublicHours` |
78
+ | `getOperatingHours` | `useOperatingHours(args, options?)` | `getOperatingHours` |
79
+ | `getCenterOperatingHoursForType` | `useCenterOperatingHoursForType(args, options?)` | `getCenterOperatingHoursForType` |
80
+ | `listCenters` | `useCenters(args, options?)` | `listPublicCenters` |
81
+ | `cancelMyMembership` | `useCancelMyMembership()` | `cancelMyMembership` |
82
+ | `applyMyModification` | `useApplyMyModification()` | `applyMyModification` |
83
+ | `cancelCheckoutPayment` | `—` | `cancelCheckoutPaymentIntent` |
84
+
85
+ Core helpers and their concrete `XArgs` / `XResult` types are exported from
86
+ `@bowlos/reservations` (`X` is the helper name with its first letter capitalized,
87
+ for example `GetMyPackageOrdersResult`). Hooks are exported from
88
+ `@bowlos/reservations/react`. The wire types mirror the existing validators and
89
+ success payloads; IDs are strings. Mount `BowlosProvider` with your client.
90
+
91
+ Query hooks accept `(args, options?)` and return `{ data, loading, error, refetch }`.
92
+ Write hooks return `{ run(args), data, loading, error, reset }`.
93
+ `useExportMyData()` is lazy: call `run({ brandId })` when the customer requests a
94
+ download. It returns the existing **v1** export, including the profile, raw
95
+ reservation/credit/loyalty/membership/pass records and communication subscriptions;
96
+ it does not add the planned v2 export fields.
97
+
98
+ Profile, communication preferences, mobile, support, export, deletion, package
99
+ orders, membership roster, loyalty history, membership cancellation and
100
+ modification require a customer session. These account calls require `brandId`.
101
+ `updateMyProfile` requires `expectedVersion`; optional profile changes include
102
+ `fullName`, `mobile`, `marketingOptIn` and `preferredCenterId` (nullable mobile and
103
+ preferred center clear their values). Support accepts `message` and optional
104
+ `centerId`. Communication preferences use `channel: "email" | "sms"` and
105
+ `status: "subscribed" | "unsubscribed"`; SMS opt-in needs `acceptedTerms: true` and
106
+ a mobile number. Transactional delivery is unaffected.
107
+
108
+ `getMyPackageOrders` lists package bookings, while `getMyPackageOrder` requires
109
+ `orderId`. Membership roster calls take `membershipId`; adding a member also
110
+ takes their `email`. Loyalty history takes `brandId`. `getReceipt` takes
111
+ `displayId` and returns the reservation receipt with its frozen snapshot, payment
112
+ trail and credit entries. The receipt and catalog/hours/centers reads use the
113
+ existing public routes. Product/subtype reads take `productId`; membership/game
114
+ card reads take `templateId` and optional `shareToken`. Brand memberships, packages
115
+ label and centers take `brandId`. `listHours` takes `centerId`;
116
+ `getOperatingHours` takes `productId, dateISO`, and
117
+ `getCenterOperatingHoursForType` takes `centerId, attractionTypeKey, dateISO`.
118
+ `previewSlotPrices` takes `centerId, productId, dateISO, mode, duration, slots` and
119
+ optional `units, persons, games`, returning each slot's `headlinePriceCents`
120
+ (which can be null). `cancelCheckoutPayment` takes `{ refToken }` and returns
121
+ `{ cancelled }`.
122
+
123
+ The legacy `deleteMyAccount` and `useDeleteMyAccount` calls retain the v1
124
+ `{ brandId, confirmation: "DELETE" }` contract. Successful deletion then runs the
125
+ client's best-effort sign-out and clears local tokens; failed deletion preserves
126
+ the session and surfaces the gateway error. For new integrations use the
127
+ [0.38.0 preview and retry contract](#account-deletion-and-export-v0380),
128
+ including `BowlosApiError.details`.
129
+
130
+ `cancelMyMembership` requires `{ brandId, membershipId, expectedVersion,
131
+ idempotencyKey, reason? }`. Its result contains `id, version, status` and optional
132
+ `currentPeriodEndsAt`; show that end date and refresh membership reads after
133
+ success. `useCancelMyMembership()` supplies the idempotency key. Cancellation
134
+ schedules the existing end-of-period behavior; it does not request a refund.
135
+
136
+ All five `useCancelMy*` hooks and `useApplyMyModification` retain one key for
137
+ retries of the same inputs after network, timeout, rate-limit or server failures.
138
+ They rotate it after success or a terminal error, or when inputs change. `reset()`
139
+ explicitly begins a new action. Re-preview and refresh versions after a terminal
140
+ conflict before submitting again. Core functions still require caller-managed
141
+ `idempotencyKey`: retain it across uncertain retries. `applyMyModification` /
142
+ `useApplyMyModification` expose the existing apply contract (new date/time,
143
+ units/persons, optional games/add-ons/refund mode/credit and `expectedVersion`);
144
+ inspect `requiresPayment` and `pendingModificationId` in its result. For paid change
145
+ orchestration, use `useBookingChange` and the payment wrappers added in 0.40.0.
146
+
147
+ A non-JSON HTTP 404 now raises `ROUTE_NOT_FOUND`; a JSON route error with
148
+ `NOT_FOUND` still means the requested data was not found. Handle missing-route
149
+ errors separately in your own UI. `/ping` currently has no capabilities array,
150
+ so this release does not implement capability detection or probe routes to infer it.
151
+
25
152
  ### Saved cards and signed-in password changes (v0.36.0)
26
153
 
27
154
  These APIs require a signed-in customer. Card arguments are
@@ -89,6 +216,10 @@ await changePassword(client, { currentPassword, newPassword });
89
216
  // All sessions are invalidated; show your sign-in screen.
90
217
  ```
91
218
 
219
+ Always show a **"Forgot your current password?"** link to your forgot-password
220
+ page, using `useAccount().requestPasswordReset` and `resetPassword` (email code).
221
+ Keep this recovery path available for OAuth-only accounts too.
222
+
92
223
  The current password is mandatory. The new password uses the same
93
224
  `validatePassword` rules as signup. On success the SDK core helper and
94
225
  hook clear the local session with best-effort sign-out. Failed changes preserve
@@ -748,7 +879,7 @@ const buy = useGameCardPurchase();
748
879
  )}
749
880
  ```
750
881
 
751
- Drive the UI off `buy.status` exactly like the [Flow lifecycle](#flow-lifecycle-reset--error-handling)
882
+ Drive the UI off `buy.status` exactly like the [Flow lifecycle](#flow-lifecycle-reset--error-handling--required-for-a-clean-install)
752
883
  section: the Review (step 2) before `start`, the payment on
753
884
  `awaitingPayment`, a **confirmation** on `confirmed` (`buy.resultId`), and an
754
885
  error + retry on `failed` / `expired` / `error`. Route the catalog's
@@ -906,7 +1037,7 @@ const buy = usePackagePurchase();
906
1037
  )}
907
1038
  ```
908
1039
 
909
- Drive the UI off `buy.status` like the [Flow lifecycle](#flow-lifecycle-reset--error-handling)
1040
+ Drive the UI off `buy.status` like the [Flow lifecycle](#flow-lifecycle-reset--error-handling--required-for-a-clean-install)
910
1041
  section — Review (step 3) before `start`, the payment on `awaitingPayment`, a
911
1042
  **confirmation** on `confirmed`, error + retry on `failed` / `error`. Route the
912
1043
  catalog's `package` pick to this flow **in-app** — not to the portal.
@@ -977,7 +1108,7 @@ const buy = useMembershipPurchase();
977
1108
  )}
978
1109
  ```
979
1110
 
980
- Drive the UI off `buy.status` exactly like the [Flow lifecycle](#flow-lifecycle-reset--error-handling)
1111
+ Drive the UI off `buy.status` exactly like the [Flow lifecycle](#flow-lifecycle-reset--error-handling--required-for-a-clean-install)
981
1112
  section — the Review (step 2) before `start`, the payment on `awaitingPayment`, a
982
1113
  **confirmation** on `confirmed` (`buy.resultId` = the new membership), and an error
983
1114
  + retry on `failed` / `expired` / `error`. Route the catalog's `membership` pick to
@@ -1169,7 +1300,8 @@ Headless parity for the four self-serve cancels the BowlOS portal already has:
1169
1300
 
1170
1301
  **Money rule (locked):** a self-serve cancel returns **store credit** per the
1171
1302
  Center's cancellation policy (more credit the earlier you cancel). **Card refunds
1172
- are staff-only** — never promise money back to the card. **Game cards** are
1303
+ for these cancellation routes are staff-only**. Booking modifications in
1304
+ 0.40.0 separately support `refundMode: "refund"`; show the server preview outcome. **Game cards** are
1173
1305
  cancellable **only while fully unused** (no games redeemed, not expired) → full
1174
1306
  credit; a used/expired card is not customer-cancellable (tell them to contact the
1175
1307
  venue). The previewed amount is **advisory** (computed when you read it); the
@@ -1222,10 +1354,10 @@ Reservation/event/package read the same way — the preview returns `bucket`
1222
1354
  `creditCents`, and `forfeitCents`; show the bucket so the customer understands a
1223
1355
  late cancel returns less.
1224
1356
 
1225
- **Idempotency / retries.** The cancel hooks generate a fresh key per attempt, so
1226
- a double-click can't double-cancel. Retrying an already-cancelled item returns an
1227
- error (the credit ledger dedupes — no double credit); treat "already cancelled"
1228
- as done and re-read the list.
1357
+ **Idempotency / retries (v0.37.0).** Cancel hooks retain one key across uncertain
1358
+ retries of the same action and rotate it after success or a terminal error.
1359
+ Changed inputs or `reset()` begin a new action. After success, re-read the list;
1360
+ a later new action against an already-cancelled item may return an error.
1229
1361
 
1230
1362
  **Non-React.** Use the core functions with a `BowlosClient`:
1231
1363
  `previewGameCardCancellation(client, …)`, `cancelMyGameCard(client, { …, idempotencyKey })`,
@@ -1281,7 +1413,10 @@ it is `true`. It goes `false` once the pass is no longer worth adding:
1281
1413
 
1282
1414
  The server enforces this regardless of the client: the pass-URL endpoints return
1283
1415
  no link for an ineligible pass, so a stale "Add to Wallet" button is a dead
1284
- action — gate on `walletEligible` to avoid showing it. Row shape:
1416
+ action — gate on `walletEligible` to avoid showing it. Use `getWalletPassUrl` /
1417
+ `useWalletPassUrl` to request a fresh normalized `{ url, platform }` result on click;
1418
+ `AddToWalletButtons` takes `eligible={pass.walletEligible}`. Do not construct URLs
1419
+ or reuse an old pass blob. See [game cards and wallet](#game-cards-and-wallet-v0390). Row shape:
1285
1420
  `{ id, displayId, kind, state, generation, walletEligible }`.
1286
1421
 
1287
1422
  ## Date-first booking (v0.24.0)
@@ -1457,6 +1592,20 @@ full control.
1457
1592
  > Website special** (a blurb + a display price). Nothing to configure in the SDK
1458
1593
  > beyond reading the hook.
1459
1594
 
1595
+ ## Gateway rate limits (PR-H)
1596
+
1597
+ Every gateway request consumes a fixed 60-second bucket per (API key, selected IP),
1598
+ with a default limit of 180 requests/minute or the key's `rateLimitPerMinute` override.
1599
+ The selected IP remains `cf-connecting-ip`, else the first `x-forwarded-for` value,
1600
+ else `noip`. The local Convex HTTP-action docs do not establish which header the
1601
+ platform overwrites; this selection is not verified trustworthy. A second atomic
1602
+ bucket per API key, shared across all IPs, caps requests at 10× the configured
1603
+ per-IP limit (default 1,800/minute), bounding spoofed-IP fan-out. Either limit
1604
+ returns the existing `RATE_LIMITED` HTTP 429 response with `Retry-After` seconds.
1605
+ Headless sites need no new arguments; respect `Retry-After` before retrying.
1606
+ Backend per-customer rolling budgets are separate (for example, 5 card setup
1607
+ intents/customer/hour), and also apply to direct Convex callers.
1608
+
1460
1609
  ## Adopting changes by version
1461
1610
 
1462
1611
  What each SDK release changed in `<BookingFlow>` and the headless steps to match.
@@ -1483,7 +1632,7 @@ Headless sites do **not** get these from a version bump — apply them by hand.
1483
1632
 
1484
1633
  | **0.22.1** | **Pay-button mount race fixed** (`<BowlosPaymentForm>` submit disabled until BOTH Stripe.js and the PaymentElement are mounted — a click during mount was a silent no-op) · **headless flash-sale checkout** — new `createFlashSaleBooking` (+ exported `CreateFlashSaleBookingArgs`/`FlashSaleBookingResult`) completing the options → book-at-sale-price → pay → poll path · docs: "Booking a flash-sale item" section; §6 included-shoes rule (`shoeMode`/`defaultShoeAddonId` + `offer.pricePlanShoeIncluded` — render "Included", never a priced stepper); event `includedAddons` are pre-selected AND charged | Custom payment UIs: mirror the disabled rule (`!stripe \|\| !elements \|\| submitting`). Flash funnels: adopt the new section (stop handing off / blocking). Event + bowling funnels: adopt the included-shoes rule in §6. |
1485
1634
 
1486
- | **0.23.0** | **Self-serve cancel parity** — preview + cancel hooks for all four types (`useReservationCancelPreview`/`useCancelMyReservation`, `useEventOrderCancelPreview`/`useCancelMyEventOrder`, `usePackageOrderCancelPreview`/`useCancelMyPackageOrder`, `useGameCardCancelPreview`/`useCancelMyGameCard`) + `useMyGameCards`; framework-free core fns mirror them. `listMyReservations` now returns `version`. | New "Self-serve cancel" section. Build a preview → confirm → cancel screen per type in your own design. Store credit only (card refunds stay staff-only); game cards cancel only while fully unused. Pass the reservation `version` as `expectedVersion`. Re-read the preview right before confirming. |
1635
+ | **0.23.0** | **Self-serve cancel parity** — preview + cancel hooks for all four types (`useReservationCancelPreview`/`useCancelMyReservation`, `useEventOrderCancelPreview`/`useCancelMyEventOrder`, `usePackageOrderCancelPreview`/`useCancelMyPackageOrder`, `useGameCardCancelPreview`/`useCancelMyGameCard`) + `useMyGameCards`; framework-free core fns mirror them. `listMyReservations` now returns `version`. | New "Self-serve cancel" section. Build a preview → confirm → cancel screen per type in your own design. Store credit only for cancellation (0.40.0 separately adds card refunds for booking modifications); game cards cancel only while fully unused. Pass the reservation `version` as `expectedVersion`. Re-read the preview right before confirming. |
1487
1636
 
1488
1637
  | **0.24.0** | **Date-first booking** — `useCatalog`/`CatalogResult` now carry `bookingEntryDefault` (Center default entry point) + `todayISO` (Center-local). `<BookingCatalog>` opens on the Center default, renders a by-activity/by-date toggle (`showEntryToggle`, `defaultEntry` override), and in date-first mode lists products bookable that day (per-product `useStartTimes`) + an Events section + an "Available any day" strip. | New "Date-first booking" section. Read `bookingEntryDefault`/`todayISO` off `useCatalog`; seed a toggle; for the chosen day check each `book_reservation` item with `useStartTimes` (empty = unavailable). Products show "See times & pricing" (no price; drill-in re-quotes); events get their own section (not per-day filtered); memberships/game-passes/packages are the "any day" strip. The drop-in does all of this automatically. |
1489
1638
  | **0.25.0** | **Full Test Mode** — every PaymentIntent + buy intent now carries `stripeMode` (`"test"\|"live"`); `<BowlosPaymentForm>` gained an optional `testPublishableKey` and picks the matching key by mode; `CatalogResult` carries `maintenanceMode`; new `useTestMode()` hook + `<MaintenanceBanner>` component; new gateway error `CENTER_IN_MAINTENANCE`. | New "Full Test Mode" section. Pass both publishable keys (`publishableKey` live + `testPublishableKey` test) to `<BowlosPaymentForm>` — or read `intent.stripeMode` and `loadStripe` the matching key in your own Elements. Render `<MaintenanceBanner brandId centerId>` (or `useTestMode`) so customers see a **maintenance** notice (never "test mode") while it's on, and handle `CENTER_IN_MAINTENANCE` from booking/buy calls as the maintenance state. Required for admin Test-Account customers to transact on a live site. Additive — one-key sites are unchanged. |
@@ -1549,3 +1698,439 @@ the PaymentIntent uses that same pinned amount. Flash reservation retries whose
1549
1698
  frozen preview is missing or inconsistent return `CHECKOUT_EXPIRED`: request a
1550
1699
  fresh quote and generate a new key. This also applies after an interruption
1551
1700
  between persisting the attempt and creating its PaymentIntent.
1701
+
1702
+ ### v0.37.0 — Customer toolkit route coverage (2026-10-30, unpublished)
1703
+
1704
+ | Version | Surface changes | Headless adoption |
1705
+ | ------- | ----------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
1706
+ | 0.37.0 | All wrappers and hooks in the customer toolkit capability map above; stable cancellation/modification retry keys; `ROUTE_NOT_FOUND`; shipped AGENTS.md build guide + coverage gate; completed v0.36.0 saved-card/password guidance | Change the dependency range `^0.36.0` → `^0.37.0`, then add the relevant hooks to your site's own account and catalog screens. |
1707
+
1708
+ `useMyPackageOrders({ brandId })` now exists: use it to list package bookings and
1709
+ `useMyPackageOrder({ brandId, orderId })` for their details. Add your membership
1710
+ cancel confirmation with `useCancelMyMembership`, show the returned period end,
1711
+ and refresh membership reads. Add deletion/export controls using the lazy write
1712
+ hooks; show your signed-out state after successful deletion. Keep existing v1
1713
+ export/download handling. Every wrapper's argument/result types are exported,
1714
+ so use those types directly instead of asserting `unknown` response shapes.
1715
+
1716
+ Remove site-side per-retry key generation around the keyed hooks; let the hook
1717
+ retain its action key. Core callers still own their keys. Branch on
1718
+ `ROUTE_NOT_FOUND` for an unavailable deployment route and keep data `NOT_FOUND`
1719
+ handling. There is no capabilities API to query yet. No backend or payment flow
1720
+ change is required by this package release.
1721
+
1722
+ For 0.37.0, migrate `^0.36.0` -> `^0.37.0` by hand. Start with [AGENTS.md](./AGENTS.md);
1723
+ its page checklist and API/template coverage are checked by release-gate step i.
1724
+ The [saved-card and signed-in password guidance](./HEADLESS.md#saved-cards-and-signed-in-password-changes-v0360)
1725
+ now includes the required password-recovery link; adopt it in your own security screen.
1726
+
1727
+ ## Unreleased / backend
1728
+
1729
+ - Successful password changes (including fresh-session legacy calls) and email-code resets send a brand-branded password-changed email; headless sites need no client changes.
1730
+
1731
+ ## Account deletion and export (v0.38.0)
1732
+
1733
+ Deletion never dead-ends because of memberships or bookings. Call
1734
+ `previewAccountDeletion(client, { brandId })` or `useAccountDeletion({ brandId })`.
1735
+ Render every consequence: memberships ending now and forfeited time, upcoming
1736
+ reservations/parties/events with the Center policy's refunds, fees and credit,
1737
+ and `loses` (including credit access, points, plays, saved cards and history).
1738
+ The preview includes `confirmPhrase` and `previewToken`; pass both with
1739
+ `deleteMyAccount(client, { brandId, confirmPhrase, previewToken })`.
1740
+ Legacy `{ brandId, confirmation: "DELETE" }` remains supported.
1741
+
1742
+ Use a type-to-confirm input with `autoCorrect="off"`, `autoComplete="off"`,
1743
+ `spellCheck={false}`, `autoCapitalize="none"`. The hook exposes `preview`,
1744
+ `consequences`, `confirmPhrase`, `status`, `error`, `confirm(typedPhrase)` and `retry()`.
1745
+ On `DELETION_PREVIEW_STALE` it reloads consequences and sets `status="stale"`:
1746
+ show the changes and require a fresh confirmation. On `DELETION_PENDING_STRIPE`
1747
+ it backs off using `details.retryAfterSec` (one second fallback), doubling each
1748
+ wait, with at most five automatic retries after the first call. After exhaustion,
1749
+ show a retry button calling `retry()` and an actionable support path. Keep the
1750
+ session on failures; successful deletion signs out. Unmount cancels pending waits.
1751
+
1752
+ `BowlosApiError.details` carries optional primitive string/number/boolean values
1753
+ from the error envelope. Missing details remain undefined; nested/unknown values
1754
+ are dropped. Branch on `code`, never message text.
1755
+
1756
+ `exportMyDataV2(client, { brandId })` returns `{ url, expiresAt }`, a curated
1757
+ export download valid for 15 minutes, with a backend budget of five per day.
1758
+ Offer the URL directly and request a fresh export after expiry. `exportMyData`
1759
+ is deprecated; its inline v1 return shape remains unchanged.
1760
+
1761
+ | Capability | Headless API |
1762
+ | --- | --- |
1763
+ | Deletion consequences and confirmation | `previewAccountDeletion`, `useAccountDeletion`, `deleteMyAccount` |
1764
+ | Curated short-lived data export | `exportMyDataV2` |
1765
+ | Structured recoverable errors | `BowlosApiError.details` |
1766
+
1767
+ ## 0.38.0
1768
+
1769
+ Deletion preview, retryable account deletion, structured error details and export
1770
+ v2 are available. Migration: ^0.37.0 -> ^0.38.0 by hand; pre-1.0 caret ranges do
1771
+ not cross minors. Adopt the preview/token confirmation flow and replace v1 export
1772
+ with exportMyDataV2. Existing v1 callers remain compatible.
1773
+
1774
+
1775
+ ## Events index (v0.39.0)
1776
+
1777
+ Use `listEventOffers(client, {centerId, includeWithoutLandingPage: false})` or
1778
+ `useEventOffers` for an index that links to `/events/<slug>`. Omitting the flag
1779
+ preserves the existing inclusion and date/title order; `true` includes offers
1780
+ without pages for non-linking displays. Explicit flags sort by date/start/title.
1781
+ Only active, upcoming sellable occurrences are returned, using each Center's
1782
+ local date. Legacy `useEvents` lists pricing events and is not the sellable index.
1783
+
1784
+ Brand sites use `listBrandEventOffers` / `useBrandEventOffers` with `{brandId,
1785
+ includeWithoutLandingPage?, limit?, cursor?}`. This requires a Brand-wide key.
1786
+ The default is landing-page gated. `limit` is 1–100 (default 50). Append `items`,
1787
+ follow `continueCursor` until `isDone`, even after an empty filtered page, then
1788
+ sort the complete list by date/start/title. Pages use stable creation order;
1789
+ individual pages alone cannot provide a complete chronological index.
1790
+
1791
+ `EventOffer` and `BrandEventOffer` describe concrete wire rows; the latter adds
1792
+ Center identity. `ListBrandEventOffersResult` preserves pagination metadata.
1793
+ `EventList` is an optional render-only reference: pass gated `items`, `loading`,
1794
+ `error`, and optional `labels`. Its `children(item)` render prop replaces each row
1795
+ with the site's own design. Defaults provide accessible status/error text and
1796
+ `/events/${encodeURIComponent(item.slug)}` links, with BowlosTheme tokens and no
1797
+ platform branding. Headless sites use the same data and render their own links.
1798
+ Copy `templates/center-site/app/events/page.tsx` for the complete pagination loop.
1799
+ This template has no event detail page yet: implement `/events/[slug]` with
1800
+ `useEventOffer({slug})` and the existing ticket/reservation purchase hooks before
1801
+ launching the index. The gateway's landing-page gate checks configured event
1802
+ pages; it cannot create routes on a separately hosted site.
1803
+
1804
+ ## Game cards and wallet (v0.39.0)
1805
+
1806
+ `getMyGameCard` / `useMyGameCard` accept `{cardId, brandId?, centerId?}` and return
1807
+ the owned card's receipt and balance (`GetMyGameCardResult`). Missing/foreign cards
1808
+ map to `NOT_FOUND` at the gateway. `getMyGameCardHistory` / `useMyGameCardHistory`
1809
+ accept `{brandId, gameCardId?, centerId?, cursor?, numItems}` (1–100), returning
1810
+ `{page, isDone, continueCursor}` plus optional Convex page split metadata. Omit
1811
+ `gameCardId` for all owned cards. Follow cursors even after empty pages. Each
1812
+ `GameCardRedemption` includes consumption, Center name, timestamp and optional
1813
+ notes; no staff identity. The legacy `getMyGameCardRedemptions` /
1814
+ `useMyGameCardRedemptions` exposes the capped 100-row route for compatibility.
1815
+
1816
+ `getWalletPassUrl` / `useWalletPassUrl().run` accept `{brandId, centerId?, kind,
1817
+ id, platform}`. Kinds are `reservation`, `membership`, `package`, `game_card`;
1818
+ platforms are `apple` or `google`. The result is always `{url, platform}`; Google
1819
+ `saveUrl` is normalized server-side. Request only on an explicit user action,
1820
+ then navigate to the returned URL. The backend enforces ownership, eligibility
1821
+ and a 30/hour budget; handle `NOT_FOUND` with a retry/support path when a pass
1822
+ isn't ready. Never fabricate pass URLs, expose tokens, or infer eligibility from
1823
+ balance alone. Build these account views using `templates/center-site/app/account/page.tsx`.
1824
+
1825
+ ## Holds and pending cancellation (v0.39.0)
1826
+
1827
+ `getMyHold` / `useMyHold` accept `{groupId, brandId?}` and return `MyHold`;
1828
+ null from the backend becomes `NOT_FOUND`. `extendMyHold` / `useExtendMyHold`
1829
+ return `{expiresAt}`; `releaseMyHold` / `useReleaseMyHold` return `null`.
1830
+ The key injects Brand scope even when omitted. `useHoldCountdown(args, options?)`
1831
+ combines these routes, exposing `remainingMs`, `expired`, `extendable`, `extend()`,
1832
+ `releaseHold()`, and the query/mutation states. It anchors elapsed time to
1833
+ `serverNowMs`, clamps at zero, and refreshes after mutations. An active hold is
1834
+ extendable once in its last five minutes. The server remains authoritative:
1835
+ handle `HOLD_EXPIRED` by returning to availability and `RATE_LIMITED` by showing
1836
+ the existing expiry. Refresh on tab resume if needed; a countdown is not a lock.
1837
+
1838
+ `getCancellationPolicy` / `useCancellationPolicy` accept `{brandId, centerId,
1839
+ productId}` and return the resolved credit windows and optional policy link
1840
+ (or null for missing Brand). Scope mismatch returns `KEY_SCOPE_MISMATCH`.
1841
+ `cancelMyPendingBooking` / `useCancelMyPendingBooking().run` accept
1842
+ `{reservationId, brandId?}` and preserve the typed result union: `not_found`,
1843
+ `cancelled` with reservationId, or `skipped` with reservationId/status (e.g. a
1844
+ payment webhook already confirmed it). Branch on `kind`; never interpret
1845
+ `skipped` as cancellation. This releases unpaid pending bookings, not paid
1846
+ cancellations or refunds. Compose into `templates/center-site/app/book/page.tsx`
1847
+ and account detail views; use `useBookingChange` for paid changes in 0.40.0.
1848
+
1849
+ ## Email verification (v0.39.0)
1850
+
1851
+ `requestEmailVerification` / `useRequestEmailVerification` accept `{brandId?}`;
1852
+ return `{ok, alreadyVerified, verifyId?}`. Requests are limited to 3/hour.
1853
+ `confirmEmailVerification` / `useConfirmEmailVerification` accept `{token,
1854
+ brandId?}` and return `{ok: true}`. These gateway routes require the customer's
1855
+ session at the key Brand, including status/confirmation. Preserve a sign-in and
1856
+ resend path for expired links. Branch on stable error codes; a request succeeding
1857
+ does not prove delivery.
1858
+
1859
+ `getEmailVerificationStatus` / `useEmailVerificationStatus` expose `valid` (with
1860
+ email), `used`, `expired`, `not_found`. `getEmailVerificationSendState` /
1861
+ `useEmailVerificationSendState` accept `{verifyId, brandId?}`, exposing `pending`,
1862
+ `sent`, or `failed` (with error). `useEmailVerification({brandId?, token?}, options?)`
1863
+ combines them: `requestVerification()` stores the verifyId, `sendState.refetch()`
1864
+ checks actual delivery, and `confirmVerification(token?)` confirms and refreshes
1865
+ the configured token's status. Render the separate request/confirm/status/sendState
1866
+ loading and error states. Poll/refetch send state while pending under site control;
1867
+ never promise delivery before `sent`. Adapt `templates/center-site/app/account/page.tsx`.
1868
+
1869
+ ## 0.39.0
1870
+
1871
+ 2026-10-30: Events index, brand cursor pages, card history/wallet, holds, verification,
1872
+ policy and pending cancellation. Existing wrapper signatures remain compatible.
1873
+ Headless adoption: change `^0.38.0` to `^0.39.0` explicitly (pre-1.0 minor ranges
1874
+ do not cross minors), then compose the hooks above into your own design. Existing
1875
+ sites can upgrade without changing their old argument shapes. Opt into safe event
1876
+ index links with `includeWithoutLandingPage: false`; consume all Brand pages.
1877
+ No automatic UI migration or new payment orchestration is implied.
1878
+
1879
+ ## Booking changes (v0.40.0)
1880
+
1881
+ | Capability | Core API | React API |
1882
+ | --- | --- | --- |
1883
+ | Preview and apply a change | `previewBookingChange`, `applyBookingChange` | `useBookingChange` |
1884
+ | Pay and recover pending changes | `createBookingChangePayment`, `getPendingBookingChange` | `useBookingChange` |
1885
+
1886
+ Pass the reservation's technical ID and current expectedVersion, not its displayId.
1887
+ Preview takes brandId, optional centerId, reservationId, newDateISO,
1888
+ newStartMinuteOfDay, newEndMinuteOfDay, newUnits, newPersons, optional newGames and
1889
+ newAddons. Render eligibility/reason and old/new totals before confirmation.
1890
+ Apply adds expectedVersion, optional refundMode (`credit` or `refund`), applyCredit
1891
+ and idempotencyKey. Core callers generate one key for a click-intent and reuse it
1892
+ on uncertain retries; generate a new key after success or a terminal failure.
1893
+ The hook manages that key and prevents duplicate in-flight applies.
1894
+
1895
+ ```tsx
1896
+ const change = useBookingChange({ brandId, centerId });
1897
+ // Call from user actions; render change.error with a retry/support path.
1898
+ await change.loadPreview(proposedChange);
1899
+ await change.apply({ ...proposedChange, expectedVersion, refundMode: "refund" });
1900
+ // If status === "pay": mint the intent independently (safe to retry).
1901
+ const payment = await change.createPayment();
1902
+ // Confirm with your Stripe UI using returned publishableKey, stripeAccount,
1903
+ // stripeMode and clientSecret. Only after confirmation:
1904
+ change.paymentConfirmed();
1905
+ ```
1906
+
1907
+ Same/cheaper changes (and upgrades fully covered by credit) finish immediately.
1908
+ Partial credit reduces the payment amount. The hook polls while `pay` or `polling`
1909
+ and only reports `done` once the webhook returns `applied`.
1910
+ `failed_slot_taken` means the slot was lost and the backend automatically refunds
1911
+ payment; explain this and offer a fresh preview. `expired` and `cancelled` require
1912
+ a fresh action. Never treat successful Stripe confirmation alone as a changed booking.
1913
+ Persist the pendingModificationId for recovery, then call
1914
+ `resume({pendingModificationId})`; it reads status first. For an unpaid recovered
1915
+ record, `createPayment()` is available after checking status and expiresAt. `reset()` discards local state; it does not cancel backend work.
1916
+ Polling stops on unmount/scope changes. Query failures remain visible and retry.
1917
+ `createPayment` retries do not call apply again. Re-preview on VERSION_CONFLICT;
1918
+ handle RATE_LIMITED and CONFLICT_RETRY with a retry action.
1919
+
1920
+ PaymentIntent keys come from the server's pending record. Never send client
1921
+ idempotency keys, mode or requestTestMode to `createModificationPaymentIntent`.
1922
+ `createBookingChangePayment({pendingModificationId})` accepts only that ID plus
1923
+ optional brandId/centerId. It returns paymentIntentId, clientSecret, amountCents,
1924
+ customerSessionClientSecret, stripeAccount, stripeMode, merchantDisplayName and
1925
+ publishableKey; customerId and ephemeralKey are stripped by the gateway.
1926
+ Dates and times are in the Center's timezone.
1927
+
1928
+ ## Billing portal and pay links (v0.40.0)
1929
+
1930
+ | Capability | Core API | React API |
1931
+ | --- | --- | --- |
1932
+ | Manage recurring membership billing | `openMembershipBillingPortal` | `useOpenMembershipBillingPortal` |
1933
+ | Read a token pay link | `getPayLink` | `usePayLink` |
1934
+ | Pay a token pay link | `createPayLinkPayment` | `useCreatePayLinkPayment` |
1935
+
1936
+ `openMembershipBillingPortal(client, {membershipId, returnUrl})` returns `{url}`;
1937
+ optional brandId/centerId can narrow scope. The mutation hook's `run` has the same
1938
+ arguments. Navigate only after a successful call. `BILLING_PORTAL_UNAVAILABLE`
1939
+ means the venue must configure its connected account portal: show actionable venue
1940
+ support. `RETURN_URL_NOT_ALLOWED` is a site configuration error. Return URLs must
1941
+ be HTTPS with an exact origin in the key's allowedOrigins or verified brand domains.
1942
+ HTTP localhost requires the key's explicit allowLocalhostReturn flag; test mode
1943
+ alone does not permit it. Sites cannot supply their own allowlist.
1944
+
1945
+ Pay-link helpers/hooks take `{token, brandId?, centerId?}`. They do not require a
1946
+ customer session: the unguessable token is the credential. Do not log it or put it
1947
+ in analytics. The gateway checks the token against its key's brand and center.
1948
+ Read status, remainingDueCents and expiresAt before offering payment. Render the
1949
+ reservation summary in Center local time. `createPayLinkPayment` returns the same
1950
+ payment fields as booking changes except `connectedAccountId` replaces stripeAccount;
1951
+ use it as the Stripe account. Do not send any mode or idempotency key. Server-derived
1952
+ keys deduplicate retries. `usePayLink(args)` exposes `refetch()`; refresh after Stripe confirmation and
1953
+ continue with a bounded polling loop while status is pending_payment; show completion only on `applied`, an automatic refund message
1954
+ on `failed_slot_taken`, and a venue contact path for expired/cancelled links.
1955
+ Handle NOT_FOUND, KEY_SCOPE_MISMATCH, VALIDATION_FAILED, RATE_LIMITED and
1956
+ CONFLICT_RETRY by code. Never repeatedly charge an expired or completed link.
1957
+
1958
+ ## 0.40.0
1959
+
1960
+ Headless adoption: explicitly update `^0.39.0` → `^0.40.0` and compose the APIs above
1961
+ into the site's own design. There are no required changes to existing calls.
1962
+ Version 0.41.0 supplies reservation detail/change and pay-link templates;
1963
+ 0.40.0 sites compose these APIs in their own routes. Test on a non-live Center with an isTestAccount customer;
1964
+ assert returned stripeMode before confirmation. Backend PRs 4a/5a must be available.
1965
+
1966
+ ## Reference account components (v0.41.0)
1967
+
1968
+ These optional reference components use the same public hooks as a custom site.
1969
+ Keep your own design: adopting any component is optional. Version 0.41.0 adds these references without changing existing hook contracts.
1970
+
1971
+ | Component entry | Component | Headless adoption / template source |
1972
+ | --- | --- | --- |
1973
+ | `/components` | `AccountDashboard` | Omit `sections` to preserve reservations, memberships, loyalty, credit and passes exactly. Opt in to `eventOrders`, `packageOrders`, `gameCards`, `profile`, `communications`, `paymentMethods`, `security`, `privacy`. Supply `centerId` for payment methods. Game cards have a keyboard-accessible native modal history drawer. |
1974
+ | `/components` | `SavedCards` | `useSavedCards`, `useRemoveCard`, `useSetDefaultCard`; refetch after changes. Use `renderAddCard(onAdded)` to compose the optional Stripe form. `app/account/payment-methods/page.tsx`. |
1975
+ | `/payments` | `AddCardForm` | `useCreateCardSetup`; initialize Stripe with the returned `publishableKey` and `stripeAccount`, then `confirmSetup` with `redirect: "if_required"`. Refetch cards only after setup succeeds. Stripe peers stay isolated to `/payments`. |
1976
+ | `/components` | `ChangePasswordForm` | `useChangePassword` for signed-in changes; `useAccount.requestPasswordReset` then `resetPassword` for the “Forgot your current password?” email-code recovery. Wrong current passwords preserve the session. `app/account/security/page.tsx`. |
1977
+ | `/components` | `ProfileForm` | `useAccount.customer` supplies name, mobile and version; `useUpdateMyProfile` sends the loaded `expectedVersion` and retains the returned version for subsequent saves. Refresh the account after a version conflict. `app/account/profile/page.tsx`. |
1978
+ | `/components` | `CommunicationPrefs` | `useMyCommunicationPrefs` + `useSetMyCommunicationPref`; explicit channel consent supplies `acceptedTerms` on subscription; refetch after save. Transactional messaging stays independent. `app/account/profile/page.tsx`. |
1979
+ | `/components` | `MembershipDetail` | `useMyMembershipDetail`, `useMyMembershipMembers`, `useAddMyMembershipMember`, `useCancelMyMembership` and `useOpenMembershipBillingPortal`. Show the period end and require a cancellation reason. Supply the site's allowlisted absolute `returnUrl`. `app/account/memberships/[id]/page.tsx`. |
1980
+ | `/components` | `GameCardHistory` | `useMyGameCardHistory` with `gameCardId`, `numItems`, opaque cursor; follow `continueCursor` even on an empty page until `isDone`. Override `unitNoun` for games/rounds. `app/account/game-cards/page.tsx`. |
1981
+ | `/components` | `AddToWalletButtons` | `useWalletPassUrl` with kind, technical ID and Apple/Google platform. Use `eligible` to hide unavailable passes; backend eligibility remains authoritative. `app/account/game-cards/page.tsx`, `app/account/reservations/[displayId]/page.tsx`. |
1982
+ | `/components` | `PrivacyCenter` | `useAccountDeletion` renders the preview, resets typing when its token changes, retries pending cancellation and requires fresh confirmation for stale consequences. `useBowlosMutation("exportMyDataV2", { auth: true })` returns a temporary download URL; v1 is not used. Configure `supportHref` to a working support route. `app/account/privacy/page.tsx`. |
1983
+ | `/components` | `BookingChange` | `useBookingChange`: preview → apply with the loaded version → create payment → confirm through the site's Stripe UI → `paymentConfirmed` → polling. `renderPayment(payment, onPaid)` receives the returned key, account and mode. Preserve server idempotency; show slot-taken/expired failures and restart from a fresh reservation. `app/account/reservations/[displayId]/change/page.tsx`. |
1984
+
1985
+ All components accept `labels` overrides and use BowlosTheme CSS tokens. Use
1986
+ `unitNoun` on booking changes and game card history. Forms have associated labels,
1987
+ status/error regions and keyboard-operable buttons. Confirmation typing disables
1988
+ correction, completion, spell checking and capitalization. Customer pages contain
1989
+ no platform branding. The account navigation links every account page and the
1990
+ existing events index; event cards now resolve to `app/events/[slug]/page.tsx`,
1991
+ which uses `useEventOffer`, `useEventTicketPreview`, `useEventTicketPurchase` and
1992
+ `BowlosPaymentForm`. Pay links use their server-issued token at `app/pay/[token]/page.tsx`.
1993
+
1994
+ For headless adoption in 0.41.0, keep your existing hooks and markup; no new backend
1995
+ routes or mandatory component migration are needed. Copy only the interactions
1996
+ you need from `examples/center-site` (shipped as generated `templates/center-site`).
1997
+
1998
+ ## Customer account toolkit
1999
+
2000
+ Build customer pages with hooks from `@bowlos/reservations/react` and core helpers
2001
+ from `@bowlos/reservations`. Reference components are optional; keep the center's
2002
+ own design. Mount one `BowlosProvider` for the shared customer session. The
2003
+ [complete page checklist](./AGENTS.md#required-pages-checklist) names the shipped
2004
+ starter file to copy or adapt for every page, including recovery and inquiry.
2005
+
2006
+ ### Account capability map
2007
+
2008
+ | Capability | Headless hooks / core APIs | Optional reference | Template under `templates/center-site/app/` |
2009
+ | --- | --- | --- | --- |
2010
+ | Sign-in, atomic registration, recovery | `useAccount`: `signIn`, `register`, `requestPasswordReset`, `resetPassword`; `useEmailVerification` | `AuthForm`, `AuthGate` | `account/page.tsx` (adapt for a standalone recovery route) |
2011
+ | Reservations, event orders, package orders | `useMyReservations`, `useMyEventOrders`, `useMyPackageOrders`, `useMyReservationDetail`, `useMyEventOrder`, `useMyPackageOrder`, `useReceipt` | `AccountDashboard` | `account/orders/page.tsx`, `account/reservations/[displayId]/page.tsx` |
2012
+ | Credit, loyalty and passes | `useMyCredits`, `useMyLoyalty`, `useMyLoyaltyHistory`, `useMyPasses` | `AccountDashboard`, `AddToWalletButtons` | `account/page.tsx` |
2013
+ | Membership members, cancellation, billing | `useMyMemberships`, `useMyMembershipDetail`, `useMyMembershipMembers`, `useAddMyMembershipMember`, `useCancelMyMembership`, `useOpenMembershipBillingPortal` | `MembershipDetail` | `account/memberships/[id]/page.tsx` |
2014
+ | Game cards, history and wallet | `useMyGameCards`, `useMyGameCard`, `useMyGameCardHistory`, `useWalletPassUrl` | `GameCardHistory`, `AddToWalletButtons` | `account/game-cards/page.tsx` |
2015
+ | Saved cards | `useSavedCards`, `useCreateCardSetup`, `useRemoveCard`, `useSetDefaultCard` | `SavedCards` + `AddCardForm` (`/payments`) | `account/payment-methods/page.tsx` |
2016
+ | Password change | `useChangePassword`, `useAccount` recovery methods | `ChangePasswordForm` | `account/security/page.tsx` |
2017
+ | Profile and consent | `useUpdateMyProfile`, `useSetMyMobile`, `useMyCommunicationPrefs`, `useSetMyCommunicationPref`, `useSubmitSupportRequest` | `ProfileForm`, `CommunicationPrefs` | `account/profile/page.tsx` |
2018
+ | Export and deletion | `exportMyDataV2`, `useAccountDeletion` | `PrivacyCenter` | `account/privacy/page.tsx` |
2019
+ | Cancellation and booking changes | `useReservationCancelPreview`, `useCancelMyReservation`, event/package/game-card preview and cancel hooks; `useBookingChange` | `BookingChange` | `account/reservations/[displayId]/change/page.tsx` |
2020
+ | Token pay links | `usePayLink`, `useCreatePayLinkPayment` | `BowlosPaymentForm` (`/payments`) | `pay/[token]/page.tsx` |
2021
+
2022
+ `AccountDashboard` keeps its original five default sections: reservations,
2023
+ memberships, loyalty, credit and passes. Opt in through `sections` to eventOrders,
2024
+ packageOrders, gameCards, profile, communications, paymentMethods, security and
2025
+ privacy; payment methods require `centerId`. `useMyPackageOrders` is a shipped
2026
+ hook, with `getMyPackageOrders` as its core twin; open orders with `useMyPackageOrder`.
2027
+
2028
+ Gate wallet buttons on `pass.walletEligible`, then request a fresh normalized
2029
+ `{ url, platform }` through `useWalletPassUrl` / `getWalletPassUrl`. Pass
2030
+ `eligible={pass.walletEligible}` to `AddToWalletButtons`; never build a pass URL.
2031
+
2032
+ Cancellation routes return policy-based store credit. Booking modifications
2033
+ separately support credit or card refunds; render the preview and resulting
2034
+ outcome rather than promising a card refund for every cancellation. Preview is
2035
+ read-only; apply revalidates. Paid upgrades reserve inventory while payment is
2036
+ pending, then apply after webhook confirmation. Do not treat Stripe confirmation
2037
+ alone as a completed change.
2038
+
2039
+ For `useCancelMy*` and `useApplyMyModification`, one idempotency key belongs to
2040
+ one user action. Hooks retain it across uncertain retries, rotate after success
2041
+ or terminal errors and when inputs change; `reset()` starts a new action. Core
2042
+ callers retain their own key across retries. Modification/payment and pay-link
2043
+ PaymentIntents use server-derived keys: do not supply a client key to those calls.
2044
+
2045
+ Keep a reachable email-code recovery page, including for signed-in customers.
2046
+ Handle `CURRENT_PASSWORD_INCORRECT` inline without signing out. Deletion needs a
2047
+ fresh preview, exact confirmation and a working retry/support path. Disable
2048
+ completion, correction, capitalization and spell checking on confirmation inputs.
2049
+ Use `err.code`, Center-local dates, server totals and returned Stripe account/key/mode.
2050
+ Never expose secret keys. Transactional sends remain independent of marketing consent.
2051
+
2052
+ ### Toolkit migration by release
2053
+
2054
+ Pre-1.0 caret ranges stay within one minor: each row requires an explicit dependency
2055
+ range edit. Existing calls and dashboard defaults remain supported. Adopt the
2056
+ hooks selectively; no reference component migration is required.
2057
+
2058
+ | Release | Dependency change | Headless adoption |
2059
+ | --- | --- | --- |
2060
+ | 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. |
2061
+ | 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. |
2062
+ | 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. |
2063
+ | 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. |
2064
+ | 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. |
2065
+
2066
+ ## 0.41.0
2067
+
2068
+ 2026-10-30: Customer account toolkit documentation, final agent checklist and
2069
+ optional account reference components/templates from PR-10. Public hook contracts
2070
+ and dashboard defaults are unchanged. This release introduces no backend routes.
2071
+
2072
+ Migration: explicitly update `^0.40.0` to `^0.41.0`; follow the capability map above
2073
+ and the [reference component contracts](#reference-account-components-v0410).
2074
+ Keep custom headless UI or adopt individual references. Test recovery, cancellation,
2075
+ wallet eligibility, deletion retry and payment completion in the site's own design.
2076
+
2077
+ ## 0.42.0
2078
+
2079
+ Waitlist booking is available when the Center enables its online waitlist toggle.
2080
+ Upgrade explicitly from 0.41.x to 0.42.0; existing booking signatures and reservation
2081
+ statuses are unchanged. A waitlist entry becomes a reservation only on promotion.
2082
+
2083
+ For headless adoption, catch the `createBooking` / `createAnonymousBooking` error:
2084
+ `BowlosApiError.slotFullDetails` exposes `{ reason: "slot_full", waitlistAvailable,
2085
+ requested, available }`. The error code remains `VALIDATION_FAILED`; offer a
2086
+ waitlist only when `waitlistAvailable` is true. Subtype waitlisting is unsupported.
2087
+ Login is required. The Center toggle also gates join and card setup server-side.
2088
+
2089
+ Use `useWaitlistJoin` from `/react`: call `join(args)` (idle → quoting → card),
2090
+ display `entry.amountCents` from the Center pricing engine, and obtain explicit
2091
+ consent: “I authorize a charge of $X to this card if a spot opens.” No charge
2092
+ occurs at join. Never hardcode the amount. Then call `createCardSetup()` and use
2093
+ `setupIntent` (publishableKey, stripeAccount, clientSecret and
2094
+ customerSessionClientSecret) with Stripe Elements in SetupIntent mode. Confirm
2095
+ with `stripe.confirmSetup({ elements, redirect: "if_required" })`, complete any
2096
+ requires_action authentication, and pass the succeeded intent to
2097
+ `cardConfirmed({ id, status })` (confirming → joined or error). Unfinished intents
2098
+ stay in card state. `error` exposes failures; `reset()` starts over. Card setup
2099
+ must follow consent, including for a zero-dollar quote. The server freezes this
2100
+ quote for the eventual promotion charge. Abandoned pending_card entries expire.
2101
+
2102
+ Framework-free routes are `joinWaitlist`, `createWaitlistSetupIntent`,
2103
+ `confirmWaitlistCard`, `listMyWaitlist`, and `leaveWaitlist`, all authenticated.
2104
+ Entry routes take `entryId` plus optional brandId/centerId; confirm also takes
2105
+ setupIntentId. List takes brandId and optional centerId and returns active entries
2106
+ plus recent history. Show pending_card/waiting under “Pending — waitlist” and call
2107
+ leaveWaitlist for Leave; refresh the list and show “not charged”. Leaving is
2108
+ rejected while promotion is charging or its outcome is unknown. Cards remain in
2109
+ the wallet after leaving. Promoted entries link through promotedReservationDisplayId.
2110
+
2111
+ `WaitlistJoin` from `/components` is an optional reference using the same headless
2112
+ hook and AddCardForm SetupIntent UI, including amount consent. Pass booking `args`
2113
+ and optional `onJoined`. AccountDashboard supports a `"waitlist"` section;
2114
+ add it to your explicit section list to show pending entries. Existing headless sites retain
2115
+ their markup and adopt these routes directly; no component adoption is required.
2116
+
2117
+ ## 0.43.0
2118
+
2119
+ Waitlist text consent and account entry details are additive. Upgrade the SDK to
2120
+ 0.43.0 after the N6 backend is deployed; old clients omit consent and receive no
2121
+ waitlist texts. Existing booking and payment behavior is unchanged.
2122
+
2123
+ | Capability | Headless API | Adoption in your site's own UI |
2124
+ | ------------------------- | ------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2125
+ | Per-waitlist text consent | `joinWaitlist(client, { ...args, textUpdates })` or `useWaitlistJoin().join({ ...args, textUpdates })` | Pass the join checkbox's boolean. Omitted or `false` means no texts; `true` opts into this waitlist's transactional texts, subject to STOP and Center event settings. |
2126
+ | Attraction and quantity | `listMyWaitlist` → `MyWaitlistEntry` | Render optional `units`, `unitLabelSingular`, `unitLabelPlural`, and `attractionName`; use neutral “unit/units” when labels are absent. |
2127
+ | Promoted time | `MyWaitlistEntry.promotedStartMinuteOfDay` / `promotedEndMinuteOfDay` | Show the actual promoted window when present, otherwise the original start/end. Display in the Center's timezone. |
2128
+ | Text status | `MyWaitlistEntry.textUpdates` | Show whether texts are enabled; missing means no texts. This is not a marketing preference. |
2129
+
2130
+ For headless adoption, show a per-waitlist checkbox, initially checked, with the
2131
+ account holder's destination phone number; pass its current value explicitly.
2132
+ Keep the separate authorization for the quoted card charge. The reference
2133
+ `WaitlistJoin` accepts `textUpdates` through its `args`; it does not add a text
2134
+ checkbox for you. All entry fields above remain optional for older responses.
2135
+ Staff-only promotion, unit availability, closing, start-time, and guest-confirmation
2136
+ error codes are not part of the SDK's exported constants.