@bowlos/reservations 0.21.0 → 0.22.1
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/HEADLESS.md +51 -4
- package/README.md +23 -16
- package/dist/account-Bm2XnaYS.d.ts +90 -0
- package/dist/account-CSaBohMT.d.cts +90 -0
- package/dist/{catalog-bpCn9klL.d.ts → catalog-BxyPJdBL.d.ts} +49 -47
- package/dist/{catalog-BuafmB8y.d.cts → catalog-D1VoVaNe.d.cts} +49 -47
- package/dist/components.cjs +32 -96
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +35 -62
- package/dist/components.d.ts +35 -62
- package/dist/components.js +31 -83
- package/dist/components.js.map +1 -1
- package/dist/index.cjs +6 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/payments.cjs +9 -1
- package/dist/payments.cjs.map +1 -1
- package/dist/payments.js +9 -1
- package/dist/payments.js.map +1 -1
- package/dist/{react-BI2RKM5p.d.ts → react-B1uSOozS.d.ts} +1 -1
- package/dist/{react-D2mBw_-l.d.cts → react-Bc_6yi9q.d.cts} +1 -1
- package/dist/react.d.cts +4 -4
- package/dist/react.d.ts +4 -4
- package/package.json +2 -2
- package/templates/center-site/package.json +1 -1
- package/dist/errors-IIK7xibp.d.cts +0 -54
- package/dist/errors-IIK7xibp.d.ts +0 -54
package/dist/components.cjs
CHANGED
|
@@ -170,20 +170,8 @@ function useFlashSale(args, options) {
|
|
|
170
170
|
function useFlashSales(args, options) {
|
|
171
171
|
return useBowlosQuery("listPublicFlashSales", args, options);
|
|
172
172
|
}
|
|
173
|
-
function
|
|
174
|
-
return useBowlosQuery("
|
|
175
|
-
}
|
|
176
|
-
function useEventOffers(args, options) {
|
|
177
|
-
return useBowlosQuery("listPublicEventOffers", args, options);
|
|
178
|
-
}
|
|
179
|
-
function usePackages(args, options) {
|
|
180
|
-
return useBowlosQuery("listPublicPackages", args, options);
|
|
181
|
-
}
|
|
182
|
-
function usePublicMemberships(args, options) {
|
|
183
|
-
return useBowlosQuery("listPublicMemberships", args, options);
|
|
184
|
-
}
|
|
185
|
-
function useGameCards(args, options) {
|
|
186
|
-
return useBowlosQuery("listPublicGameCards", args, options);
|
|
173
|
+
function useCatalog(args, options) {
|
|
174
|
+
return useBowlosQuery("listPublicCatalog", args, options);
|
|
187
175
|
}
|
|
188
176
|
|
|
189
177
|
// src/data.ts
|
|
@@ -1373,105 +1361,53 @@ var DEFAULT_LABELS7 = {
|
|
|
1373
1361
|
heading: "What would you like to book?",
|
|
1374
1362
|
loading: "Loading\u2026",
|
|
1375
1363
|
empty: "Nothing is available to book online right now.",
|
|
1376
|
-
|
|
1377
|
-
otherAttractions: "Other attractions",
|
|
1378
|
-
events: "Events",
|
|
1379
|
-
packages: "Packages",
|
|
1380
|
-
memberships: "Memberships",
|
|
1381
|
-
gamePasses: "Game passes",
|
|
1382
|
-
select: "Select",
|
|
1383
|
-
minutesAbbrev: "min",
|
|
1384
|
-
perMonth: "/mo"
|
|
1364
|
+
select: "Select"
|
|
1385
1365
|
};
|
|
1386
|
-
function BookingCatalog({
|
|
1366
|
+
function BookingCatalog({
|
|
1367
|
+
brandId,
|
|
1368
|
+
centerId,
|
|
1369
|
+
surface = "sdk_custom_site",
|
|
1370
|
+
onSelect,
|
|
1371
|
+
labels,
|
|
1372
|
+
sectionLabels,
|
|
1373
|
+
className
|
|
1374
|
+
}) {
|
|
1387
1375
|
const t = { ...DEFAULT_LABELS7, ...labels };
|
|
1388
1376
|
const s = styles();
|
|
1389
|
-
const
|
|
1390
|
-
const
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
const gameCards = useGameCards({ brandId, centerId });
|
|
1394
|
-
const reads = [products, events, packages, memberships, gameCards];
|
|
1395
|
-
const anyLoading = reads.some((r) => r.loading && !r.data);
|
|
1396
|
-
const productRows = products.data ?? [];
|
|
1397
|
-
const bowling = productRows.filter((p) => p.attractionTypeKey === "bowling").map((p) => ({ kind: "product", ...p }));
|
|
1398
|
-
const other = productRows.filter((p) => p.attractionTypeKey !== "bowling").map((p) => ({ kind: "product", ...p }));
|
|
1399
|
-
const eventOffers = (events.data ?? []).map((e) => ({
|
|
1400
|
-
kind: "event",
|
|
1401
|
-
id: e.id,
|
|
1402
|
-
slug: e.slug,
|
|
1403
|
-
name: e.title,
|
|
1404
|
-
date: e.date,
|
|
1405
|
-
description: e.subtitle ?? e.description,
|
|
1406
|
-
purchaseMode: e.purchaseMode,
|
|
1407
|
-
productId: e.productId,
|
|
1408
|
-
pricePlanId: e.pricePlanId,
|
|
1409
|
-
priceCents: e.priceCents
|
|
1410
|
-
}));
|
|
1411
|
-
const packageOffers = (packages.data ?? []).map((p) => ({
|
|
1412
|
-
kind: "package",
|
|
1413
|
-
id: p.id,
|
|
1414
|
-
name: p.name,
|
|
1415
|
-
priceCents: p.basePriceCents,
|
|
1416
|
-
description: p.description
|
|
1417
|
-
}));
|
|
1418
|
-
const membershipOffers = (memberships.data ?? []).map((m) => ({
|
|
1419
|
-
kind: "membership",
|
|
1420
|
-
id: m.id,
|
|
1421
|
-
name: m.name,
|
|
1422
|
-
priceCents: m.recurringPriceCents,
|
|
1423
|
-
description: m.description
|
|
1424
|
-
}));
|
|
1425
|
-
const gameCardOffers = (gameCards.data ?? []).map((g) => ({
|
|
1426
|
-
kind: "gamecard",
|
|
1427
|
-
id: g.id,
|
|
1428
|
-
name: g.name,
|
|
1429
|
-
priceCents: g.priceCents,
|
|
1430
|
-
description: g.description
|
|
1431
|
-
}));
|
|
1432
|
-
const sections = [
|
|
1433
|
-
{ title: t.bowling, offers: bowling },
|
|
1434
|
-
{ title: t.otherAttractions, offers: other },
|
|
1435
|
-
{ title: t.events, offers: eventOffers },
|
|
1436
|
-
{ title: t.packages, offers: packageOffers },
|
|
1437
|
-
{ title: t.memberships, offers: membershipOffers },
|
|
1438
|
-
{ title: t.gamePasses, offers: gameCardOffers }
|
|
1439
|
-
].filter((sec) => sec.offers.length > 0);
|
|
1377
|
+
const catalog = useCatalog({ brandId, centerId, surface });
|
|
1378
|
+
const sections = (catalog.data?.sections ?? []).filter(
|
|
1379
|
+
(sec) => sec.items.length > 0
|
|
1380
|
+
);
|
|
1440
1381
|
let body;
|
|
1441
|
-
if (
|
|
1382
|
+
if (catalog.loading && !catalog.data) {
|
|
1442
1383
|
body = /* @__PURE__ */ jsxRuntime.jsx("p", { style: s.muted, children: t.loading });
|
|
1443
1384
|
} else if (sections.length === 0) {
|
|
1444
1385
|
body = /* @__PURE__ */ jsxRuntime.jsx("p", { style: s.muted, children: t.empty });
|
|
1445
1386
|
} else {
|
|
1446
1387
|
body = sections.map((sec) => /* @__PURE__ */ jsxRuntime.jsxs("section", { style: { marginTop: "0.5rem" }, children: [
|
|
1447
|
-
/* @__PURE__ */ jsxRuntime.jsx("h4", { style: s.sectionTitle, children: sec.
|
|
1448
|
-
sec.
|
|
1388
|
+
/* @__PURE__ */ jsxRuntime.jsx("h4", { style: s.sectionTitle, children: sectionLabels?.[sec.key] ?? sec.label }),
|
|
1389
|
+
sec.items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.listItem, children: [
|
|
1449
1390
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1450
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { style: s.listTitle, children:
|
|
1451
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { style: s.listMeta, children: subtitle
|
|
1391
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { style: s.listTitle, children: item.title }),
|
|
1392
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { style: s.listMeta, children: item.priceLabel ?? item.subtitle ?? "" })
|
|
1452
1393
|
] }),
|
|
1453
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1454
|
-
|
|
1455
|
-
|
|
1394
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1395
|
+
"button",
|
|
1396
|
+
{
|
|
1397
|
+
type: "button",
|
|
1398
|
+
style: s.primaryBtn,
|
|
1399
|
+
onClick: () => onSelect(item),
|
|
1400
|
+
children: t.select
|
|
1401
|
+
}
|
|
1402
|
+
)
|
|
1403
|
+
] }, item.id))
|
|
1404
|
+
] }, sec.key));
|
|
1456
1405
|
}
|
|
1457
1406
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, style: s.card, children: [
|
|
1458
1407
|
/* @__PURE__ */ jsxRuntime.jsx("h3", { style: s.heading, children: t.heading }),
|
|
1459
1408
|
body
|
|
1460
1409
|
] });
|
|
1461
1410
|
}
|
|
1462
|
-
function subtitle(offer, t) {
|
|
1463
|
-
switch (offer.kind) {
|
|
1464
|
-
case "product":
|
|
1465
|
-
return `${offer.attractionName} \xB7 ${offer.durationMinutes} ${t.minutesAbbrev}`;
|
|
1466
|
-
case "event":
|
|
1467
|
-
return offer.priceCents !== null ? `${offer.date} \xB7 ${formatCents(offer.priceCents)}` : offer.date;
|
|
1468
|
-
case "membership":
|
|
1469
|
-
return `${formatCents(offer.priceCents)}${t.perMonth}`;
|
|
1470
|
-
case "package":
|
|
1471
|
-
case "gamecard":
|
|
1472
|
-
return formatCents(offer.priceCents);
|
|
1473
|
-
}
|
|
1474
|
-
}
|
|
1475
1411
|
|
|
1476
1412
|
exports.AccountDashboard = AccountDashboard;
|
|
1477
1413
|
exports.AccountMenu = AccountMenu;
|