@getmicdrop/venue-calendar 4.0.110 → 4.0.112

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 (88) hide show
  1. package/dist/{CartView-bMHSoj75.js → CartView-H6PXIc8m.js} +9 -9
  2. package/dist/{CartView-bMHSoj75.js.map → CartView-H6PXIc8m.js.map} +1 -1
  3. package/dist/{Checkout-DDXZc-yj.js → Checkout-ns94gCrx.js} +9 -9
  4. package/dist/{Checkout-DDXZc-yj.js.map → Checkout-ns94gCrx.js.map} +1 -1
  5. package/dist/{Checkout-DG2iHmHC.js → Checkout-nyPWpzmE.js} +5 -5
  6. package/dist/{Checkout-DG2iHmHC.js.map → Checkout-nyPWpzmE.js.map} +1 -1
  7. package/dist/{CheckoutTimer-Bwq6a_Hl.js → CheckoutTimer-Bv4qR0Mn.js} +5 -5
  8. package/dist/{CheckoutTimer-Bwq6a_Hl.js.map → CheckoutTimer-Bv4qR0Mn.js.map} +1 -1
  9. package/dist/{ClockIcon-ZgeMNNI1.js → ClockIcon-D2ib_bzt.js} +2 -2
  10. package/dist/{ClockIcon-ZgeMNNI1.js.map → ClockIcon-D2ib_bzt.js.map} +1 -1
  11. package/dist/{CollectionView-1pf2C4kX.js → CollectionView-G3OmVuiX.js} +5 -5
  12. package/dist/{CollectionView-1pf2C4kX.js.map → CollectionView-G3OmVuiX.js.map} +1 -1
  13. package/dist/{Event-D3o0fguY.js → Event-B1syGqOf.js} +8 -8
  14. package/dist/{Event-D3o0fguY.js.map → Event-B1syGqOf.js.map} +1 -1
  15. package/dist/{EventPage-DqO-AV8i.js → EventPage-CqryTYfg.js} +8 -8
  16. package/dist/{EventPage-DqO-AV8i.js.map → EventPage-CqryTYfg.js.map} +1 -1
  17. package/dist/{Heading-pURRwiIC.js → Heading-BM6t9w6d.js} +2 -2
  18. package/dist/{Heading-pURRwiIC.js.map → Heading-BM6t9w6d.js.map} +1 -1
  19. package/dist/{ScarcityBadge-ykz32KS9.js → ScarcityBadge-B7KnIEoD.js} +2 -2
  20. package/dist/{ScarcityBadge-ykz32KS9.js.map → ScarcityBadge-B7KnIEoD.js.map} +1 -1
  21. package/dist/{SeriesPage-BmNk80cF.js → SeriesPage-DYbBhYHy.js} +5 -5
  22. package/dist/{SeriesPage-BmNk80cF.js.map → SeriesPage-DYbBhYHy.js.map} +1 -1
  23. package/dist/{Spinner-OGA1hrc5.js → Spinner-D2Ff-2jf.js} +2 -2
  24. package/dist/{Spinner-OGA1hrc5.js.map → Spinner-D2Ff-2jf.js.map} +1 -1
  25. package/dist/{Success-DLlQ54_-.js → Success-CPQuVaaV.js} +8 -8
  26. package/dist/{Success-DLlQ54_-.js.map → Success-CPQuVaaV.js.map} +1 -1
  27. package/dist/{Text-DMpMLgcU.js → Text-C-9C-Rav.js} +2 -2
  28. package/dist/{Text-DMpMLgcU.js.map → Text-C-9C-Rav.js.map} +1 -1
  29. package/dist/{VenueCalendar-ClSRsS6u.js → VenueCalendar-Dkr4qm4p.js} +4344 -4345
  30. package/dist/{VenueCalendar-ClSRsS6u.js.map → VenueCalendar-Dkr4qm4p.js.map} +1 -1
  31. package/dist/{ViewTicketsEmbed-5LMG2xwn.js → ViewTicketsEmbed-B581Bukn.js} +5 -5
  32. package/dist/{ViewTicketsEmbed-5LMG2xwn.js.map → ViewTicketsEmbed-B581Bukn.js.map} +1 -1
  33. package/dist/{labels-Ws4MJjH5.js → labels-DAFwZdnA.js} +3 -3
  34. package/dist/{labels-Ws4MJjH5.js.map → labels-DAFwZdnA.js.map} +1 -1
  35. package/dist/{modalManager.svelte-BPA2JF6c.js → modalManager.svelte-BbA2uxS7.js} +2 -2
  36. package/dist/{modalManager.svelte-BPA2JF6c.js.map → modalManager.svelte-BbA2uxS7.js.map} +1 -1
  37. package/dist/{promo-vXx1bxQm.js → promo-BGoSmBd_.js} +2 -2
  38. package/dist/{promo-vXx1bxQm.js.map → promo-BGoSmBd_.js.map} +1 -1
  39. package/dist/{showcase-state-options-9SoS5WuT.js → showcase-state-options-BWzGMPZ-.js} +2 -2
  40. package/dist/{showcase-state-options-9SoS5WuT.js.map → showcase-state-options-BWzGMPZ-.js.map} +1 -1
  41. package/dist/{transform-BD9xXAq7.js → transform-CpjZiH34.js} +2 -2
  42. package/dist/{transform-BD9xXAq7.js.map → transform-CpjZiH34.js.map} +1 -1
  43. package/dist/{utm-rT0TPh8G.js → utm-D1uGUvk2.js} +2 -2
  44. package/dist/{utm-rT0TPh8G.js.map → utm-D1uGUvk2.js.map} +1 -1
  45. package/dist/venue-calendar.css +1 -1
  46. package/dist/venue-calendar.es.js +2 -2
  47. package/dist/venue-calendar.iife.js +47 -47
  48. package/dist/venue-calendar.iife.js.map +1 -1
  49. package/dist/venue-calendar.umd.js +44 -44
  50. package/dist/venue-calendar.umd.js.map +1 -1
  51. package/package.json +199 -199
  52. package/dist/api/api/client.d.ts +0 -17
  53. package/dist/api/api/cta.d.ts +0 -34
  54. package/dist/api/api/events.d.ts +0 -183
  55. package/dist/api/api/gift-cards.d.ts +0 -108
  56. package/dist/api/api/index.d.ts +0 -46
  57. package/dist/api/api/orders.d.ts +0 -149
  58. package/dist/api/api/promo.d.ts +0 -45
  59. package/dist/api/api/result.d.ts +0 -78
  60. package/dist/api/api/route-manifest.d.ts +0 -179
  61. package/dist/api/api/transformers/address.d.ts +0 -18
  62. package/dist/api/api/transformers/cart.d.ts +0 -19
  63. package/dist/api/api/transformers/collection.d.ts +0 -12
  64. package/dist/api/api/transformers/event.d.ts +0 -173
  65. package/dist/api/api/transformers/giftCard.d.ts +0 -11
  66. package/dist/api/api/transformers/index.d.ts +0 -27
  67. package/dist/api/api/transformers/order.d.ts +0 -44
  68. package/dist/api/api/transformers/performer.d.ts +0 -8
  69. package/dist/api/api/transformers/series.d.ts +0 -12
  70. package/dist/api/api/transformers/venue.d.ts +0 -39
  71. package/dist/api/api/venues.d.ts +0 -33
  72. package/dist/api/api/waitlist.d.ts +0 -49
  73. package/dist/api/api.cjs +0 -2
  74. package/dist/api/api.cjs.map +0 -1
  75. package/dist/api/api.mjs +0 -1302
  76. package/dist/api/api.mjs.map +0 -1
  77. package/dist/api/types.d.ts +0 -483
  78. package/dist/seo/HostSeoController.d.ts +0 -68
  79. package/dist/seo/buildCollectionJsonLd.d.ts +0 -8
  80. package/dist/seo/buildEventJsonLd.d.ts +0 -9
  81. package/dist/seo/buildSeriesJsonLd.d.ts +0 -6
  82. package/dist/seo/helpers.d.ts +0 -88
  83. package/dist/seo/index.d.ts +0 -10
  84. package/dist/seo/seo.cjs +0 -2
  85. package/dist/seo/seo.cjs.map +0 -1
  86. package/dist/seo/seo.mjs +0 -688
  87. package/dist/seo/seo.mjs.map +0 -1
  88. package/dist/seo/types.d.ts +0 -149
@@ -1,108 +0,0 @@
1
- import { VenueId } from '@getmicdrop/svelte-components';
2
- import { Result } from './result.js';
3
- /**
4
- * Request payload for creating a gift card purchase
5
- */
6
- export interface GiftCardPurchaseRequest {
7
- venueId: number | VenueId;
8
- amount: number;
9
- recipientEmail: string;
10
- recipientName: string;
11
- personalMessage?: string;
12
- purchaserEmail: string;
13
- purchaserName: string;
14
- scheduledDeliveryAt?: string | null;
15
- }
16
- /**
17
- * Response from gift card purchase creation
18
- */
19
- export interface GiftCardPurchaseResponse {
20
- giftCardUUID: string;
21
- clientSecret: string;
22
- amount: number;
23
- stripePublishableKey: string;
24
- }
25
- /**
26
- * Venue information needed for gift card purchase
27
- */
28
- export interface VenueInfo {
29
- id: VenueId;
30
- name: string;
31
- slug: string;
32
- stripePublishableKey?: string;
33
- }
34
- /**
35
- * Create a gift card purchase and get Stripe client secret
36
- * @param req - Gift card purchase request details
37
- * @returns Gift card UUID and Stripe client secret, or null on failure
38
- */
39
- export declare function createGiftCardPurchase(req: GiftCardPurchaseRequest): Promise<GiftCardPurchaseResponse | null>;
40
- /**
41
- * Result shape consumed by the Checkout component / GiftCardInput.
42
- * Monetary fields here are in DOLLARS (formatCurrency-ready).
43
- */
44
- export interface ApplyGiftCardResult {
45
- valid: boolean;
46
- giftCardCode?: string;
47
- giftCardAmount?: number;
48
- giftCardBalance?: number;
49
- paymentType?: string;
50
- stripeAmount?: number;
51
- orderTotal?: number;
52
- requiresStripe?: boolean;
53
- error?: string;
54
- }
55
- /**
56
- * Apply a gift card to a cart.
57
- */
58
- export declare function applyGiftCard(cartId: string, code: string): Promise<ApplyGiftCardResult>;
59
- export interface RemoveGiftCardResult {
60
- success: boolean;
61
- error?: string;
62
- }
63
- /**
64
- * Remove a gift card from a cart. Pass a `code` to remove a single stacked card;
65
- * omit it to remove all applied gift cards.
66
- */
67
- export declare function removeGiftCard(cartId: string, code?: string): Promise<RemoveGiftCardResult>;
68
- export interface CompleteGiftCardPaymentInput {
69
- firstName: string;
70
- lastName: string;
71
- email: string;
72
- phoneNumber?: string | null;
73
- mailingList?: boolean;
74
- }
75
- export interface CompleteGiftCardPaymentResult {
76
- success: boolean;
77
- orderId?: string;
78
- confirmationNumber?: string;
79
- error?: string;
80
- }
81
- /**
82
- * Complete a gift-card-only payment (no Stripe required when balance >= total).
83
- */
84
- export declare function completeGiftCardPayment(cartId: string, customerDetails: CompleteGiftCardPaymentInput): Promise<CompleteGiftCardPaymentResult>;
85
- /**
86
- * Fetch venue information by slug, discriminating a real 404 from a transient
87
- * failure.
88
- *
89
- * The gift-card SSR loader (`v/[venueSlug]/gift-cards/purchase/+page.ts`) gates
90
- * its HTTP status on this: only an upstream 404 (`errNotFound`) becomes a page
91
- * 404. A 5xx, network error, or timeout is `err(...)` (transient) so the loader
92
- * answers 503/retry rather than a permanent-looking 404 on a backend blip.
93
- *
94
- * @param slug - Venue slug
95
- * @param customFetch - Optional custom fetch function (for SSR)
96
- * @returns `ok(venue)`, `errNotFound(...)` for a real 404, or `err(...)` transient
97
- */
98
- export declare function getVenueBySlugResult(slug: string, customFetch?: typeof fetch): Promise<Result<VenueInfo>>;
99
- /**
100
- * Fetch venue information by slug
101
- *
102
- * Fail-open adapter over {@link getVenueBySlugResult}: returns `null` on any
103
- * failure. SSR loaders that need 404-vs-503 use the Result variant.
104
- *
105
- * @param slug - Venue slug
106
- * @returns Venue info or null on failure
107
- */
108
- export declare function getVenueBySlug(slug: string, customFetch?: typeof fetch): Promise<VenueInfo | null>;
@@ -1,46 +0,0 @@
1
- /**
2
- * MicDrop Public Checkout API
3
- *
4
- * This module provides a complete API layer for the public checkout flow:
5
- * - Order creation and management
6
- * - Payment processing with Stripe
7
- * - Promo code validation
8
- * - Event and venue data fetching
9
- * - Session management
10
- *
11
- * All endpoints are public (no authentication required) and use
12
- * the /api/v2/public base path.
13
- *
14
- * @example
15
- * ```typescript
16
- * import {
17
- * createPaymentIntent,
18
- * validatePromoCode,
19
- * transformOrder,
20
- * } from '@getmicdrop/venue-calendar/api';
21
- *
22
- * // Create payment intent
23
- * const intent = await createPaymentIntent(cartId, { 123: 2 });
24
- *
25
- * // Validate promo code
26
- * const promo = await validatePromoCode(eventId, 'DISCOUNT10');
27
- *
28
- * // Transform order for display
29
- * const order = transformOrder(apiResponse);
30
- * ```
31
- */
32
- export { configureApi, getApiConfig, getPublicBaseUrl, getLegacyPublicUrl, getOrdersV2Url, getClientIP, apiGet, apiPost, apiPut, apiDelete, } from './client.js';
33
- export { createPaymentIntent, validatePaymentIntent, updateCartQuantities, getCartByUUID, createOrder, getOrder, completeReservation, cancelReservation, extendCheckoutSession, getSessionStatus, initiateOrder, trackUTMSource, } from './orders.js';
34
- export type { CartReservationView, CartView } from './orders.js';
35
- export { validatePromoCode, hasPromoCodes, applyPromoCode, removePromoCode, } from './promo.js';
36
- export { fetchEventDetails, fetchEventTickets, fetchEventPerformers, fetchAllVenues, fetchVenueEvents, getMonthEvents, getOrgMonthEvents, getSeriesOccurrences, fetchSeriesOccurrences, fetchPublicCollection, resolvePublicEntity, checkEventPassword, checkCollectionPassword, testNetworkConnection, fetchEventDetailsResult, fetchEventTicketsResult, fetchEventPerformersResult, fetchAllVenuesResult, fetchVenueEventsResult, getMonthEventsResult, getOrgMonthEventsResult, getSeriesOccurrencesResult, fetchSeriesOccurrencesResult, } from './events.js';
37
- export { ok, err, errNotFound, isOk, isErr, unwrapOr, type Result, } from './result.js';
38
- export { getVenue, getVenueFees, getVenueBySlug } from './venues.js';
39
- export { createGiftCardPurchase, applyGiftCard, removeGiftCard, completeGiftCardPayment, } from './gift-cards.js';
40
- export type { GiftCardPurchaseRequest, GiftCardPurchaseResponse, ApplyGiftCardResult, RemoveGiftCardResult, CompleteGiftCardPaymentInput, CompleteGiftCardPaymentResult, } from './gift-cards.js';
41
- export { joinWaitlist, getWaitlistStatus, validateWaitlistToken, } from './waitlist.js';
42
- export type { JoinWaitlistResult, WaitlistStatusResult, ValidateWaitlistTokenResult, } from './waitlist.js';
43
- export { computeCtaState } from './cta.js';
44
- export type { CtaState, CtaStateOptions } from './cta.js';
45
- export { transformOrder, transformTicket, transformOrderForDisplay, transformEvent, transformEventData, transformAvailableTicket, getCDNImageUrl, getEventImageUrl, calculateCtaState, transformVenue, extractVenueFees, formatVenueAddress, } from './transformers/index.js';
46
- export type { ApiConfig, ApiResponse, PaymentIntentRequest, PaymentIntentResponse, CompleteReservationResponse, CancelReservationResponse, CreateOrderRequest, CreateOrderResponse, ValidatePaymentRequest, ValidatePaymentResponse, AttendeeInfo, ExtendSessionRequest, ExtendSessionResponse, SessionStatus, PromoValidationResponse, HasPromoCodesResponse, Order, PurchasedTicket, Event, AvailableTicket, EventPerformersResponse, Performer, Venue, SeriesOccurrence, SeriesOccurrencesResponse, SeriesPageData, PublicCollectionData, } from './types.js';
@@ -1,149 +0,0 @@
1
- import { PaymentIntentResponse, CompleteReservationResponse, CancelReservationResponse, CreateOrderResponse, ValidatePaymentRequest, ValidatePaymentResponse, ExtendSessionResponse, SessionStatus, Order } from './types.js';
2
- /**
3
- * Create a payment intent for the cart
4
- *
5
- * This initiates the Stripe payment flow by creating a PaymentIntent
6
- * on the backend. The response includes the client_secret needed
7
- * for Stripe Elements.
8
- *
9
- * @param cartId - The cart/order UUID
10
- * @param quantities - Map of ticketId -> quantity
11
- * @param donationAmounts - Map of ticketId -> donation amount in dollars (for type=2 tickets)
12
- * @returns Payment intent data including client_secret, or null on error
13
- */
14
- export declare function createPaymentIntent(cartId: string, quantities: Record<string | number, number>, donationAmounts?: Record<string | number, number>): Promise<PaymentIntentResponse | null>;
15
- /**
16
- * Fetch an existing cart by UUID (cross-device pre-fill — §1.3).
17
- *
18
- * Returns the server's authoritative view of a cart so a second device
19
- * visiting the tickets page can see the in-progress reservation it created
20
- * on another device. Returns `null` if:
21
- * - the cart no longer exists (404)
22
- * - the cart belongs to a different event than `expectedEventID` (when
23
- * supplied) — we don't want to mix carts across events
24
- * - the cart status is no longer `reserved` / `active` (e.g. expired,
25
- * completed, abandoned) — caller should treat the local cookie as stale
26
- * - any network/decode failure (caller falls back to localStorage only)
27
- *
28
- * Returned shape matches the orders-service `GET /v2Public/cart/{uuid}`
29
- * response: a Cart model with embedded Reservations.
30
- */
31
- export interface CartReservationView {
32
- ticketID: number;
33
- quantity: number;
34
- priceAtReservation: number;
35
- status: string;
36
- }
37
- export interface CartView {
38
- uuid: string;
39
- eventID: number;
40
- status: string;
41
- expiresAt: string;
42
- reservations: CartReservationView[];
43
- }
44
- export declare function getCartByUUID(cartUUID: string, expectedEventID?: string | number): Promise<CartView | null>;
45
- /**
46
- * Update cart quantities after the cart already exists.
47
- *
48
- * Replaces all reservations on the cart with the new quantities.
49
- * The orders-service handler releases old reservations (returning
50
- * inventory) and creates new ones (decrementing inventory) atomically.
51
- *
52
- * Use this when the user changes ticket counts AFTER the initial
53
- * cart was created via initiateOrder. The cart UUID is preserved,
54
- * so the timer and extension state stay intact.
55
- *
56
- * @returns true on success, false on failure
57
- */
58
- export declare function updateCartQuantities(cartId: string, quantities: Record<string | number, number>, donationAmounts?: Record<string | number, number>): Promise<boolean>;
59
- /**
60
- * Complete reservation after successful payment
61
- *
62
- * Called after Stripe confirms the payment to finalize the order
63
- * and generate tickets.
64
- *
65
- * @param orderUuid - The order UUID
66
- * @returns Success status and message
67
- */
68
- export declare function completeReservation(orderUuid: string): Promise<CompleteReservationResponse>;
69
- /**
70
- * Cancel reservation and release tickets back to inventory
71
- *
72
- * Called when user abandons checkout or session expires.
73
- *
74
- * @param orderUuid - The order UUID
75
- * @returns Success status and message
76
- */
77
- export declare function cancelReservation(orderUuid: string): Promise<CancelReservationResponse>;
78
- /**
79
- * Create a new order/cart
80
- *
81
- * This creates an empty order that can be used for checkout.
82
- * The order UUID is used for all subsequent operations.
83
- *
84
- * @param eventId - The event ID
85
- * @param promoCode - Optional promo code to apply
86
- * @returns The order UUID, or null on error
87
- */
88
- export declare function createOrder(eventId: string | number, promoCode?: string): Promise<CreateOrderResponse | null>;
89
- /**
90
- * Get order details (public, no auth required)
91
- *
92
- * Fetches the order details for displaying on the success page.
93
- *
94
- * @param orderId - The order UUID or ID
95
- * @returns The order details, or null on error
96
- */
97
- export declare function getOrder(orderId: string): Promise<Order | null>;
98
- /**
99
- * Validate payment intent and complete the order
100
- *
101
- * This is an alternative to completeReservation that accepts
102
- * additional payment details. Used by micdrop-frontend.
103
- *
104
- * @param cartId - The cart/order UUID
105
- * @param payload - Payment validation payload
106
- * @returns Validation result
107
- */
108
- export declare function validatePaymentIntent(cartId: string, payload: ValidatePaymentRequest): Promise<ValidatePaymentResponse | null>;
109
- /**
110
- * Extend the checkout session by 15 minutes
111
- *
112
- * Users get a limited number of extensions (typically 2-3).
113
- *
114
- * @param orderUuid - The order UUID
115
- * @returns Extension result with new expiry time
116
- */
117
- export declare function extendCheckoutSession(orderUuid: string): Promise<ExtendSessionResponse>;
118
- /**
119
- * Get current session status including expiry time
120
- *
121
- * Used to display countdown timer and check if extensions are available.
122
- *
123
- * @param orderUuid - The order UUID
124
- * @returns Session status including expiry time
125
- */
126
- export declare function getSessionStatus(orderUuid: string): Promise<SessionStatus>;
127
- /**
128
- * Initiate a new order (alias for createOrder)
129
- *
130
- * This function provides backwards compatibility with micdrop-frontend.
131
- * It accepts the same parameters as the legacy initiateOrder function.
132
- *
133
- * @param cartData - Object containing eventID and optional quantities/promoCode
134
- * @returns The order UUID, or null on error
135
- */
136
- export declare function initiateOrder(cartData?: {
137
- eventID: string | number;
138
- promoCode?: string;
139
- quantities?: Record<string | number, number>;
140
- }): Promise<string | null>;
141
- /**
142
- * Track UTM source for analytics
143
- *
144
- * Records the traffic source (utm_source parameter) for marketing analytics.
145
- *
146
- * @param venueId - The venue ID
147
- * @returns Promise that resolves when tracking is complete
148
- */
149
- export declare function trackUTMSource(venueId: string | number): Promise<void>;
@@ -1,45 +0,0 @@
1
- import { PromoValidationResponse } from './types.js';
2
- /**
3
- * Validate a promo code for an event
4
- *
5
- * Checks if a promo code is valid and returns its effects:
6
- * - Discount amount and type
7
- * - Hidden ticket reveal
8
- *
9
- * @param eventId - The event ID
10
- * @param code - The promo code to validate
11
- * @returns Validation result with discount info
12
- */
13
- export declare function validatePromoCode(eventId: string | number, code: string): Promise<PromoValidationResponse>;
14
- /**
15
- * Check if promo codes are available for an event
16
- *
17
- * Used to conditionally show/hide the promo code input field.
18
- *
19
- * @param eventId - The event ID
20
- * @returns Whether promo codes exist for this event
21
- */
22
- export declare function hasPromoCodes(eventId: string | number): Promise<boolean>;
23
- /**
24
- * Apply a promo code to a cart
25
- *
26
- * This updates the cart with the promo code discount.
27
- *
28
- * @param cartId - The cart UUID
29
- * @param code - The promo code to apply
30
- * @returns Success status
31
- */
32
- export declare function applyPromoCode(cartId: string, code: string): Promise<{
33
- success: boolean;
34
- error?: string;
35
- }>;
36
- /**
37
- * Remove a promo code from a cart
38
- *
39
- * @param cartId - The cart UUID
40
- * @returns Success status
41
- */
42
- export declare function removePromoCode(cartId: string): Promise<{
43
- success: boolean;
44
- error?: string;
45
- }>;
@@ -1,78 +0,0 @@
1
- /**
2
- * Result — the canonical error channel for API loaders.
3
- *
4
- * The public loaders in this package historically collapsed a failed fetch
5
- * to an empty value (`[]`, `{ performers: [], showPerformers: false }`, or
6
- * `null`), which is indistinguishable from a genuinely empty result. A buyer
7
- * hitting a live event during a transient endpoint blip then sees a dead
8
- * "No tickets available" button with no retry; a failed calendar month
9
- * renders dark, so the venue looks like it has nothing on.
10
- *
11
- * `Result<T>` gives loaders a typed error channel so callers can tell
12
- * "the request failed" apart from "there is genuinely nothing here", and
13
- * offer a retry instead of silently degrading. Loaders expose a `*Result`
14
- * variant returning this; the array/object-returning public functions stay
15
- * as thin fail-open adapters over that variant (single source of truth for
16
- * the fetch + validation logic).
17
- *
18
- * Not to be confused with `ApiResponse<T>` (types.ts) — that is the write-path
19
- * HTTP envelope returned by `apiPost`/`apiGet`/etc. (`{ success, data?, error?,
20
- * statusCode? }`, discriminated on `.success`). `Result<T>` is the read-path
21
- * loader channel, discriminated on `.ok`. They are deliberately separate:
22
- * `ApiResponse` carries transport metadata, `Result` carries only "loaded vs
23
- * failed". Check `.ok` on a Result, `.success` on an ApiResponse — never mix.
24
- */
25
- export type Result<T> = {
26
- ok: true;
27
- data: T;
28
- } | {
29
- ok: false;
30
- error: string;
31
- notFound?: boolean;
32
- };
33
- /** Wrap a successful value. */
34
- export declare function ok<T>(data: T): Result<T>;
35
- /**
36
- * Wrap a failure with a short, stable error code (used for i18n/render).
37
- *
38
- * This is a TRANSIENT failure by default (`notFound` is unset) — the request
39
- * couldn't complete (network, timeout, 5xx). Loaders that gate an SSR 404 on a
40
- * Result must treat a plain `err(...)` as retryable (503), not "gone" (404), so
41
- * a backend blip never renders a permanent-looking 404 to a buyer or crawler.
42
- */
43
- export declare function err(error: string): Result<never>;
44
- /**
45
- * Wrap a genuine "this resource does not exist" failure (upstream 404).
46
- *
47
- * Distinct from `err(...)`: only this warrants an SSR 404. A transient upstream
48
- * failure must NOT collapse to `errNotFound` — that is exactly the bug this
49
- * channel exists to prevent (a fetch blip becoming a permanent 404).
50
- */
51
- export declare function errNotFound(error: string): Result<never>;
52
- /** Narrowing guard — true when the result carries data. */
53
- export declare function isOk<T>(result: Result<T>): result is {
54
- ok: true;
55
- data: T;
56
- };
57
- /**
58
- * Narrowing guard — true when the result is a failure (transient OR not-found).
59
- *
60
- * This package typechecks with `strictNullChecks` off, where the ELSE flow of a
61
- * discriminated union does NOT narrow (`if (r.ok) {…}` narrows the positive
62
- * branch, but the fall-through keeps the full union). Consumers that need the
63
- * failure branch's `error`/`notFound` must narrow POSITIVELY through this guard
64
- * rather than relying on `!r.ok` control flow.
65
- */
66
- export declare function isErr<T>(result: Result<T>): result is {
67
- ok: false;
68
- error: string;
69
- notFound?: boolean;
70
- };
71
- /**
72
- * Collapse a Result to its data, substituting `fallback` on failure.
73
- *
74
- * This is the fail-open bridge the legacy array/object-returning loaders use
75
- * so existing callers keep their current "degrade to empty" behaviour until
76
- * they adopt the Result variant and render an error/retry state.
77
- */
78
- export declare function unwrapOr<T>(result: Result<T>, fallback: T): T;
@@ -1,179 +0,0 @@
1
- /**
2
- * The wire contract: every backend route this repo names.
3
- *
4
- * A test that asserts a route NAME proves nothing unless it proves the name
5
- * RESOLVES. `expect(fetch).toHaveBeenCalledWith('/api/…')` passes happily
6
- * against a route the router 404s — that is how 4.0.96 shipped a POST against a
7
- * route the backend did not serve and locked every buyer out of every
8
- * password-protected event.
9
- *
10
- * This module is the single source of truth two gates read:
11
- *
12
- * route-answers-contract.test.ts (every PR, offline)
13
- * every API call site in src/ must name a route listed here, with a verb
14
- * and body shape that match.
15
- *
16
- * route-answers-probe.test.ts (CI job, hits the deployed backend)
17
- * every route listed here must be ANSWERED by the router. That is what
18
- * keeps this file from being fiction.
19
- *
20
- * ROUTER-404 vs RESOURCE-404 — the whole diagnosis. The backend replies to an
21
- * unrouted request with 404 + `{"error":{"code":"NOT_FOUND","message":"Route
22
- * not found: POST /api/…"}}`. A route that EXISTS but whose resource does not
23
- * replies 400 "Invalid event ID", or 404 "Order not found", or 401, or 200.
24
- * Only the "Route not found:" prefix means the name resolved to nothing.
25
- * `isRouterNotFound()` below is the one place that distinction is made.
26
- *
27
- * PROBE SAFETY. The probe test asks PRODUCTION. A probe recipe is only correct if
28
- * it CANNOT MUTATE — and that claim is worthless unless something checks it. It
29
- * is load-bearing, not decorative: `POST /orders/create` with an EMPTY body
30
- * answers 200 and creates a real order.
31
- *
32
- * So every mutating row (POST/PUT/DELETE) must declare `probe.safety`, and
33
- * route-answers-probe.test.ts asserts the declaration against what production
34
- * actually answers. That holds for EVERY mutating row in BOTH lists — an UNSERVED
35
- * row is not exempt. "It is a router-404, so no handler runs" is circular: it is
36
- * true until the day the row's whole purpose is fulfilled and the backend ships the
37
- * route. The probe sends the request BEFORE it can know whether the name resolved,
38
- * so on that day the POST lands on a live handler, and the safety claim is the only
39
- * thing asserting it bounced. Two shapes are legal, and only two:
40
- *
41
- * refused — the handler REJECTS the recipe (400 invalid id, 401, 404, 422) and
42
- * never reaches its write. Assert the status is one it declared.
43
- *
44
- * inert — the handler ACCEPTS the recipe but it targets a resource that
45
- * cannot exist, so it changes nothing, and the response SAYS SO.
46
- * `POST /orders/complete/:uuid` is a bulk update keyed on the UUID:
47
- * it answers 200 "Completed 0 reservations" for every UUID, refusing
48
- * nothing — there is no rejecting recipe to write. Assert the row
49
- * count in the body: the response itself proves zero rows moved.
50
- *
51
- * A row that cannot honestly claim either shape must not be probed at all.
52
- */
53
- /** Host prefixes. `client.ts` prefixes any endpoint not starting with `http`
54
- * with PUBLIC — a bare `/orders/create` means `${PUBLIC}/orders/create`. */
55
- export declare const PUBLIC = "/api/v2/public";
56
- export declare const ORDERS_V2 = "/api/orders/v2/public";
57
- export declare const ORDERS_V2_ROOT = "/api/orders/v2";
58
- /**
59
- * The verbs this contract knows — runtime, not just a type. The source scanner in
60
- * route-answers-contract.test.ts checks a call site's `method:` against THIS list
61
- * and goes red on anything else. When the scanner carried its own regex
62
- * alternation instead, a `method: 'PATCH'` matched nothing, fell through to the
63
- * `'GET'` default and was checked against the GET row: green, silently, at a route
64
- * that serves no PATCH. One list, read by both.
65
- */
66
- export declare const HTTP_METHODS: readonly ["GET", "HEAD", "POST", "PUT", "DELETE"];
67
- export type HttpMethod = (typeof HTTP_METHODS)[number];
68
- /** Whether a verb written at a call site is one this contract can reason about. */
69
- export declare function isHttpMethod(verb: string): verb is HttpMethod;
70
- /**
71
- * Why a probe cannot mutate production — see PROBE SAFETY above. Required on
72
- * every POST/PUT/DELETE row and asserted live; the offline gate fails a mutating
73
- * row that omits it, so the safety claim can never again be author discipline.
74
- */
75
- export type ProbeSafety = {
76
- kind: 'refused';
77
- /** Statuses the handler answers when it refuses this recipe. Never 2xx. */
78
- statuses: readonly number[];
79
- } | {
80
- kind: 'inert';
81
- /** The status the handler answers when it accepts this recipe. */
82
- status: number;
83
- /** Must match the response body, and must prove nothing was written. */
84
- proof: RegExp;
85
- /** Why accepting it changes nothing. */
86
- why: string;
87
- };
88
- export interface Probe {
89
- path: string;
90
- body?: unknown;
91
- headers?: Record<string, string>;
92
- /** Required on POST/PUT/DELETE. Reads cannot mutate, so GET/HEAD omit it. */
93
- safety?: ProbeSafety;
94
- }
95
- export interface BackendRoute {
96
- method: HttpMethod;
97
- /** Full path from the host root. Path params are written `:name`. */
98
- path: string;
99
- /** Whether the route takes a request body. */
100
- body: 'required' | 'none';
101
- /** A request that reaches the router and cannot change anything behind it. */
102
- probe: Probe;
103
- }
104
- /** The verbs that can write. These are the probes that need a safety claim. */
105
- export declare function isMutating(method: HttpMethod): boolean;
106
- /** Turn a manifest pattern into a matcher: `:name` matches any single segment. */
107
- export declare function patternMatches(pattern: string, concrete: string): boolean;
108
- /**
109
- * A path param value that is syntactically valid and cannot exist.
110
- *
111
- * Exported because production code needs it too: `testNetworkConnection()` asks a
112
- * SERVED route about this id to find out whether the router answers at all. Same
113
- * id, same reason, one definition — an id-that-cannot-exist written out twice is
114
- * two ids that can drift.
115
- */
116
- export declare const NONEXISTENT_ID = "00000000-0000-0000-0000-000000000000";
117
- /**
118
- * Routes the deployed backend ANSWERS. Verified by route-answers-probe.test.ts.
119
- * Adding a row here without the probe agreeing is exactly the lie this gate exists
120
- * to catch — the probe will fail the row.
121
- */
122
- export declare const SERVED_ROUTES: BackendRoute[];
123
- export interface UnservedRoute extends Omit<BackendRoute, 'body'> {
124
- /** Where the dead name is spoken. */
125
- callSites: string[];
126
- /** What the buyer sees because the name resolves to nothing. */
127
- impact: string;
128
- issue: string;
129
- }
130
- /**
131
- * Routes this repo NAMES that the router does not serve — verified router-404.
132
- *
133
- * This is a debt ledger, not a sanctioned end-state. It exists so the gate can
134
- * land red-free while every dead name stays visible and non-regressible: the
135
- * contract test fails if a NEW call site names a route in neither list, and the
136
- * probe fails if a route listed here starts answering (fix the call site, then
137
- * move the row into SERVED_ROUTES). The list may only ever shrink.
138
- */
139
- export declare const UNSERVED_ROUTES: UnservedRoute[];
140
- export interface RetiredRoute {
141
- method: HttpMethod;
142
- /** The dead name, exactly as the ledger row used to spell it. */
143
- path: string;
144
- /** Who used to speak it, and what happened to them. */
145
- wasNamedBy: string;
146
- issue: string;
147
- }
148
- /**
149
- * Dead names this repo has STOPPED speaking. The ledger's graveyard.
150
- *
151
- * UNSERVED_ROUTES says "may only ever shrink" — and until now nothing enforced
152
- * that. Two ways to put a dead name back were wide open: re-add the row, or write
153
- * a fresh call site and baseline it. Either one turns the debt ledger into a
154
- * silencer, and a silencer is how the 4.0.96 password outage shipped in the first
155
- * place.
156
- *
157
- * So a retired route is retired in both directions, asserted in
158
- * route-answers-contract.test.ts:
159
- *
160
- * - nothing in src/ may NAME it again (a new call site goes red, not baselined);
161
- * - it may not reappear in UNSERVED_ROUTES (you cannot re-open the debt);
162
- * - it may not appear in SERVED_ROUTES either — if the backend genuinely ships
163
- * the route one day, DELETE the row here in the same commit that adds the
164
- * served one with a probe recipe proving the router answers it. That is a
165
- * deliberate two-place edit, which is the whole point: coming back from the
166
- * dead should cost more than adding a line.
167
- */
168
- export declare const RETIRED_ROUTES: RetiredRoute[];
169
- /**
170
- * The router-404 discriminator — the one place the distinction is made.
171
- *
172
- * TRUE = the name resolved to nothing (the bug).
173
- * FALSE = the router answered; whatever the handler then said (400 invalid id,
174
- * 404 "Order not found", 401, 501, 200) is a RESOURCE-level answer and
175
- * is none of this gate's business.
176
- */
177
- export declare function isRouterNotFound(status: number, bodyText: string): boolean;
178
- /** HEAD is answered by the GET route — Express routes the two together. */
179
- export declare function effectiveMethod(method: HttpMethod): HttpMethod;
@@ -1,18 +0,0 @@
1
- /**
2
- * Address helpers — shared between the event, series and collection page
3
- * transformers.
4
- *
5
- * Lifted verbatim from public-calendar-flow/transform.ts so the series and
6
- * collection canonicals (and the in-place transformApiEvent) read a single
7
- * source instead of each carrying a private copy. Behavior is byte-identical
8
- * to the previous module-private versions.
9
- */
10
- /**
11
- * Parse a single-line address string into display lines.
12
- * E.g. "123 Main St, Los Angeles, CA 90012" -> ["123 Main St", "Los Angeles, CA 90012"]
13
- */
14
- export declare function parseAddress(addressStr: string): string[];
15
- /**
16
- * Build a Google Maps search URL from an address string.
17
- */
18
- export declare function buildGoogleMapsUrl(address: string): string;
@@ -1,19 +0,0 @@
1
- import { CartView, CartReservationView } from '../orders.js';
2
- /**
3
- * Parse a single raw reservation row into the normalized CartReservationView.
4
- *
5
- * Wire shape is contained here. Uses `??` (PascalCase first, camelCase
6
- * fallback) so a real `0` quantity / price is preserved. Numeric coercion via
7
- * Number(), status via String() -- byte-identical to the inline `.map` in
8
- * getCartByUUID.
9
- */
10
- export declare function parseCartReservation(raw: unknown): CartReservationView;
11
- /**
12
- * Parse a raw cart payload into the normalized CartView domain shape.
13
- *
14
- * Wire shape (RawCart) is contained inside this module and never escapes it.
15
- * Reconciles PascalCase and camelCase JSON tags via `??`. Reservations are
16
- * normalized through parseCartReservation. Byte-identical to the inline
17
- * normalization previously embedded in getCartByUUID.
18
- */
19
- export declare function parseCart(raw: unknown): CartView;
@@ -1,12 +0,0 @@
1
- import { PublicCollectionData } from '../types.js';
2
- import { EventData } from '../../public-calendar-flow/types';
3
- /**
4
- * Transform PublicCollectionData (from the collection API) into our clean EventData interface.
5
- * Sets collectionId so EventExperience renders in full-width collection mode.
6
- */
7
- export declare function parseCollection(collection: PublicCollectionData): EventData;
8
- /**
9
- * Back-compat alias — the public-calendar-flow shaper name. Existing call
10
- * sites importing transformCollectionData continue to work unchanged.
11
- */
12
- export declare const transformCollectionData: typeof parseCollection;