@seatmap.pro/renderer 1.55.2 → 1.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,104 @@
1
+ # @seatmap.pro/renderer
2
+
3
+ A powerful and flexible interactive seat map renderer for event ticketing systems.
4
+
5
+ ## Overview
6
+
7
+ The Seatmap.pro Renderer is a high-performance JavaScript library for rendering interactive venue seating charts. It provides a complete solution for displaying, selecting, and managing seats for events, concerts, theaters, sports venues, and more.
8
+
9
+ ## Features
10
+
11
+ - Interactive seat selection and deselection
12
+ - Support for general admission areas
13
+ - Customizable seat and section styling
14
+ - Zoom and pan functionality
15
+ - Mobile-friendly with touch support
16
+ - High performance rendering using Canvas/WebGL
17
+ - Comprehensive event system for integration with ticketing platforms
18
+ - Accessibility features
19
+
20
+ ## Installation
21
+
22
+ ```bash
23
+ npm install @seatmap.pro/renderer
24
+ ```
25
+
26
+ or
27
+
28
+ ```bash
29
+ yarn add @seatmap.pro/renderer
30
+ ```
31
+
32
+ ## Basic Usage
33
+
34
+ ```javascript
35
+ import { SeatmapBookingRenderer } from '@seatmap.pro/renderer';
36
+
37
+ // Create a new renderer instance
38
+ const renderer = new SeatmapBookingRenderer({
39
+ container: document.getElementById('seatmap-container'),
40
+ onSeatSelect: (seat) => {
41
+ console.log('Seat selected:', seat);
42
+ },
43
+ onSchemaDataLoaded: () => {
44
+ console.log('Schema data loaded successfully');
45
+ }
46
+ });
47
+
48
+ // Load event data
49
+ renderer.loadEvent(eventId);
50
+ ```
51
+
52
+ ## Checking Version
53
+
54
+ You can check the library version in several ways:
55
+
56
+ ### Script Tag (Standalone Bundle)
57
+
58
+ ```html
59
+ <script src="seatmap-booking-renderer.js"></script>
60
+ <script>
61
+ console.log(SeatmapBookingRenderer.VERSION);
62
+ </script>
63
+ ```
64
+
65
+ ### NPM Module
66
+
67
+ ```javascript
68
+ import { SeatmapBookingRenderer, VERSION } from '@seatmap.pro/renderer';
69
+
70
+ console.log(VERSION);
71
+ // or
72
+ console.log(SeatmapBookingRenderer.VERSION);
73
+ ```
74
+
75
+ ### Instance Method
76
+
77
+ ```javascript
78
+ const renderer = new SeatmapBookingRenderer(element, settings);
79
+ console.log(renderer.getVersion());
80
+ ```
81
+
82
+ ## Documentation
83
+
84
+ For detailed documentation, visit our:
85
+
86
+ - [Knowledge Base](https://seatmap.pro/knowledge-base/) - Complete documentation for all Seatmap.pro components
87
+ - [Renderer Specification](https://seatmap.pro/knowledge-base/renderer/spec/) - Detailed API reference for the renderer
88
+ - [API Documentation](https://seatmap.pro/knowledge-base/api/v2/) - Additional API documentation
89
+
90
+ ## Examples
91
+
92
+ Check out our [examples page](https://seatmap.pro/knowledge-base/renderer/sdk/) for implementation samples.
93
+
94
+ ## Product Website
95
+
96
+ For more information, pricing, and demos, visit [https://seatmap.pro](https://seatmap.pro).
97
+
98
+ ## License
99
+
100
+ This package is licensed under a commercial license. Please contact [support@seatmap.pro](mailto:support@seatmap.pro) for licensing information.
101
+
102
+ ## Support
103
+
104
+ For support, please contact [support@seatmap.pro](mailto:support@seatmap.pro) or visit our [support portal](https://support.seatmap.pro).
package/lib/index.d.ts CHANGED
@@ -1147,6 +1147,62 @@ interface IMinimapSettings {
1147
1147
  */
1148
1148
  showCartPins?: boolean;
1149
1149
  }
1150
+ /**
1151
+ * Loading phase identifiers for progress tracking.
1152
+ */
1153
+ type LoadingPhase = 'schema' | 'prices' | 'rows' | 'background-blurred' | 'background-preview' | 'background-full' | 'processing';
1154
+ /**
1155
+ * Progress event data passed to onLoadProgress callback.
1156
+ */
1157
+ interface ILoadProgressEvent {
1158
+ phase: LoadingPhase;
1159
+ progress: number;
1160
+ isIndeterminate: boolean;
1161
+ message: string;
1162
+ }
1163
+ /**
1164
+ * Background image loaded event data.
1165
+ * @hidden
1166
+ */
1167
+ interface IBackgroundImageLoadedEvent {
1168
+ type: 'blurred' | 'preview' | 'full';
1169
+ loadTimeMs: number;
1170
+ sizeBytes?: number;
1171
+ }
1172
+ /**
1173
+ * Loader display style.
1174
+ */
1175
+ type LoaderStyle = 'overlay' | 'top-bar';
1176
+ /**
1177
+ * Loader theme configuration.
1178
+ */
1179
+ interface ILoaderTheme {
1180
+ overlayColor?: string;
1181
+ overlayOpacity?: number;
1182
+ progressBarColor?: string;
1183
+ progressBarBackgroundColor?: string;
1184
+ progressBarHeight?: number;
1185
+ textColor?: string;
1186
+ fontSize?: number;
1187
+ }
1188
+ /**
1189
+ * Loader configuration settings.
1190
+ */
1191
+ interface ILoaderSettings {
1192
+ enabled: boolean;
1193
+ style?: LoaderStyle;
1194
+ theme?: ILoaderTheme;
1195
+ showText?: boolean;
1196
+ texts?: {
1197
+ schema?: string;
1198
+ prices?: string;
1199
+ rows?: string;
1200
+ backgroundBlurred?: string;
1201
+ backgroundPreview?: string;
1202
+ backgroundFull?: string;
1203
+ processing?: string;
1204
+ };
1205
+ }
1150
1206
  /**
1151
1207
  * Configuration settings for the renderer.
1152
1208
  * Defines various options that control the behavior and appearance of the renderer.
@@ -1162,6 +1218,12 @@ interface IRendererSettings {
1162
1218
  * Can be 'local', 'stage', or 'production' (default).
1163
1219
  */
1164
1220
  env?: string;
1221
+ /**
1222
+ * Base URL prefix for background images.
1223
+ * Used to resolve relative image paths to absolute URLs.
1224
+ * Absolute URLs (starting with http://, https://, or data:) are used as-is.
1225
+ */
1226
+ backgroundImageBaseUrl?: string;
1165
1227
  /**
1166
1228
  * External price information for seats.
1167
1229
  */
@@ -1261,6 +1323,11 @@ interface IRendererSettings {
1261
1323
  * Minimap configuration settings.
1262
1324
  */
1263
1325
  minimap?: IMinimapSettings;
1326
+ /**
1327
+ * Loader configuration settings.
1328
+ * Controls the loading overlay with progress bar during event loading.
1329
+ */
1330
+ loader?: ILoaderSettings;
1264
1331
  /**
1265
1332
  * Option to configure zoom settings
1266
1333
  */
@@ -1388,6 +1455,24 @@ interface IRendererSettings {
1388
1455
  * schema being fully initialized.
1389
1456
  */
1390
1457
  onSchemaDataLoaded?: () => void;
1458
+ /**
1459
+ * Fires during loading to report progress.
1460
+ *
1461
+ * @remarks
1462
+ *
1463
+ * Progress event contains phase, progress percentage (0-100),
1464
+ * whether the phase is indeterminate, and a status message.
1465
+ */
1466
+ onLoadProgress?: (event: ILoadProgressEvent) => void;
1467
+ /**
1468
+ * Fires when a background image has been loaded.
1469
+ *
1470
+ * @remarks
1471
+ *
1472
+ * Provides the image type (blurred, preview, full), load time in ms, and size in bytes.
1473
+ * @hidden
1474
+ */
1475
+ onBackgroundImageLoaded?: (event: IBackgroundImageLoadedEvent) => void;
1391
1476
  /**
1392
1477
  * Fires while panning.
1393
1478
  */
@@ -1592,6 +1677,43 @@ declare class OutlineLayer {
1592
1677
  appendRowsOverlay(rowsFragment: string, css?: string): void;
1593
1678
  }
1594
1679
 
1680
+ interface IRendererZoomControls {
1681
+ zoomToFit: () => void;
1682
+ getSectionsWithCoords: () => ISectionWithCoords[];
1683
+ }
1684
+ interface ISectionTransform {
1685
+ rotationAngle: number;
1686
+ center: IPoint;
1687
+ top: IPoint;
1688
+ section: IPoint;
1689
+ skewAngle: number;
1690
+ }
1691
+
1692
+ interface IStageLayer {
1693
+ destroy: () => void;
1694
+ backgroundElement: HTMLImageElement;
1695
+ redraw: () => void;
1696
+ drawOffscreenCanvas: () => void;
1697
+ drawOnscreenCanvas: (scale: number, translate: IPoint) => void;
1698
+ getVisibleSeats: () => any[];
1699
+ updateSize: () => void;
1700
+ sectionViewActive: boolean;
1701
+ getAnimationState: () => {
1702
+ inProgress: boolean;
1703
+ rotationAngle: number;
1704
+ skewAngle: number;
1705
+ duration: number;
1706
+ };
1707
+ applySectionViewAnimation: (section: ISectionWithCoords, options: IRendererZoomControls) => Promise<boolean>;
1708
+ getAnimationPoint: () => IPoint;
1709
+ sectionViewTransform: ISectionTransform;
1710
+ /**
1711
+ * Captures a snapshot of the full seatmap (background-sized) for use in minimap.
1712
+ * Should resolve after the first full render finishes.
1713
+ */
1714
+ captureSeatmap: () => Promise<HTMLImageElement | null>;
1715
+ }
1716
+
1595
1717
  /**
1596
1718
  * @hidden
1597
1719
  */
@@ -1882,10 +2004,11 @@ declare class Renderer implements IRenderer {
1882
2004
  private width;
1883
2005
  private padding;
1884
2006
  protected readonly context: Context;
1885
- private stageLayer;
2007
+ protected stageLayer: IStageLayer;
1886
2008
  private selectionLayer;
1887
2009
  protected outlineLayer: OutlineLayer;
1888
2010
  private minimapLayer?;
2011
+ private loaderLayer?;
1889
2012
  private service;
1890
2013
  private zoomToFitScale;
1891
2014
  private isTouchMode;
@@ -1930,6 +2053,9 @@ declare class Renderer implements IRenderer {
1930
2053
  * @returns The version string
1931
2054
  */
1932
2055
  getVersion(): string;
2056
+ protected showLoader(): void;
2057
+ protected updateLoaderProgress(phase: LoadingPhase, phaseProgress?: number): void;
2058
+ protected completeLoader(): void;
1933
2059
  /**
1934
2060
  * Sets the interaction mode for the renderer.
1935
2061
  *
@@ -2462,6 +2588,7 @@ interface IAdminRendererSettings extends IRendererSettings {
2462
2588
  * Extends the base Renderer with admin-specific functionality.
2463
2589
  */
2464
2590
  declare class SeatmapAdminRenderer extends Renderer {
2591
+ static readonly VERSION = "1.57.0";
2465
2592
  protected apiClient: BookingApiClient;
2466
2593
  /**
2467
2594
  * Creates a new instance of the AdminRenderer.
@@ -2615,9 +2742,12 @@ interface IBookingRendererSettings extends IRendererSettings {
2615
2742
  * Extends the base Renderer with booking-specific functionality.
2616
2743
  */
2617
2744
  declare class SeatmapBookingRenderer extends Renderer {
2745
+ static readonly VERSION = "1.57.0";
2618
2746
  private apiClient;
2619
2747
  private stats;
2620
- private tags;
2748
+ private tags?;
2749
+ private lastSentViewBox?;
2750
+ private debugOverlay?;
2621
2751
  /**
2622
2752
  * Creates a new instance of the SeatmapBookingRenderer.
2623
2753
  *
@@ -2634,7 +2764,7 @@ declare class SeatmapBookingRenderer extends Renderer {
2634
2764
  *
2635
2765
  * @throws {Error} Throws an error if the public key is undefined
2636
2766
  */
2637
- constructor(element: HTMLElement, settings?: IBookingRendererSettings, tags?: any);
2767
+ constructor(element: HTMLElement, settings?: IBookingRendererSettings, tags?: Record<string, string | number | boolean>);
2638
2768
  /**
2639
2769
  * Gets the current view box properties.
2640
2770
  *
@@ -2642,11 +2772,13 @@ declare class SeatmapBookingRenderer extends Renderer {
2642
2772
  * @private
2643
2773
  */
2644
2774
  private getViewBox;
2775
+ private hasViewBoxChanged;
2645
2776
  /**
2646
2777
  * Loads event's schema and prices.
2647
2778
  *
2648
2779
  * Fetches the schema, prices, and row SVG data for the specified event.
2649
- * Initializes analytics tracking and sets up event handlers for user interactions.
2780
+ * Uses progressive loading: renders schema immediately with disabled interactions,
2781
+ * then enables interactions when prices arrive.
2650
2782
  *
2651
2783
  * @example
2652
2784
  * ```js
@@ -2668,9 +2800,11 @@ declare class SeatmapBookingRenderer extends Renderer {
2668
2800
  *
2669
2801
  * @param eventId - Event GUID to load
2670
2802
  * @param sectorId - Optional sector ID to show only a specific sector
2671
- * @returns A promise that resolves when the data fetching is completed
2803
+ * @returns A promise that resolves when the schema is loaded and rendered
2672
2804
  */
2673
2805
  loadEvent(eventId: string, sectorId?: number): Promise<void>;
2806
+ private handlePricesLoaded;
2807
+ private setupEventHandlers;
2674
2808
  /**
2675
2809
  * Creates a statistics data object for seat selection/deselection events.
2676
2810
  *
@@ -2696,7 +2830,7 @@ declare class SeatmapBookingRenderer extends Renderer {
2696
2830
  * Package version information
2697
2831
  * This file is automatically updated during the build process
2698
2832
  */
2699
- declare const VERSION = "1.55.2";
2833
+ declare const VERSION = "1.57.0";
2700
2834
 
2701
2835
  declare const defaultZoomSettings: IZoomSettings;
2702
2836
  declare const mergeSettings: (defaults: IRendererSettings, settings?: Partial<IRendererSettings>) => IRendererSettings & Partial<IRendererSettings>;
@@ -2739,4 +2873,4 @@ declare class RotationAnimation {
2739
2873
  getAnimation(): IRotationAnimation | null;
2740
2874
  }
2741
2875
 
2742
- export { BookingApiClient, type ById, type ColorById, type ColorSequenceSettings, type DeepPartial, type DestEvent, DestEventType, type IAdminRendererSettings, type IBaseSeat, type IBaseSector, type IBasicSeatStyle, 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 IMinimapSettings, 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 IRendererAnimation, 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, type IVisibilitySettings, type IZoomSettings, type MinimapPosition, type Nullable, Renderer, type RendererMachine, type RendererMachineReducer, type RendererMachineService, RendererSelectMode, RendererTargetType, RotationAnimation, type SeatFilter, type SeatInteractionState, SeatmapAdminRenderer, SeatmapBookingRenderer, type SrcEvent, SrcEventType, type TransformArray, VERSION, convertPricesToColored, convertPricesToColoredById, defaultZoomSettings, mergeSettings, sortPrices };
2876
+ export { BookingApiClient, type ById, type ColorById, type ColorSequenceSettings, type DeepPartial, type DestEvent, DestEventType, type IAdminRendererSettings, type IBackgroundImageLoadedEvent, type IBaseSeat, type IBaseSector, type IBasicSeatStyle, 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 ILoadProgressEvent, type ILoaderSettings, type ILoaderTheme, type IMinimapSettings, 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 IRendererAnimation, 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, type IVisibilitySettings, type IZoomSettings, type LoaderStyle, type LoadingPhase, type MinimapPosition, type Nullable, Renderer, type RendererMachine, type RendererMachineReducer, type RendererMachineService, RendererSelectMode, RendererTargetType, type RequestMetrics, RotationAnimation, type SeatFilter, type SeatInteractionState, SeatmapAdminRenderer, SeatmapBookingRenderer, type SrcEvent, SrcEventType, type TransformArray, VERSION, convertPricesToColored, convertPricesToColoredById, defaultZoomSettings, mergeSettings, sortPrices };