@bowlos/reservations 0.7.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/HEADLESS.md +294 -0
- package/README.md +93 -12
- package/dist/{catalog-DBIisELC.d.ts → catalog-kd07kri0.d.ts} +1 -1
- package/dist/{catalog-DEwo88hz.d.cts → catalog-kdDjgvT1.d.cts} +1 -1
- package/dist/{chunk-YICHFUAY.js → chunk-2X7MFQWY.js} +9 -3
- package/dist/chunk-2X7MFQWY.js.map +1 -0
- package/dist/{chunk-JBBWGMRT.js → chunk-FPUWLOW3.js} +10 -4
- package/dist/chunk-FPUWLOW3.js.map +1 -0
- package/dist/chunk-Y3YSDO3H.js +221 -0
- package/dist/chunk-Y3YSDO3H.js.map +1 -0
- package/dist/components.cjs +332 -166
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +14 -3
- package/dist/components.d.ts +14 -3
- package/dist/components.js +322 -373
- package/dist/components.js.map +1 -1
- package/dist/{data-DrM0D6Pi.d.cts → data-lC-l-haz.d.cts} +33 -54
- package/dist/{data-DrM0D6Pi.d.ts → data-lC-l-haz.d.ts} +33 -54
- package/dist/errors-IIK7xibp.d.cts +54 -0
- package/dist/errors-IIK7xibp.d.ts +54 -0
- package/dist/index.cjs +8 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +2 -2
- package/dist/payments.cjs +245 -0
- package/dist/payments.cjs.map +1 -0
- package/dist/payments.d.cts +37 -0
- package/dist/payments.d.ts +37 -0
- package/dist/payments.js +83 -0
- package/dist/payments.js.map +1 -0
- package/dist/{react-7ruEsubp.d.cts → react-B3dlcklN.d.ts} +2 -1
- package/dist/{react-Cb_NZCXa.d.ts → react-aZplAyHS.d.cts} +2 -1
- package/dist/react.cjs +8 -0
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +12 -5
- package/dist/react.d.ts +12 -5
- package/dist/react.js +2 -2
- package/package.json +22 -3
- package/templates/center-site/README.md +8 -7
- package/templates/center-site/app/book/page.tsx +10 -3
- package/templates/center-site/package.json +1 -1
- package/dist/chunk-JBBWGMRT.js.map +0 -1
- package/dist/chunk-YICHFUAY.js.map +0 -1
- package/templates/center-site/app/book/checkout-form.tsx +0 -85
|
@@ -134,59 +134,6 @@ declare class BowlosClient {
|
|
|
134
134
|
/** Create a configured client. */
|
|
135
135
|
declare function createBowlosClient(config: BowlosClientConfig): BowlosClient;
|
|
136
136
|
|
|
137
|
-
/**
|
|
138
|
-
* Error model for the BowlOS Reservations SDK.
|
|
139
|
-
*
|
|
140
|
-
* Every failed gateway call surfaces as a single `BowlosApiError` carrying a
|
|
141
|
-
* stable `code` (string), the HTTP `status`, and — for rate limits — a
|
|
142
|
-
* `retryAfterSeconds`. The gateway normalizes the backend's two error
|
|
143
|
-
* conventions (thrown ConvexError + `{ ok:false }` envelopes) into one JSON
|
|
144
|
-
* shape; this class is the client-side mirror of that shape, so consumers
|
|
145
|
-
* branch on `error.code`, never on message text.
|
|
146
|
-
*/
|
|
147
|
-
/** Stable error codes the gateway / backend can return. Open set — treat
|
|
148
|
-
* `code` as a string and match against these for known cases. */
|
|
149
|
-
declare const BOWLOS_ERROR_CODES: {
|
|
150
|
-
readonly API_KEY_MISSING: "API_KEY_MISSING";
|
|
151
|
-
readonly API_KEY_INVALID: "API_KEY_INVALID";
|
|
152
|
-
readonly ORIGIN_NOT_ALLOWED: "ORIGIN_NOT_ALLOWED";
|
|
153
|
-
readonly RATE_LIMITED: "RATE_LIMITED";
|
|
154
|
-
readonly INVALID_CREDENTIALS: "INVALID_CREDENTIALS";
|
|
155
|
-
readonly SIGNUP_FAILED: "SIGNUP_FAILED";
|
|
156
|
-
readonly VALIDATION_FAILED: "VALIDATION_FAILED";
|
|
157
|
-
readonly PERMISSION_DENIED: "PERMISSION_DENIED";
|
|
158
|
-
readonly SCOPE_REVOKED: "SCOPE_REVOKED";
|
|
159
|
-
readonly NOT_FOUND: "NOT_FOUND";
|
|
160
|
-
readonly VERSION_CONFLICT: "VERSION_CONFLICT";
|
|
161
|
-
readonly PRICING_SNAPSHOT_STALE: "PRICING_SNAPSHOT_STALE";
|
|
162
|
-
readonly PAYMENTS_NOT_CONNECTED: "PAYMENTS_NOT_CONNECTED";
|
|
163
|
-
readonly CONNECT_ACCOUNT_RESTRICTED: "CONNECT_ACCOUNT_RESTRICTED";
|
|
164
|
-
readonly CHECKOUT_EXPIRED: "CHECKOUT_EXPIRED";
|
|
165
|
-
readonly NETWORK_ERROR: "NETWORK_ERROR";
|
|
166
|
-
readonly UNKNOWN: "ERROR";
|
|
167
|
-
};
|
|
168
|
-
type BowlosErrorCode = (typeof BOWLOS_ERROR_CODES)[keyof typeof BOWLOS_ERROR_CODES] | (string & {});
|
|
169
|
-
interface BowlosApiErrorOptions {
|
|
170
|
-
retryAfterSeconds?: number;
|
|
171
|
-
cause?: unknown;
|
|
172
|
-
}
|
|
173
|
-
declare class BowlosApiError extends Error {
|
|
174
|
-
/** Stable, machine-readable code. Branch on this, not on `message`. */
|
|
175
|
-
readonly code: BowlosErrorCode;
|
|
176
|
-
/** HTTP status (0 for a network failure before any response). */
|
|
177
|
-
readonly status: number;
|
|
178
|
-
/** Seconds to wait before retrying — present only on `RATE_LIMITED`. */
|
|
179
|
-
readonly retryAfterSeconds?: number;
|
|
180
|
-
constructor(code: BowlosErrorCode, message: string, status: number, options?: BowlosApiErrorOptions);
|
|
181
|
-
/** Too many requests — caller should back off `retryAfterSeconds`. */
|
|
182
|
-
get isRateLimited(): boolean;
|
|
183
|
-
/** Bad/expired login. The session could not be established or has lapsed. */
|
|
184
|
-
get isAuthError(): boolean;
|
|
185
|
-
/** Wrong/missing API key or a disallowed origin — a site-config problem,
|
|
186
|
-
* not something the end customer can fix. */
|
|
187
|
-
get isConfigError(): boolean;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
137
|
/**
|
|
191
138
|
* Typed data surface for @bowlos/reservations — booking-funnel reads.
|
|
192
139
|
*
|
|
@@ -216,6 +163,19 @@ type BookingAddonSelection = {
|
|
|
216
163
|
addonId: string;
|
|
217
164
|
quantity: number;
|
|
218
165
|
};
|
|
166
|
+
/** A bookable add-on for a product (shoe rental, upgrades…). `rateMode` is how
|
|
167
|
+
* it prices — `per_person` (× bowlers), `per_unit` (× lanes), or `flat` (once).
|
|
168
|
+
* `defaultQuantityRule: "one_per_guest"` hints the natural quantity is the
|
|
169
|
+
* party size; `"manual"` means the customer picks. */
|
|
170
|
+
interface PublicAddon {
|
|
171
|
+
id: string;
|
|
172
|
+
displayId: string;
|
|
173
|
+
name: string;
|
|
174
|
+
description: string | null;
|
|
175
|
+
priceCents: number;
|
|
176
|
+
rateMode: "per_person" | "per_unit" | "flat";
|
|
177
|
+
defaultQuantityRule: "one_per_guest" | "manual";
|
|
178
|
+
}
|
|
219
179
|
/** Inputs for `bookingPreview` (the authoritative price quote). */
|
|
220
180
|
type BookingPreviewArgs = {
|
|
221
181
|
centerId: string;
|
|
@@ -246,6 +206,25 @@ declare function checkAvailability(client: BowlosClient, args: AvailabilityArgs)
|
|
|
246
206
|
/** Authoritative price quote for the chosen inputs (anonymous; a signed-in
|
|
247
207
|
* session unlocks member rates + account credit). */
|
|
248
208
|
declare function bookingPreview(client: BowlosClient, args: BookingPreviewArgs): Promise<BookingQuote>;
|
|
209
|
+
/** Add-ons available for a product (shoe rental, upgrades…). Anonymous-callable;
|
|
210
|
+
* feed the customer's picks back as `addons` on the preview + the booking. */
|
|
211
|
+
declare function listAddons(client: BowlosClient, args: {
|
|
212
|
+
productId: string;
|
|
213
|
+
}): Promise<PublicAddon[]>;
|
|
214
|
+
/** Inputs for `availableStartTimes`. */
|
|
215
|
+
type StartTimesArgs = {
|
|
216
|
+
productId: string;
|
|
217
|
+
dateISO: string;
|
|
218
|
+
/** Booking length, to leave room before close. Default 60 on the server. */
|
|
219
|
+
durationMinutes?: number;
|
|
220
|
+
/** Grid step in minutes. Default 30 on the server. */
|
|
221
|
+
stepMinutes?: number;
|
|
222
|
+
mode?: PricingMode;
|
|
223
|
+
};
|
|
224
|
+
/** The bookable start times (minute-of-day, ascending) for a product on a date:
|
|
225
|
+
* within operating hours, past the booking buffer, and backed by a real price
|
|
226
|
+
* plan (same pricing engine the quote uses). Anonymous-callable. */
|
|
227
|
+
declare function listStartTimes(client: BowlosClient, args: StartTimesArgs): Promise<number[]>;
|
|
249
228
|
/** Convenience: free units = total minus the busy set (never negative). */
|
|
250
229
|
declare function availableUnitCount(availability: AvailabilityResult): number;
|
|
251
230
|
/** Customer identity for a booking (collected in the booking form; the server
|
|
@@ -324,4 +303,4 @@ declare function abandonCheckout(client: BowlosClient, refToken: string): Promis
|
|
|
324
303
|
ok: boolean;
|
|
325
304
|
}>;
|
|
326
305
|
|
|
327
|
-
export { type AuthState as A,
|
|
306
|
+
export { type AuthState as A, type BookingAddonSelection as B, type CheckoutStatus as C, localStorageTokenStore as D, type FetchLike as F, type LinkProfile as L, type PaymentIntentInfo as P, type StartTimesArgs as S, type TokenStore as T, type AvailabilityArgs as a, 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 CreateBookingArgs as j, type Customer as k, type PingResult as l, type PricingMode as m, type PublicAddon as n, type Tokens as o, abandonCheckout as p, availableUnitCount as q, bookingPreview as r, checkAvailability as s, createBooking as t, createBowlosClient as u, createCheckoutPaymentIntent as v, generateIdempotencyKey as w, getCheckoutStatus as x, listAddons as y, listStartTimes as z };
|
|
@@ -134,59 +134,6 @@ declare class BowlosClient {
|
|
|
134
134
|
/** Create a configured client. */
|
|
135
135
|
declare function createBowlosClient(config: BowlosClientConfig): BowlosClient;
|
|
136
136
|
|
|
137
|
-
/**
|
|
138
|
-
* Error model for the BowlOS Reservations SDK.
|
|
139
|
-
*
|
|
140
|
-
* Every failed gateway call surfaces as a single `BowlosApiError` carrying a
|
|
141
|
-
* stable `code` (string), the HTTP `status`, and — for rate limits — a
|
|
142
|
-
* `retryAfterSeconds`. The gateway normalizes the backend's two error
|
|
143
|
-
* conventions (thrown ConvexError + `{ ok:false }` envelopes) into one JSON
|
|
144
|
-
* shape; this class is the client-side mirror of that shape, so consumers
|
|
145
|
-
* branch on `error.code`, never on message text.
|
|
146
|
-
*/
|
|
147
|
-
/** Stable error codes the gateway / backend can return. Open set — treat
|
|
148
|
-
* `code` as a string and match against these for known cases. */
|
|
149
|
-
declare const BOWLOS_ERROR_CODES: {
|
|
150
|
-
readonly API_KEY_MISSING: "API_KEY_MISSING";
|
|
151
|
-
readonly API_KEY_INVALID: "API_KEY_INVALID";
|
|
152
|
-
readonly ORIGIN_NOT_ALLOWED: "ORIGIN_NOT_ALLOWED";
|
|
153
|
-
readonly RATE_LIMITED: "RATE_LIMITED";
|
|
154
|
-
readonly INVALID_CREDENTIALS: "INVALID_CREDENTIALS";
|
|
155
|
-
readonly SIGNUP_FAILED: "SIGNUP_FAILED";
|
|
156
|
-
readonly VALIDATION_FAILED: "VALIDATION_FAILED";
|
|
157
|
-
readonly PERMISSION_DENIED: "PERMISSION_DENIED";
|
|
158
|
-
readonly SCOPE_REVOKED: "SCOPE_REVOKED";
|
|
159
|
-
readonly NOT_FOUND: "NOT_FOUND";
|
|
160
|
-
readonly VERSION_CONFLICT: "VERSION_CONFLICT";
|
|
161
|
-
readonly PRICING_SNAPSHOT_STALE: "PRICING_SNAPSHOT_STALE";
|
|
162
|
-
readonly PAYMENTS_NOT_CONNECTED: "PAYMENTS_NOT_CONNECTED";
|
|
163
|
-
readonly CONNECT_ACCOUNT_RESTRICTED: "CONNECT_ACCOUNT_RESTRICTED";
|
|
164
|
-
readonly CHECKOUT_EXPIRED: "CHECKOUT_EXPIRED";
|
|
165
|
-
readonly NETWORK_ERROR: "NETWORK_ERROR";
|
|
166
|
-
readonly UNKNOWN: "ERROR";
|
|
167
|
-
};
|
|
168
|
-
type BowlosErrorCode = (typeof BOWLOS_ERROR_CODES)[keyof typeof BOWLOS_ERROR_CODES] | (string & {});
|
|
169
|
-
interface BowlosApiErrorOptions {
|
|
170
|
-
retryAfterSeconds?: number;
|
|
171
|
-
cause?: unknown;
|
|
172
|
-
}
|
|
173
|
-
declare class BowlosApiError extends Error {
|
|
174
|
-
/** Stable, machine-readable code. Branch on this, not on `message`. */
|
|
175
|
-
readonly code: BowlosErrorCode;
|
|
176
|
-
/** HTTP status (0 for a network failure before any response). */
|
|
177
|
-
readonly status: number;
|
|
178
|
-
/** Seconds to wait before retrying — present only on `RATE_LIMITED`. */
|
|
179
|
-
readonly retryAfterSeconds?: number;
|
|
180
|
-
constructor(code: BowlosErrorCode, message: string, status: number, options?: BowlosApiErrorOptions);
|
|
181
|
-
/** Too many requests — caller should back off `retryAfterSeconds`. */
|
|
182
|
-
get isRateLimited(): boolean;
|
|
183
|
-
/** Bad/expired login. The session could not be established or has lapsed. */
|
|
184
|
-
get isAuthError(): boolean;
|
|
185
|
-
/** Wrong/missing API key or a disallowed origin — a site-config problem,
|
|
186
|
-
* not something the end customer can fix. */
|
|
187
|
-
get isConfigError(): boolean;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
137
|
/**
|
|
191
138
|
* Typed data surface for @bowlos/reservations — booking-funnel reads.
|
|
192
139
|
*
|
|
@@ -216,6 +163,19 @@ type BookingAddonSelection = {
|
|
|
216
163
|
addonId: string;
|
|
217
164
|
quantity: number;
|
|
218
165
|
};
|
|
166
|
+
/** A bookable add-on for a product (shoe rental, upgrades…). `rateMode` is how
|
|
167
|
+
* it prices — `per_person` (× bowlers), `per_unit` (× lanes), or `flat` (once).
|
|
168
|
+
* `defaultQuantityRule: "one_per_guest"` hints the natural quantity is the
|
|
169
|
+
* party size; `"manual"` means the customer picks. */
|
|
170
|
+
interface PublicAddon {
|
|
171
|
+
id: string;
|
|
172
|
+
displayId: string;
|
|
173
|
+
name: string;
|
|
174
|
+
description: string | null;
|
|
175
|
+
priceCents: number;
|
|
176
|
+
rateMode: "per_person" | "per_unit" | "flat";
|
|
177
|
+
defaultQuantityRule: "one_per_guest" | "manual";
|
|
178
|
+
}
|
|
219
179
|
/** Inputs for `bookingPreview` (the authoritative price quote). */
|
|
220
180
|
type BookingPreviewArgs = {
|
|
221
181
|
centerId: string;
|
|
@@ -246,6 +206,25 @@ declare function checkAvailability(client: BowlosClient, args: AvailabilityArgs)
|
|
|
246
206
|
/** Authoritative price quote for the chosen inputs (anonymous; a signed-in
|
|
247
207
|
* session unlocks member rates + account credit). */
|
|
248
208
|
declare function bookingPreview(client: BowlosClient, args: BookingPreviewArgs): Promise<BookingQuote>;
|
|
209
|
+
/** Add-ons available for a product (shoe rental, upgrades…). Anonymous-callable;
|
|
210
|
+
* feed the customer's picks back as `addons` on the preview + the booking. */
|
|
211
|
+
declare function listAddons(client: BowlosClient, args: {
|
|
212
|
+
productId: string;
|
|
213
|
+
}): Promise<PublicAddon[]>;
|
|
214
|
+
/** Inputs for `availableStartTimes`. */
|
|
215
|
+
type StartTimesArgs = {
|
|
216
|
+
productId: string;
|
|
217
|
+
dateISO: string;
|
|
218
|
+
/** Booking length, to leave room before close. Default 60 on the server. */
|
|
219
|
+
durationMinutes?: number;
|
|
220
|
+
/** Grid step in minutes. Default 30 on the server. */
|
|
221
|
+
stepMinutes?: number;
|
|
222
|
+
mode?: PricingMode;
|
|
223
|
+
};
|
|
224
|
+
/** The bookable start times (minute-of-day, ascending) for a product on a date:
|
|
225
|
+
* within operating hours, past the booking buffer, and backed by a real price
|
|
226
|
+
* plan (same pricing engine the quote uses). Anonymous-callable. */
|
|
227
|
+
declare function listStartTimes(client: BowlosClient, args: StartTimesArgs): Promise<number[]>;
|
|
249
228
|
/** Convenience: free units = total minus the busy set (never negative). */
|
|
250
229
|
declare function availableUnitCount(availability: AvailabilityResult): number;
|
|
251
230
|
/** Customer identity for a booking (collected in the booking form; the server
|
|
@@ -324,4 +303,4 @@ declare function abandonCheckout(client: BowlosClient, refToken: string): Promis
|
|
|
324
303
|
ok: boolean;
|
|
325
304
|
}>;
|
|
326
305
|
|
|
327
|
-
export { type AuthState as A,
|
|
306
|
+
export { type AuthState as A, type BookingAddonSelection as B, type CheckoutStatus as C, localStorageTokenStore as D, type FetchLike as F, type LinkProfile as L, type PaymentIntentInfo as P, type StartTimesArgs as S, type TokenStore as T, type AvailabilityArgs as a, 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 CreateBookingArgs as j, type Customer as k, type PingResult as l, type PricingMode as m, type PublicAddon as n, type Tokens as o, abandonCheckout as p, availableUnitCount as q, bookingPreview as r, checkAvailability as s, createBooking as t, createBowlosClient as u, createCheckoutPaymentIntent as v, generateIdempotencyKey as w, getCheckoutStatus as x, listAddons as y, listStartTimes as z };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error model for the BowlOS Reservations SDK.
|
|
3
|
+
*
|
|
4
|
+
* Every failed gateway call surfaces as a single `BowlosApiError` carrying a
|
|
5
|
+
* stable `code` (string), the HTTP `status`, and — for rate limits — a
|
|
6
|
+
* `retryAfterSeconds`. The gateway normalizes the backend's two error
|
|
7
|
+
* conventions (thrown ConvexError + `{ ok:false }` envelopes) into one JSON
|
|
8
|
+
* shape; this class is the client-side mirror of that shape, so consumers
|
|
9
|
+
* branch on `error.code`, never on message text.
|
|
10
|
+
*/
|
|
11
|
+
/** Stable error codes the gateway / backend can return. Open set — treat
|
|
12
|
+
* `code` as a string and match against these for known cases. */
|
|
13
|
+
declare const BOWLOS_ERROR_CODES: {
|
|
14
|
+
readonly API_KEY_MISSING: "API_KEY_MISSING";
|
|
15
|
+
readonly API_KEY_INVALID: "API_KEY_INVALID";
|
|
16
|
+
readonly ORIGIN_NOT_ALLOWED: "ORIGIN_NOT_ALLOWED";
|
|
17
|
+
readonly RATE_LIMITED: "RATE_LIMITED";
|
|
18
|
+
readonly INVALID_CREDENTIALS: "INVALID_CREDENTIALS";
|
|
19
|
+
readonly SIGNUP_FAILED: "SIGNUP_FAILED";
|
|
20
|
+
readonly VALIDATION_FAILED: "VALIDATION_FAILED";
|
|
21
|
+
readonly PERMISSION_DENIED: "PERMISSION_DENIED";
|
|
22
|
+
readonly SCOPE_REVOKED: "SCOPE_REVOKED";
|
|
23
|
+
readonly NOT_FOUND: "NOT_FOUND";
|
|
24
|
+
readonly VERSION_CONFLICT: "VERSION_CONFLICT";
|
|
25
|
+
readonly PRICING_SNAPSHOT_STALE: "PRICING_SNAPSHOT_STALE";
|
|
26
|
+
readonly PAYMENTS_NOT_CONNECTED: "PAYMENTS_NOT_CONNECTED";
|
|
27
|
+
readonly CONNECT_ACCOUNT_RESTRICTED: "CONNECT_ACCOUNT_RESTRICTED";
|
|
28
|
+
readonly CHECKOUT_EXPIRED: "CHECKOUT_EXPIRED";
|
|
29
|
+
readonly NETWORK_ERROR: "NETWORK_ERROR";
|
|
30
|
+
readonly UNKNOWN: "ERROR";
|
|
31
|
+
};
|
|
32
|
+
type BowlosErrorCode = (typeof BOWLOS_ERROR_CODES)[keyof typeof BOWLOS_ERROR_CODES] | (string & {});
|
|
33
|
+
interface BowlosApiErrorOptions {
|
|
34
|
+
retryAfterSeconds?: number;
|
|
35
|
+
cause?: unknown;
|
|
36
|
+
}
|
|
37
|
+
declare class BowlosApiError extends Error {
|
|
38
|
+
/** Stable, machine-readable code. Branch on this, not on `message`. */
|
|
39
|
+
readonly code: BowlosErrorCode;
|
|
40
|
+
/** HTTP status (0 for a network failure before any response). */
|
|
41
|
+
readonly status: number;
|
|
42
|
+
/** Seconds to wait before retrying — present only on `RATE_LIMITED`. */
|
|
43
|
+
readonly retryAfterSeconds?: number;
|
|
44
|
+
constructor(code: BowlosErrorCode, message: string, status: number, options?: BowlosApiErrorOptions);
|
|
45
|
+
/** Too many requests — caller should back off `retryAfterSeconds`. */
|
|
46
|
+
get isRateLimited(): boolean;
|
|
47
|
+
/** Bad/expired login. The session could not be established or has lapsed. */
|
|
48
|
+
get isAuthError(): boolean;
|
|
49
|
+
/** Wrong/missing API key or a disallowed origin — a site-config problem,
|
|
50
|
+
* not something the end customer can fix. */
|
|
51
|
+
get isConfigError(): boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { BOWLOS_ERROR_CODES as B, BowlosApiError as a, type BowlosApiErrorOptions as b, type BowlosErrorCode as c };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error model for the BowlOS Reservations SDK.
|
|
3
|
+
*
|
|
4
|
+
* Every failed gateway call surfaces as a single `BowlosApiError` carrying a
|
|
5
|
+
* stable `code` (string), the HTTP `status`, and — for rate limits — a
|
|
6
|
+
* `retryAfterSeconds`. The gateway normalizes the backend's two error
|
|
7
|
+
* conventions (thrown ConvexError + `{ ok:false }` envelopes) into one JSON
|
|
8
|
+
* shape; this class is the client-side mirror of that shape, so consumers
|
|
9
|
+
* branch on `error.code`, never on message text.
|
|
10
|
+
*/
|
|
11
|
+
/** Stable error codes the gateway / backend can return. Open set — treat
|
|
12
|
+
* `code` as a string and match against these for known cases. */
|
|
13
|
+
declare const BOWLOS_ERROR_CODES: {
|
|
14
|
+
readonly API_KEY_MISSING: "API_KEY_MISSING";
|
|
15
|
+
readonly API_KEY_INVALID: "API_KEY_INVALID";
|
|
16
|
+
readonly ORIGIN_NOT_ALLOWED: "ORIGIN_NOT_ALLOWED";
|
|
17
|
+
readonly RATE_LIMITED: "RATE_LIMITED";
|
|
18
|
+
readonly INVALID_CREDENTIALS: "INVALID_CREDENTIALS";
|
|
19
|
+
readonly SIGNUP_FAILED: "SIGNUP_FAILED";
|
|
20
|
+
readonly VALIDATION_FAILED: "VALIDATION_FAILED";
|
|
21
|
+
readonly PERMISSION_DENIED: "PERMISSION_DENIED";
|
|
22
|
+
readonly SCOPE_REVOKED: "SCOPE_REVOKED";
|
|
23
|
+
readonly NOT_FOUND: "NOT_FOUND";
|
|
24
|
+
readonly VERSION_CONFLICT: "VERSION_CONFLICT";
|
|
25
|
+
readonly PRICING_SNAPSHOT_STALE: "PRICING_SNAPSHOT_STALE";
|
|
26
|
+
readonly PAYMENTS_NOT_CONNECTED: "PAYMENTS_NOT_CONNECTED";
|
|
27
|
+
readonly CONNECT_ACCOUNT_RESTRICTED: "CONNECT_ACCOUNT_RESTRICTED";
|
|
28
|
+
readonly CHECKOUT_EXPIRED: "CHECKOUT_EXPIRED";
|
|
29
|
+
readonly NETWORK_ERROR: "NETWORK_ERROR";
|
|
30
|
+
readonly UNKNOWN: "ERROR";
|
|
31
|
+
};
|
|
32
|
+
type BowlosErrorCode = (typeof BOWLOS_ERROR_CODES)[keyof typeof BOWLOS_ERROR_CODES] | (string & {});
|
|
33
|
+
interface BowlosApiErrorOptions {
|
|
34
|
+
retryAfterSeconds?: number;
|
|
35
|
+
cause?: unknown;
|
|
36
|
+
}
|
|
37
|
+
declare class BowlosApiError extends Error {
|
|
38
|
+
/** Stable, machine-readable code. Branch on this, not on `message`. */
|
|
39
|
+
readonly code: BowlosErrorCode;
|
|
40
|
+
/** HTTP status (0 for a network failure before any response). */
|
|
41
|
+
readonly status: number;
|
|
42
|
+
/** Seconds to wait before retrying — present only on `RATE_LIMITED`. */
|
|
43
|
+
readonly retryAfterSeconds?: number;
|
|
44
|
+
constructor(code: BowlosErrorCode, message: string, status: number, options?: BowlosApiErrorOptions);
|
|
45
|
+
/** Too many requests — caller should back off `retryAfterSeconds`. */
|
|
46
|
+
get isRateLimited(): boolean;
|
|
47
|
+
/** Bad/expired login. The session could not be established or has lapsed. */
|
|
48
|
+
get isAuthError(): boolean;
|
|
49
|
+
/** Wrong/missing API key or a disallowed origin — a site-config problem,
|
|
50
|
+
* not something the end customer can fix. */
|
|
51
|
+
get isConfigError(): boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { BOWLOS_ERROR_CODES as B, BowlosApiError as a, type BowlosApiErrorOptions as b, type BowlosErrorCode as c };
|
package/dist/index.cjs
CHANGED
|
@@ -460,6 +460,12 @@ function checkAvailability(client, args) {
|
|
|
460
460
|
function bookingPreview(client, args) {
|
|
461
461
|
return client.call("bookingPreview", args);
|
|
462
462
|
}
|
|
463
|
+
function listAddons(client, args) {
|
|
464
|
+
return client.call("listPublicAddons", args);
|
|
465
|
+
}
|
|
466
|
+
function listStartTimes(client, args) {
|
|
467
|
+
return client.call("availableStartTimes", args);
|
|
468
|
+
}
|
|
463
469
|
function availableUnitCount(availability) {
|
|
464
470
|
return Math.max(0, availability.totalUnits - availability.busyUnitIds.length);
|
|
465
471
|
}
|
|
@@ -562,11 +568,13 @@ exports.getMyMemberships = getMyMemberships;
|
|
|
562
568
|
exports.getMyPasses = getMyPasses;
|
|
563
569
|
exports.getMyReservationDetail = getMyReservationDetail;
|
|
564
570
|
exports.getMyReservations = getMyReservations;
|
|
571
|
+
exports.listAddons = listAddons;
|
|
565
572
|
exports.listEvents = listEvents;
|
|
566
573
|
exports.listGameCards = listGameCards;
|
|
567
574
|
exports.listPackages = listPackages;
|
|
568
575
|
exports.listProducts = listProducts;
|
|
569
576
|
exports.listPublicMemberships = listPublicMemberships;
|
|
577
|
+
exports.listStartTimes = listStartTimes;
|
|
570
578
|
exports.localStorageTokenStore = localStorageTokenStore;
|
|
571
579
|
exports.runDoctor = runDoctor;
|
|
572
580
|
//# sourceMappingURL=index.cjs.map
|