@bowlos/reservations 0.1.0 → 0.3.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/README.md +63 -0
- package/dist/account-COEgvwfx.d.cts +43 -0
- package/dist/account-CzyIERC5.d.ts +43 -0
- package/dist/chunk-4VDDL2CN.js +299 -0
- package/dist/chunk-4VDDL2CN.js.map +1 -0
- package/dist/components.cjs +1120 -0
- package/dist/components.cjs.map +1 -0
- package/dist/components.d.cts +353 -0
- package/dist/components.d.ts +353 -0
- package/dist/components.js +765 -0
- package/dist/components.js.map +1 -0
- package/dist/{account-Cl6hElpL.d.cts → data-DrM0D6Pi.d.cts} +1 -41
- package/dist/{account-Cl6hElpL.d.ts → data-DrM0D6Pi.d.ts} +1 -41
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/react-B_8H7AyT.d.cts +43 -0
- package/dist/react-bG9YV_xP.d.ts +43 -0
- package/dist/react.d.cts +7 -42
- package/dist/react.d.ts +7 -42
- package/dist/react.js +3 -297
- package/dist/react.js.map +1 -1
- package/package.json +11 -1
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
3
|
+
import { q as PricingMode, P as PaymentIntentInfo, o as Customer } from './data-DrM0D6Pi.cjs';
|
|
4
|
+
import { c as UseAccountResult } from './react-B_8H7AyT.cjs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Themeable design tokens for the `@bowlos/reservations/components` layer.
|
|
8
|
+
*
|
|
9
|
+
* Override any subset; the rest fall back to neutral, **white-label** defaults
|
|
10
|
+
* (deliberately no BowlOS branding — these render on a center's own site).
|
|
11
|
+
* Tokens are applied as CSS custom properties, so you can theme either with
|
|
12
|
+
* `<BowlosTheme theme={...}>` or by setting the `--bowlos-*` variables yourself
|
|
13
|
+
* in CSS.
|
|
14
|
+
*/
|
|
15
|
+
interface BowlosThemeTokens {
|
|
16
|
+
/** Accent color — buttons, highlights. */
|
|
17
|
+
colorPrimary?: string;
|
|
18
|
+
/** Text/icon color on top of `colorPrimary`. */
|
|
19
|
+
colorPrimaryContrast?: string;
|
|
20
|
+
colorText?: string;
|
|
21
|
+
colorMuted?: string;
|
|
22
|
+
colorBg?: string;
|
|
23
|
+
colorSurface?: string;
|
|
24
|
+
colorBorder?: string;
|
|
25
|
+
colorError?: string;
|
|
26
|
+
colorSuccess?: string;
|
|
27
|
+
/** Corner radius (e.g. "10px", "0.5rem"). */
|
|
28
|
+
radius?: string;
|
|
29
|
+
/** Font family stack. */
|
|
30
|
+
fontFamily?: string;
|
|
31
|
+
}
|
|
32
|
+
/** Neutral, white-label defaults — used as the CSS-var fallbacks, so components
|
|
33
|
+
* look right even with no `<BowlosTheme>` wrapper. */
|
|
34
|
+
declare const BOWLOS_DEFAULT_THEME: Required<BowlosThemeTokens>;
|
|
35
|
+
/**
|
|
36
|
+
* Applies a theme by setting the `--bowlos-*` CSS variables on a wrapper, which
|
|
37
|
+
* the components read. Children inherit them; nest another `<BowlosTheme>` to
|
|
38
|
+
* override per-section. Optional — components fall back to neutral defaults
|
|
39
|
+
* without it.
|
|
40
|
+
*/
|
|
41
|
+
declare function BowlosTheme({ theme, className, style, children, }: {
|
|
42
|
+
theme?: BowlosThemeTokens;
|
|
43
|
+
className?: string;
|
|
44
|
+
style?: CSSProperties;
|
|
45
|
+
children: ReactNode;
|
|
46
|
+
}): react_jsx_runtime.JSX.Element;
|
|
47
|
+
|
|
48
|
+
/** Visible strings — override any subset for copy/i18n. */
|
|
49
|
+
interface BookingFlowLabels {
|
|
50
|
+
heading: string;
|
|
51
|
+
date: string;
|
|
52
|
+
start: string;
|
|
53
|
+
quantity: string;
|
|
54
|
+
name: string;
|
|
55
|
+
email: string;
|
|
56
|
+
hold: string;
|
|
57
|
+
holding: string;
|
|
58
|
+
continueToPayment: string;
|
|
59
|
+
preparing: string;
|
|
60
|
+
cancel: string;
|
|
61
|
+
releaseHold: string;
|
|
62
|
+
heldHeading: string;
|
|
63
|
+
heldBody: string;
|
|
64
|
+
paymentHeading: string;
|
|
65
|
+
confirmedHeading: string;
|
|
66
|
+
confirmationLabel: string;
|
|
67
|
+
bookAnother: string;
|
|
68
|
+
checkingAvailability: string;
|
|
69
|
+
}
|
|
70
|
+
interface BookingFlowProps {
|
|
71
|
+
centerId: string;
|
|
72
|
+
productId: string;
|
|
73
|
+
pricingMode?: PricingMode;
|
|
74
|
+
durationMinutes?: number;
|
|
75
|
+
defaultDateISO?: string;
|
|
76
|
+
defaultStartMinuteOfDay?: number;
|
|
77
|
+
/**
|
|
78
|
+
* Render your Stripe Elements form here. The SDK never loads Stripe.js — it
|
|
79
|
+
* hands you the Connect PaymentIntent; initialize Stripe with
|
|
80
|
+
* `paymentIntent.connectedAccountId` + `paymentIntent.clientSecret`, and call
|
|
81
|
+
* `onPaid()` once `confirmPayment` succeeds (that starts polling for the
|
|
82
|
+
* materialized reservation). Surface failures with `onError(message)`.
|
|
83
|
+
*/
|
|
84
|
+
renderPayment: (ctx: {
|
|
85
|
+
paymentIntent: PaymentIntentInfo;
|
|
86
|
+
amountCents: number;
|
|
87
|
+
onPaid: () => void;
|
|
88
|
+
onError: (message: string) => void;
|
|
89
|
+
}) => ReactNode;
|
|
90
|
+
/** Called once when the reservation is confirmed. */
|
|
91
|
+
onConfirmed?: (reservation: {
|
|
92
|
+
reservationId: string | null;
|
|
93
|
+
reservationDisplayId: string | null;
|
|
94
|
+
}) => void;
|
|
95
|
+
/** Unit noun, e.g. lane/lanes (per_unit) or player/players (per_person). */
|
|
96
|
+
unitLabel?: {
|
|
97
|
+
singular: string;
|
|
98
|
+
plural: string;
|
|
99
|
+
};
|
|
100
|
+
labels?: Partial<BookingFlowLabels>;
|
|
101
|
+
className?: string;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* A complete, themeable booking widget: availability + price → reserve (hold) →
|
|
105
|
+
* pay (your Stripe slot) → confirm. Built on `useBookingFlow`. Must render
|
|
106
|
+
* inside a `<BowlosProvider>`; theme it with `<BowlosTheme>` or `--bowlos-*` CSS
|
|
107
|
+
* vars. White-label by design — no BowlOS branding.
|
|
108
|
+
*/
|
|
109
|
+
declare function BookingFlow({ centerId, productId, pricingMode, durationMinutes, defaultDateISO, defaultStartMinuteOfDay, renderPayment, onConfirmed, unitLabel, labels, className, }: BookingFlowProps): react_jsx_runtime.JSX.Element;
|
|
110
|
+
|
|
111
|
+
/** Visible strings — override any subset for copy/i18n. */
|
|
112
|
+
interface AuthGateLabels {
|
|
113
|
+
signInHeading: string;
|
|
114
|
+
signUpHeading: string;
|
|
115
|
+
linkHeading: string;
|
|
116
|
+
loading: string;
|
|
117
|
+
email: string;
|
|
118
|
+
password: string;
|
|
119
|
+
name: string;
|
|
120
|
+
signIn: string;
|
|
121
|
+
signingIn: string;
|
|
122
|
+
createAccount: string;
|
|
123
|
+
haveAccount: string;
|
|
124
|
+
needAccount: string;
|
|
125
|
+
finishProfile: string;
|
|
126
|
+
saving: string;
|
|
127
|
+
signOut: string;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* The presentational session form — driven by a session controller passed in,
|
|
131
|
+
* so it holds NO `useAccount` of its own. That lets a parent that already owns a
|
|
132
|
+
* session (e.g. `<FlashSale>`) render the form against the *same* instance, so a
|
|
133
|
+
* sign-in flips the parent's status (and triggers its refetch). Renders nothing
|
|
134
|
+
* once linked — the parent decides what to show. Use `<AuthGate>` instead if you
|
|
135
|
+
* just want a self-contained gate.
|
|
136
|
+
*/
|
|
137
|
+
declare function AuthForm({ account, labels, className, }: {
|
|
138
|
+
account: UseAccountResult;
|
|
139
|
+
labels?: Partial<AuthGateLabels>;
|
|
140
|
+
className?: string;
|
|
141
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
142
|
+
/** The linked-customer context handed to `<AuthGate>`'s `children`. */
|
|
143
|
+
interface AuthGateRenderContext {
|
|
144
|
+
customer: Customer;
|
|
145
|
+
account: UseAccountResult;
|
|
146
|
+
}
|
|
147
|
+
interface AuthGateProps {
|
|
148
|
+
/**
|
|
149
|
+
* Rendered once a customer is signed in + linked. Receives the customer and
|
|
150
|
+
* the full account controller (so you can wire your own "sign out", etc.).
|
|
151
|
+
* Optional — omit to use `<AuthGate>` purely as a sign-in panel.
|
|
152
|
+
*/
|
|
153
|
+
children?: (ctx: AuthGateRenderContext) => ReactNode;
|
|
154
|
+
labels?: Partial<AuthGateLabels>;
|
|
155
|
+
className?: string;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Self-contained themed session gate: owns one `useAccount`, shows the sign-in /
|
|
159
|
+
* create-account / finish-profile form when signed out, then renders
|
|
160
|
+
* `children(customer)` once linked. Must render inside a `<BowlosProvider>`;
|
|
161
|
+
* theme with `<BowlosTheme>` or the `--bowlos-*` CSS vars. White-label — no
|
|
162
|
+
* BowlOS branding.
|
|
163
|
+
*/
|
|
164
|
+
declare function AuthGate({ children, labels, className }: AuthGateProps): react_jsx_runtime.JSX.Element;
|
|
165
|
+
|
|
166
|
+
interface MyReservationSummary {
|
|
167
|
+
id: string;
|
|
168
|
+
displayId: string;
|
|
169
|
+
status: string;
|
|
170
|
+
centerId: string;
|
|
171
|
+
dateISO: string;
|
|
172
|
+
startMinuteOfDay: number;
|
|
173
|
+
endMinuteOfDay: number;
|
|
174
|
+
finalCents: number;
|
|
175
|
+
paidCents: number;
|
|
176
|
+
balanceDue: boolean;
|
|
177
|
+
sourceChannel: string;
|
|
178
|
+
createdAt: number;
|
|
179
|
+
}
|
|
180
|
+
interface MyMembershipSummary {
|
|
181
|
+
id: string;
|
|
182
|
+
displayId: string;
|
|
183
|
+
status: string;
|
|
184
|
+
currentPeriodEndsAt: string | number;
|
|
185
|
+
templateName: string;
|
|
186
|
+
templateType: string;
|
|
187
|
+
recurringPriceCents: number;
|
|
188
|
+
recurringCadence: string;
|
|
189
|
+
autoRenews: boolean;
|
|
190
|
+
}
|
|
191
|
+
interface MyLoyalty {
|
|
192
|
+
currentTierName: string | null;
|
|
193
|
+
nextTierName: string | null;
|
|
194
|
+
yearPoints: number;
|
|
195
|
+
pointsToNextTier: number;
|
|
196
|
+
qualificationYear: number;
|
|
197
|
+
}
|
|
198
|
+
interface MyCreditEntry {
|
|
199
|
+
id: string;
|
|
200
|
+
displayId: string;
|
|
201
|
+
entryType: string;
|
|
202
|
+
amountCents: number;
|
|
203
|
+
note: string;
|
|
204
|
+
createdAt: number;
|
|
205
|
+
}
|
|
206
|
+
interface MyCredits {
|
|
207
|
+
balanceCents: number;
|
|
208
|
+
ledger: MyCreditEntry[];
|
|
209
|
+
}
|
|
210
|
+
interface MyPass {
|
|
211
|
+
id: string;
|
|
212
|
+
displayId: string;
|
|
213
|
+
kind: string;
|
|
214
|
+
state: string;
|
|
215
|
+
generation: number;
|
|
216
|
+
}
|
|
217
|
+
interface AccountDashboardLabels {
|
|
218
|
+
welcome: string;
|
|
219
|
+
signOut: string;
|
|
220
|
+
reservations: string;
|
|
221
|
+
memberships: string;
|
|
222
|
+
loyalty: string;
|
|
223
|
+
credits: string;
|
|
224
|
+
passes: string;
|
|
225
|
+
loading: string;
|
|
226
|
+
loadError: string;
|
|
227
|
+
noReservations: string;
|
|
228
|
+
noMemberships: string;
|
|
229
|
+
noCredits: string;
|
|
230
|
+
noPasses: string;
|
|
231
|
+
balance: string;
|
|
232
|
+
pointsSuffix: string;
|
|
233
|
+
toNextTier: string;
|
|
234
|
+
noTier: string;
|
|
235
|
+
renews: string;
|
|
236
|
+
autoRenews: string;
|
|
237
|
+
balanceDue: string;
|
|
238
|
+
}
|
|
239
|
+
type AccountSection = "reservations" | "memberships" | "loyalty" | "credits" | "passes";
|
|
240
|
+
interface AccountDashboardProps {
|
|
241
|
+
/** The Brand this site belongs to (account reads are Brand-scoped). */
|
|
242
|
+
brandId: string;
|
|
243
|
+
/** Which sections to show, in order. Defaults to all five. */
|
|
244
|
+
sections?: AccountSection[];
|
|
245
|
+
labels?: Partial<AccountDashboardLabels & AuthGateLabels>;
|
|
246
|
+
className?: string;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* A complete, themeable account page: signs the customer in (via `<AuthGate>`),
|
|
250
|
+
* then shows their reservations, memberships, loyalty, account credit, and
|
|
251
|
+
* passes. Must render inside a `<BowlosProvider>`; theme with `<BowlosTheme>` or
|
|
252
|
+
* the `--bowlos-*` CSS vars. White-label by design — no BowlOS branding.
|
|
253
|
+
*/
|
|
254
|
+
declare function AccountDashboard({ brandId, sections, labels, className }: AccountDashboardProps): react_jsx_runtime.JSX.Element;
|
|
255
|
+
|
|
256
|
+
interface FlashBrand {
|
|
257
|
+
name: string;
|
|
258
|
+
primaryColor: string | null;
|
|
259
|
+
logoUrl: string | null;
|
|
260
|
+
bannerImageUrl: string | null;
|
|
261
|
+
}
|
|
262
|
+
/** A flash item once prices are unlocked (member view). `onBook` receives this. */
|
|
263
|
+
interface FlashSaleItem {
|
|
264
|
+
id: string;
|
|
265
|
+
name: string;
|
|
266
|
+
itemType: string;
|
|
267
|
+
regularPriceCents: number;
|
|
268
|
+
salePriceCents: number;
|
|
269
|
+
/** Top of the per-date range; equals `salePriceCents` for flat-priced items. */
|
|
270
|
+
salePriceMaxCents: number;
|
|
271
|
+
}
|
|
272
|
+
interface LockedItem {
|
|
273
|
+
id: string;
|
|
274
|
+
name: string;
|
|
275
|
+
itemType: string;
|
|
276
|
+
regularPriceCents: number;
|
|
277
|
+
}
|
|
278
|
+
type FlashSaleView = {
|
|
279
|
+
kind: "closed";
|
|
280
|
+
brand: FlashBrand;
|
|
281
|
+
displayName: string;
|
|
282
|
+
description: string;
|
|
283
|
+
slug: string;
|
|
284
|
+
} | {
|
|
285
|
+
kind: "live_locked";
|
|
286
|
+
brand: FlashBrand;
|
|
287
|
+
displayName: string;
|
|
288
|
+
description: string;
|
|
289
|
+
slug: string;
|
|
290
|
+
windowStartAt: number;
|
|
291
|
+
windowEndAt: number;
|
|
292
|
+
preloginMessage: string | null;
|
|
293
|
+
items: LockedItem[];
|
|
294
|
+
} | {
|
|
295
|
+
kind: "live";
|
|
296
|
+
brand: FlashBrand;
|
|
297
|
+
signedInAs: string;
|
|
298
|
+
displayName: string;
|
|
299
|
+
description: string;
|
|
300
|
+
slug: string;
|
|
301
|
+
windowStartAt: number;
|
|
302
|
+
windowEndAt: number;
|
|
303
|
+
loyaltyDiscountEnabled: boolean;
|
|
304
|
+
items: FlashSaleItem[];
|
|
305
|
+
};
|
|
306
|
+
interface FlashSaleLabels {
|
|
307
|
+
loading: string;
|
|
308
|
+
unavailable: string;
|
|
309
|
+
ended: string;
|
|
310
|
+
endsIn: string;
|
|
311
|
+
lockedPrice: string;
|
|
312
|
+
signInPrompt: string;
|
|
313
|
+
book: string;
|
|
314
|
+
saleEnded: string;
|
|
315
|
+
}
|
|
316
|
+
interface FlashSaleProps {
|
|
317
|
+
/** The globally-unique flash-sale slug (from the share link). */
|
|
318
|
+
slug: string;
|
|
319
|
+
/**
|
|
320
|
+
* Called when a signed-in member books an item. Hand off to your booking flow
|
|
321
|
+
* at the sale price (e.g. route to a `<BookingFlow>` page carrying the item).
|
|
322
|
+
* Omit to hide the Book buttons (display-only).
|
|
323
|
+
*/
|
|
324
|
+
onBook?: (item: FlashSaleItem) => void;
|
|
325
|
+
labels?: Partial<FlashSaleLabels & AuthGateLabels>;
|
|
326
|
+
className?: string;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* The branded, themeable flash-sale page. Anonymous visitors see the brand,
|
|
330
|
+
* countdown, the operator's pre-login message, and item names with prices
|
|
331
|
+
* **locked** — then a sign-in form (sale prices are member-only, enforced
|
|
332
|
+
* server-side). Once a customer of the Brand signs in, prices unlock and each
|
|
333
|
+
* item gets a Book button (handed off via `onBook`). Must render inside a
|
|
334
|
+
* `<BowlosProvider>`; theme with `<BowlosTheme>` / `--bowlos-*` vars.
|
|
335
|
+
*/
|
|
336
|
+
declare function FlashSale({ slug, onBook, labels, className }: FlashSaleProps): react_jsx_runtime.JSX.Element;
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Shared primitives for the `@bowlos/reservations/components` layer.
|
|
340
|
+
*
|
|
341
|
+
* One canonical set of themed style atoms + formatters, consumed by every
|
|
342
|
+
* component (booking, account, flash) so there's a single source of truth for
|
|
343
|
+
* the look — no per-surface copies. All visuals read the `--bowlos-*` CSS vars
|
|
344
|
+
* via `token()`, so a `<BowlosTheme>` (or raw CSS) restyles every component at
|
|
345
|
+
* once. White-label by design — neutral defaults, no BowlOS branding.
|
|
346
|
+
*/
|
|
347
|
+
|
|
348
|
+
/** Format integer cents as USD. */
|
|
349
|
+
declare function formatCents(cents: number): string;
|
|
350
|
+
/** A min–max money range, collapsing to one value when they're equal. */
|
|
351
|
+
declare function formatCentsRange(minCents: number, maxCents: number): string;
|
|
352
|
+
|
|
353
|
+
export { AccountDashboard, type AccountDashboardLabels, type AccountDashboardProps, type AccountSection, AuthForm, AuthGate, type AuthGateLabels, type AuthGateProps, type AuthGateRenderContext, BOWLOS_DEFAULT_THEME, BookingFlow, type BookingFlowLabels, type BookingFlowProps, BowlosTheme, type BowlosThemeTokens, type FlashBrand, FlashSale, type FlashSaleItem, type FlashSaleLabels, type FlashSaleProps, type FlashSaleView, type MyCreditEntry, type MyCredits, type MyLoyalty, type MyMembershipSummary, type MyPass, type MyReservationSummary, formatCents, formatCentsRange };
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
3
|
+
import { q as PricingMode, P as PaymentIntentInfo, o as Customer } from './data-DrM0D6Pi.js';
|
|
4
|
+
import { c as UseAccountResult } from './react-bG9YV_xP.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Themeable design tokens for the `@bowlos/reservations/components` layer.
|
|
8
|
+
*
|
|
9
|
+
* Override any subset; the rest fall back to neutral, **white-label** defaults
|
|
10
|
+
* (deliberately no BowlOS branding — these render on a center's own site).
|
|
11
|
+
* Tokens are applied as CSS custom properties, so you can theme either with
|
|
12
|
+
* `<BowlosTheme theme={...}>` or by setting the `--bowlos-*` variables yourself
|
|
13
|
+
* in CSS.
|
|
14
|
+
*/
|
|
15
|
+
interface BowlosThemeTokens {
|
|
16
|
+
/** Accent color — buttons, highlights. */
|
|
17
|
+
colorPrimary?: string;
|
|
18
|
+
/** Text/icon color on top of `colorPrimary`. */
|
|
19
|
+
colorPrimaryContrast?: string;
|
|
20
|
+
colorText?: string;
|
|
21
|
+
colorMuted?: string;
|
|
22
|
+
colorBg?: string;
|
|
23
|
+
colorSurface?: string;
|
|
24
|
+
colorBorder?: string;
|
|
25
|
+
colorError?: string;
|
|
26
|
+
colorSuccess?: string;
|
|
27
|
+
/** Corner radius (e.g. "10px", "0.5rem"). */
|
|
28
|
+
radius?: string;
|
|
29
|
+
/** Font family stack. */
|
|
30
|
+
fontFamily?: string;
|
|
31
|
+
}
|
|
32
|
+
/** Neutral, white-label defaults — used as the CSS-var fallbacks, so components
|
|
33
|
+
* look right even with no `<BowlosTheme>` wrapper. */
|
|
34
|
+
declare const BOWLOS_DEFAULT_THEME: Required<BowlosThemeTokens>;
|
|
35
|
+
/**
|
|
36
|
+
* Applies a theme by setting the `--bowlos-*` CSS variables on a wrapper, which
|
|
37
|
+
* the components read. Children inherit them; nest another `<BowlosTheme>` to
|
|
38
|
+
* override per-section. Optional — components fall back to neutral defaults
|
|
39
|
+
* without it.
|
|
40
|
+
*/
|
|
41
|
+
declare function BowlosTheme({ theme, className, style, children, }: {
|
|
42
|
+
theme?: BowlosThemeTokens;
|
|
43
|
+
className?: string;
|
|
44
|
+
style?: CSSProperties;
|
|
45
|
+
children: ReactNode;
|
|
46
|
+
}): react_jsx_runtime.JSX.Element;
|
|
47
|
+
|
|
48
|
+
/** Visible strings — override any subset for copy/i18n. */
|
|
49
|
+
interface BookingFlowLabels {
|
|
50
|
+
heading: string;
|
|
51
|
+
date: string;
|
|
52
|
+
start: string;
|
|
53
|
+
quantity: string;
|
|
54
|
+
name: string;
|
|
55
|
+
email: string;
|
|
56
|
+
hold: string;
|
|
57
|
+
holding: string;
|
|
58
|
+
continueToPayment: string;
|
|
59
|
+
preparing: string;
|
|
60
|
+
cancel: string;
|
|
61
|
+
releaseHold: string;
|
|
62
|
+
heldHeading: string;
|
|
63
|
+
heldBody: string;
|
|
64
|
+
paymentHeading: string;
|
|
65
|
+
confirmedHeading: string;
|
|
66
|
+
confirmationLabel: string;
|
|
67
|
+
bookAnother: string;
|
|
68
|
+
checkingAvailability: string;
|
|
69
|
+
}
|
|
70
|
+
interface BookingFlowProps {
|
|
71
|
+
centerId: string;
|
|
72
|
+
productId: string;
|
|
73
|
+
pricingMode?: PricingMode;
|
|
74
|
+
durationMinutes?: number;
|
|
75
|
+
defaultDateISO?: string;
|
|
76
|
+
defaultStartMinuteOfDay?: number;
|
|
77
|
+
/**
|
|
78
|
+
* Render your Stripe Elements form here. The SDK never loads Stripe.js — it
|
|
79
|
+
* hands you the Connect PaymentIntent; initialize Stripe with
|
|
80
|
+
* `paymentIntent.connectedAccountId` + `paymentIntent.clientSecret`, and call
|
|
81
|
+
* `onPaid()` once `confirmPayment` succeeds (that starts polling for the
|
|
82
|
+
* materialized reservation). Surface failures with `onError(message)`.
|
|
83
|
+
*/
|
|
84
|
+
renderPayment: (ctx: {
|
|
85
|
+
paymentIntent: PaymentIntentInfo;
|
|
86
|
+
amountCents: number;
|
|
87
|
+
onPaid: () => void;
|
|
88
|
+
onError: (message: string) => void;
|
|
89
|
+
}) => ReactNode;
|
|
90
|
+
/** Called once when the reservation is confirmed. */
|
|
91
|
+
onConfirmed?: (reservation: {
|
|
92
|
+
reservationId: string | null;
|
|
93
|
+
reservationDisplayId: string | null;
|
|
94
|
+
}) => void;
|
|
95
|
+
/** Unit noun, e.g. lane/lanes (per_unit) or player/players (per_person). */
|
|
96
|
+
unitLabel?: {
|
|
97
|
+
singular: string;
|
|
98
|
+
plural: string;
|
|
99
|
+
};
|
|
100
|
+
labels?: Partial<BookingFlowLabels>;
|
|
101
|
+
className?: string;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* A complete, themeable booking widget: availability + price → reserve (hold) →
|
|
105
|
+
* pay (your Stripe slot) → confirm. Built on `useBookingFlow`. Must render
|
|
106
|
+
* inside a `<BowlosProvider>`; theme it with `<BowlosTheme>` or `--bowlos-*` CSS
|
|
107
|
+
* vars. White-label by design — no BowlOS branding.
|
|
108
|
+
*/
|
|
109
|
+
declare function BookingFlow({ centerId, productId, pricingMode, durationMinutes, defaultDateISO, defaultStartMinuteOfDay, renderPayment, onConfirmed, unitLabel, labels, className, }: BookingFlowProps): react_jsx_runtime.JSX.Element;
|
|
110
|
+
|
|
111
|
+
/** Visible strings — override any subset for copy/i18n. */
|
|
112
|
+
interface AuthGateLabels {
|
|
113
|
+
signInHeading: string;
|
|
114
|
+
signUpHeading: string;
|
|
115
|
+
linkHeading: string;
|
|
116
|
+
loading: string;
|
|
117
|
+
email: string;
|
|
118
|
+
password: string;
|
|
119
|
+
name: string;
|
|
120
|
+
signIn: string;
|
|
121
|
+
signingIn: string;
|
|
122
|
+
createAccount: string;
|
|
123
|
+
haveAccount: string;
|
|
124
|
+
needAccount: string;
|
|
125
|
+
finishProfile: string;
|
|
126
|
+
saving: string;
|
|
127
|
+
signOut: string;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* The presentational session form — driven by a session controller passed in,
|
|
131
|
+
* so it holds NO `useAccount` of its own. That lets a parent that already owns a
|
|
132
|
+
* session (e.g. `<FlashSale>`) render the form against the *same* instance, so a
|
|
133
|
+
* sign-in flips the parent's status (and triggers its refetch). Renders nothing
|
|
134
|
+
* once linked — the parent decides what to show. Use `<AuthGate>` instead if you
|
|
135
|
+
* just want a self-contained gate.
|
|
136
|
+
*/
|
|
137
|
+
declare function AuthForm({ account, labels, className, }: {
|
|
138
|
+
account: UseAccountResult;
|
|
139
|
+
labels?: Partial<AuthGateLabels>;
|
|
140
|
+
className?: string;
|
|
141
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
142
|
+
/** The linked-customer context handed to `<AuthGate>`'s `children`. */
|
|
143
|
+
interface AuthGateRenderContext {
|
|
144
|
+
customer: Customer;
|
|
145
|
+
account: UseAccountResult;
|
|
146
|
+
}
|
|
147
|
+
interface AuthGateProps {
|
|
148
|
+
/**
|
|
149
|
+
* Rendered once a customer is signed in + linked. Receives the customer and
|
|
150
|
+
* the full account controller (so you can wire your own "sign out", etc.).
|
|
151
|
+
* Optional — omit to use `<AuthGate>` purely as a sign-in panel.
|
|
152
|
+
*/
|
|
153
|
+
children?: (ctx: AuthGateRenderContext) => ReactNode;
|
|
154
|
+
labels?: Partial<AuthGateLabels>;
|
|
155
|
+
className?: string;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Self-contained themed session gate: owns one `useAccount`, shows the sign-in /
|
|
159
|
+
* create-account / finish-profile form when signed out, then renders
|
|
160
|
+
* `children(customer)` once linked. Must render inside a `<BowlosProvider>`;
|
|
161
|
+
* theme with `<BowlosTheme>` or the `--bowlos-*` CSS vars. White-label — no
|
|
162
|
+
* BowlOS branding.
|
|
163
|
+
*/
|
|
164
|
+
declare function AuthGate({ children, labels, className }: AuthGateProps): react_jsx_runtime.JSX.Element;
|
|
165
|
+
|
|
166
|
+
interface MyReservationSummary {
|
|
167
|
+
id: string;
|
|
168
|
+
displayId: string;
|
|
169
|
+
status: string;
|
|
170
|
+
centerId: string;
|
|
171
|
+
dateISO: string;
|
|
172
|
+
startMinuteOfDay: number;
|
|
173
|
+
endMinuteOfDay: number;
|
|
174
|
+
finalCents: number;
|
|
175
|
+
paidCents: number;
|
|
176
|
+
balanceDue: boolean;
|
|
177
|
+
sourceChannel: string;
|
|
178
|
+
createdAt: number;
|
|
179
|
+
}
|
|
180
|
+
interface MyMembershipSummary {
|
|
181
|
+
id: string;
|
|
182
|
+
displayId: string;
|
|
183
|
+
status: string;
|
|
184
|
+
currentPeriodEndsAt: string | number;
|
|
185
|
+
templateName: string;
|
|
186
|
+
templateType: string;
|
|
187
|
+
recurringPriceCents: number;
|
|
188
|
+
recurringCadence: string;
|
|
189
|
+
autoRenews: boolean;
|
|
190
|
+
}
|
|
191
|
+
interface MyLoyalty {
|
|
192
|
+
currentTierName: string | null;
|
|
193
|
+
nextTierName: string | null;
|
|
194
|
+
yearPoints: number;
|
|
195
|
+
pointsToNextTier: number;
|
|
196
|
+
qualificationYear: number;
|
|
197
|
+
}
|
|
198
|
+
interface MyCreditEntry {
|
|
199
|
+
id: string;
|
|
200
|
+
displayId: string;
|
|
201
|
+
entryType: string;
|
|
202
|
+
amountCents: number;
|
|
203
|
+
note: string;
|
|
204
|
+
createdAt: number;
|
|
205
|
+
}
|
|
206
|
+
interface MyCredits {
|
|
207
|
+
balanceCents: number;
|
|
208
|
+
ledger: MyCreditEntry[];
|
|
209
|
+
}
|
|
210
|
+
interface MyPass {
|
|
211
|
+
id: string;
|
|
212
|
+
displayId: string;
|
|
213
|
+
kind: string;
|
|
214
|
+
state: string;
|
|
215
|
+
generation: number;
|
|
216
|
+
}
|
|
217
|
+
interface AccountDashboardLabels {
|
|
218
|
+
welcome: string;
|
|
219
|
+
signOut: string;
|
|
220
|
+
reservations: string;
|
|
221
|
+
memberships: string;
|
|
222
|
+
loyalty: string;
|
|
223
|
+
credits: string;
|
|
224
|
+
passes: string;
|
|
225
|
+
loading: string;
|
|
226
|
+
loadError: string;
|
|
227
|
+
noReservations: string;
|
|
228
|
+
noMemberships: string;
|
|
229
|
+
noCredits: string;
|
|
230
|
+
noPasses: string;
|
|
231
|
+
balance: string;
|
|
232
|
+
pointsSuffix: string;
|
|
233
|
+
toNextTier: string;
|
|
234
|
+
noTier: string;
|
|
235
|
+
renews: string;
|
|
236
|
+
autoRenews: string;
|
|
237
|
+
balanceDue: string;
|
|
238
|
+
}
|
|
239
|
+
type AccountSection = "reservations" | "memberships" | "loyalty" | "credits" | "passes";
|
|
240
|
+
interface AccountDashboardProps {
|
|
241
|
+
/** The Brand this site belongs to (account reads are Brand-scoped). */
|
|
242
|
+
brandId: string;
|
|
243
|
+
/** Which sections to show, in order. Defaults to all five. */
|
|
244
|
+
sections?: AccountSection[];
|
|
245
|
+
labels?: Partial<AccountDashboardLabels & AuthGateLabels>;
|
|
246
|
+
className?: string;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* A complete, themeable account page: signs the customer in (via `<AuthGate>`),
|
|
250
|
+
* then shows their reservations, memberships, loyalty, account credit, and
|
|
251
|
+
* passes. Must render inside a `<BowlosProvider>`; theme with `<BowlosTheme>` or
|
|
252
|
+
* the `--bowlos-*` CSS vars. White-label by design — no BowlOS branding.
|
|
253
|
+
*/
|
|
254
|
+
declare function AccountDashboard({ brandId, sections, labels, className }: AccountDashboardProps): react_jsx_runtime.JSX.Element;
|
|
255
|
+
|
|
256
|
+
interface FlashBrand {
|
|
257
|
+
name: string;
|
|
258
|
+
primaryColor: string | null;
|
|
259
|
+
logoUrl: string | null;
|
|
260
|
+
bannerImageUrl: string | null;
|
|
261
|
+
}
|
|
262
|
+
/** A flash item once prices are unlocked (member view). `onBook` receives this. */
|
|
263
|
+
interface FlashSaleItem {
|
|
264
|
+
id: string;
|
|
265
|
+
name: string;
|
|
266
|
+
itemType: string;
|
|
267
|
+
regularPriceCents: number;
|
|
268
|
+
salePriceCents: number;
|
|
269
|
+
/** Top of the per-date range; equals `salePriceCents` for flat-priced items. */
|
|
270
|
+
salePriceMaxCents: number;
|
|
271
|
+
}
|
|
272
|
+
interface LockedItem {
|
|
273
|
+
id: string;
|
|
274
|
+
name: string;
|
|
275
|
+
itemType: string;
|
|
276
|
+
regularPriceCents: number;
|
|
277
|
+
}
|
|
278
|
+
type FlashSaleView = {
|
|
279
|
+
kind: "closed";
|
|
280
|
+
brand: FlashBrand;
|
|
281
|
+
displayName: string;
|
|
282
|
+
description: string;
|
|
283
|
+
slug: string;
|
|
284
|
+
} | {
|
|
285
|
+
kind: "live_locked";
|
|
286
|
+
brand: FlashBrand;
|
|
287
|
+
displayName: string;
|
|
288
|
+
description: string;
|
|
289
|
+
slug: string;
|
|
290
|
+
windowStartAt: number;
|
|
291
|
+
windowEndAt: number;
|
|
292
|
+
preloginMessage: string | null;
|
|
293
|
+
items: LockedItem[];
|
|
294
|
+
} | {
|
|
295
|
+
kind: "live";
|
|
296
|
+
brand: FlashBrand;
|
|
297
|
+
signedInAs: string;
|
|
298
|
+
displayName: string;
|
|
299
|
+
description: string;
|
|
300
|
+
slug: string;
|
|
301
|
+
windowStartAt: number;
|
|
302
|
+
windowEndAt: number;
|
|
303
|
+
loyaltyDiscountEnabled: boolean;
|
|
304
|
+
items: FlashSaleItem[];
|
|
305
|
+
};
|
|
306
|
+
interface FlashSaleLabels {
|
|
307
|
+
loading: string;
|
|
308
|
+
unavailable: string;
|
|
309
|
+
ended: string;
|
|
310
|
+
endsIn: string;
|
|
311
|
+
lockedPrice: string;
|
|
312
|
+
signInPrompt: string;
|
|
313
|
+
book: string;
|
|
314
|
+
saleEnded: string;
|
|
315
|
+
}
|
|
316
|
+
interface FlashSaleProps {
|
|
317
|
+
/** The globally-unique flash-sale slug (from the share link). */
|
|
318
|
+
slug: string;
|
|
319
|
+
/**
|
|
320
|
+
* Called when a signed-in member books an item. Hand off to your booking flow
|
|
321
|
+
* at the sale price (e.g. route to a `<BookingFlow>` page carrying the item).
|
|
322
|
+
* Omit to hide the Book buttons (display-only).
|
|
323
|
+
*/
|
|
324
|
+
onBook?: (item: FlashSaleItem) => void;
|
|
325
|
+
labels?: Partial<FlashSaleLabels & AuthGateLabels>;
|
|
326
|
+
className?: string;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* The branded, themeable flash-sale page. Anonymous visitors see the brand,
|
|
330
|
+
* countdown, the operator's pre-login message, and item names with prices
|
|
331
|
+
* **locked** — then a sign-in form (sale prices are member-only, enforced
|
|
332
|
+
* server-side). Once a customer of the Brand signs in, prices unlock and each
|
|
333
|
+
* item gets a Book button (handed off via `onBook`). Must render inside a
|
|
334
|
+
* `<BowlosProvider>`; theme with `<BowlosTheme>` / `--bowlos-*` vars.
|
|
335
|
+
*/
|
|
336
|
+
declare function FlashSale({ slug, onBook, labels, className }: FlashSaleProps): react_jsx_runtime.JSX.Element;
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Shared primitives for the `@bowlos/reservations/components` layer.
|
|
340
|
+
*
|
|
341
|
+
* One canonical set of themed style atoms + formatters, consumed by every
|
|
342
|
+
* component (booking, account, flash) so there's a single source of truth for
|
|
343
|
+
* the look — no per-surface copies. All visuals read the `--bowlos-*` CSS vars
|
|
344
|
+
* via `token()`, so a `<BowlosTheme>` (or raw CSS) restyles every component at
|
|
345
|
+
* once. White-label by design — neutral defaults, no BowlOS branding.
|
|
346
|
+
*/
|
|
347
|
+
|
|
348
|
+
/** Format integer cents as USD. */
|
|
349
|
+
declare function formatCents(cents: number): string;
|
|
350
|
+
/** A min–max money range, collapsing to one value when they're equal. */
|
|
351
|
+
declare function formatCentsRange(minCents: number, maxCents: number): string;
|
|
352
|
+
|
|
353
|
+
export { AccountDashboard, type AccountDashboardLabels, type AccountDashboardProps, type AccountSection, AuthForm, AuthGate, type AuthGateLabels, type AuthGateProps, type AuthGateRenderContext, BOWLOS_DEFAULT_THEME, BookingFlow, type BookingFlowLabels, type BookingFlowProps, BowlosTheme, type BowlosThemeTokens, type FlashBrand, FlashSale, type FlashSaleItem, type FlashSaleLabels, type FlashSaleProps, type FlashSaleView, type MyCreditEntry, type MyCredits, type MyLoyalty, type MyMembershipSummary, type MyPass, type MyReservationSummary, formatCents, formatCentsRange };
|