@bowlos/reservations 0.20.0 → 0.22.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/HEADLESS.md +205 -6
- package/README.md +24 -10
- package/dist/account-CO8xzUs_.d.ts +54 -0
- package/dist/account-SqT7et4C.d.cts +54 -0
- package/dist/catalog-BxyPJdBL.d.ts +160 -0
- package/dist/catalog-D1VoVaNe.d.cts +160 -0
- package/dist/{chunk-3GAXATYP.js → chunk-FV6SROO2.js} +22 -4
- package/dist/chunk-FV6SROO2.js.map +1 -0
- package/dist/{chunk-32FTBLXQ.js → chunk-S5T4OCBY.js} +25 -3
- package/dist/chunk-S5T4OCBY.js.map +1 -0
- package/dist/components.cjs +32 -91
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +36 -57
- package/dist/components.d.ts +36 -57
- package/dist/components.js +32 -79
- package/dist/components.js.map +1 -1
- package/dist/{data-ymW_rWbz.d.cts → data-BKlgn8Ln.d.cts} +72 -1
- package/dist/{data-ymW_rWbz.d.ts → data-BKlgn8Ln.d.ts} +72 -1
- package/dist/index.cjs +45 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +18 -3
- package/dist/index.js.map +1 -1
- package/dist/payments.d.cts +1 -1
- package/dist/payments.d.ts +1 -1
- package/dist/{react-Bh0z-Lnb.d.ts → react-B1uSOozS.d.ts} +2 -2
- package/dist/{react-DHvo_ZHf.d.cts → react-Bc_6yi9q.d.cts} +2 -2
- package/dist/react.cjs +73 -0
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +36 -6
- package/dist/react.d.ts +36 -6
- package/dist/react.js +37 -4
- package/dist/react.js.map +1 -1
- package/package.json +2 -2
- package/templates/center-site/package.json +1 -1
- package/dist/catalog-BGPCoIOm.d.ts +0 -93
- package/dist/catalog-eofYl46p.d.cts +0 -93
- package/dist/chunk-32FTBLXQ.js.map +0 -1
- package/dist/chunk-3GAXATYP.js.map +0 -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 useEvents(args, options) {
|
|
177
|
-
return useBowlosQuery("listPublicEvents", 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,100 +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
|
-
name: e.name,
|
|
1403
|
-
date: e.date,
|
|
1404
|
-
description: e.description
|
|
1405
|
-
}));
|
|
1406
|
-
const packageOffers = (packages.data ?? []).map((p) => ({
|
|
1407
|
-
kind: "package",
|
|
1408
|
-
id: p.id,
|
|
1409
|
-
name: p.name,
|
|
1410
|
-
priceCents: p.basePriceCents,
|
|
1411
|
-
description: p.description
|
|
1412
|
-
}));
|
|
1413
|
-
const membershipOffers = (memberships.data ?? []).map((m) => ({
|
|
1414
|
-
kind: "membership",
|
|
1415
|
-
id: m.id,
|
|
1416
|
-
name: m.name,
|
|
1417
|
-
priceCents: m.recurringPriceCents,
|
|
1418
|
-
description: m.description
|
|
1419
|
-
}));
|
|
1420
|
-
const gameCardOffers = (gameCards.data ?? []).map((g) => ({
|
|
1421
|
-
kind: "gamecard",
|
|
1422
|
-
id: g.id,
|
|
1423
|
-
name: g.name,
|
|
1424
|
-
priceCents: g.priceCents,
|
|
1425
|
-
description: g.description
|
|
1426
|
-
}));
|
|
1427
|
-
const sections = [
|
|
1428
|
-
{ title: t.bowling, offers: bowling },
|
|
1429
|
-
{ title: t.otherAttractions, offers: other },
|
|
1430
|
-
{ title: t.events, offers: eventOffers },
|
|
1431
|
-
{ title: t.packages, offers: packageOffers },
|
|
1432
|
-
{ title: t.memberships, offers: membershipOffers },
|
|
1433
|
-
{ title: t.gamePasses, offers: gameCardOffers }
|
|
1434
|
-
].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
|
+
);
|
|
1435
1381
|
let body;
|
|
1436
|
-
if (
|
|
1382
|
+
if (catalog.loading && !catalog.data) {
|
|
1437
1383
|
body = /* @__PURE__ */ jsxRuntime.jsx("p", { style: s.muted, children: t.loading });
|
|
1438
1384
|
} else if (sections.length === 0) {
|
|
1439
1385
|
body = /* @__PURE__ */ jsxRuntime.jsx("p", { style: s.muted, children: t.empty });
|
|
1440
1386
|
} else {
|
|
1441
1387
|
body = sections.map((sec) => /* @__PURE__ */ jsxRuntime.jsxs("section", { style: { marginTop: "0.5rem" }, children: [
|
|
1442
|
-
/* @__PURE__ */ jsxRuntime.jsx("h4", { style: s.sectionTitle, children: sec.
|
|
1443
|
-
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: [
|
|
1444
1390
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1445
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { style: s.listTitle, children:
|
|
1446
|
-
/* @__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 ?? "" })
|
|
1447
1393
|
] }),
|
|
1448
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1449
|
-
|
|
1450
|
-
|
|
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));
|
|
1451
1405
|
}
|
|
1452
1406
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, style: s.card, children: [
|
|
1453
1407
|
/* @__PURE__ */ jsxRuntime.jsx("h3", { style: s.heading, children: t.heading }),
|
|
1454
1408
|
body
|
|
1455
1409
|
] });
|
|
1456
1410
|
}
|
|
1457
|
-
function subtitle(offer, t) {
|
|
1458
|
-
switch (offer.kind) {
|
|
1459
|
-
case "product":
|
|
1460
|
-
return `${offer.attractionName} \xB7 ${offer.durationMinutes} ${t.minutesAbbrev}`;
|
|
1461
|
-
case "event":
|
|
1462
|
-
return offer.date;
|
|
1463
|
-
case "membership":
|
|
1464
|
-
return `${formatCents(offer.priceCents)}${t.perMonth}`;
|
|
1465
|
-
case "package":
|
|
1466
|
-
case "gamecard":
|
|
1467
|
-
return formatCents(offer.priceCents);
|
|
1468
|
-
}
|
|
1469
|
-
}
|
|
1470
1411
|
|
|
1471
1412
|
exports.AccountDashboard = AccountDashboard;
|
|
1472
1413
|
exports.AccountMenu = AccountMenu;
|