@bowlos/reservations 0.4.0 → 0.6.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 +25 -7
- package/dist/{account-COEgvwfx.d.cts → account-BRapzoNI.d.cts} +4 -1
- package/dist/{account-CzyIERC5.d.ts → account-VO6BzPNK.d.ts} +4 -1
- package/dist/{chunk-NYTGLAQH.js → chunk-H42X4FRR.js} +19 -8
- package/dist/chunk-H42X4FRR.js.map +1 -0
- package/dist/{chunk-QGTGKNJW.js → chunk-YICHFUAY.js} +41 -11
- package/dist/chunk-YICHFUAY.js.map +1 -0
- package/dist/components.cjs +144 -60
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +84 -7
- package/dist/components.d.ts +84 -7
- package/dist/components.js +136 -21
- package/dist/components.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +172 -4
- package/dist/index.js.map +1 -1
- package/dist/{react-B_8H7AyT.d.cts → react-7ruEsubp.d.cts} +5 -2
- package/dist/{react-bG9YV_xP.d.ts → react-Cb_NZCXa.d.ts} +5 -2
- package/dist/react.cjs +16 -3
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +6 -4
- package/dist/react.d.ts +6 -4
- package/dist/react.js +2 -3
- package/package.json +1 -1
- package/templates/center-site/app/book/page.tsx +55 -28
- package/templates/center-site/app/flash/page.tsx +18 -0
- package/templates/center-site/app/layout.tsx +5 -1
- package/templates/center-site/app/providers.tsx +26 -4
- package/templates/center-site/app/site-header.tsx +31 -0
- package/templates/center-site/env.example +10 -5
- package/templates/center-site/lib/bowlos.ts +13 -5
- package/templates/center-site/package.json +1 -1
- package/dist/chunk-2RMK6BWO.js +0 -41
- package/dist/chunk-2RMK6BWO.js.map +0 -1
- package/dist/chunk-4FL2QYSS.js +0 -174
- package/dist/chunk-4FL2QYSS.js.map +0 -1
- package/dist/chunk-NYTGLAQH.js.map +0 -1
- package/dist/chunk-QGTGKNJW.js.map +0 -1
- package/dist/cli.d.cts +0 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -176
- package/dist/cli.js.map +0 -1
package/dist/components.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { CSSProperties, ReactNode } from 'react';
|
|
3
3
|
import { q as PricingMode, P as PaymentIntentInfo, o as Customer } from './data-DrM0D6Pi.cjs';
|
|
4
|
-
import { c as UseAccountResult } from './react-
|
|
4
|
+
import { c as UseAccountResult } from './react-7ruEsubp.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Themeable design tokens for the `@bowlos/reservations/components` layer.
|
|
@@ -61,11 +61,15 @@ interface BookingFlowLabels {
|
|
|
61
61
|
releaseHold: string;
|
|
62
62
|
heldHeading: string;
|
|
63
63
|
heldBody: string;
|
|
64
|
+
securing: string;
|
|
64
65
|
paymentHeading: string;
|
|
65
66
|
confirmedHeading: string;
|
|
66
67
|
confirmationLabel: string;
|
|
67
68
|
bookAnother: string;
|
|
68
69
|
checkingAvailability: string;
|
|
70
|
+
bookingAs: string;
|
|
71
|
+
notYou: string;
|
|
72
|
+
signInHint: string;
|
|
69
73
|
}
|
|
70
74
|
interface BookingFlowProps {
|
|
71
75
|
centerId: string;
|
|
@@ -97,16 +101,26 @@ interface BookingFlowProps {
|
|
|
97
101
|
singular: string;
|
|
98
102
|
plural: string;
|
|
99
103
|
};
|
|
104
|
+
/**
|
|
105
|
+
* Online reservations are pay-to-confirm: after the customer books, the hold
|
|
106
|
+
* advances straight to payment with no "you've placed a hold" intermission
|
|
107
|
+
* (the inventory hold stays internal and just expires if they bail). Default
|
|
108
|
+
* `true`. Set `false` to expose the explicit "Reserve → Continue to payment"
|
|
109
|
+
* two-step instead.
|
|
110
|
+
*/
|
|
111
|
+
completeSaleOnly?: boolean;
|
|
112
|
+
/** Where the "Not you?" / "Sign in" links go (e.g. "/account"). */
|
|
113
|
+
accountHref?: string;
|
|
100
114
|
labels?: Partial<BookingFlowLabels>;
|
|
101
115
|
className?: string;
|
|
102
116
|
}
|
|
103
117
|
/**
|
|
104
|
-
* A complete, themeable booking widget: availability + price →
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
118
|
+
* A complete, themeable booking widget: availability + price → book → pay (your
|
|
119
|
+
* Stripe slot) → confirm. Account-aware (hides Name/Email and books as the
|
|
120
|
+
* signed-in customer) and pay-to-confirm by default. Built on `useBookingFlow`.
|
|
121
|
+
* Must render inside a `<BowlosProvider>`; theme with `<BowlosTheme>`. White-label.
|
|
108
122
|
*/
|
|
109
|
-
declare function BookingFlow({ centerId, productId, pricingMode, durationMinutes, defaultDateISO, defaultStartMinuteOfDay, renderPayment, onConfirmed, unitLabel, labels, className, }: BookingFlowProps): react_jsx_runtime.JSX.Element;
|
|
123
|
+
declare function BookingFlow({ centerId, productId, pricingMode, durationMinutes, defaultDateISO, defaultStartMinuteOfDay, renderPayment, onConfirmed, unitLabel, completeSaleOnly, accountHref, labels, className, }: BookingFlowProps): react_jsx_runtime.JSX.Element;
|
|
110
124
|
|
|
111
125
|
/** Visible strings — override any subset for copy/i18n. */
|
|
112
126
|
interface AuthGateLabels {
|
|
@@ -163,6 +177,26 @@ interface AuthGateProps {
|
|
|
163
177
|
*/
|
|
164
178
|
declare function AuthGate({ children, labels, className }: AuthGateProps): react_jsx_runtime.JSX.Element;
|
|
165
179
|
|
|
180
|
+
/** Visible strings — override for copy/i18n. */
|
|
181
|
+
interface AccountMenuLabels {
|
|
182
|
+
signIn: string;
|
|
183
|
+
signOut: string;
|
|
184
|
+
loading: string;
|
|
185
|
+
}
|
|
186
|
+
interface AccountMenuProps {
|
|
187
|
+
/** Where the signed-in name and the "Sign in" link point. Default "/account". */
|
|
188
|
+
accountHref?: string;
|
|
189
|
+
labels?: Partial<AccountMenuLabels>;
|
|
190
|
+
className?: string;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* A drop-in header login indicator. Reads the **shared** session, so it appears
|
|
194
|
+
* the same on every page and updates instantly when the customer signs in or out
|
|
195
|
+
* anywhere. Signed out → a "Sign in" link; signed in → the customer's first name
|
|
196
|
+
* (linking to their account) + a Sign out action. Theme with `<BowlosTheme>`.
|
|
197
|
+
*/
|
|
198
|
+
declare function AccountMenu({ accountHref, labels, className }: AccountMenuProps): react_jsx_runtime.JSX.Element;
|
|
199
|
+
|
|
166
200
|
interface MyReservationSummary {
|
|
167
201
|
id: string;
|
|
168
202
|
displayId: string;
|
|
@@ -335,6 +369,49 @@ interface FlashSaleProps {
|
|
|
335
369
|
*/
|
|
336
370
|
declare function FlashSale({ slug, onBook, labels, className }: FlashSaleProps): react_jsx_runtime.JSX.Element;
|
|
337
371
|
|
|
372
|
+
/** One sale in the index. No prices/items — those stay member-gated per-slug. */
|
|
373
|
+
interface FlashSaleIndexItem {
|
|
374
|
+
slug: string;
|
|
375
|
+
displayName: string;
|
|
376
|
+
description: string;
|
|
377
|
+
status: "live" | "upcoming";
|
|
378
|
+
windowStartAt: number;
|
|
379
|
+
windowEndAt: number;
|
|
380
|
+
}
|
|
381
|
+
interface FlashSaleIndexView {
|
|
382
|
+
sales: FlashSaleIndexItem[];
|
|
383
|
+
}
|
|
384
|
+
/** Visible strings — override for copy/i18n. */
|
|
385
|
+
interface FlashSaleIndexLabels {
|
|
386
|
+
heading: string;
|
|
387
|
+
loading: string;
|
|
388
|
+
unavailable: string;
|
|
389
|
+
empty: string;
|
|
390
|
+
liveNow: string;
|
|
391
|
+
opens: string;
|
|
392
|
+
view: string;
|
|
393
|
+
soon: string;
|
|
394
|
+
}
|
|
395
|
+
interface FlashSaleIndexProps {
|
|
396
|
+
/** The Brand whose sales to list. */
|
|
397
|
+
brandId: string;
|
|
398
|
+
/**
|
|
399
|
+
* Called when a customer opens a sale — route to that sale's page, e.g.
|
|
400
|
+
* `onOpen={(sale) => router.push(`/flash/${sale.slug}`)}`. Omit for display-only.
|
|
401
|
+
*/
|
|
402
|
+
onOpen?: (sale: FlashSaleIndexItem) => void;
|
|
403
|
+
labels?: Partial<FlashSaleIndexLabels>;
|
|
404
|
+
className?: string;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* The branded flash-sale landing page: the Brand's **live** sales (buyable now)
|
|
408
|
+
* + **upcoming** scheduled ones (name + when purchases open). When there are
|
|
409
|
+
* none, a "check back soon" notice. No prices or items — those stay member-gated
|
|
410
|
+
* on each sale's own page. Must render inside a `<BowlosProvider>`; theme with
|
|
411
|
+
* `<BowlosTheme>`. (Lead-capture / "notify me" is a planned follow-up.)
|
|
412
|
+
*/
|
|
413
|
+
declare function FlashSaleIndex({ brandId, onOpen, labels, className }: FlashSaleIndexProps): react_jsx_runtime.JSX.Element;
|
|
414
|
+
|
|
338
415
|
/**
|
|
339
416
|
* Shared primitives for the `@bowlos/reservations/components` layer.
|
|
340
417
|
*
|
|
@@ -350,4 +427,4 @@ declare function formatCents(cents: number): string;
|
|
|
350
427
|
/** A min–max money range, collapsing to one value when they're equal. */
|
|
351
428
|
declare function formatCentsRange(minCents: number, maxCents: number): string;
|
|
352
429
|
|
|
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 };
|
|
430
|
+
export { AccountDashboard, type AccountDashboardLabels, type AccountDashboardProps, AccountMenu, type AccountMenuLabels, type AccountMenuProps, type AccountSection, AuthForm, AuthGate, type AuthGateLabels, type AuthGateProps, type AuthGateRenderContext, BOWLOS_DEFAULT_THEME, BookingFlow, type BookingFlowLabels, type BookingFlowProps, BowlosTheme, type BowlosThemeTokens, type FlashBrand, FlashSale, FlashSaleIndex, type FlashSaleIndexItem, type FlashSaleIndexLabels, type FlashSaleIndexProps, type FlashSaleIndexView, type FlashSaleItem, type FlashSaleLabels, type FlashSaleProps, type FlashSaleView, type MyCreditEntry, type MyCredits, type MyLoyalty, type MyMembershipSummary, type MyPass, type MyReservationSummary, formatCents, formatCentsRange };
|
package/dist/components.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { CSSProperties, ReactNode } from 'react';
|
|
3
3
|
import { q as PricingMode, P as PaymentIntentInfo, o as Customer } from './data-DrM0D6Pi.js';
|
|
4
|
-
import { c as UseAccountResult } from './react-
|
|
4
|
+
import { c as UseAccountResult } from './react-Cb_NZCXa.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Themeable design tokens for the `@bowlos/reservations/components` layer.
|
|
@@ -61,11 +61,15 @@ interface BookingFlowLabels {
|
|
|
61
61
|
releaseHold: string;
|
|
62
62
|
heldHeading: string;
|
|
63
63
|
heldBody: string;
|
|
64
|
+
securing: string;
|
|
64
65
|
paymentHeading: string;
|
|
65
66
|
confirmedHeading: string;
|
|
66
67
|
confirmationLabel: string;
|
|
67
68
|
bookAnother: string;
|
|
68
69
|
checkingAvailability: string;
|
|
70
|
+
bookingAs: string;
|
|
71
|
+
notYou: string;
|
|
72
|
+
signInHint: string;
|
|
69
73
|
}
|
|
70
74
|
interface BookingFlowProps {
|
|
71
75
|
centerId: string;
|
|
@@ -97,16 +101,26 @@ interface BookingFlowProps {
|
|
|
97
101
|
singular: string;
|
|
98
102
|
plural: string;
|
|
99
103
|
};
|
|
104
|
+
/**
|
|
105
|
+
* Online reservations are pay-to-confirm: after the customer books, the hold
|
|
106
|
+
* advances straight to payment with no "you've placed a hold" intermission
|
|
107
|
+
* (the inventory hold stays internal and just expires if they bail). Default
|
|
108
|
+
* `true`. Set `false` to expose the explicit "Reserve → Continue to payment"
|
|
109
|
+
* two-step instead.
|
|
110
|
+
*/
|
|
111
|
+
completeSaleOnly?: boolean;
|
|
112
|
+
/** Where the "Not you?" / "Sign in" links go (e.g. "/account"). */
|
|
113
|
+
accountHref?: string;
|
|
100
114
|
labels?: Partial<BookingFlowLabels>;
|
|
101
115
|
className?: string;
|
|
102
116
|
}
|
|
103
117
|
/**
|
|
104
|
-
* A complete, themeable booking widget: availability + price →
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
118
|
+
* A complete, themeable booking widget: availability + price → book → pay (your
|
|
119
|
+
* Stripe slot) → confirm. Account-aware (hides Name/Email and books as the
|
|
120
|
+
* signed-in customer) and pay-to-confirm by default. Built on `useBookingFlow`.
|
|
121
|
+
* Must render inside a `<BowlosProvider>`; theme with `<BowlosTheme>`. White-label.
|
|
108
122
|
*/
|
|
109
|
-
declare function BookingFlow({ centerId, productId, pricingMode, durationMinutes, defaultDateISO, defaultStartMinuteOfDay, renderPayment, onConfirmed, unitLabel, labels, className, }: BookingFlowProps): react_jsx_runtime.JSX.Element;
|
|
123
|
+
declare function BookingFlow({ centerId, productId, pricingMode, durationMinutes, defaultDateISO, defaultStartMinuteOfDay, renderPayment, onConfirmed, unitLabel, completeSaleOnly, accountHref, labels, className, }: BookingFlowProps): react_jsx_runtime.JSX.Element;
|
|
110
124
|
|
|
111
125
|
/** Visible strings — override any subset for copy/i18n. */
|
|
112
126
|
interface AuthGateLabels {
|
|
@@ -163,6 +177,26 @@ interface AuthGateProps {
|
|
|
163
177
|
*/
|
|
164
178
|
declare function AuthGate({ children, labels, className }: AuthGateProps): react_jsx_runtime.JSX.Element;
|
|
165
179
|
|
|
180
|
+
/** Visible strings — override for copy/i18n. */
|
|
181
|
+
interface AccountMenuLabels {
|
|
182
|
+
signIn: string;
|
|
183
|
+
signOut: string;
|
|
184
|
+
loading: string;
|
|
185
|
+
}
|
|
186
|
+
interface AccountMenuProps {
|
|
187
|
+
/** Where the signed-in name and the "Sign in" link point. Default "/account". */
|
|
188
|
+
accountHref?: string;
|
|
189
|
+
labels?: Partial<AccountMenuLabels>;
|
|
190
|
+
className?: string;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* A drop-in header login indicator. Reads the **shared** session, so it appears
|
|
194
|
+
* the same on every page and updates instantly when the customer signs in or out
|
|
195
|
+
* anywhere. Signed out → a "Sign in" link; signed in → the customer's first name
|
|
196
|
+
* (linking to their account) + a Sign out action. Theme with `<BowlosTheme>`.
|
|
197
|
+
*/
|
|
198
|
+
declare function AccountMenu({ accountHref, labels, className }: AccountMenuProps): react_jsx_runtime.JSX.Element;
|
|
199
|
+
|
|
166
200
|
interface MyReservationSummary {
|
|
167
201
|
id: string;
|
|
168
202
|
displayId: string;
|
|
@@ -335,6 +369,49 @@ interface FlashSaleProps {
|
|
|
335
369
|
*/
|
|
336
370
|
declare function FlashSale({ slug, onBook, labels, className }: FlashSaleProps): react_jsx_runtime.JSX.Element;
|
|
337
371
|
|
|
372
|
+
/** One sale in the index. No prices/items — those stay member-gated per-slug. */
|
|
373
|
+
interface FlashSaleIndexItem {
|
|
374
|
+
slug: string;
|
|
375
|
+
displayName: string;
|
|
376
|
+
description: string;
|
|
377
|
+
status: "live" | "upcoming";
|
|
378
|
+
windowStartAt: number;
|
|
379
|
+
windowEndAt: number;
|
|
380
|
+
}
|
|
381
|
+
interface FlashSaleIndexView {
|
|
382
|
+
sales: FlashSaleIndexItem[];
|
|
383
|
+
}
|
|
384
|
+
/** Visible strings — override for copy/i18n. */
|
|
385
|
+
interface FlashSaleIndexLabels {
|
|
386
|
+
heading: string;
|
|
387
|
+
loading: string;
|
|
388
|
+
unavailable: string;
|
|
389
|
+
empty: string;
|
|
390
|
+
liveNow: string;
|
|
391
|
+
opens: string;
|
|
392
|
+
view: string;
|
|
393
|
+
soon: string;
|
|
394
|
+
}
|
|
395
|
+
interface FlashSaleIndexProps {
|
|
396
|
+
/** The Brand whose sales to list. */
|
|
397
|
+
brandId: string;
|
|
398
|
+
/**
|
|
399
|
+
* Called when a customer opens a sale — route to that sale's page, e.g.
|
|
400
|
+
* `onOpen={(sale) => router.push(`/flash/${sale.slug}`)}`. Omit for display-only.
|
|
401
|
+
*/
|
|
402
|
+
onOpen?: (sale: FlashSaleIndexItem) => void;
|
|
403
|
+
labels?: Partial<FlashSaleIndexLabels>;
|
|
404
|
+
className?: string;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* The branded flash-sale landing page: the Brand's **live** sales (buyable now)
|
|
408
|
+
* + **upcoming** scheduled ones (name + when purchases open). When there are
|
|
409
|
+
* none, a "check back soon" notice. No prices or items — those stay member-gated
|
|
410
|
+
* on each sale's own page. Must render inside a `<BowlosProvider>`; theme with
|
|
411
|
+
* `<BowlosTheme>`. (Lead-capture / "notify me" is a planned follow-up.)
|
|
412
|
+
*/
|
|
413
|
+
declare function FlashSaleIndex({ brandId, onOpen, labels, className }: FlashSaleIndexProps): react_jsx_runtime.JSX.Element;
|
|
414
|
+
|
|
338
415
|
/**
|
|
339
416
|
* Shared primitives for the `@bowlos/reservations/components` layer.
|
|
340
417
|
*
|
|
@@ -350,4 +427,4 @@ declare function formatCents(cents: number): string;
|
|
|
350
427
|
/** A min–max money range, collapsing to one value when they're equal. */
|
|
351
428
|
declare function formatCentsRange(minCents: number, maxCents: number): string;
|
|
352
429
|
|
|
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 };
|
|
430
|
+
export { AccountDashboard, type AccountDashboardLabels, type AccountDashboardProps, AccountMenu, type AccountMenuLabels, type AccountMenuProps, type AccountSection, AuthForm, AuthGate, type AuthGateLabels, type AuthGateProps, type AuthGateRenderContext, BOWLOS_DEFAULT_THEME, BookingFlow, type BookingFlowLabels, type BookingFlowProps, BowlosTheme, type BowlosThemeTokens, type FlashBrand, FlashSale, FlashSaleIndex, type FlashSaleIndexItem, type FlashSaleIndexLabels, type FlashSaleIndexProps, type FlashSaleIndexView, type FlashSaleItem, type FlashSaleLabels, type FlashSaleProps, type FlashSaleView, type MyCreditEntry, type MyCredits, type MyLoyalty, type MyMembershipSummary, type MyPass, type MyReservationSummary, formatCents, formatCentsRange };
|
package/dist/components.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { useAvailability, useBookingPreview, useBookingFlow,
|
|
2
|
-
import { availableUnitCount } from './chunk-
|
|
3
|
-
import './chunk-QGTGKNJW.js';
|
|
1
|
+
import { useAccount, useAvailability, useBookingPreview, useBookingFlow, useMyReservations, useMyMemberships, useMyLoyalty, useMyCredits, useMyPasses, useFlashSale, useFlashSales } from './chunk-H42X4FRR.js';
|
|
2
|
+
import { availableUnitCount } from './chunk-YICHFUAY.js';
|
|
4
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
4
|
import { useState, useRef, useEffect, useMemo } from 'react';
|
|
6
5
|
|
|
@@ -221,19 +220,23 @@ var DEFAULT_LABELS = {
|
|
|
221
220
|
quantity: "Quantity",
|
|
222
221
|
name: "Name",
|
|
223
222
|
email: "Email",
|
|
224
|
-
hold: "
|
|
225
|
-
holding: "
|
|
223
|
+
hold: "Book",
|
|
224
|
+
holding: "Booking\u2026",
|
|
226
225
|
continueToPayment: "Continue to payment",
|
|
227
226
|
preparing: "Preparing\u2026",
|
|
228
227
|
cancel: "Cancel",
|
|
229
228
|
releaseHold: "Release hold",
|
|
230
|
-
heldHeading: "
|
|
229
|
+
heldHeading: "Almost there",
|
|
231
230
|
heldBody: "We're holding your spot for a few minutes. Continue to payment to confirm.",
|
|
231
|
+
securing: "Securing your spot\u2026",
|
|
232
232
|
paymentHeading: "Payment",
|
|
233
233
|
confirmedHeading: "You're booked",
|
|
234
234
|
confirmationLabel: "Confirmation",
|
|
235
235
|
bookAnother: "Book another",
|
|
236
|
-
checkingAvailability: "Checking availability\u2026"
|
|
236
|
+
checkingAvailability: "Checking availability\u2026",
|
|
237
|
+
bookingAs: "Booking as {name}",
|
|
238
|
+
notYou: "Not you?",
|
|
239
|
+
signInHint: "Sign in to book faster"
|
|
237
240
|
};
|
|
238
241
|
function BookingFlow({
|
|
239
242
|
centerId,
|
|
@@ -245,10 +248,16 @@ function BookingFlow({
|
|
|
245
248
|
renderPayment,
|
|
246
249
|
onConfirmed,
|
|
247
250
|
unitLabel = { singular: "lane", plural: "lanes" },
|
|
251
|
+
completeSaleOnly = true,
|
|
252
|
+
accountHref,
|
|
248
253
|
labels,
|
|
249
254
|
className
|
|
250
255
|
}) {
|
|
251
256
|
const t = { ...DEFAULT_LABELS, ...labels };
|
|
257
|
+
const account = useAccount();
|
|
258
|
+
const signedIn = account.status === "linked" && account.customer !== null;
|
|
259
|
+
const acctName = account.customer?.fullName ?? "";
|
|
260
|
+
const acctEmail = account.customer?.email ?? "";
|
|
252
261
|
const [dateISO, setDateISO] = useState(defaultDateISO);
|
|
253
262
|
const [startMinuteOfDay, setStartMinuteOfDay] = useState(defaultStartMinuteOfDay);
|
|
254
263
|
const endMinuteOfDay = startMinuteOfDay + durationMinutes;
|
|
@@ -272,6 +281,13 @@ function BookingFlow({
|
|
|
272
281
|
onConfirmedRef.current?.(flow.reservation);
|
|
273
282
|
}
|
|
274
283
|
}, [flow.status, flow.reservation]);
|
|
284
|
+
const prepareRef = useRef(flow.preparePayment);
|
|
285
|
+
prepareRef.current = flow.preparePayment;
|
|
286
|
+
useEffect(() => {
|
|
287
|
+
if (completeSaleOnly && flow.status === "held") {
|
|
288
|
+
void prepareRef.current();
|
|
289
|
+
}
|
|
290
|
+
}, [completeSaleOnly, flow.status]);
|
|
275
291
|
const bookingArgs = useMemo(
|
|
276
292
|
() => ({
|
|
277
293
|
centerId,
|
|
@@ -281,9 +297,9 @@ function BookingFlow({
|
|
|
281
297
|
endMinuteOfDay,
|
|
282
298
|
mode: pricingMode,
|
|
283
299
|
units,
|
|
284
|
-
customer: { fullName, email, marketingOptIn: false }
|
|
300
|
+
customer: signedIn ? { fullName: acctName, email: acctEmail, marketingOptIn: false } : { fullName, email, marketingOptIn: false }
|
|
285
301
|
}),
|
|
286
|
-
[centerId, productId, dateISO, startMinuteOfDay, endMinuteOfDay, pricingMode, units, fullName, email]
|
|
302
|
+
[centerId, productId, dateISO, startMinuteOfDay, endMinuteOfDay, pricingMode, units, signedIn, acctName, acctEmail, fullName, email]
|
|
287
303
|
);
|
|
288
304
|
const freeUnits = availability.data ? availableUnitCount(availability.data) : null;
|
|
289
305
|
const quoteCents = preview.data?.totalCentsPerPlan?.[0]?.totalCents ?? null;
|
|
@@ -316,6 +332,13 @@ function BookingFlow({
|
|
|
316
332
|
] });
|
|
317
333
|
}
|
|
318
334
|
if (flow.status === "held" || flow.status === "preparingPayment") {
|
|
335
|
+
if (completeSaleOnly) {
|
|
336
|
+
return /* @__PURE__ */ jsxs("div", { className, style: s.card, children: [
|
|
337
|
+
/* @__PURE__ */ jsx("h3", { style: s.heading, children: t.heldHeading }),
|
|
338
|
+
/* @__PURE__ */ jsx("p", { style: s.body, children: t.securing }),
|
|
339
|
+
flow.error && /* @__PURE__ */ jsx("p", { style: s.error, children: flow.error.code })
|
|
340
|
+
] });
|
|
341
|
+
}
|
|
319
342
|
const preparing = flow.status === "preparingPayment";
|
|
320
343
|
return /* @__PURE__ */ jsxs("div", { className, style: s.card, children: [
|
|
321
344
|
/* @__PURE__ */ jsx("h3", { style: s.heading, children: t.heldHeading }),
|
|
@@ -363,19 +386,36 @@ function BookingFlow({
|
|
|
363
386
|
}
|
|
364
387
|
)
|
|
365
388
|
] }),
|
|
366
|
-
/* @__PURE__ */ jsxs("
|
|
367
|
-
t.name,
|
|
368
|
-
/* @__PURE__ */
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
389
|
+
signedIn ? /* @__PURE__ */ jsxs("p", { style: s.meta, children: [
|
|
390
|
+
t.bookingAs.replace("{name}", acctName),
|
|
391
|
+
accountHref ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
392
|
+
" \xB7 ",
|
|
393
|
+
/* @__PURE__ */ jsx("a", { href: accountHref, style: s.linkBtn, children: t.notYou })
|
|
394
|
+
] }) : null
|
|
395
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
396
|
+
/* @__PURE__ */ jsxs("label", { style: s.label, children: [
|
|
397
|
+
t.name,
|
|
398
|
+
/* @__PURE__ */ jsx("input", { value: fullName, onChange: (e) => setFullName(e.target.value), style: s.input, required: true })
|
|
399
|
+
] }),
|
|
400
|
+
/* @__PURE__ */ jsxs("label", { style: s.label, children: [
|
|
401
|
+
t.email,
|
|
402
|
+
/* @__PURE__ */ jsx("input", { type: "email", value: email, onChange: (e) => setEmail(e.target.value), style: s.input, required: true })
|
|
403
|
+
] }),
|
|
404
|
+
accountHref ? /* @__PURE__ */ jsx("a", { href: accountHref, style: s.linkBtn, children: t.signInHint }) : null
|
|
373
405
|
] }),
|
|
374
406
|
/* @__PURE__ */ jsxs("p", { style: s.meta, "aria-live": "polite", children: [
|
|
375
407
|
dateISO === "" ? "" : availability.loading ? t.checkingAvailability : freeUnits !== null ? `${freeUnits} ${freeUnits === 1 ? unitLabel.singular : unitLabel.plural} available` : availability.error ? availability.error.code : "",
|
|
376
408
|
quoteCents !== null ? ` \xB7 ${formatCents(quoteCents)}` : ""
|
|
377
409
|
] }),
|
|
378
|
-
/* @__PURE__ */ jsx(
|
|
410
|
+
/* @__PURE__ */ jsx(
|
|
411
|
+
"button",
|
|
412
|
+
{
|
|
413
|
+
type: "submit",
|
|
414
|
+
style: s.primaryBtn,
|
|
415
|
+
disabled: holding || dateISO === "" || !signedIn && (!fullName || !email),
|
|
416
|
+
children: holding ? t.holding : `${t.hold} ${unitNoun}`
|
|
417
|
+
}
|
|
418
|
+
),
|
|
379
419
|
flow.error && /* @__PURE__ */ jsxs("p", { style: s.error, children: [
|
|
380
420
|
flow.error.code,
|
|
381
421
|
" \u2014 ",
|
|
@@ -509,6 +549,35 @@ function AuthGate({ children, labels, className }) {
|
|
|
509
549
|
return /* @__PURE__ */ jsx(AuthForm, { account, labels, className });
|
|
510
550
|
}
|
|
511
551
|
var DEFAULT_LABELS3 = {
|
|
552
|
+
signIn: "Sign in",
|
|
553
|
+
signOut: "Sign out",
|
|
554
|
+
loading: "\u2026"
|
|
555
|
+
};
|
|
556
|
+
function AccountMenu({ accountHref = "/account", labels, className }) {
|
|
557
|
+
const t = { ...DEFAULT_LABELS3, ...labels };
|
|
558
|
+
const account = useAccount();
|
|
559
|
+
const s = styles();
|
|
560
|
+
const wrap = {
|
|
561
|
+
display: "inline-flex",
|
|
562
|
+
alignItems: "center",
|
|
563
|
+
gap: "0.625rem",
|
|
564
|
+
fontFamily: token("fontFamily"),
|
|
565
|
+
fontSize: "0.9rem",
|
|
566
|
+
color: token("colorText")
|
|
567
|
+
};
|
|
568
|
+
if (account.status === "loading") {
|
|
569
|
+
return /* @__PURE__ */ jsx("span", { className, style: wrap, children: /* @__PURE__ */ jsx("span", { style: s.muted, children: t.loading }) });
|
|
570
|
+
}
|
|
571
|
+
if (account.status === "linked" && account.customer) {
|
|
572
|
+
const first = account.customer.fullName.split(" ")[0] || account.customer.fullName;
|
|
573
|
+
return /* @__PURE__ */ jsxs("span", { className, style: wrap, children: [
|
|
574
|
+
/* @__PURE__ */ jsx("a", { href: accountHref, style: s.linkBtn, children: first }),
|
|
575
|
+
/* @__PURE__ */ jsx("button", { type: "button", style: s.linkBtn, onClick: () => void account.signOut(), children: t.signOut })
|
|
576
|
+
] });
|
|
577
|
+
}
|
|
578
|
+
return /* @__PURE__ */ jsx("a", { className, href: accountHref, style: { ...wrap, ...s.linkBtn }, children: t.signIn });
|
|
579
|
+
}
|
|
580
|
+
var DEFAULT_LABELS4 = {
|
|
512
581
|
welcome: "Welcome, {name}",
|
|
513
582
|
signOut: "Sign out",
|
|
514
583
|
reservations: "Reservations",
|
|
@@ -552,7 +621,7 @@ function Dashboard({
|
|
|
552
621
|
customerName,
|
|
553
622
|
onSignOut
|
|
554
623
|
}) {
|
|
555
|
-
const t = { ...
|
|
624
|
+
const t = { ...DEFAULT_LABELS4, ...labels };
|
|
556
625
|
const s = styles();
|
|
557
626
|
const show = (k) => sections.includes(k);
|
|
558
627
|
const reservations = useMyReservations(
|
|
@@ -669,7 +738,7 @@ function formatDate(value) {
|
|
|
669
738
|
if (Number.isNaN(d.getTime())) return String(value);
|
|
670
739
|
return d.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" });
|
|
671
740
|
}
|
|
672
|
-
var
|
|
741
|
+
var DEFAULT_LABELS5 = {
|
|
673
742
|
loading: "Loading\u2026",
|
|
674
743
|
unavailable: "This flash sale isn\u2019t available.",
|
|
675
744
|
ended: "This flash sale has ended.",
|
|
@@ -680,7 +749,7 @@ var DEFAULT_LABELS4 = {
|
|
|
680
749
|
saleEnded: "Sale ended"
|
|
681
750
|
};
|
|
682
751
|
function FlashSale({ slug, onBook, labels, className }) {
|
|
683
|
-
const t = { ...
|
|
752
|
+
const t = { ...DEFAULT_LABELS5, ...labels };
|
|
684
753
|
const account = useAccount();
|
|
685
754
|
const sale = useFlashSale({ slug });
|
|
686
755
|
const s = styles();
|
|
@@ -759,7 +828,53 @@ function Hero({
|
|
|
759
828
|
description && /* @__PURE__ */ jsx("p", { style: s.body, children: description })
|
|
760
829
|
] });
|
|
761
830
|
}
|
|
831
|
+
var DEFAULT_LABELS6 = {
|
|
832
|
+
heading: "Flash sales",
|
|
833
|
+
loading: "Loading\u2026",
|
|
834
|
+
unavailable: "Flash sales are unavailable right now.",
|
|
835
|
+
empty: "No flash sales right now \u2014 check back soon.",
|
|
836
|
+
liveNow: "On sale now",
|
|
837
|
+
opens: "Opens",
|
|
838
|
+
view: "View sale",
|
|
839
|
+
soon: "Upcoming"
|
|
840
|
+
};
|
|
841
|
+
function FlashSaleIndex({ brandId, onOpen, labels, className }) {
|
|
842
|
+
const t = { ...DEFAULT_LABELS6, ...labels };
|
|
843
|
+
const s = styles();
|
|
844
|
+
const list = useFlashSales({ brandId });
|
|
845
|
+
let body;
|
|
846
|
+
if (list.loading && !list.data) {
|
|
847
|
+
body = /* @__PURE__ */ jsx("p", { style: s.muted, children: t.loading });
|
|
848
|
+
} else if (list.error) {
|
|
849
|
+
body = /* @__PURE__ */ jsx("p", { style: s.muted, children: t.unavailable });
|
|
850
|
+
} else if ((list.data?.sales.length ?? 0) === 0) {
|
|
851
|
+
body = /* @__PURE__ */ jsx("p", { style: s.muted, children: t.empty });
|
|
852
|
+
} else {
|
|
853
|
+
body = /* @__PURE__ */ jsx("div", { children: list.data?.sales.map((sale) => /* @__PURE__ */ jsxs("div", { style: s.listItem, children: [
|
|
854
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
855
|
+
/* @__PURE__ */ jsx("p", { style: s.listTitle, children: sale.displayName }),
|
|
856
|
+
/* @__PURE__ */ jsx("p", { style: s.listMeta, children: sale.status === "live" ? t.liveNow : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
857
|
+
t.opens,
|
|
858
|
+
" ",
|
|
859
|
+
/* @__PURE__ */ jsx(When, { ms: sale.windowStartAt })
|
|
860
|
+
] }) })
|
|
861
|
+
] }),
|
|
862
|
+
sale.status === "live" && onOpen ? /* @__PURE__ */ jsx("button", { type: "button", style: s.primaryBtn, onClick: () => onOpen(sale), children: t.view }) : /* @__PURE__ */ jsx("span", { style: s.badge, children: sale.status === "live" ? t.liveNow : t.soon })
|
|
863
|
+
] }, sale.slug)) });
|
|
864
|
+
}
|
|
865
|
+
return /* @__PURE__ */ jsxs("div", { className, style: s.card, children: [
|
|
866
|
+
/* @__PURE__ */ jsx("h3", { style: s.heading, children: t.heading }),
|
|
867
|
+
body
|
|
868
|
+
] });
|
|
869
|
+
}
|
|
870
|
+
function When({ ms }) {
|
|
871
|
+
const [text, setText] = useState(null);
|
|
872
|
+
useEffect(() => {
|
|
873
|
+
setText(new Date(ms).toLocaleString(void 0, { dateStyle: "medium", timeStyle: "short" }));
|
|
874
|
+
}, [ms]);
|
|
875
|
+
return /* @__PURE__ */ jsx(Fragment, { children: text ?? "" });
|
|
876
|
+
}
|
|
762
877
|
|
|
763
|
-
export { AccountDashboard, AuthForm, AuthGate, BOWLOS_DEFAULT_THEME, BookingFlow, BowlosTheme, FlashSale, formatCents, formatCentsRange };
|
|
878
|
+
export { AccountDashboard, AccountMenu, AuthForm, AuthGate, BOWLOS_DEFAULT_THEME, BookingFlow, BowlosTheme, FlashSale, FlashSaleIndex, formatCents, formatCentsRange };
|
|
764
879
|
//# sourceMappingURL=components.js.map
|
|
765
880
|
//# sourceMappingURL=components.js.map
|