@getmicdrop/venue-calendar 3.1.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,395 @@
1
+ /**
2
+ * TypeScript definitions for @getmicdrop/venue-calendar
3
+ */
4
+
5
+ // ============================================================================
6
+ // Event Data Types
7
+ // ============================================================================
8
+
9
+ /**
10
+ * Event data structure returned from the API or passed to components
11
+ */
12
+ export interface EventData {
13
+ id: string | number;
14
+ name: string;
15
+ date: string;
16
+ startDateTime?: string;
17
+ endDateTime?: string;
18
+ image?: string;
19
+ description?: string;
20
+ venueId?: string | number;
21
+ venueID?: string | number;
22
+ timeZone?: string;
23
+ location?: string;
24
+ slug?: string;
25
+ status?: 'on_sale' | 'selling_fast' | 'sold_out';
26
+ }
27
+
28
+ /**
29
+ * Ticket data structure
30
+ */
31
+ export interface TicketData {
32
+ id: string | number;
33
+ name: string;
34
+ price: number;
35
+ quantity?: number;
36
+ description?: string;
37
+ available?: number;
38
+ }
39
+
40
+ // ============================================================================
41
+ // Theme Types
42
+ // ============================================================================
43
+
44
+ /**
45
+ * Theme color configuration using HSL format
46
+ * All values should be HSL strings like "217 91% 60%"
47
+ */
48
+ export interface ThemeColors {
49
+ /** Brand primary color */
50
+ brandPrimary: string;
51
+ /** Primary text color */
52
+ textPrimary: string;
53
+ /** Secondary text color */
54
+ textSecondary: string;
55
+ /** Tertiary text color */
56
+ textTertiary: string;
57
+ /** Primary background color */
58
+ bgPrimary: string;
59
+ /** Secondary background color */
60
+ bgSecondary: string;
61
+ /** Quaternary background color */
62
+ bgQuaternary: string;
63
+ /** Primary stroke/border color */
64
+ strokePrimary: string;
65
+ /** Secondary stroke/border color */
66
+ strokeSecondary: string;
67
+ /** On sale status color */
68
+ statusOnSale: string;
69
+ /** Selling fast status color */
70
+ statusSellingFast: string;
71
+ /** Sold out status color */
72
+ statusSoldOut: string;
73
+ /** Today's date background color */
74
+ todayBg: string;
75
+ /** Today's date text color */
76
+ todayText: string;
77
+ /** Event dot color for on sale */
78
+ eventDotOnSale: string;
79
+ /** Event dot color for selling fast */
80
+ eventDotSellingFast: string;
81
+ /** Event dot color for sold out */
82
+ eventDotSoldOut: string;
83
+ /** Hover background color */
84
+ hoverBg: string;
85
+ /** Focus ring color */
86
+ focusRing: string;
87
+ }
88
+
89
+ /**
90
+ * Preset themes collection
91
+ */
92
+ export interface Themes {
93
+ light: ThemeColors;
94
+ dark: ThemeColors;
95
+ highContrast: ThemeColors;
96
+ }
97
+
98
+ // ============================================================================
99
+ // View Option Types
100
+ // ============================================================================
101
+
102
+ /**
103
+ * View option for the calendar view switcher
104
+ */
105
+ export interface ViewOption {
106
+ id: number;
107
+ text: string;
108
+ icon: string;
109
+ ariaLabel?: string;
110
+ }
111
+
112
+ export type ViewType = 'list' | 'gallery' | 'calendar';
113
+
114
+ // ============================================================================
115
+ // Component Props Interfaces
116
+ // ============================================================================
117
+
118
+ /**
119
+ * Base options for all init functions
120
+ */
121
+ export interface BaseInitOptions {
122
+ /** CSS selector or HTMLElement to mount the component */
123
+ target: string | HTMLElement;
124
+ /** The venue ID (optional, default: '1') */
125
+ venueId?: string;
126
+ /** The organization ID (optional, default: '1') */
127
+ organizationId?: string;
128
+ }
129
+
130
+ /**
131
+ * Options for initializing the Venue Calendar component
132
+ */
133
+ export interface CalendarProps extends BaseInitOptions {
134
+ /** Initial view: 'list', 'gallery', or 'calendar' (default: 'calendar') */
135
+ view?: ViewType;
136
+ /** Array of event objects to display */
137
+ events?: EventData[];
138
+ /** Whether to show view switcher (default: true) */
139
+ showViewOptions?: boolean;
140
+ /** Whether to show month navigation (default: true) */
141
+ showMonthSwitcher?: boolean;
142
+ /** Current month store (Svelte writable store) */
143
+ currentMonth?: import('svelte/store').Writable<number>;
144
+ /** Current year store (Svelte writable store) */
145
+ currentYear?: import('svelte/store').Writable<number>;
146
+ /** Handler for navigating to next month */
147
+ handleNext?: () => void;
148
+ /** Handler for navigating to previous month */
149
+ handlePrev?: () => void;
150
+ /** Callback function when an event is clicked */
151
+ onEventClick?: (event: EventData) => void;
152
+ }
153
+
154
+ /**
155
+ * Options for initializing the Event Details View
156
+ */
157
+ export interface EventDetailsOptions extends BaseInitOptions {
158
+ /** The event ID to display */
159
+ eventId: string;
160
+ /** Callback when back button is clicked */
161
+ onNavigateBack?: () => void;
162
+ /** Callback when navigating to cart */
163
+ onNavigateToCart?: (eventId: string) => void;
164
+ }
165
+
166
+ /**
167
+ * Options for initializing the Cart View
168
+ */
169
+ export interface CartViewOptions extends BaseInitOptions {
170
+ /** The event ID for the cart */
171
+ eventId: string;
172
+ /** Callback when back button is clicked */
173
+ onNavigateBack?: () => void;
174
+ /** Callback when navigating to checkout */
175
+ onNavigateToCheckout?: (eventId: string) => void;
176
+ }
177
+
178
+ /**
179
+ * Success callback data from checkout
180
+ */
181
+ export interface CheckoutSuccessData {
182
+ orderId?: string;
183
+ eventId?: string;
184
+ event?: EventData;
185
+ }
186
+
187
+ /**
188
+ * Options for initializing the Checkout View
189
+ */
190
+ export interface CheckoutOptions extends BaseInitOptions {
191
+ /** The event ID to display */
192
+ eventId: string;
193
+ /** The event slug (optional) */
194
+ slug?: string;
195
+ /** Array of available tickets (optional) */
196
+ availableTickets?: TicketData[];
197
+ /** Callback when checkout is successful */
198
+ onSuccess?: (data: CheckoutSuccessData) => void;
199
+ /** Callback when navigating to success page */
200
+ onNavigateToSuccess?: (data: CheckoutSuccessData) => void;
201
+ }
202
+
203
+ /**
204
+ * Options for initializing the Success View
205
+ */
206
+ export interface SuccessViewOptions extends BaseInitOptions {
207
+ /** The event ID (optional) */
208
+ eventId?: string;
209
+ /** The event slug (optional) */
210
+ slug?: string;
211
+ /** The order ID (optional) */
212
+ orderId?: string;
213
+ }
214
+
215
+ /**
216
+ * Alias for CalendarProps for backward compatibility
217
+ */
218
+ export type InitOptions = CalendarProps;
219
+
220
+ // ============================================================================
221
+ // Svelte Component Instance
222
+ // ============================================================================
223
+
224
+ /**
225
+ * Svelte component instance returned by init functions
226
+ */
227
+ export interface SvelteComponentInstance {
228
+ /** Destroy the component and clean up */
229
+ $destroy?: () => void;
230
+ /** Internal cleanup for success listener */
231
+ _successCleanup?: () => void;
232
+ }
233
+
234
+ // ============================================================================
235
+ // Exported Functions
236
+ // ============================================================================
237
+
238
+ /**
239
+ * Initialize the Venue Calendar component
240
+ * @param options - Configuration options
241
+ * @returns The Svelte component instance, or null if target not found
242
+ */
243
+ export function initVenueCalendar(options: CalendarProps): SvelteComponentInstance | null;
244
+
245
+ /**
246
+ * Initialize the Event Details View
247
+ * @param options - Configuration options
248
+ * @returns The Svelte component instance, or null if target not found or eventId missing
249
+ */
250
+ export function initEventDetailsView(options: EventDetailsOptions): SvelteComponentInstance | null;
251
+
252
+ /**
253
+ * Initialize the Cart View
254
+ * @param options - Configuration options
255
+ * @returns The Svelte component instance, or null if target not found or eventId missing
256
+ */
257
+ export function initCartView(options: CartViewOptions): SvelteComponentInstance | null;
258
+
259
+ /**
260
+ * Alias for initCartView
261
+ */
262
+ export const initCart: typeof initCartView;
263
+
264
+ /**
265
+ * Initialize the Checkout View
266
+ * @param options - Configuration options
267
+ * @returns The Svelte component instance, or null if target not found or eventId missing
268
+ */
269
+ export function initCheckoutView(options: CheckoutOptions): SvelteComponentInstance | null;
270
+
271
+ /**
272
+ * Alias for initCheckoutView
273
+ */
274
+ export const initCheckout: typeof initCheckoutView;
275
+
276
+ /**
277
+ * Initialize the Success View
278
+ * @param options - Configuration options
279
+ * @returns The Svelte component instance, or null if target not found
280
+ */
281
+ export function initSuccessView(options: SuccessViewOptions): SvelteComponentInstance | null;
282
+
283
+ /**
284
+ * Alias for initSuccessView
285
+ */
286
+ export const initSuccess: typeof initSuccessView;
287
+
288
+ /**
289
+ * Auto-mount: Automatically finds and mounts calendar to elements with class 'micdrop-calendar-container'
290
+ */
291
+ export function autoMount(): void;
292
+
293
+ // ============================================================================
294
+ // Theme Exports
295
+ // ============================================================================
296
+
297
+ /**
298
+ * Collection of preset themes
299
+ */
300
+ export const themes: Themes;
301
+
302
+ /**
303
+ * Light theme preset
304
+ */
305
+ export const lightTheme: ThemeColors;
306
+
307
+ /**
308
+ * Dark theme preset
309
+ */
310
+ export const darkTheme: ThemeColors;
311
+
312
+ /**
313
+ * High contrast theme preset for accessibility
314
+ */
315
+ export const highContrastTheme: ThemeColors;
316
+
317
+ /**
318
+ * Apply a theme to the calendar widget
319
+ * @param theme - Theme object with HSL color values
320
+ * @param container - Optional container element (defaults to document.documentElement)
321
+ */
322
+ export function applyTheme(theme: Partial<ThemeColors>, container?: HTMLElement): void;
323
+
324
+ /**
325
+ * Generate CSS string for embedding themes
326
+ * @param theme - Theme object
327
+ * @returns CSS string with custom properties
328
+ */
329
+ export function generateThemeCSS(theme: Partial<ThemeColors>): string;
330
+
331
+ // ============================================================================
332
+ // Svelte Component Exports
333
+ // ============================================================================
334
+
335
+ /**
336
+ * VenueCalendar Svelte component (CalendarContainer)
337
+ */
338
+ export const VenueCalendar: any;
339
+
340
+ /**
341
+ * EventDetailsView Svelte component
342
+ */
343
+ export const EventDetailsView: any;
344
+
345
+ /**
346
+ * CartView Svelte component
347
+ */
348
+ export const CartView: any;
349
+
350
+ /**
351
+ * Checkout Svelte component
352
+ */
353
+ export const Checkout: any;
354
+
355
+ /**
356
+ * CheckoutView alias for Checkout
357
+ */
358
+ export const CheckoutView: any;
359
+
360
+ /**
361
+ * Success Svelte component
362
+ */
363
+ export const Success: any;
364
+
365
+ // ============================================================================
366
+ // Default Export
367
+ // ============================================================================
368
+
369
+ declare const _default: {
370
+ initVenueCalendar: typeof initVenueCalendar;
371
+ initEventDetailsView: typeof initEventDetailsView;
372
+ initCartView: typeof initCartView;
373
+ initCart: typeof initCartView;
374
+ initCheckoutView: typeof initCheckoutView;
375
+ initCheckout: typeof initCheckoutView;
376
+ initSuccessView: typeof initSuccessView;
377
+ initSuccess: typeof initSuccessView;
378
+ autoMount: typeof autoMount;
379
+ VenueCalendar: any;
380
+ themes: Themes;
381
+ lightTheme: ThemeColors;
382
+ darkTheme: ThemeColors;
383
+ highContrastTheme: ThemeColors;
384
+ applyTheme: typeof applyTheme;
385
+ generateThemeCSS: typeof generateThemeCSS;
386
+ EventDetailsView: any;
387
+ CartView: any;
388
+ Checkout: any;
389
+ CheckoutView: any;
390
+ Success: any;
391
+ /** @deprecated Use Success instead */
392
+ Sucess: any;
393
+ };
394
+
395
+ export default _default;