@seatmap.pro/renderer 0.0.4 → 0.0.5

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.ts CHANGED
@@ -1,149 +1,459 @@
1
1
  import KDBush from 'kdbush';
2
2
  import { Machine, Service } from 'robot3';
3
3
 
4
- interface IPoint {
5
- readonly x: number;
6
- readonly y: number;
7
- }
8
-
9
- interface IPrice {
10
- id: IPriceId;
11
- name: string;
12
- }
13
- interface IColoredPrice extends IPrice {
14
- color: string;
15
- }
16
-
17
4
  /**
18
- * @hidden
5
+ * Base interface for seat properties.
19
6
  */
20
- interface IRendererMachineContext {
21
- mode?: string;
22
- scale: number;
23
- isEagleView: boolean;
24
- events: DestEvent[];
25
- hovered?: {
26
- targetType: RendererTargetType;
27
- id: number;
28
- };
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;
29
40
  }
30
41
  /**
31
- * @hidden
32
- */
33
- type RendererMachineReducer<T> = (ctx: IRendererMachineContext, src: T) => IRendererMachineContext;
34
- /**
35
- * @hidden
42
+ * Base interface for sector properties.
36
43
  */
37
- type RendererMachine = Machine<any, IRendererMachineContext, any>;
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
+ }
38
82
  /**
83
+ * Interface representing the schema data transfer object from the API.
39
84
  * @hidden
40
85
  */
41
- type RendererMachineService = Service<RendererMachine>;
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
+ }
42
96
  /**
97
+ * Interface representing the venue data transfer object from the API.
43
98
  * @hidden
44
99
  */
45
- declare enum RendererTargetType {
46
- SEAT = "seat",
47
- SECTION = "section"
100
+ interface IVenueDTO {
101
+ guid: string;
102
+ name: string;
103
+ gaCapacity?: number;
104
+ seatsCapacity?: number;
105
+ seatmap: ISchemaDTO;
106
+ schema: ISchemaDTO;
48
107
  }
49
108
  /**
109
+ * Interface representing the plain seats data transfer object from the API.
50
110
  * @hidden
51
111
  */
52
- declare enum RendererSelectMode {
53
- REPLACE = "replace",
54
- ADD = "add",
55
- SUBTRACT = "subtract"
112
+ interface IPlainSeatsDTO {
113
+ ids: number[];
114
+ x: number[];
115
+ y: number[];
116
+ rowIds: [];
117
+ sectorIds: [];
118
+ names: string[];
56
119
  }
57
120
  /**
58
- * Source events
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
59
124
  */
125
+ type ISeatDTO = IBaseSeat;
60
126
  /**
127
+ * Interface representing a row in the venue.
61
128
  * @hidden
62
129
  */
63
- declare enum SrcEventType {
64
- DRAG_START = "srcDragStart",
65
- DRAG_MOVE = "srcDragMove",
66
- DRAG_END = "srcDragEnd",
67
- CLICK = "srcClick",
68
- MOUSE_MOVE = "srcMouseMove"
130
+ interface IRowDTO {
131
+ id: number;
132
+ rowNumber: number;
133
+ sectorId: number;
134
+ name: string;
135
+ seatName: string;
69
136
  }
70
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.
71
140
  * @hidden
72
141
  */
73
- type SrcEvent = IDragStartSrcEvent | IDragMoveSrcEvent | IDragEndSrcEvent | IClickSrcEvent | IMouseMoveSrcEvent;
142
+ type ISectorDTO = IBaseSector;
74
143
  /**
144
+ * Interface representing the SVG background data transfer object from the API.
75
145
  * @hidden
76
146
  */
77
- interface IDragSrcEvent<T> {
78
- type: T;
79
- origin: {
80
- x: number;
81
- y: number;
82
- };
83
- delta: {
147
+ interface ISVGBackgroundDTO {
148
+ svg: string;
149
+ viewBox: {
84
150
  x: number;
85
151
  y: number;
152
+ width: number;
153
+ height: number;
86
154
  };
87
- shiftKey?: boolean;
88
- altKey?: boolean;
155
+ svgLink?: string;
156
+ images?: IPngBackgroundDTO;
89
157
  }
90
158
  /**
159
+ * Interface representing the configuration data transfer object from the API.
91
160
  * @hidden
92
161
  */
93
- interface IDragStartSrcEvent extends IDragSrcEvent<SrcEventType.DRAG_START> {
162
+ interface IConfigurationDTO {
163
+ accessible: number[];
164
+ marked: number[];
165
+ eventName?: string;
94
166
  }
95
167
  /**
96
- * @hidden
168
+ * Interface representing a special price option for seats, sections, or sectors.
169
+ * Contains information about a named price point with its identifier.
97
170
  */
98
- interface IDragMoveSrcEvent extends IDragSrcEvent<SrcEventType.DRAG_MOVE> {
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;
99
180
  }
100
181
  /**
101
- * @hidden
182
+ * Interface representing special state information for seats, sections, or sectors.
183
+ * Contains additional properties that affect rendering or behavior.
102
184
  */
103
- interface IDragEndSrcEvent extends IDragSrcEvent<SrcEventType.DRAG_END> {
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;
104
198
  }
105
199
  /**
200
+ * Interface representing a price list data transfer object from the API.
106
201
  * @hidden
107
202
  */
108
- interface IClickSrcEvent {
109
- type: SrcEventType.CLICK;
110
- target: HTMLElement;
111
- point: {
112
- x: number;
113
- y: number;
114
- };
115
- section?: ISection;
116
- seat?: ISeat;
117
- shiftKey?: boolean;
118
- altKey?: boolean;
203
+ interface IPriceListDTO {
204
+ seats: [number, IPriceId, ISpecialState?][];
205
+ groupOfSeats: [number, number, number, ISpecialState?][];
206
+ prices: IPriceDTO[];
207
+ requestTime?: number;
208
+ responseSize?: number;
119
209
  }
120
210
  /**
211
+ * Interface representing a price data transfer object from the API.
121
212
  * @hidden
122
213
  */
123
- interface IMouseMoveSrcEvent {
124
- type: SrcEventType.MOUSE_MOVE;
125
- target: HTMLElement;
126
- section?: ISection;
127
- seat?: ISeat;
214
+ interface IPriceDTO {
215
+ id: IPriceId;
216
+ name: string;
128
217
  }
129
218
  /**
130
- * Output events
219
+ * Type representing blurred image data.
220
+ * @hidden
131
221
  */
222
+ type IBlurred = {
223
+ data: string;
224
+ shrink_factor: number;
225
+ size: number;
226
+ status: string;
227
+ };
132
228
  /**
229
+ * Type representing a PNG image loaded from a URL.
133
230
  * @hidden
134
231
  */
135
- declare enum DestEventType {
136
- PAN = "destPan",
137
- RECT_SELECT = "destRectSelect",
138
- DESELECT = "destDeselect",
139
- PAN_ZOOM = "destPanZoom",
140
- SEAT_SELECT = "destSeatSelect",
141
- SEAT_CART_SWITCH = "destSeatCartSwitch",
142
- SECTION_CLICK = "destSectionClick",
143
- SEAT_MOUSE_ENTER = "destSeatMouseEnter",
144
- SECTION_MOUSE_ENTER = "destSectionMouseEnter",
145
- SEAT_MOUSE_LEAVE = "destSeatMouseLeave",
146
- SECTION_MOUSE_LEAVE = "destSectionMouseLeave"
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"
147
457
  }
148
458
  /**
149
459
  * @hidden
@@ -801,481 +1111,170 @@ interface IRendererSettings {
801
1111
  *
802
1112
  * Seats are passed as a param to the handler (see ISeat).
803
1113
  *
804
- */
805
- onSeatsDeselect?: (seats: ISeat[]) => void;
806
- /**
807
- * Fires when the cart was modified.
808
- *
809
- * @remarks
810
- *
811
- * Cart state is passed as a param to the handler (see ICart).
812
- */
813
- onCartChange?: (cart: ICart, prevCart?: ICart) => void;
814
- /**
815
- * Fires when the mouse pointer moves above a section.
816
- *
817
- * @remarks
818
- *
819
- * Section is passed as a param to the handler (see ISection).
820
- */
821
- onSectorMouseEnter?: (section: ISection) => void;
822
- /**
823
- * Fires when the mouse pointer leaves a section.
824
- */
825
- onSectorMouseLeave?: () => void;
826
- /**
827
- * Fires when the user clicks on a section.
828
- *
829
- * @deprecated
830
- * Use onSectionClick instead
831
- */
832
- onSectorClick?: (section: ISection) => void;
833
- /**
834
- * Fires when the user clicks on a section.
835
- *
836
- * @remarks
837
- *
838
- * Section is passed as a param to the handler (see ISection).
839
- */
840
- onSectionClick?: (section: ISection) => void;
841
- /**
842
- * Fires before the zoom animation started.
843
- */
844
- onZoomStart?: (newZoom: number, oldZoom: number) => void;
845
- /**
846
- * Fires after the zoom animation ended.
847
- */
848
- onZoomEnd?: (newZoom: number, oldZoom?: number) => void;
849
- /**
850
- * Fires when component full redrawing starts.
851
- */
852
- onRedrawStart?: () => void;
853
- /**
854
- * Fires when component full redrawing ends.
855
- */
856
- onRedrawEnd?: () => void;
857
- /**
858
- * Fires when schema data has been successfully loaded and processed.
859
- *
860
- * @remarks
861
- *
862
- * This event is triggered after the schema data is fully loaded and all internal
863
- * processing is complete. It can be used to perform actions that depend on the
864
- * schema being fully initialized.
865
- */
866
- onSchemaDataLoaded?: () => void;
867
- /**
868
- * Fires while panning.
869
- */
870
- onPan?: (delta: IPoint, isFinish?: boolean) => void;
871
- /**
872
- * Fires after seat selection was updated.
873
- */
874
- onSeatSelectionChange?: () => void;
875
- /**
876
- * Fires after seats selection was updated.
877
- */
878
- onSeatsSelectionChange?: (seats: ISeat[]) => void;
879
- /**
880
- * You can control seats' styling by returning custom style for each seat
881
- */
882
- onBeforeSeatDraw?: (event: IBeforeSeatDrawEvent) => ISeatStyle;
883
- lockedSeatsFilter?: (seat: ISeat) => boolean;
884
- }
885
- /**
886
- * Represents the possible interaction states of a seat.
887
- * Used to determine how a seat should be rendered based on user interaction.
888
- */
889
- type SeatInteractionState = 'default' | 'hovered' | 'selected';
890
- /**
891
- * Interface for the event data passed to the onBeforeSeatDraw callback.
892
- * Contains information about the seat being drawn and its current state.
893
- */
894
- interface IBeforeSeatDrawEvent {
895
- /**
896
- * The seat being drawn.
897
- */
898
- seat: ISeat;
899
- /**
900
- * The current interaction state of the seat.
901
- */
902
- state: SeatInteractionState;
903
- /**
904
- * The default style that will be applied to the seat.
905
- */
906
- style: ISeatStyle;
907
- /**
908
- * The rendering context.
909
- */
910
- context: Context;
911
- }
912
- interface IRendererSeatStyleSettings {
913
- default?: ISeatStyle;
914
- unavailable?: ISeatStyle;
915
- filtered?: ISeatStyle;
916
- hovered?: ISeatStyle;
917
- selected?: ISeatStyle;
918
- }
919
- interface ISeatStyle {
920
- size: number;
921
- color: string;
922
- seatName?: {
923
- font: string;
924
- color: string;
925
- };
926
- stroke?: {
927
- width: number;
928
- color: string;
929
- align: 'center' | 'inside' | 'outside';
930
- };
931
- imageId?: string;
932
- shadow?: {
933
- blur: number;
934
- color: string;
935
- x?: number;
936
- y?: number;
937
- };
938
- accessible?: ISeatStyle;
939
- }
940
- interface IRendererSvgSectionStylesSetting {
941
- default?: Pick<ISvgSectionStyle, 'sectionName' | 'stroke' | 'cursor'>;
942
- unavailable?: ISvgSectionStyle;
943
- filtered?: ISvgSectionStyle;
944
- hovered?: ISvgSectionStyle;
945
- selected?: ISvgSectionStyle;
946
- }
947
- interface ISvgSectionStyle {
948
- sectionName?: {
949
- color?: string;
950
- };
951
- bgColor?: string;
952
- stroke?: {
953
- color?: string;
954
- opacity?: number;
955
- };
956
- cursor?: string;
957
- }
958
- interface IRendererTheme {
959
- gridStep?: number;
960
- bgColor?: string;
961
- priceColors?: string[][];
962
- colorCategories?: string[];
963
- images?: {
964
- [id: string]: string;
965
- };
966
- seatStyles?: IRendererSeatStyleSettings;
967
- svgSectionStyles?: IRendererSvgSectionStylesSetting;
968
- }
969
-
970
- /**
971
- * Base interface for seat properties.
972
- */
973
- interface IBaseSeat {
974
- /**
975
- * The unique identifier of the seat.
976
- */
977
- id: number;
978
- /**
979
- * The ID of the row this seat belongs to.
980
- */
981
- rowId: number;
982
- /**
983
- * The ID of the sector this seat belongs to.
984
- */
985
- sectorId: number;
986
- /**
987
- * The X coordinate of the seat within its section.
988
- */
989
- x: number;
990
- /**
991
- * The Y coordinate of the seat within its section.
992
- */
993
- y: number;
994
- /**
995
- * The name or number of the seat.
996
- */
997
- name: string;
998
- /**
999
- * Whether the seat is accessible for people with disabilities.
1000
- */
1001
- isAccessible?: boolean;
1002
- /**
1003
- * Whether the seat is marked with a special status.
1004
- */
1005
- isMarked?: boolean;
1006
- }
1007
- /**
1008
- * Base interface for sector properties.
1009
- */
1010
- interface IBaseSector {
1011
- /**
1012
- * The unique identifier of the sector.
1013
- */
1014
- id: number;
1015
- /**
1016
- * The globally unique identifier for the sector.
1017
- */
1018
- guid?: string;
1019
- /**
1020
- * Whether this is a general admission (GA) sector.
1021
- */
1022
- isGa: boolean;
1023
- /**
1024
- * The name of the sector.
1025
- */
1026
- name: string;
1027
- /**
1028
- * The rotation angle of the sector in degrees.
1029
- */
1030
- angle?: number | null;
1031
- /**
1032
- * The type of the sector.
1033
- */
1034
- type?: string | null;
1035
- /**
1036
- * Whether the sector is disabled and cannot be interacted with.
1037
- */
1038
- disabled?: boolean;
1039
- /**
1040
- * Whether the sector is filtered out by current filter criteria.
1041
- */
1042
- filtered?: boolean;
1043
- /**
1044
- * Whether the sector is currently selected.
1045
- */
1046
- selected?: boolean;
1047
- }
1048
- /**
1049
- * Interface representing the schema data transfer object from the API.
1050
- * @hidden
1051
- */
1052
- interface ISchemaDTO {
1053
- plainSeats?: IPlainSeatsDTO;
1054
- seats: ISeatDTO[];
1055
- rows: IRowDTO[];
1056
- sectors: ISectorDTO[];
1057
- background: ISVGBackgroundDTO;
1058
- requestTime?: number;
1059
- responseSize?: number;
1060
- configuration?: IConfigurationDTO;
1061
- }
1062
- /**
1063
- * Interface representing the venue data transfer object from the API.
1064
- * @hidden
1065
- */
1066
- interface IVenueDTO {
1067
- guid: string;
1068
- name: string;
1069
- gaCapacity?: number;
1070
- seatsCapacity?: number;
1071
- seatmap: ISchemaDTO;
1072
- schema: ISchemaDTO;
1073
- }
1074
- /**
1075
- * Interface representing the plain seats data transfer object from the API.
1076
- * @hidden
1077
- */
1078
- interface IPlainSeatsDTO {
1079
- ids: number[];
1080
- x: number[];
1081
- y: number[];
1082
- rowIds: [];
1083
- sectorIds: [];
1084
- names: string[];
1085
- }
1086
- /**
1087
- * Interface representing the base seat data transfer object from the API.
1088
- * Contains the core properties of a seat as received from the backend.
1089
- * @hidden
1090
- */
1091
- interface ISeatDTO extends IBaseSeat {
1092
- }
1093
- /**
1094
- * Interface representing a row in the venue.
1095
- * @hidden
1096
- */
1097
- interface IRowDTO {
1098
- id: number;
1099
- rowNumber: number;
1100
- sectorId: number;
1101
- name: string;
1102
- seatName: string;
1103
- }
1104
- /**
1105
- * Interface representing the base sector data transfer object from the API.
1106
- * Contains the core properties of a sector as received from the backend.
1107
- * @hidden
1108
- */
1109
- interface ISectorDTO extends IBaseSector {
1110
- }
1111
- /**
1112
- * Interface representing the SVG background data transfer object from the API.
1113
- * @hidden
1114
- */
1115
- interface ISVGBackgroundDTO {
1116
- svg: string;
1117
- viewBox: {
1118
- x: number;
1119
- y: number;
1120
- width: number;
1121
- height: number;
1122
- };
1123
- svgLink?: string;
1124
- images?: IPngBackgroundDTO;
1125
- }
1126
- /**
1127
- * Interface representing the configuration data transfer object from the API.
1128
- * @hidden
1129
- */
1130
- interface IConfigurationDTO {
1131
- accessible: number[];
1132
- marked: number[];
1133
- eventName?: string;
1134
- }
1135
- /**
1136
- * Interface representing a special price option for seats, sections, or sectors.
1137
- * Contains information about a named price point with its identifier.
1138
- */
1139
- interface ISpecialPrice {
1114
+ */
1115
+ onSeatsDeselect?: (seats: ISeat[]) => void;
1140
1116
  /**
1141
- * The name or label of the special price option.
1117
+ * Fires when the cart was modified.
1118
+ *
1119
+ * @remarks
1120
+ *
1121
+ * Cart state is passed as a param to the handler (see ICart).
1142
1122
  */
1143
- name: string;
1123
+ onCartChange?: (cart: ICart, prevCart?: ICart) => void;
1144
1124
  /**
1145
- * The unique identifier for this price option.
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).
1146
1130
  */
1147
- priceId: number;
1148
- }
1149
- /**
1150
- * Interface representing special state information for seats, sections, or sectors.
1151
- * Contains additional properties that affect rendering or behavior.
1152
- */
1153
- interface ISpecialState {
1131
+ onSectorMouseEnter?: (section: ISection) => void;
1154
1132
  /**
1155
- * Special state flag 1, used for custom state indicators.
1133
+ * Fires when the mouse pointer leaves a section.
1156
1134
  */
1157
- s1?: number;
1135
+ onSectorMouseLeave?: () => void;
1158
1136
  /**
1159
- * Array of special prices associated with this item.
1137
+ * Fires when the user clicks on a section.
1138
+ *
1139
+ * @deprecated
1140
+ * Use onSectionClick instead
1160
1141
  */
1161
- prices?: ISpecialPrice[];
1142
+ onSectorClick?: (section: ISection) => void;
1162
1143
  /**
1163
- * Category identifier for grouping items with similar special states.
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).
1164
1149
  */
1165
- category?: number;
1166
- }
1167
- /**
1168
- * Interface representing a price list data transfer object from the API.
1169
- * @hidden
1170
- */
1171
- interface IPriceListDTO {
1172
- seats: [number, IPriceId, ISpecialState?][];
1173
- groupOfSeats: [number, number, number, ISpecialState?][];
1174
- prices: IPriceDTO[];
1175
- requestTime?: number;
1176
- responseSize?: number;
1177
- }
1178
- /**
1179
- * Interface representing a price data transfer object from the API.
1180
- * @hidden
1181
- */
1182
- interface IPriceDTO {
1183
- id: IPriceId;
1184
- name: string;
1185
- }
1186
- /**
1187
- * Type representing blurred image data.
1188
- * @hidden
1189
- */
1190
- type IBlurred = {
1191
- data: string;
1192
- shrink_factor: number;
1193
- size: number;
1194
- status: string;
1195
- };
1196
- /**
1197
- * Type representing a PNG image loaded from a URL.
1198
- * @hidden
1199
- */
1200
- type IPngFromUrl = {
1201
- height: number;
1202
- size: number;
1203
- width: number;
1204
- path: string;
1205
- status: string;
1206
- };
1207
- /**
1208
- * Interface representing PNG background images in different resolutions.
1209
- * @hidden
1210
- */
1211
- interface IPngBackgroundDTO {
1212
- blurred: IBlurred;
1213
- preview: IPngFromUrl;
1214
- full: IPngFromUrl;
1215
- }
1216
-
1217
- /**
1218
- * Settings for the BookingApiClient.
1219
- * @hidden
1220
- */
1221
- interface IBookingApiClientSettings {
1222
- baseUrl: string;
1223
- publicKey: string;
1224
- }
1225
- /**
1226
- * Metrics for API requests.
1227
- * @hidden
1228
- */
1229
- interface RequestMetrics {
1230
- data?: string;
1231
- requestTime: number;
1232
- responseSize: number;
1233
- }
1234
- /**
1235
- * API client for fetching schema and price data from the booking API.
1236
- * @hidden
1237
- */
1238
- declare class BookingApiClient {
1239
- private settings;
1240
- constructor(settings: IBookingApiClientSettings);
1150
+ onSectionClick?: (section: ISection) => void;
1241
1151
  /**
1242
- * Returns schema data
1243
- * @param schemaId Schema ID
1152
+ * Fires before the zoom animation started.
1244
1153
  */
1245
- fetchSchema(schemaId: number): Promise<ISchemaDTO>;
1154
+ onZoomStart?: (newZoom: number, oldZoom: number) => void;
1246
1155
  /**
1247
- * Returns schema data
1248
- * @param venueId Venue GUID
1156
+ * Fires after the zoom animation ended.
1249
1157
  */
1250
- fetchSchemaForVenue(venueId: string): Promise<Omit<IVenueDTO, 'seatmap'>>;
1158
+ onZoomEnd?: (newZoom: number, oldZoom?: number) => void;
1251
1159
  /**
1252
- * Returns schema data
1253
- * @param eventId Event GUID
1160
+ * Fires when component full redrawing starts.
1254
1161
  */
1255
- fetchSchemaForEvent(eventId: string): Promise<ISchemaDTO>;
1256
- private unpackSchemaDTO;
1162
+ onRedrawStart?: () => void;
1257
1163
  /**
1258
- * Return prices information
1259
- * @param eventId Event GUID
1164
+ * Fires when component full redrawing ends.
1260
1165
  */
1261
- fetchPricesForEvent(eventId: string): Promise<IPriceListDTO>;
1166
+ onRedrawEnd?: () => void;
1262
1167
  /**
1263
- * Return rows SVG information
1264
- * @param eventId Event GUID
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.
1265
1175
  */
1266
- fetchRowsSvgForEvent(eventId: string): Promise<RequestMetrics>;
1176
+ onSchemaDataLoaded?: () => void;
1267
1177
  /**
1268
- * Makes request to booking API
1269
- * @param url Relative API endpoint URL, e.g. 'event/prices/?id=XXX'
1178
+ * Fires while panning.
1270
1179
  */
1271
- request<T>(url: string): Promise<T>;
1180
+ onPan?: (delta: IPoint, isFinish?: boolean) => void;
1272
1181
  /**
1273
- * Makes request to booking API
1274
- * @param url Relative API endpoint URL, e.g. 'event/prices/?id=XXX'
1182
+ * Fires after seat selection was updated.
1275
1183
  */
1276
- requestPlain<T extends RequestMetrics>(url: string): Promise<any>;
1277
- private restoreSeats;
1278
- private restoreIds;
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;
1279
1278
  }
1280
1279
 
1281
1280
  /**
@@ -1854,7 +1853,7 @@ declare class Renderer implements IRenderer {
1854
1853
  */
1855
1854
  getSeatSelection(): IExtendedSeat[];
1856
1855
  setSectionSelection(sections?: number[] | string[]): void;
1857
- getSvgSectionBySelection(): ISectorDTO[];
1856
+ getSvgSectionBySelection(): IBaseSector[];
1858
1857
  disableSvgSectionsByIds(ids: number[], options?: {
1859
1858
  resetAll?: boolean;
1860
1859
  }): void;
@@ -2205,4 +2204,4 @@ declare class SeatmapBookingRenderer extends Renderer {
2205
2204
 
2206
2205
  declare const mergeSettings: <TSettings extends IRendererSettings>(defaults: IRendererSettings, settings?: TSettings | undefined) => IRendererSettings & TSettings;
2207
2206
 
2208
- export { BookingApiClient, type ById, type DestEvent, DestEventType, type IAdminRendererSettings, type IBaseSeat, type IBaseSector, type IBeforeSeatDrawEvent, type IBookingRendererSettings, type ICart, type ICartGa, type ICartSeat, type IClickSrcEvent, type IDragEndSrcEvent, type IDragMoveSrcEvent, type IDragStartSrcEvent, type IExtendedSeat, type IMouseMoveSrcEvent, type IPoint, type IPriceId, type IPriceListDTO, type IRemovedCartGa, type IRenderer, type IRendererMachineContext, type IRendererSeatStyleSettings, type IRendererSettings, type IRendererSvgSectionStylesSetting, type IRendererTheme, type IRowDTO, type ISchemaDTO, type ISeat, type ISeatDTO, type ISeatPriceScheme, type ISeatStyle, type ISection, type ISectionRect, type ISectionWithCoords, type ISector, type ISectorDTO, type ISpecialState, type ISvgSectionStyle, Renderer, type RendererMachine, type RendererMachineReducer, type RendererMachineService, RendererSelectMode, RendererTargetType, type SeatFilter, type SeatInteractionState, SeatmapAdminRenderer, SeatmapBookingRenderer, type SrcEvent, SrcEventType, type TransformArray, mergeSettings };
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 };