@bowlos/reservations 0.25.0 → 0.27.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 (38) hide show
  1. package/HEADLESS.md +91 -16
  2. package/README.md +7 -5
  3. package/dist/{account-5oZrwcaq.d.ts → account-BwGAUqXP.d.ts} +1 -1
  4. package/dist/{account-nHac98qx.d.cts → account-D40XqO4d.d.cts} +1 -1
  5. package/dist/{catalog-BMdk6ZSC.d.ts → catalog-OLD8ShC_.d.ts} +1 -1
  6. package/dist/{catalog-Ca7eN9CP.d.cts → catalog-V2LD9X6-.d.cts} +1 -1
  7. package/dist/{chunk-7OHHK65Q.js → chunk-AB3D63RF.js} +8 -4
  8. package/dist/chunk-AB3D63RF.js.map +1 -0
  9. package/dist/{chunk-5JWJBLPE.js → chunk-IG6SFBZK.js} +23 -6
  10. package/dist/chunk-IG6SFBZK.js.map +1 -0
  11. package/dist/cli.cjs +17 -2
  12. package/dist/cli.cjs.map +1 -1
  13. package/dist/components.cjs +49 -20
  14. package/dist/components.cjs.map +1 -1
  15. package/dist/components.d.cts +6 -4
  16. package/dist/components.d.ts +6 -4
  17. package/dist/components.js +51 -22
  18. package/dist/components.js.map +1 -1
  19. package/dist/{data-CVq9zXz7.d.cts → data-CtrEtDnP.d.cts} +18 -5
  20. package/dist/{data-CVq9zXz7.d.ts → data-CtrEtDnP.d.ts} +18 -5
  21. package/dist/index.cjs +21 -4
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +4 -4
  24. package/dist/index.d.ts +4 -4
  25. package/dist/index.js +2 -2
  26. package/dist/payments.d.cts +1 -1
  27. package/dist/payments.d.ts +1 -1
  28. package/dist/{react-Bhpzhr01.d.cts → react-B2zTfI5g.d.cts} +4 -2
  29. package/dist/{react-C9bUP9LB.d.ts → react-CLHP9bcD.d.ts} +4 -2
  30. package/dist/react.cjs +22 -3
  31. package/dist/react.cjs.map +1 -1
  32. package/dist/react.d.cts +5 -5
  33. package/dist/react.d.ts +5 -5
  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-5JWJBLPE.js.map +0 -1
  38. package/dist/chunk-7OHHK65Q.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-Ca7eN9CP.cjs';
4
- export { h as CatalogResult, i as CatalogSection } from './catalog-Ca7eN9CP.cjs';
5
- import { U as PricingMode, S as PaymentIntentInfo, l as Customer } from './data-CVq9zXz7.cjs';
6
- import { d as UseAccountResult } from './react-Bhpzhr01.cjs';
3
+ import { m as PublicSurface, g as CatalogItem } from './catalog-V2LD9X6-.cjs';
4
+ export { h as CatalogResult, i as CatalogSection } from './catalog-V2LD9X6-.cjs';
5
+ import { U as PricingMode, S as PaymentIntentInfo, l as Customer } from './data-CtrEtDnP.cjs';
6
+ import { d as UseAccountResult } from './react-B2zTfI5g.cjs';
7
7
 
8
8
  /**
9
9
  * Themeable design tokens for the `@bowlos/reservations/components` layer.
@@ -93,6 +93,8 @@ interface BookingFlowLabels {
93
93
  bookingAs: string;
94
94
  notYou: string;
95
95
  signInHint: string;
96
+ signInToContinue: string;
97
+ signInAtCheckout: string;
96
98
  }
97
99
  interface BookingFlowProps {
98
100
  centerId: string;
@@ -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-BMdk6ZSC.js';
4
- export { h as CatalogResult, i as CatalogSection } from './catalog-BMdk6ZSC.js';
5
- import { U as PricingMode, S as PaymentIntentInfo, l as Customer } from './data-CVq9zXz7.js';
6
- import { d as UseAccountResult } from './react-C9bUP9LB.js';
3
+ import { m as PublicSurface, g as CatalogItem } from './catalog-OLD8ShC_.js';
4
+ export { h as CatalogResult, i as CatalogSection } from './catalog-OLD8ShC_.js';
5
+ import { U as PricingMode, S as PaymentIntentInfo, l as Customer } from './data-CtrEtDnP.js';
6
+ import { d as UseAccountResult } from './react-CLHP9bcD.js';
7
7
 
8
8
  /**
9
9
  * Themeable design tokens for the `@bowlos/reservations/components` layer.
@@ -93,6 +93,8 @@ interface BookingFlowLabels {
93
93
  bookingAs: string;
94
94
  notYou: string;
95
95
  signInHint: string;
96
+ signInToContinue: string;
97
+ signInAtCheckout: string;
96
98
  }
97
99
  interface BookingFlowProps {
98
100
  centerId: string;
@@ -1,5 +1,5 @@
1
- import { useTestMode, useAccount, useAvailability, useBookingPreview, useAddons, useStartTimes, useBookingFlow, useMyReservations, useMyMemberships, useMyLoyalty, useMyCredits, useMyPasses, useFlashSale, useFlashSales, useCatalog } from './chunk-7OHHK65Q.js';
2
- import { availableUnitCount } from './chunk-5JWJBLPE.js';
1
+ import { useTestMode, useAccount, useAvailability, useBookingPreview, useAddons, useStartTimes, useBookingFlow, useMyReservations, useMyMemberships, useMyLoyalty, useMyCredits, useMyPasses, useFlashSale, useFlashSales, useCatalog } from './chunk-AB3D63RF.js';
2
+ import { availableUnitCount } from './chunk-IG6SFBZK.js';
3
3
  import { token, styles, formatCents, formatMinuteLabel, minutesToTime, useCountdown, formatCentsRange } from './chunk-Y3YSDO3H.js';
4
4
  export { BOWLOS_DEFAULT_THEME, BowlosTheme, formatCents, formatCentsRange } from './chunk-Y3YSDO3H.js';
5
5
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -78,7 +78,11 @@ function AuthForm({
78
78
  const onAuth = (e) => {
79
79
  e.preventDefault();
80
80
  void guard(
81
- () => mode === "signIn" ? account.signIn(email, password) : account.signUp(email, password)
81
+ () => mode === "signIn" ? account.signIn(email, password) : (
82
+ // Atomic sign-up: login + customer profile in one call (no orphan
83
+ // window from a missed/raced second step).
84
+ account.register(email, password, { fullName, marketingOptIn: false })
85
+ )
82
86
  );
83
87
  };
84
88
  const onLink = (e) => {
@@ -116,6 +120,18 @@ function AuthForm({
116
120
  if (account.status === "linked") return null;
117
121
  return /* @__PURE__ */ jsxs("form", { className, style: s.card, onSubmit: onAuth, children: [
118
122
  /* @__PURE__ */ jsx("h3", { style: s.heading, children: mode === "signIn" ? t.signInHeading : t.signUpHeading }),
123
+ mode === "signUp" && /* @__PURE__ */ jsxs("label", { style: s.label, children: [
124
+ t.name,
125
+ /* @__PURE__ */ jsx(
126
+ "input",
127
+ {
128
+ value: fullName,
129
+ onChange: (e) => setFullName(e.target.value),
130
+ style: s.input,
131
+ required: true
132
+ }
133
+ )
134
+ ] }),
119
135
  /* @__PURE__ */ jsxs("label", { style: s.label, children: [
120
136
  t.email,
121
137
  /* @__PURE__ */ jsx(
@@ -194,7 +210,9 @@ var DEFAULT_LABELS2 = {
194
210
  checkingAvailability: "Checking availability\u2026",
195
211
  bookingAs: "Booking as {name}",
196
212
  notYou: "Not you?",
197
- signInHint: "Sign in to book faster"
213
+ signInHint: "Sign in to book faster",
214
+ signInToContinue: "Sign in to continue",
215
+ signInAtCheckout: "You can browse and price your booking now \u2014 you'll sign in to complete it."
198
216
  };
199
217
  var COUNT_LABEL = {
200
218
  per_unit_per_hour: "Lanes",
@@ -259,7 +277,7 @@ function BookingFlow({
259
277
  const countArgs = pricingMode === "per_person_per_hour" ? { persons: count } : pricingMode === "per_game" ? { games: count } : { units: count };
260
278
  const availability = useAvailability(
261
279
  { productId, dateISO, startMinuteOfDay, endMinuteOfDay },
262
- { enabled: dateISO !== "" && signedIn }
280
+ { enabled: dateISO !== "" }
263
281
  );
264
282
  const preview = useBookingPreview(
265
283
  {
@@ -272,12 +290,12 @@ function BookingFlow({
272
290
  ...countArgs,
273
291
  addons: selectedAddons
274
292
  },
275
- { enabled: dateISO !== "" && signedIn }
293
+ { enabled: dateISO !== "", auth: signedIn }
276
294
  );
277
- const addons = useAddons({ productId }, { enabled: signedIn });
295
+ const addons = useAddons({ productId }, { enabled: true });
278
296
  const startTimes = useStartTimes(
279
297
  { productId, dateISO, durationMinutes, mode: pricingMode },
280
- { enabled: dateISO !== "" && signedIn }
298
+ { enabled: dateISO !== "" }
281
299
  );
282
300
  const flow = useBookingFlow();
283
301
  const onConfirmedRef = useRef(onConfirmed);
@@ -381,9 +399,6 @@ function BookingFlow({
381
399
  flow.error && /* @__PURE__ */ jsx("p", { style: s.error, children: flow.error.code })
382
400
  ] });
383
401
  }
384
- if (!signedIn) {
385
- return /* @__PURE__ */ jsx(AuthForm, { account, className });
386
- }
387
402
  const holding = flow.status === "holding";
388
403
  if (reviewing) {
389
404
  const chosenAddons = addonList.map((a) => ({ ...a, quantity: addonQtys[a.id] ?? 0 })).filter((a) => a.quantity > 0);
@@ -418,15 +433,29 @@ function BookingFlow({
418
433
  /* @__PURE__ */ jsx("strong", { children: t.orderTotal }),
419
434
  /* @__PURE__ */ jsx("strong", { children: quoteCents != null ? formatCents(quoteCents) : "\u2014" })
420
435
  ] }),
421
- /* @__PURE__ */ jsx(
422
- "button",
423
- {
424
- type: "button",
425
- style: s.primaryBtn,
426
- disabled: holding || quoteCents == null,
427
- onClick: () => void flow.startHold(bookingArgs),
428
- children: holding ? t.securing : t.continueToPayment
429
- }
436
+ signedIn ? (
437
+ // Signed in → place the hold + pay. Disabled until the (possibly
438
+ // post-login) quote resolves, so we never hold/charge against a
439
+ // total the customer hasn't seen. (D4: "Continue" waits for the
440
+ // re-quote.)
441
+ /* @__PURE__ */ jsx(
442
+ "button",
443
+ {
444
+ type: "button",
445
+ style: s.primaryBtn,
446
+ disabled: holding || preview.loading || quoteCents == null,
447
+ onClick: () => void flow.startHold(bookingArgs),
448
+ children: holding ? t.securing : t.continueToPayment
449
+ }
450
+ )
451
+ ) : (
452
+ // Signed out → gate here (mirrors the white-label "Sign in to
453
+ // continue" card). After sign-in the quote re-runs with auth, so
454
+ // member rate / credit apply before payment.
455
+ /* @__PURE__ */ jsxs("div", { style: s.stack, children: [
456
+ /* @__PURE__ */ jsx("p", { style: s.body, children: t.signInToContinue }),
457
+ /* @__PURE__ */ jsx(AuthForm, { account })
458
+ ] })
430
459
  ),
431
460
  /* @__PURE__ */ jsx("button", { type: "button", style: s.linkBtn, disabled: holding, onClick: () => setReviewing(false), children: t.editOrder }),
432
461
  flow.error && /* @__PURE__ */ jsxs("p", { style: s.error, children: [
@@ -502,13 +531,13 @@ function BookingFlow({
502
531
  )
503
532
  ] }, addon.id))
504
533
  ] }) : null,
505
- /* @__PURE__ */ jsxs("p", { style: s.meta, children: [
534
+ /* @__PURE__ */ jsx("p", { style: s.meta, children: signedIn ? /* @__PURE__ */ jsxs(Fragment, { children: [
506
535
  t.bookingAs.replace("{name}", acctName),
507
536
  accountHref ? /* @__PURE__ */ jsxs(Fragment, { children: [
508
537
  " \xB7 ",
509
538
  /* @__PURE__ */ jsx("a", { href: accountHref, style: s.linkBtn, children: t.notYou })
510
539
  ] }) : null
511
- ] }),
540
+ ] }) : t.signInAtCheckout }),
512
541
  /* @__PURE__ */ jsxs("p", { style: s.meta, "aria-live": "polite", children: [
513
542
  dateISO === "" || startOptions.length === 0 ? "" : availability.loading ? t.checkingAvailability : freeUnits !== null ? `${freeUnits} ${freeUnits === 1 ? unitLabel.singular : unitLabel.plural} available` : availability.error ? availability.error.code : "",
514
543
  startOptions.length > 0 && quoteCents !== null ? ` \xB7 ${formatCents(quoteCents)}` : ""