@getmicdrop/venue-calendar 4.0.109 → 4.0.111
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.
- package/dist/CartView-DiSdmuA_.js +2475 -0
- package/dist/CartView-DiSdmuA_.js.map +1 -0
- package/dist/{Checkout-CMEf_qnp.js → Checkout-DBaNrRya.js} +323 -333
- package/dist/Checkout-DBaNrRya.js.map +1 -0
- package/dist/{Checkout-Chki2df_.js → Checkout-DwJr030c.js} +206 -205
- package/dist/Checkout-DwJr030c.js.map +1 -0
- package/dist/{CheckoutTimer-BAaY_60w.js → CheckoutTimer-DPFVh7QG.js} +5 -5
- package/dist/{CheckoutTimer-BAaY_60w.js.map → CheckoutTimer-DPFVh7QG.js.map} +1 -1
- package/dist/{ClockIcon-Dbbj_qur.js → ClockIcon-BoEIfS3d.js} +2 -2
- package/dist/{ClockIcon-Dbbj_qur.js.map → ClockIcon-BoEIfS3d.js.map} +1 -1
- package/dist/{CollectionView-RM30YPOJ.js → CollectionView-DM3WLpLu.js} +78 -77
- package/dist/CollectionView-DM3WLpLu.js.map +1 -0
- package/dist/{Event-kdxMa6OT.js → Event-DymZpajQ.js} +659 -657
- package/dist/Event-DymZpajQ.js.map +1 -0
- package/dist/{EventPage-BRBByBHe.js → EventPage-D7GG_BWH.js} +300 -306
- package/dist/EventPage-D7GG_BWH.js.map +1 -0
- package/dist/{Heading-CSDFD80h.js → Heading-C8oOcA05.js} +2 -2
- package/dist/{Heading-CSDFD80h.js.map → Heading-C8oOcA05.js.map} +1 -1
- package/dist/{ScarcityBadge-B0ca48su.js → ScarcityBadge-BqJHRkab.js} +11 -11
- package/dist/{ScarcityBadge-B0ca48su.js.map → ScarcityBadge-BqJHRkab.js.map} +1 -1
- package/dist/SeriesPage-DsJ9zGPQ.js +34 -0
- package/dist/SeriesPage-DsJ9zGPQ.js.map +1 -0
- package/dist/{Spinner--TOwvv9A.js → Spinner-DPzuHWU6.js} +2 -2
- package/dist/{Spinner--TOwvv9A.js.map → Spinner-DPzuHWU6.js.map} +1 -1
- package/dist/Success-C0D_INAc.js +896 -0
- package/dist/Success-C0D_INAc.js.map +1 -0
- package/dist/{Text-WLl_ELy9.js → Text-DOd8068v.js} +19 -19
- package/dist/Text-DOd8068v.js.map +1 -0
- package/dist/VenueCalendar-B809Hecp.js +16467 -0
- package/dist/VenueCalendar-B809Hecp.js.map +1 -0
- package/dist/{ViewTicketsEmbed-BOukxQIF.js → ViewTicketsEmbed-BPMp4JM0.js} +86 -85
- package/dist/{ViewTicketsEmbed-BOukxQIF.js.map → ViewTicketsEmbed-BPMp4JM0.js.map} +1 -1
- package/dist/__SKIP_PATHS__-BtJ0tS93.js +10 -0
- package/dist/__SKIP_PATHS__-BtJ0tS93.js.map +1 -0
- package/dist/{labels-DXGieQXs.js → labels-wFEhrJkb.js} +154 -149
- package/dist/labels-wFEhrJkb.js.map +1 -0
- package/dist/{modalManager.svelte-Dbd1xgTQ.js → modalManager.svelte-DjiZPIja.js} +2 -2
- package/dist/{modalManager.svelte-Dbd1xgTQ.js.map → modalManager.svelte-DjiZPIja.js.map} +1 -1
- package/dist/navigation--gZASiSa.js +19 -0
- package/dist/navigation--gZASiSa.js.map +1 -0
- package/dist/{promo-oWi_MKmY.js → promo-DK6Hxogl.js} +2 -2
- package/dist/{promo-oWi_MKmY.js.map → promo-DK6Hxogl.js.map} +1 -1
- package/dist/{showcase-state-options-DJJdjxvZ.js → showcase-state-options-BuPnUf0V.js} +21 -21
- package/dist/showcase-state-options-BuPnUf0V.js.map +1 -0
- package/dist/{transform-Bgqwj9i-.js → transform-C6LCkao6.js} +81 -77
- package/dist/transform-C6LCkao6.js.map +1 -0
- package/dist/types/index.d.ts +18 -14
- package/dist/utm-DYGTGbVA.js +288 -0
- package/dist/utm-DYGTGbVA.js.map +1 -0
- package/dist/venue-calendar.css +1 -1
- package/dist/venue-calendar.es.js +2 -2
- package/dist/venue-calendar.iife.js +50 -50
- package/dist/venue-calendar.iife.js.map +1 -1
- package/dist/venue-calendar.umd.js +45 -45
- package/dist/venue-calendar.umd.js.map +1 -1
- package/package.json +199 -199
- package/dist/CartView-C3N5pw89.js +0 -2381
- package/dist/CartView-C3N5pw89.js.map +0 -1
- package/dist/Checkout-CMEf_qnp.js.map +0 -1
- package/dist/Checkout-Chki2df_.js.map +0 -1
- package/dist/CollectionView-RM30YPOJ.js.map +0 -1
- package/dist/Event-kdxMa6OT.js.map +0 -1
- package/dist/EventPage-BRBByBHe.js.map +0 -1
- package/dist/SeriesPage-CczfbUKO.js +0 -33
- package/dist/SeriesPage-CczfbUKO.js.map +0 -1
- package/dist/Success-DIWUGUPs.js +0 -886
- package/dist/Success-DIWUGUPs.js.map +0 -1
- package/dist/Text-WLl_ELy9.js.map +0 -1
- package/dist/VenueCalendar-CU5N9klc.js +0 -16579
- package/dist/VenueCalendar-CU5N9klc.js.map +0 -1
- package/dist/api/api/client.d.ts +0 -17
- package/dist/api/api/cta.d.ts +0 -34
- package/dist/api/api/events.d.ts +0 -183
- package/dist/api/api/gift-cards.d.ts +0 -108
- package/dist/api/api/index.d.ts +0 -46
- package/dist/api/api/orders.d.ts +0 -149
- package/dist/api/api/promo.d.ts +0 -45
- package/dist/api/api/result.d.ts +0 -78
- package/dist/api/api/route-manifest.d.ts +0 -179
- package/dist/api/api/transformers/address.d.ts +0 -18
- package/dist/api/api/transformers/cart.d.ts +0 -19
- package/dist/api/api/transformers/collection.d.ts +0 -12
- package/dist/api/api/transformers/event.d.ts +0 -173
- package/dist/api/api/transformers/giftCard.d.ts +0 -11
- package/dist/api/api/transformers/index.d.ts +0 -27
- package/dist/api/api/transformers/order.d.ts +0 -44
- package/dist/api/api/transformers/performer.d.ts +0 -8
- package/dist/api/api/transformers/series.d.ts +0 -12
- package/dist/api/api/transformers/venue.d.ts +0 -39
- package/dist/api/api/venues.d.ts +0 -33
- package/dist/api/api/waitlist.d.ts +0 -49
- package/dist/api/api.cjs +0 -2
- package/dist/api/api.cjs.map +0 -1
- package/dist/api/api.mjs +0 -1299
- package/dist/api/api.mjs.map +0 -1
- package/dist/api/types.d.ts +0 -483
- package/dist/labels-DXGieQXs.js.map +0 -1
- package/dist/seo/HostSeoController.d.ts +0 -68
- package/dist/seo/buildCollectionJsonLd.d.ts +0 -8
- package/dist/seo/buildEventJsonLd.d.ts +0 -9
- package/dist/seo/buildSeriesJsonLd.d.ts +0 -6
- package/dist/seo/helpers.d.ts +0 -88
- package/dist/seo/index.d.ts +0 -10
- package/dist/seo/seo.cjs +0 -2
- package/dist/seo/seo.cjs.map +0 -1
- package/dist/seo/seo.mjs +0 -541
- package/dist/seo/seo.mjs.map +0 -1
- package/dist/seo/types.d.ts +0 -150
- package/dist/showcase-state-options-DJJdjxvZ.js.map +0 -1
- package/dist/transform-Bgqwj9i-.js.map +0 -1
package/dist/api/api/client.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ApiConfig, ApiResponse } from './types.js';
|
|
2
|
-
export declare function configureApi(config: Partial<ApiConfig>): void;
|
|
3
|
-
export declare function getApiConfig(): Required<ApiConfig>;
|
|
4
|
-
export declare function getPublicBaseUrl(): string;
|
|
5
|
-
export declare function getLegacyPublicUrl(): string;
|
|
6
|
-
export declare function getOrdersV2Url(): string;
|
|
7
|
-
/** @deprecated IP is now resolved server-side via request headers. */
|
|
8
|
-
export declare function getClientIP(): Promise<string>;
|
|
9
|
-
export declare function apiGet<T>(endpoint: string, options?: RequestInit): Promise<ApiResponse<T>>;
|
|
10
|
-
export declare function apiPost<T>(endpoint: string, body?: unknown, options?: RequestInit): Promise<ApiResponse<T>>;
|
|
11
|
-
export declare function apiPut<T>(endpoint: string, body?: unknown, options?: RequestInit): Promise<ApiResponse<T>>;
|
|
12
|
-
export declare function apiDelete<T>(endpoint: string, options?: RequestInit): Promise<ApiResponse<T>>;
|
|
13
|
-
/**
|
|
14
|
-
* Simple fetch wrapper that returns parsed JSON or null on error.
|
|
15
|
-
* Inherits the global timeout + retry policy for GETs.
|
|
16
|
-
*/
|
|
17
|
-
export declare function simpleFetch<T>(url: string, options?: RequestInit): Promise<T | null>;
|
package/dist/api/api/cta.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { isHiddenTicketPurchasable } from '@getmicdrop/svelte-components/transforms';
|
|
2
|
-
export interface CtaStateOptions {
|
|
3
|
-
cancelled?: boolean;
|
|
4
|
-
isRegistration?: boolean;
|
|
5
|
-
waitlistEnabled?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export interface CtaState {
|
|
8
|
-
text: string;
|
|
9
|
-
disabled: boolean;
|
|
10
|
-
reason: 'cancelled' | 'event_past' | 'no_tickets' | 'available' | 'coming_soon' | 'sold_out_waitlist' | 'sold_out' | 'sales_ended' | 'hidden_only';
|
|
11
|
-
}
|
|
12
|
-
interface CtaEvent {
|
|
13
|
-
startDateTime?: string | null;
|
|
14
|
-
endDateTime?: string | null;
|
|
15
|
-
hasPurchasableHiddenTickets?: boolean;
|
|
16
|
-
}
|
|
17
|
-
interface CtaTicket {
|
|
18
|
-
salesChannel?: number;
|
|
19
|
-
salesBegin?: string | null;
|
|
20
|
-
salesStart?: string | null;
|
|
21
|
-
saleBegin?: string | null;
|
|
22
|
-
onSaleStart?: string | null;
|
|
23
|
-
salesEnd?: string | null;
|
|
24
|
-
saleEnd?: string | null;
|
|
25
|
-
onSaleEnd?: string | null;
|
|
26
|
-
remainingCapacity?: number | null;
|
|
27
|
-
quantityRemaining?: number | null;
|
|
28
|
-
quantity?: number | null;
|
|
29
|
-
soldOut?: boolean;
|
|
30
|
-
isHidden?: boolean;
|
|
31
|
-
visibility?: number;
|
|
32
|
-
}
|
|
33
|
-
export { isHiddenTicketPurchasable };
|
|
34
|
-
export declare function computeCtaState(event: CtaEvent, tickets: CtaTicket[] | undefined, options?: CtaStateOptions): CtaState;
|
package/dist/api/api/events.d.ts
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { Result } from './result.js';
|
|
2
|
-
import { Event, AvailableTicket, EventPerformersResponse, SeriesOccurrencesResponse, PublicCollectionData, ResolvedEntity } from './types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Fetch event details, discriminating a real 404 from a transient failure.
|
|
5
|
-
*
|
|
6
|
-
* The SSR loader (`[id]/[slug]/+page.js`) gates its HTTP status on this: only an
|
|
7
|
-
* upstream 404 (`errNotFound`) becomes a page 404. A 5xx, a network error, or a
|
|
8
|
-
* timeout is `err(...)` (transient) so the loader can answer 503/retry instead
|
|
9
|
-
* of rendering a permanent-looking 404 to a buyer or crawler on a backend blip.
|
|
10
|
-
*
|
|
11
|
-
* @param eventId - The event ID
|
|
12
|
-
* @param customFetch - Optional custom fetch function (for SSR)
|
|
13
|
-
* @param password - Optional password for gated events
|
|
14
|
-
* @returns `ok(event)`, `errNotFound(...)` for a real 404, or `err(...)` transient
|
|
15
|
-
*/
|
|
16
|
-
export declare function fetchEventDetailsResult(eventId: string | number, customFetch?: typeof fetch, password?: string): Promise<Result<Event>>;
|
|
17
|
-
/**
|
|
18
|
-
* Fetch event details
|
|
19
|
-
*
|
|
20
|
-
* Gets full event information including venue and ticket data.
|
|
21
|
-
*
|
|
22
|
-
* Fail-open adapter over {@link fetchEventDetailsResult}: existing in-widget
|
|
23
|
-
* callers (Checkout, CartView, EventPage) keep degrading to `null` on any
|
|
24
|
-
* failure. SSR loaders that need to answer 404-vs-503 use the Result variant.
|
|
25
|
-
*
|
|
26
|
-
* @param eventId - The event ID
|
|
27
|
-
* @param customFetch - Optional custom fetch function (for SSR)
|
|
28
|
-
* @returns Event details or null on error
|
|
29
|
-
*/
|
|
30
|
-
export declare function fetchEventDetails(eventId: string | number, customFetch?: typeof fetch, password?: string): Promise<Event | null>;
|
|
31
|
-
/**
|
|
32
|
-
* Fetch available tickets for an event
|
|
33
|
-
*
|
|
34
|
-
* Returns all ticket types that are currently available for sale.
|
|
35
|
-
*
|
|
36
|
-
* @param eventId - The event ID
|
|
37
|
-
* @returns Array of available tickets
|
|
38
|
-
*/
|
|
39
|
-
export declare function fetchEventTicketsResult(eventId: string | number): Promise<Result<AvailableTicket[]>>;
|
|
40
|
-
export declare function fetchEventTickets(eventId: string | number): Promise<AvailableTicket[]>;
|
|
41
|
-
/**
|
|
42
|
-
* Fetch performers for an event
|
|
43
|
-
*
|
|
44
|
-
* Returns the lineup with pre-resolved avatar URLs.
|
|
45
|
-
*
|
|
46
|
-
* @param eventId - The event ID
|
|
47
|
-
* @returns Performers list and visibility flag
|
|
48
|
-
*/
|
|
49
|
-
export declare function fetchEventPerformersResult(eventId: string | number): Promise<Result<EventPerformersResponse>>;
|
|
50
|
-
export declare function fetchEventPerformers(eventId: string | number): Promise<EventPerformersResponse>;
|
|
51
|
-
/**
|
|
52
|
-
* Fetch all venues for an organization
|
|
53
|
-
*
|
|
54
|
-
* @param orgId - The organization ID
|
|
55
|
-
* @returns Array of venues
|
|
56
|
-
*/
|
|
57
|
-
export declare function fetchAllVenuesResult(orgId: string | number): Promise<Result<any[]>>;
|
|
58
|
-
export declare function fetchAllVenues(orgId: string | number): Promise<any[]>;
|
|
59
|
-
/**
|
|
60
|
-
* Fetch events for a venue
|
|
61
|
-
*
|
|
62
|
-
* @param venueId - The venue ID
|
|
63
|
-
* @returns Array of events
|
|
64
|
-
*/
|
|
65
|
-
export declare function fetchVenueEventsResult(venueId: string | number): Promise<Result<Event[]>>;
|
|
66
|
-
export declare function fetchVenueEvents(venueId: string | number): Promise<Event[]>;
|
|
67
|
-
export declare function getMonthEventsResult(venueId: string | number, year: number, month: number): Promise<Result<Event[]>>;
|
|
68
|
-
export declare function getMonthEvents(venueId: string | number, year: number, month: number): Promise<Event[]>;
|
|
69
|
-
/**
|
|
70
|
-
* Get events for an organization for a specific month
|
|
71
|
-
*
|
|
72
|
-
* @param orgId - The organization ID
|
|
73
|
-
* @param year - The year (e.g., 2024)
|
|
74
|
-
* @param month - The month (1-12)
|
|
75
|
-
* @returns Array of events for the month
|
|
76
|
-
*/
|
|
77
|
-
export declare function getOrgMonthEventsResult(orgId: string | number, year: number, month: number): Promise<Result<Event[]>>;
|
|
78
|
-
export declare function getOrgMonthEvents(orgId: string | number, year: number, month: number): Promise<Event[]>;
|
|
79
|
-
/**
|
|
80
|
-
* Get series occurrences for date selector
|
|
81
|
-
*
|
|
82
|
-
* Returns all instances of a recurring event series.
|
|
83
|
-
*
|
|
84
|
-
* @param eventSeriesId - The series ID
|
|
85
|
-
* @returns Series occurrences
|
|
86
|
-
*/
|
|
87
|
-
export declare function getSeriesOccurrencesResult(eventSeriesId: number): Promise<Result<SeriesOccurrencesResponse>>;
|
|
88
|
-
export declare function getSeriesOccurrences(eventSeriesId: number): Promise<SeriesOccurrencesResponse | null>;
|
|
89
|
-
/**
|
|
90
|
-
* Fetch series occurrences with CTA state
|
|
91
|
-
*
|
|
92
|
-
* Returns full series data including availability status.
|
|
93
|
-
*
|
|
94
|
-
* @param eventSeriesId - The series ID
|
|
95
|
-
* @param venueId - The venue ID
|
|
96
|
-
* @returns Series occurrences with CTA state
|
|
97
|
-
*/
|
|
98
|
-
export declare function fetchSeriesOccurrencesResult(eventSeriesId: number, venueId: string | number): Promise<Result<SeriesOccurrencesResponse>>;
|
|
99
|
-
export declare function fetchSeriesOccurrences(eventSeriesId: number, venueId: string | number): Promise<SeriesOccurrencesResponse | null>;
|
|
100
|
-
/**
|
|
101
|
-
* Resolve an entity-agnostic public id to its concrete type + data.
|
|
102
|
-
*
|
|
103
|
-
* The embed deep-link (`#{id}-{slug}`) carries no type prefix, so a cold
|
|
104
|
-
* deep link (the show isn't in the loaded calendar month) needs the backend
|
|
105
|
-
* to say whether the id is an event, series, or collection before the widget
|
|
106
|
-
* can render the right view. This is the same `/api/v2/public/resolve/{id}`
|
|
107
|
-
* endpoint get-micdrop.com's `/e/{slugId}` page resolves server-side; here we
|
|
108
|
-
* call it cross-origin from the venue's page (the public API already serves
|
|
109
|
-
* the calendar cross-origin, so CORS is in place).
|
|
110
|
-
*
|
|
111
|
-
* @param id - The entity id (numeric, type-agnostic)
|
|
112
|
-
* @param slug - Optional slug hint (lets the backend canonicalize)
|
|
113
|
-
* @returns `{ type, id, title, data }` or null on failure
|
|
114
|
-
*/
|
|
115
|
-
export declare function resolvePublicEntity(id: string | number, slug?: string): Promise<ResolvedEntity | null>;
|
|
116
|
-
/**
|
|
117
|
-
* Fetch public collection data
|
|
118
|
-
*
|
|
119
|
-
* Returns collection info including events list.
|
|
120
|
-
* For password-protected collections, pass the password to authenticate.
|
|
121
|
-
*
|
|
122
|
-
* @param collectionId - The collection ID
|
|
123
|
-
* @param password - Optional password for protected collections
|
|
124
|
-
* @returns Collection data or null on error
|
|
125
|
-
*/
|
|
126
|
-
export declare function fetchPublicCollection(collectionId: string | number, password?: string): Promise<PublicCollectionData | null>;
|
|
127
|
-
/**
|
|
128
|
-
* Check collection password
|
|
129
|
-
*
|
|
130
|
-
* Validates password for password-protected collections.
|
|
131
|
-
*
|
|
132
|
-
* @param collectionId - The collection ID
|
|
133
|
-
* @param password - The password to check
|
|
134
|
-
* @returns Whether the password is valid
|
|
135
|
-
*/
|
|
136
|
-
export declare function checkCollectionPassword(collectionId: string | number, password: string): Promise<boolean>;
|
|
137
|
-
/**
|
|
138
|
-
* Check event password
|
|
139
|
-
*
|
|
140
|
-
* Validates password for password-protected events.
|
|
141
|
-
*
|
|
142
|
-
* @param eventId - The event ID
|
|
143
|
-
* @param password - The password to check
|
|
144
|
-
* @returns Whether the password is valid
|
|
145
|
-
*/
|
|
146
|
-
export declare function checkEventPassword(eventId: string | number, password: string): Promise<{
|
|
147
|
-
valid: boolean;
|
|
148
|
-
}>;
|
|
149
|
-
/**
|
|
150
|
-
* Test network connection
|
|
151
|
-
*
|
|
152
|
-
* Asks whether the public API is reachable.
|
|
153
|
-
*
|
|
154
|
-
* THE QUESTION IS "DID THE ROUTER ANSWER", NOT "DID THE RESOURCE EXIST" — the
|
|
155
|
-
* same distinction route-manifest.ts is built on. Under the old `response.ok`
|
|
156
|
-
* rule this probe reported the API DOWN on a healthy backend on EVERY branch,
|
|
157
|
-
* for EVERY input, always. Measured against production: HEAD answers 405 on
|
|
158
|
-
* every route the backend serves — including `HEAD /events/venue/42` for a venue
|
|
159
|
-
* that EXISTS — and the old `HEAD /health` branch answered 404, because the
|
|
160
|
-
* router does not serve /health at all. None of those are `ok`. A liveness check
|
|
161
|
-
* that always fails is worse than none.
|
|
162
|
-
*
|
|
163
|
-
* Two changes fix two different things, and they are separable:
|
|
164
|
-
*
|
|
165
|
-
* 1. THE STATUS RULE is what fixes liveness. Reachable means ANSWERED, not
|
|
166
|
-
* `response.ok`. A 400, a 404 or a 405 is the backend talking: it is up.
|
|
167
|
-
* Only a transport failure (DNS, TLS, CORS, offline) or a 5xx means it is
|
|
168
|
-
* not serving. This rule alone would have made liveness report up, even on
|
|
169
|
-
* the old /health probe (404 < 500).
|
|
170
|
-
* 2. THE REPOINT is what stops this naming a route the router does not serve —
|
|
171
|
-
* the name-resolution gate, and #444. Every branch now names a route the
|
|
172
|
-
* backend actually SERVES. There is no id-free public route, so the no-ids
|
|
173
|
-
* branch asks a served route about an id that cannot exist: we do not care
|
|
174
|
-
* what it says about the venue, only that it said anything at all. This is
|
|
175
|
-
* not what fixes liveness.
|
|
176
|
-
*
|
|
177
|
-
* Do not "simplify" `status < 500` back to `response.ok`. That is the bug.
|
|
178
|
-
*
|
|
179
|
-
* @param orgId - Optional org ID
|
|
180
|
-
* @param venueId - Optional venue ID
|
|
181
|
-
* @returns Whether the API answered
|
|
182
|
-
*/
|
|
183
|
-
export declare function testNetworkConnection(orgId?: string | number, venueId?: string | number): Promise<boolean>;
|
|
@@ -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>;
|
package/dist/api/api/index.d.ts
DELETED
|
@@ -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';
|
package/dist/api/api/orders.d.ts
DELETED
|
@@ -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>;
|
package/dist/api/api/promo.d.ts
DELETED
|
@@ -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
|
-
}>;
|
package/dist/api/api/result.d.ts
DELETED
|
@@ -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;
|