@seatmap.pro/renderer 0.0.4 → 0.0.6

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,170 +1,415 @@
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
131
- */
132
- /**
219
+ * Type representing blurred image data.
133
220
  * @hidden
134
221
  */
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"
147
- }
222
+ type IBlurred = {
223
+ data: string;
224
+ shrink_factor: number;
225
+ size: number;
226
+ status: string;
227
+ };
148
228
  /**
229
+ * Type representing a PNG image loaded from a URL.
149
230
  * @hidden
150
231
  */
151
- type DestEvent = IPanDestEvent | IRectSelectDestEvent | IPanZoomDestEvent | IDeselectDestEvent | ISeatSelectDestEvent | ISeatCartSwitchDestEvent | ISectionClickDestEvent | ISeatMouseEnterDestEvent | ISectionMouseEnterDestEvent | ISeatMouseLeaveDestEvent | ISectionMouseLeaveDestEvent;
232
+ type IPngFromUrl = {
233
+ height: number;
234
+ size: number;
235
+ width: number;
236
+ path: string;
237
+ status: string;
238
+ };
152
239
  /**
240
+ * Interface representing PNG background images in different resolutions.
153
241
  * @hidden
154
242
  */
155
- interface IPanDestEvent {
156
- type: DestEventType.PAN;
157
- isStart?: boolean;
158
- isFinish?: boolean;
159
- delta: {
160
- x: number;
161
- y: number;
162
- };
243
+ interface IPngBackgroundDTO {
244
+ blurred: IBlurred;
245
+ preview: IPngFromUrl;
246
+ full: IPngFromUrl;
163
247
  }
248
+
164
249
  /**
250
+ * Settings for the BookingApiClient.
165
251
  * @hidden
166
252
  */
167
- interface IRectSelectDestEvent {
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 {
168
413
  type: DestEventType.RECT_SELECT;
169
414
  selectMode: RendererSelectMode;
170
415
  isStart?: boolean;
@@ -828,454 +1073,143 @@ interface IRendererSettings {
828
1073
  *
829
1074
  * @deprecated
830
1075
  * 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 {
1076
+ */
1077
+ onSectorClick?: (section: ISection) => void;
1140
1078
  /**
1141
- * The name or label of the special price option.
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).
1142
1084
  */
1143
- name: string;
1085
+ onSectionClick?: (section: ISection) => void;
1144
1086
  /**
1145
- * The unique identifier for this price option.
1087
+ * Fires before the zoom animation started.
1146
1088
  */
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 {
1089
+ onZoomStart?: (newZoom: number, oldZoom: number) => void;
1154
1090
  /**
1155
- * Special state flag 1, used for custom state indicators.
1091
+ * Fires after the zoom animation ended.
1156
1092
  */
1157
- s1?: number;
1093
+ onZoomEnd?: (newZoom: number, oldZoom?: number) => void;
1158
1094
  /**
1159
- * Array of special prices associated with this item.
1095
+ * Fires when component full redrawing starts.
1160
1096
  */
1161
- prices?: ISpecialPrice[];
1097
+ onRedrawStart?: () => void;
1162
1098
  /**
1163
- * Category identifier for grouping items with similar special states.
1099
+ * Fires when component full redrawing ends.
1164
1100
  */
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);
1101
+ onRedrawEnd?: () => void;
1241
1102
  /**
1242
- * Returns schema data
1243
- * @param schemaId Schema ID
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.
1244
1110
  */
1245
- fetchSchema(schemaId: number): Promise<ISchemaDTO>;
1111
+ onSchemaDataLoaded?: () => void;
1246
1112
  /**
1247
- * Returns schema data
1248
- * @param venueId Venue GUID
1113
+ * Fires while panning.
1249
1114
  */
1250
- fetchSchemaForVenue(venueId: string): Promise<Omit<IVenueDTO, 'seatmap'>>;
1115
+ onPan?: (delta: IPoint, isFinish?: boolean) => void;
1251
1116
  /**
1252
- * Returns schema data
1253
- * @param eventId Event GUID
1117
+ * Fires after seat selection was updated.
1254
1118
  */
1255
- fetchSchemaForEvent(eventId: string): Promise<ISchemaDTO>;
1256
- private unpackSchemaDTO;
1119
+ onSeatSelectionChange?: () => void;
1257
1120
  /**
1258
- * Return prices information
1259
- * @param eventId Event GUID
1121
+ * Fires after seats selection was updated.
1260
1122
  */
1261
- fetchPricesForEvent(eventId: string): Promise<IPriceListDTO>;
1123
+ onSeatsSelectionChange?: (seats: ISeat[]) => void;
1262
1124
  /**
1263
- * Return rows SVG information
1264
- * @param eventId Event GUID
1125
+ * You can control seats' styling by returning custom style for each seat
1265
1126
  */
1266
- fetchRowsSvgForEvent(eventId: string): Promise<RequestMetrics>;
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 {
1267
1140
  /**
1268
- * Makes request to booking API
1269
- * @param url Relative API endpoint URL, e.g. 'event/prices/?id=XXX'
1141
+ * The seat being drawn.
1270
1142
  */
1271
- request<T>(url: string): Promise<T>;
1143
+ seat: ISeat;
1272
1144
  /**
1273
- * Makes request to booking API
1274
- * @param url Relative API endpoint URL, e.g. 'event/prices/?id=XXX'
1145
+ * The current interaction state of the seat.
1275
1146
  */
1276
- requestPlain<T extends RequestMetrics>(url: string): Promise<any>;
1277
- private restoreSeats;
1278
- private restoreIds;
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;
1279
1213
  }
1280
1214
 
1281
1215
  /**
@@ -1854,7 +1788,7 @@ declare class Renderer implements IRenderer {
1854
1788
  */
1855
1789
  getSeatSelection(): IExtendedSeat[];
1856
1790
  setSectionSelection(sections?: number[] | string[]): void;
1857
- getSvgSectionBySelection(): ISectorDTO[];
1791
+ getSvgSectionBySelection(): IBaseSector[];
1858
1792
  disableSvgSectionsByIds(ids: number[], options?: {
1859
1793
  resetAll?: boolean;
1860
1794
  }): void;
@@ -1975,6 +1909,19 @@ interface IAdminRendererSettings extends IRendererSettings {
1975
1909
  */
1976
1910
  env?: string;
1977
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
+ }
1978
1925
  /**
1979
1926
  * Admin Renderer class for seatmap administration.
1980
1927
  * Extends the base Renderer with admin-specific functionality.
@@ -2121,6 +2068,49 @@ interface IBookingRendererSettings extends IRendererSettings {
2121
2068
  */
2122
2069
  backgroundLoadStepTime?: number;
2123
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
+ }
2124
2114
  /**
2125
2115
  * Booking Renderer class for seatmap booking.
2126
2116
  * Extends the base Renderer with booking-specific functionality.
@@ -2205,4 +2195,4 @@ declare class SeatmapBookingRenderer extends Renderer {
2205
2195
 
2206
2196
  declare const mergeSettings: <TSettings extends IRendererSettings>(defaults: IRendererSettings, settings?: TSettings | undefined) => IRendererSettings & TSettings;
2207
2197
 
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 };
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 };