@seatsio/seatsio-types 2.9.0 → 3.1.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.
Files changed (2) hide show
  1. package/dist/index.d.ts +60 -40
  2. package/package.json +5 -1
package/dist/index.d.ts CHANGED
@@ -113,7 +113,7 @@ export interface ChartRendererConfigOptions extends DeprecatedConfigProperties,
113
113
  * @param ticketType The ticket type for which the user clicked on the plus button. Optional.
114
114
  * {@link https://docs.seats.io/docs/renderer/config-cangaselectionbeincreased See documentation}
115
115
  */
116
- canGASelectionBeIncreased?: (gaArea: GeneralAdmissionAreaProps, defaultValue: boolean, extraConfig: ExtraConfig, ticketType?: TicketTypeJson) => boolean;
116
+ canGASelectionBeIncreased?: (gaArea: GeneralAdmissionArea, defaultValue: boolean, extraConfig: ExtraConfig, ticketType?: TicketTypeJson) => boolean;
117
117
  /**
118
118
  * If your chart div is enclosed within a <form>element, you can use this configuration option to automatically add the selected seat IDs to the form data. This is one of the ways you can pass the selected seats to your server, so that you can book them later on through the Seats API.
119
119
  * {@link https://docs.seats.io/docs/renderer/config-selectedobjectsinputname See documentation}
@@ -132,7 +132,7 @@ export interface ChartRendererConfigOptions extends DeprecatedConfigProperties,
132
132
  /**
133
133
  * A function whose result will be displayed as extra information on the cursor tooltip. {@link https://docs.seats.io/docs/renderer/config-tooltipinfo See documentation}
134
134
  */
135
- tooltipInfo?: <T extends SelectableObjectProps>(object: T) => string;
135
+ tooltipInfo?: (object: SelectableObject) => string;
136
136
  /**
137
137
  * On mobile, when displaying a chart with sections, a tooltip is shown at the bottom of the screen with the section name and pricing.
138
138
  * You can hide this tooltip on mobile by passing `showActiveSectionTooltipOnMobile: false`.
@@ -165,8 +165,8 @@ export interface ChartRendererConfigOptions extends DeprecatedConfigProperties,
165
165
  * Leaves the specified categories normally visible, while making all others dimmed out. The array can be a list of category IDs or labels.
166
166
  */
167
167
  filteredCategories?: CategoryKey[];
168
- objectColor?: (object: SelectableObjectProps, defaultColor: string, extraConfig: ExtraConfig) => string;
169
- objectLabel?: (object: SelectableObjectProps, defaultLabel: string, extraConfig: ExtraConfig) => string;
168
+ objectColor?: (object: SelectableObject, defaultColor: string, extraConfig: ExtraConfig) => string;
169
+ objectLabel?: (object: SelectableObject, defaultLabel: string, extraConfig: ExtraConfig) => string;
170
170
  /**
171
171
  * @param object
172
172
  * @param defaultIcon
@@ -174,8 +174,8 @@ export interface ChartRendererConfigOptions extends DeprecatedConfigProperties,
174
174
  * @returns A string with the name of a FontAwesome v4.7.0 icon. {@link https://fontawesome.com/v4.7.0/icons/ See the full list of available icons}.
175
175
  * For more details, {@link https://docs.seats.io/docs/renderer/config-objecticon see the documentation}.
176
176
  */
177
- objectIcon?: (object: SelectableObjectProps, defaultIcon: string | null, extraConfig?: ExtraConfig) => string;
178
- sectionColor?: (section: SectionProps, defaultColor: string, extraConfig: ExtraConfig) => string;
177
+ objectIcon?: (object: SelectableObject, defaultIcon: string | null, extraConfig?: ExtraConfig) => string;
178
+ sectionColor?: (section: Section, defaultColor: string, extraConfig: ExtraConfig) => string;
179
179
  /**
180
180
  * This setting allows you specify when section contents (rows of seats, tables, etc) should be shown. Only available on charts with sections. {@link https://docs.seats.io/docs/renderer/config-showsectioncontents See documentation}
181
181
  * @default 'always'
@@ -184,7 +184,7 @@ export interface ChartRendererConfigOptions extends DeprecatedConfigProperties,
184
184
  /**
185
185
  * A function that should return true if an object is visible, and false otherwise. When an object is invisible, it can't be selected or interacted with. {@link https://docs.seats.io/docs/renderer/config-isobjectvisible See documentation}
186
186
  */
187
- isObjectVisible?: (object: SelectableObjectProps, extraConfig: ExtraConfig) => boolean;
187
+ isObjectVisible?: (object: SelectableObject, extraConfig: ExtraConfig) => boolean;
188
188
  /**
189
189
  * Set to true to show seat labels in your chart.
190
190
  * @deault false
@@ -366,7 +366,7 @@ export interface EventManagerSelectModeConfigOptions extends BaseEventManagerCon
366
366
  * @returns A string with the name of a FontAwesome v4.7.0 icon. {@link https://fontawesome.com/v4.7.0/icons/ See the full list of available icons}.
367
367
  * For more details, {@link https://docs.seats.io/docs/event-manager/modes/select#objecticon see the documentation}.
368
368
  */
369
- objectIcon?: (object: SelectableObjectProps, defaultIcon: string | null, extraConfig?: ExtraConfig) => string;
369
+ objectIcon?: (object: SelectableObject, defaultIcon: string | null, extraConfig?: ExtraConfig) => string;
370
370
  objectTooltip?: {
371
371
  showOrderId?: boolean;
372
372
  showTechnicalLabel?: boolean;
@@ -378,12 +378,15 @@ export interface EventManagerSelectModeConfigOptions extends BaseEventManagerCon
378
378
  }
379
379
  export interface EventManagerStaticModeConfigOptions extends BaseEventManagerConfigOptions, WithEvents {
380
380
  mode: 'static';
381
- onObjectMouseOver?: (object: SelectableObjectProps) => void;
382
- onObjectMouseOut?: (object: SelectableObjectProps) => void;
381
+ onObjectMouseOver?: (object: SelectableObject) => void;
382
+ onObjectMouseOut?: (object: SelectableObject) => void;
383
383
  tooltipContents?: (object: object) => string;
384
384
  }
385
385
  export type EventManagerConfigOptions = EventManagerManageObjectStatusesModeConfigOptions | EventManagerManageChannelsModeConfigOptions | EventManagerManageCategoriesModeConfigOptions | EventManagerSelectModeConfigOptions | EventManagerFilterSectionsModeConfigOptions | EventManagerStaticModeConfigOptions | (BaseEventManagerConfigOptions & WithEvent);
386
- export interface ChartDesignerConfigOptions {
386
+ export type ChartDesignerConfigOptions = ChartDesignerNormalModeConfigOptions | ChartDesignerReadOnlyModeConfigOptions | ChartDesignerSafeModeConfigOptions;
387
+ export type ChartDesignerMode = 'normal' | 'readOnly' | 'safe';
388
+ export interface BaseChartDesignerConfigOptions {
389
+ mode?: ChartDesignerMode;
387
390
  canvasColorScheme?: 'auto' | 'light' | 'dark';
388
391
  chartKey?: string;
389
392
  container?: Element;
@@ -400,7 +403,6 @@ export interface ChartDesignerConfigOptions {
400
403
  * Documentation: {@link https://docs.seats.io/docs/embedded-designer/configuration-language}
401
404
  */
402
405
  language?: 'de' | 'en' | 'es' | 'fr' | 'pt';
403
- mode?: 'normal' | 'safe' | 'readOnly';
404
406
  onChartCreated?: (chartKey: string) => void;
405
407
  onChartPublished?: (chartKey: string) => void;
406
408
  onChartUpdated?: (chartKey: string) => void;
@@ -411,6 +413,18 @@ export interface ChartDesignerConfigOptions {
411
413
  openLatestDrawing?: boolean;
412
414
  secretKey: string;
413
415
  }
416
+ export interface ChartDesignerNormalModeConfigOptions extends BaseChartDesignerConfigOptions {
417
+ mode?: 'normal';
418
+ }
419
+ export interface ChartDesignerReadOnlyModeConfigOptions extends BaseChartDesignerConfigOptions {
420
+ mode: 'readOnly';
421
+ }
422
+ export interface ChartDesignerSafeModeConfigOptions extends BaseChartDesignerConfigOptions {
423
+ mode: 'safe';
424
+ safeModeOptions?: {
425
+ allowDeletingObjects?: boolean;
426
+ };
427
+ }
414
428
  export interface ChartDesignerFeatures {
415
429
  'tables.bookAsAWhole'?: boolean;
416
430
  areas?: boolean;
@@ -460,18 +474,18 @@ export type ChartRendererCallbacks = {
460
474
  onFloorChanged?: (floor?: Floor) => void;
461
475
  onFullScreenClosed?: () => void;
462
476
  onFullScreenOpened?: () => void;
463
- onHoldFailed?: (objects: BookableObjectProps[], ticketTypes: TicketTypeJson[]) => void;
464
- onHoldSucceeded?: (objects: BookableObjectProps[], ticketTypes: TicketTypeJson[]) => void;
477
+ onHoldFailed?: (objects: BookableObject[], ticketTypes: TicketTypeJson[]) => void;
478
+ onHoldSucceeded?: (objects: BookableObject[], ticketTypes: TicketTypeJson[]) => void;
465
479
  onHoldTokenExpired?: () => void;
466
- onObjectClicked?: (object: SelectableObjectProps) => void;
467
- onObjectDeselected?: (object: BookableObjectProps, selectedTicketType: TicketTypeJson) => void;
468
- onObjectMouseOut?: (object: SelectableObjectProps) => void;
469
- onObjectMouseOver?: (object: SelectableObjectProps) => void;
470
- onObjectSelected?: (object: SelectableObjectProps, selectedTicketType: TicketTypeJson) => void;
471
- onObjectStatusChanged?: (object: BookableObjectProps) => void;
472
- onReleaseHoldFailed?: (objects: BookableObjectProps[], ticketTypes: TicketTypeJson[]) => void;
473
- onReleaseHoldSucceeded?: (objects: BookableObjectProps[], ticketTypes: TicketTypeJson[]) => void;
474
- onSelectedObjectBooked?: (object: BookableObjectProps) => void;
480
+ onObjectClicked?: (object: SelectableObject) => void;
481
+ onObjectMouseOut?: (object: SelectableObject) => void;
482
+ onObjectMouseOver?: (object: SelectableObject) => void;
483
+ onObjectSelected?: (object: SelectableObject, selectedTicketType: TicketTypeJson) => void;
484
+ onObjectDeselected?: (object: SelectableObject, selectedTicketType: TicketTypeJson) => void;
485
+ onObjectStatusChanged?: (object: BookableObject) => void;
486
+ onReleaseHoldFailed?: (objects: BookableObject[], ticketTypes: TicketTypeJson[]) => void;
487
+ onReleaseHoldSucceeded?: (objects: BookableObject[], ticketTypes: TicketTypeJson[]) => void;
488
+ onSelectedObjectBooked?: (object: BookableObject) => void;
475
489
  onSelectionInvalid?: (violations: string[]) => void;
476
490
  onSelectionValid?: () => void;
477
491
  onSessionInitialized?: (holdToken: HoldToken) => void;
@@ -753,19 +767,19 @@ interface Labels {
753
767
  section?: string;
754
768
  }
755
769
  export type PriceType = number | string;
756
- export interface InteractiveObjectProps {
770
+ export interface InteractiveObject {
757
771
  readonly label: string;
758
772
  readonly labels: Labels;
759
773
  }
760
- export interface NonBookableTableProps extends InteractiveObjectProps {
761
- readonly seats: SeatProps[];
774
+ export interface NonBookableTable extends InteractiveObject {
775
+ readonly seats: Seat[];
762
776
  readonly center: {
763
777
  x: number;
764
778
  y: number;
765
779
  };
766
780
  readonly category?: CategoryToJSON;
767
781
  }
768
- export interface NonBookableTableSeatProps extends InteractiveObjectProps {
782
+ export interface NonBookableTableSeat extends InteractiveObject {
769
783
  readonly center: {
770
784
  x: number;
771
785
  y: number;
@@ -777,7 +791,7 @@ export interface NonBookableTableSeatProps extends InteractiveObjectProps {
777
791
  type: 'row' | 'table';
778
792
  };
779
793
  }
780
- export interface SelectableObjectProps extends InteractiveObjectProps {
794
+ export interface AbstractSelectableObject extends InteractiveObject {
781
795
  readonly objectType: string;
782
796
  readonly selected: boolean;
783
797
  readonly selectedTicketType: string | undefined;
@@ -791,8 +805,8 @@ export interface SelectableObjectProps extends InteractiveObjectProps {
791
805
  select: (ticketType?: string) => Promise<void>;
792
806
  deselect: (ticketType?: string) => Promise<void>;
793
807
  }
794
- export interface SectionProps extends InteractiveObjectProps {
795
- readonly objectType: string;
808
+ export interface Section extends InteractiveObject {
809
+ readonly objectType: 'section';
796
810
  readonly numberOfSelectableObjects: number;
797
811
  readonly numberOfSelectedObjects: number;
798
812
  readonly selectableCategories: CategoryKey[];
@@ -800,10 +814,11 @@ export interface SectionProps extends InteractiveObjectProps {
800
814
  readonly isInteractive: boolean;
801
815
  readonly sectionCategory?: CategoryToJSON;
802
816
  }
803
- export interface InteractiveSectionProps extends SelectableObjectProps {
817
+ export interface InteractiveSection extends AbstractSelectableObject {
818
+ readonly objectType: 'section';
804
819
  readonly ticketListing: ListingBySection;
805
820
  }
806
- export interface BookableObjectProps extends SelectableObjectProps {
821
+ export interface AbstractBookableObject extends AbstractSelectableObject {
807
822
  /**
808
823
  * Set to one of the predefined values `free`, `reservedByToken`, `booked` or use a custom status.
809
824
  */
@@ -819,7 +834,8 @@ export interface BookableObjectProps extends SelectableObjectProps {
819
834
  */
820
835
  channel?: Channel;
821
836
  }
822
- export interface SeatProps extends BookableObjectProps {
837
+ export interface Seat extends AbstractBookableObject {
838
+ readonly objectType: 'Seat';
823
839
  readonly center: {
824
840
  x: number;
825
841
  y: number;
@@ -832,17 +848,19 @@ export interface SeatProps extends BookableObjectProps {
832
848
  pulse: () => Promise<void>;
833
849
  unpulse: () => Promise<void>;
834
850
  }
835
- export interface BoothProps extends BookableObjectProps {
851
+ export interface Booth extends AbstractBookableObject {
836
852
  readonly objectType: 'Booth';
837
853
  }
838
- export interface TableProps extends BookableObjectProps {
839
- readonly seats: NonBookableTableSeatProps[];
854
+ export interface Table extends AbstractBookableObject {
855
+ readonly objectType: 'Table';
856
+ readonly seats: NonBookableTableSeat[];
840
857
  readonly center: {
841
858
  x: number;
842
859
  y: number;
843
860
  };
844
861
  }
845
- export interface GeneralAdmissionAreaProps extends BookableObjectProps {
862
+ export interface GeneralAdmissionArea extends AbstractBookableObject {
863
+ readonly objectType: 'GeneralAdmissionArea';
846
864
  readonly numBooked: number;
847
865
  readonly capacity: number;
848
866
  readonly numFree: number;
@@ -853,17 +871,19 @@ export interface GeneralAdmissionAreaProps extends BookableObjectProps {
853
871
  readonly entrance: string | null;
854
872
  readonly bookAsAWhole: boolean;
855
873
  }
874
+ export type BookableObject = Seat | GeneralAdmissionArea | Booth | Table;
875
+ export type SelectableObject = BookableObject | InteractiveSection;
856
876
  export interface SeatingChart {
857
877
  changeConfig: (config: ConfigChange) => Promise<void>;
858
878
  clearSelection: () => Promise<void>;
859
879
  deselectCategories: (categoryIds: string[]) => Promise<void>;
860
880
  deselectObjects: (objects: (string | Selection)[]) => Promise<void>;
861
881
  destroy: () => void;
862
- findObject: <T extends SelectableObjectProps>(label: string) => Promise<T>;
882
+ findObject: (label: string) => Promise<SelectableObject>;
863
883
  getReportBySelectability: () => Promise<Object>;
864
884
  holdToken: string;
865
885
  listCategories: () => Promise<Category[]>;
866
- listSelectedObjects: <T extends SelectableObjectProps>() => Promise<T[]>;
886
+ listSelectedObjects: () => Promise<SelectableObject[]>;
867
887
  render: () => SeatingChart;
868
888
  rerender: () => void;
869
889
  resetView: () => Promise<void>;
@@ -874,7 +894,7 @@ export interface SeatingChart {
874
894
  unpulse: (objects: string[]) => Promise<void>;
875
895
  startNewSession: () => Promise<void>;
876
896
  zoomToFilteredCategories: () => Promise<void>;
877
- zoomToSection: (label: string) => SectionProps[];
897
+ zoomToSection: (label: string) => Section[];
878
898
  zoomToObjects: (labels: string[]) => Promise<void>;
879
899
  zoomToSelectedObjects: () => Promise<void>;
880
900
  }
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "@seatsio/seatsio-types",
3
3
  "description": "Type definitions for Seats.io",
4
- "version": "2.9.0",
4
+ "version": "3.1.0",
5
5
  "license": "MIT",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [
8
8
  "dist/index.d.ts"
9
9
  ],
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/seatsio/seatsio-types"
13
+ },
10
14
  "devDependencies": {
11
15
  "@actions/core": "1.10.1",
12
16
  "cli-select-2": "2.0.0",