@bookitive/js 0.1.6 → 0.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.
- package/dist/index.d.ts +153 -7
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -68,13 +68,31 @@ interface DtoPublicCheckoutTheme {
|
|
|
68
68
|
* Mode is the colour scheme: "light" or "dark".
|
|
69
69
|
* @example "light"
|
|
70
70
|
*/
|
|
71
|
-
mode?:
|
|
71
|
+
mode?: "light" | "dark";
|
|
72
72
|
/**
|
|
73
73
|
* Radius is the corner radius for fields and buttons.
|
|
74
74
|
* @example "12px"
|
|
75
75
|
*/
|
|
76
76
|
radius?: string;
|
|
77
77
|
}
|
|
78
|
+
interface DtoPublicDiscount {
|
|
79
|
+
/**
|
|
80
|
+
* Code is the normalized (uppercase) promo code.
|
|
81
|
+
* @example "EARLYBIRD"
|
|
82
|
+
*/
|
|
83
|
+
code?: string;
|
|
84
|
+
/**
|
|
85
|
+
* Kind is how the discount applies: "percent" of the items subtotal, or a
|
|
86
|
+
* "fixed" amount in the event currency's minor units.
|
|
87
|
+
* @example "percent"
|
|
88
|
+
*/
|
|
89
|
+
kind?: "percent" | "fixed";
|
|
90
|
+
/**
|
|
91
|
+
* Value is 1-100 for percent, minor units for fixed.
|
|
92
|
+
* @example 10
|
|
93
|
+
*/
|
|
94
|
+
value?: number;
|
|
95
|
+
}
|
|
78
96
|
interface DtoPublicEvent {
|
|
79
97
|
/** Event is the event's public identity: name, times, venue, currency. */
|
|
80
98
|
event?: DtoPublicEventInfo;
|
|
@@ -86,6 +104,11 @@ interface DtoPublicEvent {
|
|
|
86
104
|
floors?: DtoPublicFloorInfo[];
|
|
87
105
|
/** Org is the organizer's public branding (name, logo, accent colour). */
|
|
88
106
|
org?: DtoPublicOrg;
|
|
107
|
+
/**
|
|
108
|
+
* Protection describes the anti-scalping requirements a buyer must satisfy
|
|
109
|
+
* at checkout (verified phone, named tickets). All-false when unprotected.
|
|
110
|
+
*/
|
|
111
|
+
protection?: DtoPublicProtection;
|
|
89
112
|
/**
|
|
90
113
|
* TicketTypes are the sellable ticket categories with prices and limits.
|
|
91
114
|
* @uniqueItems false
|
|
@@ -151,7 +174,7 @@ interface DtoPublicFloor {
|
|
|
151
174
|
* Mode is "single" (one open space) or "sections" (subdivided blocks).
|
|
152
175
|
* @example "sections"
|
|
153
176
|
*/
|
|
154
|
-
mode?:
|
|
177
|
+
mode?: "single" | "sections";
|
|
155
178
|
/**
|
|
156
179
|
* Name is the floor's display label.
|
|
157
180
|
* @example "Ground floor"
|
|
@@ -195,7 +218,7 @@ interface DtoPublicFloorInfo {
|
|
|
195
218
|
* Mode is "single" (one open space) or "sections" (subdivided blocks).
|
|
196
219
|
* @example "sections"
|
|
197
220
|
*/
|
|
198
|
-
mode?:
|
|
221
|
+
mode?: "single" | "sections";
|
|
199
222
|
/**
|
|
200
223
|
* Name is the floor's display label.
|
|
201
224
|
* @example "Ground floor"
|
|
@@ -266,6 +289,11 @@ interface DtoPublicOrder {
|
|
|
266
289
|
* @example "CZK"
|
|
267
290
|
*/
|
|
268
291
|
currency?: string;
|
|
292
|
+
/**
|
|
293
|
+
* DiscountCents is what the redeemed promo code took off the total.
|
|
294
|
+
* @example 14900
|
|
295
|
+
*/
|
|
296
|
+
discountCents?: number;
|
|
269
297
|
/**
|
|
270
298
|
* ExpiresAt is when the held seats and this order expire (RFC 3339).
|
|
271
299
|
* @example "2026-06-20T18:15:00Z"
|
|
@@ -282,7 +310,7 @@ interface DtoPublicOrder {
|
|
|
282
310
|
* Status is the order lifecycle state at creation time.
|
|
283
311
|
* @example "pending"
|
|
284
312
|
*/
|
|
285
|
-
status?:
|
|
313
|
+
status?: "pending" | "paid" | "cancelled" | "expired";
|
|
286
314
|
/**
|
|
287
315
|
* TotalCents is the amount due in the event currency's minor units.
|
|
288
316
|
* @example 149000
|
|
@@ -310,6 +338,13 @@ interface DtoPublicOrderCustomer {
|
|
|
310
338
|
phone?: string;
|
|
311
339
|
}
|
|
312
340
|
interface DtoPublicOrderItem {
|
|
341
|
+
/**
|
|
342
|
+
* Attendees carries one full name per admitted person when the event
|
|
343
|
+
* requires named tickets — exactly Quantity names, in ticket order.
|
|
344
|
+
* @uniqueItems false
|
|
345
|
+
* @example ["Jana Nováková"]
|
|
346
|
+
*/
|
|
347
|
+
attendees?: string[];
|
|
313
348
|
/**
|
|
314
349
|
* GAAreaID is the standing area's id for standing ticket types.
|
|
315
350
|
* @example "1810000000000000601"
|
|
@@ -340,12 +375,26 @@ interface DtoPublicOrderRequest {
|
|
|
340
375
|
captchaToken?: string;
|
|
341
376
|
/** Customer is the buyer's contact details. */
|
|
342
377
|
customer: DtoPublicOrderCustomer;
|
|
378
|
+
/**
|
|
379
|
+
* DiscountCode redeems a promo code (case-insensitive); the discount is
|
|
380
|
+
* applied to the items subtotal and enforced against the code's limits.
|
|
381
|
+
* @minLength 2
|
|
382
|
+
* @maxLength 40
|
|
383
|
+
* @example "EARLYBIRD"
|
|
384
|
+
*/
|
|
385
|
+
discountCode?: string;
|
|
343
386
|
/**
|
|
344
387
|
* Items are the order lines; at least one is required.
|
|
345
388
|
* @minItems 1
|
|
346
389
|
* @uniqueItems false
|
|
347
390
|
*/
|
|
348
391
|
items: DtoPublicOrderItem[];
|
|
392
|
+
/**
|
|
393
|
+
* VerificationToken is the single-use token from the verify/check endpoint,
|
|
394
|
+
* required when the event demands a verified phone number.
|
|
395
|
+
* @example "3q2p8Zk1…"
|
|
396
|
+
*/
|
|
397
|
+
verificationToken?: string;
|
|
349
398
|
}
|
|
350
399
|
/** Org is the organizer's public branding (name, logo, accent colour). */
|
|
351
400
|
interface DtoPublicOrg {
|
|
@@ -385,6 +434,29 @@ interface DtoPublicPaymentDetail {
|
|
|
385
434
|
*/
|
|
386
435
|
variableSymbol?: string;
|
|
387
436
|
}
|
|
437
|
+
/**
|
|
438
|
+
* Protection describes the anti-scalping requirements a buyer must satisfy
|
|
439
|
+
* at checkout (verified phone, named tickets). All-false when unprotected.
|
|
440
|
+
*/
|
|
441
|
+
interface DtoPublicProtection {
|
|
442
|
+
/**
|
|
443
|
+
* PhonePrefixes is the allowlist of accepted international dialling codes
|
|
444
|
+
* (e.g. "+420"). Only meaningful when RequireVerifiedPhone is set.
|
|
445
|
+
* @uniqueItems false
|
|
446
|
+
* @example ["+420","+421"]
|
|
447
|
+
*/
|
|
448
|
+
phonePrefixes?: string[];
|
|
449
|
+
/**
|
|
450
|
+
* RequireAttendeeNames demands one attendee name per admitted person.
|
|
451
|
+
* @example false
|
|
452
|
+
*/
|
|
453
|
+
requireAttendeeNames?: boolean;
|
|
454
|
+
/**
|
|
455
|
+
* RequireVerifiedPhone gates checkout behind SMS phone verification.
|
|
456
|
+
* @example true
|
|
457
|
+
*/
|
|
458
|
+
requireVerifiedPhone?: boolean;
|
|
459
|
+
}
|
|
388
460
|
interface DtoPublicSeat {
|
|
389
461
|
/**
|
|
390
462
|
* Code is the human-facing seat label (section prefix + table + seat).
|
|
@@ -517,7 +589,7 @@ interface DtoPublicTable {
|
|
|
517
589
|
* Shape is the table outline: "round", "rect", or "row".
|
|
518
590
|
* @example "round"
|
|
519
591
|
*/
|
|
520
|
-
shape?:
|
|
592
|
+
shape?: "round" | "rect" | "row";
|
|
521
593
|
/**
|
|
522
594
|
* Sides is the seat count per edge for rect tables [top,right,bottom,left].
|
|
523
595
|
* @uniqueItems false
|
|
@@ -570,7 +642,13 @@ interface DtoPublicTicketType {
|
|
|
570
642
|
* Kind is "seated" (maps to a seat) or "standing" (sold by quantity).
|
|
571
643
|
* @example "standing"
|
|
572
644
|
*/
|
|
573
|
-
kind?:
|
|
645
|
+
kind?: "seated" | "standing";
|
|
646
|
+
/**
|
|
647
|
+
* MaxPerCustomer caps how many of this type one verified buyer may hold
|
|
648
|
+
* across orders (anti-scalping); absent when unlimited.
|
|
649
|
+
* @example 4
|
|
650
|
+
*/
|
|
651
|
+
maxPerCustomer?: number;
|
|
574
652
|
/**
|
|
575
653
|
* MaxPerOrder caps how many of this type a single order may contain.
|
|
576
654
|
* @example 6
|
|
@@ -609,6 +687,53 @@ interface DtoPublicTicketType {
|
|
|
609
687
|
*/
|
|
610
688
|
saleStartTime?: string;
|
|
611
689
|
}
|
|
690
|
+
interface DtoPublicVerification {
|
|
691
|
+
/**
|
|
692
|
+
* ExpiresAt is when the token stops being accepted (RFC 3339).
|
|
693
|
+
* @example "2026-06-20T18:30:00Z"
|
|
694
|
+
*/
|
|
695
|
+
expiresAt?: string;
|
|
696
|
+
/**
|
|
697
|
+
* Phone is the normalized number the token certifies.
|
|
698
|
+
* @example "+420777123456"
|
|
699
|
+
*/
|
|
700
|
+
phone?: string;
|
|
701
|
+
/**
|
|
702
|
+
* VerificationToken is consumed by exactly one order for this event.
|
|
703
|
+
* @example "5Yx…"
|
|
704
|
+
*/
|
|
705
|
+
verificationToken?: string;
|
|
706
|
+
}
|
|
707
|
+
interface DtoPublicVerifyCheckRequest {
|
|
708
|
+
/**
|
|
709
|
+
* Code is the OTP from the SMS.
|
|
710
|
+
* @minLength 4
|
|
711
|
+
* @maxLength 10
|
|
712
|
+
* @example "123456"
|
|
713
|
+
*/
|
|
714
|
+
code: string;
|
|
715
|
+
/**
|
|
716
|
+
* @minLength 8
|
|
717
|
+
* @maxLength 20
|
|
718
|
+
* @example "+420777123456"
|
|
719
|
+
*/
|
|
720
|
+
phone: string;
|
|
721
|
+
}
|
|
722
|
+
interface DtoPublicVerifyStartRequest {
|
|
723
|
+
/**
|
|
724
|
+
* CaptchaToken is the client-side captcha solution, verified server-side.
|
|
725
|
+
* @example "03AGdBq26…"
|
|
726
|
+
*/
|
|
727
|
+
captchaToken?: string;
|
|
728
|
+
/**
|
|
729
|
+
* Phone in international E.164 format.
|
|
730
|
+
* @minLength 8
|
|
731
|
+
* @maxLength 20
|
|
732
|
+
* @example "+420777123456"
|
|
733
|
+
*/
|
|
734
|
+
phone: string;
|
|
735
|
+
}
|
|
736
|
+
type ResponseAPIResponseEmpty = object;
|
|
612
737
|
|
|
613
738
|
/** One seat changing state. "reserved" appears only when the event shares
|
|
614
739
|
* reserved status publicly — a reserved seat may free up again. */
|
|
@@ -660,6 +785,13 @@ declare class BookitiveClient {
|
|
|
660
785
|
seating(): Promise<DtoPublicSeating>;
|
|
661
786
|
/** Live sellability snapshot (poll it, or use live() for push updates). */
|
|
662
787
|
availability(): Promise<DtoPublicAvailability>;
|
|
788
|
+
/**
|
|
789
|
+
* Previews a promo code: what applying it would do. Throws a
|
|
790
|
+
* BookitiveError with status 404 for unknown/paused/out-of-window codes
|
|
791
|
+
* and 409 (error.isConflict) when the code is fully redeemed. The order
|
|
792
|
+
* endpoint re-validates on submit.
|
|
793
|
+
*/
|
|
794
|
+
discount(code: string): Promise<DtoPublicDiscount>;
|
|
663
795
|
/**
|
|
664
796
|
* Places a bank-transfer reservation: seats are held atomically for the
|
|
665
797
|
* event's hold TTL and payment instructions are emailed (and returned).
|
|
@@ -667,6 +799,20 @@ declare class BookitiveClient {
|
|
|
667
799
|
* reselect.
|
|
668
800
|
*/
|
|
669
801
|
checkout(order: DtoPublicOrderRequest): Promise<DtoPublicOrder>;
|
|
802
|
+
/**
|
|
803
|
+
* Sends a one-time code by SMS for events that require a verified phone
|
|
804
|
+
* (event.protection.requireVerifiedPhone). Captcha-gated like checkout, so
|
|
805
|
+
* pass a captcha token minted on the Bookitive origin. Throws a
|
|
806
|
+
* BookitiveError: 400 (bad/disallowed number), 403 (captcha/blocked), or
|
|
807
|
+
* 429 (cooldown/rate limit — back off and let the buyer retry).
|
|
808
|
+
*/
|
|
809
|
+
verifyStart(phone: string, captchaToken?: string): Promise<void>;
|
|
810
|
+
/**
|
|
811
|
+
* Validates the SMS code and returns a single-use verificationToken (valid
|
|
812
|
+
* ~30 min) to pass as order.verificationToken. Throws a BookitiveError:
|
|
813
|
+
* 400 (wrong code), 410 (expired — resend), or 429 (too many attempts).
|
|
814
|
+
*/
|
|
815
|
+
verifyCheck(phone: string, code: string): Promise<DtoPublicVerification>;
|
|
670
816
|
/**
|
|
671
817
|
* Subscribes to live availability over websocket: `startstate` fires with
|
|
672
818
|
* the full snapshot on every (re)connect, then `seat` deltas stream in.
|
|
@@ -675,4 +821,4 @@ declare class BookitiveClient {
|
|
|
675
821
|
live(handlers: LiveHandlers): LiveSubscription;
|
|
676
822
|
}
|
|
677
823
|
|
|
678
|
-
export { BookitiveClient, type BookitiveClientOptions, BookitiveError, type DtoAPIError, DtoErrorCode, type DtoPublicAvailability, type DtoPublicCheckoutTheme, type DtoPublicEvent, type DtoPublicEventInfo, type DtoPublicFloor, type DtoPublicFloorInfo, type DtoPublicGAArea, type DtoPublicOrder, type DtoPublicOrderCustomer, type DtoPublicOrderItem, type DtoPublicOrderRequest, type DtoPublicOrg, type DtoPublicPaymentDetail, type DtoPublicSeat, type DtoPublicSeating, type DtoPublicSection, type DtoPublicTable, type DtoPublicTicketType, type LiveHandlers, LiveSubscription, type SeatDelta };
|
|
824
|
+
export { BookitiveClient, type BookitiveClientOptions, BookitiveError, type DtoAPIError, DtoErrorCode, type DtoPublicAvailability, type DtoPublicCheckoutTheme, type DtoPublicDiscount, type DtoPublicEvent, type DtoPublicEventInfo, type DtoPublicFloor, type DtoPublicFloorInfo, type DtoPublicGAArea, type DtoPublicOrder, type DtoPublicOrderCustomer, type DtoPublicOrderItem, type DtoPublicOrderRequest, type DtoPublicOrg, type DtoPublicPaymentDetail, type DtoPublicProtection, type DtoPublicSeat, type DtoPublicSeating, type DtoPublicSection, type DtoPublicTable, type DtoPublicTicketType, type DtoPublicVerification, type DtoPublicVerifyCheckRequest, type DtoPublicVerifyStartRequest, type LiveHandlers, LiveSubscription, type ResponseAPIResponseEmpty, type SeatDelta };
|
package/dist/index.js
CHANGED
|
@@ -98,6 +98,15 @@ var BookitiveClient = class {
|
|
|
98
98
|
availability() {
|
|
99
99
|
return this.#get("/availability");
|
|
100
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Previews a promo code: what applying it would do. Throws a
|
|
103
|
+
* BookitiveError with status 404 for unknown/paused/out-of-window codes
|
|
104
|
+
* and 409 (error.isConflict) when the code is fully redeemed. The order
|
|
105
|
+
* endpoint re-validates on submit.
|
|
106
|
+
*/
|
|
107
|
+
discount(code) {
|
|
108
|
+
return this.#get(`/discount?code=${encodeURIComponent(code)}`);
|
|
109
|
+
}
|
|
101
110
|
/**
|
|
102
111
|
* Places a bank-transfer reservation: seats are held atomically for the
|
|
103
112
|
* event's hold TTL and payment instructions are emailed (and returned).
|
|
@@ -112,6 +121,29 @@ var BookitiveClient = class {
|
|
|
112
121
|
});
|
|
113
122
|
return this.#parse(res, "checkout failed");
|
|
114
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Sends a one-time code by SMS for events that require a verified phone
|
|
126
|
+
* (event.protection.requireVerifiedPhone). Captcha-gated like checkout, so
|
|
127
|
+
* pass a captcha token minted on the Bookitive origin. Throws a
|
|
128
|
+
* BookitiveError: 400 (bad/disallowed number), 403 (captcha/blocked), or
|
|
129
|
+
* 429 (cooldown/rate limit — back off and let the buyer retry).
|
|
130
|
+
*/
|
|
131
|
+
async verifyStart(phone, captchaToken) {
|
|
132
|
+
const res = await this.#fetch(`${this.#base}/verify/start`, {
|
|
133
|
+
method: "POST",
|
|
134
|
+
headers: { "Content-Type": "application/json" },
|
|
135
|
+
body: JSON.stringify({ phone, captchaToken })
|
|
136
|
+
});
|
|
137
|
+
await this.#parse(res, "failed to send verification code");
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Validates the SMS code and returns a single-use verificationToken (valid
|
|
141
|
+
* ~30 min) to pass as order.verificationToken. Throws a BookitiveError:
|
|
142
|
+
* 400 (wrong code), 410 (expired — resend), or 429 (too many attempts).
|
|
143
|
+
*/
|
|
144
|
+
verifyCheck(phone, code) {
|
|
145
|
+
return this.#post("/verify/check", { phone, code });
|
|
146
|
+
}
|
|
115
147
|
/**
|
|
116
148
|
* Subscribes to live availability over websocket: `startstate` fires with
|
|
117
149
|
* the full snapshot on every (re)connect, then `seat` deltas stream in.
|
|
@@ -124,6 +156,14 @@ var BookitiveClient = class {
|
|
|
124
156
|
const res = await this.#fetch(`${this.#base}${path}`);
|
|
125
157
|
return this.#parse(res, `request failed: ${path || "/"}`);
|
|
126
158
|
}
|
|
159
|
+
async #post(path, body) {
|
|
160
|
+
const res = await this.#fetch(`${this.#base}${path}`, {
|
|
161
|
+
method: "POST",
|
|
162
|
+
headers: { "Content-Type": "application/json" },
|
|
163
|
+
body: JSON.stringify(body)
|
|
164
|
+
});
|
|
165
|
+
return this.#parse(res, `request failed: ${path}`);
|
|
166
|
+
}
|
|
127
167
|
async #parse(res, fallback) {
|
|
128
168
|
if (!res.ok) {
|
|
129
169
|
let body;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/generated/api.ts","../src/live.ts","../src/client.ts"],"sourcesContent":["/* eslint-disable */\n/* tslint:disable */\n// @ts-nocheck\n/*\n * ---------------------------------------------------------------\n * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##\n * ## ##\n * ## AUTHOR: acacode ##\n * ## SOURCE: https://github.com/acacode/swagger-typescript-api ##\n * ---------------------------------------------------------------\n */\n\n/**\n * Type is the stable, machine-readable error code.\n * @example \"CONFLICT\"\n */\nexport enum DtoErrorCode {\n\tErrInvalidPayload = 'INVALID_PAYLOAD',\n\tErrValidationFailed = 'VALIDATION_FAILED',\n\tErrNotFound = 'NOT_FOUND',\n\tErrConflict = 'CONFLICT',\n\tErrForbidden = 'FORBIDDEN',\n\tErrInternal = 'INTERNAL_ERROR',\n}\n\nexport interface DtoAPIError {\n\t/** Data carries optional structured context for the error. */\n\tdata?: any;\n\t/** Fields maps a request field to a validation message, when applicable. */\n\tfields?: Record<string, string>;\n\t/**\n\t * Msg is a human-readable description of what went wrong.\n\t * @example \"seat is no longer available\"\n\t */\n\tmsg?: string;\n\t/**\n\t * Timestamp is when the error was produced (RFC 3339).\n\t * @example \"2026-06-20T18:00:00Z\"\n\t */\n\ttimestamp?: string;\n\t/**\n\t * TraceID identifies this request in our logs; include it in support asks.\n\t * @example \"01JABCDoftraceZ\"\n\t */\n\ttraceId?: string;\n\t/** Type is the stable, machine-readable error code. */\n\ttype?: DtoErrorCode;\n}\n\nexport interface DtoPublicAvailability {\n\t/** GARemaining maps a standing area id to its remaining capacity. */\n\tgaRemaining?: Record<string, number>;\n\t/**\n\t * ReservedSeats marks which unavailable seats are merely reserved and may\n\t * free up again — present only when the event shares reserved status.\n\t * @uniqueItems false\n\t * @example [\"1810000000000000502\"]\n\t */\n\treservedSeats?: string[];\n\t/** TicketTypeRemaining maps a ticket type id to its remaining capacity. */\n\tticketTypeRemaining?: Record<string, number>;\n\t/**\n\t * UnavailableSeats lists the ids of seats that cannot currently be bought.\n\t * @uniqueItems false\n\t * @example [\"1810000000000000501\",\"1810000000000000502\"]\n\t */\n\tunavailableSeats?: string[];\n}\n\n/** CheckoutTheme customises the hosted checkout; null = Bookitive defaults. */\nexport interface DtoPublicCheckoutTheme {\n\t/**\n\t * ButtonLabel overrides the submit button text.\n\t * @example \"Objednat\"\n\t */\n\tbuttonLabel?: string;\n\t/**\n\t * FontFamily is an allowlisted font key (self-hosted by Bookitive).\n\t * @example \"inter\"\n\t */\n\tfontFamily?: string;\n\t/**\n\t * Mode is the colour scheme: \"light\" or \"dark\".\n\t * @example \"light\"\n\t */\n\tmode?: 'light' | 'dark';\n\t/**\n\t * Radius is the corner radius for fields and buttons.\n\t * @example \"12px\"\n\t */\n\tradius?: string;\n}\n\nexport interface DtoPublicEvent {\n\t/** Event is the event's public identity: name, times, venue, currency. */\n\tevent?: DtoPublicEventInfo;\n\t/**\n\t * Floors lets a host page render its floor tabs without loading the full\n\t * seating payload; ids match the seating endpoint's floors.\n\t * @uniqueItems false\n\t */\n\tfloors?: DtoPublicFloorInfo[];\n\t/** Org is the organizer's public branding (name, logo, accent colour). */\n\torg?: DtoPublicOrg;\n\t/**\n\t * TicketTypes are the sellable ticket categories with prices and limits.\n\t * @uniqueItems false\n\t */\n\tticketTypes?: DtoPublicTicketType[];\n}\n\n/** Event is the event's public identity: name, times, venue, currency. */\nexport interface DtoPublicEventInfo {\n\t/**\n\t * Currency is the ISO 4217 code all prices are quoted in.\n\t * @example \"CZK\"\n\t */\n\tcurrency?: string;\n\t/**\n\t * EndTime is when the event ends (RFC 3339), when known.\n\t * @example \"2026-06-20T23:00:00Z\"\n\t */\n\tendTime?: string;\n\t/**\n\t * HoldTTLSeconds is how long a checkout holds selected seats before expiry.\n\t * @example 900\n\t */\n\tholdTtlSeconds?: number;\n\t/**\n\t * LocationName is the venue's display name, when set.\n\t * @example \"Výstaviště Praha\"\n\t */\n\tlocationName?: string;\n\t/**\n\t * Name is the event's public display name.\n\t * @example \"Rockfest 2026\"\n\t */\n\tname?: string;\n\t/**\n\t * Slug is the event's URL identifier (the {eventSlug} path parameter).\n\t * @example \"rockfest-2026\"\n\t */\n\tslug?: string;\n\t/**\n\t * StartTime is when doors/the event begins (RFC 3339).\n\t * @example \"2026-06-20T18:00:00Z\"\n\t */\n\tstartTime?: string;\n}\n\nexport interface DtoPublicFloor {\n\t/**\n\t * Cons are short caveats for this floor, shown alongside the pros.\n\t * @uniqueItems false\n\t * @example [\"Standing only\"]\n\t */\n\tcons?: string[];\n\t/**\n\t * Description is optional customer-facing copy shown on the floor's tab.\n\t * @example \"Standing area in front of the main stage\"\n\t */\n\tdescription?: string;\n\t/**\n\t * ID is the floor's stable id; it matches PublicFloorInfo.id.\n\t * @example \"1810000000000000101\"\n\t */\n\tid?: string;\n\t/**\n\t * Mode is \"single\" (one open space) or \"sections\" (subdivided blocks).\n\t * @example \"sections\"\n\t */\n\tmode?: 'single' | 'sections';\n\t/**\n\t * Name is the floor's display label.\n\t * @example \"Ground floor\"\n\t */\n\tname?: string;\n\t/**\n\t * Position is the 1-based tab order among the event's floors.\n\t * @example 1\n\t */\n\tposition?: number;\n\t/**\n\t * Pros are short selling points for this floor, shown as a checklist.\n\t * @uniqueItems false\n\t * @example [\"Closest to the stage\",\"Great atmosphere\"]\n\t */\n\tpros?: string[];\n\t/**\n\t * Sections are the floor's blocks; a single-mode floor has exactly one.\n\t * @uniqueItems false\n\t */\n\tsections?: DtoPublicSection[];\n}\n\nexport interface DtoPublicFloorInfo {\n\t/**\n\t * Cons are short caveats for this floor, shown alongside the pros.\n\t * @uniqueItems false\n\t * @example [\"Standing only\"]\n\t */\n\tcons?: string[];\n\t/**\n\t * Description is optional customer-facing copy shown on the floor's tab.\n\t * @example \"Standing area in front of the main stage\"\n\t */\n\tdescription?: string;\n\t/**\n\t * ID is the floor's stable id; it matches a floor in the seating endpoint.\n\t * @example \"1810000000000000101\"\n\t */\n\tid?: string;\n\t/**\n\t * Mode is \"single\" (one open space) or \"sections\" (subdivided blocks).\n\t * @example \"sections\"\n\t */\n\tmode?: 'single' | 'sections';\n\t/**\n\t * Name is the floor's display label.\n\t * @example \"Ground floor\"\n\t */\n\tname?: string;\n\t/**\n\t * Position is the 1-based tab order among the event's floors.\n\t * @example 1\n\t */\n\tposition?: number;\n\t/**\n\t * Pros are short selling points for this floor, shown as a checklist.\n\t * @uniqueItems false\n\t * @example [\"Closest to the stage\",\"Great atmosphere\"]\n\t */\n\tpros?: string[];\n}\n\nexport interface DtoPublicGAArea {\n\t/**\n\t * Capacity is the total number of standing tickets this area can sell.\n\t * @example 500\n\t */\n\tcapacity?: number;\n\t/**\n\t * H is the area's height on the floor canvas.\n\t * @example 200\n\t */\n\th?: number;\n\t/**\n\t * ID is the standing area's stable id, referenced by availability/orders.\n\t * @example \"1810000000000000601\"\n\t */\n\tid?: string;\n\t/**\n\t * Label is the standing area's display name.\n\t * @example \"Pit\"\n\t */\n\tlabel?: string;\n\t/**\n\t * Rotation is the area's rotation in degrees.\n\t * @example 0\n\t */\n\trotation?: number;\n\t/**\n\t * TicketTypeID is the standing ticket type mapped to this area, when priced.\n\t * @example \"1810000000000000201\"\n\t */\n\tticketTypeId?: string;\n\t/**\n\t * W is the area's width on the floor canvas.\n\t * @example 600\n\t */\n\tw?: number;\n\t/**\n\t * X is the area's left offset on the floor canvas.\n\t * @example 100\n\t */\n\tx?: number;\n\t/**\n\t * Y is the area's top offset on the floor canvas.\n\t * @example 400\n\t */\n\ty?: number;\n}\n\nexport interface DtoPublicOrder {\n\t/**\n\t * Currency is the ISO 4217 code the total is quoted in.\n\t * @example \"CZK\"\n\t */\n\tcurrency?: string;\n\t/**\n\t * ExpiresAt is when the held seats and this order expire (RFC 3339).\n\t * @example \"2026-06-20T18:15:00Z\"\n\t */\n\texpiresAt?: string;\n\t/** Payment carries the bank-transfer instructions for pending orders. */\n\tpayment?: DtoPublicPaymentDetail;\n\t/**\n\t * Reference is the order's human-facing reference (also the payment symbol).\n\t * @example \"RF26-000142\"\n\t */\n\treference?: string;\n\t/**\n\t * Status is the order lifecycle state at creation time.\n\t * @example \"pending\"\n\t */\n\tstatus?: 'pending' | 'paid' | 'cancelled' | 'expired';\n\t/**\n\t * TotalCents is the amount due in the event currency's minor units.\n\t * @example 149000\n\t */\n\ttotalCents?: number;\n}\n\n/** Customer is the buyer's contact details. */\nexport interface DtoPublicOrderCustomer {\n\t/**\n\t * Email is where the payment instructions and tickets are sent.\n\t * @example \"jana@example.com\"\n\t */\n\temail: string;\n\t/**\n\t * Name is the buyer's full name.\n\t * @maxLength 200\n\t * @example \"Jana Nováková\"\n\t */\n\tname: string;\n\t/**\n\t * Phone is an optional contact number.\n\t * @maxLength 50\n\t * @example \"+420123456789\"\n\t */\n\tphone?: string;\n}\n\nexport interface DtoPublicOrderItem {\n\t/**\n\t * GAAreaID is the standing area's id for standing ticket types.\n\t * @example \"1810000000000000601\"\n\t */\n\tgaAreaId?: string;\n\t/**\n\t * Quantity is how many to buy — always 1 for a seat, 1+ for standing.\n\t * @min 1\n\t * @example 1\n\t */\n\tquantity: number;\n\t/**\n\t * SeatID is the chosen seat's id for seated ticket types.\n\t * @example \"1810000000000000501\"\n\t */\n\tseatId?: string;\n\t/**\n\t * TicketTypeID is the ticket type being bought (from the event endpoint).\n\t * @example \"1810000000000000201\"\n\t */\n\tticketTypeId: string;\n}\n\nexport interface DtoPublicOrderRequest {\n\t/**\n\t * CaptchaToken is the client-side captcha solution, verified server-side.\n\t * @example \"03AGdBq26…\"\n\t */\n\tcaptchaToken?: string;\n\t/** Customer is the buyer's contact details. */\n\tcustomer: DtoPublicOrderCustomer;\n\t/**\n\t * Items are the order lines; at least one is required.\n\t * @minItems 1\n\t * @uniqueItems false\n\t */\n\titems: DtoPublicOrderItem[];\n}\n\n/** Org is the organizer's public branding (name, logo, accent colour). */\nexport interface DtoPublicOrg {\n\t/**\n\t * AccentColor is the organizer's brand colour as a hex string, if set.\n\t * @example \"#E5482F\"\n\t */\n\taccentColor?: string;\n\t/** CheckoutTheme customises the hosted checkout; null = Bookitive defaults. */\n\tcheckoutTheme?: DtoPublicCheckoutTheme;\n\t/**\n\t * LogoURL is an absolute URL to the organizer's logo, if set.\n\t * @example \"https://cdn.bookitive.com/orgs/rockfest/logo.png\"\n\t */\n\tlogoUrl?: string;\n\t/**\n\t * Name is the organizer's public display name.\n\t * @example \"Rockfest Productions\"\n\t */\n\tname?: string;\n\t/**\n\t * Slug is the organizer's URL identifier (the {orgSlug} path parameter).\n\t * @example \"rockfest\"\n\t */\n\tslug?: string;\n}\n\n/** Payment carries the bank-transfer instructions for pending orders. */\nexport interface DtoPublicPaymentDetail {\n\t/**\n\t * BankAccount is the organizer's free-form payment destination.\n\t * @example \"123456789/0100\"\n\t */\n\tbankAccount?: string;\n\t/**\n\t * VariableSymbol identifies the payment — it equals the order reference.\n\t * @example \"26000142\"\n\t */\n\tvariableSymbol?: string;\n}\n\nexport interface DtoPublicSeat {\n\t/**\n\t * Code is the human-facing seat label (section prefix + table + seat).\n\t * @example \"L12-3\"\n\t */\n\tcode?: string;\n\t/**\n\t * ID is the seat's stable id; availability and orders reference it.\n\t * @example \"1810000000000000501\"\n\t */\n\tid?: string;\n\t/**\n\t * TableID is the owning table's id, when the seat belongs to a table.\n\t * @example \"1810000000000000401\"\n\t */\n\ttableId?: string;\n\t/**\n\t * TicketTypeID is the ticket type mapped to this seat, when priced.\n\t * @example \"1810000000000000201\"\n\t */\n\tticketTypeId?: string;\n\t/**\n\t * X is the seat centre's x on the floor canvas.\n\t * @example 245\n\t */\n\tx?: number;\n\t/**\n\t * Y is the seat centre's y on the floor canvas.\n\t * @example 158\n\t */\n\ty?: number;\n}\n\nexport interface DtoPublicSeating {\n\t/**\n\t * Floors are the chart's floors in tab order, each with its geometry.\n\t * @uniqueItems false\n\t */\n\tfloors?: DtoPublicFloor[];\n}\n\nexport interface DtoPublicSection {\n\t/** Decorations is opaque visual scenery (stage, walls, doors) — never sold. */\n\tdecorations?: object;\n\t/**\n\t * GAAreas are the standing areas (sold by quantity) in this section.\n\t * @uniqueItems false\n\t */\n\tgaAreas?: DtoPublicGAArea[];\n\t/**\n\t * H is the section's height on the floor canvas, if sized.\n\t * @example 300\n\t */\n\th?: number;\n\t/**\n\t * ID is the section's stable id.\n\t * @example \"1810000000000000301\"\n\t */\n\tid?: string;\n\t/**\n\t * Name is the section's display label.\n\t * @example \"Left block\"\n\t */\n\tname?: string;\n\t/** Polygon is the section's outline as an array of {x,y} points, if shaped. */\n\tpolygon?: object;\n\t/**\n\t * Prefix is prepended to seat codes in this section (e.g. \"L\" → \"L12-3\").\n\t * @example \"L\"\n\t */\n\tprefix?: string;\n\t/**\n\t * Seats are the individually sellable seats in this section.\n\t * @uniqueItems false\n\t */\n\tseats?: DtoPublicSeat[];\n\t/** Settings is opaque render config (chair gap/size, label typography). */\n\tsettings?: object;\n\t/**\n\t * Tables are the seated tables in this section.\n\t * @uniqueItems false\n\t */\n\ttables?: DtoPublicTable[];\n\t/**\n\t * W is the section's width on the floor canvas, if sized.\n\t * @example 400\n\t */\n\tw?: number;\n\t/**\n\t * X is the section's left offset on the floor canvas, if positioned.\n\t * @example 120\n\t */\n\tx?: number;\n\t/**\n\t * Y is the section's top offset on the floor canvas, if positioned.\n\t * @example 80\n\t */\n\ty?: number;\n}\n\nexport interface DtoPublicTable {\n\t/**\n\t * Curve is the arc for row tables, in degrees (0 = straight row).\n\t * @example 0\n\t */\n\tcurve?: number;\n\t/**\n\t * H is the height for rect tables, in canvas units.\n\t * @example 60\n\t */\n\th?: number;\n\t/**\n\t * ID is the table's stable id, referenced by PublicSeat.tableId.\n\t * @example \"1810000000000000401\"\n\t */\n\tid?: string;\n\t/**\n\t * Number is the table's display number within its section.\n\t * @example 12\n\t */\n\tnumber?: number;\n\t/**\n\t * Radius is the radius for round tables, in canvas units.\n\t * @example 45\n\t */\n\tradius?: number;\n\t/**\n\t * Rotation is the table's rotation in degrees.\n\t * @example 0\n\t */\n\trotation?: number;\n\t/**\n\t * Shape is the table outline: \"round\", \"rect\", or \"row\".\n\t * @example \"round\"\n\t */\n\tshape?: 'round' | 'rect' | 'row';\n\t/**\n\t * Sides is the seat count per edge for rect tables [top,right,bottom,left].\n\t * @uniqueItems false\n\t */\n\tsides?: number[];\n\t/**\n\t * Spacing is the gap between seats on a row table, in canvas units.\n\t * @example 24\n\t */\n\tspacing?: number;\n\t/**\n\t * W is the width for rect tables, in canvas units.\n\t * @example 120\n\t */\n\tw?: number;\n\t/**\n\t * X is the table centre's x on the floor canvas.\n\t * @example 240.5\n\t */\n\tx?: number;\n\t/**\n\t * Y is the table centre's y on the floor canvas.\n\t * @example 160\n\t */\n\ty?: number;\n}\n\nexport interface DtoPublicTicketType {\n\t/**\n\t * Color is the swatch used to tint seats/areas of this type, as hex.\n\t * @example \"#E5482F\"\n\t */\n\tcolor?: string;\n\t/**\n\t * Cons are short caveats for this ticket type, shown alongside the pros.\n\t * @uniqueItems false\n\t * @example [\"No seating\"]\n\t */\n\tcons?: string[];\n\t/**\n\t * Description is optional customer-facing copy for this ticket type.\n\t * @example \"Front-stage standing with a dedicated bar\"\n\t */\n\tdescription?: string;\n\t/**\n\t * ID is the ticket type's stable id, referenced by order items and seats.\n\t * @example \"1810000000000000201\"\n\t */\n\tid?: string;\n\t/**\n\t * Kind is \"seated\" (maps to a seat) or \"standing\" (sold by quantity).\n\t * @example \"standing\"\n\t */\n\tkind?: 'seated' | 'standing';\n\t/**\n\t * MaxPerOrder caps how many of this type a single order may contain.\n\t * @example 6\n\t */\n\tmaxPerOrder?: number;\n\t/**\n\t * MinPerOrder appears only when it is a real constraint (> 1) — the\n\t * limit applies to orders that include this type at all.\n\t * @example 1\n\t */\n\tminPerOrder?: number;\n\t/**\n\t * Name is the ticket type's display label.\n\t * @example \"VIP\"\n\t */\n\tname?: string;\n\t/**\n\t * PriceCents is the unit price in the event's currency's minor units.\n\t * @example 149000\n\t */\n\tpriceCents?: number;\n\t/**\n\t * Pros are short selling points for this ticket type, shown as a checklist.\n\t * @uniqueItems false\n\t * @example [\"Best view\",\"Dedicated bar\",\"Fast-track entry\"]\n\t */\n\tpros?: string[];\n\t/**\n\t * SaleEndTime is when this type stops selling (RFC 3339), if scheduled.\n\t * @example \"2026-06-20T16:00:00Z\"\n\t */\n\tsaleEndTime?: string;\n\t/**\n\t * SaleStartTime is when this type goes on sale (RFC 3339), if scheduled.\n\t * @example \"2026-01-15T10:00:00Z\"\n\t */\n\tsaleStartTime?: string;\n}\n","// Live availability over websocket: {\"event\":\"startstate\"|\"seat\", data}.\n// Startstate re-fires on every reconnect, so consumers treat it as the\n// resync point and apply deltas on top.\nimport type { DtoPublicAvailability } from './generated/api.js';\n\n/** One seat changing state. \"reserved\" appears only when the event shares\n * reserved status publicly — a reserved seat may free up again. */\nexport interface SeatDelta {\n\tseatId: string;\n\ttaken: boolean;\n\tstatus: 'free' | 'reserved' | 'taken';\n}\n\nexport interface LiveHandlers {\n\t/** Full snapshot — on connect and on every reconnect. */\n\tonStartstate?: (availability: DtoPublicAvailability) => void;\n\t/** One seat changed. */\n\tonSeat?: (delta: SeatDelta) => void;\n\t/** Connection state changes (drive a \"live\" indicator if you like). */\n\tonConnectionChange?: (connected: boolean) => void;\n}\n\nconst INITIAL_BACKOFF_MS = 1000;\nconst MAX_BACKOFF_MS = 15000;\n\nexport class LiveSubscription {\n\t#url: string;\n\t#handlers: LiveHandlers;\n\t#ws: WebSocket | null = null;\n\t#backoff = INITIAL_BACKOFF_MS;\n\t#retry: ReturnType<typeof setTimeout> | null = null;\n\t#closed = false;\n\n\tconstructor(url: string, handlers: LiveHandlers) {\n\t\tthis.#url = url.replace(/^http/, 'ws');\n\t\tthis.#handlers = handlers;\n\t\tthis.#connect();\n\t}\n\n\tclose(): void {\n\t\tthis.#closed = true;\n\t\tif (this.#retry) clearTimeout(this.#retry);\n\t\tthis.#ws?.close();\n\t}\n\n\t#connect(): void {\n\t\tif (this.#closed) return;\n\t\tconst ws = new WebSocket(this.#url);\n\t\tthis.#ws = ws;\n\t\tws.onopen = () => {\n\t\t\tthis.#backoff = INITIAL_BACKOFF_MS;\n\t\t\tthis.#handlers.onConnectionChange?.(true);\n\t\t};\n\t\tws.onmessage = (event) => {\n\t\t\tlet message: { event?: string; data?: unknown };\n\t\t\ttry {\n\t\t\t\tmessage = JSON.parse(event.data as string);\n\t\t\t} catch {\n\t\t\t\treturn; // ignore malformed / non-JSON frames rather than throwing\n\t\t\t}\n\t\t\tif (message.event === 'startstate') {\n\t\t\t\tthis.#handlers.onStartstate?.(message.data as DtoPublicAvailability);\n\t\t\t} else if (message.event === 'seat') {\n\t\t\t\tthis.#handlers.onSeat?.(message.data as SeatDelta);\n\t\t\t}\n\t\t};\n\t\tws.onclose = () => {\n\t\t\tthis.#handlers.onConnectionChange?.(false);\n\t\t\tif (this.#closed) return;\n\t\t\t// Equal-jitter backoff: reconnect somewhere in [backoff/2, backoff) so a\n\t\t\t// mass disconnect doesn't produce a synchronized reconnect thundering herd.\n\t\t\tconst delay = this.#backoff / 2 + Math.random() * (this.#backoff / 2);\n\t\t\tthis.#retry = setTimeout(() => this.#connect(), delay);\n\t\t\tthis.#backoff = Math.min(this.#backoff * 2, MAX_BACKOFF_MS);\n\t\t};\n\t}\n}\n","// The typed core of @bookitive/js: a thin fetch wrapper over the public\n// checkout API, addressed by org + event slug. All response and payload types\n// are generated from the backend's public swagger — they cannot drift.\nimport { DtoErrorCode } from './generated/api.js';\nimport type {\n\tDtoAPIError,\n\tDtoPublicAvailability,\n\tDtoPublicEvent,\n\tDtoPublicOrder,\n\tDtoPublicOrderRequest,\n\tDtoPublicSeating,\n} from './generated/api.js';\nimport { LiveSubscription, type LiveHandlers } from './live.js';\n\nexport interface BookitiveClientOptions {\n\t/** API origin, e.g. \"https://api.bookitive.com\" (no trailing slash). */\n\tbaseUrl: string;\n\t/** Organization slug — the {org} in events.bookitive.com/{org}/{event}. */\n\torg: string;\n\t/** Event slug. */\n\tevent: string;\n\t/** Custom fetch (SSR frameworks pass their own). Defaults to global fetch. */\n\tfetch?: typeof fetch;\n}\n\n/** API failure with the backend's error envelope attached. */\nexport class BookitiveError extends Error {\n\treadonly status: number;\n\t/** The backend error code (e.g. DtoErrorCode.ErrConflict), or \"UNKNOWN\" when\n\t * the response carried no JSON envelope. */\n\treadonly type: DtoErrorCode | 'UNKNOWN';\n\n\tconstructor(status: number, body: DtoAPIError | undefined, fallback: string) {\n\t\tsuper(body?.msg ?? fallback);\n\t\tthis.name = 'BookitiveError';\n\t\tthis.status = status;\n\t\tthis.type = body?.type ?? 'UNKNOWN';\n\t}\n\n\t/** The selection raced another buyer — refresh availability and reselect. */\n\tget isConflict(): boolean {\n\t\treturn this.type === DtoErrorCode.ErrConflict || this.status === 409;\n\t}\n}\n\nexport class BookitiveClient {\n\treadonly #base: string;\n\treadonly #fetch: typeof fetch;\n\n\tconstructor(options: BookitiveClientOptions) {\n\t\tthis.#base = `${options.baseUrl.replace(/\\/$/, '')}/public/v1/orgs/${encodeURIComponent(\n\t\t\toptions.org\n\t\t)}/events/${encodeURIComponent(options.event)}`;\n\t\t// bind, or a browser's fetch throws \"Illegal invocation\" when called\n\t\t// detached from window\n\t\tthis.#fetch = options.fetch ?? ((...args) => fetch(...args));\n\t}\n\n\t/** Event identity, org branding, priced ticket types, and floor tabs. */\n\tevent(): Promise<DtoPublicEvent> {\n\t\treturn this.#get<DtoPublicEvent>('');\n\t}\n\n\t/** Static chart geometry: floors → sections → tables, seats, GA areas. */\n\tseating(): Promise<DtoPublicSeating> {\n\t\treturn this.#get<DtoPublicSeating>('/seating');\n\t}\n\n\t/** Live sellability snapshot (poll it, or use live() for push updates). */\n\tavailability(): Promise<DtoPublicAvailability> {\n\t\treturn this.#get<DtoPublicAvailability>('/availability');\n\t}\n\n\t/**\n\t * Places a bank-transfer reservation: seats are held atomically for the\n\t * event's hold TTL and payment instructions are emailed (and returned).\n\t * A 409 (error.isConflict) means a seat was just taken — refresh and\n\t * reselect.\n\t */\n\tasync checkout(order: DtoPublicOrderRequest): Promise<DtoPublicOrder> {\n\t\tconst res = await this.#fetch(`${this.#base}/orders`, {\n\t\t\tmethod: 'POST',\n\t\t\theaders: { 'Content-Type': 'application/json' },\n\t\t\tbody: JSON.stringify(order),\n\t\t});\n\t\treturn this.#parse<DtoPublicOrder>(res, 'checkout failed');\n\t}\n\n\t/**\n\t * Subscribes to live availability over websocket: `startstate` fires with\n\t * the full snapshot on every (re)connect, then `seat` deltas stream in.\n\t * Reconnects automatically with backoff; call close() when done.\n\t */\n\tlive(handlers: LiveHandlers): LiveSubscription {\n\t\treturn new LiveSubscription(`${this.#base}/live`, handlers);\n\t}\n\n\tasync #get<T>(path: string): Promise<T> {\n\t\tconst res = await this.#fetch(`${this.#base}${path}`);\n\t\treturn this.#parse<T>(res, `request failed: ${path || '/'}`);\n\t}\n\n\tasync #parse<T>(res: Response, fallback: string): Promise<T> {\n\t\tif (!res.ok) {\n\t\t\tlet body: DtoAPIError | undefined;\n\t\t\ttry {\n\t\t\t\tbody = (await res.json()) as DtoAPIError;\n\t\t\t} catch {\n\t\t\t\t// non-JSON error body — the fallback message covers it\n\t\t\t}\n\t\t\tthrow new BookitiveError(res.status, body, fallback);\n\t\t}\n\t\t// 204/205 never carry a body. Otherwise read the text and parse only\n\t\t// when it's non-empty — this avoids res.headers.get('content-length'),\n\t\t// which throws under SvelteKit's SSR fetch (response headers aren't\n\t\t// serialized by default) and would otherwise 500 any server-side load.\n\t\tif (res.status === 204 || res.status === 205) {\n\t\t\treturn undefined as T;\n\t\t}\n\t\tconst text = await res.text();\n\t\treturn (text ? JSON.parse(text) : undefined) as T;\n\t}\n}\n"],"mappings":";AAgBO,IAAK,eAAL,kBAAKA,kBAAL;AACN,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,yBAAsB;AACtB,EAAAA,cAAA,iBAAc;AACd,EAAAA,cAAA,iBAAc;AACd,EAAAA,cAAA,kBAAe;AACf,EAAAA,cAAA,iBAAc;AANH,SAAAA;AAAA,GAAA;;;ACMZ,IAAM,qBAAqB;AAC3B,IAAM,iBAAiB;AAEhB,IAAM,mBAAN,MAAuB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA,MAAwB;AAAA,EACxB,WAAW;AAAA,EACX,SAA+C;AAAA,EAC/C,UAAU;AAAA,EAEV,YAAY,KAAa,UAAwB;AAChD,SAAK,OAAO,IAAI,QAAQ,SAAS,IAAI;AACrC,SAAK,YAAY;AACjB,SAAK,SAAS;AAAA,EACf;AAAA,EAEA,QAAc;AACb,SAAK,UAAU;AACf,QAAI,KAAK,OAAQ,cAAa,KAAK,MAAM;AACzC,SAAK,KAAK,MAAM;AAAA,EACjB;AAAA,EAEA,WAAiB;AAChB,QAAI,KAAK,QAAS;AAClB,UAAM,KAAK,IAAI,UAAU,KAAK,IAAI;AAClC,SAAK,MAAM;AACX,OAAG,SAAS,MAAM;AACjB,WAAK,WAAW;AAChB,WAAK,UAAU,qBAAqB,IAAI;AAAA,IACzC;AACA,OAAG,YAAY,CAAC,UAAU;AACzB,UAAI;AACJ,UAAI;AACH,kBAAU,KAAK,MAAM,MAAM,IAAc;AAAA,MAC1C,QAAQ;AACP;AAAA,MACD;AACA,UAAI,QA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,eAAe;AAAA,EACxD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,SAAS,OAAuD;AACrE,UAAM,MAAM,MAAM,KAAK,OAAO,GAAG,KAAK,KAAK,WAAW;AAAA,MACrD,QAAQ;AAAA,MACR,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,MAC9C,MAAM,KAAK,UAAU,KAAK;AAAA,IAC3B,CAAC;AACD,WAAO,KAAK,OAAuB,KAAK,iBAAiB;AAAA,EAC1D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,KAAK,UAA0C;AAC9C,WAAO,IAAI,iBAAiB,GAAG,KAAK,KAAK,SAAS,QAAQ;AAAA,EAC3D;AAAA,EAEA,MAAM,KAAQ,MAA0B;AACvC,UAAM,MAAM,MAAM,KAAK,OAAO,GAAG,KAAK,KAAK,GAAG,IAAI,EAAE;AACpD,WAAO,KAAK,OAAU,KAAK,mBAAmB,QAAQ,GAAG,EAAE;AAAA,EAC5D;AAAA,EAEA,MAAM,OAAU,KAAe,UAA8B;AAC5D,QAAI,CAAC,IAAI,IAAI;AACZ,UAAI;AACJ,UAAI;AACH,eAAQ,MAAM,IAAI,KAAK;AAAA,MACxB,QAAQ;AAAA,MAER;AACA,YAAM,IAAI,eAAe,IAAI,QAAQ,MAAM,QAAQ;AAAA,IACpD;AAKA,QAAI,IAAI,WAAW,OAAO,IAAI,WAAW,KAAK;AAC7C,aAAO;AAAA,IACR;AACA,UAAM,OAAO,MAAM,IAAI,KAAK;AAC5B,WAAQ,OAAO,KAAK,MAAM,IAAI,IAAI;AAAA,EACnC;AACD;","names":["DtoErrorCode"]}
|
|
1
|
+
{"version":3,"sources":["../src/generated/api.ts","../src/live.ts","../src/client.ts"],"sourcesContent":["/* eslint-disable */\n/* tslint:disable */\n// @ts-nocheck\n/*\n * ---------------------------------------------------------------\n * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##\n * ## ##\n * ## AUTHOR: acacode ##\n * ## SOURCE: https://github.com/acacode/swagger-typescript-api ##\n * ---------------------------------------------------------------\n */\n\n/**\n * Type is the stable, machine-readable error code.\n * @example \"CONFLICT\"\n */\nexport enum DtoErrorCode {\n ErrInvalidPayload = \"INVALID_PAYLOAD\",\n ErrValidationFailed = \"VALIDATION_FAILED\",\n ErrNotFound = \"NOT_FOUND\",\n ErrConflict = \"CONFLICT\",\n ErrForbidden = \"FORBIDDEN\",\n ErrInternal = \"INTERNAL_ERROR\",\n}\n\nexport interface DtoAPIError {\n /** Data carries optional structured context for the error. */\n data?: any;\n /** Fields maps a request field to a validation message, when applicable. */\n fields?: Record<string, string>;\n /**\n * Msg is a human-readable description of what went wrong.\n * @example \"seat is no longer available\"\n */\n msg?: string;\n /**\n * Timestamp is when the error was produced (RFC 3339).\n * @example \"2026-06-20T18:00:00Z\"\n */\n timestamp?: string;\n /**\n * TraceID identifies this request in our logs; include it in support asks.\n * @example \"01JABCDoftraceZ\"\n */\n traceId?: string;\n /** Type is the stable, machine-readable error code. */\n type?: DtoErrorCode;\n}\n\nexport interface DtoPublicAvailability {\n /** GARemaining maps a standing area id to its remaining capacity. */\n gaRemaining?: Record<string, number>;\n /**\n * ReservedSeats marks which unavailable seats are merely reserved and may\n * free up again — present only when the event shares reserved status.\n * @uniqueItems false\n * @example [\"1810000000000000502\"]\n */\n reservedSeats?: string[];\n /** TicketTypeRemaining maps a ticket type id to its remaining capacity. */\n ticketTypeRemaining?: Record<string, number>;\n /**\n * UnavailableSeats lists the ids of seats that cannot currently be bought.\n * @uniqueItems false\n * @example [\"1810000000000000501\",\"1810000000000000502\"]\n */\n unavailableSeats?: string[];\n}\n\n/** CheckoutTheme customises the hosted checkout; null = Bookitive defaults. */\nexport interface DtoPublicCheckoutTheme {\n /**\n * ButtonLabel overrides the submit button text.\n * @example \"Objednat\"\n */\n buttonLabel?: string;\n /**\n * FontFamily is an allowlisted font key (self-hosted by Bookitive).\n * @example \"inter\"\n */\n fontFamily?: string;\n /**\n * Mode is the colour scheme: \"light\" or \"dark\".\n * @example \"light\"\n */\n mode?: \"light\" | \"dark\";\n /**\n * Radius is the corner radius for fields and buttons.\n * @example \"12px\"\n */\n radius?: string;\n}\n\nexport interface DtoPublicDiscount {\n /**\n * Code is the normalized (uppercase) promo code.\n * @example \"EARLYBIRD\"\n */\n code?: string;\n /**\n * Kind is how the discount applies: \"percent\" of the items subtotal, or a\n * \"fixed\" amount in the event currency's minor units.\n * @example \"percent\"\n */\n kind?: \"percent\" | \"fixed\";\n /**\n * Value is 1-100 for percent, minor units for fixed.\n * @example 10\n */\n value?: number;\n}\n\nexport interface DtoPublicEvent {\n /** Event is the event's public identity: name, times, venue, currency. */\n event?: DtoPublicEventInfo;\n /**\n * Floors lets a host page render its floor tabs without loading the full\n * seating payload; ids match the seating endpoint's floors.\n * @uniqueItems false\n */\n floors?: DtoPublicFloorInfo[];\n /** Org is the organizer's public branding (name, logo, accent colour). */\n org?: DtoPublicOrg;\n /**\n * Protection describes the anti-scalping requirements a buyer must satisfy\n * at checkout (verified phone, named tickets). All-false when unprotected.\n */\n protection?: DtoPublicProtection;\n /**\n * TicketTypes are the sellable ticket categories with prices and limits.\n * @uniqueItems false\n */\n ticketTypes?: DtoPublicTicketType[];\n}\n\n/** Event is the event's public identity: name, times, venue, currency. */\nexport interface DtoPublicEventInfo {\n /**\n * Currency is the ISO 4217 code all prices are quoted in.\n * @example \"CZK\"\n */\n currency?: string;\n /**\n * EndTime is when the event ends (RFC 3339), when known.\n * @example \"2026-06-20T23:00:00Z\"\n */\n endTime?: string;\n /**\n * HoldTTLSeconds is how long a checkout holds selected seats before expiry.\n * @example 900\n */\n holdTtlSeconds?: number;\n /**\n * LocationName is the venue's display name, when set.\n * @example \"Výstaviště Praha\"\n */\n locationName?: string;\n /**\n * Name is the event's public display name.\n * @example \"Rockfest 2026\"\n */\n name?: string;\n /**\n * Slug is the event's URL identifier (the {eventSlug} path parameter).\n * @example \"rockfest-2026\"\n */\n slug?: string;\n /**\n * StartTime is when doors/the event begins (RFC 3339).\n * @example \"2026-06-20T18:00:00Z\"\n */\n startTime?: string;\n}\n\nexport interface DtoPublicFloor {\n /**\n * Cons are short caveats for this floor, shown alongside the pros.\n * @uniqueItems false\n * @example [\"Standing only\"]\n */\n cons?: string[];\n /**\n * Description is optional customer-facing copy shown on the floor's tab.\n * @example \"Standing area in front of the main stage\"\n */\n description?: string;\n /**\n * ID is the floor's stable id; it matches PublicFloorInfo.id.\n * @example \"1810000000000000101\"\n */\n id?: string;\n /**\n * Mode is \"single\" (one open space) or \"sections\" (subdivided blocks).\n * @example \"sections\"\n */\n mode?: \"single\" | \"sections\";\n /**\n * Name is the floor's display label.\n * @example \"Ground floor\"\n */\n name?: string;\n /**\n * Position is the 1-based tab order among the event's floors.\n * @example 1\n */\n position?: number;\n /**\n * Pros are short selling points for this floor, shown as a checklist.\n * @uniqueItems false\n * @example [\"Closest to the stage\",\"Great atmosphere\"]\n */\n pros?: string[];\n /**\n * Sections are the floor's blocks; a single-mode floor has exactly one.\n * @uniqueItems false\n */\n sections?: DtoPublicSection[];\n}\n\nexport interface DtoPublicFloorInfo {\n /**\n * Cons are short caveats for this floor, shown alongside the pros.\n * @uniqueItems false\n * @example [\"Standing only\"]\n */\n cons?: string[];\n /**\n * Description is optional customer-facing copy shown on the floor's tab.\n * @example \"Standing area in front of the main stage\"\n */\n description?: string;\n /**\n * ID is the floor's stable id; it matches a floor in the seating endpoint.\n * @example \"1810000000000000101\"\n */\n id?: string;\n /**\n * Mode is \"single\" (one open space) or \"sections\" (subdivided blocks).\n * @example \"sections\"\n */\n mode?: \"single\" | \"sections\";\n /**\n * Name is the floor's display label.\n * @example \"Ground floor\"\n */\n name?: string;\n /**\n * Position is the 1-based tab order among the event's floors.\n * @example 1\n */\n position?: number;\n /**\n * Pros are short selling points for this floor, shown as a checklist.\n * @uniqueItems false\n * @example [\"Closest to the stage\",\"Great atmosphere\"]\n */\n pros?: string[];\n}\n\nexport interface DtoPublicGAArea {\n /**\n * Capacity is the total number of standing tickets this area can sell.\n * @example 500\n */\n capacity?: number;\n /**\n * H is the area's height on the floor canvas.\n * @example 200\n */\n h?: number;\n /**\n * ID is the standing area's stable id, referenced by availability/orders.\n * @example \"1810000000000000601\"\n */\n id?: string;\n /**\n * Label is the standing area's display name.\n * @example \"Pit\"\n */\n label?: string;\n /**\n * Rotation is the area's rotation in degrees.\n * @example 0\n */\n rotation?: number;\n /**\n * TicketTypeID is the standing ticket type mapped to this area, when priced.\n * @example \"1810000000000000201\"\n */\n ticketTypeId?: string;\n /**\n * W is the area's width on the floor canvas.\n * @example 600\n */\n w?: number;\n /**\n * X is the area's left offset on the floor canvas.\n * @example 100\n */\n x?: number;\n /**\n * Y is the area's top offset on the floor canvas.\n * @example 400\n */\n y?: number;\n}\n\nexport interface DtoPublicOrder {\n /**\n * Currency is the ISO 4217 code the total is quoted in.\n * @example \"CZK\"\n */\n currency?: string;\n /**\n * DiscountCents is what the redeemed promo code took off the total.\n * @example 14900\n */\n discountCents?: number;\n /**\n * ExpiresAt is when the held seats and this order expire (RFC 3339).\n * @example \"2026-06-20T18:15:00Z\"\n */\n expiresAt?: string;\n /** Payment carries the bank-transfer instructions for pending orders. */\n payment?: DtoPublicPaymentDetail;\n /**\n * Reference is the order's human-facing reference (also the payment symbol).\n * @example \"RF26-000142\"\n */\n reference?: string;\n /**\n * Status is the order lifecycle state at creation time.\n * @example \"pending\"\n */\n status?: \"pending\" | \"paid\" | \"cancelled\" | \"expired\";\n /**\n * TotalCents is the amount due in the event currency's minor units.\n * @example 149000\n */\n totalCents?: number;\n}\n\n/** Customer is the buyer's contact details. */\nexport interface DtoPublicOrderCustomer {\n /**\n * Email is where the payment instructions and tickets are sent.\n * @example \"jana@example.com\"\n */\n email: string;\n /**\n * Name is the buyer's full name.\n * @maxLength 200\n * @example \"Jana Nováková\"\n */\n name: string;\n /**\n * Phone is an optional contact number.\n * @maxLength 50\n * @example \"+420123456789\"\n */\n phone?: string;\n}\n\nexport interface DtoPublicOrderItem {\n /**\n * Attendees carries one full name per admitted person when the event\n * requires named tickets — exactly Quantity names, in ticket order.\n * @uniqueItems false\n * @example [\"Jana Nováková\"]\n */\n attendees?: string[];\n /**\n * GAAreaID is the standing area's id for standing ticket types.\n * @example \"1810000000000000601\"\n */\n gaAreaId?: string;\n /**\n * Quantity is how many to buy — always 1 for a seat, 1+ for standing.\n * @min 1\n * @example 1\n */\n quantity: number;\n /**\n * SeatID is the chosen seat's id for seated ticket types.\n * @example \"1810000000000000501\"\n */\n seatId?: string;\n /**\n * TicketTypeID is the ticket type being bought (from the event endpoint).\n * @example \"1810000000000000201\"\n */\n ticketTypeId: string;\n}\n\nexport interface DtoPublicOrderRequest {\n /**\n * CaptchaToken is the client-side captcha solution, verified server-side.\n * @example \"03AGdBq26…\"\n */\n captchaToken?: string;\n /** Customer is the buyer's contact details. */\n customer: DtoPublicOrderCustomer;\n /**\n * DiscountCode redeems a promo code (case-insensitive); the discount is\n * applied to the items subtotal and enforced against the code's limits.\n * @minLength 2\n * @maxLength 40\n * @example \"EARLYBIRD\"\n */\n discountCode?: string;\n /**\n * Items are the order lines; at least one is required.\n * @minItems 1\n * @uniqueItems false\n */\n items: DtoPublicOrderItem[];\n /**\n * VerificationToken is the single-use token from the verify/check endpoint,\n * required when the event demands a verified phone number.\n * @example \"3q2p8Zk1…\"\n */\n verificationToken?: string;\n}\n\n/** Org is the organizer's public branding (name, logo, accent colour). */\nexport interface DtoPublicOrg {\n /**\n * AccentColor is the organizer's brand colour as a hex string, if set.\n * @example \"#E5482F\"\n */\n accentColor?: string;\n /** CheckoutTheme customises the hosted checkout; null = Bookitive defaults. */\n checkoutTheme?: DtoPublicCheckoutTheme;\n /**\n * LogoURL is an absolute URL to the organizer's logo, if set.\n * @example \"https://cdn.bookitive.com/orgs/rockfest/logo.png\"\n */\n logoUrl?: string;\n /**\n * Name is the organizer's public display name.\n * @example \"Rockfest Productions\"\n */\n name?: string;\n /**\n * Slug is the organizer's URL identifier (the {orgSlug} path parameter).\n * @example \"rockfest\"\n */\n slug?: string;\n}\n\n/** Payment carries the bank-transfer instructions for pending orders. */\nexport interface DtoPublicPaymentDetail {\n /**\n * BankAccount is the organizer's free-form payment destination.\n * @example \"123456789/0100\"\n */\n bankAccount?: string;\n /**\n * VariableSymbol identifies the payment — it equals the order reference.\n * @example \"26000142\"\n */\n variableSymbol?: string;\n}\n\n/**\n * Protection describes the anti-scalping requirements a buyer must satisfy\n * at checkout (verified phone, named tickets). All-false when unprotected.\n */\nexport interface DtoPublicProtection {\n /**\n * PhonePrefixes is the allowlist of accepted international dialling codes\n * (e.g. \"+420\"). Only meaningful when RequireVerifiedPhone is set.\n * @uniqueItems false\n * @example [\"+420\",\"+421\"]\n */\n phonePrefixes?: string[];\n /**\n * RequireAttendeeNames demands one attendee name per admitted person.\n * @example false\n */\n requireAttendeeNames?: boolean;\n /**\n * RequireVerifiedPhone gates checkout behind SMS phone verification.\n * @example true\n */\n requireVerifiedPhone?: boolean;\n}\n\nexport interface DtoPublicSeat {\n /**\n * Code is the human-facing seat label (section prefix + table + seat).\n * @example \"L12-3\"\n */\n code?: string;\n /**\n * ID is the seat's stable id; availability and orders reference it.\n * @example \"1810000000000000501\"\n */\n id?: string;\n /**\n * TableID is the owning table's id, when the seat belongs to a table.\n * @example \"1810000000000000401\"\n */\n tableId?: string;\n /**\n * TicketTypeID is the ticket type mapped to this seat, when priced.\n * @example \"1810000000000000201\"\n */\n ticketTypeId?: string;\n /**\n * X is the seat centre's x on the floor canvas.\n * @example 245\n */\n x?: number;\n /**\n * Y is the seat centre's y on the floor canvas.\n * @example 158\n */\n y?: number;\n}\n\nexport interface DtoPublicSeating {\n /**\n * Floors are the chart's floors in tab order, each with its geometry.\n * @uniqueItems false\n */\n floors?: DtoPublicFloor[];\n}\n\nexport interface DtoPublicSection {\n /** Decorations is opaque visual scenery (stage, walls, doors) — never sold. */\n decorations?: object;\n /**\n * GAAreas are the standing areas (sold by quantity) in this section.\n * @uniqueItems false\n */\n gaAreas?: DtoPublicGAArea[];\n /**\n * H is the section's height on the floor canvas, if sized.\n * @example 300\n */\n h?: number;\n /**\n * ID is the section's stable id.\n * @example \"1810000000000000301\"\n */\n id?: string;\n /**\n * Name is the section's display label.\n * @example \"Left block\"\n */\n name?: string;\n /** Polygon is the section's outline as an array of {x,y} points, if shaped. */\n polygon?: object;\n /**\n * Prefix is prepended to seat codes in this section (e.g. \"L\" → \"L12-3\").\n * @example \"L\"\n */\n prefix?: string;\n /**\n * Seats are the individually sellable seats in this section.\n * @uniqueItems false\n */\n seats?: DtoPublicSeat[];\n /** Settings is opaque render config (chair gap/size, label typography). */\n settings?: object;\n /**\n * Tables are the seated tables in this section.\n * @uniqueItems false\n */\n tables?: DtoPublicTable[];\n /**\n * W is the section's width on the floor canvas, if sized.\n * @example 400\n */\n w?: number;\n /**\n * X is the section's left offset on the floor canvas, if positioned.\n * @example 120\n */\n x?: number;\n /**\n * Y is the section's top offset on the floor canvas, if positioned.\n * @example 80\n */\n y?: number;\n}\n\nexport interface DtoPublicTable {\n /**\n * Curve is the arc for row tables, in degrees (0 = straight row).\n * @example 0\n */\n curve?: number;\n /**\n * H is the height for rect tables, in canvas units.\n * @example 60\n */\n h?: number;\n /**\n * ID is the table's stable id, referenced by PublicSeat.tableId.\n * @example \"1810000000000000401\"\n */\n id?: string;\n /**\n * Number is the table's display number within its section.\n * @example 12\n */\n number?: number;\n /**\n * Radius is the radius for round tables, in canvas units.\n * @example 45\n */\n radius?: number;\n /**\n * Rotation is the table's rotation in degrees.\n * @example 0\n */\n rotation?: number;\n /**\n * Shape is the table outline: \"round\", \"rect\", or \"row\".\n * @example \"round\"\n */\n shape?: \"round\" | \"rect\" | \"row\";\n /**\n * Sides is the seat count per edge for rect tables [top,right,bottom,left].\n * @uniqueItems false\n */\n sides?: number[];\n /**\n * Spacing is the gap between seats on a row table, in canvas units.\n * @example 24\n */\n spacing?: number;\n /**\n * W is the width for rect tables, in canvas units.\n * @example 120\n */\n w?: number;\n /**\n * X is the table centre's x on the floor canvas.\n * @example 240.5\n */\n x?: number;\n /**\n * Y is the table centre's y on the floor canvas.\n * @example 160\n */\n y?: number;\n}\n\nexport interface DtoPublicTicketType {\n /**\n * Color is the swatch used to tint seats/areas of this type, as hex.\n * @example \"#E5482F\"\n */\n color?: string;\n /**\n * Cons are short caveats for this ticket type, shown alongside the pros.\n * @uniqueItems false\n * @example [\"No seating\"]\n */\n cons?: string[];\n /**\n * Description is optional customer-facing copy for this ticket type.\n * @example \"Front-stage standing with a dedicated bar\"\n */\n description?: string;\n /**\n * ID is the ticket type's stable id, referenced by order items and seats.\n * @example \"1810000000000000201\"\n */\n id?: string;\n /**\n * Kind is \"seated\" (maps to a seat) or \"standing\" (sold by quantity).\n * @example \"standing\"\n */\n kind?: \"seated\" | \"standing\";\n /**\n * MaxPerCustomer caps how many of this type one verified buyer may hold\n * across orders (anti-scalping); absent when unlimited.\n * @example 4\n */\n maxPerCustomer?: number;\n /**\n * MaxPerOrder caps how many of this type a single order may contain.\n * @example 6\n */\n maxPerOrder?: number;\n /**\n * MinPerOrder appears only when it is a real constraint (> 1) — the\n * limit applies to orders that include this type at all.\n * @example 1\n */\n minPerOrder?: number;\n /**\n * Name is the ticket type's display label.\n * @example \"VIP\"\n */\n name?: string;\n /**\n * PriceCents is the unit price in the event's currency's minor units.\n * @example 149000\n */\n priceCents?: number;\n /**\n * Pros are short selling points for this ticket type, shown as a checklist.\n * @uniqueItems false\n * @example [\"Best view\",\"Dedicated bar\",\"Fast-track entry\"]\n */\n pros?: string[];\n /**\n * SaleEndTime is when this type stops selling (RFC 3339), if scheduled.\n * @example \"2026-06-20T16:00:00Z\"\n */\n saleEndTime?: string;\n /**\n * SaleStartTime is when this type goes on sale (RFC 3339), if scheduled.\n * @example \"2026-01-15T10:00:00Z\"\n */\n saleStartTime?: string;\n}\n\nexport interface DtoPublicVerification {\n /**\n * ExpiresAt is when the token stops being accepted (RFC 3339).\n * @example \"2026-06-20T18:30:00Z\"\n */\n expiresAt?: string;\n /**\n * Phone is the normalized number the token certifies.\n * @example \"+420777123456\"\n */\n phone?: string;\n /**\n * VerificationToken is consumed by exactly one order for this event.\n * @example \"5Yx…\"\n */\n verificationToken?: string;\n}\n\nexport interface DtoPublicVerifyCheckRequest {\n /**\n * Code is the OTP from the SMS.\n * @minLength 4\n * @maxLength 10\n * @example \"123456\"\n */\n code: string;\n /**\n * @minLength 8\n * @maxLength 20\n * @example \"+420777123456\"\n */\n phone: string;\n}\n\nexport interface DtoPublicVerifyStartRequest {\n /**\n * CaptchaToken is the client-side captcha solution, verified server-side.\n * @example \"03AGdBq26…\"\n */\n captchaToken?: string;\n /**\n * Phone in international E.164 format.\n * @minLength 8\n * @maxLength 20\n * @example \"+420777123456\"\n */\n phone: string;\n}\n\nexport type ResponseAPIResponseEmpty = object;\n","// Live availability over websocket: {\"event\":\"startstate\"|\"seat\", data}.\n// Startstate re-fires on every reconnect, so consumers treat it as the\n// resync point and apply deltas on top.\nimport type { DtoPublicAvailability } from './generated/api.js';\n\n/** One seat changing state. \"reserved\" appears only when the event shares\n * reserved status publicly — a reserved seat may free up again. */\nexport interface SeatDelta {\n\tseatId: string;\n\ttaken: boolean;\n\tstatus: 'free' | 'reserved' | 'taken';\n}\n\nexport interface LiveHandlers {\n\t/** Full snapshot — on connect and on every reconnect. */\n\tonStartstate?: (availability: DtoPublicAvailability) => void;\n\t/** One seat changed. */\n\tonSeat?: (delta: SeatDelta) => void;\n\t/** Connection state changes (drive a \"live\" indicator if you like). */\n\tonConnectionChange?: (connected: boolean) => void;\n}\n\nconst INITIAL_BACKOFF_MS = 1000;\nconst MAX_BACKOFF_MS = 15000;\n\nexport class LiveSubscription {\n\t#url: string;\n\t#handlers: LiveHandlers;\n\t#ws: WebSocket | null = null;\n\t#backoff = INITIAL_BACKOFF_MS;\n\t#retry: ReturnType<typeof setTimeout> | null = null;\n\t#closed = false;\n\n\tconstructor(url: string, handlers: LiveHandlers) {\n\t\tthis.#url = url.replace(/^http/, 'ws');\n\t\tthis.#handlers = handlers;\n\t\tthis.#connect();\n\t}\n\n\tclose(): void {\n\t\tthis.#closed = true;\n\t\tif (this.#retry) clearTimeout(this.#retry);\n\t\tthis.#ws?.close();\n\t}\n\n\t#connect(): void {\n\t\tif (this.#closed) return;\n\t\tconst ws = new WebSocket(this.#url);\n\t\tthis.#ws = ws;\n\t\tws.onopen = () => {\n\t\t\tthis.#backoff = INITIAL_BACKOFF_MS;\n\t\t\tthis.#handlers.onConnectionChange?.(true);\n\t\t};\n\t\tws.onmessage = (event) => {\n\t\t\tlet message: { event?: string; data?: unknown };\n\t\t\ttry {\n\t\t\t\tmessage = JSON.parse(event.data as string);\n\t\t\t} catch {\n\t\t\t\treturn; // ignore malformed / non-JSON frames rather than throwing\n\t\t\t}\n\t\t\tif (message.event === 'startstate') {\n\t\t\t\tthis.#handlers.onStartstate?.(message.data as DtoPublicAvailability);\n\t\t\t} else if (message.event === 'seat') {\n\t\t\t\tthis.#handlers.onSeat?.(message.data as SeatDelta);\n\t\t\t}\n\t\t};\n\t\tws.onclose = () => {\n\t\t\tthis.#handlers.onConnectionChange?.(false);\n\t\t\tif (this.#closed) return;\n\t\t\t// Equal-jitter backoff: reconnect somewhere in [backoff/2, backoff) so a\n\t\t\t// mass disconnect doesn't produce a synchronized reconnect thundering herd.\n\t\t\tconst delay = this.#backoff / 2 + Math.random() * (this.#backoff / 2);\n\t\t\tthis.#retry = setTimeout(() => this.#connect(), delay);\n\t\t\tthis.#backoff = Math.min(this.#backoff * 2, MAX_BACKOFF_MS);\n\t\t};\n\t}\n}\n","// The typed core of @bookitive/js: a thin fetch wrapper over the public\n// checkout API, addressed by org + event slug. All response and payload types\n// are generated from the backend's public swagger — they cannot drift.\nimport { DtoErrorCode } from './generated/api.js';\nimport type {\n\tDtoAPIError,\n\tDtoPublicAvailability,\n\tDtoPublicDiscount,\n\tDtoPublicEvent,\n\tDtoPublicOrder,\n\tDtoPublicOrderRequest,\n\tDtoPublicSeating,\n\tDtoPublicVerification,\n} from './generated/api.js';\nimport { LiveSubscription, type LiveHandlers } from './live.js';\n\nexport interface BookitiveClientOptions {\n\t/** API origin, e.g. \"https://api.bookitive.com\" (no trailing slash). */\n\tbaseUrl: string;\n\t/** Organization slug — the {org} in events.bookitive.com/{org}/{event}. */\n\torg: string;\n\t/** Event slug. */\n\tevent: string;\n\t/** Custom fetch (SSR frameworks pass their own). Defaults to global fetch. */\n\tfetch?: typeof fetch;\n}\n\n/** API failure with the backend's error envelope attached. */\nexport class BookitiveError extends Error {\n\treadonly status: number;\n\t/** The backend error code (e.g. DtoErrorCode.ErrConflict), or \"UNKNOWN\" when\n\t * the response carried no JSON envelope. */\n\treadonly type: DtoErrorCode | 'UNKNOWN';\n\n\tconstructor(status: number, body: DtoAPIError | undefined, fallback: string) {\n\t\tsuper(body?.msg ?? fallback);\n\t\tthis.name = 'BookitiveError';\n\t\tthis.status = status;\n\t\tthis.type = body?.type ?? 'UNKNOWN';\n\t}\n\n\t/** The selection raced another buyer — refresh availability and reselect. */\n\tget isConflict(): boolean {\n\t\treturn this.type === DtoErrorCode.ErrConflict || this.status === 409;\n\t}\n}\n\nexport class BookitiveClient {\n\treadonly #base: string;\n\treadonly #fetch: typeof fetch;\n\n\tconstructor(options: BookitiveClientOptions) {\n\t\tthis.#base = `${options.baseUrl.replace(/\\/$/, '')}/public/v1/orgs/${encodeURIComponent(\n\t\t\toptions.org\n\t\t)}/events/${encodeURIComponent(options.event)}`;\n\t\t// bind, or a browser's fetch throws \"Illegal invocation\" when called\n\t\t// detached from window\n\t\tthis.#fetch = options.fetch ?? ((...args) => fetch(...args));\n\t}\n\n\t/** Event identity, org branding, priced ticket types, and floor tabs. */\n\tevent(): Promise<DtoPublicEvent> {\n\t\treturn this.#get<DtoPublicEvent>('');\n\t}\n\n\t/** Static chart geometry: floors → sections → tables, seats, GA areas. */\n\tseating(): Promise<DtoPublicSeating> {\n\t\treturn this.#get<DtoPublicSeating>('/seating');\n\t}\n\n\t/** Live sellability snapshot (poll it, or use live() for push updates). */\n\tavailability(): Promise<DtoPublicAvailability> {\n\t\treturn this.#get<DtoPublicAvailability>('/availability');\n\t}\n\n\t/**\n\t * Previews a promo code: what applying it would do. Throws a\n\t * BookitiveError with status 404 for unknown/paused/out-of-window codes\n\t * and 409 (error.isConflict) when the code is fully redeemed. The order\n\t * endpoint re-validates on submit.\n\t */\n\tdiscount(code: string): Promise<DtoPublicDiscount> {\n\t\treturn this.#get<DtoPublicDiscount>(`/discount?code=${encodeURIComponent(code)}`);\n\t}\n\n\t/**\n\t * Places a bank-transfer reservation: seats are held atomically for the\n\t * event's hold TTL and payment instructions are emailed (and returned).\n\t * A 409 (error.isConflict) means a seat was just taken — refresh and\n\t * reselect.\n\t */\n\tasync checkout(order: DtoPublicOrderRequest): Promise<DtoPublicOrder> {\n\t\tconst res = await this.#fetch(`${this.#base}/orders`, {\n\t\t\tmethod: 'POST',\n\t\t\theaders: { 'Content-Type': 'application/json' },\n\t\t\tbody: JSON.stringify(order),\n\t\t});\n\t\treturn this.#parse<DtoPublicOrder>(res, 'checkout failed');\n\t}\n\n\t/**\n\t * Sends a one-time code by SMS for events that require a verified phone\n\t * (event.protection.requireVerifiedPhone). Captcha-gated like checkout, so\n\t * pass a captcha token minted on the Bookitive origin. Throws a\n\t * BookitiveError: 400 (bad/disallowed number), 403 (captcha/blocked), or\n\t * 429 (cooldown/rate limit — back off and let the buyer retry).\n\t */\n\tasync verifyStart(phone: string, captchaToken?: string): Promise<void> {\n\t\tconst res = await this.#fetch(`${this.#base}/verify/start`, {\n\t\t\tmethod: 'POST',\n\t\t\theaders: { 'Content-Type': 'application/json' },\n\t\t\tbody: JSON.stringify({ phone, captchaToken }),\n\t\t});\n\t\tawait this.#parse<void>(res, 'failed to send verification code');\n\t}\n\n\t/**\n\t * Validates the SMS code and returns a single-use verificationToken (valid\n\t * ~30 min) to pass as order.verificationToken. Throws a BookitiveError:\n\t * 400 (wrong code), 410 (expired — resend), or 429 (too many attempts).\n\t */\n\tverifyCheck(phone: string, code: string): Promise<DtoPublicVerification> {\n\t\treturn this.#post<DtoPublicVerification>('/verify/check', { phone, code });\n\t}\n\n\t/**\n\t * Subscribes to live availability over websocket: `startstate` fires with\n\t * the full snapshot on every (re)connect, then `seat` deltas stream in.\n\t * Reconnects automatically with backoff; call close() when done.\n\t */\n\tlive(handlers: LiveHandlers): LiveSubscription {\n\t\treturn new LiveSubscription(`${this.#base}/live`, handlers);\n\t}\n\n\tasync #get<T>(path: string): Promise<T> {\n\t\tconst res = await this.#fetch(`${this.#base}${path}`);\n\t\treturn this.#parse<T>(res, `request failed: ${path || '/'}`);\n\t}\n\n\tasync #post<T>(path: string, body: unknown): Promise<T> {\n\t\tconst res = await this.#fetch(`${this.#base}${path}`, {\n\t\t\tmethod: 'POST',\n\t\t\theaders: { 'Content-Type': 'application/json' },\n\t\t\tbody: JSON.stringify(body),\n\t\t});\n\t\treturn this.#parse<T>(res, `request failed: ${path}`);\n\t}\n\n\tasync #parse<T>(res: Response, fallback: string): Promise<T> {\n\t\tif (!res.ok) {\n\t\t\tlet body: DtoAPIError | undefined;\n\t\t\ttry {\n\t\t\t\tbody = (await res.json()) as DtoAPIError;\n\t\t\t} catch {\n\t\t\t\t// non-JSON error body — the fallback message covers it\n\t\t\t}\n\t\t\tthrow new BookitiveError(res.status, body, fallback);\n\t\t}\n\t\t// 204/205 never carry a body. Otherwise read the text and parse only\n\t\t// when it's non-empty — this avoids res.headers.get('content-length'),\n\t\t// which throws under SvelteKit's SSR fetch (response headers aren't\n\t\t// serialized by default) and would otherwise 500 any server-side load.\n\t\tif (res.status === 204 || res.status === 205) {\n\t\t\treturn undefined as T;\n\t\t}\n\t\tconst text = await res.text();\n\t\treturn (text ? JSON.parse(text) : undefined) as T;\n\t}\n}\n"],"mappings":";AAgBO,IAAK,eAAL,kBAAKA,kBAAL;AACL,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,yBAAsB;AACtB,EAAAA,cAAA,iBAAc;AACd,EAAAA,c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