@bowlos/reservations 0.5.0 → 0.7.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.
@@ -369,6 +369,119 @@ interface FlashSaleProps {
369
369
  */
370
370
  declare function FlashSale({ slug, onBook, labels, className }: FlashSaleProps): react_jsx_runtime.JSX.Element;
371
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
+
415
+ /** A selectable offer, tagged by kind so the consumer can route it. */
416
+ type CatalogOffer = {
417
+ kind: "product";
418
+ id: string;
419
+ name: string;
420
+ attractionName: string;
421
+ attractionTypeKey: string;
422
+ durationMinutes: number;
423
+ pricingMode: string;
424
+ } | {
425
+ kind: "event";
426
+ id: string;
427
+ name: string;
428
+ date: string;
429
+ description: string | null;
430
+ } | {
431
+ kind: "package";
432
+ id: string;
433
+ name: string;
434
+ priceCents: number;
435
+ description: string | null;
436
+ } | {
437
+ kind: "membership";
438
+ id: string;
439
+ name: string;
440
+ priceCents: number;
441
+ description: string | null;
442
+ } | {
443
+ kind: "gamecard";
444
+ id: string;
445
+ name: string;
446
+ priceCents: number;
447
+ description: string | null;
448
+ };
449
+ interface BookingCatalogLabels {
450
+ heading: string;
451
+ loading: string;
452
+ empty: string;
453
+ bowling: string;
454
+ otherAttractions: string;
455
+ events: string;
456
+ packages: string;
457
+ memberships: string;
458
+ gamePasses: string;
459
+ select: string;
460
+ minutesAbbrev: string;
461
+ perMonth: string;
462
+ }
463
+ interface BookingCatalogProps {
464
+ /** Brand (packages + game passes) and Center (products + events + memberships). */
465
+ brandId: string;
466
+ centerId: string;
467
+ /**
468
+ * Called when a customer picks an offer. Route by `offer.kind`: a `product`
469
+ * or `event` → your `<BookingFlow>` (preset the event's date); a `package` /
470
+ * `membership` / `gamecard` → its buy page.
471
+ */
472
+ onSelect: (offer: CatalogOffer) => void;
473
+ labels?: Partial<BookingCatalogLabels>;
474
+ className?: string;
475
+ }
476
+ /**
477
+ * The categorized catalog of everything a Center sells online — Bowling, Other
478
+ * attractions, Events, Packages, Memberships, Game passes — each offer under its
479
+ * heading. Picking one hands off via `onSelect`. No prices cross the wire for
480
+ * gated surfaces; this only lists public offers. Must render inside a
481
+ * `<BowlosProvider>`; theme with `<BowlosTheme>`.
482
+ */
483
+ declare function BookingCatalog({ brandId, centerId, onSelect, labels, className }: BookingCatalogProps): react_jsx_runtime.JSX.Element;
484
+
372
485
  /**
373
486
  * Shared primitives for the `@bowlos/reservations/components` layer.
374
487
  *
@@ -384,4 +497,4 @@ declare function formatCents(cents: number): string;
384
497
  /** A min–max money range, collapsing to one value when they're equal. */
385
498
  declare function formatCentsRange(minCents: number, maxCents: number): string;
386
499
 
387
- 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, type FlashSaleItem, type FlashSaleLabels, type FlashSaleProps, type FlashSaleView, type MyCreditEntry, type MyCredits, type MyLoyalty, type MyMembershipSummary, type MyPass, type MyReservationSummary, formatCents, formatCentsRange };
500
+ 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, type CatalogOffer, 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 };
@@ -369,6 +369,119 @@ interface FlashSaleProps {
369
369
  */
370
370
  declare function FlashSale({ slug, onBook, labels, className }: FlashSaleProps): react_jsx_runtime.JSX.Element;
371
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
+
415
+ /** A selectable offer, tagged by kind so the consumer can route it. */
416
+ type CatalogOffer = {
417
+ kind: "product";
418
+ id: string;
419
+ name: string;
420
+ attractionName: string;
421
+ attractionTypeKey: string;
422
+ durationMinutes: number;
423
+ pricingMode: string;
424
+ } | {
425
+ kind: "event";
426
+ id: string;
427
+ name: string;
428
+ date: string;
429
+ description: string | null;
430
+ } | {
431
+ kind: "package";
432
+ id: string;
433
+ name: string;
434
+ priceCents: number;
435
+ description: string | null;
436
+ } | {
437
+ kind: "membership";
438
+ id: string;
439
+ name: string;
440
+ priceCents: number;
441
+ description: string | null;
442
+ } | {
443
+ kind: "gamecard";
444
+ id: string;
445
+ name: string;
446
+ priceCents: number;
447
+ description: string | null;
448
+ };
449
+ interface BookingCatalogLabels {
450
+ heading: string;
451
+ loading: string;
452
+ empty: string;
453
+ bowling: string;
454
+ otherAttractions: string;
455
+ events: string;
456
+ packages: string;
457
+ memberships: string;
458
+ gamePasses: string;
459
+ select: string;
460
+ minutesAbbrev: string;
461
+ perMonth: string;
462
+ }
463
+ interface BookingCatalogProps {
464
+ /** Brand (packages + game passes) and Center (products + events + memberships). */
465
+ brandId: string;
466
+ centerId: string;
467
+ /**
468
+ * Called when a customer picks an offer. Route by `offer.kind`: a `product`
469
+ * or `event` → your `<BookingFlow>` (preset the event's date); a `package` /
470
+ * `membership` / `gamecard` → its buy page.
471
+ */
472
+ onSelect: (offer: CatalogOffer) => void;
473
+ labels?: Partial<BookingCatalogLabels>;
474
+ className?: string;
475
+ }
476
+ /**
477
+ * The categorized catalog of everything a Center sells online — Bowling, Other
478
+ * attractions, Events, Packages, Memberships, Game passes — each offer under its
479
+ * heading. Picking one hands off via `onSelect`. No prices cross the wire for
480
+ * gated surfaces; this only lists public offers. Must render inside a
481
+ * `<BowlosProvider>`; theme with `<BowlosTheme>`.
482
+ */
483
+ declare function BookingCatalog({ brandId, centerId, onSelect, labels, className }: BookingCatalogProps): react_jsx_runtime.JSX.Element;
484
+
372
485
  /**
373
486
  * Shared primitives for the `@bowlos/reservations/components` layer.
374
487
  *
@@ -384,4 +497,4 @@ declare function formatCents(cents: number): string;
384
497
  /** A min–max money range, collapsing to one value when they're equal. */
385
498
  declare function formatCentsRange(minCents: number, maxCents: number): string;
386
499
 
387
- 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, type FlashSaleItem, type FlashSaleLabels, type FlashSaleProps, type FlashSaleView, type MyCreditEntry, type MyCredits, type MyLoyalty, type MyMembershipSummary, type MyPass, type MyReservationSummary, formatCents, formatCentsRange };
500
+ 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, type CatalogOffer, 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 };
@@ -1,4 +1,4 @@
1
- import { useAccount, useAvailability, useBookingPreview, useBookingFlow, useMyReservations, useMyMemberships, useMyLoyalty, useMyCredits, useMyPasses, useFlashSale } from './chunk-E5KVVXSJ.js';
1
+ import { useAccount, useAvailability, useBookingPreview, useBookingFlow, useMyReservations, useMyMemberships, useMyLoyalty, useMyCredits, useMyPasses, useFlashSale, useFlashSales, useProducts, useEvents, usePackages, usePublicMemberships, useGameCards } from './chunk-JBBWGMRT.js';
2
2
  import { availableUnitCount } from './chunk-YICHFUAY.js';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import { useState, useRef, useEffect, useMemo } from 'react';
@@ -828,7 +828,151 @@ function Hero({
828
828
  description && /* @__PURE__ */ jsx("p", { style: s.body, children: description })
829
829
  ] });
830
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
+ }
877
+ var DEFAULT_LABELS7 = {
878
+ heading: "What would you like to book?",
879
+ loading: "Loading\u2026",
880
+ empty: "Nothing is available to book online right now.",
881
+ bowling: "Bowling",
882
+ otherAttractions: "Other attractions",
883
+ events: "Events",
884
+ packages: "Packages",
885
+ memberships: "Memberships",
886
+ gamePasses: "Game passes",
887
+ select: "Select",
888
+ minutesAbbrev: "min",
889
+ perMonth: "/mo"
890
+ };
891
+ function BookingCatalog({ brandId, centerId, onSelect, labels, className }) {
892
+ const t = { ...DEFAULT_LABELS7, ...labels };
893
+ const s = styles();
894
+ const products = useProducts({ centerId });
895
+ const events = useEvents({ centerId });
896
+ const packages = usePackages({ brandId, centerId });
897
+ const memberships = usePublicMemberships({ centerId });
898
+ const gameCards = useGameCards({ brandId, centerId });
899
+ const reads = [products, events, packages, memberships, gameCards];
900
+ const anyLoading = reads.some((r) => r.loading && !r.data);
901
+ const productRows = products.data ?? [];
902
+ const bowling = productRows.filter((p) => p.attractionTypeKey === "bowling").map((p) => ({ kind: "product", ...p }));
903
+ const other = productRows.filter((p) => p.attractionTypeKey !== "bowling").map((p) => ({ kind: "product", ...p }));
904
+ const eventOffers = (events.data ?? []).map((e) => ({
905
+ kind: "event",
906
+ id: e.id,
907
+ name: e.name,
908
+ date: e.date,
909
+ description: e.description
910
+ }));
911
+ const packageOffers = (packages.data ?? []).map((p) => ({
912
+ kind: "package",
913
+ id: p.id,
914
+ name: p.name,
915
+ priceCents: p.basePriceCents,
916
+ description: p.description
917
+ }));
918
+ const membershipOffers = (memberships.data ?? []).map((m) => ({
919
+ kind: "membership",
920
+ id: m.id,
921
+ name: m.name,
922
+ priceCents: m.recurringPriceCents,
923
+ description: m.description
924
+ }));
925
+ const gameCardOffers = (gameCards.data ?? []).map((g) => ({
926
+ kind: "gamecard",
927
+ id: g.id,
928
+ name: g.name,
929
+ priceCents: g.priceCents,
930
+ description: g.description
931
+ }));
932
+ const sections = [
933
+ { title: t.bowling, offers: bowling },
934
+ { title: t.otherAttractions, offers: other },
935
+ { title: t.events, offers: eventOffers },
936
+ { title: t.packages, offers: packageOffers },
937
+ { title: t.memberships, offers: membershipOffers },
938
+ { title: t.gamePasses, offers: gameCardOffers }
939
+ ].filter((sec) => sec.offers.length > 0);
940
+ let body;
941
+ if (anyLoading) {
942
+ body = /* @__PURE__ */ jsx("p", { style: s.muted, children: t.loading });
943
+ } else if (sections.length === 0) {
944
+ body = /* @__PURE__ */ jsx("p", { style: s.muted, children: t.empty });
945
+ } else {
946
+ body = sections.map((sec) => /* @__PURE__ */ jsxs("section", { style: { marginTop: "0.5rem" }, children: [
947
+ /* @__PURE__ */ jsx("h4", { style: s.sectionTitle, children: sec.title }),
948
+ sec.offers.map((offer) => /* @__PURE__ */ jsxs("div", { style: s.listItem, children: [
949
+ /* @__PURE__ */ jsxs("div", { children: [
950
+ /* @__PURE__ */ jsx("p", { style: s.listTitle, children: offer.name }),
951
+ /* @__PURE__ */ jsx("p", { style: s.listMeta, children: subtitle(offer, t) })
952
+ ] }),
953
+ /* @__PURE__ */ jsx("button", { type: "button", style: s.primaryBtn, onClick: () => onSelect(offer), children: t.select })
954
+ ] }, `${offer.kind}:${offer.id}`))
955
+ ] }, sec.title));
956
+ }
957
+ return /* @__PURE__ */ jsxs("div", { className, style: s.card, children: [
958
+ /* @__PURE__ */ jsx("h3", { style: s.heading, children: t.heading }),
959
+ body
960
+ ] });
961
+ }
962
+ function subtitle(offer, t) {
963
+ switch (offer.kind) {
964
+ case "product":
965
+ return `${offer.attractionName} \xB7 ${offer.durationMinutes} ${t.minutesAbbrev}`;
966
+ case "event":
967
+ return offer.date;
968
+ case "membership":
969
+ return `${formatCents(offer.priceCents)}${t.perMonth}`;
970
+ case "package":
971
+ case "gamecard":
972
+ return formatCents(offer.priceCents);
973
+ }
974
+ }
831
975
 
832
- export { AccountDashboard, AccountMenu, AuthForm, AuthGate, BOWLOS_DEFAULT_THEME, BookingFlow, BowlosTheme, FlashSale, formatCents, formatCentsRange };
976
+ export { AccountDashboard, AccountMenu, AuthForm, AuthGate, BOWLOS_DEFAULT_THEME, BookingCatalog, BookingFlow, BowlosTheme, FlashSale, FlashSaleIndex, formatCents, formatCentsRange };
833
977
  //# sourceMappingURL=components.js.map
834
978
  //# sourceMappingURL=components.js.map