seats-io-seating-chart-wrapper
See the clubhouse doc for information on how this repository is used in the mobile apps and web and how to test changes locally in this repo and publish to npm to be imported/consumed by the mobile apps and website
Testing Locally
You need to make changes first to src/index.js
and then build them by running npm run build
which puts the minimized output into the umd/@todaytix
folder.
In the repository there is a file called seats-io-example.html
which you can load in the browser to see your changes take effect. It looks for the minimized seating chart JS file located at umd/@todaytix/seats-io-seating-chart-wrapper.min.js
which is overwritten every time you update src/index.js
and run npm run build
.
Two values in seats-io-example.html
need to be replaced to correctly load the seating chart: event id and public key. Public key is the seats io public key that a dev can get for you. Event id is a different key that exists per showtime and can be found in the allocated_showtime
table of the database.
Example - Code snippet (Vanilla JS)
<script src="./umd/@todaytix/seats-io-seating-chart-wrapper.min.js"></script>
<script>
this.seatingChart = new SeatsIOSeatingChart(
'seat-selector',
'todaytix-example-2',
'[public-key]',
{
holdOnSelect: false,
selectBestAvailable: false,
hideTooltip: false,
},
{
onChartRendered: function onChartRendered(chart) {
},
onChartRenderingFailed: function onChartRenderingFailed(chart) {
},
onObjectClicked: function onObjectClicked(object) {
},
onObjectSelected: function onObjectSelected(object, selectedTicketType) {
},
onObjectDeselected: function onObjectDeselected(object, selectedTicketType) {
},
onObjectDeselected: function onObjectMouseOver(object) {
},
onObjectMouseOut: function onObjectMouseOut(object) {
},
onSelectedObjectBooked: function onSelectedObjectBooked(object) {
},
onBestAvailableSelected: function onBestAvailableSelected(objects, nextToEachOther) {
},
onBestAvailableSelectionFailed: function onBestAvailableSelectionFailed() {
},
onScrolledOutOfBoundsVertically: function onScrolledOutOfBoundsVertically(amount) {
},
onHoldSucceeded: function onHoldSucceeded(objects) {
},
onHoldFailed: function onHoldFailed(objects) {
},
onReleaseHoldSucceeded: function onReleaseHoldSucceeded(objects) {
},
onReleaseHoldFailed: function onReleaseHoldFailed(objects) {
},
onSelectionInvalid: function onSelectionInvalid(violations) {
}
},
},
);
this.seatingChart.render();
this.seatingChart.deselectObjects(objects);
this.seatingChart.deselectObjects(objects);
this.seatingChart.updatePriceRange(min,max);
this.seatingChart.updateInventoryMap(inventoryMap);
this.seatingChart.getSelectedObjects();
this.seatingChart.zoomToSelectedObjects();
</script>
Example - Code snippet (ReactJS)
import SeatsIOSeatingChartWrapper from 'SeatsIOSeatingChartWrapper';
...
componentDidMount() {
if (!__ENV__.CLIENT) {
return;
}
const extraConfig = {
accessibleHeading: settings.accessibleHeading,
accessibleText: settings.accessibleText,
inventoryMap,
hideTooltip,
max: maxRange,
min: minRange,
orphanText: settings.orphanText,
partialViewHeading: settings.partialViewHeading,
partialViewText: settings.partialViewText,
taxDescription: settings.taxDescription,
};
this.seatingChart = new SeatsIOSeatingChart(
SEAT_IO_CONTAINER,
eventId,
publicKey,
{
extraConfig,
holdOnSelect: false,
selectBestAvailable: false,
},
{
onBestAvailableSelected: this.onBestAvailableSelected,
onBestAvailableSelectionFailed: this.onBestAvailableSelectionFailed,
onChartRendered: this.onChartRendered,
onChartRenderingFailed: this.onChartRenderingFailed,
onHoldFailed: this.onHoldFailed,
onHoldSucceeded: this.onHoldSucceeded,
onObjectClicked: this.onObjectClicked,
onObjectDeselected: this.onObjectDeselected,
onObjectMouseOut: this.onObjectMouseOut,
onObjectMouseOver: this.onObjectMouseOver,
onObjectSelected: this.onObjectSelected,
onReleaseHoldFailed: this.onReleaseHoldFailed,
onReleaseHoldSucceeded: this.onReleaseHoldSucceeded,
onScrolledOutOfBoundsVertically: this.onScrolledOutOfBoundsVertically,
onSelectedObjectBooked: this.onSelectedObjectBooked,
onSelectionInvalid: this.onSelectionInvalid,
onSelectionValid: this.onSelectionValid,
},
);
this.seatingChart.render();
}