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