@getmicdrop/venue-calendar 3.3.0 → 3.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/README.md +661 -661
- package/dist/VenueCalendar-BMSfRl2d.js.map +1 -1
- package/dist/api/api.cjs +2 -0
- package/dist/api/api.cjs.map +1 -0
- package/dist/api/api.mjs +787 -0
- package/dist/api/api.mjs.map +1 -0
- package/dist/api/client.d.ts +46 -0
- package/dist/api/events.d.ts +102 -0
- package/dist/api/index.d.ts +38 -0
- package/dist/api/orders.d.ts +104 -0
- package/dist/api/promo.d.ts +45 -0
- package/dist/api/transformers/event.d.ts +86 -0
- package/dist/api/transformers/index.d.ts +9 -0
- package/dist/api/transformers/order.d.ts +105 -0
- package/dist/api/transformers/venue.d.ts +48 -0
- package/{src/lib/api/types.ts → dist/api/types.d.ts} +289 -289
- package/dist/api/venues.d.ts +33 -0
- package/dist/types/index.d.ts +395 -395
- package/dist/venue-calendar.iife.js.map +1 -1
- package/dist/venue-calendar.umd.js.map +1 -1
- package/package.json +96 -93
- package/src/lib/theme.js +209 -209
- package/src/lib/api/client.ts +0 -210
- package/src/lib/api/events.ts +0 -358
- package/src/lib/api/index.ts +0 -182
- package/src/lib/api/orders.ts +0 -390
- package/src/lib/api/promo.ts +0 -164
- package/src/lib/api/transformers/event.ts +0 -248
- package/src/lib/api/transformers/index.ts +0 -29
- package/src/lib/api/transformers/order.ts +0 -207
- package/src/lib/api/transformers/venue.ts +0 -118
- package/src/lib/api/venues.ts +0 -100
package/dist/api/api.mjs
ADDED
|
@@ -0,0 +1,787 @@
|
|
|
1
|
+
const n = {
|
|
2
|
+
/**
|
|
3
|
+
* Log debug message
|
|
4
|
+
* @param {string} message
|
|
5
|
+
* @param {...unknown} args
|
|
6
|
+
*/
|
|
7
|
+
debug: (e, ...r) => {
|
|
8
|
+
},
|
|
9
|
+
/**
|
|
10
|
+
* Log info message
|
|
11
|
+
* @param {string} message
|
|
12
|
+
* @param {...unknown} args
|
|
13
|
+
*/
|
|
14
|
+
info: (e, ...r) => {
|
|
15
|
+
},
|
|
16
|
+
/**
|
|
17
|
+
* Log warning message
|
|
18
|
+
* @param {string} message
|
|
19
|
+
* @param {...unknown} args
|
|
20
|
+
*/
|
|
21
|
+
warn: (e, ...r) => {
|
|
22
|
+
},
|
|
23
|
+
/**
|
|
24
|
+
* Log error message
|
|
25
|
+
* @param {string} message
|
|
26
|
+
* @param {...unknown} args
|
|
27
|
+
*/
|
|
28
|
+
error: (e, ...r) => {
|
|
29
|
+
}
|
|
30
|
+
}, w = {
|
|
31
|
+
baseUrl: "https://get-micdrop.com",
|
|
32
|
+
timeout: 3e4,
|
|
33
|
+
onError: (e) => n.error("API Error:", e)
|
|
34
|
+
};
|
|
35
|
+
let u = { ...w };
|
|
36
|
+
function S(e) {
|
|
37
|
+
u = { ...u, ...e };
|
|
38
|
+
}
|
|
39
|
+
function F() {
|
|
40
|
+
return { ...u };
|
|
41
|
+
}
|
|
42
|
+
function c() {
|
|
43
|
+
return `${u.baseUrl}/api/v2/public`;
|
|
44
|
+
}
|
|
45
|
+
function l() {
|
|
46
|
+
return `${u.baseUrl}/api/public`;
|
|
47
|
+
}
|
|
48
|
+
function _() {
|
|
49
|
+
return `${u.baseUrl}/api/orders/public`;
|
|
50
|
+
}
|
|
51
|
+
async function k() {
|
|
52
|
+
try {
|
|
53
|
+
return (await (await fetch("https://api.ipify.org?format=json")).json()).ip || "";
|
|
54
|
+
} catch (e) {
|
|
55
|
+
return n.warn("Could not fetch client IP:", e), "";
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async function U(e, r) {
|
|
59
|
+
return h("GET", e, void 0, r);
|
|
60
|
+
}
|
|
61
|
+
async function q(e, r, t) {
|
|
62
|
+
return h("POST", e, r, t);
|
|
63
|
+
}
|
|
64
|
+
async function z(e, r, t) {
|
|
65
|
+
return h("PUT", e, r, t);
|
|
66
|
+
}
|
|
67
|
+
async function L(e, r) {
|
|
68
|
+
return h("DELETE", e, void 0, r);
|
|
69
|
+
}
|
|
70
|
+
async function h(e, r, t, o) {
|
|
71
|
+
const s = r.startsWith("http") ? r : `${c()}${r}`, d = new AbortController(), i = setTimeout(() => d.abort(), u.timeout);
|
|
72
|
+
try {
|
|
73
|
+
const a = await fetch(s, {
|
|
74
|
+
method: e,
|
|
75
|
+
headers: {
|
|
76
|
+
"Content-Type": "application/json",
|
|
77
|
+
...o?.headers
|
|
78
|
+
},
|
|
79
|
+
body: t ? JSON.stringify(t) : void 0,
|
|
80
|
+
credentials: "include",
|
|
81
|
+
signal: d.signal,
|
|
82
|
+
...o
|
|
83
|
+
});
|
|
84
|
+
if (clearTimeout(i), !a.ok) {
|
|
85
|
+
const m = await a.json().catch(() => ({})), g = new Error(
|
|
86
|
+
m.error || m.message || `HTTP ${a.status}`
|
|
87
|
+
);
|
|
88
|
+
return u.onError(g), {
|
|
89
|
+
success: !1,
|
|
90
|
+
error: m.error || m.message || `HTTP ${a.status}`,
|
|
91
|
+
statusCode: a.status
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
success: !0,
|
|
96
|
+
data: await a.json(),
|
|
97
|
+
statusCode: a.status
|
|
98
|
+
};
|
|
99
|
+
} catch (a) {
|
|
100
|
+
clearTimeout(i);
|
|
101
|
+
const f = a instanceof Error ? a.name === "AbortError" ? "Request timed out" : a.message : "Unknown error";
|
|
102
|
+
return u.onError(a instanceof Error ? a : new Error(f)), {
|
|
103
|
+
success: !1,
|
|
104
|
+
error: f
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async function $(e, r) {
|
|
109
|
+
try {
|
|
110
|
+
const t = await fetch(e, {
|
|
111
|
+
credentials: "include",
|
|
112
|
+
...r
|
|
113
|
+
});
|
|
114
|
+
if (!t.ok) {
|
|
115
|
+
const o = await t.json().catch(() => ({}));
|
|
116
|
+
return n.error(`API request failed: ${t.status}`, o), null;
|
|
117
|
+
}
|
|
118
|
+
return t.json();
|
|
119
|
+
} catch (t) {
|
|
120
|
+
return n.error("API request error:", t), null;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
async function T(e, r) {
|
|
124
|
+
try {
|
|
125
|
+
const t = await fetch(
|
|
126
|
+
`${_()}/cart/${e}/payment-intent`,
|
|
127
|
+
{
|
|
128
|
+
method: "POST",
|
|
129
|
+
headers: {
|
|
130
|
+
"Content-Type": "application/json"
|
|
131
|
+
},
|
|
132
|
+
credentials: "include",
|
|
133
|
+
body: JSON.stringify({
|
|
134
|
+
productQuantities: r
|
|
135
|
+
})
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
if (!t.ok) {
|
|
139
|
+
const s = await t.json().catch(() => ({}));
|
|
140
|
+
throw n.error("Payment intent creation failed:", s), new Error(s.error || "Failed to create payment intent");
|
|
141
|
+
}
|
|
142
|
+
const o = await t.json();
|
|
143
|
+
return n.debug("Payment intent created:", o), o;
|
|
144
|
+
} catch (t) {
|
|
145
|
+
return n.error("createPaymentIntent error:", t), null;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
async function R(e) {
|
|
149
|
+
try {
|
|
150
|
+
const r = await fetch(
|
|
151
|
+
`${c()}/orders/complete/${e}`,
|
|
152
|
+
{
|
|
153
|
+
method: "POST",
|
|
154
|
+
headers: {
|
|
155
|
+
"Content-Type": "application/json"
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
return r.ok ? {
|
|
160
|
+
success: !0,
|
|
161
|
+
message: (await r.json()).message
|
|
162
|
+
} : {
|
|
163
|
+
success: !1,
|
|
164
|
+
error: (await r.json().catch(() => ({}))).error || "Failed to complete reservation"
|
|
165
|
+
};
|
|
166
|
+
} catch (r) {
|
|
167
|
+
return n.error("Error completing reservation:", r), { success: !1, error: "Network error completing reservation" };
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
async function M(e) {
|
|
171
|
+
try {
|
|
172
|
+
const r = await fetch(
|
|
173
|
+
`${c()}/orders/cancel/${e}`,
|
|
174
|
+
{
|
|
175
|
+
method: "POST",
|
|
176
|
+
headers: {
|
|
177
|
+
"Content-Type": "application/json"
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
);
|
|
181
|
+
return r.ok ? {
|
|
182
|
+
success: !0,
|
|
183
|
+
message: (await r.json()).message
|
|
184
|
+
} : {
|
|
185
|
+
success: !1,
|
|
186
|
+
error: (await r.json().catch(() => ({}))).error || "Failed to cancel reservation"
|
|
187
|
+
};
|
|
188
|
+
} catch (r) {
|
|
189
|
+
return n.error("Error cancelling reservation:", r), { success: !1, error: "Network error cancelling reservation" };
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
async function B(e, r) {
|
|
193
|
+
try {
|
|
194
|
+
const t = await fetch(`${l()}/createOrder`, {
|
|
195
|
+
method: "POST",
|
|
196
|
+
headers: {
|
|
197
|
+
"Content-Type": "application/json"
|
|
198
|
+
},
|
|
199
|
+
body: JSON.stringify({
|
|
200
|
+
eventID: e,
|
|
201
|
+
promoCode: r
|
|
202
|
+
})
|
|
203
|
+
});
|
|
204
|
+
if (!t.ok) {
|
|
205
|
+
const o = await t.json().catch(() => ({}));
|
|
206
|
+
return n.error("Create order failed:", o), null;
|
|
207
|
+
}
|
|
208
|
+
return t.json();
|
|
209
|
+
} catch (t) {
|
|
210
|
+
return n.error("createOrder error:", t), null;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
async function H(e) {
|
|
214
|
+
return $(`${l()}/getOrder/${e}`);
|
|
215
|
+
}
|
|
216
|
+
async function J(e, r) {
|
|
217
|
+
try {
|
|
218
|
+
const t = await fetch(
|
|
219
|
+
`${l()}/validatePaymentIntent/${e}`,
|
|
220
|
+
{
|
|
221
|
+
method: "POST",
|
|
222
|
+
headers: {
|
|
223
|
+
"Content-Type": "application/json"
|
|
224
|
+
},
|
|
225
|
+
body: JSON.stringify(r)
|
|
226
|
+
}
|
|
227
|
+
);
|
|
228
|
+
if (!t.ok) {
|
|
229
|
+
const s = await t.json().catch(() => ({}));
|
|
230
|
+
return n.error("Payment validation failed:", s), {
|
|
231
|
+
success: !1,
|
|
232
|
+
status: "failed",
|
|
233
|
+
error: s.error || "Payment validation failed"
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
const o = await t.json();
|
|
237
|
+
return {
|
|
238
|
+
success: !0,
|
|
239
|
+
status: o.status || "Payment succeeded",
|
|
240
|
+
orderUUID: o.orderUUID || o.uuid
|
|
241
|
+
};
|
|
242
|
+
} catch (t) {
|
|
243
|
+
return n.error("validatePaymentIntent error:", t), null;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
async function O(e) {
|
|
247
|
+
try {
|
|
248
|
+
const r = await fetch(`${c()}/orders/extend-session`, {
|
|
249
|
+
method: "POST",
|
|
250
|
+
headers: {
|
|
251
|
+
"Content-Type": "application/json"
|
|
252
|
+
},
|
|
253
|
+
body: JSON.stringify({ orderUuid: e })
|
|
254
|
+
});
|
|
255
|
+
if (!r.ok)
|
|
256
|
+
return {
|
|
257
|
+
success: !1,
|
|
258
|
+
error: (await r.json().catch(() => ({}))).error || "Failed to extend session"
|
|
259
|
+
};
|
|
260
|
+
const t = await r.json();
|
|
261
|
+
return {
|
|
262
|
+
success: !0,
|
|
263
|
+
newExpiryTime: t.newExpiryTime,
|
|
264
|
+
remainingExtensions: t.remainingExtensions
|
|
265
|
+
};
|
|
266
|
+
} catch (r) {
|
|
267
|
+
return n.error("Error extending checkout session:", r), { success: !1, error: "Network error extending session" };
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
async function W(e) {
|
|
271
|
+
try {
|
|
272
|
+
const r = await fetch(
|
|
273
|
+
`${c()}/orders/session/${e}`
|
|
274
|
+
);
|
|
275
|
+
if (!r.ok)
|
|
276
|
+
return { error: (await r.json().catch(() => ({}))).error || "No active session found" };
|
|
277
|
+
const t = await r.json();
|
|
278
|
+
return {
|
|
279
|
+
expiresAt: t.expiresAt,
|
|
280
|
+
extensionCount: t.extensionCount,
|
|
281
|
+
remainingExtensions: t.remainingExtensions,
|
|
282
|
+
canExtend: t.canExtend,
|
|
283
|
+
reservationCount: t.reservationCount
|
|
284
|
+
};
|
|
285
|
+
} catch (r) {
|
|
286
|
+
return n.error("Error getting session status:", r), { error: "Network error getting session status" };
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
async function G(e = {}) {
|
|
290
|
+
try {
|
|
291
|
+
const r = await fetch(`${l()}/createOrder`, {
|
|
292
|
+
method: "POST",
|
|
293
|
+
headers: {
|
|
294
|
+
"Content-Type": "application/json"
|
|
295
|
+
},
|
|
296
|
+
body: JSON.stringify(e)
|
|
297
|
+
});
|
|
298
|
+
if (!r.ok) {
|
|
299
|
+
const o = await r.json().catch(() => ({}));
|
|
300
|
+
return n.error("Order initiation failed:", o), null;
|
|
301
|
+
}
|
|
302
|
+
return (await r.json()).uuid;
|
|
303
|
+
} catch (r) {
|
|
304
|
+
return n.error("initiateOrder error:", r), null;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
async function Q(e) {
|
|
308
|
+
if (typeof window > "u") return;
|
|
309
|
+
const t = new URLSearchParams(window.location.search).get("utm_source") || "Direct";
|
|
310
|
+
try {
|
|
311
|
+
await fetch(
|
|
312
|
+
`${l()}/increment/${e}/${encodeURIComponent(t)}`
|
|
313
|
+
);
|
|
314
|
+
} catch (o) {
|
|
315
|
+
n.error("UTM tracking failed:", o);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
async function K(e, r) {
|
|
319
|
+
try {
|
|
320
|
+
if (!r || !r.trim())
|
|
321
|
+
return { valid: !1, error: "Promo code is required" };
|
|
322
|
+
const t = encodeURIComponent(r.trim()), o = await fetch(
|
|
323
|
+
`${c()}/promo-codes/validate/${e}/${t}`
|
|
324
|
+
);
|
|
325
|
+
if (!o.ok)
|
|
326
|
+
return o.status === 404 ? { valid: !1, error: "Invalid promo code" } : { valid: !1, error: (await o.json().catch(() => ({}))).error || "Failed to validate code" };
|
|
327
|
+
const s = await o.json();
|
|
328
|
+
return {
|
|
329
|
+
valid: s.valid ?? !0,
|
|
330
|
+
revealHiddenTickets: s.revealHiddenTickets,
|
|
331
|
+
revealTicketIds: s.revealTicketIds,
|
|
332
|
+
provideDiscount: s.provideDiscount,
|
|
333
|
+
discountType: s.discountType,
|
|
334
|
+
amount: s.amount,
|
|
335
|
+
code: s.code || r
|
|
336
|
+
};
|
|
337
|
+
} catch (t) {
|
|
338
|
+
return n.error("Error validating promo code:", t), { valid: !1, error: "Network error validating code" };
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
async function X(e) {
|
|
342
|
+
try {
|
|
343
|
+
const r = await fetch(
|
|
344
|
+
`${c()}/promo-codes/check/${e}`
|
|
345
|
+
);
|
|
346
|
+
return r.ok ? (await r.json()).hasPromoCodes === !0 : !0;
|
|
347
|
+
} catch (r) {
|
|
348
|
+
return n.error("Error checking promo codes availability:", r), !0;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
async function Y(e, r) {
|
|
352
|
+
try {
|
|
353
|
+
const t = await fetch(
|
|
354
|
+
`${c()}/orders/${e}/apply-promo`,
|
|
355
|
+
{
|
|
356
|
+
method: "POST",
|
|
357
|
+
headers: {
|
|
358
|
+
"Content-Type": "application/json"
|
|
359
|
+
},
|
|
360
|
+
body: JSON.stringify({ code: r })
|
|
361
|
+
}
|
|
362
|
+
);
|
|
363
|
+
return t.ok ? { success: !0 } : {
|
|
364
|
+
success: !1,
|
|
365
|
+
error: (await t.json().catch(() => ({}))).error || "Failed to apply promo code"
|
|
366
|
+
};
|
|
367
|
+
} catch (t) {
|
|
368
|
+
return n.error("Error applying promo code:", t), { success: !1, error: "Network error applying code" };
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
async function Z(e) {
|
|
372
|
+
try {
|
|
373
|
+
const r = await fetch(
|
|
374
|
+
`${c()}/orders/${e}/remove-promo`,
|
|
375
|
+
{
|
|
376
|
+
method: "POST",
|
|
377
|
+
headers: {
|
|
378
|
+
"Content-Type": "application/json"
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
);
|
|
382
|
+
return r.ok ? { success: !0 } : {
|
|
383
|
+
success: !1,
|
|
384
|
+
error: (await r.json().catch(() => ({}))).error || "Failed to remove promo code"
|
|
385
|
+
};
|
|
386
|
+
} catch (r) {
|
|
387
|
+
return n.error("Error removing promo code:", r), { success: !1, error: "Network error removing code" };
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
async function p(e, r = fetch) {
|
|
391
|
+
try {
|
|
392
|
+
const t = await r(`${c()}/events/${e}`);
|
|
393
|
+
if (!t.ok)
|
|
394
|
+
throw new Error(`Failed to fetch event details: ${t.status}`);
|
|
395
|
+
return t.json();
|
|
396
|
+
} catch (t) {
|
|
397
|
+
return n.error("Error fetching event details:", t), null;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
async function E(e) {
|
|
401
|
+
try {
|
|
402
|
+
const r = await fetch(
|
|
403
|
+
`${c()}/tickets/event/${e}`
|
|
404
|
+
);
|
|
405
|
+
if (!r.ok)
|
|
406
|
+
throw new Error(`Failed to fetch tickets: ${r.status}`);
|
|
407
|
+
const t = await r.json();
|
|
408
|
+
return Array.isArray(t) ? t : [];
|
|
409
|
+
} catch (r) {
|
|
410
|
+
return n.error("Error fetching tickets:", r), [];
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
async function V(e) {
|
|
414
|
+
try {
|
|
415
|
+
if (!e)
|
|
416
|
+
return n.warn("fetchEventPerformers called without eventId"), { performers: [], showPerformers: !1 };
|
|
417
|
+
const r = await fetch(
|
|
418
|
+
`${c()}/events/${e}/performers`
|
|
419
|
+
);
|
|
420
|
+
if (!r.ok)
|
|
421
|
+
return n.error(
|
|
422
|
+
`Failed to fetch performers: ${r.status} ${r.statusText}`
|
|
423
|
+
), { performers: [], showPerformers: !1 };
|
|
424
|
+
const t = await r.json();
|
|
425
|
+
return {
|
|
426
|
+
performers: Array.isArray(t.performers) ? t.performers : [],
|
|
427
|
+
showPerformers: t.showPerformers === !0
|
|
428
|
+
};
|
|
429
|
+
} catch (r) {
|
|
430
|
+
return n.error("Error fetching event performers:", r), { performers: [], showPerformers: !1 };
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
async function ee(e) {
|
|
434
|
+
try {
|
|
435
|
+
if (!e)
|
|
436
|
+
return n.warn("fetchAllVenues called without orgId"), [];
|
|
437
|
+
const r = await fetch(
|
|
438
|
+
`${c()}/venues/organization/${e}`
|
|
439
|
+
);
|
|
440
|
+
if (!r.ok)
|
|
441
|
+
return n.error(
|
|
442
|
+
`Failed to fetch venues: ${r.status} ${r.statusText}`
|
|
443
|
+
), [];
|
|
444
|
+
const t = await r.json();
|
|
445
|
+
return Array.isArray(t) ? t : [];
|
|
446
|
+
} catch (r) {
|
|
447
|
+
return n.error("Error fetching venues:", r), [];
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
async function re(e) {
|
|
451
|
+
try {
|
|
452
|
+
if (!e)
|
|
453
|
+
return n.warn("fetchVenueEvents called without venueId"), [];
|
|
454
|
+
const r = await fetch(
|
|
455
|
+
`${c()}/events/venue/${e}`
|
|
456
|
+
);
|
|
457
|
+
if (!r.ok)
|
|
458
|
+
return n.error(
|
|
459
|
+
`Failed to fetch venue events: ${r.status} ${r.statusText}`
|
|
460
|
+
), [];
|
|
461
|
+
const t = await r.json();
|
|
462
|
+
return Array.isArray(t) ? t : [];
|
|
463
|
+
} catch (r) {
|
|
464
|
+
return n.error("Error fetching venue events:", r), [];
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
async function te(e, r, t) {
|
|
468
|
+
try {
|
|
469
|
+
const o = await fetch(
|
|
470
|
+
`${c()}/events/venue/${e}/month/${r}/${t}`
|
|
471
|
+
);
|
|
472
|
+
if (!o.ok)
|
|
473
|
+
return n.error(`Failed to fetch month events: ${o.status}`), [];
|
|
474
|
+
const s = await o.json();
|
|
475
|
+
return Array.isArray(s.events) ? s.events : Array.isArray(s) ? s : [];
|
|
476
|
+
} catch (o) {
|
|
477
|
+
return n.error("Error fetching month events:", o), [];
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
async function oe(e, r, t) {
|
|
481
|
+
try {
|
|
482
|
+
const o = await fetch(
|
|
483
|
+
`${c()}/events/organization/${e}/month/${r}/${t}`
|
|
484
|
+
);
|
|
485
|
+
if (!o.ok)
|
|
486
|
+
return n.error(`Failed to fetch org month events: ${o.status}`), [];
|
|
487
|
+
const s = await o.json();
|
|
488
|
+
return Array.isArray(s.events) ? s.events : Array.isArray(s) ? s : [];
|
|
489
|
+
} catch (o) {
|
|
490
|
+
return n.error("Error fetching org month events:", o), [];
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
async function ne(e) {
|
|
494
|
+
try {
|
|
495
|
+
const r = await fetch(
|
|
496
|
+
`${c()}/series/${e}/occurrences`
|
|
497
|
+
);
|
|
498
|
+
return r.ok ? r.json() : (n.error(`Failed to fetch series occurrences: ${r.status}`), null);
|
|
499
|
+
} catch (r) {
|
|
500
|
+
return n.error("Error fetching series occurrences:", r), null;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
async function se(e, r) {
|
|
504
|
+
try {
|
|
505
|
+
const t = await fetch(
|
|
506
|
+
`${c()}/series/${e}/occurrences?venueId=${r}`
|
|
507
|
+
);
|
|
508
|
+
return t.ok ? t.json() : (n.error(`Failed to fetch series with CTA: ${t.status}`), null);
|
|
509
|
+
} catch (t) {
|
|
510
|
+
return n.error("Error fetching series occurrences:", t), null;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
async function ae(e, r) {
|
|
514
|
+
try {
|
|
515
|
+
const t = encodeURIComponent(r), o = await fetch(
|
|
516
|
+
`${c()}/events/${e}/check-password/${t}`
|
|
517
|
+
);
|
|
518
|
+
return o.ok ? (await o.json()).valid === !0 : !1;
|
|
519
|
+
} catch (t) {
|
|
520
|
+
return n.error("Error checking event password:", t), !1;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
async function ce(e, r) {
|
|
524
|
+
try {
|
|
525
|
+
const t = r ? `${c()}/events/venue/${r}` : e ? `${c()}/venues/organization/${e}` : `${c()}/health`;
|
|
526
|
+
return (await fetch(t, {
|
|
527
|
+
method: "HEAD"
|
|
528
|
+
})).ok;
|
|
529
|
+
} catch (t) {
|
|
530
|
+
return n.error("Network connection test failed:", t), !1;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
async function v(e) {
|
|
534
|
+
try {
|
|
535
|
+
if (!e)
|
|
536
|
+
return n.warn("getVenue called without venueId"), null;
|
|
537
|
+
const r = await fetch(`${l()}/getVenue/${e}`);
|
|
538
|
+
return r.ok ? r.json() : (n.error(`Failed to fetch venue: ${r.status}`), null);
|
|
539
|
+
} catch (r) {
|
|
540
|
+
return n.error("Error fetching venue:", r), null;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
async function ie(e) {
|
|
544
|
+
const r = await v(e);
|
|
545
|
+
return r ? {
|
|
546
|
+
serviceFeePercentage: r.serviceFeePercentage ?? 0,
|
|
547
|
+
serviceFeeCents: r.serviceFeeCents ?? 0,
|
|
548
|
+
taxPercentage: r.taxPercentage ?? 0
|
|
549
|
+
} : null;
|
|
550
|
+
}
|
|
551
|
+
async function ue(e) {
|
|
552
|
+
try {
|
|
553
|
+
if (!e)
|
|
554
|
+
return n.warn("getVenueBySlug called without slug"), null;
|
|
555
|
+
const r = encodeURIComponent(e), t = await fetch(`${l()}/venue/${r}`);
|
|
556
|
+
return t.ok ? t.json() : (n.error(`Failed to fetch venue by slug: ${t.status}`), null);
|
|
557
|
+
} catch (r) {
|
|
558
|
+
return n.error("Error fetching venue by slug:", r), null;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
function P(e) {
|
|
562
|
+
return {
|
|
563
|
+
uuid: e.uuid || String(e.id || e.ID || ""),
|
|
564
|
+
id: e.id || e.ID,
|
|
565
|
+
ticketNumber: e.ticketNumber || e.ticket_number,
|
|
566
|
+
orderId: e.orderId || e.order_id,
|
|
567
|
+
attendeeFirstName: e.attendeeFirstName || e.attendee_first_name || e.firstName,
|
|
568
|
+
attendeeLastName: e.attendeeLastName || e.attendee_last_name || e.lastName,
|
|
569
|
+
attendeeEmail: e.attendeeEmail || e.attendee_email || e.email,
|
|
570
|
+
ticketName: e.ticketName || e.ticket_name || e.name || "",
|
|
571
|
+
ticketTypeId: e.ticketTypeId || e.ticket_type_id,
|
|
572
|
+
purchasePrice: e.purchasePrice || e.purchase_price || e.price || 0,
|
|
573
|
+
status: e.status,
|
|
574
|
+
checkedIn: e.checkedIn || e.checked_in,
|
|
575
|
+
checkedInAt: e.checkedInAt || e.checked_in_at
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
function A(e) {
|
|
579
|
+
const r = e.purchasedTickets || e.tickets || e.purchased_tickets || [];
|
|
580
|
+
return {
|
|
581
|
+
uuid: e.uuid || String(e.id || e.ID || ""),
|
|
582
|
+
id: e.id || e.ID,
|
|
583
|
+
customerEmail: e.customerEmail || e.email || e.customer_email || "",
|
|
584
|
+
customerFirstName: e.customerFirstName || e.firstName || e.first_name,
|
|
585
|
+
customerLastName: e.customerLastName || e.lastName || e.last_name,
|
|
586
|
+
status: e.status || "unknown",
|
|
587
|
+
totalAmount: e.totalAmount || e.total || e.total_amount || 0,
|
|
588
|
+
subtotal: e.subtotal,
|
|
589
|
+
serviceFeesAmount: e.serviceFeesAmount || e.serviceFee || e.service_fee || e.service_fees_amount || 0,
|
|
590
|
+
taxAmount: e.taxAmount || e.tax || e.tax_amount || 0,
|
|
591
|
+
discount: e.discount || 0,
|
|
592
|
+
paymentIntentId: e.paymentIntentId || e.payment_intent_id,
|
|
593
|
+
paymentMethod: e.paymentMethod || e.payment_method,
|
|
594
|
+
purchasedTickets: r.map(P),
|
|
595
|
+
createdAt: e.createdAt || e.created_at,
|
|
596
|
+
updatedAt: e.updatedAt || e.updated_at
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
function le(e) {
|
|
600
|
+
const r = A(e), t = r.uuid.split("-")[0] || r.uuid;
|
|
601
|
+
return {
|
|
602
|
+
orderId: r.uuid,
|
|
603
|
+
displayOrderId: t,
|
|
604
|
+
email: r.customerEmail,
|
|
605
|
+
customerName: [r.customerFirstName, r.customerLastName].filter(Boolean).join(" "),
|
|
606
|
+
total: r.totalAmount,
|
|
607
|
+
formattedTotal: `$${(r.totalAmount / 100).toFixed(2)}`,
|
|
608
|
+
ticketCount: r.purchasedTickets.length,
|
|
609
|
+
status: r.status
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
const D = "https://micdrop-images.sfo3.digitaloceanspaces.com";
|
|
613
|
+
function b(e) {
|
|
614
|
+
return e ? e.startsWith("http") ? e : `${D}/${e.replace(/^\//, "")}` : "";
|
|
615
|
+
}
|
|
616
|
+
function y(e) {
|
|
617
|
+
const r = e.imageUrl || e.imageURL || e.image_url || e.image || "";
|
|
618
|
+
return b(r);
|
|
619
|
+
}
|
|
620
|
+
function C(e) {
|
|
621
|
+
const r = e.ctaState || e.cta_state;
|
|
622
|
+
if (r)
|
|
623
|
+
return r;
|
|
624
|
+
if (e.isCancelled || e.is_cancelled)
|
|
625
|
+
return "ended";
|
|
626
|
+
const t = e.startDateTime || e.start_date_time || e.date;
|
|
627
|
+
if (t) {
|
|
628
|
+
const i = new Date(t).getTime(), a = Date.now();
|
|
629
|
+
if (i < a)
|
|
630
|
+
return "ended";
|
|
631
|
+
}
|
|
632
|
+
const o = e.ticketsAvailable ?? e.tickets_available;
|
|
633
|
+
if (o !== void 0)
|
|
634
|
+
return o <= 0 ? "sold_out" : "available";
|
|
635
|
+
const s = e.availableTickets || e.available_tickets || e.tickets || [];
|
|
636
|
+
return s.length === 0 ? "coming_soon" : s.reduce((i, a) => {
|
|
637
|
+
const f = a.quantityAvailable ?? a.quantity_available ?? a.quantity ?? 0, m = a.quantitySold ?? a.quantity_sold ?? 0;
|
|
638
|
+
return i + Math.max(0, f - m);
|
|
639
|
+
}, 0) <= 0 ? "sold_out" : "available";
|
|
640
|
+
}
|
|
641
|
+
function I(e) {
|
|
642
|
+
return {
|
|
643
|
+
id: e.id || e.ID,
|
|
644
|
+
name: e.name || e.ticketName || "",
|
|
645
|
+
description: e.description,
|
|
646
|
+
price: e.price || 0,
|
|
647
|
+
quantity: e.quantity || e.totalQuantity || 0,
|
|
648
|
+
quantitySold: e.quantitySold || e.quantity_sold || 0,
|
|
649
|
+
quantityAvailable: e.quantityAvailable || e.quantity_available || (e.quantity || 0) - (e.quantitySold || 0),
|
|
650
|
+
minPerOrder: e.minPerOrder || e.min_per_order || 1,
|
|
651
|
+
maxPerOrder: e.maxPerOrder || e.max_per_order || 10,
|
|
652
|
+
saleStartDate: e.saleStartDate || e.sale_start_date,
|
|
653
|
+
saleEndDate: e.saleEndDate || e.sale_end_date,
|
|
654
|
+
isHidden: e.isHidden || e.is_hidden || !1,
|
|
655
|
+
revealWithPromoCode: e.revealWithPromoCode || e.reveal_with_promo_code,
|
|
656
|
+
ticketType: e.ticketType || e.ticket_type || 0,
|
|
657
|
+
sectionId: e.sectionId || e.section_id,
|
|
658
|
+
sortOrder: e.sortOrder || e.sort_order || 0
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
function j(e) {
|
|
662
|
+
const t = (e.availableTickets || e.available_tickets || e.tickets || []).map(I), o = t.map((i) => i.price).filter((i) => i > 0), s = o.length > 0 ? Math.min(...o) : void 0, d = o.length > 0 ? Math.max(...o) : void 0;
|
|
663
|
+
return {
|
|
664
|
+
eventID: e.eventID || e.id || e.ID || 0,
|
|
665
|
+
id: e.id || e.ID,
|
|
666
|
+
name: e.name || e.title || "",
|
|
667
|
+
title: e.title || e.name,
|
|
668
|
+
slug: e.slug,
|
|
669
|
+
description: e.description,
|
|
670
|
+
date: e.date || e.startDateTime || e.start_date_time || "",
|
|
671
|
+
startDateTime: e.startDateTime || e.start_date_time,
|
|
672
|
+
endDateTime: e.endDateTime || e.end_date_time,
|
|
673
|
+
doorsOpenTime: e.doorsOpenTime || e.doors_open_time,
|
|
674
|
+
timezone: e.timezone || e.time_zone,
|
|
675
|
+
venueId: e.venueId || e.venue_id,
|
|
676
|
+
venueName: e.venueName || e.venue_name,
|
|
677
|
+
venueAddress: e.venueAddress || e.venue_address,
|
|
678
|
+
location: e.location || e.venueAddress || e.venue_address,
|
|
679
|
+
imageUrl: y(e),
|
|
680
|
+
imageURL: y(e),
|
|
681
|
+
status: e.status,
|
|
682
|
+
isPublished: e.isPublished ?? e.is_published,
|
|
683
|
+
isCancelled: e.isCancelled ?? e.is_cancelled,
|
|
684
|
+
availableTickets: t,
|
|
685
|
+
ticketsAvailable: e.ticketsAvailable ?? e.tickets_available ?? t.reduce((i, a) => i + (a.quantityAvailable || 0), 0),
|
|
686
|
+
ticketsSold: e.ticketsSold ?? e.tickets_sold,
|
|
687
|
+
minPrice: e.minPrice ?? e.min_price ?? s,
|
|
688
|
+
maxPrice: e.maxPrice ?? e.max_price ?? d,
|
|
689
|
+
ctaText: e.ctaText || e.cta_text,
|
|
690
|
+
ctaState: C(e),
|
|
691
|
+
showPerformers: e.showPerformers ?? e.show_performers,
|
|
692
|
+
eventSeriesId: e.eventSeriesId || e.event_series_id,
|
|
693
|
+
seriesInstanceNumber: e.seriesInstanceNumber || e.series_instance_number
|
|
694
|
+
};
|
|
695
|
+
}
|
|
696
|
+
const de = j, x = "https://micdrop-images.sfo3.digitaloceanspaces.com";
|
|
697
|
+
function N(e) {
|
|
698
|
+
return e ? e.startsWith("http") ? e : `${x}/${e.replace(/^\//, "")}` : "";
|
|
699
|
+
}
|
|
700
|
+
function me(e) {
|
|
701
|
+
const r = e.logoUrl || e.logo_url || e.logo;
|
|
702
|
+
return {
|
|
703
|
+
id: e.id || e.ID || 0,
|
|
704
|
+
name: e.name || "",
|
|
705
|
+
slug: e.slug,
|
|
706
|
+
address: e.address,
|
|
707
|
+
googleLocationNameCache: e.googleLocationNameCache || e.google_location_name_cache,
|
|
708
|
+
city: e.city,
|
|
709
|
+
state: e.state,
|
|
710
|
+
zipCode: e.zipCode || e.zip_code,
|
|
711
|
+
country: e.country,
|
|
712
|
+
timezone: e.timezone || e.time_zone,
|
|
713
|
+
logoUrl: N(r),
|
|
714
|
+
serviceFeePercentage: e.serviceFeePercentage ?? e.service_fee_percentage ?? 0,
|
|
715
|
+
serviceFeeCents: e.serviceFeeCents ?? e.service_fee_cents ?? 0,
|
|
716
|
+
taxPercentage: e.taxPercentage ?? e.tax_percentage ?? 0,
|
|
717
|
+
organizationId: e.organizationId || e.organization_id
|
|
718
|
+
};
|
|
719
|
+
}
|
|
720
|
+
function fe(e) {
|
|
721
|
+
return {
|
|
722
|
+
serviceFeePercentage: e.serviceFeePercentage ?? e.service_fee_percentage ?? 0,
|
|
723
|
+
serviceFeeCents: e.serviceFeeCents ?? e.service_fee_cents ?? 0,
|
|
724
|
+
taxPercentage: e.taxPercentage ?? e.tax_percentage ?? 0
|
|
725
|
+
};
|
|
726
|
+
}
|
|
727
|
+
function he(e) {
|
|
728
|
+
return [
|
|
729
|
+
e.address,
|
|
730
|
+
e.city,
|
|
731
|
+
e.state,
|
|
732
|
+
e.zipCode
|
|
733
|
+
].filter(Boolean).join(", ");
|
|
734
|
+
}
|
|
735
|
+
export {
|
|
736
|
+
L as apiDelete,
|
|
737
|
+
U as apiGet,
|
|
738
|
+
q as apiPost,
|
|
739
|
+
z as apiPut,
|
|
740
|
+
Y as applyPromoCode,
|
|
741
|
+
C as calculateCtaState,
|
|
742
|
+
M as cancelReservation,
|
|
743
|
+
ae as checkEventPassword,
|
|
744
|
+
R as completeReservation,
|
|
745
|
+
S as configureApi,
|
|
746
|
+
B as createOrder,
|
|
747
|
+
T as createPaymentIntent,
|
|
748
|
+
O as extendCheckoutSession,
|
|
749
|
+
fe as extractVenueFees,
|
|
750
|
+
ee as fetchAllVenues,
|
|
751
|
+
p as fetchEventDetails,
|
|
752
|
+
V as fetchEventPerformers,
|
|
753
|
+
E as fetchEventTickets,
|
|
754
|
+
se as fetchSeriesOccurrences,
|
|
755
|
+
re as fetchVenueEvents,
|
|
756
|
+
he as formatVenueAddress,
|
|
757
|
+
F as getApiConfig,
|
|
758
|
+
b as getCDNImageUrl,
|
|
759
|
+
k as getClientIP,
|
|
760
|
+
y as getEventImageUrl,
|
|
761
|
+
l as getLegacyPublicUrl,
|
|
762
|
+
te as getMonthEvents,
|
|
763
|
+
H as getOrder,
|
|
764
|
+
_ as getOrdersPublicUrl,
|
|
765
|
+
oe as getOrgMonthEvents,
|
|
766
|
+
c as getPublicBaseUrl,
|
|
767
|
+
ne as getSeriesOccurrences,
|
|
768
|
+
W as getSessionStatus,
|
|
769
|
+
v as getVenue,
|
|
770
|
+
ue as getVenueBySlug,
|
|
771
|
+
ie as getVenueFees,
|
|
772
|
+
X as hasPromoCodes,
|
|
773
|
+
G as initiateOrder,
|
|
774
|
+
Z as removePromoCode,
|
|
775
|
+
ce as testNetworkConnection,
|
|
776
|
+
Q as trackUTMSource,
|
|
777
|
+
I as transformAvailableTicket,
|
|
778
|
+
j as transformEvent,
|
|
779
|
+
de as transformEventData,
|
|
780
|
+
A as transformOrder,
|
|
781
|
+
le as transformOrderForDisplay,
|
|
782
|
+
P as transformTicket,
|
|
783
|
+
me as transformVenue,
|
|
784
|
+
J as validatePaymentIntent,
|
|
785
|
+
K as validatePromoCode
|
|
786
|
+
};
|
|
787
|
+
//# sourceMappingURL=api.mjs.map
|