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