Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ticketevolution/seatmaps-client

Package Overview
Dependencies
Maintainers
3
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ticketevolution/seatmaps-client

A client side JavaScript library that enables users to view interactive seating charts for tickets available via the Ticket Evolution API.

  • 1.3.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
601
increased by0.17%
Maintainers
3
Weekly downloads
 
Created
Source

Ticket Evolution logo

Ticket Evolution Seatmaps

JavaScript Style Guide Known Vulnerabilities

A client side JavaScript library that enables users to view seatmaps for available tickets on Ticket Evolution by:

  1. Fetching the map SVG and manifest JSON, with the given venueId and configurationId, from Ticket Evolution AWS S3 buckets using the mapsDomain (defaults to maps.ticketevolution.com).
  2. Rendering the map in the provided DOM element via the .build function which accepts the id of the element as an argument (see below for an example DOM setup).
  3. Color map sections according to the sectionPercentile configurations and the available ticketGroups (and any selectedSections if provided).
  4. Render a tooltip when the user hovers over a section, which will provide quantity and price information.

Note: Sections will not color and you will not be able to highlight/toggle sections via the map or the API until ticket groups are supplied to the map, either through ticketGroups configuration or updateTicketGroups API.

After instantiation, a public API is available with a limited number of functions to interact with the map.

Help: Ticket Evolution

Installation and Usage Options

Window Object

1. Download tevomaps.js

wget https://raw.githubusercontent.com/ticketevolution/seatmaps-client/master/build/tevomaps.js

2. Load tevomaps.js, create a map root, and build a map

<div id='my-map'></div>
<script src="tevomaps.js"></script>
<script>
  // create a new seatmap
  var seatmap = new Tevomaps({
    venueId: '10',
    configurationId: '1046',
    ticketGroups: [{
      tevo_section_name: 'upper end zone 232',
      retail_price: 100
    }]
  });

  // turn element with ID of 'my-map' into a seatmap for config 1046
  var seatmapApi = seatmap.build('my-map');

  // perform some actions, like highlighting section "upper end zone 232"
  seatmapApi.highlightSection('upper end zone 232');
</script>

CommonJS

1. Install via npm or yarn

npm install --save @ticketevolution/seatmaps-client

or

yarn add @ticketevolution/seatmaps-client

2. Create a script that includes @ticketevolution/seatmaps-client

// main.js

import Tevomaps from '@ticketevolution/seatmaps-client'

// create a new seatmap
const seatmap = new Tevomaps({
  venueId: '10',
  configurationId: '1046',
  ticketGroups: [{
    tevo_section_name: 'upper end zone 232',
    retail_price: 100
  }]
});

// turn element with ID of 'my-map' into a seatmap for config 1046
const seatmapApi = seatmap.build('my-map');

// perform some actions, like highlighting section "upper end zone 232"
seatmapApi.highlightSection('upper end zone 232')

API Reference

class Tevomaps

new Tevomaps(options: object)

Options:

NameRequiredTypeDefault ValueDescription
venueIdstringTicket Map Venue ID
configurationIdstringTicket Map Configuration ID
sectionPercentilesobject{
    '0.2': '#FFC515',
    '0.4': '#f2711c',
    '0.6': '#D6226A',
    '0.8': '#a333c8',
    '1': '#2A6EBB'
}
Define percentiles to color sections based on their average ticket group price. Ticket groups which fall within a given range will display the associated color on the map for their section.

ie. Given an event with 100 ticket groups, with each ticket group price incrementing by $1 from $100 to $200, a section whose average ticket group price is $110 will be displayed as #FFC515, and a section whose average price of $175 will be displayed as #a333c8.
mapFontFamilystringSet a default font for the map. Native browser fonts available, a list below is provided but results may vary depending upon the browser and browser version.

• Helvetica
• Arial
• Times
• Times New Roman
• Courier
• Courier New
• Verdana
• Tahoma
mapsDomainstringhttps://maps.ticketevolution.comThe domain from which map SVGs and manifests will be fetched. To pull maps from the development environment, use https://maps-dev.ticketevolution.com
onSelectionfunctionA function which will be called by Tevomaps when a section of the map has been clicked. It will pass as arguments an array of all currently selected section IDs and expect nothing back.

onSelection: function (sectionIds) {
    console.log(sectionIds); //=> ['id-1','id-2']
}

Note: This method is also called when a section is deselected. If all sections are deselected, the sectionIds array will be empty.

Note: This method will always return lower case section names, you will need to take that in consideration when you do string comparisons.
selectedSectionsstring[][]An array of section IDs for the map to initially highlight by default when it is rendered.
ticketGroupsTicketGroup[][]An array of ticket groups to be used for section pricing. Expects each ticket group to adhere to the TicketGroup interface. This API was designed for you to directly pass into the client library the response from the Ticket Evolution /v9/ticket_groups endpoint. Note that include_tevo_section_mappings must be true in that API request.
showControlsbooleantrueWhen set to true, the map controls (the zoom in, zoom out, reset zoom, and clear selection buttons) will be visible.
showLegendbooleantrueWhen set to true, the map legend will be visible.
mouseControlEnabledbooleantrueWhen set to true, the map will respond to mouse events (such as click, move, and hover).
updateTicketGroups(groups: TicketGroup[])

Changes the collection of ticket groups in the map used to calculate available sections and section prices. Useful if you have a feature for filtering ticket groups and you want the map to update.

highlightSection(section: string)

Temporarily colors the given section by making it more opaque. This is the same effect used for hovering on a section.

unhighlightSection(section: string)

Removes the highlight effect of the given section, if it's not selected, by reverting it back to its base transparency. This is the same effect used for hovering off on a section.

selectSection(section: string)

This is the same effect used for clicking on a section to select it. It colors the section and will not revert back by hovering off it or calling unhighlightSection. Calls the onSelection callback with the updated array of selected sections.

deselectSection(section: string)

This is the same effect used for clicking on a section to deselect it. It reverts the color of the section and is the only way to unhighlight a selected section. Calls the onSelection callback with the updated array of selected sections.

Interfaces

NameProperties
TicketGroup{
    tevo_section_name: string;
    retail_price: number;
}

Contributing & Development

The below instructions will get the project up and running on your local machine for development and testing purposes.

System Prerequisites

  • node
  • yarn
  • make
  • git

Using make

We've made the startup process simple by using a Makefile for all common workflows.

To see what Makefile commands are available, in your terminal shell run make or make help. It will list all the available Makefile commands with their descriptions.

TargetEffect
helpDisplay all other make targets and their effects
installInstall client and server side packages for development
startStart the development server

Using yarn or npm

A slew of npm/yarn scripts are also present to make development a bit easier:

ScriptEffect
buildCompiles and bundles all source into build/tevomaps.js and build/tevomaps.js.gz
watchBuilds the project, then watches source files for changes (rebuilds on each change)
startStarts the using-module example using webpack-dev-server
analyzeAnalyses the build process that would create build/tevomaps.js
lintUses eslint to lint all source code

Contributing Cont.

Once you have completed the above steps, contribution to the repository is as follows:

  1. Create an issue on GitHub to address your concerns
  2. In the issue state the feature request or problem (give exact steps for replicating problems)
  3. Give a detailed description of a solution to the problem or the behavior of the feature request
  4. If you plan to submit a PR then create a branch named as such <issue-number>-<brief-branch-description>
  5. should be 2-3 words that can most accurately describe the intent of the code in the branch
  6. Write the code to create the feature or address the problem
  7. Before opening a PR against master: run npm run build and bump the version number in the package.json according to (semantic versioning rules)[https://semver.org]
  8. Open a PR of your branch against master
  9. Respond to any comments
  10. When all checks are passing and you have received a :+1:, squash & merge your PR

Keywords

FAQs

Package last updated on 27 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc