@getmicdrop/venue-calendar 4.3.1 → 4.3.2
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/api/api.cjs +1 -0
- package/dist/api/api.mjs +1442 -0
- package/dist/api/client.d.ts +157 -0
- package/dist/api/cta.d.ts +50 -0
- package/dist/api/events.d.ts +202 -0
- package/dist/api/gift-cards.d.ts +119 -0
- package/dist/api/index.d.ts +46 -0
- package/dist/api/orders.d.ts +193 -0
- package/dist/api/promo.d.ts +45 -0
- package/dist/api/result.d.ts +78 -0
- package/dist/api/route-manifest.d.ts +206 -0
- package/dist/api/transformers/address.d.ts +18 -0
- package/dist/api/transformers/cart.d.ts +34 -0
- package/dist/api/transformers/collection.d.ts +12 -0
- package/dist/api/transformers/event.d.ts +177 -0
- package/dist/api/transformers/faq.d.ts +40 -0
- package/dist/api/transformers/giftCard.d.ts +11 -0
- package/dist/api/transformers/index.d.ts +27 -0
- package/dist/api/transformers/order.d.ts +44 -0
- package/dist/api/transformers/performer.d.ts +8 -0
- package/dist/api/transformers/series.d.ts +12 -0
- package/dist/api/transformers/venue.d.ts +65 -0
- package/dist/api/types.d.ts +554 -0
- package/dist/api/venues.d.ts +33 -0
- package/dist/api/waitlist.d.ts +77 -0
- package/dist/seo/HostSeoController.d.ts +68 -0
- package/dist/seo/buildCollectionJsonLd.d.ts +8 -0
- package/dist/seo/buildEventJsonLd.d.ts +9 -0
- package/dist/seo/buildSeriesJsonLd.d.ts +6 -0
- package/dist/seo/helpers.d.ts +88 -0
- package/dist/seo/index.d.ts +10 -0
- package/dist/seo/seo.cjs +1 -0
- package/dist/seo/seo.mjs +592 -0
- package/dist/seo/types.d.ts +156 -0
- package/dist/venue-calendar.es.js +1 -1
- package/dist/venue-calendar.iife.js +2 -2
- package/dist/venue-calendar.umd.js +1 -1
- package/package.json +1 -1
- /package/dist/locales/{4.3.1 → 4.3.2}/flow/de.js +0 -0
- /package/dist/locales/{4.3.1 → 4.3.2}/flow/es.js +0 -0
- /package/dist/locales/{4.3.1 → 4.3.2}/flow/fr.js +0 -0
- /package/dist/locales/{4.3.1 → 4.3.2}/flow/id.js +0 -0
- /package/dist/locales/{4.3.1 → 4.3.2}/flow/it.js +0 -0
- /package/dist/locales/{4.3.1 → 4.3.2}/flow/ja.js +0 -0
- /package/dist/locales/{4.3.1 → 4.3.2}/flow/ko.js +0 -0
- /package/dist/locales/{4.3.1 → 4.3.2}/flow/nl.js +0 -0
- /package/dist/locales/{4.3.1 → 4.3.2}/flow/pl.js +0 -0
- /package/dist/locales/{4.3.1 → 4.3.2}/flow/pt-br.js +0 -0
- /package/dist/locales/{4.3.1 → 4.3.2}/flow/tr.js +0 -0
- /package/dist/locales/{4.3.1 → 4.3.2}/flow/zh.js +0 -0
- /package/dist/locales/{4.3.1 → 4.3.2}/main/de.js +0 -0
- /package/dist/locales/{4.3.1 → 4.3.2}/main/es.js +0 -0
- /package/dist/locales/{4.3.1 → 4.3.2}/main/fr.js +0 -0
- /package/dist/locales/{4.3.1 → 4.3.2}/main/id.js +0 -0
- /package/dist/locales/{4.3.1 → 4.3.2}/main/it.js +0 -0
- /package/dist/locales/{4.3.1 → 4.3.2}/main/ja.js +0 -0
- /package/dist/locales/{4.3.1 → 4.3.2}/main/ko.js +0 -0
- /package/dist/locales/{4.3.1 → 4.3.2}/main/nl.js +0 -0
- /package/dist/locales/{4.3.1 → 4.3.2}/main/pl.js +0 -0
- /package/dist/locales/{4.3.1 → 4.3.2}/main/pt-br.js +0 -0
- /package/dist/locales/{4.3.1 → 4.3.2}/main/tr.js +0 -0
- /package/dist/locales/{4.3.1 → 4.3.2}/main/zh.js +0 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { ApiConfig, ApiResponse } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Per-request options. A superset of `RequestInit`: the two extra fields are
|
|
4
|
+
* consumed here and never reach `fetch`.
|
|
5
|
+
*/
|
|
6
|
+
export interface ApiRequestOptions extends RequestInit {
|
|
7
|
+
/**
|
|
8
|
+
* The widget key for THIS request, overriding the module-global one.
|
|
9
|
+
*
|
|
10
|
+
* The global (`config.js`'s `setWidgetKey`) is a single-instance
|
|
11
|
+
* convenience: two `<micdrop-calendar>` elements on one page with different
|
|
12
|
+
* keys both end up using whichever connected last, and the loser then 403s
|
|
13
|
+
* on every strict read and renders an empty calendar with no visible cause.
|
|
14
|
+
* `initVenueCalendar({ widgetKey })` threads the element's own key down to
|
|
15
|
+
* here so each instance authorizes with its own. The option name is FROZEN
|
|
16
|
+
* as `widgetKey` — VenueCalendar.js passes it under that name.
|
|
17
|
+
*
|
|
18
|
+
* TODO(seam: calendar-container-shell / embed-origin-config-surface): this is
|
|
19
|
+
* the transport half only. VenueCalendar.js hands the key to
|
|
20
|
+
* CalendarContainer as a prop; until the components that issue the reads pass
|
|
21
|
+
* it back down as `apiGet(url, { widgetKey })`, the module global is still
|
|
22
|
+
* what authorizes them and two differently-keyed embeds on one page still
|
|
23
|
+
* collapse into one key. The TODO in VenueCalendar.js that points HERE is
|
|
24
|
+
* discharged; the one pointing outward is not.
|
|
25
|
+
*/
|
|
26
|
+
widgetKey?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Skip the global `onError` handler for this call.
|
|
29
|
+
*
|
|
30
|
+
* For endpoints where a non-2xx is an EXPECTED, handled answer rather than a
|
|
31
|
+
* fault — /tax-preview's 422 "this venue has no tax address, show $0" is the
|
|
32
|
+
* live example. Without this the caller has to bypass the whole api-client
|
|
33
|
+
* with a raw `fetch` just to avoid emitting API-error noise on the happy
|
|
34
|
+
* path, which is how the hardcoded `https://get-micdrop.com` tax-preview URL
|
|
35
|
+
* in CartView survived (and broke every venue-hosted embed, which cannot
|
|
36
|
+
* reach a URL pinned to our own origin under its own CSP/consent rules).
|
|
37
|
+
*/
|
|
38
|
+
suppressOnError?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Observers of backend failure CODES, for cross-cutting state that no single
|
|
42
|
+
* caller owns.
|
|
43
|
+
*
|
|
44
|
+
* The concrete case is the buy path's `ORIGIN_NOT_REGISTERED` (embed audit
|
|
45
|
+
* 2026-08-22): every cart/promo/payment call can raise it, but the thing that
|
|
46
|
+
* has to react is the calendar shell, which makes none of those calls. Rather
|
|
47
|
+
* than thread the code back through six call sites, whoever cares subscribes
|
|
48
|
+
* here. Observers see EVERY failure code, so they must filter, and a throwing
|
|
49
|
+
* observer is contained — a broken subscriber must not turn a handled API
|
|
50
|
+
* error into an unhandled one.
|
|
51
|
+
*/
|
|
52
|
+
type ApiErrorCodeObserver = (_code: string) => void;
|
|
53
|
+
/** Subscribe to backend failure codes. Returns an unsubscribe function. */
|
|
54
|
+
export declare function onApiErrorCode(observer: ApiErrorCodeObserver): () => void;
|
|
55
|
+
/**
|
|
56
|
+
* A response, plus the machine-readable failure code when there was one.
|
|
57
|
+
*
|
|
58
|
+
* Widens `ApiResponse` rather than replacing it, so every existing caller that
|
|
59
|
+
* annotates `ApiResponse<T>` keeps compiling.
|
|
60
|
+
*/
|
|
61
|
+
export interface ApiResult<T> extends ApiResponse<T> {
|
|
62
|
+
/**
|
|
63
|
+
* The backend's `code` for a failure — `WIDGET_KEY_INVALID`,
|
|
64
|
+
* `WIDGET_VENUE_MISMATCH`, `WIDGET_ORG_MISMATCH`, `NOT_FOUND`, … Before this
|
|
65
|
+
* existed the only thing that survived a failed request was a human-readable
|
|
66
|
+
* `error` string handed to `logger.error`, so a widget embedded on the wrong
|
|
67
|
+
* domain, a key scoped to another org, and a genuine outage were all the same
|
|
68
|
+
* "something went wrong" to the UI. The shell keys its message off this.
|
|
69
|
+
*/
|
|
70
|
+
errorCode?: string;
|
|
71
|
+
/**
|
|
72
|
+
* The CALLER's AbortSignal fired — a superseded in-flight request, not a
|
|
73
|
+
* failure. Distinguished from a timeout (which also surfaces as an
|
|
74
|
+
* AbortError) because callers debouncing a request must leave their state
|
|
75
|
+
* untouched on an abort and reset it on a real failure.
|
|
76
|
+
*/
|
|
77
|
+
aborted?: boolean;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The Error handed to the global `onError` handler, carrying the same code the
|
|
81
|
+
* returned `ApiResult` does. `onError` receives an `Error` by contract, so the
|
|
82
|
+
* code rides as a property rather than being flattened into the message.
|
|
83
|
+
*/
|
|
84
|
+
export declare class ApiRequestError extends Error {
|
|
85
|
+
readonly code?: string;
|
|
86
|
+
readonly statusCode?: number;
|
|
87
|
+
constructor(message: string, code?: string, statusCode?: number);
|
|
88
|
+
}
|
|
89
|
+
export declare function configureApi(config: Partial<ApiConfig>): void;
|
|
90
|
+
export declare function getApiConfig(): Required<ApiConfig>;
|
|
91
|
+
export declare function getPublicBaseUrl(): string;
|
|
92
|
+
export declare function getLegacyPublicUrl(): string;
|
|
93
|
+
export declare function getOrdersV2Url(): string;
|
|
94
|
+
/** @deprecated IP is now resolved server-side via request headers. */
|
|
95
|
+
export declare function getClientIP(): Promise<string>;
|
|
96
|
+
export declare function apiGet<T>(endpoint: string, options?: ApiRequestOptions): Promise<ApiResult<T>>;
|
|
97
|
+
export declare function apiPost<T>(endpoint: string, body?: unknown, options?: ApiRequestOptions): Promise<ApiResult<T>>;
|
|
98
|
+
export declare function apiPut<T>(endpoint: string, body?: unknown, options?: ApiRequestOptions): Promise<ApiResult<T>>;
|
|
99
|
+
export declare function apiDelete<T>(endpoint: string, options?: ApiRequestOptions): Promise<ApiResult<T>>;
|
|
100
|
+
/** One priced line in a tax quote. `amountCents` is the LINE total, not unit. */
|
|
101
|
+
export interface TaxPreviewLineItem {
|
|
102
|
+
amountCents: number;
|
|
103
|
+
reference: string;
|
|
104
|
+
quantity: number;
|
|
105
|
+
}
|
|
106
|
+
export interface TaxPreviewRequest {
|
|
107
|
+
venueId: number;
|
|
108
|
+
/** WHICH SHOW the quote is for — honours a per-event tax exemption (MIC-2606). */
|
|
109
|
+
eventId?: number;
|
|
110
|
+
lineItems: TaxPreviewLineItem[];
|
|
111
|
+
/** Order-level promo discount in integer cents (MIC-2567). */
|
|
112
|
+
discountCents?: number;
|
|
113
|
+
/** Ask the server for the authoritative service fee alongside the tax. */
|
|
114
|
+
computeServiceFee?: boolean;
|
|
115
|
+
}
|
|
116
|
+
/** Both fields are integer CENTS, and both are contract-optional. */
|
|
117
|
+
export interface TaxPreviewResponse {
|
|
118
|
+
taxTotal?: number;
|
|
119
|
+
serviceFeeCents?: number;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Server-authoritative tax (and, optionally, service fee) quote.
|
|
123
|
+
*
|
|
124
|
+
* Exists so the cart summary does not have to bypass this client to get one.
|
|
125
|
+
* The raw `fetch` it replaces hardcoded `https://get-micdrop.com/...`, which is
|
|
126
|
+
* the whole third-party-domain bug in one line: an embed on a venue's own
|
|
127
|
+
* domain could not retarget it at all, so a self-hosted or proxied deployment
|
|
128
|
+
* quoted tax from the wrong origin (or, under a strict CSP, not at all).
|
|
129
|
+
*
|
|
130
|
+
* `suppressOnError` defaults TRUE because a 422 here is a documented, handled
|
|
131
|
+
* answer — "this venue has no address configured for Stripe Tax, show $0" — and
|
|
132
|
+
* routing it through the global onError handler is what made the raw fetch look
|
|
133
|
+
* necessary. Callers still see the 422 in `statusCode` and must apply their own
|
|
134
|
+
* fallback; genuine 5xx/network failures are theirs to log.
|
|
135
|
+
*
|
|
136
|
+
* @param req - the quote request; `lineItems` may be empty, but prefer not
|
|
137
|
+
* calling at all in that case (the server has nothing to price).
|
|
138
|
+
* @param options.signal - abort a superseded quote. An abort comes back as
|
|
139
|
+
* `{ aborted: true }`, NOT as a failure, so a debouncing caller can return
|
|
140
|
+
* early without clobbering the numbers it is still showing.
|
|
141
|
+
*/
|
|
142
|
+
export declare function taxPreview(req: TaxPreviewRequest, options?: {
|
|
143
|
+
signal?: AbortSignal;
|
|
144
|
+
suppressOnError?: boolean;
|
|
145
|
+
}): Promise<ApiResult<TaxPreviewResponse>>;
|
|
146
|
+
/**
|
|
147
|
+
* Simple fetch wrapper that returns parsed JSON or null on error.
|
|
148
|
+
* Inherits the global timeout + retry policy for GETs.
|
|
149
|
+
*
|
|
150
|
+
* NOTE: this was slated for deletion on the premise that it had no production
|
|
151
|
+
* callers. It has seven — events.ts (loadResult, resolvePublicEntity, the
|
|
152
|
+
* collection loader and both password checks), orders.ts's getOrder, and
|
|
153
|
+
* view-tickets/defaults.ts — so it stays. What it does NOT do any more is send
|
|
154
|
+
* credentials; see the apiRequest comment for why that is the point.
|
|
155
|
+
*/
|
|
156
|
+
export declare function simpleFetch<T>(url: string, options?: RequestInit & Pick<ApiRequestOptions, 'widgetKey'>): Promise<T | null>;
|
|
157
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
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' | 'sales_paused' | 'postponed' | 'hidden_only';
|
|
11
|
+
}
|
|
12
|
+
interface CtaEvent {
|
|
13
|
+
startDateTime?: string | null;
|
|
14
|
+
endDateTime?: string | null;
|
|
15
|
+
hasPurchasableHiddenTickets?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The event's own LIFECYCLE (MIC-2531) — draft | live | started | ended |
|
|
18
|
+
* canceled | postponed. Distinct from {@link CtaEvent.salesStatus}, which is
|
|
19
|
+
* the operator's sales dial: a show can be live with sales paused, and a
|
|
20
|
+
* postponed show is not the same thing as a paused one however alike the two
|
|
21
|
+
* look from the till.
|
|
22
|
+
*/
|
|
23
|
+
status?: string | null;
|
|
24
|
+
/**
|
|
25
|
+
* The operator's sales dial (MIC-2455). On the PUBLIC payload this is already
|
|
26
|
+
* the effective value — the backend merges any manual override into it. The
|
|
27
|
+
* ADMIN payload does NOT merge: there `salesStatus` is the computed value and
|
|
28
|
+
* `salesStatusOverride` is what the operator forced, so an admin-shaped event
|
|
29
|
+
* read through here would answer with the wrong dial.
|
|
30
|
+
*/
|
|
31
|
+
salesStatus?: string | null;
|
|
32
|
+
}
|
|
33
|
+
interface CtaTicket {
|
|
34
|
+
salesChannel?: number;
|
|
35
|
+
salesBegin?: string | null;
|
|
36
|
+
salesStart?: string | null;
|
|
37
|
+
saleBegin?: string | null;
|
|
38
|
+
onSaleStart?: string | null;
|
|
39
|
+
salesEnd?: string | null;
|
|
40
|
+
saleEnd?: string | null;
|
|
41
|
+
onSaleEnd?: string | null;
|
|
42
|
+
remainingCapacity?: number | null;
|
|
43
|
+
quantityRemaining?: number | null;
|
|
44
|
+
quantity?: number | null;
|
|
45
|
+
soldOut?: boolean;
|
|
46
|
+
isHidden?: boolean;
|
|
47
|
+
visibility?: number;
|
|
48
|
+
}
|
|
49
|
+
export { isHiddenTicketPurchasable };
|
|
50
|
+
export declare function computeCtaState(event: CtaEvent, tickets: CtaTicket[] | undefined, options?: CtaStateOptions): CtaState;
|
|
@@ -0,0 +1,202 @@
|
|
|
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, promoCode?: string): Promise<Result<AvailableTicket[]>>;
|
|
40
|
+
export declare function fetchEventTickets(eventId: string | number, promoCode?: string): 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
|
+
/**
|
|
68
|
+
* Options for a month read.
|
|
69
|
+
*
|
|
70
|
+
* `fresh` means "this caller must not be handed an answer that was already on
|
|
71
|
+
* the wire". It exists for the live status stream: when the backend says a show
|
|
72
|
+
* was canceled or postponed, CalendarContainer force-refreshes that month, and
|
|
73
|
+
* an in-flight response may have been snapshotted by the server BEFORE the
|
|
74
|
+
* change that triggered the refresh. Joining it would leave a canceled show
|
|
75
|
+
* drawn as on-sale until the next envelope — the exact staleness
|
|
76
|
+
* CalendarContainer's own force path exists to prevent.
|
|
77
|
+
*
|
|
78
|
+
* A fresh read also REPLACES the shared entry, so anyone joining afterwards
|
|
79
|
+
* waits on the post-change request rather than the one it superseded. Two
|
|
80
|
+
* instances that both force on the same envelope still share, because both of
|
|
81
|
+
* their requests are post-change.
|
|
82
|
+
*/
|
|
83
|
+
export interface MonthReadOptions {
|
|
84
|
+
fresh?: boolean;
|
|
85
|
+
}
|
|
86
|
+
export declare function getMonthEventsResult(venueId: string | number, year: number, month: number, options?: MonthReadOptions): Promise<Result<Event[]>>;
|
|
87
|
+
export declare function getMonthEvents(venueId: string | number, year: number, month: number): Promise<Event[]>;
|
|
88
|
+
/**
|
|
89
|
+
* Get events for an organization for a specific month
|
|
90
|
+
*
|
|
91
|
+
* @param orgId - The organization ID
|
|
92
|
+
* @param year - The year (e.g., 2024)
|
|
93
|
+
* @param month - The month (1-12)
|
|
94
|
+
* @returns Array of events for the month
|
|
95
|
+
*/
|
|
96
|
+
export declare function getOrgMonthEventsResult(orgId: string | number, year: number, month: number, options?: MonthReadOptions): Promise<Result<Event[]>>;
|
|
97
|
+
export declare function getOrgMonthEvents(orgId: string | number, year: number, month: number): Promise<Event[]>;
|
|
98
|
+
/**
|
|
99
|
+
* Get series occurrences for date selector
|
|
100
|
+
*
|
|
101
|
+
* Returns all instances of a recurring event series.
|
|
102
|
+
*
|
|
103
|
+
* @param eventSeriesId - The series ID
|
|
104
|
+
* @returns Series occurrences
|
|
105
|
+
*/
|
|
106
|
+
export declare function getSeriesOccurrencesResult(eventSeriesId: number): Promise<Result<SeriesOccurrencesResponse>>;
|
|
107
|
+
export declare function getSeriesOccurrences(eventSeriesId: number): Promise<SeriesOccurrencesResponse | null>;
|
|
108
|
+
/**
|
|
109
|
+
* Fetch series occurrences with CTA state
|
|
110
|
+
*
|
|
111
|
+
* Returns full series data including availability status.
|
|
112
|
+
*
|
|
113
|
+
* @param eventSeriesId - The series ID
|
|
114
|
+
* @param venueId - The venue ID
|
|
115
|
+
* @returns Series occurrences with CTA state
|
|
116
|
+
*/
|
|
117
|
+
export declare function fetchSeriesOccurrencesResult(eventSeriesId: number, venueId: string | number): Promise<Result<SeriesOccurrencesResponse>>;
|
|
118
|
+
export declare function fetchSeriesOccurrences(eventSeriesId: number, venueId: string | number): Promise<SeriesOccurrencesResponse | null>;
|
|
119
|
+
/**
|
|
120
|
+
* Resolve an entity-agnostic public id to its concrete type + data.
|
|
121
|
+
*
|
|
122
|
+
* The embed deep-link (`#{id}-{slug}`) carries no type prefix, so a cold
|
|
123
|
+
* deep link (the show isn't in the loaded calendar month) needs the backend
|
|
124
|
+
* to say whether the id is an event, series, or collection before the widget
|
|
125
|
+
* can render the right view. This is the same `/api/v2/public/resolve/{id}`
|
|
126
|
+
* endpoint get-micdrop.com's `/e/{slugId}` page resolves server-side; here we
|
|
127
|
+
* call it cross-origin from the venue's page (the public API already serves
|
|
128
|
+
* the calendar cross-origin, so CORS is in place).
|
|
129
|
+
*
|
|
130
|
+
* @param id - The entity id (numeric, type-agnostic)
|
|
131
|
+
* @param slug - Optional slug hint (lets the backend canonicalize)
|
|
132
|
+
* @returns `{ type, id, title, data }` or null on failure
|
|
133
|
+
*/
|
|
134
|
+
export declare function resolvePublicEntity(id: string | number, slug?: string): Promise<ResolvedEntity | null>;
|
|
135
|
+
/**
|
|
136
|
+
* Fetch public collection data
|
|
137
|
+
*
|
|
138
|
+
* Returns collection info including events list.
|
|
139
|
+
* For password-protected collections, pass the password to authenticate.
|
|
140
|
+
*
|
|
141
|
+
* @param collectionId - The collection ID
|
|
142
|
+
* @param password - Optional password for protected collections
|
|
143
|
+
* @returns Collection data or null on error
|
|
144
|
+
*/
|
|
145
|
+
export declare function fetchPublicCollection(collectionId: string | number, password?: string): Promise<PublicCollectionData | null>;
|
|
146
|
+
/**
|
|
147
|
+
* Check collection password
|
|
148
|
+
*
|
|
149
|
+
* Validates password for password-protected collections.
|
|
150
|
+
*
|
|
151
|
+
* @param collectionId - The collection ID
|
|
152
|
+
* @param password - The password to check
|
|
153
|
+
* @returns Whether the password is valid
|
|
154
|
+
*/
|
|
155
|
+
export declare function checkCollectionPassword(collectionId: string | number, password: string): Promise<boolean>;
|
|
156
|
+
/**
|
|
157
|
+
* Check event password
|
|
158
|
+
*
|
|
159
|
+
* Validates password for password-protected events.
|
|
160
|
+
*
|
|
161
|
+
* @param eventId - The event ID
|
|
162
|
+
* @param password - The password to check
|
|
163
|
+
* @returns Whether the password is valid
|
|
164
|
+
*/
|
|
165
|
+
export declare function checkEventPassword(eventId: string | number, password: string): Promise<{
|
|
166
|
+
valid: boolean;
|
|
167
|
+
}>;
|
|
168
|
+
/**
|
|
169
|
+
* Test network connection
|
|
170
|
+
*
|
|
171
|
+
* Asks whether the public API is reachable.
|
|
172
|
+
*
|
|
173
|
+
* THE QUESTION IS "DID THE ROUTER ANSWER", NOT "DID THE RESOURCE EXIST" — the
|
|
174
|
+
* same distinction route-manifest.ts is built on. Under the old `response.ok`
|
|
175
|
+
* rule this probe reported the API DOWN on a healthy backend on EVERY branch,
|
|
176
|
+
* for EVERY input, always. Measured against production: HEAD answers 405 on
|
|
177
|
+
* every route the backend serves — including `HEAD /events/venue/42` for a venue
|
|
178
|
+
* that EXISTS — and the old `HEAD /health` branch answered 404, because the
|
|
179
|
+
* router does not serve /health at all. None of those are `ok`. A liveness check
|
|
180
|
+
* that always fails is worse than none.
|
|
181
|
+
*
|
|
182
|
+
* Two changes fix two different things, and they are separable:
|
|
183
|
+
*
|
|
184
|
+
* 1. THE STATUS RULE is what fixes liveness. Reachable means ANSWERED, not
|
|
185
|
+
* `response.ok`. A 400, a 404 or a 405 is the backend talking: it is up.
|
|
186
|
+
* Only a transport failure (DNS, TLS, CORS, offline) or a 5xx means it is
|
|
187
|
+
* not serving. This rule alone would have made liveness report up, even on
|
|
188
|
+
* the old /health probe (404 < 500).
|
|
189
|
+
* 2. THE REPOINT is what stops this naming a route the router does not serve —
|
|
190
|
+
* the name-resolution gate, and #444. Every branch now names a route the
|
|
191
|
+
* backend actually SERVES. There is no id-free public route, so the no-ids
|
|
192
|
+
* branch asks a served route about an id that cannot exist: we do not care
|
|
193
|
+
* what it says about the venue, only that it said anything at all. This is
|
|
194
|
+
* not what fixes liveness.
|
|
195
|
+
*
|
|
196
|
+
* Do not "simplify" `status < 500` back to `response.ok`. That is the bug.
|
|
197
|
+
*
|
|
198
|
+
* @param orgId - Optional org ID
|
|
199
|
+
* @param venueId - Optional venue ID
|
|
200
|
+
* @returns Whether the API answered
|
|
201
|
+
*/
|
|
202
|
+
export declare function testNetworkConnection(orgId?: string | number, venueId?: string | number): Promise<boolean>;
|
|
@@ -0,0 +1,119 @@
|
|
|
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
|
+
* Amount still owed after the removal, in DOLLARS, as the server computed it.
|
|
64
|
+
* `undefined` when the cart is not yet priced (the server sends null) — the
|
|
65
|
+
* caller must then leave its own total alone rather than infer a zero.
|
|
66
|
+
*/
|
|
67
|
+
remainingTotal?: number;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Remove a gift card from a cart. Identify a single stacked card by `giftCardId`
|
|
71
|
+
* (what the cart response gives — codes come back masked) or by `code` for one
|
|
72
|
+
* applied in this same session. Pass neither to remove ALL applied cards.
|
|
73
|
+
*/
|
|
74
|
+
export declare function removeGiftCard(cartId: string, target?: {
|
|
75
|
+
giftCardId?: number;
|
|
76
|
+
code?: string;
|
|
77
|
+
}): Promise<RemoveGiftCardResult>;
|
|
78
|
+
export interface CompleteGiftCardPaymentInput {
|
|
79
|
+
firstName: string;
|
|
80
|
+
lastName: string;
|
|
81
|
+
email: string;
|
|
82
|
+
phoneNumber?: string | null;
|
|
83
|
+
questionAnswer?: string;
|
|
84
|
+
mailingList?: boolean;
|
|
85
|
+
}
|
|
86
|
+
export interface CompleteGiftCardPaymentResult {
|
|
87
|
+
success: boolean;
|
|
88
|
+
orderId?: string;
|
|
89
|
+
confirmationNumber?: string;
|
|
90
|
+
error?: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Complete a gift-card-only payment (no Stripe required when balance >= total).
|
|
94
|
+
*/
|
|
95
|
+
export declare function completeGiftCardPayment(cartId: string, customerDetails: CompleteGiftCardPaymentInput, uiLocale?: string): Promise<CompleteGiftCardPaymentResult>;
|
|
96
|
+
/**
|
|
97
|
+
* Fetch venue information by slug, discriminating a real 404 from a transient
|
|
98
|
+
* failure.
|
|
99
|
+
*
|
|
100
|
+
* The gift-card SSR loader (`v/[venueSlug]/gift-cards/purchase/+page.ts`) gates
|
|
101
|
+
* its HTTP status on this: only an upstream 404 (`errNotFound`) becomes a page
|
|
102
|
+
* 404. A 5xx, network error, or timeout is `err(...)` (transient) so the loader
|
|
103
|
+
* answers 503/retry rather than a permanent-looking 404 on a backend blip.
|
|
104
|
+
*
|
|
105
|
+
* @param slug - Venue slug
|
|
106
|
+
* @param customFetch - Optional custom fetch function (for SSR)
|
|
107
|
+
* @returns `ok(venue)`, `errNotFound(...)` for a real 404, or `err(...)` transient
|
|
108
|
+
*/
|
|
109
|
+
export declare function getVenueBySlugResult(slug: string, customFetch?: typeof fetch): Promise<Result<VenueInfo>>;
|
|
110
|
+
/**
|
|
111
|
+
* Fetch venue information by slug
|
|
112
|
+
*
|
|
113
|
+
* Fail-open adapter over {@link getVenueBySlugResult}: returns `null` on any
|
|
114
|
+
* failure. SSR loaders that need 404-vs-503 use the Result variant.
|
|
115
|
+
*
|
|
116
|
+
* @param slug - Venue slug
|
|
117
|
+
* @returns Venue info or null on failure
|
|
118
|
+
*/
|
|
119
|
+
export declare function getVenueBySlug(slug: string, customFetch?: typeof fetch): Promise<VenueInfo | null>;
|
|
@@ -0,0 +1,46 @@
|
|
|
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, requeueWaitlistToFront, } from './waitlist.js';
|
|
42
|
+
export type { JoinWaitlistResult, WaitlistStatusResult, ValidateWaitlistTokenResult, RequeueWaitlistResult, } 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';
|