@bowlos/reservations 0.32.0 → 0.35.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 (37) hide show
  1. package/HEADLESS.md +122 -21
  2. package/README.md +29 -0
  3. package/dist/{account-B5i2ddbT.d.ts → account-BJ5UjC0r.d.ts} +1 -1
  4. package/dist/{account-bfaIAO_T.d.cts → account-QoFg8-i1.d.cts} +1 -1
  5. package/dist/{catalog-Dq8gpdAA.d.ts → catalog-CGitz1PG.d.ts} +1 -1
  6. package/dist/{catalog-BtvuX49Y.d.cts → catalog-p9cwB6Qv.d.cts} +1 -1
  7. package/dist/{chunk-BFSMRBWB.js → chunk-MMSVM3QS.js} +3 -3
  8. package/dist/{chunk-BFSMRBWB.js.map → chunk-MMSVM3QS.js.map} +1 -1
  9. package/dist/{chunk-EQH5HDYQ.js → chunk-SMPDCDMB.js} +3 -3
  10. package/dist/chunk-SMPDCDMB.js.map +1 -0
  11. package/dist/{chunk-MJHRMLJO.js → chunk-UN5E6UEZ.js} +2 -2
  12. package/dist/{chunk-MJHRMLJO.js.map → chunk-UN5E6UEZ.js.map} +1 -1
  13. package/dist/components.cjs +68 -22
  14. package/dist/components.cjs.map +1 -1
  15. package/dist/components.d.cts +4 -4
  16. package/dist/components.d.ts +4 -4
  17. package/dist/components.js +70 -24
  18. package/dist/components.js.map +1 -1
  19. package/dist/{data-qGBxYRJB.d.cts → data-qw8P3JW3.d.cts} +65 -3
  20. package/dist/{data-qGBxYRJB.d.ts → data-qw8P3JW3.d.ts} +65 -3
  21. package/dist/index.cjs +28 -1
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +54 -5
  24. package/dist/index.d.ts +54 -5
  25. package/dist/index.js +30 -5
  26. package/dist/index.js.map +1 -1
  27. package/dist/payments.d.cts +1 -1
  28. package/dist/payments.d.ts +1 -1
  29. package/dist/{react-9kBVKWRt.d.ts → react-C2V1kXnO.d.ts} +2 -2
  30. package/dist/{react--xfZz9Y4.d.cts → react-DtncBQ3b.d.cts} +2 -2
  31. package/dist/react.cjs.map +1 -1
  32. package/dist/react.d.cts +6 -6
  33. package/dist/react.d.ts +6 -6
  34. package/dist/react.js +3 -3
  35. package/package.json +1 -1
  36. package/templates/center-site/package.json +1 -1
  37. package/dist/chunk-EQH5HDYQ.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-BtvuX49Y.cjs';
4
- export { h as CatalogResult, i as CatalogSection } from './catalog-BtvuX49Y.cjs';
5
- import { U as PricingMode, S as PaymentIntentInfo, l as Customer } from './data-qGBxYRJB.cjs';
6
- import { d as UseAccountResult } from './react--xfZz9Y4.cjs';
3
+ import { m as PublicSurface, g as CatalogItem } from './catalog-p9cwB6Qv.cjs';
4
+ export { h as CatalogResult, i as CatalogSection } from './catalog-p9cwB6Qv.cjs';
5
+ import { U as PricingMode, S as PaymentIntentInfo, l as Customer } from './data-qw8P3JW3.cjs';
6
+ import { d as UseAccountResult } from './react-DtncBQ3b.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-Dq8gpdAA.js';
4
- export { h as CatalogResult, i as CatalogSection } from './catalog-Dq8gpdAA.js';
5
- import { U as PricingMode, S as PaymentIntentInfo, l as Customer } from './data-qGBxYRJB.js';
6
- import { d as UseAccountResult } from './react-9kBVKWRt.js';
3
+ import { m as PublicSurface, g as CatalogItem } from './catalog-CGitz1PG.js';
4
+ export { h as CatalogResult, i as CatalogSection } from './catalog-CGitz1PG.js';
5
+ import { U as PricingMode, S as PaymentIntentInfo, l as Customer } from './data-qw8P3JW3.js';
6
+ import { d as UseAccountResult } from './react-C2V1kXnO.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-BFSMRBWB.js';
3
- import { availableUnitCount } from './chunk-MJHRMLJO.js';
1
+ import { INQUIRY_FORMS } from './chunk-SMPDCDMB.js';
2
+ import { useTestMode, useAccount, useAvailability, useBookingPreview, useAddons, useStartTimes, useBookingFlow, useMyReservations, useMyMemberships, useMyLoyalty, useMyCredits, useMyPasses, useFlashSale, useFlashSales, useCatalog, useRetailPricing } from './chunk-MMSVM3QS.js';
3
+ import { availableUnitCount } from './chunk-UN5E6UEZ.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 ?? [];
@@ -505,37 +512,74 @@ function BookingFlow({
505
512
  }
506
513
  const holding = flow.status === "holding";
507
514
  if (reviewing) {
508
- const chosenAddons = addonList.map((a) => ({ ...a, quantity: addonQtys[a.id] ?? 0 })).filter((a) => a.quantity > 0);
509
- const addonsSubtotalCents = chosenAddons.reduce(
510
- (sum, a) => sum + a.priceCents * a.quantity,
511
- 0
515
+ const plan = preview.data?.plans?.[0];
516
+ const planId = plan?.pricePlanId;
517
+ const taxForPlan = (preview.data?.taxLinesPerPlan ?? []).find(
518
+ (tp) => tp.pricePlanId === planId
512
519
  );
520
+ const totalForPlan = (preview.data?.totalCentsPerPlan ?? []).find((tp) => tp.pricePlanId === planId)?.totalCents ?? quoteCents;
513
521
  const fee = preview.data?.reservationFee;
514
522
  const feeCents = typeof fee?.amountCents === "number" ? fee.amountCents : 0;
515
523
  const feeLabel = typeof fee?.label === "string" && fee.label ? fee.label : t.reservationFeeLabel;
516
- const reservationCents = quoteCents != null ? quoteCents - addonsSubtotalCents - feeCents : null;
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)}`);
525
+ const chosenAddons = addonList.map((a) => ({ ...a, quantity: addonQtys[a.id] ?? 0 })).filter((a) => a.quantity > 0);
526
+ const fallbackAddonsCents = chosenAddons.reduce(
527
+ (sum, a) => sum + a.priceCents * a.quantity,
528
+ 0
529
+ );
530
+ const fallbackReservationCents = quoteCents != null ? quoteCents - fallbackAddonsCents - feeCents : null;
518
531
  return /* @__PURE__ */ jsxs("div", { className, style: s.card, children: [
519
532
  /* @__PURE__ */ jsx("h3", { style: s.heading, children: t.reviewHeading }),
520
- /* @__PURE__ */ jsxs("div", { style: s.rowBetween, children: [
521
- /* @__PURE__ */ jsx("span", { style: s.body, children: reservationLine }),
522
- reservationCents != null ? /* @__PURE__ */ jsx("span", { style: s.body, children: formatCents(reservationCents) }) : null
523
- ] }),
524
- chosenAddons.map((a) => /* @__PURE__ */ jsxs("div", { style: s.rowBetween, children: [
525
- /* @__PURE__ */ jsxs("span", { style: s.muted, children: [
526
- a.name,
527
- " \xD7 ",
528
- a.quantity
533
+ plan?.pricePlanName ? /* @__PURE__ */ jsx("p", { style: s.muted, children: plan.pricePlanName }) : null,
534
+ plan ? /* @__PURE__ */ jsxs(Fragment, { children: [
535
+ /* @__PURE__ */ jsxs("div", { style: s.rowBetween, children: [
536
+ /* @__PURE__ */ jsx("span", { style: s.body, children: reservationLine }),
537
+ /* @__PURE__ */ jsx("span", { style: s.body, children: formatCents(plan.baseSubtotalCents) })
529
538
  ] }),
530
- /* @__PURE__ */ jsx("span", { style: s.muted, children: formatCents(a.priceCents * a.quantity) })
531
- ] }, a.id)),
539
+ plan.addonLineItems.map((a) => /* @__PURE__ */ jsxs("div", { style: s.rowBetween, children: [
540
+ /* @__PURE__ */ jsxs("span", { style: s.muted, children: [
541
+ a.addonName,
542
+ " \xD7 ",
543
+ a.quantity
544
+ ] }),
545
+ /* @__PURE__ */ jsx("span", { style: s.muted, children: formatCents(a.lineSubtotalCents) })
546
+ ] }, a.addonId)),
547
+ plan.shoesIncluded ? /* @__PURE__ */ jsxs("div", { style: s.rowBetween, children: [
548
+ /* @__PURE__ */ jsx("span", { style: s.muted, children: "Shoes included" }),
549
+ /* @__PURE__ */ jsx("span", { style: s.muted, children: "\u2014" })
550
+ ] }) : null,
551
+ plan.appliedDiscount && plan.appliedDiscount.amountCents > 0 ? /* @__PURE__ */ jsxs("div", { style: s.rowBetween, children: [
552
+ /* @__PURE__ */ jsx("span", { style: s.muted, children: plan.appliedDiscount.label }),
553
+ /* @__PURE__ */ jsxs("span", { style: s.muted, children: [
554
+ "\u2212",
555
+ formatCents(plan.appliedDiscount.amountCents)
556
+ ] })
557
+ ] }) : null,
558
+ (taxForPlan?.taxLines ?? []).map((tl) => /* @__PURE__ */ jsxs("div", { style: s.rowBetween, children: [
559
+ /* @__PURE__ */ jsx("span", { style: s.muted, children: tl.label }),
560
+ /* @__PURE__ */ jsx("span", { style: s.muted, children: formatCents(tl.taxCents) })
561
+ ] }, tl.rateId))
562
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
563
+ fallbackReservationCents != null ? /* @__PURE__ */ jsxs("div", { style: s.rowBetween, children: [
564
+ /* @__PURE__ */ jsx("span", { style: s.body, children: reservationLine }),
565
+ /* @__PURE__ */ jsx("span", { style: s.body, children: formatCents(fallbackReservationCents) })
566
+ ] }) : null,
567
+ chosenAddons.map((a) => /* @__PURE__ */ jsxs("div", { style: s.rowBetween, children: [
568
+ /* @__PURE__ */ jsxs("span", { style: s.muted, children: [
569
+ a.name,
570
+ " \xD7 ",
571
+ a.quantity
572
+ ] }),
573
+ /* @__PURE__ */ jsx("span", { style: s.muted, children: formatCents(a.priceCents * a.quantity) })
574
+ ] }, a.id))
575
+ ] }),
532
576
  feeCents > 0 ? /* @__PURE__ */ jsxs("div", { style: s.rowBetween, children: [
533
577
  /* @__PURE__ */ jsx("span", { style: s.muted, children: feeLabel }),
534
578
  /* @__PURE__ */ jsx("span", { style: s.muted, children: formatCents(feeCents) })
535
579
  ] }) : null,
536
580
  /* @__PURE__ */ jsxs("div", { style: s.rowBetween, children: [
537
581
  /* @__PURE__ */ jsx("strong", { children: t.orderTotal }),
538
- /* @__PURE__ */ jsx("strong", { children: quoteCents != null ? formatCents(quoteCents) : "\u2014" })
582
+ /* @__PURE__ */ jsx("strong", { children: totalForPlan != null ? formatCents(totalForPlan) : "\u2014" })
539
583
  ] }),
540
584
  signedIn ? (
541
585
  // Signed in → place the hold + pay. Disabled until the (possibly
@@ -592,7 +636,9 @@ function BookingFlow({
592
636
  )
593
637
  ] }),
594
638
  /* @__PURE__ */ jsxs("label", { style: s.label, children: [
595
- COUNT_LABEL[pricingMode],
639
+ titleCase(
640
+ (availability.data?.unitNoun ?? preview.data?.unitNoun)?.plural ?? COUNT_LABEL[pricingMode]
641
+ ),
596
642
  /* @__PURE__ */ jsx(
597
643
  "input",
598
644
  {
@@ -643,7 +689,7 @@ function BookingFlow({
643
689
  ] }) : null
644
690
  ] }) : t.signInAtCheckout }),
645
691
  /* @__PURE__ */ jsxs("p", { style: s.meta, "aria-live": "polite", children: [
646
- 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 : "",
647
693
  startOptions.length > 0 && quoteCents !== null ? ` \xB7 ${formatCents(quoteCents)}` : ""
648
694
  ] }),
649
695
  /* @__PURE__ */ jsx(