@bowlos/reservations 0.5.0 → 0.6.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.
@@ -369,6 +369,49 @@ interface FlashSaleProps {
369
369
  */
370
370
  declare function FlashSale({ slug, onBook, labels, className }: FlashSaleProps): react_jsx_runtime.JSX.Element;
371
371
 
372
+ /** One sale in the index. No prices/items — those stay member-gated per-slug. */
373
+ interface FlashSaleIndexItem {
374
+ slug: string;
375
+ displayName: string;
376
+ description: string;
377
+ status: "live" | "upcoming";
378
+ windowStartAt: number;
379
+ windowEndAt: number;
380
+ }
381
+ interface FlashSaleIndexView {
382
+ sales: FlashSaleIndexItem[];
383
+ }
384
+ /** Visible strings — override for copy/i18n. */
385
+ interface FlashSaleIndexLabels {
386
+ heading: string;
387
+ loading: string;
388
+ unavailable: string;
389
+ empty: string;
390
+ liveNow: string;
391
+ opens: string;
392
+ view: string;
393
+ soon: string;
394
+ }
395
+ interface FlashSaleIndexProps {
396
+ /** The Brand whose sales to list. */
397
+ brandId: string;
398
+ /**
399
+ * Called when a customer opens a sale — route to that sale's page, e.g.
400
+ * `onOpen={(sale) => router.push(`/flash/${sale.slug}`)}`. Omit for display-only.
401
+ */
402
+ onOpen?: (sale: FlashSaleIndexItem) => void;
403
+ labels?: Partial<FlashSaleIndexLabels>;
404
+ className?: string;
405
+ }
406
+ /**
407
+ * The branded flash-sale landing page: the Brand's **live** sales (buyable now)
408
+ * + **upcoming** scheduled ones (name + when purchases open). When there are
409
+ * none, a "check back soon" notice. No prices or items — those stay member-gated
410
+ * on each sale's own page. Must render inside a `<BowlosProvider>`; theme with
411
+ * `<BowlosTheme>`. (Lead-capture / "notify me" is a planned follow-up.)
412
+ */
413
+ declare function FlashSaleIndex({ brandId, onOpen, labels, className }: FlashSaleIndexProps): react_jsx_runtime.JSX.Element;
414
+
372
415
  /**
373
416
  * Shared primitives for the `@bowlos/reservations/components` layer.
374
417
  *
@@ -384,4 +427,4 @@ declare function formatCents(cents: number): string;
384
427
  /** A min–max money range, collapsing to one value when they're equal. */
385
428
  declare function formatCentsRange(minCents: number, maxCents: number): string;
386
429
 
387
- export { AccountDashboard, type AccountDashboardLabels, type AccountDashboardProps, AccountMenu, type AccountMenuLabels, type AccountMenuProps, type AccountSection, AuthForm, AuthGate, type AuthGateLabels, type AuthGateProps, type AuthGateRenderContext, BOWLOS_DEFAULT_THEME, BookingFlow, type BookingFlowLabels, type BookingFlowProps, BowlosTheme, type BowlosThemeTokens, type FlashBrand, FlashSale, type FlashSaleItem, type FlashSaleLabels, type FlashSaleProps, type FlashSaleView, type MyCreditEntry, type MyCredits, type MyLoyalty, type MyMembershipSummary, type MyPass, type MyReservationSummary, formatCents, formatCentsRange };
430
+ export { AccountDashboard, type AccountDashboardLabels, type AccountDashboardProps, AccountMenu, type AccountMenuLabels, type AccountMenuProps, type AccountSection, AuthForm, AuthGate, type AuthGateLabels, type AuthGateProps, type AuthGateRenderContext, BOWLOS_DEFAULT_THEME, BookingFlow, type BookingFlowLabels, type BookingFlowProps, BowlosTheme, type BowlosThemeTokens, type FlashBrand, FlashSale, FlashSaleIndex, type FlashSaleIndexItem, type FlashSaleIndexLabels, type FlashSaleIndexProps, type FlashSaleIndexView, type FlashSaleItem, type FlashSaleLabels, type FlashSaleProps, type FlashSaleView, type MyCreditEntry, type MyCredits, type MyLoyalty, type MyMembershipSummary, type MyPass, type MyReservationSummary, formatCents, formatCentsRange };
@@ -369,6 +369,49 @@ interface FlashSaleProps {
369
369
  */
370
370
  declare function FlashSale({ slug, onBook, labels, className }: FlashSaleProps): react_jsx_runtime.JSX.Element;
371
371
 
372
+ /** One sale in the index. No prices/items — those stay member-gated per-slug. */
373
+ interface FlashSaleIndexItem {
374
+ slug: string;
375
+ displayName: string;
376
+ description: string;
377
+ status: "live" | "upcoming";
378
+ windowStartAt: number;
379
+ windowEndAt: number;
380
+ }
381
+ interface FlashSaleIndexView {
382
+ sales: FlashSaleIndexItem[];
383
+ }
384
+ /** Visible strings — override for copy/i18n. */
385
+ interface FlashSaleIndexLabels {
386
+ heading: string;
387
+ loading: string;
388
+ unavailable: string;
389
+ empty: string;
390
+ liveNow: string;
391
+ opens: string;
392
+ view: string;
393
+ soon: string;
394
+ }
395
+ interface FlashSaleIndexProps {
396
+ /** The Brand whose sales to list. */
397
+ brandId: string;
398
+ /**
399
+ * Called when a customer opens a sale — route to that sale's page, e.g.
400
+ * `onOpen={(sale) => router.push(`/flash/${sale.slug}`)}`. Omit for display-only.
401
+ */
402
+ onOpen?: (sale: FlashSaleIndexItem) => void;
403
+ labels?: Partial<FlashSaleIndexLabels>;
404
+ className?: string;
405
+ }
406
+ /**
407
+ * The branded flash-sale landing page: the Brand's **live** sales (buyable now)
408
+ * + **upcoming** scheduled ones (name + when purchases open). When there are
409
+ * none, a "check back soon" notice. No prices or items — those stay member-gated
410
+ * on each sale's own page. Must render inside a `<BowlosProvider>`; theme with
411
+ * `<BowlosTheme>`. (Lead-capture / "notify me" is a planned follow-up.)
412
+ */
413
+ declare function FlashSaleIndex({ brandId, onOpen, labels, className }: FlashSaleIndexProps): react_jsx_runtime.JSX.Element;
414
+
372
415
  /**
373
416
  * Shared primitives for the `@bowlos/reservations/components` layer.
374
417
  *
@@ -384,4 +427,4 @@ declare function formatCents(cents: number): string;
384
427
  /** A min–max money range, collapsing to one value when they're equal. */
385
428
  declare function formatCentsRange(minCents: number, maxCents: number): string;
386
429
 
387
- export { AccountDashboard, type AccountDashboardLabels, type AccountDashboardProps, AccountMenu, type AccountMenuLabels, type AccountMenuProps, type AccountSection, AuthForm, AuthGate, type AuthGateLabels, type AuthGateProps, type AuthGateRenderContext, BOWLOS_DEFAULT_THEME, BookingFlow, type BookingFlowLabels, type BookingFlowProps, BowlosTheme, type BowlosThemeTokens, type FlashBrand, FlashSale, type FlashSaleItem, type FlashSaleLabels, type FlashSaleProps, type FlashSaleView, type MyCreditEntry, type MyCredits, type MyLoyalty, type MyMembershipSummary, type MyPass, type MyReservationSummary, formatCents, formatCentsRange };
430
+ export { AccountDashboard, type AccountDashboardLabels, type AccountDashboardProps, AccountMenu, type AccountMenuLabels, type AccountMenuProps, type AccountSection, AuthForm, AuthGate, type AuthGateLabels, type AuthGateProps, type AuthGateRenderContext, BOWLOS_DEFAULT_THEME, BookingFlow, type BookingFlowLabels, type BookingFlowProps, BowlosTheme, type BowlosThemeTokens, type FlashBrand, FlashSale, FlashSaleIndex, type FlashSaleIndexItem, type FlashSaleIndexLabels, type FlashSaleIndexProps, type FlashSaleIndexView, type FlashSaleItem, type FlashSaleLabels, type FlashSaleProps, type FlashSaleView, type MyCreditEntry, type MyCredits, type MyLoyalty, type MyMembershipSummary, type MyPass, type MyReservationSummary, formatCents, formatCentsRange };
@@ -1,4 +1,4 @@
1
- import { useAccount, useAvailability, useBookingPreview, useBookingFlow, useMyReservations, useMyMemberships, useMyLoyalty, useMyCredits, useMyPasses, useFlashSale } from './chunk-E5KVVXSJ.js';
1
+ import { useAccount, useAvailability, useBookingPreview, useBookingFlow, useMyReservations, useMyMemberships, useMyLoyalty, useMyCredits, useMyPasses, useFlashSale, useFlashSales } from './chunk-H42X4FRR.js';
2
2
  import { availableUnitCount } from './chunk-YICHFUAY.js';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import { useState, useRef, useEffect, useMemo } from 'react';
@@ -828,7 +828,53 @@ function Hero({
828
828
  description && /* @__PURE__ */ jsx("p", { style: s.body, children: description })
829
829
  ] });
830
830
  }
831
+ var DEFAULT_LABELS6 = {
832
+ heading: "Flash sales",
833
+ loading: "Loading\u2026",
834
+ unavailable: "Flash sales are unavailable right now.",
835
+ empty: "No flash sales right now \u2014 check back soon.",
836
+ liveNow: "On sale now",
837
+ opens: "Opens",
838
+ view: "View sale",
839
+ soon: "Upcoming"
840
+ };
841
+ function FlashSaleIndex({ brandId, onOpen, labels, className }) {
842
+ const t = { ...DEFAULT_LABELS6, ...labels };
843
+ const s = styles();
844
+ const list = useFlashSales({ brandId });
845
+ let body;
846
+ if (list.loading && !list.data) {
847
+ body = /* @__PURE__ */ jsx("p", { style: s.muted, children: t.loading });
848
+ } else if (list.error) {
849
+ body = /* @__PURE__ */ jsx("p", { style: s.muted, children: t.unavailable });
850
+ } else if ((list.data?.sales.length ?? 0) === 0) {
851
+ body = /* @__PURE__ */ jsx("p", { style: s.muted, children: t.empty });
852
+ } else {
853
+ body = /* @__PURE__ */ jsx("div", { children: list.data?.sales.map((sale) => /* @__PURE__ */ jsxs("div", { style: s.listItem, children: [
854
+ /* @__PURE__ */ jsxs("div", { children: [
855
+ /* @__PURE__ */ jsx("p", { style: s.listTitle, children: sale.displayName }),
856
+ /* @__PURE__ */ jsx("p", { style: s.listMeta, children: sale.status === "live" ? t.liveNow : /* @__PURE__ */ jsxs(Fragment, { children: [
857
+ t.opens,
858
+ " ",
859
+ /* @__PURE__ */ jsx(When, { ms: sale.windowStartAt })
860
+ ] }) })
861
+ ] }),
862
+ sale.status === "live" && onOpen ? /* @__PURE__ */ jsx("button", { type: "button", style: s.primaryBtn, onClick: () => onOpen(sale), children: t.view }) : /* @__PURE__ */ jsx("span", { style: s.badge, children: sale.status === "live" ? t.liveNow : t.soon })
863
+ ] }, sale.slug)) });
864
+ }
865
+ return /* @__PURE__ */ jsxs("div", { className, style: s.card, children: [
866
+ /* @__PURE__ */ jsx("h3", { style: s.heading, children: t.heading }),
867
+ body
868
+ ] });
869
+ }
870
+ function When({ ms }) {
871
+ const [text, setText] = useState(null);
872
+ useEffect(() => {
873
+ setText(new Date(ms).toLocaleString(void 0, { dateStyle: "medium", timeStyle: "short" }));
874
+ }, [ms]);
875
+ return /* @__PURE__ */ jsx(Fragment, { children: text ?? "" });
876
+ }
831
877
 
832
- export { AccountDashboard, AccountMenu, AuthForm, AuthGate, BOWLOS_DEFAULT_THEME, BookingFlow, BowlosTheme, FlashSale, formatCents, formatCentsRange };
878
+ export { AccountDashboard, AccountMenu, AuthForm, AuthGate, BOWLOS_DEFAULT_THEME, BookingFlow, BowlosTheme, FlashSale, FlashSaleIndex, formatCents, formatCentsRange };
833
879
  //# sourceMappingURL=components.js.map
834
880
  //# sourceMappingURL=components.js.map