@seatmap.pro/renderer 0.0.1
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 +788 -0
- package/lib/index.d.mts +2187 -0
- package/lib/index.d.ts +2187 -0
- package/lib/index.js +1 -0
- package/lib/index.mjs +1 -0
- package/package.json +91 -0
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,2187 @@
|
|
|
1
|
+
import KDBush from 'kdbush';
|
|
2
|
+
import { Machine, Service } from 'robot3';
|
|
3
|
+
|
|
4
|
+
interface IPoint {
|
|
5
|
+
readonly x: number;
|
|
6
|
+
readonly y: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
type ById$1<T> = {
|
|
10
|
+
[id: number]: T;
|
|
11
|
+
};
|
|
12
|
+
interface IPrice {
|
|
13
|
+
id: IPriceId;
|
|
14
|
+
name: string;
|
|
15
|
+
}
|
|
16
|
+
interface IColoredPrice extends IPrice {
|
|
17
|
+
color: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @hidden
|
|
21
|
+
*/
|
|
22
|
+
type ColorSequenceSettings = string[][];
|
|
23
|
+
/**
|
|
24
|
+
* @hidden
|
|
25
|
+
*/
|
|
26
|
+
declare const sortPrices: <T extends IPrice>(prices: T[]) => T[];
|
|
27
|
+
/**
|
|
28
|
+
* @hidden
|
|
29
|
+
*/
|
|
30
|
+
declare const convertPricesToColored: (prices: IPrice[], colorSettings: ColorSequenceSettings) => IColoredPrice[];
|
|
31
|
+
/**
|
|
32
|
+
* @hidden
|
|
33
|
+
*/
|
|
34
|
+
declare const convertPricesToColoredById: (prices: IPrice[], colorSettings: ColorSequenceSettings) => ById$1<IColoredPrice>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @hidden
|
|
38
|
+
*/
|
|
39
|
+
interface IRendererMachineContext {
|
|
40
|
+
mode?: string;
|
|
41
|
+
scale: number;
|
|
42
|
+
isEagleView: boolean;
|
|
43
|
+
events: DestEvent[];
|
|
44
|
+
hovered?: {
|
|
45
|
+
targetType: RendererTargetType;
|
|
46
|
+
id: number;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @hidden
|
|
51
|
+
*/
|
|
52
|
+
type RendererMachineReducer<T> = (ctx: IRendererMachineContext, src: T) => IRendererMachineContext;
|
|
53
|
+
/**
|
|
54
|
+
* @hidden
|
|
55
|
+
*/
|
|
56
|
+
type RendererMachine = Machine<any, IRendererMachineContext, any>;
|
|
57
|
+
/**
|
|
58
|
+
* @hidden
|
|
59
|
+
*/
|
|
60
|
+
type RendererMachineService = Service<RendererMachine>;
|
|
61
|
+
/**
|
|
62
|
+
* @hidden
|
|
63
|
+
*/
|
|
64
|
+
declare enum RendererTargetType {
|
|
65
|
+
SEAT = "seat",
|
|
66
|
+
SECTION = "section"
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @hidden
|
|
70
|
+
*/
|
|
71
|
+
declare enum RendererSelectMode {
|
|
72
|
+
REPLACE = "replace",
|
|
73
|
+
ADD = "add",
|
|
74
|
+
SUBTRACT = "subtract"
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Source events
|
|
78
|
+
*/
|
|
79
|
+
/**
|
|
80
|
+
* @hidden
|
|
81
|
+
*/
|
|
82
|
+
declare enum SrcEventType {
|
|
83
|
+
DRAG_START = "srcDragStart",
|
|
84
|
+
DRAG_MOVE = "srcDragMove",
|
|
85
|
+
DRAG_END = "srcDragEnd",
|
|
86
|
+
CLICK = "srcClick",
|
|
87
|
+
MOUSE_MOVE = "srcMouseMove"
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* @hidden
|
|
91
|
+
*/
|
|
92
|
+
type SrcEvent = IDragStartSrcEvent | IDragMoveSrcEvent | IDragEndSrcEvent | IClickSrcEvent | IMouseMoveSrcEvent;
|
|
93
|
+
/**
|
|
94
|
+
* @hidden
|
|
95
|
+
*/
|
|
96
|
+
interface IDragSrcEvent<T> {
|
|
97
|
+
type: T;
|
|
98
|
+
origin: {
|
|
99
|
+
x: number;
|
|
100
|
+
y: number;
|
|
101
|
+
};
|
|
102
|
+
delta: {
|
|
103
|
+
x: number;
|
|
104
|
+
y: number;
|
|
105
|
+
};
|
|
106
|
+
shiftKey?: boolean;
|
|
107
|
+
altKey?: boolean;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* @hidden
|
|
111
|
+
*/
|
|
112
|
+
interface IDragStartSrcEvent extends IDragSrcEvent<SrcEventType.DRAG_START> {
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* @hidden
|
|
116
|
+
*/
|
|
117
|
+
interface IDragMoveSrcEvent extends IDragSrcEvent<SrcEventType.DRAG_MOVE> {
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* @hidden
|
|
121
|
+
*/
|
|
122
|
+
interface IDragEndSrcEvent extends IDragSrcEvent<SrcEventType.DRAG_END> {
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* @hidden
|
|
126
|
+
*/
|
|
127
|
+
interface IClickSrcEvent {
|
|
128
|
+
type: SrcEventType.CLICK;
|
|
129
|
+
target: HTMLElement;
|
|
130
|
+
point: {
|
|
131
|
+
x: number;
|
|
132
|
+
y: number;
|
|
133
|
+
};
|
|
134
|
+
section?: ISection;
|
|
135
|
+
seat?: ISeat;
|
|
136
|
+
shiftKey?: boolean;
|
|
137
|
+
altKey?: boolean;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* @hidden
|
|
141
|
+
*/
|
|
142
|
+
interface IMouseMoveSrcEvent {
|
|
143
|
+
type: SrcEventType.MOUSE_MOVE;
|
|
144
|
+
target: HTMLElement;
|
|
145
|
+
section?: ISection;
|
|
146
|
+
seat?: ISeat;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Output events
|
|
150
|
+
*/
|
|
151
|
+
/**
|
|
152
|
+
* @hidden
|
|
153
|
+
*/
|
|
154
|
+
declare enum DestEventType {
|
|
155
|
+
PAN = "destPan",
|
|
156
|
+
RECT_SELECT = "destRectSelect",
|
|
157
|
+
DESELECT = "destDeselect",
|
|
158
|
+
PAN_ZOOM = "destPanZoom",
|
|
159
|
+
SEAT_SELECT = "destSeatSelect",
|
|
160
|
+
SEAT_CART_SWITCH = "destSeatCartSwitch",
|
|
161
|
+
SECTION_CLICK = "destSectionClick",
|
|
162
|
+
SEAT_MOUSE_ENTER = "destSeatMouseEnter",
|
|
163
|
+
SECTION_MOUSE_ENTER = "destSectionMouseEnter",
|
|
164
|
+
SEAT_MOUSE_LEAVE = "destSeatMouseLeave",
|
|
165
|
+
SECTION_MOUSE_LEAVE = "destSectionMouseLeave"
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* @hidden
|
|
169
|
+
*/
|
|
170
|
+
type DestEvent = IPanDestEvent | IRectSelectDestEvent | IPanZoomDestEvent | IDeselectDestEvent | ISeatSelectDestEvent | ISeatCartSwitchDestEvent | ISectionClickDestEvent | ISeatMouseEnterDestEvent | ISectionMouseEnterDestEvent | ISeatMouseLeaveDestEvent | ISectionMouseLeaveDestEvent;
|
|
171
|
+
/**
|
|
172
|
+
* @hidden
|
|
173
|
+
*/
|
|
174
|
+
interface IPanDestEvent {
|
|
175
|
+
type: DestEventType.PAN;
|
|
176
|
+
isStart?: boolean;
|
|
177
|
+
isFinish?: boolean;
|
|
178
|
+
delta: {
|
|
179
|
+
x: number;
|
|
180
|
+
y: number;
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* @hidden
|
|
185
|
+
*/
|
|
186
|
+
interface IRectSelectDestEvent {
|
|
187
|
+
type: DestEventType.RECT_SELECT;
|
|
188
|
+
selectMode: RendererSelectMode;
|
|
189
|
+
isStart?: boolean;
|
|
190
|
+
isFinish?: boolean;
|
|
191
|
+
isRowsMode?: boolean;
|
|
192
|
+
rect: {
|
|
193
|
+
x: number;
|
|
194
|
+
y: number;
|
|
195
|
+
width: number;
|
|
196
|
+
height: number;
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* @hidden
|
|
201
|
+
*/
|
|
202
|
+
interface IPanZoomDestEvent {
|
|
203
|
+
type: DestEventType.PAN_ZOOM;
|
|
204
|
+
scale: number;
|
|
205
|
+
origin?: {
|
|
206
|
+
x: number;
|
|
207
|
+
y: number;
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* @hidden
|
|
212
|
+
*/
|
|
213
|
+
interface ISeatMouseEnterDestEvent {
|
|
214
|
+
type: DestEventType.SEAT_MOUSE_ENTER;
|
|
215
|
+
isRowsMode?: boolean;
|
|
216
|
+
seat: ISeat;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* @hidden
|
|
220
|
+
*/
|
|
221
|
+
interface ISectionMouseEnterDestEvent {
|
|
222
|
+
type: DestEventType.SECTION_MOUSE_ENTER;
|
|
223
|
+
section: ISection;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* @hidden
|
|
227
|
+
*/
|
|
228
|
+
interface ISeatMouseLeaveDestEvent {
|
|
229
|
+
type: DestEventType.SEAT_MOUSE_LEAVE;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* @hidden
|
|
233
|
+
*/
|
|
234
|
+
interface ISectionMouseLeaveDestEvent {
|
|
235
|
+
type: DestEventType.SECTION_MOUSE_LEAVE;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* @hidden
|
|
239
|
+
*/
|
|
240
|
+
interface IDeselectDestEvent {
|
|
241
|
+
type: DestEventType.DESELECT;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* @hidden
|
|
245
|
+
*/
|
|
246
|
+
interface ISeatSelectDestEvent {
|
|
247
|
+
type: DestEventType.SEAT_SELECT;
|
|
248
|
+
selectMode: RendererSelectMode;
|
|
249
|
+
point: {
|
|
250
|
+
x: number;
|
|
251
|
+
y: number;
|
|
252
|
+
};
|
|
253
|
+
seat: ISeat;
|
|
254
|
+
isRowsMode?: boolean;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* @hidden
|
|
258
|
+
*/
|
|
259
|
+
interface ISeatCartSwitchDestEvent {
|
|
260
|
+
type: DestEventType.SEAT_CART_SWITCH;
|
|
261
|
+
point: {
|
|
262
|
+
x: number;
|
|
263
|
+
y: number;
|
|
264
|
+
};
|
|
265
|
+
seat: ISeat;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* @hidden
|
|
269
|
+
*/
|
|
270
|
+
interface ISectionClickDestEvent {
|
|
271
|
+
type: DestEventType.SECTION_CLICK;
|
|
272
|
+
point: {
|
|
273
|
+
x: number;
|
|
274
|
+
y: number;
|
|
275
|
+
};
|
|
276
|
+
section: ISection;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* @hidden
|
|
281
|
+
*/
|
|
282
|
+
interface IGaInfo {
|
|
283
|
+
id: number;
|
|
284
|
+
name: string;
|
|
285
|
+
transform: TransformArray;
|
|
286
|
+
isTable?: boolean;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* @hidden
|
|
290
|
+
*/
|
|
291
|
+
declare class Context {
|
|
292
|
+
private redrawHandler;
|
|
293
|
+
element: HTMLElement;
|
|
294
|
+
settings: IRendererSettings;
|
|
295
|
+
seatImages: {
|
|
296
|
+
[id: string]: HTMLImageElement;
|
|
297
|
+
};
|
|
298
|
+
cart: ICart;
|
|
299
|
+
gaCategories: {
|
|
300
|
+
[id: number]: number;
|
|
301
|
+
};
|
|
302
|
+
categoriesColor: {
|
|
303
|
+
[id: number]: string | undefined;
|
|
304
|
+
};
|
|
305
|
+
scale: number;
|
|
306
|
+
translate: IPoint;
|
|
307
|
+
isEagleView: boolean;
|
|
308
|
+
private _seats;
|
|
309
|
+
seatsIndex: KDBush<ISeat>;
|
|
310
|
+
seatsById: ById<ISeat>;
|
|
311
|
+
seatsByRowId: {
|
|
312
|
+
[rowId: number]: ISeat[];
|
|
313
|
+
};
|
|
314
|
+
rowsById: ById<IRowDTO>;
|
|
315
|
+
sectionsById: ById<ISector>;
|
|
316
|
+
pricesById: ById<IColoredPrice>;
|
|
317
|
+
seatsKeysMissedOnPriceSet: string[];
|
|
318
|
+
seatsIdsMissedOnPriceSet: number[];
|
|
319
|
+
/**
|
|
320
|
+
* @hidden
|
|
321
|
+
*/
|
|
322
|
+
private _pricesDTO;
|
|
323
|
+
private _selectedSeatIds;
|
|
324
|
+
private _selectedGaId?;
|
|
325
|
+
underlay: {
|
|
326
|
+
svgString: string;
|
|
327
|
+
viewBox: {
|
|
328
|
+
x: number;
|
|
329
|
+
y: number;
|
|
330
|
+
width: number;
|
|
331
|
+
height: number;
|
|
332
|
+
};
|
|
333
|
+
svgUrl?: string;
|
|
334
|
+
pngBackground?: IPngBackgroundDTO;
|
|
335
|
+
};
|
|
336
|
+
hoveredSeat?: ISeat;
|
|
337
|
+
hoveredRow?: IRowDTO;
|
|
338
|
+
gaInfo: IGaInfo[];
|
|
339
|
+
constructor(element: HTMLElement, settings: IRendererSettings, redrawHandler: () => void);
|
|
340
|
+
set selectedSeatIds(value: number[]);
|
|
341
|
+
get selectedSeatIds(): number[];
|
|
342
|
+
set selectedGaId(value: number | undefined);
|
|
343
|
+
get selectedGaId(): number | undefined;
|
|
344
|
+
destroy(): void;
|
|
345
|
+
/**
|
|
346
|
+
* @hidden
|
|
347
|
+
*/
|
|
348
|
+
setPricesDTO(value: IPriceListDTO): void;
|
|
349
|
+
/**
|
|
350
|
+
* @hidden
|
|
351
|
+
*/
|
|
352
|
+
getPricesDTO(): IPriceListDTO;
|
|
353
|
+
setHovered(seat: ISeat | undefined, isRowsMode?: boolean): void;
|
|
354
|
+
private createSeatImages;
|
|
355
|
+
initCart(cart: ICart): void;
|
|
356
|
+
get seats(): ISeat[];
|
|
357
|
+
set seats(value: ISeat[]);
|
|
358
|
+
getPositionByOffset: (offset: IPoint) => IPoint;
|
|
359
|
+
getOffsetByPosition: (position: IPoint) => IPoint;
|
|
360
|
+
addGaToCart(ga: ICartGa): void;
|
|
361
|
+
removeGaFromCart(removedGa: IRemovedCartGa): void;
|
|
362
|
+
addSeatsToCart(seats: ICartSeat[]): void;
|
|
363
|
+
rectSelectSeats(rect: {
|
|
364
|
+
x: number;
|
|
365
|
+
y: number;
|
|
366
|
+
width: number;
|
|
367
|
+
height: number;
|
|
368
|
+
}, mode: RendererSelectMode): void;
|
|
369
|
+
selectSeats(seats: number[], mode: RendererSelectMode): void;
|
|
370
|
+
rectSelectRows(rect: {
|
|
371
|
+
x: number;
|
|
372
|
+
y: number;
|
|
373
|
+
width: number;
|
|
374
|
+
height: number;
|
|
375
|
+
}, mode: RendererSelectMode): void;
|
|
376
|
+
repairSeat: (s: ICartSeat) => ICartSeat | undefined;
|
|
377
|
+
afterCartUpdate: () => void;
|
|
378
|
+
repairGa: (ga: ICartGa) => ICartGa | undefined;
|
|
379
|
+
findSeatByKey(key: string): ISeat | undefined;
|
|
380
|
+
getCart(): ICart;
|
|
381
|
+
isSeatInCart(seatId: number): boolean;
|
|
382
|
+
isSectionSelected(sectorId: number): boolean;
|
|
383
|
+
addSeatToCart(seatId: number): void;
|
|
384
|
+
removeSeatFromCart(seatId: number): void;
|
|
385
|
+
getCartSeats(): ISeat[];
|
|
386
|
+
getSeatSelection(): ISeat[];
|
|
387
|
+
setSectionSelection(sections?: number[] | string[]): (number | undefined)[] | null;
|
|
388
|
+
getSvgSectionBySelection(): ISectorDTO[];
|
|
389
|
+
getGaSectors(): ISector[];
|
|
390
|
+
seatToCartSeat: (seat: ISeat, origCartSeat?: ICartSeat) => ICartSeat;
|
|
391
|
+
seatToExtendedSeat: (seat: ISeat) => IExtendedSeat;
|
|
392
|
+
calculateAbsolutePoint(point: IPoint): IPoint;
|
|
393
|
+
getSeatByOffset: (offset: IPoint) => ISeat | undefined;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* Type for mapping objects by their ID.
|
|
398
|
+
*/
|
|
399
|
+
type ById<T> = {
|
|
400
|
+
[id: number]: T;
|
|
401
|
+
};
|
|
402
|
+
/**
|
|
403
|
+
* Type representing a price identifier, which can be either a number or a string.
|
|
404
|
+
* Used to uniquely identify price points in the system.
|
|
405
|
+
*/
|
|
406
|
+
type IPriceId = number | string;
|
|
407
|
+
/**
|
|
408
|
+
* Type representing a transformation matrix as a 6-element array.
|
|
409
|
+
*/
|
|
410
|
+
type TransformArray = [number, number, number, number, number, number];
|
|
411
|
+
/**
|
|
412
|
+
* Interface representing a seat in the venue with extended properties.
|
|
413
|
+
* Contains all the base seat properties plus additional properties for rendering and interaction.
|
|
414
|
+
*/
|
|
415
|
+
interface ISeat extends IBaseSeat {
|
|
416
|
+
/**
|
|
417
|
+
* The price ID associated with this seat.
|
|
418
|
+
*/
|
|
419
|
+
priceId?: IPriceId;
|
|
420
|
+
/**
|
|
421
|
+
* Whether the seat is locked and cannot be selected.
|
|
422
|
+
*/
|
|
423
|
+
locked?: boolean;
|
|
424
|
+
/**
|
|
425
|
+
* Whether the seat is filtered out by current filter criteria.
|
|
426
|
+
*/
|
|
427
|
+
filtered?: boolean;
|
|
428
|
+
/**
|
|
429
|
+
* Special state information for the seat.
|
|
430
|
+
*/
|
|
431
|
+
special?: ISpecialState;
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Interface representing a sector in the venue with extended properties.
|
|
435
|
+
* Contains all the base sector properties plus additional properties for rendering and interaction.
|
|
436
|
+
*/
|
|
437
|
+
interface ISector extends IBaseSector {
|
|
438
|
+
/**
|
|
439
|
+
* The price ID associated with this sector.
|
|
440
|
+
*/
|
|
441
|
+
priceId?: IPriceId;
|
|
442
|
+
/**
|
|
443
|
+
* Special state information for the sector.
|
|
444
|
+
*/
|
|
445
|
+
special?: ISpecialState;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Interface representing a section in the venue.
|
|
449
|
+
* A section is a logical grouping of seats or a general admission area.
|
|
450
|
+
*/
|
|
451
|
+
interface ISection {
|
|
452
|
+
/**
|
|
453
|
+
* The unique ID of the section.
|
|
454
|
+
*/
|
|
455
|
+
id?: number;
|
|
456
|
+
/**
|
|
457
|
+
* The name of the section.
|
|
458
|
+
*/
|
|
459
|
+
name: string;
|
|
460
|
+
/**
|
|
461
|
+
* Whether this is a general admission section.
|
|
462
|
+
*/
|
|
463
|
+
ga: boolean;
|
|
464
|
+
/**
|
|
465
|
+
* The rectangular bounds of the section.
|
|
466
|
+
*/
|
|
467
|
+
rect: ISectionRect;
|
|
468
|
+
/**
|
|
469
|
+
* The price for the section.
|
|
470
|
+
*/
|
|
471
|
+
price?: number;
|
|
472
|
+
/**
|
|
473
|
+
* Special state information for the section.
|
|
474
|
+
*/
|
|
475
|
+
special?: ISpecialState;
|
|
476
|
+
/**
|
|
477
|
+
* The type of the section.
|
|
478
|
+
*/
|
|
479
|
+
type?: string | null;
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Interface representing a section with additional coordinate information.
|
|
483
|
+
* Extends ISection with absolute x and y coordinates.
|
|
484
|
+
*/
|
|
485
|
+
interface ISectionWithCoords {
|
|
486
|
+
/**
|
|
487
|
+
* The X coordinate of the section.
|
|
488
|
+
*/
|
|
489
|
+
x: number;
|
|
490
|
+
/**
|
|
491
|
+
* The Y coordinate of the section.
|
|
492
|
+
*/
|
|
493
|
+
y: number;
|
|
494
|
+
/**
|
|
495
|
+
* The unique ID of the section.
|
|
496
|
+
*/
|
|
497
|
+
id?: number | undefined;
|
|
498
|
+
/**
|
|
499
|
+
* The name of the section.
|
|
500
|
+
*/
|
|
501
|
+
name: string;
|
|
502
|
+
/**
|
|
503
|
+
* Whether this is a general admission section.
|
|
504
|
+
*/
|
|
505
|
+
ga: boolean;
|
|
506
|
+
/**
|
|
507
|
+
* The rectangular bounds of the section.
|
|
508
|
+
*/
|
|
509
|
+
rect: ISectionRect;
|
|
510
|
+
/**
|
|
511
|
+
* The price for the section.
|
|
512
|
+
*/
|
|
513
|
+
price?: number | undefined;
|
|
514
|
+
/**
|
|
515
|
+
* Special state information for the section.
|
|
516
|
+
*/
|
|
517
|
+
special?: ISpecialState | undefined;
|
|
518
|
+
/**
|
|
519
|
+
* The type of the section.
|
|
520
|
+
*/
|
|
521
|
+
type?: string | undefined | null;
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* Interface representing the rectangular bounds of a section.
|
|
525
|
+
*/
|
|
526
|
+
interface ISectionRect {
|
|
527
|
+
/**
|
|
528
|
+
* The left coordinate of the rectangle.
|
|
529
|
+
*/
|
|
530
|
+
left: number;
|
|
531
|
+
/**
|
|
532
|
+
* The top coordinate of the rectangle.
|
|
533
|
+
*/
|
|
534
|
+
top: number;
|
|
535
|
+
/**
|
|
536
|
+
* The width of the rectangle.
|
|
537
|
+
*/
|
|
538
|
+
width: number;
|
|
539
|
+
/**
|
|
540
|
+
* The height of the rectangle.
|
|
541
|
+
*/
|
|
542
|
+
height: number;
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Interface representing a seat in the shopping cart.
|
|
546
|
+
*/
|
|
547
|
+
interface ICartSeat {
|
|
548
|
+
/**
|
|
549
|
+
* The unique identifier of the seat.
|
|
550
|
+
*/
|
|
551
|
+
id?: number;
|
|
552
|
+
/**
|
|
553
|
+
* The unique key for the seat, typically combining section, row, and seat information.
|
|
554
|
+
*/
|
|
555
|
+
key: string;
|
|
556
|
+
/**
|
|
557
|
+
* The price of the seat.
|
|
558
|
+
*/
|
|
559
|
+
price?: number;
|
|
560
|
+
/**
|
|
561
|
+
* Special state information for the seat.
|
|
562
|
+
*/
|
|
563
|
+
special?: ISpecialState;
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* Extended interface for a seat with additional coordinate and descriptive information.
|
|
567
|
+
* Extends ICartSeat with position and section details.
|
|
568
|
+
*/
|
|
569
|
+
interface IExtendedSeat extends ICartSeat {
|
|
570
|
+
/**
|
|
571
|
+
* The X coordinate of the seat.
|
|
572
|
+
*/
|
|
573
|
+
x: number;
|
|
574
|
+
/**
|
|
575
|
+
* The Y coordinate of the seat.
|
|
576
|
+
*/
|
|
577
|
+
y: number;
|
|
578
|
+
/**
|
|
579
|
+
* The absolute X coordinate of the seat.
|
|
580
|
+
*/
|
|
581
|
+
ax: number;
|
|
582
|
+
/**
|
|
583
|
+
* The absolute Y coordinate of the seat.
|
|
584
|
+
*/
|
|
585
|
+
ay: number;
|
|
586
|
+
/**
|
|
587
|
+
* The ID of the section containing this seat.
|
|
588
|
+
*/
|
|
589
|
+
sectionId: number;
|
|
590
|
+
/**
|
|
591
|
+
* The ID of the sector containing this seat.
|
|
592
|
+
*/
|
|
593
|
+
sectorId: number;
|
|
594
|
+
/**
|
|
595
|
+
* The name or number of the seat.
|
|
596
|
+
*/
|
|
597
|
+
seatName: string;
|
|
598
|
+
/**
|
|
599
|
+
* The row number of the seat.
|
|
600
|
+
*/
|
|
601
|
+
rowNumber: number;
|
|
602
|
+
/**
|
|
603
|
+
* The name of the section containing this seat.
|
|
604
|
+
*/
|
|
605
|
+
sectionName: string;
|
|
606
|
+
/**
|
|
607
|
+
* Whether the seat is accessible for people with disabilities.
|
|
608
|
+
*/
|
|
609
|
+
isAccessible?: boolean;
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Interface representing a general admission (GA) item in the shopping cart.
|
|
613
|
+
*/
|
|
614
|
+
interface ICartGa {
|
|
615
|
+
/**
|
|
616
|
+
* The ID of the sector for this GA item.
|
|
617
|
+
*/
|
|
618
|
+
sectorId?: number;
|
|
619
|
+
/**
|
|
620
|
+
* The unique key for the GA item.
|
|
621
|
+
*/
|
|
622
|
+
key: string;
|
|
623
|
+
/**
|
|
624
|
+
* The number of GA tickets in this item.
|
|
625
|
+
*/
|
|
626
|
+
count: number;
|
|
627
|
+
/**
|
|
628
|
+
* The price per GA ticket.
|
|
629
|
+
*/
|
|
630
|
+
price: number;
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* Interface representing a removed general admission (GA) item from the cart.
|
|
634
|
+
*/
|
|
635
|
+
interface IRemovedCartGa {
|
|
636
|
+
/**
|
|
637
|
+
* The ID of the sector for the removed GA item.
|
|
638
|
+
*/
|
|
639
|
+
sectorId: number;
|
|
640
|
+
/**
|
|
641
|
+
* The price of the removed GA item.
|
|
642
|
+
*/
|
|
643
|
+
price?: number;
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* Interface representing the shopping cart containing selected seats and GA items.
|
|
647
|
+
*/
|
|
648
|
+
interface ICart {
|
|
649
|
+
/**
|
|
650
|
+
* Array of selected seats in the cart.
|
|
651
|
+
*/
|
|
652
|
+
seats: ICartSeat[];
|
|
653
|
+
/**
|
|
654
|
+
* Array of general admission items in the cart.
|
|
655
|
+
*/
|
|
656
|
+
ga: ICartGa[];
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Type definition for a function that filters seats based on custom criteria.
|
|
660
|
+
* @param seat - The seat to evaluate against the filter criteria
|
|
661
|
+
* @returns A boolean indicating whether the seat passes the filter (true) or not (false)
|
|
662
|
+
*/
|
|
663
|
+
type SeatFilter = (seat: ISeat) => boolean;
|
|
664
|
+
/**
|
|
665
|
+
* Type definition for a seat price scheme, which associates a price with a specific seat.
|
|
666
|
+
*/
|
|
667
|
+
type ISeatPriceScheme = {
|
|
668
|
+
/**
|
|
669
|
+
* Optional unique identifier for the price scheme.
|
|
670
|
+
*/
|
|
671
|
+
id?: number;
|
|
672
|
+
/**
|
|
673
|
+
* The unique key of the seat this price applies to.
|
|
674
|
+
*/
|
|
675
|
+
seatKey: string;
|
|
676
|
+
/**
|
|
677
|
+
* The price value for the seat.
|
|
678
|
+
*/
|
|
679
|
+
price: number;
|
|
680
|
+
/**
|
|
681
|
+
* The price ID reference for the seat.
|
|
682
|
+
*/
|
|
683
|
+
priceId: IPriceId;
|
|
684
|
+
};
|
|
685
|
+
/**
|
|
686
|
+
* Configuration settings for the renderer.
|
|
687
|
+
* Defines various options that control the behavior and appearance of the renderer.
|
|
688
|
+
*/
|
|
689
|
+
interface IRendererSettings {
|
|
690
|
+
/**
|
|
691
|
+
* Environment setting that determines which API endpoint to use.
|
|
692
|
+
* Can be 'local', 'stage', or 'production' (default).
|
|
693
|
+
*/
|
|
694
|
+
env?: string;
|
|
695
|
+
/**
|
|
696
|
+
* External price information for seats.
|
|
697
|
+
*/
|
|
698
|
+
seatsPrices?: ISeatPriceScheme[];
|
|
699
|
+
/**
|
|
700
|
+
* Theme settings for the renderer.
|
|
701
|
+
*/
|
|
702
|
+
theme?: IRendererTheme;
|
|
703
|
+
/**
|
|
704
|
+
* Delay in milliseconds for debounced events.
|
|
705
|
+
*/
|
|
706
|
+
debounceDelay?: number;
|
|
707
|
+
/**
|
|
708
|
+
* Number of seats to select as a group.
|
|
709
|
+
*/
|
|
710
|
+
groupSize?: number;
|
|
711
|
+
/**
|
|
712
|
+
* Fixed height for the renderer in pixels.
|
|
713
|
+
*/
|
|
714
|
+
height?: number;
|
|
715
|
+
/**
|
|
716
|
+
* Initial padding around the venue when first loaded.
|
|
717
|
+
*/
|
|
718
|
+
initialPadding?: number;
|
|
719
|
+
/**
|
|
720
|
+
* Padding around the venue during normal operation.
|
|
721
|
+
*/
|
|
722
|
+
padding?: number;
|
|
723
|
+
/**
|
|
724
|
+
* Minimum zoom level required to enable seat selection.
|
|
725
|
+
*/
|
|
726
|
+
seatSelectionMinZoom?: number;
|
|
727
|
+
/**
|
|
728
|
+
* Maximum number of seats that can be selected.
|
|
729
|
+
*/
|
|
730
|
+
selectionLimit?: number;
|
|
731
|
+
/**
|
|
732
|
+
* Duration of transform animations in milliseconds.
|
|
733
|
+
*/
|
|
734
|
+
transformAnimationDuration?: number;
|
|
735
|
+
/**
|
|
736
|
+
* Duration of zoom animations in milliseconds.
|
|
737
|
+
*/
|
|
738
|
+
zoomAnimationDuration?: number;
|
|
739
|
+
/**
|
|
740
|
+
* Delay time for loading the next background in milliseconds.
|
|
741
|
+
*/
|
|
742
|
+
backgroundLoadStepTime?: number;
|
|
743
|
+
/**
|
|
744
|
+
* If true, disables zoom when clicking on empty space.
|
|
745
|
+
*/
|
|
746
|
+
disableZoomToEmptySpace?: boolean;
|
|
747
|
+
/**
|
|
748
|
+
* If true, hides all seats from view.
|
|
749
|
+
*/
|
|
750
|
+
hideSeats?: boolean;
|
|
751
|
+
/**
|
|
752
|
+
* If true, shows the outline layer during animations.
|
|
753
|
+
*/
|
|
754
|
+
showOutlineLayerOnAnimation?: boolean;
|
|
755
|
+
/**
|
|
756
|
+
* If true, shows row labels.
|
|
757
|
+
*/
|
|
758
|
+
showRows?: boolean;
|
|
759
|
+
/**
|
|
760
|
+
* If true, shows outlines for unavailable seats.
|
|
761
|
+
*/
|
|
762
|
+
showUnavailableOutlines?: boolean;
|
|
763
|
+
/**
|
|
764
|
+
* If true, uses WebGL for rendering instead of Canvas.
|
|
765
|
+
*/
|
|
766
|
+
switchToWebGL?: boolean;
|
|
767
|
+
/**
|
|
768
|
+
* Rises when the mouse pointer moves above a seat.
|
|
769
|
+
*
|
|
770
|
+
* @remarks
|
|
771
|
+
*
|
|
772
|
+
* Seat is passed as a param to the handler (see IExtendedSeat).
|
|
773
|
+
*/
|
|
774
|
+
onSeatMouseEnter?: (seat: IExtendedSeat) => void;
|
|
775
|
+
/**
|
|
776
|
+
* Same as `onSeatMouseEnter` but with debounce.
|
|
777
|
+
*
|
|
778
|
+
* @remarks
|
|
779
|
+
*
|
|
780
|
+
* Seat is passed as a param to the handler (see IExtendedSeat).
|
|
781
|
+
*/
|
|
782
|
+
onSeatDebouncedEnter?: (seat: IExtendedSeat) => void;
|
|
783
|
+
/**
|
|
784
|
+
* Fires when the mouse pointer leaves a seat.
|
|
785
|
+
*/
|
|
786
|
+
onSeatMouseLeave?: () => void;
|
|
787
|
+
/**
|
|
788
|
+
* Fires when the user marks a seat as selected.
|
|
789
|
+
*
|
|
790
|
+
* @remarks
|
|
791
|
+
*
|
|
792
|
+
* Seat is passed as a param to the handler (see IExtendedSeat).
|
|
793
|
+
*
|
|
794
|
+
* To cancel seat selection you can return `false` or Promise resolving to `false`.
|
|
795
|
+
*/
|
|
796
|
+
onSeatSelect?: (seat: IExtendedSeat) => void | boolean | Promise<void | boolean>;
|
|
797
|
+
/**
|
|
798
|
+
* Fires when the user deselects a seat.
|
|
799
|
+
*
|
|
800
|
+
* @remarks
|
|
801
|
+
*
|
|
802
|
+
* Seat is passed as a param to the handler (see IExtendedSeat).
|
|
803
|
+
*
|
|
804
|
+
* To cancel seat deselection you can return `false` or Promise resolving to `false`.
|
|
805
|
+
*/
|
|
806
|
+
onSeatDeselect?: (seat: IExtendedSeat) => void | boolean | Promise<void | boolean>;
|
|
807
|
+
/**
|
|
808
|
+
* Fires when the user marks a seat or seats as selected.
|
|
809
|
+
*
|
|
810
|
+
* @remarks
|
|
811
|
+
*
|
|
812
|
+
* Seats are passed as a param to the handler (see ISeat).
|
|
813
|
+
*
|
|
814
|
+
*/
|
|
815
|
+
onSeatsSelect?: (seats: ISeat[]) => void;
|
|
816
|
+
/**
|
|
817
|
+
* Fires when the user deselects a seat or seats.
|
|
818
|
+
*
|
|
819
|
+
* @remarks
|
|
820
|
+
*
|
|
821
|
+
* Seats are passed as a param to the handler (see ISeat).
|
|
822
|
+
*
|
|
823
|
+
*/
|
|
824
|
+
onSeatsDeselect?: (seats: ISeat[]) => void;
|
|
825
|
+
/**
|
|
826
|
+
* Fires when the cart was modified.
|
|
827
|
+
*
|
|
828
|
+
* @remarks
|
|
829
|
+
*
|
|
830
|
+
* Cart state is passed as a param to the handler (see ICart).
|
|
831
|
+
*/
|
|
832
|
+
onCartChange?: (cart: ICart, prevCart?: ICart) => void;
|
|
833
|
+
/**
|
|
834
|
+
* Fires when the mouse pointer moves above a section.
|
|
835
|
+
*
|
|
836
|
+
* @remarks
|
|
837
|
+
*
|
|
838
|
+
* Section is passed as a param to the handler (see ISection).
|
|
839
|
+
*/
|
|
840
|
+
onSectorMouseEnter?: (section: ISection) => void;
|
|
841
|
+
/**
|
|
842
|
+
* Fires when the mouse pointer leaves a section.
|
|
843
|
+
*/
|
|
844
|
+
onSectorMouseLeave?: () => void;
|
|
845
|
+
/**
|
|
846
|
+
* Fires when the user clicks on a section.
|
|
847
|
+
*
|
|
848
|
+
* @deprecated
|
|
849
|
+
* Use onSectionClick instead
|
|
850
|
+
*/
|
|
851
|
+
onSectorClick?: (section: ISection) => void;
|
|
852
|
+
/**
|
|
853
|
+
* Fires when the user clicks on a section.
|
|
854
|
+
*
|
|
855
|
+
* @remarks
|
|
856
|
+
*
|
|
857
|
+
* Section is passed as a param to the handler (see ISection).
|
|
858
|
+
*/
|
|
859
|
+
onSectionClick?: (section: ISection) => void;
|
|
860
|
+
/**
|
|
861
|
+
* Fires before the zoom animation started.
|
|
862
|
+
*/
|
|
863
|
+
onZoomStart?: (newZoom: number, oldZoom: number) => void;
|
|
864
|
+
/**
|
|
865
|
+
* Fires after the zoom animation ended.
|
|
866
|
+
*/
|
|
867
|
+
onZoomEnd?: (newZoom: number, oldZoom?: number) => void;
|
|
868
|
+
/**
|
|
869
|
+
* Fires when component full redrawing starts.
|
|
870
|
+
*/
|
|
871
|
+
onRedrawStart?: () => void;
|
|
872
|
+
/**
|
|
873
|
+
* Fires when component full redrawing ends.
|
|
874
|
+
*/
|
|
875
|
+
onRedrawEnd?: () => void;
|
|
876
|
+
/**
|
|
877
|
+
* Fires while panning.
|
|
878
|
+
*/
|
|
879
|
+
onPan?: (delta: IPoint, isFinish?: boolean) => void;
|
|
880
|
+
/**
|
|
881
|
+
* Fires after seat selection was updated.
|
|
882
|
+
*/
|
|
883
|
+
onSeatSelectionChange?: () => void;
|
|
884
|
+
/**
|
|
885
|
+
* Fires after seats selection was updated.
|
|
886
|
+
*/
|
|
887
|
+
onSeatsSelectionChange?: (seats: ISeat[]) => void;
|
|
888
|
+
/**
|
|
889
|
+
* You can control seats' styling by returning custom style for each seat
|
|
890
|
+
*/
|
|
891
|
+
onBeforeSeatDraw?: (event: IBeforeSeatDrawEvent) => ISeatStyle;
|
|
892
|
+
lockedSeatsFilter?: (seat: ISeat) => boolean;
|
|
893
|
+
}
|
|
894
|
+
/**
|
|
895
|
+
* Represents the possible interaction states of a seat.
|
|
896
|
+
* Used to determine how a seat should be rendered based on user interaction.
|
|
897
|
+
*/
|
|
898
|
+
type SeatInteractionState = 'default' | 'hovered' | 'selected';
|
|
899
|
+
/**
|
|
900
|
+
* Interface for the event data passed to the onBeforeSeatDraw callback.
|
|
901
|
+
* Contains information about the seat being drawn and its current state.
|
|
902
|
+
*/
|
|
903
|
+
interface IBeforeSeatDrawEvent {
|
|
904
|
+
/**
|
|
905
|
+
* The seat being drawn.
|
|
906
|
+
*/
|
|
907
|
+
seat: ISeat;
|
|
908
|
+
/**
|
|
909
|
+
* The current interaction state of the seat.
|
|
910
|
+
*/
|
|
911
|
+
state: SeatInteractionState;
|
|
912
|
+
/**
|
|
913
|
+
* The default style that will be applied to the seat.
|
|
914
|
+
*/
|
|
915
|
+
style: ISeatStyle;
|
|
916
|
+
/**
|
|
917
|
+
* The rendering context.
|
|
918
|
+
*/
|
|
919
|
+
context: Context;
|
|
920
|
+
}
|
|
921
|
+
interface IRendererSeatStyleSettings {
|
|
922
|
+
default?: ISeatStyle;
|
|
923
|
+
unavailable?: ISeatStyle;
|
|
924
|
+
filtered?: ISeatStyle;
|
|
925
|
+
hovered?: ISeatStyle;
|
|
926
|
+
selected?: ISeatStyle;
|
|
927
|
+
}
|
|
928
|
+
interface ISeatStyle {
|
|
929
|
+
size: number;
|
|
930
|
+
color: string;
|
|
931
|
+
seatName?: {
|
|
932
|
+
font: string;
|
|
933
|
+
color: string;
|
|
934
|
+
};
|
|
935
|
+
stroke?: {
|
|
936
|
+
width: number;
|
|
937
|
+
color: string;
|
|
938
|
+
align: 'center' | 'inside' | 'outside';
|
|
939
|
+
};
|
|
940
|
+
imageId?: string;
|
|
941
|
+
shadow?: {
|
|
942
|
+
blur: number;
|
|
943
|
+
color: string;
|
|
944
|
+
x?: number;
|
|
945
|
+
y?: number;
|
|
946
|
+
};
|
|
947
|
+
accessible?: ISeatStyle;
|
|
948
|
+
}
|
|
949
|
+
interface IRendererSvgSectionStylesSetting {
|
|
950
|
+
default?: Pick<ISvgSectionStyle, 'sectionName' | 'stroke' | 'cursor'>;
|
|
951
|
+
unavailable?: ISvgSectionStyle;
|
|
952
|
+
filtered?: ISvgSectionStyle;
|
|
953
|
+
hovered?: ISvgSectionStyle;
|
|
954
|
+
selected?: ISvgSectionStyle;
|
|
955
|
+
}
|
|
956
|
+
interface ISvgSectionStyle {
|
|
957
|
+
sectionName?: {
|
|
958
|
+
color?: string;
|
|
959
|
+
};
|
|
960
|
+
bgColor?: string;
|
|
961
|
+
stroke?: {
|
|
962
|
+
color?: string;
|
|
963
|
+
opacity?: number;
|
|
964
|
+
};
|
|
965
|
+
cursor?: string;
|
|
966
|
+
}
|
|
967
|
+
interface IRendererTheme {
|
|
968
|
+
gridStep?: number;
|
|
969
|
+
bgColor?: string;
|
|
970
|
+
priceColors?: string[][];
|
|
971
|
+
colorCategories?: string[];
|
|
972
|
+
images?: {
|
|
973
|
+
[id: string]: string;
|
|
974
|
+
};
|
|
975
|
+
seatStyles?: IRendererSeatStyleSettings;
|
|
976
|
+
svgSectionStyles?: IRendererSvgSectionStylesSetting;
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
/**
|
|
980
|
+
* Base interface for seat properties.
|
|
981
|
+
*/
|
|
982
|
+
interface IBaseSeat {
|
|
983
|
+
/**
|
|
984
|
+
* The unique identifier of the seat.
|
|
985
|
+
*/
|
|
986
|
+
id: number;
|
|
987
|
+
/**
|
|
988
|
+
* The ID of the row this seat belongs to.
|
|
989
|
+
*/
|
|
990
|
+
rowId: number;
|
|
991
|
+
/**
|
|
992
|
+
* The ID of the sector this seat belongs to.
|
|
993
|
+
*/
|
|
994
|
+
sectorId: number;
|
|
995
|
+
/**
|
|
996
|
+
* The X coordinate of the seat within its section.
|
|
997
|
+
*/
|
|
998
|
+
x: number;
|
|
999
|
+
/**
|
|
1000
|
+
* The Y coordinate of the seat within its section.
|
|
1001
|
+
*/
|
|
1002
|
+
y: number;
|
|
1003
|
+
/**
|
|
1004
|
+
* The name or number of the seat.
|
|
1005
|
+
*/
|
|
1006
|
+
name: string;
|
|
1007
|
+
/**
|
|
1008
|
+
* Whether the seat is accessible for people with disabilities.
|
|
1009
|
+
*/
|
|
1010
|
+
isAccessible?: boolean;
|
|
1011
|
+
/**
|
|
1012
|
+
* Whether the seat is marked with a special status.
|
|
1013
|
+
*/
|
|
1014
|
+
isMarked?: boolean;
|
|
1015
|
+
}
|
|
1016
|
+
/**
|
|
1017
|
+
* Base interface for sector properties.
|
|
1018
|
+
*/
|
|
1019
|
+
interface IBaseSector {
|
|
1020
|
+
/**
|
|
1021
|
+
* The unique identifier of the sector.
|
|
1022
|
+
*/
|
|
1023
|
+
id: number;
|
|
1024
|
+
/**
|
|
1025
|
+
* The globally unique identifier for the sector.
|
|
1026
|
+
*/
|
|
1027
|
+
guid?: string;
|
|
1028
|
+
/**
|
|
1029
|
+
* Whether this is a general admission (GA) sector.
|
|
1030
|
+
*/
|
|
1031
|
+
isGa: boolean;
|
|
1032
|
+
/**
|
|
1033
|
+
* The name of the sector.
|
|
1034
|
+
*/
|
|
1035
|
+
name: string;
|
|
1036
|
+
/**
|
|
1037
|
+
* The rotation angle of the sector in degrees.
|
|
1038
|
+
*/
|
|
1039
|
+
angle?: number | null;
|
|
1040
|
+
/**
|
|
1041
|
+
* The type of the sector.
|
|
1042
|
+
*/
|
|
1043
|
+
type?: string | null;
|
|
1044
|
+
/**
|
|
1045
|
+
* Whether the sector is disabled and cannot be interacted with.
|
|
1046
|
+
*/
|
|
1047
|
+
disabled?: boolean;
|
|
1048
|
+
/**
|
|
1049
|
+
* Whether the sector is filtered out by current filter criteria.
|
|
1050
|
+
*/
|
|
1051
|
+
filtered?: boolean;
|
|
1052
|
+
/**
|
|
1053
|
+
* Whether the sector is currently selected.
|
|
1054
|
+
*/
|
|
1055
|
+
selected?: boolean;
|
|
1056
|
+
}
|
|
1057
|
+
/**
|
|
1058
|
+
* Interface representing the schema data transfer object from the API.
|
|
1059
|
+
* @hidden
|
|
1060
|
+
*/
|
|
1061
|
+
interface ISchemaDTO {
|
|
1062
|
+
plainSeats?: IPlainSeatsDTO;
|
|
1063
|
+
seats: ISeatDTO[];
|
|
1064
|
+
rows: IRowDTO[];
|
|
1065
|
+
sectors: ISectorDTO[];
|
|
1066
|
+
background: ISVGBackgroundDTO;
|
|
1067
|
+
requestTime?: number;
|
|
1068
|
+
responseSize?: number;
|
|
1069
|
+
configuration?: IConfigurationDTO;
|
|
1070
|
+
}
|
|
1071
|
+
/**
|
|
1072
|
+
* Interface representing the venue data transfer object from the API.
|
|
1073
|
+
* @hidden
|
|
1074
|
+
*/
|
|
1075
|
+
interface IVenueDTO {
|
|
1076
|
+
guid: string;
|
|
1077
|
+
name: string;
|
|
1078
|
+
gaCapacity?: number;
|
|
1079
|
+
seatsCapacity?: number;
|
|
1080
|
+
seatmap: ISchemaDTO;
|
|
1081
|
+
schema: ISchemaDTO;
|
|
1082
|
+
}
|
|
1083
|
+
/**
|
|
1084
|
+
* Interface representing the plain seats data transfer object from the API.
|
|
1085
|
+
* @hidden
|
|
1086
|
+
*/
|
|
1087
|
+
interface IPlainSeatsDTO {
|
|
1088
|
+
ids: number[];
|
|
1089
|
+
x: number[];
|
|
1090
|
+
y: number[];
|
|
1091
|
+
rowIds: [];
|
|
1092
|
+
sectorIds: [];
|
|
1093
|
+
names: string[];
|
|
1094
|
+
}
|
|
1095
|
+
/**
|
|
1096
|
+
* Interface representing the base seat data transfer object from the API.
|
|
1097
|
+
* Contains the core properties of a seat as received from the backend.
|
|
1098
|
+
* @hidden
|
|
1099
|
+
*/
|
|
1100
|
+
interface ISeatDTO extends IBaseSeat {
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* Interface representing a row in the venue.
|
|
1104
|
+
* @hidden
|
|
1105
|
+
*/
|
|
1106
|
+
interface IRowDTO {
|
|
1107
|
+
id: number;
|
|
1108
|
+
rowNumber: number;
|
|
1109
|
+
sectorId: number;
|
|
1110
|
+
name: string;
|
|
1111
|
+
seatName: string;
|
|
1112
|
+
}
|
|
1113
|
+
/**
|
|
1114
|
+
* Interface representing the base sector data transfer object from the API.
|
|
1115
|
+
* Contains the core properties of a sector as received from the backend.
|
|
1116
|
+
* @hidden
|
|
1117
|
+
*/
|
|
1118
|
+
interface ISectorDTO extends IBaseSector {
|
|
1119
|
+
}
|
|
1120
|
+
/**
|
|
1121
|
+
* Interface representing the SVG background data transfer object from the API.
|
|
1122
|
+
* @hidden
|
|
1123
|
+
*/
|
|
1124
|
+
interface ISVGBackgroundDTO {
|
|
1125
|
+
svg: string;
|
|
1126
|
+
viewBox: {
|
|
1127
|
+
x: number;
|
|
1128
|
+
y: number;
|
|
1129
|
+
width: number;
|
|
1130
|
+
height: number;
|
|
1131
|
+
};
|
|
1132
|
+
svgLink?: string;
|
|
1133
|
+
images?: IPngBackgroundDTO;
|
|
1134
|
+
}
|
|
1135
|
+
/**
|
|
1136
|
+
* Interface representing the configuration data transfer object from the API.
|
|
1137
|
+
* @hidden
|
|
1138
|
+
*/
|
|
1139
|
+
interface IConfigurationDTO {
|
|
1140
|
+
accessible: number[];
|
|
1141
|
+
marked: number[];
|
|
1142
|
+
eventName?: string;
|
|
1143
|
+
}
|
|
1144
|
+
/**
|
|
1145
|
+
* Interface representing a special price option for seats, sections, or sectors.
|
|
1146
|
+
* Contains information about a named price point with its identifier.
|
|
1147
|
+
*/
|
|
1148
|
+
interface ISpecialPrice {
|
|
1149
|
+
/**
|
|
1150
|
+
* The name or label of the special price option.
|
|
1151
|
+
*/
|
|
1152
|
+
name: string;
|
|
1153
|
+
/**
|
|
1154
|
+
* The unique identifier for this price option.
|
|
1155
|
+
*/
|
|
1156
|
+
priceId: number;
|
|
1157
|
+
}
|
|
1158
|
+
/**
|
|
1159
|
+
* Interface representing special state information for seats, sections, or sectors.
|
|
1160
|
+
* Contains additional properties that affect rendering or behavior.
|
|
1161
|
+
*/
|
|
1162
|
+
interface ISpecialState {
|
|
1163
|
+
/**
|
|
1164
|
+
* Special state flag 1, used for custom state indicators.
|
|
1165
|
+
*/
|
|
1166
|
+
s1?: number;
|
|
1167
|
+
/**
|
|
1168
|
+
* Array of special prices associated with this item.
|
|
1169
|
+
*/
|
|
1170
|
+
prices?: ISpecialPrice[];
|
|
1171
|
+
/**
|
|
1172
|
+
* Category identifier for grouping items with similar special states.
|
|
1173
|
+
*/
|
|
1174
|
+
category?: number;
|
|
1175
|
+
}
|
|
1176
|
+
/**
|
|
1177
|
+
* Interface representing a price list data transfer object from the API.
|
|
1178
|
+
* @hidden
|
|
1179
|
+
*/
|
|
1180
|
+
interface IPriceListDTO {
|
|
1181
|
+
seats: [number, IPriceId, ISpecialState?][];
|
|
1182
|
+
groupOfSeats: [number, number, number, ISpecialState?][];
|
|
1183
|
+
prices: IPriceDTO[];
|
|
1184
|
+
requestTime?: number;
|
|
1185
|
+
responseSize?: number;
|
|
1186
|
+
}
|
|
1187
|
+
/**
|
|
1188
|
+
* Interface representing a price data transfer object from the API.
|
|
1189
|
+
* @hidden
|
|
1190
|
+
*/
|
|
1191
|
+
interface IPriceDTO {
|
|
1192
|
+
id: IPriceId;
|
|
1193
|
+
name: string;
|
|
1194
|
+
}
|
|
1195
|
+
/**
|
|
1196
|
+
* Type representing blurred image data.
|
|
1197
|
+
* @hidden
|
|
1198
|
+
*/
|
|
1199
|
+
type IBlurred = {
|
|
1200
|
+
data: string;
|
|
1201
|
+
shrink_factor: number;
|
|
1202
|
+
size: number;
|
|
1203
|
+
status: string;
|
|
1204
|
+
};
|
|
1205
|
+
/**
|
|
1206
|
+
* Type representing a PNG image loaded from a URL.
|
|
1207
|
+
* @hidden
|
|
1208
|
+
*/
|
|
1209
|
+
type IPngFromUrl = {
|
|
1210
|
+
height: number;
|
|
1211
|
+
size: number;
|
|
1212
|
+
width: number;
|
|
1213
|
+
path: string;
|
|
1214
|
+
status: string;
|
|
1215
|
+
};
|
|
1216
|
+
/**
|
|
1217
|
+
* Interface representing PNG background images in different resolutions.
|
|
1218
|
+
* @hidden
|
|
1219
|
+
*/
|
|
1220
|
+
interface IPngBackgroundDTO {
|
|
1221
|
+
blurred: IBlurred;
|
|
1222
|
+
preview: IPngFromUrl;
|
|
1223
|
+
full: IPngFromUrl;
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
/**
|
|
1227
|
+
* Settings for the BookingApiClient.
|
|
1228
|
+
* @hidden
|
|
1229
|
+
*/
|
|
1230
|
+
interface IBookingApiClientSettings {
|
|
1231
|
+
baseUrl: string;
|
|
1232
|
+
publicKey: string;
|
|
1233
|
+
}
|
|
1234
|
+
/**
|
|
1235
|
+
* Metrics for API requests.
|
|
1236
|
+
* @hidden
|
|
1237
|
+
*/
|
|
1238
|
+
interface RequestMetrics {
|
|
1239
|
+
data?: string;
|
|
1240
|
+
requestTime: number;
|
|
1241
|
+
responseSize: number;
|
|
1242
|
+
}
|
|
1243
|
+
/**
|
|
1244
|
+
* API client for fetching schema and price data from the booking API.
|
|
1245
|
+
* @hidden
|
|
1246
|
+
*/
|
|
1247
|
+
declare class BookingApiClient {
|
|
1248
|
+
private settings;
|
|
1249
|
+
constructor(settings: IBookingApiClientSettings);
|
|
1250
|
+
/**
|
|
1251
|
+
* Returns schema data
|
|
1252
|
+
* @param schemaId Schema ID
|
|
1253
|
+
*/
|
|
1254
|
+
fetchSchema(schemaId: number): Promise<ISchemaDTO>;
|
|
1255
|
+
/**
|
|
1256
|
+
* Returns schema data
|
|
1257
|
+
* @param venueId Venue GUID
|
|
1258
|
+
*/
|
|
1259
|
+
fetchSchemaForVenue(venueId: string): Promise<Omit<IVenueDTO, 'seatmap'>>;
|
|
1260
|
+
/**
|
|
1261
|
+
* Returns schema data
|
|
1262
|
+
* @param eventId Event GUID
|
|
1263
|
+
*/
|
|
1264
|
+
fetchSchemaForEvent(eventId: string): Promise<ISchemaDTO>;
|
|
1265
|
+
private unpackSchemaDTO;
|
|
1266
|
+
/**
|
|
1267
|
+
* Return prices information
|
|
1268
|
+
* @param eventId Event GUID
|
|
1269
|
+
*/
|
|
1270
|
+
fetchPricesForEvent(eventId: string): Promise<IPriceListDTO>;
|
|
1271
|
+
/**
|
|
1272
|
+
* Return rows SVG information
|
|
1273
|
+
* @param eventId Event GUID
|
|
1274
|
+
*/
|
|
1275
|
+
fetchRowsSvgForEvent(eventId: string): Promise<RequestMetrics>;
|
|
1276
|
+
/**
|
|
1277
|
+
* Makes request to booking API
|
|
1278
|
+
* @param url Relative API endpoint URL, e.g. 'event/prices/?id=XXX'
|
|
1279
|
+
*/
|
|
1280
|
+
request<T>(url: string): Promise<T>;
|
|
1281
|
+
/**
|
|
1282
|
+
* Makes request to booking API
|
|
1283
|
+
* @param url Relative API endpoint URL, e.g. 'event/prices/?id=XXX'
|
|
1284
|
+
*/
|
|
1285
|
+
requestPlain<T extends RequestMetrics>(url: string): Promise<any>;
|
|
1286
|
+
private restoreSeats;
|
|
1287
|
+
private restoreIds;
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
/**
|
|
1291
|
+
* @hidden
|
|
1292
|
+
*/
|
|
1293
|
+
interface IOutlineRect {
|
|
1294
|
+
sectionId: number;
|
|
1295
|
+
x: number;
|
|
1296
|
+
y: number;
|
|
1297
|
+
width: number;
|
|
1298
|
+
height: number;
|
|
1299
|
+
transform?: string;
|
|
1300
|
+
}
|
|
1301
|
+
/**
|
|
1302
|
+
* @hidden
|
|
1303
|
+
*/
|
|
1304
|
+
declare class OutlineLayer {
|
|
1305
|
+
svgElement: SVGSVGElement;
|
|
1306
|
+
private outlineShapes;
|
|
1307
|
+
private context;
|
|
1308
|
+
constructor(context: Context);
|
|
1309
|
+
destroy(): void;
|
|
1310
|
+
setSectionSelection(id: number | undefined): void;
|
|
1311
|
+
highlightGa(id: number | undefined): void;
|
|
1312
|
+
clearSectionHighlight(): void;
|
|
1313
|
+
highlightSection(id: number | undefined): void;
|
|
1314
|
+
get width(): number;
|
|
1315
|
+
get height(): number;
|
|
1316
|
+
updateSize(): void;
|
|
1317
|
+
checkBackgroundOutlines(): boolean;
|
|
1318
|
+
setBackgroundAsOutline(): void;
|
|
1319
|
+
cleanSvgInlineStyles(stylesToRemove?: string[]): void;
|
|
1320
|
+
updateOutlines(): void;
|
|
1321
|
+
createOutlineRect(section: ISector): SVGRectElement;
|
|
1322
|
+
calcOutlineRect(section: ISector): IOutlineRect;
|
|
1323
|
+
handleChangeEagleView(): void;
|
|
1324
|
+
createGaInfo: (gaGroups: SVGGElement[]) => IGaInfo[];
|
|
1325
|
+
disableSvgSectionById: (id: number) => void;
|
|
1326
|
+
enableSvgSectionById: (id: number) => void;
|
|
1327
|
+
filterSvgSectionById: (id: number) => void;
|
|
1328
|
+
removeFilterSvgSectionById: (id: number) => void;
|
|
1329
|
+
update(): void;
|
|
1330
|
+
updateAnimationStep(scale: number, translate: IPoint): void;
|
|
1331
|
+
hide(): void;
|
|
1332
|
+
show(): void;
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
/**
|
|
1336
|
+
* Interface for the base Renderer functionality.
|
|
1337
|
+
* Defines the core methods and properties that all renderer implementations must provide.
|
|
1338
|
+
*/
|
|
1339
|
+
interface IRenderer {
|
|
1340
|
+
/**
|
|
1341
|
+
* Initializes the cart with the provided cart data.
|
|
1342
|
+
*
|
|
1343
|
+
* @param cart - The cart data to initialize
|
|
1344
|
+
*/
|
|
1345
|
+
initCart: (cart: ICart) => void;
|
|
1346
|
+
/**
|
|
1347
|
+
* Gets the current cart state.
|
|
1348
|
+
*
|
|
1349
|
+
* @returns The current cart
|
|
1350
|
+
*/
|
|
1351
|
+
getCart: () => ICart;
|
|
1352
|
+
/**
|
|
1353
|
+
* Clears all items from the cart.
|
|
1354
|
+
*/
|
|
1355
|
+
clearCart: () => void;
|
|
1356
|
+
/**
|
|
1357
|
+
* Adds a general admission ticket to the cart.
|
|
1358
|
+
*
|
|
1359
|
+
* @param ga - The general admission ticket to add
|
|
1360
|
+
*/
|
|
1361
|
+
addGaToCart: (ga: ICartGa) => void;
|
|
1362
|
+
/**
|
|
1363
|
+
* Removes a general admission ticket from the cart.
|
|
1364
|
+
*
|
|
1365
|
+
* @param removedGa - Information about the GA ticket to remove
|
|
1366
|
+
*/
|
|
1367
|
+
removeGaFromCart: (removedGa: IRemovedCartGa) => void;
|
|
1368
|
+
/**
|
|
1369
|
+
* Adds seats to the cart.
|
|
1370
|
+
*
|
|
1371
|
+
* @param seats - The seats to add to the cart
|
|
1372
|
+
*/
|
|
1373
|
+
addSeatsToCart: (seats: ICartSeat[]) => void;
|
|
1374
|
+
/**
|
|
1375
|
+
* Removes seats from the cart by their IDs.
|
|
1376
|
+
*
|
|
1377
|
+
* @param seatIds - The IDs of the seats to remove
|
|
1378
|
+
*/
|
|
1379
|
+
removeSeatsFromCartByIds: (seatIds: number[]) => void;
|
|
1380
|
+
/**
|
|
1381
|
+
* Disables seats by their IDs, making them unavailable for selection.
|
|
1382
|
+
*
|
|
1383
|
+
* @param seatIds - The IDs of the seats to disable
|
|
1384
|
+
*/
|
|
1385
|
+
disableSeatsByIds: (seatIds: number[]) => void;
|
|
1386
|
+
/**
|
|
1387
|
+
* Disables seats by their keys, making them unavailable for selection.
|
|
1388
|
+
*
|
|
1389
|
+
* @param keys - The keys of the seats to disable
|
|
1390
|
+
*/
|
|
1391
|
+
disableSeatsByKeys: (keys: string[]) => void;
|
|
1392
|
+
/**
|
|
1393
|
+
* Updates the lock status of seats based on the provided filter.
|
|
1394
|
+
*
|
|
1395
|
+
* @param filter - The filter function to determine which seats to lock
|
|
1396
|
+
*/
|
|
1397
|
+
updateSeatLocks: (filter: SeatFilter) => void;
|
|
1398
|
+
/**
|
|
1399
|
+
* Converts seat keys to seat IDs.
|
|
1400
|
+
*
|
|
1401
|
+
* @param keys - The seat keys to convert
|
|
1402
|
+
* @returns The corresponding seat IDs
|
|
1403
|
+
*/
|
|
1404
|
+
seatKeysToIds: (keys: string[]) => number[];
|
|
1405
|
+
/**
|
|
1406
|
+
* Sets the group size for group selection.
|
|
1407
|
+
*
|
|
1408
|
+
* @param groupSize - The size of the group
|
|
1409
|
+
*/
|
|
1410
|
+
setGroupSize: (groupSize: number) => void;
|
|
1411
|
+
/**
|
|
1412
|
+
* Gets the IDs of all marked seats.
|
|
1413
|
+
*
|
|
1414
|
+
* @returns The IDs of marked seats
|
|
1415
|
+
*/
|
|
1416
|
+
getMarkedSeatsIds: () => number[];
|
|
1417
|
+
/**
|
|
1418
|
+
* Gets all available prices.
|
|
1419
|
+
*
|
|
1420
|
+
* @returns The available prices with color information
|
|
1421
|
+
*/
|
|
1422
|
+
getPrices: () => IColoredPrice[];
|
|
1423
|
+
/**
|
|
1424
|
+
* Gets all seats in the venue.
|
|
1425
|
+
*
|
|
1426
|
+
* @returns All seats in the venue
|
|
1427
|
+
*/
|
|
1428
|
+
getSeats: () => ISeatDTO[];
|
|
1429
|
+
/**
|
|
1430
|
+
* Gets the current zoom level.
|
|
1431
|
+
*
|
|
1432
|
+
* @returns The current zoom level
|
|
1433
|
+
*/
|
|
1434
|
+
getZoom: () => number;
|
|
1435
|
+
/**
|
|
1436
|
+
* Gets the maximum allowed zoom level.
|
|
1437
|
+
*
|
|
1438
|
+
* @returns The maximum zoom level
|
|
1439
|
+
*/
|
|
1440
|
+
getMaxZoom: () => number;
|
|
1441
|
+
/**
|
|
1442
|
+
* Gets the minimum allowed zoom level.
|
|
1443
|
+
*
|
|
1444
|
+
* @returns The minimum zoom level
|
|
1445
|
+
*/
|
|
1446
|
+
getMinZoom: () => number;
|
|
1447
|
+
/**
|
|
1448
|
+
* Increases the zoom level by one step.
|
|
1449
|
+
*/
|
|
1450
|
+
zoomIn: () => void;
|
|
1451
|
+
/**
|
|
1452
|
+
* Decreases the zoom level by one step.
|
|
1453
|
+
*/
|
|
1454
|
+
zoomOut: () => void;
|
|
1455
|
+
/**
|
|
1456
|
+
* Adjusts the zoom level to fit the entire venue in the viewport.
|
|
1457
|
+
*/
|
|
1458
|
+
zoomToFit: () => void;
|
|
1459
|
+
/**
|
|
1460
|
+
* Sets external price information for seats.
|
|
1461
|
+
*
|
|
1462
|
+
* @param seatsPrices - Optional external price information for seats
|
|
1463
|
+
*/
|
|
1464
|
+
setExternalPrices: (seatsPrices?: ISeatPriceScheme[]) => void;
|
|
1465
|
+
/**
|
|
1466
|
+
* Destroys the renderer instance, cleaning up all resources.
|
|
1467
|
+
*/
|
|
1468
|
+
destroy: () => void;
|
|
1469
|
+
/**
|
|
1470
|
+
* Disables SVG sections by their IDs.
|
|
1471
|
+
*
|
|
1472
|
+
* @param sectionIds - The IDs of the sections to disable
|
|
1473
|
+
* @param options - Optional configuration
|
|
1474
|
+
* @param options.resetAll - Whether to reset all sections before disabling
|
|
1475
|
+
*/
|
|
1476
|
+
disableSvgSectionsByIds: (sectionIds: number[], options?: {
|
|
1477
|
+
resetAll?: boolean;
|
|
1478
|
+
}) => void;
|
|
1479
|
+
/**
|
|
1480
|
+
* Enables SVG sections by their IDs.
|
|
1481
|
+
*
|
|
1482
|
+
* @param sectionIds - The IDs of the sections to enable
|
|
1483
|
+
*/
|
|
1484
|
+
enableSvgSectionsByIds: (sectionIds: number[]) => void;
|
|
1485
|
+
/**
|
|
1486
|
+
* Disables SVG sections by their names.
|
|
1487
|
+
*
|
|
1488
|
+
* @param sectionNames - The names of the sections to disable
|
|
1489
|
+
* @param options - Optional configuration
|
|
1490
|
+
* @param options.resetAll - Whether to reset all sections before disabling
|
|
1491
|
+
*/
|
|
1492
|
+
disableSvgSectionsByNames: (sectionNames: string[], options?: {
|
|
1493
|
+
resetAll?: boolean;
|
|
1494
|
+
}) => void;
|
|
1495
|
+
/**
|
|
1496
|
+
* Enables SVG sections by their names.
|
|
1497
|
+
*
|
|
1498
|
+
* @param sectionNames - The names of the sections to enable
|
|
1499
|
+
*/
|
|
1500
|
+
enableSvgSectionsByNames: (sectionNames: string[]) => void;
|
|
1501
|
+
/**
|
|
1502
|
+
* Gets SVG sections by the current selection.
|
|
1503
|
+
*
|
|
1504
|
+
* @returns The selected SVG sections
|
|
1505
|
+
*/
|
|
1506
|
+
getSvgSectionBySelection: () => ISectorDTO[];
|
|
1507
|
+
}
|
|
1508
|
+
interface IZoomSettings {
|
|
1509
|
+
presets: number[];
|
|
1510
|
+
maxZoomToFitScale: number;
|
|
1511
|
+
minPinchZoom: number;
|
|
1512
|
+
maxPinchZoom: number;
|
|
1513
|
+
}
|
|
1514
|
+
/**
|
|
1515
|
+
* Base Renderer class that implements the IRenderer interface.
|
|
1516
|
+
* Provides core functionality for rendering and interacting with a venue map.
|
|
1517
|
+
*/
|
|
1518
|
+
declare class Renderer implements IRenderer {
|
|
1519
|
+
protected zoomSettings: IZoomSettings;
|
|
1520
|
+
private hammer;
|
|
1521
|
+
private height;
|
|
1522
|
+
private width;
|
|
1523
|
+
private padding;
|
|
1524
|
+
protected readonly context: Context;
|
|
1525
|
+
private stageLayer;
|
|
1526
|
+
private selectionLayer;
|
|
1527
|
+
protected outlineLayer: OutlineLayer;
|
|
1528
|
+
private zoomToFitScale;
|
|
1529
|
+
private isTouchMode;
|
|
1530
|
+
private pinchStartPoint?;
|
|
1531
|
+
private animation?;
|
|
1532
|
+
private resizeTimer;
|
|
1533
|
+
private service;
|
|
1534
|
+
protected isRunning: boolean;
|
|
1535
|
+
private disableZoomToEmptySpace;
|
|
1536
|
+
private backgroundLoadStepTime;
|
|
1537
|
+
private switchToWebGL;
|
|
1538
|
+
/**
|
|
1539
|
+
* Creates a new instance of the Renderer.
|
|
1540
|
+
*
|
|
1541
|
+
* @param element - The DOM element where the renderer will be mounted
|
|
1542
|
+
* @param machine - The state machine that controls the renderer behavior
|
|
1543
|
+
* @param settings - Configuration settings for the renderer
|
|
1544
|
+
*/
|
|
1545
|
+
constructor(element: HTMLElement, machine: RendererMachine, settings: IRendererSettings);
|
|
1546
|
+
/**
|
|
1547
|
+
* Destroys the renderer instance, cleaning up all resources.
|
|
1548
|
+
* This includes removing event listeners, canceling animations, and destroying canvas layers.
|
|
1549
|
+
*/
|
|
1550
|
+
destroy(): void;
|
|
1551
|
+
/**
|
|
1552
|
+
* Gets the width of the renderer.
|
|
1553
|
+
*
|
|
1554
|
+
* @returns The width in pixels
|
|
1555
|
+
*/
|
|
1556
|
+
getWidth(): number;
|
|
1557
|
+
/**
|
|
1558
|
+
* Gets the height of the renderer.
|
|
1559
|
+
*
|
|
1560
|
+
* @returns The height in pixels
|
|
1561
|
+
*/
|
|
1562
|
+
getHeight(): number;
|
|
1563
|
+
/**
|
|
1564
|
+
* Sets the interaction mode for the renderer.
|
|
1565
|
+
*
|
|
1566
|
+
* @param mode - The mode to set
|
|
1567
|
+
* @returns Whether the mode was set successfully
|
|
1568
|
+
*/
|
|
1569
|
+
setMode(mode: string): boolean;
|
|
1570
|
+
getMode(): string | undefined;
|
|
1571
|
+
setHeight(height: number): void;
|
|
1572
|
+
setGroupSize(groupSize: number): void;
|
|
1573
|
+
getSeatIds(seats: ISeat[] | number[] | string[]): number[];
|
|
1574
|
+
getMarkedSeatsIds(): number[];
|
|
1575
|
+
setSeatsCategory(seats: ISeat[] | number[] | string[], category: number, color?: string): void;
|
|
1576
|
+
setGaCategory(sectionId: number, category: number | undefined): void;
|
|
1577
|
+
resetCategories(): void;
|
|
1578
|
+
/**
|
|
1579
|
+
* Returns category's color
|
|
1580
|
+
*
|
|
1581
|
+
* @param category Category number
|
|
1582
|
+
*/
|
|
1583
|
+
getCategoryColor(category: number): string | undefined;
|
|
1584
|
+
private createHammer;
|
|
1585
|
+
private changeMachineContext;
|
|
1586
|
+
private createMachineService;
|
|
1587
|
+
private handleTouchStart;
|
|
1588
|
+
private setContextScale;
|
|
1589
|
+
private handleDebouncedSeatChange;
|
|
1590
|
+
/**
|
|
1591
|
+
* Retrieves the available prices.
|
|
1592
|
+
*
|
|
1593
|
+
* @example
|
|
1594
|
+
*
|
|
1595
|
+
* Example of return value:
|
|
1596
|
+
*
|
|
1597
|
+
* ```js
|
|
1598
|
+
* [
|
|
1599
|
+
* { id: 63, name: '100', color: '#9C27B0' },
|
|
1600
|
+
* { id: 64, name: '200', color: '#2196F3' }
|
|
1601
|
+
* ];
|
|
1602
|
+
* ```
|
|
1603
|
+
*
|
|
1604
|
+
* @returns Array of available prices
|
|
1605
|
+
*/
|
|
1606
|
+
getPrices(): IColoredPrice[];
|
|
1607
|
+
/**
|
|
1608
|
+
* Initializes the internal cart state.
|
|
1609
|
+
*
|
|
1610
|
+
* @remarks
|
|
1611
|
+
*
|
|
1612
|
+
* In a case of page reload you should initialize
|
|
1613
|
+
* the saved state with this method.
|
|
1614
|
+
*
|
|
1615
|
+
* Cart initialization is available right after
|
|
1616
|
+
* component initialization.
|
|
1617
|
+
*
|
|
1618
|
+
* Sales page must save the cart state in the given format
|
|
1619
|
+
* to support the page reload feature.
|
|
1620
|
+
*
|
|
1621
|
+
* @example
|
|
1622
|
+
*
|
|
1623
|
+
* ```js
|
|
1624
|
+
* var cart = {
|
|
1625
|
+
* seats: [
|
|
1626
|
+
* {
|
|
1627
|
+
* id: 1389563,
|
|
1628
|
+
* key: 'Section 1;;5;;14',
|
|
1629
|
+
* price: 100
|
|
1630
|
+
* },
|
|
1631
|
+
* { key: 'Table 3;;1;;1', price: 500 },
|
|
1632
|
+
* { key: 'Section 2;;5;;1', price: 200 }
|
|
1633
|
+
* ],
|
|
1634
|
+
* ga: [
|
|
1635
|
+
* {
|
|
1636
|
+
* id: 100500,
|
|
1637
|
+
* key: 'Table 2',
|
|
1638
|
+
* price: 200,
|
|
1639
|
+
* count: 1
|
|
1640
|
+
* },
|
|
1641
|
+
* { key: 'Section 5', price: 100, count: 2 }
|
|
1642
|
+
* ]
|
|
1643
|
+
* };
|
|
1644
|
+
*
|
|
1645
|
+
* renderer.initCart(cart);
|
|
1646
|
+
* ```
|
|
1647
|
+
*
|
|
1648
|
+
* @param cart Cart state
|
|
1649
|
+
*/
|
|
1650
|
+
initCart(cart: ICart): void;
|
|
1651
|
+
/**
|
|
1652
|
+
* Clears the internal cart state.
|
|
1653
|
+
*/
|
|
1654
|
+
clearCart(): void;
|
|
1655
|
+
/**
|
|
1656
|
+
* Retrieves the internal cart state.
|
|
1657
|
+
*
|
|
1658
|
+
* @remarks
|
|
1659
|
+
*
|
|
1660
|
+
* Seatmap.pro doesn't support any session mechanisms.
|
|
1661
|
+
* Cart is always should be stored on the ticketing system side.
|
|
1662
|
+
* For the state management reasons, the Renderer has internal
|
|
1663
|
+
* selected seat representation.
|
|
1664
|
+
*
|
|
1665
|
+
* @example
|
|
1666
|
+
*
|
|
1667
|
+
* Example of cart object:
|
|
1668
|
+
*
|
|
1669
|
+
* ```js
|
|
1670
|
+
* var cart = {
|
|
1671
|
+
* seats: [
|
|
1672
|
+
* { id: 1389563, key: 'Section 1;;5;;14', price: 100 },
|
|
1673
|
+
* { key: 'Table 3;;1;;1', price: 500 },
|
|
1674
|
+
* { key: 'Section 2;;5;;1', price: 200 }
|
|
1675
|
+
* ],
|
|
1676
|
+
* ga: [
|
|
1677
|
+
* {
|
|
1678
|
+
* id: 100500,
|
|
1679
|
+
* key: 'Table 2',
|
|
1680
|
+
* price: 200,
|
|
1681
|
+
* count: 1
|
|
1682
|
+
* },
|
|
1683
|
+
* { key: 'Section 5', price: 100, count: 2 }
|
|
1684
|
+
* ]
|
|
1685
|
+
* };
|
|
1686
|
+
* ```
|
|
1687
|
+
*
|
|
1688
|
+
* @returns Returns selected seats and GA ticket count
|
|
1689
|
+
*/
|
|
1690
|
+
getCart(): ICart;
|
|
1691
|
+
private emitSrcEvent;
|
|
1692
|
+
private addHandlers;
|
|
1693
|
+
protected setSchemaData(schema: ISchemaDTO): Promise<void>;
|
|
1694
|
+
/**
|
|
1695
|
+
* Sets external prices to seats
|
|
1696
|
+
*
|
|
1697
|
+
* * @remarks
|
|
1698
|
+
*
|
|
1699
|
+
* In case you need to use prices from external resources
|
|
1700
|
+
* you should execute this method.
|
|
1701
|
+
* External prices can be passed as an argument or as
|
|
1702
|
+
* a `seatsPrices` property within the settings.
|
|
1703
|
+
*/
|
|
1704
|
+
setExternalPrices(seatsPrices?: ISeatPriceScheme[]): void;
|
|
1705
|
+
protected setPricesData(priceList: IPriceListDTO): void;
|
|
1706
|
+
/**
|
|
1707
|
+
* Adds GA seats to cart programmatically.
|
|
1708
|
+
*
|
|
1709
|
+
* @remarks
|
|
1710
|
+
*
|
|
1711
|
+
* This method can be used when `onSectorClick` was fired
|
|
1712
|
+
* and developer wants to handle custom add GA seats control.
|
|
1713
|
+
* You can add desired quantity of GA tickets to the cart.
|
|
1714
|
+
*
|
|
1715
|
+
* @example
|
|
1716
|
+
*
|
|
1717
|
+
* ```js
|
|
1718
|
+
* renderer.addGaToCart({
|
|
1719
|
+
* id: 100500,
|
|
1720
|
+
* key: 'Table 2',
|
|
1721
|
+
* price: 200,
|
|
1722
|
+
* // quantity of GA tickets
|
|
1723
|
+
* count: 3
|
|
1724
|
+
* });
|
|
1725
|
+
* ```
|
|
1726
|
+
*
|
|
1727
|
+
* @param ga GA cart item
|
|
1728
|
+
*/
|
|
1729
|
+
addGaToCart(ga: ICartGa): void;
|
|
1730
|
+
/**
|
|
1731
|
+
* Removes GA seats from cart programmatically.
|
|
1732
|
+
*
|
|
1733
|
+
* @remarks
|
|
1734
|
+
*
|
|
1735
|
+
* This method can be used when `onSectorClick` was fired
|
|
1736
|
+
* and developer wants to handle custom remove GA seats control.
|
|
1737
|
+
* You can remove GA from cart.
|
|
1738
|
+
*
|
|
1739
|
+
* @example
|
|
1740
|
+
*
|
|
1741
|
+
* ```js
|
|
1742
|
+
* renderer.removeGaFromCart({
|
|
1743
|
+
* sectorId: 100500,
|
|
1744
|
+
* price: 200
|
|
1745
|
+
* });
|
|
1746
|
+
* ```
|
|
1747
|
+
*
|
|
1748
|
+
* @param removedGa removed GA cart item
|
|
1749
|
+
*/
|
|
1750
|
+
removeGaFromCart(removedGa: IRemovedCartGa): void;
|
|
1751
|
+
/**
|
|
1752
|
+
* Adds seats to cart programmatically.
|
|
1753
|
+
*
|
|
1754
|
+
* @remarks
|
|
1755
|
+
*
|
|
1756
|
+
* This method is optional.
|
|
1757
|
+
* In a common scenario the user adds available seats
|
|
1758
|
+
* by clicking on them.
|
|
1759
|
+
*
|
|
1760
|
+
* @example
|
|
1761
|
+
*
|
|
1762
|
+
* ```js
|
|
1763
|
+
* renderer.addSeatsToCart([
|
|
1764
|
+
* {
|
|
1765
|
+
* id: 803,
|
|
1766
|
+
* key: 'Section 3;;3;;1',
|
|
1767
|
+
* price: 500
|
|
1768
|
+
* }
|
|
1769
|
+
* ]);
|
|
1770
|
+
* ```
|
|
1771
|
+
*
|
|
1772
|
+
* @param seats Array of seats to add
|
|
1773
|
+
*/
|
|
1774
|
+
addSeatsToCart(seats: ICartSeat[]): void;
|
|
1775
|
+
/**
|
|
1776
|
+
* Removes seats from internal cart.
|
|
1777
|
+
*
|
|
1778
|
+
* @param ids Array of internal seat IDs
|
|
1779
|
+
*/
|
|
1780
|
+
removeSeatsFromCartByIds(ids: number[]): void;
|
|
1781
|
+
/**
|
|
1782
|
+
* Removes seats from internal cart.
|
|
1783
|
+
*
|
|
1784
|
+
* @param keys Array of composite seat keys
|
|
1785
|
+
*/
|
|
1786
|
+
removeSeatsFromCartByKeys(keys: string[]): void;
|
|
1787
|
+
/**
|
|
1788
|
+
* Marks seats as unavailable and removes them from cart.
|
|
1789
|
+
*
|
|
1790
|
+
* @param ids Array of internal seat IDs
|
|
1791
|
+
* @param options Optional configuration object.
|
|
1792
|
+
* @param options.resetAll If `true` (default), all seats not in the `ids` array will be unlocked.
|
|
1793
|
+
* If `false`, only the seats in the `ids` array will be affected, and the
|
|
1794
|
+
* locked state of other seats will remain unchanged.
|
|
1795
|
+
*/
|
|
1796
|
+
disableSeatsByIds(ids: number[], options?: {
|
|
1797
|
+
resetAll?: boolean;
|
|
1798
|
+
}): void;
|
|
1799
|
+
/**
|
|
1800
|
+
* Marks disabled seats as available.
|
|
1801
|
+
*
|
|
1802
|
+
* @param ids Array of internal seat IDs
|
|
1803
|
+
*/
|
|
1804
|
+
enableSeatsByIds(ids: number[]): void;
|
|
1805
|
+
/**
|
|
1806
|
+
* Marks seats as unavailable and removes them from cart.
|
|
1807
|
+
*
|
|
1808
|
+
* @param keys Array of composite seat keys
|
|
1809
|
+
*/
|
|
1810
|
+
disableSeatsByKeys(keys: string[]): void;
|
|
1811
|
+
/**
|
|
1812
|
+
* Marks seats as filtered.
|
|
1813
|
+
*
|
|
1814
|
+
* @param ids Array of internal seat IDs
|
|
1815
|
+
*/
|
|
1816
|
+
filterSeatsByIds(ids: number[]): void;
|
|
1817
|
+
/**
|
|
1818
|
+
* Marks disabled seats as available.
|
|
1819
|
+
*
|
|
1820
|
+
* @param ids Array of internal seat IDs
|
|
1821
|
+
*/
|
|
1822
|
+
removeFilter(ids?: number[]): void;
|
|
1823
|
+
/**
|
|
1824
|
+
* Marks seats as filtered.
|
|
1825
|
+
*
|
|
1826
|
+
* @param keys Array of composite seat keys
|
|
1827
|
+
*/
|
|
1828
|
+
filterSeatsByKeys(keys: string[]): void;
|
|
1829
|
+
/**
|
|
1830
|
+
* Convert array of seat keys to array of seat ids
|
|
1831
|
+
*
|
|
1832
|
+
* @param keys Array of composite seat keys
|
|
1833
|
+
*/
|
|
1834
|
+
seatKeysToIds(keys: string[]): number[];
|
|
1835
|
+
/**
|
|
1836
|
+
* Updates seat lock states.
|
|
1837
|
+
*
|
|
1838
|
+
* @example
|
|
1839
|
+
*
|
|
1840
|
+
* For example, you can create handler to prevent selection of seats
|
|
1841
|
+
* with different special state:
|
|
1842
|
+
*
|
|
1843
|
+
* ```js
|
|
1844
|
+
* const handleCartChange = (cart, prevCart) => {
|
|
1845
|
+
* if (!cart.seats.length) {
|
|
1846
|
+
* // Unlock all the seats if the cart is empty
|
|
1847
|
+
* renderer.updateSeatLocks(s => false);
|
|
1848
|
+
* } else if (!prevCart || !prevCart.seats.length) {
|
|
1849
|
+
* // Lock seats with different special state
|
|
1850
|
+
* const seat = cart.seats[0];
|
|
1851
|
+
* renderer.updateSeatLocks(
|
|
1852
|
+
* s => (s.special && s.special.s1) !== (seat.special && seat.special.s1)
|
|
1853
|
+
* );
|
|
1854
|
+
* }
|
|
1855
|
+
* };
|
|
1856
|
+
* ```
|
|
1857
|
+
*
|
|
1858
|
+
* @param filter Function should return `true` for seats to lock
|
|
1859
|
+
*/
|
|
1860
|
+
updateSeatLocks(filter: SeatFilter): void;
|
|
1861
|
+
/**
|
|
1862
|
+
* Returns selected seats
|
|
1863
|
+
*/
|
|
1864
|
+
getSeatSelection(): IExtendedSeat[];
|
|
1865
|
+
setSectionSelection(sections?: number[] | string[]): void;
|
|
1866
|
+
getSvgSectionBySelection(): ISectorDTO[];
|
|
1867
|
+
disableSvgSectionsByIds(ids: number[], options?: {
|
|
1868
|
+
resetAll?: boolean;
|
|
1869
|
+
}): void;
|
|
1870
|
+
enableSvgSectionsByIds(ids: number[]): void;
|
|
1871
|
+
private updateBackgroundImage;
|
|
1872
|
+
filterSvgSectionsByIds(ids: number[], options?: {
|
|
1873
|
+
resetAll?: boolean;
|
|
1874
|
+
}): void;
|
|
1875
|
+
removeFilterSvgSectionsByIds(ids?: number[]): void;
|
|
1876
|
+
disableSvgSectionsByNames(names: string[], options?: {
|
|
1877
|
+
resetAll?: boolean;
|
|
1878
|
+
}): void;
|
|
1879
|
+
enableSvgSectionsByNames(names: string[]): void;
|
|
1880
|
+
setSeatSelection(seats: number[] | string[] | ISeat[]): void;
|
|
1881
|
+
setSelectedGa(ga?: number | string): void;
|
|
1882
|
+
getSelectedGa(): ISector | undefined;
|
|
1883
|
+
/**
|
|
1884
|
+
* Returns sections info
|
|
1885
|
+
*/
|
|
1886
|
+
getSections(): ISector[];
|
|
1887
|
+
/**
|
|
1888
|
+
*
|
|
1889
|
+
* @returns Rows data array
|
|
1890
|
+
*/
|
|
1891
|
+
getRows(): IRowDTO[];
|
|
1892
|
+
/**
|
|
1893
|
+
*
|
|
1894
|
+
* @returns Seats data array
|
|
1895
|
+
*/
|
|
1896
|
+
getSeats(): ISeatDTO[];
|
|
1897
|
+
/**
|
|
1898
|
+
*
|
|
1899
|
+
* @returns Row data
|
|
1900
|
+
*/
|
|
1901
|
+
getRowById(id: number): IRowDTO;
|
|
1902
|
+
/**
|
|
1903
|
+
* Returns only visible seats with coords relative to canvas
|
|
1904
|
+
*/
|
|
1905
|
+
getVisibleSeats(): ISeat[];
|
|
1906
|
+
getSectionsWithCoords(): ISectionWithCoords[];
|
|
1907
|
+
private handleDestPan;
|
|
1908
|
+
private handleDestRectSelect;
|
|
1909
|
+
private handleDestDeselect;
|
|
1910
|
+
private getGaSectionByOutline;
|
|
1911
|
+
private getSectionByOutline;
|
|
1912
|
+
private getSectorRectByOutline;
|
|
1913
|
+
private handleDestPanZoom;
|
|
1914
|
+
private handleDestSeatSelect;
|
|
1915
|
+
private findNearestSeatGroup;
|
|
1916
|
+
private handleDestSeatCartSwitch;
|
|
1917
|
+
private handleDestSectionClick;
|
|
1918
|
+
private handlePinch;
|
|
1919
|
+
private normalizePinchScale;
|
|
1920
|
+
private handleDestSeatMouseEnter;
|
|
1921
|
+
private handleDestSectionMouseEnter;
|
|
1922
|
+
private handleDestSeatMouseLeave;
|
|
1923
|
+
private handleDestSectionMouseLeave;
|
|
1924
|
+
private handleMouseMove;
|
|
1925
|
+
private handleMouseMoveOutside;
|
|
1926
|
+
private handleWindowResize;
|
|
1927
|
+
private updateSize;
|
|
1928
|
+
/**
|
|
1929
|
+
* Returns current zoom value.
|
|
1930
|
+
*/
|
|
1931
|
+
getZoom(): number;
|
|
1932
|
+
zoomIn(): void;
|
|
1933
|
+
zoomOut(): void;
|
|
1934
|
+
zoomToFit(): void;
|
|
1935
|
+
clearSectorHighlight(): void;
|
|
1936
|
+
highlightSector(id: number | undefined): void;
|
|
1937
|
+
private startPanAnimation;
|
|
1938
|
+
private animationPanStep;
|
|
1939
|
+
private startAnimation;
|
|
1940
|
+
private animationStep;
|
|
1941
|
+
private cachedDraw;
|
|
1942
|
+
private redraw;
|
|
1943
|
+
private doTranslate;
|
|
1944
|
+
private calculateLimitedTranslate;
|
|
1945
|
+
private calculateLimit;
|
|
1946
|
+
seatToExtendedSeat: (seat: ISeat) => IExtendedSeat;
|
|
1947
|
+
private calculateRelativeScaledLimitedTranslate;
|
|
1948
|
+
private calculateAbsoluteScaledTranslate;
|
|
1949
|
+
private calculateRelativeScaledTranslate;
|
|
1950
|
+
/**
|
|
1951
|
+
* Current approach implies that the seatmap contains proper background
|
|
1952
|
+
* Scale and
|
|
1953
|
+
*
|
|
1954
|
+
* @param background - background object
|
|
1955
|
+
* @internal
|
|
1956
|
+
*/
|
|
1957
|
+
private getInitialScaleAndTranslate;
|
|
1958
|
+
private getNextScale;
|
|
1959
|
+
private getPrevScale;
|
|
1960
|
+
private getZoomPresets;
|
|
1961
|
+
/**
|
|
1962
|
+
* Returns the minimal zoom preset value.
|
|
1963
|
+
*/
|
|
1964
|
+
getMinZoom(): number;
|
|
1965
|
+
/**
|
|
1966
|
+
* Returns the maximum zoom preset value.
|
|
1967
|
+
*/
|
|
1968
|
+
getMaxZoom(): number;
|
|
1969
|
+
viewSection(section: ISection): void;
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1972
|
+
interface IAdminRendererSettings extends IRendererSettings {
|
|
1973
|
+
/**
|
|
1974
|
+
* Custom API base URL that overrides the environment-based URL.
|
|
1975
|
+
*/
|
|
1976
|
+
baseUrl?: string;
|
|
1977
|
+
/**
|
|
1978
|
+
* Public API key for authentication.
|
|
1979
|
+
*/
|
|
1980
|
+
publicKey?: string;
|
|
1981
|
+
/**
|
|
1982
|
+
* Environment setting that determines which API endpoint to use.
|
|
1983
|
+
* Can be 'local', 'stage', or 'production' (default).
|
|
1984
|
+
*/
|
|
1985
|
+
env?: string;
|
|
1986
|
+
}
|
|
1987
|
+
/**
|
|
1988
|
+
* Admin Renderer class for seatmap administration.
|
|
1989
|
+
* Extends the base Renderer with admin-specific functionality.
|
|
1990
|
+
*/
|
|
1991
|
+
declare class SeatmapAdminRenderer extends Renderer {
|
|
1992
|
+
protected apiClient: BookingApiClient;
|
|
1993
|
+
/**
|
|
1994
|
+
* Creates a new instance of the AdminRenderer.
|
|
1995
|
+
*
|
|
1996
|
+
* Initializes the renderer by setting up the base configuration and API client.
|
|
1997
|
+
* The API endpoint URL is determined based on the environment setting.
|
|
1998
|
+
*
|
|
1999
|
+
* @param element - The HTML element where the renderer will be mounted
|
|
2000
|
+
* @param settings - Optional configuration settings for the renderer
|
|
2001
|
+
* @param settings.env - Environment setting ('local', 'stage', or 'production'(default))
|
|
2002
|
+
* that determines which API endpoint to use
|
|
2003
|
+
* @param settings.baseUrl - Optional custom API base URL that overrides the environment-based URL
|
|
2004
|
+
* @param settings.publicKey - Required API public key for authentication
|
|
2005
|
+
*
|
|
2006
|
+
* @throws {Error} Throws an error if the public key is undefined
|
|
2007
|
+
*
|
|
2008
|
+
* @example
|
|
2009
|
+
* ```typescript
|
|
2010
|
+
* // Create with default production settings
|
|
2011
|
+
* const renderer = new AdminRenderer(document.getElementById('container'), {
|
|
2012
|
+
* publicKey: 'your-public-key'
|
|
2013
|
+
* });
|
|
2014
|
+
*
|
|
2015
|
+
* // Create with staging environment
|
|
2016
|
+
* const stageRenderer = new AdminRenderer(document.getElementById('container'), {
|
|
2017
|
+
* env: 'stage',
|
|
2018
|
+
* publicKey: 'your-stage-key'
|
|
2019
|
+
* });
|
|
2020
|
+
*
|
|
2021
|
+
* // Create with custom base URL
|
|
2022
|
+
* const customRenderer = new AdminRenderer(document.getElementById('container'), {
|
|
2023
|
+
* baseUrl: 'https://your-custom-api.example.com/v1/',
|
|
2024
|
+
* publicKey: 'your-public-key'
|
|
2025
|
+
* });
|
|
2026
|
+
* ```
|
|
2027
|
+
*/
|
|
2028
|
+
constructor(element: HTMLElement, settings?: IAdminRendererSettings);
|
|
2029
|
+
/**
|
|
2030
|
+
* Sets the interaction mode for the component and updates visibility of the outline layer.
|
|
2031
|
+
*
|
|
2032
|
+
* @param mode - The interaction mode to set. When set to 'pan', the outline layer is hidden.
|
|
2033
|
+
* For any other mode, the outline layer is shown.
|
|
2034
|
+
*
|
|
2035
|
+
* @returns A boolean indicating whether the mode change was successful.
|
|
2036
|
+
* Returns true if the outline layer exists and the mode was set.
|
|
2037
|
+
* Returns false if the outline layer doesn't exist.
|
|
2038
|
+
*
|
|
2039
|
+
* @example
|
|
2040
|
+
* ```typescript
|
|
2041
|
+
* // Set mode to 'pan' - will hide outline layer
|
|
2042
|
+
* component.setMode('pan');
|
|
2043
|
+
*
|
|
2044
|
+
* // Set mode to 'select' - will show outline layer
|
|
2045
|
+
* component.setMode('select');
|
|
2046
|
+
* ```
|
|
2047
|
+
*/
|
|
2048
|
+
setMode(mode: string): boolean;
|
|
2049
|
+
/**
|
|
2050
|
+
* Loads event's schema
|
|
2051
|
+
*
|
|
2052
|
+
* @example
|
|
2053
|
+
* ```js
|
|
2054
|
+
* var eventId = 'a4a75361-7823-4847-bf22-336843022e80';
|
|
2055
|
+
* renderer.loadEvent(eventId).then(function() {
|
|
2056
|
+
* renderer.initCart(cart);
|
|
2057
|
+
* });
|
|
2058
|
+
* ``` *
|
|
2059
|
+
* @param eventId - Event ID
|
|
2060
|
+
* @returns A promise that resolves when the data fetching is completed
|
|
2061
|
+
*/
|
|
2062
|
+
loadEvent(eventId: string): Promise<void>;
|
|
2063
|
+
/**
|
|
2064
|
+
* Loads schema by id
|
|
2065
|
+
*
|
|
2066
|
+
* @example
|
|
2067
|
+
* ```js
|
|
2068
|
+
* var schemaId = 100500;
|
|
2069
|
+
* renderer.loadSchema(schemaId).then(function() { ... });
|
|
2070
|
+
* ```
|
|
2071
|
+
*
|
|
2072
|
+
* @param schemaId - Schema ID
|
|
2073
|
+
* @returns A promise that resolves when the data fetching is completed
|
|
2074
|
+
*/
|
|
2075
|
+
loadSchema(schemaId: number): Promise<void>;
|
|
2076
|
+
}
|
|
2077
|
+
|
|
2078
|
+
interface IBookingRendererSettings extends IRendererSettings {
|
|
2079
|
+
/**
|
|
2080
|
+
* Custom API base URL that overrides the environment-based URL.
|
|
2081
|
+
*
|
|
2082
|
+
* @hidden
|
|
2083
|
+
*/
|
|
2084
|
+
baseUrl?: string;
|
|
2085
|
+
/**
|
|
2086
|
+
* Public API key for authentication.
|
|
2087
|
+
*/
|
|
2088
|
+
publicKey?: string;
|
|
2089
|
+
/**
|
|
2090
|
+
* Environment setting that determines which API endpoint to use.
|
|
2091
|
+
* Can be 'local', 'stage', or 'production' (default).
|
|
2092
|
+
*/
|
|
2093
|
+
env?: string;
|
|
2094
|
+
/**
|
|
2095
|
+
* If set to `true`, zoom is disabled when clicking into empty space.
|
|
2096
|
+
*
|
|
2097
|
+
* @defaultValue `false`
|
|
2098
|
+
*/
|
|
2099
|
+
disableZoomToEmptySpace?: boolean;
|
|
2100
|
+
/**
|
|
2101
|
+
* If set to true, renderer will switch to WebGL.
|
|
2102
|
+
*
|
|
2103
|
+
* @defaultValue `false`
|
|
2104
|
+
*/
|
|
2105
|
+
switchToWebGL?: boolean;
|
|
2106
|
+
/**
|
|
2107
|
+
* Sets the delay time for loading the next background.
|
|
2108
|
+
*
|
|
2109
|
+
* @defaultValue `0`
|
|
2110
|
+
*/
|
|
2111
|
+
backgroundLoadStepTime?: number;
|
|
2112
|
+
}
|
|
2113
|
+
/**
|
|
2114
|
+
* Booking Renderer class for seatmap booking.
|
|
2115
|
+
* Extends the base Renderer with booking-specific functionality.
|
|
2116
|
+
*/
|
|
2117
|
+
declare class SeatmapBookingRenderer extends Renderer {
|
|
2118
|
+
private apiClient;
|
|
2119
|
+
private stats;
|
|
2120
|
+
private tags;
|
|
2121
|
+
/**
|
|
2122
|
+
* Creates a new instance of the SeatmapBookingRenderer.
|
|
2123
|
+
*
|
|
2124
|
+
* Initializes the renderer by setting up the base configuration, API client, and analytics.
|
|
2125
|
+
* The API endpoint URL is determined based on the environment setting.
|
|
2126
|
+
*
|
|
2127
|
+
* @param element - DOM element that will be a host element for the Renderer
|
|
2128
|
+
* @param settings - Optional configuration settings for the renderer
|
|
2129
|
+
* @param settings.env - Environment setting ('local', 'stage', or 'production'(default))
|
|
2130
|
+
* that determines which API endpoint to use
|
|
2131
|
+
* @param settings.baseUrl - Optional custom API base URL that overrides the environment-based URL
|
|
2132
|
+
* @param settings.publicKey - Required API public key for authentication
|
|
2133
|
+
* @param tags - Optional tags for analytics tracking
|
|
2134
|
+
*
|
|
2135
|
+
* @throws {Error} Throws an error if the public key is undefined
|
|
2136
|
+
*/
|
|
2137
|
+
constructor(element: HTMLElement, settings?: IBookingRendererSettings, tags?: any);
|
|
2138
|
+
/**
|
|
2139
|
+
* Gets the current view box properties.
|
|
2140
|
+
*
|
|
2141
|
+
* @returns The current view box with width, height, scale, and translation information
|
|
2142
|
+
* @private
|
|
2143
|
+
*/
|
|
2144
|
+
private getViewBox;
|
|
2145
|
+
/**
|
|
2146
|
+
* Loads event's schema and prices.
|
|
2147
|
+
*
|
|
2148
|
+
* Fetches the schema, prices, and row SVG data for the specified event.
|
|
2149
|
+
* Initializes analytics tracking and sets up event handlers for user interactions.
|
|
2150
|
+
*
|
|
2151
|
+
* @example
|
|
2152
|
+
* ```js
|
|
2153
|
+
* var eventId = 'a4a75361-7823-4847-bf22-336843022e80';
|
|
2154
|
+
* renderer.loadEvent(eventId).then(function() {
|
|
2155
|
+
* renderer.initCart(cart);
|
|
2156
|
+
* });
|
|
2157
|
+
* ```
|
|
2158
|
+
*
|
|
2159
|
+
* @param eventId - Event GUID to load
|
|
2160
|
+
* @param sectorId - Optional sector ID to show only a specific sector
|
|
2161
|
+
* @returns A promise that resolves when the data fetching is completed
|
|
2162
|
+
*/
|
|
2163
|
+
loadEvent(eventId: string, sectorId?: number): Promise<void>;
|
|
2164
|
+
/**
|
|
2165
|
+
* Creates a statistics data object for seat selection/deselection events.
|
|
2166
|
+
*
|
|
2167
|
+
* @param seat - The seat that was selected or deselected
|
|
2168
|
+
* @param isSuccess - Whether the selection/deselection was successful
|
|
2169
|
+
* @returns Statistics data for the seat event
|
|
2170
|
+
* @private
|
|
2171
|
+
*/
|
|
2172
|
+
private createStatsSeatRequest;
|
|
2173
|
+
/**
|
|
2174
|
+
* Filters the schema and prices to only include data for a specific sector.
|
|
2175
|
+
*
|
|
2176
|
+
* @param sectorId - The ID of the sector to keep
|
|
2177
|
+
* @param schema - The complete schema data
|
|
2178
|
+
* @param prices - The complete price list data
|
|
2179
|
+
* @returns A tuple containing the filtered schema and prices
|
|
2180
|
+
* @private
|
|
2181
|
+
*/
|
|
2182
|
+
private leaveSectionOnly;
|
|
2183
|
+
}
|
|
2184
|
+
|
|
2185
|
+
declare const mergeSettings: <TSettings extends IRendererSettings>(defaults: IRendererSettings, settings?: TSettings | undefined) => IRendererSettings & TSettings;
|
|
2186
|
+
|
|
2187
|
+
export { BookingApiClient, type ById, type ColorSequenceSettings, type DestEvent, DestEventType, type IAdminRendererSettings, type IBaseSeat, type IBaseSector, type IBeforeSeatDrawEvent, type IBookingRendererSettings, type ICart, type ICartGa, type ICartSeat, type IClickSrcEvent, type IColoredPrice, type IConfigurationDTO, type IDeselectDestEvent, type IDragEndSrcEvent, type IDragMoveSrcEvent, type IDragStartSrcEvent, type IExtendedSeat, type IMouseMoveSrcEvent, type IPanDestEvent, type IPanZoomDestEvent, type IPlainSeatsDTO, type IPngBackgroundDTO, type IPoint, type IPrice, type IPriceDTO, type IPriceId, type IPriceListDTO, type IRectSelectDestEvent, type IRemovedCartGa, type IRenderer, type IRendererMachineContext, type IRendererSeatStyleSettings, type IRendererSettings, type IRendererSvgSectionStylesSetting, type IRendererTheme, type IRowDTO, type ISVGBackgroundDTO, type ISchemaDTO, type ISeat, type ISeatCartSwitchDestEvent, type ISeatDTO, type ISeatMouseEnterDestEvent, type ISeatMouseLeaveDestEvent, type ISeatPriceScheme, type ISeatSelectDestEvent, type ISeatStyle, type ISection, type ISectionClickDestEvent, type ISectionMouseEnterDestEvent, type ISectionMouseLeaveDestEvent, type ISectionRect, type ISectionWithCoords, type ISector, type ISectorDTO, type ISpecialPrice, type ISpecialState, type ISvgSectionStyle, type IVenueDTO, Renderer, type RendererMachine, type RendererMachineReducer, type RendererMachineService, RendererSelectMode, RendererTargetType, type SeatFilter, type SeatInteractionState, SeatmapAdminRenderer, SeatmapBookingRenderer, type SrcEvent, SrcEventType, type TransformArray, convertPricesToColored, convertPricesToColoredById, mergeSettings, sortPrices };
|