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