@bowlos/reservations 0.34.0 → 0.36.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 (43) hide show
  1. package/HEADLESS.md +196 -2
  2. package/README.md +130 -0
  3. package/dist/{account-CsCusw5Z.d.ts → account-DfM2COaz.d.ts} +47 -2
  4. package/dist/{account-Di8nktqp.d.cts → account-oCvYWmO9.d.cts} +47 -2
  5. package/dist/{catalog-DdvLcOrs.d.cts → catalog-DbhdwmnX.d.cts} +4 -1
  6. package/dist/{catalog-DT-ePirK.d.ts → catalog-XkjgPI5C.d.ts} +4 -1
  7. package/dist/{chunk-GIAJQPMM.js → chunk-3JSVEOKG.js} +8 -4
  8. package/dist/chunk-3JSVEOKG.js.map +1 -0
  9. package/dist/{chunk-CAXGTKJQ.js → chunk-TEHRROVY.js} +37 -4
  10. package/dist/chunk-TEHRROVY.js.map +1 -0
  11. package/dist/{chunk-EQH5HDYQ.js → chunk-YAXBZJMI.js} +2 -2
  12. package/dist/{chunk-EQH5HDYQ.js.map → chunk-YAXBZJMI.js.map} +1 -1
  13. package/dist/cli.cjs +5 -3
  14. package/dist/cli.cjs.map +1 -1
  15. package/dist/components.cjs +13 -5
  16. package/dist/components.cjs.map +1 -1
  17. package/dist/components.d.cts +4 -4
  18. package/dist/components.d.ts +4 -4
  19. package/dist/components.js +16 -7
  20. package/dist/components.js.map +1 -1
  21. package/dist/{data-BaHVz6fa.d.cts → data-BJkB-tvM.d.cts} +32 -4
  22. package/dist/{data-BaHVz6fa.d.ts → data-BJkB-tvM.d.ts} +32 -4
  23. package/dist/index.cjs +28 -2
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +4 -4
  26. package/dist/index.d.ts +4 -4
  27. package/dist/index.js +22 -5
  28. package/dist/index.js.map +1 -1
  29. package/dist/payments.d.cts +1 -1
  30. package/dist/payments.d.ts +1 -1
  31. package/dist/{react-DImwA9C9.d.ts → react-0MyyTtE4.d.ts} +2 -2
  32. package/dist/{react-DK1elmLQ.d.cts → react-CWAG4cW0.d.cts} +2 -2
  33. package/dist/react.cjs +43 -3
  34. package/dist/react.cjs.map +1 -1
  35. package/dist/react.d.cts +23 -7
  36. package/dist/react.d.ts +23 -7
  37. package/dist/react.js +3 -3
  38. package/package.json +3 -2
  39. package/templates/center-site/app/book/page.tsx +11 -23
  40. package/templates/center-site/app/catalog/page.tsx +16 -9
  41. package/templates/center-site/package.json +1 -1
  42. package/dist/chunk-CAXGTKJQ.js.map +0 -1
  43. package/dist/chunk-GIAJQPMM.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 { m as PublicSurface, g as CatalogItem } from './catalog-DdvLcOrs.cjs';
4
- export { h as CatalogResult, i as CatalogSection } from './catalog-DdvLcOrs.cjs';
5
- import { U as PricingMode, S as PaymentIntentInfo, l as Customer } from './data-BaHVz6fa.cjs';
6
- import { d as UseAccountResult } from './react-DK1elmLQ.cjs';
3
+ import { m as PublicSurface, g as CatalogItem } from './catalog-DbhdwmnX.cjs';
4
+ export { h as CatalogResult, i as CatalogSection } from './catalog-DbhdwmnX.cjs';
5
+ import { U as PricingMode, S as PaymentIntentInfo, l as Customer } from './data-BJkB-tvM.cjs';
6
+ import { d as UseAccountResult } from './react-CWAG4cW0.cjs';
7
7
  import { InquiryFormType } from '@bowlos/shared';
8
8
 
9
9
  /**
@@ -1,9 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { CSSProperties, ReactNode } from 'react';
3
- import { m as PublicSurface, g as CatalogItem } from './catalog-DT-ePirK.js';
4
- export { h as CatalogResult, i as CatalogSection } from './catalog-DT-ePirK.js';
5
- import { U as PricingMode, S as PaymentIntentInfo, l as Customer } from './data-BaHVz6fa.js';
6
- import { d as UseAccountResult } from './react-DImwA9C9.js';
3
+ import { m as PublicSurface, g as CatalogItem } from './catalog-XkjgPI5C.js';
4
+ export { h as CatalogResult, i as CatalogSection } from './catalog-XkjgPI5C.js';
5
+ import { U as PricingMode, S as PaymentIntentInfo, l as Customer } from './data-BJkB-tvM.js';
6
+ import { d as UseAccountResult } from './react-0MyyTtE4.js';
7
7
  import { InquiryFormType } from '@bowlos/shared';
8
8
 
9
9
  /**
@@ -1,6 +1,6 @@
1
- import { INQUIRY_FORMS } from './chunk-EQH5HDYQ.js';
2
- import { useTestMode, useAccount, useAvailability, useBookingPreview, useAddons, useStartTimes, useBookingFlow, useMyReservations, useMyMemberships, useMyLoyalty, useMyCredits, useMyPasses, useFlashSale, useFlashSales, useCatalog, useRetailPricing } from './chunk-CAXGTKJQ.js';
3
- import { availableUnitCount } from './chunk-GIAJQPMM.js';
1
+ import { INQUIRY_FORMS } from './chunk-YAXBZJMI.js';
2
+ import { useTestMode, useAccount, useAvailability, useBookingPreview, useAddons, useStartTimes, useBookingFlow, useMyReservations, useMyMemberships, useMyLoyalty, useMyCredits, useMyPasses, useFlashSale, useFlashSales, useCatalog, useRetailPricing } from './chunk-TEHRROVY.js';
3
+ import { availableUnitCount } from './chunk-3JSVEOKG.js';
4
4
  import { token, styles, formatCents, formatMinuteLabel, minutesToTime, useCountdown, formatCentsRange } from './chunk-Y3YSDO3H.js';
5
5
  export { BOWLOS_DEFAULT_THEME, BowlosTheme, formatCents, formatCentsRange } from './chunk-Y3YSDO3H.js';
6
6
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -323,6 +323,13 @@ var COUNT_LABEL = {
323
323
  per_person_per_hour: "Bowlers",
324
324
  per_game: "Games"
325
325
  };
326
+ function countNoun(noun, count, fallbackPlural) {
327
+ if (noun) return count === 1 ? noun.singular : noun.plural;
328
+ return fallbackPlural;
329
+ }
330
+ function titleCase(s) {
331
+ return s.length === 0 ? s : s[0].toUpperCase() + s.slice(1);
332
+ }
326
333
  var ADDON_RATE_SUFFIX = {
327
334
  per_person: " / person",
328
335
  per_unit: " / unit",
@@ -442,7 +449,7 @@ function BookingFlow({
442
449
  }),
443
450
  [centerId, productId, dateISO, startMinuteOfDay, endMinuteOfDay, pricingMode, count, selectedAddons, acctName, acctEmail]
444
451
  );
445
- const freeUnits = availability.data ? availableUnitCount(availability.data) : null;
452
+ const availableUnits = availability.data ? availableUnitCount(availability.data) : null;
446
453
  const quoteCents = preview.data?.totalCentsPerPlan?.[0]?.totalCents ?? null;
447
454
  const addonList = addons.data ?? [];
448
455
  const startOptions = startTimes.data ?? [];
@@ -514,7 +521,7 @@ function BookingFlow({
514
521
  const fee = preview.data?.reservationFee;
515
522
  const feeCents = typeof fee?.amountCents === "number" ? fee.amountCents : 0;
516
523
  const feeLabel = typeof fee?.label === "string" && fee.label ? fee.label : t.reservationFeeLabel;
517
- const reservationLine = t.reservationLineLabel.replace("{count}", String(count)).replace("{unit}", COUNT_LABEL[pricingMode]).replace("{date}", formatDateLabel(dateISO)).replace("{time}", `${formatMinuteLabel(startMinuteOfDay)}\u2013${formatMinuteLabel(endMinuteOfDay)}`);
524
+ const reservationLine = t.reservationLineLabel.replace("{count}", String(count)).replace("{unit}", countNoun(preview.data?.unitNoun, count, COUNT_LABEL[pricingMode])).replace("{date}", formatDateLabel(dateISO)).replace("{time}", `${formatMinuteLabel(startMinuteOfDay)}\u2013${formatMinuteLabel(endMinuteOfDay)}`);
518
525
  const chosenAddons = addonList.map((a) => ({ ...a, quantity: addonQtys[a.id] ?? 0 })).filter((a) => a.quantity > 0);
519
526
  const fallbackAddonsCents = chosenAddons.reduce(
520
527
  (sum, a) => sum + a.priceCents * a.quantity,
@@ -629,7 +636,9 @@ function BookingFlow({
629
636
  )
630
637
  ] }),
631
638
  /* @__PURE__ */ jsxs("label", { style: s.label, children: [
632
- COUNT_LABEL[pricingMode],
639
+ titleCase(
640
+ (availability.data?.unitNoun ?? preview.data?.unitNoun)?.plural ?? COUNT_LABEL[pricingMode]
641
+ ),
633
642
  /* @__PURE__ */ jsx(
634
643
  "input",
635
644
  {
@@ -680,7 +689,7 @@ function BookingFlow({
680
689
  ] }) : null
681
690
  ] }) : t.signInAtCheckout }),
682
691
  /* @__PURE__ */ jsxs("p", { style: s.meta, "aria-live": "polite", children: [
683
- dateISO === "" || startOptions.length === 0 ? "" : availability.loading ? t.checkingAvailability : freeUnits !== null ? `${freeUnits} ${freeUnits === 1 ? unitLabel.singular : unitLabel.plural} available` : availability.error ? availability.error.code : "",
692
+ dateISO === "" || startOptions.length === 0 ? "" : availability.loading ? t.checkingAvailability : availableUnits !== null ? `${availableUnits} ${countNoun(availability.data?.unitNoun ?? unitLabel, availableUnits, unitLabel.plural)} available` : availability.error ? availability.error.code : "",
684
693
  startOptions.length > 0 && quoteCents !== null ? ` \xB7 ${formatCents(quoteCents)}` : ""
685
694
  ] }),
686
695
  /* @__PURE__ */ jsx(