@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.
Files changed (74) hide show
  1. package/AGENTS.md +300 -0
  2. package/HEADLESS.md +534 -10
  3. package/README.md +242 -2
  4. package/dist/{data-BJkB-tvM.d.cts → account-DEX2Lr78.d.cts} +208 -1
  5. package/dist/{data-BJkB-tvM.d.ts → account-DEX2Lr78.d.ts} +208 -1
  6. package/dist/booking-change-4DGu-B08.d.ts +1282 -0
  7. package/dist/booking-change-aK6P37FZ.d.cts +1282 -0
  8. package/dist/{chunk-3JSVEOKG.js → chunk-44WKP6MW.js} +32 -5
  9. package/dist/chunk-44WKP6MW.js.map +1 -0
  10. package/dist/{chunk-TEHRROVY.js → chunk-BWJHRJN6.js} +47 -192
  11. package/dist/chunk-BWJHRJN6.js.map +1 -0
  12. package/dist/{chunk-Y3YSDO3H.js → chunk-FMFHNBDH.js} +56 -5
  13. package/dist/chunk-FMFHNBDH.js.map +1 -0
  14. package/dist/chunk-I37IJNYU.js +139 -0
  15. package/dist/chunk-I37IJNYU.js.map +1 -0
  16. package/dist/chunk-VJIS56OO.js +717 -0
  17. package/dist/chunk-VJIS56OO.js.map +1 -0
  18. package/dist/cli.cjs +29 -3
  19. package/dist/cli.cjs.map +1 -1
  20. package/dist/components.cjs +1595 -2
  21. package/dist/components.cjs.map +1 -1
  22. package/dist/components.d.cts +208 -7
  23. package/dist/components.d.ts +208 -7
  24. package/dist/components.js +1045 -7
  25. package/dist/components.js.map +1 -1
  26. package/dist/index.cjs +270 -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 +203 -0
  33. package/dist/payments.cjs.map +1 -1
  34. package/dist/payments.d.cts +16 -2
  35. package/dist/payments.d.ts +16 -2
  36. package/dist/payments.js +78 -2
  37. package/dist/payments.js.map +1 -1
  38. package/dist/{react-0MyyTtE4.d.ts → react-CrRciA7I.d.ts} +2 -2
  39. package/dist/{react-CWAG4cW0.d.cts → react-QJrsaOnN.d.cts} +2 -2
  40. package/dist/react.cjs +758 -27
  41. package/dist/react.cjs.map +1 -1
  42. package/dist/react.d.cts +139 -12
  43. package/dist/react.d.ts +139 -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
@@ -775,4 +775,211 @@ declare function abandonCheckout(client: BowlosClient, refToken: string): Promis
775
775
  ok: boolean;
776
776
  }>;
777
777
 
778
- export { bookingPreview as $, type AuthState as A, type BookingAddonSelection as B, type CheckoutStatus as C, type MembershipStatusResult as D, type EventTicketCheckoutStatus as E, type FetchLike as F, type GameCardCheckoutStatus as G, type MembershipSubscriptionArgs as H, type MembershipSubscriptionIntent as I, type MembershipSubscriptionPreviewResult as J, type PackagePreviewArgs as K, type LinkProfile as L, type MembershipCheckoutStatus as M, type PackagePreviewResult as N, type PackagePurchaseArgs as O, type PackageCheckoutStatus as P, type PackagePurchaseIntent as Q, type PackageStatusResult as R, type PaymentIntentInfo as S, type PingResult as T, type PricingMode as U, type PublicAddon as V, type StartTimesArgs as W, type TokenStore as X, type Tokens as Y, abandonCheckout as Z, availableUnitCount as _, type AvailabilityArgs as a, checkAvailability as a0, createBooking as a1, createBowlosClient as a2, createCheckoutPaymentIntent as a3, createEventTicketOrder as a4, createGameCardOrder as a5, createMembershipOrder as a6, createMembershipSubscriptionOrder as a7, createPackageOrder as a8, generateIdempotencyKey as a9, getCheckoutStatus as aa, getEventTicketStatus as ab, getGameCardStatus as ac, getMembershipStatus as ad, getPackageStatus as ae, listAddons as af, listStartTimes as ag, localStorageTokenStore as ah, previewEventTicket as ai, previewGameCard as aj, previewMembership as ak, previewMembershipSubscription as al, previewPackage as am, type AvailabilityResult as b, type BookingCustomer as c, type BookingHold as d, type BookingPreviewArgs as e, type BookingQuote as f, BowlosClient as g, type BowlosClientConfig as h, type CheckoutStatusResult as i, type ConnectedPaymentInput as j, type CreateBookingArgs as k, type Customer as l, type EventTicketPreviewArgs as m, type EventTicketPreviewResult as n, type EventTicketPurchaseArgs as o, type EventTicketPurchaseIntent as p, type EventTicketStatusResult as q, type GameCardPreviewArgs as r, type GameCardPreviewResult as s, type GameCardPurchaseArgs as t, type GameCardPurchaseIntent as u, type GameCardStatusResult as v, type MembershipPreviewArgs as w, type MembershipPreviewResult as x, type MembershipPurchaseArgs as y, type MembershipPurchaseIntent as z };
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 };