@bowlos/reservations 0.23.0 → 0.25.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 (39) hide show
  1. package/HEADLESS.md +87 -0
  2. package/README.md +18 -0
  3. package/dist/{account-B9tDfXke.d.ts → account-5oZrwcaq.d.ts} +1 -1
  4. package/dist/{account-C9SvfE3q.d.cts → account-nHac98qx.d.cts} +1 -1
  5. package/dist/{catalog-BxyPJdBL.d.ts → catalog-BMdk6ZSC.d.ts} +18 -1
  6. package/dist/{catalog-D1VoVaNe.d.cts → catalog-Ca7eN9CP.d.cts} +18 -1
  7. package/dist/{chunk-S5T4OCBY.js → chunk-5JWJBLPE.js} +2 -2
  8. package/dist/{chunk-S5T4OCBY.js.map → chunk-5JWJBLPE.js.map} +1 -1
  9. package/dist/{chunk-CRETIPLS.js → chunk-7OHHK65Q.js} +11 -4
  10. package/dist/chunk-7OHHK65Q.js.map +1 -0
  11. package/dist/components.cjs +174 -18
  12. package/dist/components.cjs.map +1 -1
  13. package/dist/components.d.cts +44 -26
  14. package/dist/components.d.ts +44 -26
  15. package/dist/components.js +171 -23
  16. package/dist/components.js.map +1 -1
  17. package/dist/{data-BKlgn8Ln.d.cts → data-CVq9zXz7.d.cts} +34 -0
  18. package/dist/{data-BKlgn8Ln.d.ts → data-CVq9zXz7.d.ts} +34 -0
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +4 -4
  21. package/dist/index.d.ts +4 -4
  22. package/dist/index.js +2 -2
  23. package/dist/index.js.map +1 -1
  24. package/dist/payments.cjs +4 -2
  25. package/dist/payments.cjs.map +1 -1
  26. package/dist/payments.d.cts +11 -3
  27. package/dist/payments.d.ts +11 -3
  28. package/dist/payments.js +4 -2
  29. package/dist/payments.js.map +1 -1
  30. package/dist/{react--BT8olOw.d.cts → react-Bhpzhr01.d.cts} +2 -2
  31. package/dist/{react-BvuU4nzT.d.ts → react-C9bUP9LB.d.ts} +2 -2
  32. package/dist/react.cjs +8 -0
  33. package/dist/react.cjs.map +1 -1
  34. package/dist/react.d.cts +18 -6
  35. package/dist/react.d.ts +18 -6
  36. package/dist/react.js +3 -3
  37. package/package.json +2 -2
  38. package/templates/center-site/package.json +1 -1
  39. package/dist/chunk-CRETIPLS.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 { U as PricingMode, S as PaymentIntentInfo, l as Customer } from './data-BKlgn8Ln.cjs';
4
- import { d as UseAccountResult } from './react--BT8olOw.cjs';
5
- import { g as CatalogItem } from './catalog-D1VoVaNe.cjs';
6
- export { h as CatalogResult, i as CatalogSection } from './catalog-D1VoVaNe.cjs';
3
+ import { m as PublicSurface, g as CatalogItem } from './catalog-Ca7eN9CP.cjs';
4
+ export { h as CatalogResult, i as CatalogSection } from './catalog-Ca7eN9CP.cjs';
5
+ import { U as PricingMode, S as PaymentIntentInfo, l as Customer } from './data-CVq9zXz7.cjs';
6
+ import { d as UseAccountResult } from './react-Bhpzhr01.cjs';
7
7
 
8
8
  /**
9
9
  * Themeable design tokens for the `@bowlos/reservations/components` layer.
@@ -47,6 +47,18 @@ declare function BowlosTheme({ theme, className, style, children, }: {
47
47
  children: ReactNode;
48
48
  }): react_jsx_runtime.JSX.Element;
49
49
 
50
+ interface MaintenanceBannerProps {
51
+ brandId: string;
52
+ centerId: string;
53
+ /** Which surface's catalog/visibility to read. Default "sdk_custom_site". */
54
+ surface?: PublicSurface;
55
+ /** Override the default customer-facing copy (never mention "test mode"). */
56
+ message?: string;
57
+ className?: string;
58
+ style?: CSSProperties;
59
+ }
60
+ declare function MaintenanceBanner({ brandId, centerId, surface, message, className, style, }: MaintenanceBannerProps): react_jsx_runtime.JSX.Element | null;
61
+
50
62
  /** Visible strings — override any subset for copy/i18n. */
51
63
  interface BookingFlowLabels {
52
64
  heading: string;
@@ -425,42 +437,48 @@ interface FlashSaleIndexProps {
425
437
  declare function FlashSaleIndex({ brandId, onOpen, labels, className }: FlashSaleIndexProps): react_jsx_runtime.JSX.Element;
426
438
 
427
439
  /**
428
- * v0.22.0 (BREAKING): `<BookingCatalog>` is now built on the canonical
440
+ * v0.22.0 (BREAKING): `<BookingCatalog>` is built on the canonical
429
441
  * visibility-aware catalog read (`useCatalog` / `listPublicCatalog`) — the
430
- * same read the white-label web and mobile surfaces consume — so the Center
431
- * admin's per-surface visibility toggles finally apply to the drop-in.
442
+ * same read the white-label web and mobile surfaces consume.
432
443
  *
433
- * `onSelect` now receives a `CatalogItem` (route by `item.action.type` with
434
- * the IDs in `item.action.payload`) instead of the old per-kind
435
- * `CatalogOffer` union. See HEADLESS.md → "The canonical catalog" for the
436
- * routing table; the drop-in and a headless site now route identically.
444
+ * v0.24.0: date-first booking. The catalog read returns the Center's
445
+ * `bookingEntryDefault`; this component opens on it and shows a "by activity /
446
+ * by date" toggle the customer can flip. Date-first lists what's bookable on a
447
+ * chosen day (per-product availability via the existing `availableStartTimes`
448
+ * read) + the events section + an "any day" strip (memberships / game passes /
449
+ * packages). Headless sites build the same from `useCatalog` + `useStartTimes`
450
+ * — see HEADLESS.md → "Date-first booking".
451
+ *
452
+ * `onSelect` receives a `CatalogItem` (route by `item.action.type` with the IDs
453
+ * in `item.action.payload`); the drop-in and a headless site route identically.
437
454
  */
438
455
  interface BookingCatalogLabels {
439
456
  heading: string;
440
457
  loading: string;
441
458
  empty: string;
442
459
  select: string;
460
+ byActivity: string;
461
+ byDate: string;
462
+ pickDay: string;
463
+ bookableOnPrefix: string;
464
+ events: string;
465
+ anyDay: string;
466
+ noTimesThatDay: string;
467
+ nothingThatDay: string;
468
+ checking: string;
443
469
  }
470
+ type EntryMode = "product_first" | "date_first";
444
471
  interface BookingCatalogProps {
445
472
  brandId: string;
446
473
  centerId: string;
447
- /**
448
- * The surface whose admin visibility rules apply. Defaults to
449
- * "sdk_custom_site" (a center's own SDK-built site).
450
- */
451
474
  surface?: "sdk_custom_site" | "white_label_web" | "mobile_app";
452
- /**
453
- * Called when a customer picks an item. Route by `item.action.type`:
454
- * `book_reservation` → your `<BookingFlow>` (payload.productId);
455
- * `view_event` / `buy_ticket` → the event landing by payload.slug;
456
- * `buy_package` / `buy_membership` / `buy_game_pass` → that buy flow
457
- * (payload.packageId / templateId).
458
- */
459
475
  onSelect: (item: CatalogItem) => void;
460
476
  labels?: Partial<BookingCatalogLabels>;
461
- /** Override a section heading by its category key (backend labels are
462
- * the default), e.g. `{ game_passes: "Punch cards" }`. */
463
477
  sectionLabels?: Partial<Record<string, string>>;
478
+ /** Force the entry point, ignoring the Center default. */
479
+ defaultEntry?: EntryMode;
480
+ /** Show the by-activity / by-date toggle (default true). */
481
+ showEntryToggle?: boolean;
464
482
  className?: string;
465
483
  }
466
484
  /**
@@ -470,7 +488,7 @@ interface BookingCatalogProps {
470
488
  * binding prices come from the per-category previews after login. Must render
471
489
  * inside a `<BowlosProvider>`; theme with `<BowlosTheme>`.
472
490
  */
473
- declare function BookingCatalog({ brandId, centerId, surface, onSelect, labels, sectionLabels, className, }: BookingCatalogProps): react_jsx_runtime.JSX.Element;
491
+ declare function BookingCatalog({ brandId, centerId, surface, onSelect, labels, sectionLabels, defaultEntry, showEntryToggle, className, }: BookingCatalogProps): react_jsx_runtime.JSX.Element;
474
492
 
475
493
  /**
476
494
  * Shared primitives for the `@bowlos/reservations/components` layer.
@@ -487,4 +505,4 @@ declare function formatCents(cents: number): string;
487
505
  /** A min–max money range, collapsing to one value when they're equal. */
488
506
  declare function formatCentsRange(minCents: number, maxCents: number): string;
489
507
 
490
- export { AccountDashboard, type AccountDashboardLabels, type AccountDashboardProps, AccountMenu, type AccountMenuLabels, type AccountMenuProps, type AccountSection, AuthForm, AuthGate, type AuthGateLabels, type AuthGateProps, type AuthGateRenderContext, BOWLOS_DEFAULT_THEME, BookingCatalog, type BookingCatalogLabels, type BookingCatalogProps, BookingFlow, type BookingFlowLabels, type BookingFlowProps, BowlosTheme, type BowlosThemeTokens, CatalogItem, 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 };
508
+ export { AccountDashboard, type AccountDashboardLabels, type AccountDashboardProps, AccountMenu, type AccountMenuLabels, type AccountMenuProps, type AccountSection, AuthForm, AuthGate, type AuthGateLabels, type AuthGateProps, type AuthGateRenderContext, BOWLOS_DEFAULT_THEME, BookingCatalog, type BookingCatalogLabels, type BookingCatalogProps, BookingFlow, type BookingFlowLabels, type BookingFlowProps, BowlosTheme, type BowlosThemeTokens, CatalogItem, type FlashBrand, FlashSale, FlashSaleIndex, type FlashSaleIndexItem, type FlashSaleIndexLabels, type FlashSaleIndexProps, type FlashSaleIndexView, type FlashSaleItem, type FlashSaleLabels, type FlashSaleProps, type FlashSaleView, MaintenanceBanner, type MaintenanceBannerProps, type MyCreditEntry, type MyCredits, type MyLoyalty, type MyMembershipSummary, type MyPass, type MyReservationSummary, formatCents, formatCentsRange };
@@ -1,9 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { CSSProperties, ReactNode } from 'react';
3
- import { U as PricingMode, S as PaymentIntentInfo, l as Customer } from './data-BKlgn8Ln.js';
4
- import { d as UseAccountResult } from './react-BvuU4nzT.js';
5
- import { g as CatalogItem } from './catalog-BxyPJdBL.js';
6
- export { h as CatalogResult, i as CatalogSection } from './catalog-BxyPJdBL.js';
3
+ import { m as PublicSurface, g as CatalogItem } from './catalog-BMdk6ZSC.js';
4
+ export { h as CatalogResult, i as CatalogSection } from './catalog-BMdk6ZSC.js';
5
+ import { U as PricingMode, S as PaymentIntentInfo, l as Customer } from './data-CVq9zXz7.js';
6
+ import { d as UseAccountResult } from './react-C9bUP9LB.js';
7
7
 
8
8
  /**
9
9
  * Themeable design tokens for the `@bowlos/reservations/components` layer.
@@ -47,6 +47,18 @@ declare function BowlosTheme({ theme, className, style, children, }: {
47
47
  children: ReactNode;
48
48
  }): react_jsx_runtime.JSX.Element;
49
49
 
50
+ interface MaintenanceBannerProps {
51
+ brandId: string;
52
+ centerId: string;
53
+ /** Which surface's catalog/visibility to read. Default "sdk_custom_site". */
54
+ surface?: PublicSurface;
55
+ /** Override the default customer-facing copy (never mention "test mode"). */
56
+ message?: string;
57
+ className?: string;
58
+ style?: CSSProperties;
59
+ }
60
+ declare function MaintenanceBanner({ brandId, centerId, surface, message, className, style, }: MaintenanceBannerProps): react_jsx_runtime.JSX.Element | null;
61
+
50
62
  /** Visible strings — override any subset for copy/i18n. */
51
63
  interface BookingFlowLabels {
52
64
  heading: string;
@@ -425,42 +437,48 @@ interface FlashSaleIndexProps {
425
437
  declare function FlashSaleIndex({ brandId, onOpen, labels, className }: FlashSaleIndexProps): react_jsx_runtime.JSX.Element;
426
438
 
427
439
  /**
428
- * v0.22.0 (BREAKING): `<BookingCatalog>` is now built on the canonical
440
+ * v0.22.0 (BREAKING): `<BookingCatalog>` is built on the canonical
429
441
  * visibility-aware catalog read (`useCatalog` / `listPublicCatalog`) — the
430
- * same read the white-label web and mobile surfaces consume — so the Center
431
- * admin's per-surface visibility toggles finally apply to the drop-in.
442
+ * same read the white-label web and mobile surfaces consume.
432
443
  *
433
- * `onSelect` now receives a `CatalogItem` (route by `item.action.type` with
434
- * the IDs in `item.action.payload`) instead of the old per-kind
435
- * `CatalogOffer` union. See HEADLESS.md → "The canonical catalog" for the
436
- * routing table; the drop-in and a headless site now route identically.
444
+ * v0.24.0: date-first booking. The catalog read returns the Center's
445
+ * `bookingEntryDefault`; this component opens on it and shows a "by activity /
446
+ * by date" toggle the customer can flip. Date-first lists what's bookable on a
447
+ * chosen day (per-product availability via the existing `availableStartTimes`
448
+ * read) + the events section + an "any day" strip (memberships / game passes /
449
+ * packages). Headless sites build the same from `useCatalog` + `useStartTimes`
450
+ * — see HEADLESS.md → "Date-first booking".
451
+ *
452
+ * `onSelect` receives a `CatalogItem` (route by `item.action.type` with the IDs
453
+ * in `item.action.payload`); the drop-in and a headless site route identically.
437
454
  */
438
455
  interface BookingCatalogLabels {
439
456
  heading: string;
440
457
  loading: string;
441
458
  empty: string;
442
459
  select: string;
460
+ byActivity: string;
461
+ byDate: string;
462
+ pickDay: string;
463
+ bookableOnPrefix: string;
464
+ events: string;
465
+ anyDay: string;
466
+ noTimesThatDay: string;
467
+ nothingThatDay: string;
468
+ checking: string;
443
469
  }
470
+ type EntryMode = "product_first" | "date_first";
444
471
  interface BookingCatalogProps {
445
472
  brandId: string;
446
473
  centerId: string;
447
- /**
448
- * The surface whose admin visibility rules apply. Defaults to
449
- * "sdk_custom_site" (a center's own SDK-built site).
450
- */
451
474
  surface?: "sdk_custom_site" | "white_label_web" | "mobile_app";
452
- /**
453
- * Called when a customer picks an item. Route by `item.action.type`:
454
- * `book_reservation` → your `<BookingFlow>` (payload.productId);
455
- * `view_event` / `buy_ticket` → the event landing by payload.slug;
456
- * `buy_package` / `buy_membership` / `buy_game_pass` → that buy flow
457
- * (payload.packageId / templateId).
458
- */
459
475
  onSelect: (item: CatalogItem) => void;
460
476
  labels?: Partial<BookingCatalogLabels>;
461
- /** Override a section heading by its category key (backend labels are
462
- * the default), e.g. `{ game_passes: "Punch cards" }`. */
463
477
  sectionLabels?: Partial<Record<string, string>>;
478
+ /** Force the entry point, ignoring the Center default. */
479
+ defaultEntry?: EntryMode;
480
+ /** Show the by-activity / by-date toggle (default true). */
481
+ showEntryToggle?: boolean;
464
482
  className?: string;
465
483
  }
466
484
  /**
@@ -470,7 +488,7 @@ interface BookingCatalogProps {
470
488
  * binding prices come from the per-category previews after login. Must render
471
489
  * inside a `<BowlosProvider>`; theme with `<BowlosTheme>`.
472
490
  */
473
- declare function BookingCatalog({ brandId, centerId, surface, onSelect, labels, sectionLabels, className, }: BookingCatalogProps): react_jsx_runtime.JSX.Element;
491
+ declare function BookingCatalog({ brandId, centerId, surface, onSelect, labels, sectionLabels, defaultEntry, showEntryToggle, className, }: BookingCatalogProps): react_jsx_runtime.JSX.Element;
474
492
 
475
493
  /**
476
494
  * Shared primitives for the `@bowlos/reservations/components` layer.
@@ -487,4 +505,4 @@ declare function formatCents(cents: number): string;
487
505
  /** A min–max money range, collapsing to one value when they're equal. */
488
506
  declare function formatCentsRange(minCents: number, maxCents: number): string;
489
507
 
490
- export { AccountDashboard, type AccountDashboardLabels, type AccountDashboardProps, AccountMenu, type AccountMenuLabels, type AccountMenuProps, type AccountSection, AuthForm, AuthGate, type AuthGateLabels, type AuthGateProps, type AuthGateRenderContext, BOWLOS_DEFAULT_THEME, BookingCatalog, type BookingCatalogLabels, type BookingCatalogProps, BookingFlow, type BookingFlowLabels, type BookingFlowProps, BowlosTheme, type BowlosThemeTokens, CatalogItem, 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 };
508
+ export { AccountDashboard, type AccountDashboardLabels, type AccountDashboardProps, AccountMenu, type AccountMenuLabels, type AccountMenuProps, type AccountSection, AuthForm, AuthGate, type AuthGateLabels, type AuthGateProps, type AuthGateRenderContext, BOWLOS_DEFAULT_THEME, BookingCatalog, type BookingCatalogLabels, type BookingCatalogProps, BookingFlow, type BookingFlowLabels, type BookingFlowProps, BowlosTheme, type BowlosThemeTokens, CatalogItem, type FlashBrand, FlashSale, FlashSaleIndex, type FlashSaleIndexItem, type FlashSaleIndexLabels, type FlashSaleIndexProps, type FlashSaleIndexView, type FlashSaleItem, type FlashSaleLabels, type FlashSaleProps, type FlashSaleView, MaintenanceBanner, type MaintenanceBannerProps, type MyCreditEntry, type MyCredits, type MyLoyalty, type MyMembershipSummary, type MyPass, type MyReservationSummary, formatCents, formatCentsRange };
@@ -1,10 +1,42 @@
1
- import { useAccount, useAvailability, useBookingPreview, useAddons, useStartTimes, useBookingFlow, useMyReservations, useMyMemberships, useMyLoyalty, useMyCredits, useMyPasses, useFlashSale, useFlashSales, useCatalog } from './chunk-CRETIPLS.js';
2
- import { availableUnitCount } from './chunk-S5T4OCBY.js';
3
- import { styles, formatCents, formatMinuteLabel, token, minutesToTime, useCountdown, formatCentsRange } from './chunk-Y3YSDO3H.js';
1
+ import { useTestMode, useAccount, useAvailability, useBookingPreview, useAddons, useStartTimes, useBookingFlow, useMyReservations, useMyMemberships, useMyLoyalty, useMyCredits, useMyPasses, useFlashSale, useFlashSales, useCatalog } from './chunk-7OHHK65Q.js';
2
+ import { availableUnitCount } from './chunk-5JWJBLPE.js';
3
+ import { token, styles, formatCents, formatMinuteLabel, minutesToTime, useCountdown, formatCentsRange } from './chunk-Y3YSDO3H.js';
4
4
  export { BOWLOS_DEFAULT_THEME, BowlosTheme, formatCents, formatCentsRange } from './chunk-Y3YSDO3H.js';
5
- import { useState, useEffect, useMemo, useRef } from 'react';
6
5
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
+ import { useState, useEffect, useMemo, useRef } from 'react';
7
7
 
8
+ var DEFAULT_MESSAGE = "We're performing maintenance \u2014 online booking is temporarily unavailable. Please check back soon.";
9
+ function MaintenanceBanner({
10
+ brandId,
11
+ centerId,
12
+ surface = "sdk_custom_site",
13
+ message,
14
+ className,
15
+ style
16
+ }) {
17
+ const { maintenanceMode } = useTestMode({ brandId, centerId, surface });
18
+ if (!maintenanceMode) return null;
19
+ return /* @__PURE__ */ jsx(
20
+ "div",
21
+ {
22
+ role: "status",
23
+ className,
24
+ style: {
25
+ fontFamily: token("fontFamily"),
26
+ color: token("colorText"),
27
+ background: token("colorBg"),
28
+ borderLeft: `4px solid ${token("colorPrimary")}`,
29
+ border: `1px solid ${token("colorBorder")}`,
30
+ borderLeftWidth: 4,
31
+ borderRadius: token("radius"),
32
+ padding: "0.75rem 1rem",
33
+ fontWeight: 600,
34
+ ...style
35
+ },
36
+ children: message ?? DEFAULT_MESSAGE
37
+ }
38
+ );
39
+ }
8
40
  var DEFAULT_LABELS = {
9
41
  signInHeading: "Sign in",
10
42
  signUpHeading: "Create your account",
@@ -827,8 +859,18 @@ var DEFAULT_LABELS7 = {
827
859
  heading: "What would you like to book?",
828
860
  loading: "Loading\u2026",
829
861
  empty: "Nothing is available to book online right now.",
830
- select: "Select"
862
+ select: "Select",
863
+ byActivity: "Browse by activity",
864
+ byDate: "Browse by date",
865
+ pickDay: "Pick a day",
866
+ bookableOnPrefix: "Bookable on ",
867
+ events: "Events",
868
+ anyDay: "Available any day",
869
+ noTimesThatDay: "No times this day",
870
+ nothingThatDay: "Nothing date-specific that day \u2014 try another date or see what's available any day.",
871
+ checking: "Checking\u2026"
831
872
  };
873
+ var DATE_BOUND_KEYS = ["bowling", "other_attractions"];
832
874
  function BookingCatalog({
833
875
  brandId,
834
876
  centerId,
@@ -836,45 +878,151 @@ function BookingCatalog({
836
878
  onSelect,
837
879
  labels,
838
880
  sectionLabels,
881
+ defaultEntry,
882
+ showEntryToggle = true,
839
883
  className
840
884
  }) {
841
885
  const t = { ...DEFAULT_LABELS7, ...labels };
842
886
  const s = styles();
843
887
  const catalog = useCatalog({ brandId, centerId, surface });
844
- const sections = (catalog.data?.sections ?? []).filter(
845
- (sec) => sec.items.length > 0
846
- );
888
+ const [modeOverride, setModeOverride] = useState(null);
889
+ const [date, setDate] = useState(null);
890
+ const sections = (catalog.data?.sections ?? []).filter((sec) => sec.items.length > 0);
891
+ const mode = modeOverride ?? defaultEntry ?? catalog.data?.bookingEntryDefault ?? "product_first";
892
+ const today = catalog.data?.todayISO ?? browserTodayISO();
893
+ const effDate = date ?? today;
894
+ const renderItemRow = (item, meta, disabled) => /* @__PURE__ */ jsxs("div", { style: { ...s.listItem, opacity: 1 }, children: [
895
+ /* @__PURE__ */ jsxs("div", { children: [
896
+ /* @__PURE__ */ jsx("p", { style: s.listTitle, children: item.title }),
897
+ /* @__PURE__ */ jsx("p", { style: s.listMeta, children: item.priceLabel ?? item.subtitle ?? "" })
898
+ ] }),
899
+ /* @__PURE__ */ jsx("button", { type: "button", style: s.primaryBtn, onClick: () => onSelect(item), children: t.select })
900
+ ] }, item.id);
847
901
  let body;
848
902
  if (catalog.loading && !catalog.data) {
849
903
  body = /* @__PURE__ */ jsx("p", { style: s.muted, children: t.loading });
850
904
  } else if (sections.length === 0) {
851
905
  body = /* @__PURE__ */ jsx("p", { style: s.muted, children: t.empty });
852
- } else {
853
- body = sections.map((sec) => /* @__PURE__ */ jsxs("section", { style: { marginTop: "0.5rem" }, children: [
854
- /* @__PURE__ */ jsx("h4", { style: s.sectionTitle, children: sectionLabels?.[sec.key] ?? sec.label }),
855
- sec.items.map((item) => /* @__PURE__ */ jsxs("div", { style: s.listItem, children: [
856
- /* @__PURE__ */ jsxs("div", { children: [
857
- /* @__PURE__ */ jsx("p", { style: s.listTitle, children: item.title }),
858
- /* @__PURE__ */ jsx("p", { style: s.listMeta, children: item.priceLabel ?? item.subtitle ?? "" })
859
- ] }),
906
+ } else if (mode === "date_first") {
907
+ const productItems = sections.filter((sec) => DATE_BOUND_KEYS.includes(sec.key)).flatMap((sec) => sec.items).filter((i) => i.action.type === "book_reservation");
908
+ const eventItems = sections.find((sec) => sec.key === "events")?.items ?? [];
909
+ const anytimeItems = sections.filter((sec) => !DATE_BOUND_KEYS.includes(sec.key) && sec.key !== "events").flatMap((sec) => sec.items);
910
+ body = /* @__PURE__ */ jsxs(Fragment, { children: [
911
+ /* @__PURE__ */ jsxs("label", { style: { display: "flex", flexDirection: "column", gap: "0.25rem", maxWidth: "16rem" }, children: [
912
+ /* @__PURE__ */ jsx("span", { style: s.listMeta, children: t.pickDay }),
860
913
  /* @__PURE__ */ jsx(
861
- "button",
914
+ "input",
862
915
  {
863
- type: "button",
864
- style: s.primaryBtn,
865
- onClick: () => onSelect(item),
866
- children: t.select
916
+ type: "date",
917
+ value: effDate,
918
+ min: today,
919
+ onChange: (e) => setDate(e.target.value || today),
920
+ style: s.input
867
921
  }
868
922
  )
869
- ] }, item.id))
923
+ ] }),
924
+ /* @__PURE__ */ jsxs("section", { style: { marginTop: "0.75rem" }, children: [
925
+ /* @__PURE__ */ jsxs("h4", { style: s.sectionTitle, children: [
926
+ t.bookableOnPrefix,
927
+ formatDay(effDate)
928
+ ] }),
929
+ productItems.length === 0 ? /* @__PURE__ */ jsx("p", { style: s.muted, children: t.nothingThatDay }) : productItems.map((item) => /* @__PURE__ */ jsx(
930
+ ProductDateRow,
931
+ {
932
+ item,
933
+ dateISO: effDate,
934
+ onSelect,
935
+ labels: t,
936
+ s
937
+ },
938
+ item.id
939
+ ))
940
+ ] }),
941
+ eventItems.length > 0 && /* @__PURE__ */ jsxs("section", { style: { marginTop: "0.5rem" }, children: [
942
+ /* @__PURE__ */ jsx("h4", { style: s.sectionTitle, children: t.events }),
943
+ eventItems.map((item) => renderItemRow(item))
944
+ ] }),
945
+ anytimeItems.length > 0 && /* @__PURE__ */ jsxs("section", { style: { marginTop: "0.5rem" }, children: [
946
+ /* @__PURE__ */ jsx("h4", { style: s.sectionTitle, children: t.anyDay }),
947
+ anytimeItems.map((item) => renderItemRow(item))
948
+ ] })
949
+ ] });
950
+ } else {
951
+ body = sections.map((sec) => /* @__PURE__ */ jsxs("section", { style: { marginTop: "0.5rem" }, children: [
952
+ /* @__PURE__ */ jsx("h4", { style: s.sectionTitle, children: sectionLabels?.[sec.key] ?? sec.label }),
953
+ sec.items.map((item) => renderItemRow(item))
870
954
  ] }, sec.key));
871
955
  }
872
956
  return /* @__PURE__ */ jsxs("div", { className, style: s.card, children: [
873
957
  /* @__PURE__ */ jsx("h3", { style: s.heading, children: t.heading }),
958
+ showEntryToggle && catalog.data && /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "0.5rem", marginBottom: "0.5rem" }, children: [
959
+ /* @__PURE__ */ jsx(EntryButton, { active: mode === "product_first", onClick: () => setModeOverride("product_first"), s, children: t.byActivity }),
960
+ /* @__PURE__ */ jsx(EntryButton, { active: mode === "date_first", onClick: () => setModeOverride("date_first"), s, children: t.byDate })
961
+ ] }),
874
962
  body
875
963
  ] });
876
964
  }
965
+ function EntryButton({
966
+ active,
967
+ onClick,
968
+ s,
969
+ children
970
+ }) {
971
+ return /* @__PURE__ */ jsx(
972
+ "button",
973
+ {
974
+ type: "button",
975
+ onClick,
976
+ "aria-pressed": active,
977
+ style: {
978
+ ...s.primaryBtn,
979
+ opacity: active ? 1 : 0.5,
980
+ cursor: "pointer"
981
+ },
982
+ children
983
+ }
984
+ );
985
+ }
986
+ function ProductDateRow({
987
+ item,
988
+ dateISO,
989
+ onSelect,
990
+ labels,
991
+ s
992
+ }) {
993
+ const productId = item.action.type === "book_reservation" ? item.action.payload.productId : "";
994
+ const times = useStartTimes(
995
+ { productId, dateISO },
996
+ { enabled: productId !== "" }
997
+ );
998
+ const loading = times.loading && times.data === null;
999
+ const available = (times.data?.length ?? 0) > 0;
1000
+ const meta = loading ? labels.checking : available ? item.priceLabel ?? "See times & pricing" : labels.noTimesThatDay;
1001
+ return /* @__PURE__ */ jsxs("div", { style: { ...s.listItem, opacity: !loading && !available ? 0.55 : 1 }, children: [
1002
+ /* @__PURE__ */ jsxs("div", { children: [
1003
+ /* @__PURE__ */ jsx("p", { style: s.listTitle, children: item.title }),
1004
+ /* @__PURE__ */ jsx("p", { style: s.listMeta, children: meta })
1005
+ ] }),
1006
+ available && /* @__PURE__ */ jsx("button", { type: "button", style: s.primaryBtn, onClick: () => onSelect(item), children: labels.select })
1007
+ ] });
1008
+ }
1009
+ function browserTodayISO() {
1010
+ const d = /* @__PURE__ */ new Date();
1011
+ return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(
1012
+ d.getDate()
1013
+ ).padStart(2, "0")}`;
1014
+ }
1015
+ function formatDay(iso) {
1016
+ const [y, m, d] = iso.split("-").map(Number);
1017
+ if (!y || !m || !d) return iso;
1018
+ return new Date(Date.UTC(y, m - 1, d)).toLocaleDateString(void 0, {
1019
+ weekday: "long",
1020
+ month: "long",
1021
+ day: "numeric",
1022
+ timeZone: "UTC"
1023
+ });
1024
+ }
877
1025
 
878
- export { AccountDashboard, AccountMenu, AuthForm, AuthGate, BookingCatalog, BookingFlow, FlashSale, FlashSaleIndex };
1026
+ export { AccountDashboard, AccountMenu, AuthForm, AuthGate, BookingCatalog, BookingFlow, FlashSale, FlashSaleIndex, MaintenanceBanner };
879
1027
  //# sourceMappingURL=components.js.map
880
1028
  //# sourceMappingURL=components.js.map