@bowlos/reservations 0.35.0 → 0.36.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 (43) hide show
  1. package/HEADLESS.md +182 -1
  2. package/README.md +121 -0
  3. package/dist/{account-BJ5UjC0r.d.ts → account-DfM2COaz.d.ts} +47 -2
  4. package/dist/{account-QoFg8-i1.d.cts → account-oCvYWmO9.d.cts} +47 -2
  5. package/dist/{catalog-p9cwB6Qv.d.cts → catalog-DbhdwmnX.d.cts} +4 -1
  6. package/dist/{catalog-CGitz1PG.d.ts → catalog-XkjgPI5C.d.ts} +4 -1
  7. package/dist/{chunk-UN5E6UEZ.js → chunk-3JSVEOKG.js} +8 -4
  8. package/dist/chunk-3JSVEOKG.js.map +1 -0
  9. package/dist/{chunk-MMSVM3QS.js → chunk-TEHRROVY.js} +37 -4
  10. package/dist/chunk-TEHRROVY.js.map +1 -0
  11. package/dist/{chunk-SMPDCDMB.js → chunk-YAXBZJMI.js} +3 -3
  12. package/dist/chunk-YAXBZJMI.js.map +1 -0
  13. package/dist/cli.cjs +5 -3
  14. package/dist/cli.cjs.map +1 -1
  15. package/dist/components.cjs +1 -2
  16. package/dist/components.cjs.map +1 -1
  17. package/dist/components.d.cts +4 -4
  18. package/dist/components.d.ts +4 -4
  19. package/dist/components.js +3 -3
  20. package/dist/{data-qw8P3JW3.d.cts → data-BJkB-tvM.d.cts} +10 -2
  21. package/dist/{data-qw8P3JW3.d.ts → data-BJkB-tvM.d.ts} +10 -2
  22. package/dist/index.cjs +29 -3
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +4 -4
  25. package/dist/index.d.ts +4 -4
  26. package/dist/index.js +22 -5
  27. package/dist/index.js.map +1 -1
  28. package/dist/payments.d.cts +1 -1
  29. package/dist/payments.d.ts +1 -1
  30. package/dist/{react-C2V1kXnO.d.ts → react-0MyyTtE4.d.ts} +2 -2
  31. package/dist/{react-DtncBQ3b.d.cts → react-CWAG4cW0.d.cts} +2 -2
  32. package/dist/react.cjs +43 -3
  33. package/dist/react.cjs.map +1 -1
  34. package/dist/react.d.cts +22 -6
  35. package/dist/react.d.ts +22 -6
  36. package/dist/react.js +3 -3
  37. package/package.json +3 -2
  38. package/templates/center-site/app/book/page.tsx +11 -23
  39. package/templates/center-site/app/catalog/page.tsx +21 -12
  40. package/templates/center-site/package.json +1 -1
  41. package/dist/chunk-MMSVM3QS.js.map +0 -1
  42. package/dist/chunk-SMPDCDMB.js.map +0 -1
  43. package/dist/chunk-UN5E6UEZ.js.map +0 -1
@@ -1,9 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { CSSProperties, ReactNode } from 'react';
3
- import { m as PublicSurface, g as CatalogItem } from './catalog-p9cwB6Qv.cjs';
4
- export { h as CatalogResult, i as CatalogSection } from './catalog-p9cwB6Qv.cjs';
5
- import { U as PricingMode, S as PaymentIntentInfo, l as Customer } from './data-qw8P3JW3.cjs';
6
- import { d as UseAccountResult } from './react-DtncBQ3b.cjs';
3
+ import { m as PublicSurface, g as CatalogItem } from './catalog-DbhdwmnX.cjs';
4
+ export { h as CatalogResult, i as CatalogSection } from './catalog-DbhdwmnX.cjs';
5
+ import { U as PricingMode, S as PaymentIntentInfo, l as Customer } from './data-BJkB-tvM.cjs';
6
+ import { d as UseAccountResult } from './react-CWAG4cW0.cjs';
7
7
  import { InquiryFormType } from '@bowlos/shared';
8
8
 
9
9
  /**
@@ -1,9 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { CSSProperties, ReactNode } from 'react';
3
- import { m as PublicSurface, g as CatalogItem } from './catalog-CGitz1PG.js';
4
- export { h as CatalogResult, i as CatalogSection } from './catalog-CGitz1PG.js';
5
- import { U as PricingMode, S as PaymentIntentInfo, l as Customer } from './data-qw8P3JW3.js';
6
- import { d as UseAccountResult } from './react-C2V1kXnO.js';
3
+ import { m as PublicSurface, g as CatalogItem } from './catalog-XkjgPI5C.js';
4
+ export { h as CatalogResult, i as CatalogSection } from './catalog-XkjgPI5C.js';
5
+ import { U as PricingMode, S as PaymentIntentInfo, l as Customer } from './data-BJkB-tvM.js';
6
+ import { d as UseAccountResult } from './react-0MyyTtE4.js';
7
7
  import { InquiryFormType } from '@bowlos/shared';
8
8
 
9
9
  /**
@@ -1,6 +1,6 @@
1
- import { INQUIRY_FORMS } from './chunk-SMPDCDMB.js';
2
- import { useTestMode, useAccount, useAvailability, useBookingPreview, useAddons, useStartTimes, useBookingFlow, useMyReservations, useMyMemberships, useMyLoyalty, useMyCredits, useMyPasses, useFlashSale, useFlashSales, useCatalog, useRetailPricing } from './chunk-MMSVM3QS.js';
3
- import { availableUnitCount } from './chunk-UN5E6UEZ.js';
1
+ import { INQUIRY_FORMS } from './chunk-YAXBZJMI.js';
2
+ import { useTestMode, useAccount, useAvailability, useBookingPreview, useAddons, useStartTimes, useBookingFlow, useMyReservations, useMyMemberships, useMyLoyalty, useMyCredits, useMyPasses, useFlashSale, useFlashSales, useCatalog, useRetailPricing } from './chunk-TEHRROVY.js';
3
+ import { availableUnitCount } from './chunk-3JSVEOKG.js';
4
4
  import { token, styles, formatCents, formatMinuteLabel, minutesToTime, useCountdown, formatCentsRange } from './chunk-Y3YSDO3H.js';
5
5
  export { BOWLOS_DEFAULT_THEME, BowlosTheme, formatCents, formatCentsRange } from './chunk-Y3YSDO3H.js';
6
6
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -465,6 +465,8 @@ type GameCardPreviewArgs = {
465
465
  * total. Drives the headless "Review" step. Computed by the SAME engine as the
466
466
  * PaymentIntent, so it never diverges from what the customer is charged. */
467
467
  interface GameCardPreviewResult {
468
+ tierDiscountCents?: number;
469
+ tierDiscountLabel?: string;
468
470
  subtotalCents: number;
469
471
  taxLines: {
470
472
  rateId: string;
@@ -490,6 +492,8 @@ type EventTicketPreviewArgs = {
490
492
  flashSaleItemId?: string;
491
493
  };
492
494
  interface EventTicketPreviewResult {
495
+ tierDiscountCents?: number;
496
+ tierDiscountLabel?: string;
493
497
  eventName: string;
494
498
  eventDate: string;
495
499
  quantity: number;
@@ -610,6 +614,8 @@ type PackagePreviewArgs = {
610
614
  * total. Drives the headless "Review" step. Computed by the SAME engine as the
611
615
  * PaymentIntent, so it never diverges from what the customer is charged. */
612
616
  interface PackagePreviewResult {
617
+ tierDiscountCents?: number;
618
+ tierDiscountLabel?: string;
613
619
  baseTotalCents: number;
614
620
  addons: {
615
621
  addonId: string;
@@ -651,6 +657,8 @@ type MembershipPreviewArgs = {
651
657
  * by the SAME engine as the PaymentIntent, so it never diverges from what the
652
658
  * customer is charged. */
653
659
  interface MembershipPreviewResult {
660
+ tierDiscountCents?: number;
661
+ tierDiscountLabel?: string;
654
662
  duesCents: number;
655
663
  setupFeeCents: number;
656
664
  subtotalCents: number;
@@ -755,8 +763,8 @@ interface MembershipSubscriptionIntent {
755
763
  declare function createMembershipSubscriptionOrder(client: BowlosClient, args: MembershipSubscriptionArgs): Promise<MembershipSubscriptionIntent>;
756
764
  /** Browser/Node-safe idempotency key for booking creates. */
757
765
  declare function generateIdempotencyKey(): string;
758
- /** Place the inventory hold + open a checkout. Sends the session when present
759
- * (member rates + account credit); falls back to anonymous. */
766
+ /** Place the inventory hold + open a checkout. Requires a signed-in
767
+ * customer — the server rejects a guest. Sends the session bearer. */
760
768
  declare function createBooking(client: BowlosClient, args: CreateBookingArgs): Promise<BookingHold>;
761
769
  /** Mint the Stripe Connect PaymentIntent for a held checkout (by refToken). */
762
770
  declare function createCheckoutPaymentIntent(client: BowlosClient, refToken: string): Promise<PaymentIntentInfo>;
@@ -465,6 +465,8 @@ type GameCardPreviewArgs = {
465
465
  * total. Drives the headless "Review" step. Computed by the SAME engine as the
466
466
  * PaymentIntent, so it never diverges from what the customer is charged. */
467
467
  interface GameCardPreviewResult {
468
+ tierDiscountCents?: number;
469
+ tierDiscountLabel?: string;
468
470
  subtotalCents: number;
469
471
  taxLines: {
470
472
  rateId: string;
@@ -490,6 +492,8 @@ type EventTicketPreviewArgs = {
490
492
  flashSaleItemId?: string;
491
493
  };
492
494
  interface EventTicketPreviewResult {
495
+ tierDiscountCents?: number;
496
+ tierDiscountLabel?: string;
493
497
  eventName: string;
494
498
  eventDate: string;
495
499
  quantity: number;
@@ -610,6 +614,8 @@ type PackagePreviewArgs = {
610
614
  * total. Drives the headless "Review" step. Computed by the SAME engine as the
611
615
  * PaymentIntent, so it never diverges from what the customer is charged. */
612
616
  interface PackagePreviewResult {
617
+ tierDiscountCents?: number;
618
+ tierDiscountLabel?: string;
613
619
  baseTotalCents: number;
614
620
  addons: {
615
621
  addonId: string;
@@ -651,6 +657,8 @@ type MembershipPreviewArgs = {
651
657
  * by the SAME engine as the PaymentIntent, so it never diverges from what the
652
658
  * customer is charged. */
653
659
  interface MembershipPreviewResult {
660
+ tierDiscountCents?: number;
661
+ tierDiscountLabel?: string;
654
662
  duesCents: number;
655
663
  setupFeeCents: number;
656
664
  subtotalCents: number;
@@ -755,8 +763,8 @@ interface MembershipSubscriptionIntent {
755
763
  declare function createMembershipSubscriptionOrder(client: BowlosClient, args: MembershipSubscriptionArgs): Promise<MembershipSubscriptionIntent>;
756
764
  /** Browser/Node-safe idempotency key for booking creates. */
757
765
  declare function generateIdempotencyKey(): string;
758
- /** Place the inventory hold + open a checkout. Sends the session when present
759
- * (member rates + account credit); falls back to anonymous. */
766
+ /** Place the inventory hold + open a checkout. Requires a signed-in
767
+ * customer — the server rejects a guest. Sends the session bearer. */
760
768
  declare function createBooking(client: BowlosClient, args: CreateBookingArgs): Promise<BookingHold>;
761
769
  /** Mint the Stripe Connect PaymentIntent for a held checkout (by refToken). */
762
770
  declare function createCheckoutPaymentIntent(client: BowlosClient, refToken: string): Promise<PaymentIntentInfo>;
package/dist/index.cjs CHANGED
@@ -8,6 +8,9 @@ var BOWLOS_ERROR_CODES = {
8
8
  ORIGIN_NOT_ALLOWED: "ORIGIN_NOT_ALLOWED",
9
9
  RATE_LIMITED: "RATE_LIMITED",
10
10
  // Auth
11
+ PASSWORD_TOO_WEAK: "PASSWORD_TOO_WEAK",
12
+ CURRENT_PASSWORD_INCORRECT: "CURRENT_PASSWORD_INCORRECT",
13
+ CURRENT_PASSWORD_REQUIRED: "CURRENT_PASSWORD_REQUIRED",
11
14
  INVALID_CREDENTIALS: "INVALID_CREDENTIALS",
12
15
  SIGNUP_FAILED: "SIGNUP_FAILED",
13
16
  // Shared backend codes
@@ -88,7 +91,8 @@ function isConfigErrorCode(code) {
88
91
  return code === BOWLOS_ERROR_CODES.API_KEY_MISSING || code === BOWLOS_ERROR_CODES.API_KEY_INVALID || code === BOWLOS_ERROR_CODES.ORIGIN_NOT_ALLOWED || code === BOWLOS_ERROR_CODES.RATE_LIMITED;
89
92
  }
90
93
  function looksLikeExpiredSession(status, code) {
91
- if (isConfigErrorCode(code)) return false;
94
+ if (isConfigErrorCode(code) || code === BOWLOS_ERROR_CODES.CURRENT_PASSWORD_INCORRECT || code === BOWLOS_ERROR_CODES.CURRENT_PASSWORD_REQUIRED)
95
+ return false;
92
96
  return status === 401 || code === BOWLOS_ERROR_CODES.PERMISSION_DENIED || code === BOWLOS_ERROR_CODES.SCOPE_REVOKED;
93
97
  }
94
98
  var BowlosClient = class {
@@ -198,7 +202,7 @@ var BowlosClient = class {
198
202
  }
199
203
  const code = env.error?.code ?? (status === 429 ? BOWLOS_ERROR_CODES.RATE_LIMITED : status === 404 ? BOWLOS_ERROR_CODES.NOT_FOUND : BOWLOS_ERROR_CODES.UNKNOWN);
200
204
  const message = env.error?.message ?? `Request to "${name}" failed (HTTP ${status}).`;
201
- if (auth && !retried && this.store.get() && looksLikeExpiredSession(status, code)) {
205
+ if (name !== "changeMyPassword" && auth && !retried && this.store.get() && looksLikeExpiredSession(status, code)) {
202
206
  const refreshed = await this.tryRefresh();
203
207
  if (refreshed) return this.callInternal(name, args, auth, true, method);
204
208
  }
@@ -323,7 +327,7 @@ function createBowlosClient(config) {
323
327
  return new BowlosClient(config);
324
328
  }
325
329
 
326
- // ../../../../../Users/bosummers/conductor/workspaces/bowlos/budapest/packages/shared/src/inquiry.ts
330
+ // ../shared/src/inquiry.ts
327
331
  var INQUIRY_FORMS = {
328
332
  contact: {
329
333
  label: "Contact",
@@ -772,6 +776,23 @@ function createFlashSaleBooking(client, args) {
772
776
  auth: true
773
777
  });
774
778
  }
779
+ function listSavedCards(client, args) {
780
+ return client.call("listMyPaymentMethods", args, { auth: true });
781
+ }
782
+ function createCardSetup(client, args) {
783
+ return client.call("createSetupIntentForAddingCard", args, { auth: true });
784
+ }
785
+ function removeSavedCard(client, args) {
786
+ return client.call("detachPaymentMethod", args, { auth: true });
787
+ }
788
+ function setDefaultCard(client, args) {
789
+ return client.call("setDefaultPaymentMethod", args, { auth: true });
790
+ }
791
+ async function changePassword(client, args) {
792
+ const result = await client.call("changeMyPassword", args, { auth: true });
793
+ await client.signOut();
794
+ return result;
795
+ }
775
796
 
776
797
  // src/catalog.ts
777
798
  function listCatalog(client, args) {
@@ -867,9 +888,11 @@ exports.cancelMyEventOrder = cancelMyEventOrder;
867
888
  exports.cancelMyGameCard = cancelMyGameCard;
868
889
  exports.cancelMyPackageOrder = cancelMyPackageOrder;
869
890
  exports.cancelMyReservation = cancelMyReservation;
891
+ exports.changePassword = changePassword;
870
892
  exports.checkAvailability = checkAvailability;
871
893
  exports.createBooking = createBooking;
872
894
  exports.createBowlosClient = createBowlosClient;
895
+ exports.createCardSetup = createCardSetup;
873
896
  exports.createCheckoutPaymentIntent = createCheckoutPaymentIntent;
874
897
  exports.createEventTicketOrder = createEventTicketOrder;
875
898
  exports.createFlashSaleBooking = createFlashSaleBooking;
@@ -909,6 +932,7 @@ exports.listPackages = listPackages;
909
932
  exports.listProducts = listProducts;
910
933
  exports.listPublicMemberships = listPublicMemberships;
911
934
  exports.listRetailPricing = listRetailPricing;
935
+ exports.listSavedCards = listSavedCards;
912
936
  exports.listStartTimes = listStartTimes;
913
937
  exports.localStorageTokenStore = localStorageTokenStore;
914
938
  exports.previewEventOrderCancellation = previewEventOrderCancellation;
@@ -920,8 +944,10 @@ exports.previewMembershipSubscription = previewMembershipSubscription;
920
944
  exports.previewPackage = previewPackage;
921
945
  exports.previewPackageOrderCancellation = previewPackageOrderCancellation;
922
946
  exports.previewReservationCancellation = previewReservationCancellation;
947
+ exports.removeSavedCard = removeSavedCard;
923
948
  exports.resolvePackageStartTimesForWeekday = resolvePackageStartTimesForWeekday;
924
949
  exports.runDoctor = runDoctor;
950
+ exports.setDefaultCard = setDefaultCard;
925
951
  exports.splitPackageAddons = splitPackageAddons;
926
952
  exports.toOptionalAddonsInput = toOptionalAddonsInput;
927
953
  exports.usesPerWeekdayStartTimes = usesPerWeekdayStartTimes;