@bowlos/reservations 0.6.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.
- package/README.md +22 -1
- package/dist/catalog-DBIisELC.d.ts +74 -0
- package/dist/catalog-DEwo88hz.d.cts +74 -0
- package/dist/{chunk-H42X4FRR.js → chunk-JBBWGMRT.js} +18 -3
- package/dist/chunk-JBBWGMRT.js.map +1 -0
- package/dist/components.cjs +114 -0
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +71 -1
- package/dist/components.d.ts +71 -1
- package/dist/components.js +100 -2
- package/dist/components.js.map +1 -1
- package/dist/index.cjs +26 -0
- 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 +21 -1
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +20 -0
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +12 -2
- package/dist/react.d.ts +12 -2
- package/dist/react.js +1 -1
- package/package.json +1 -1
- package/templates/center-site/app/book/page.tsx +23 -22
- package/templates/center-site/app/buy/page.tsx +36 -0
- package/templates/center-site/app/catalog/page.tsx +35 -0
- package/templates/center-site/app/site-header.tsx +1 -1
- package/templates/center-site/package.json +1 -1
- package/dist/account-BRapzoNI.d.cts +0 -46
- package/dist/account-VO6BzPNK.d.ts +0 -46
- package/dist/chunk-H42X4FRR.js.map +0 -1
package/dist/components.d.cts
CHANGED
|
@@ -412,6 +412,76 @@ interface FlashSaleIndexProps {
|
|
|
412
412
|
*/
|
|
413
413
|
declare function FlashSaleIndex({ brandId, onOpen, labels, className }: FlashSaleIndexProps): react_jsx_runtime.JSX.Element;
|
|
414
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
|
+
|
|
415
485
|
/**
|
|
416
486
|
* Shared primitives for the `@bowlos/reservations/components` layer.
|
|
417
487
|
*
|
|
@@ -427,4 +497,4 @@ declare function formatCents(cents: number): string;
|
|
|
427
497
|
/** A min–max money range, collapsing to one value when they're equal. */
|
|
428
498
|
declare function formatCentsRange(minCents: number, maxCents: number): string;
|
|
429
499
|
|
|
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 };
|
|
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 };
|
package/dist/components.d.ts
CHANGED
|
@@ -412,6 +412,76 @@ interface FlashSaleIndexProps {
|
|
|
412
412
|
*/
|
|
413
413
|
declare function FlashSaleIndex({ brandId, onOpen, labels, className }: FlashSaleIndexProps): react_jsx_runtime.JSX.Element;
|
|
414
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
|
+
|
|
415
485
|
/**
|
|
416
486
|
* Shared primitives for the `@bowlos/reservations/components` layer.
|
|
417
487
|
*
|
|
@@ -427,4 +497,4 @@ declare function formatCents(cents: number): string;
|
|
|
427
497
|
/** A min–max money range, collapsing to one value when they're equal. */
|
|
428
498
|
declare function formatCentsRange(minCents: number, maxCents: number): string;
|
|
429
499
|
|
|
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 };
|
|
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 };
|
package/dist/components.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useAccount, useAvailability, useBookingPreview, useBookingFlow, useMyReservations, useMyMemberships, useMyLoyalty, useMyCredits, useMyPasses, useFlashSale, useFlashSales } from './chunk-
|
|
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';
|
|
@@ -874,7 +874,105 @@ function When({ ms }) {
|
|
|
874
874
|
}, [ms]);
|
|
875
875
|
return /* @__PURE__ */ jsx(Fragment, { children: text ?? "" });
|
|
876
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
|
+
}
|
|
877
975
|
|
|
878
|
-
export { AccountDashboard, AccountMenu, AuthForm, AuthGate, BOWLOS_DEFAULT_THEME, BookingFlow, BowlosTheme, FlashSale, FlashSaleIndex, formatCents, formatCentsRange };
|
|
976
|
+
export { AccountDashboard, AccountMenu, AuthForm, AuthGate, BOWLOS_DEFAULT_THEME, BookingCatalog, BookingFlow, BowlosTheme, FlashSale, FlashSaleIndex, formatCents, formatCentsRange };
|
|
879
977
|
//# sourceMappingURL=components.js.map
|
|
880
978
|
//# sourceMappingURL=components.js.map
|