Skip to main content

Configuration

Configuration of the widget can occur through an options object passed to the initalization (inject) function of the widget. For example:

let options = {
token: token,
orgId: id,
// disable airport search
disableAirport: true,
};

let widget = new window.Sitata.covidMap(el, options)
widget.run()

In some cases, configuration can occur on the fly through various functions. See below.

Options

The following configuration options are available:

propertytypedescription
departureCodeStringThe ISO 3166 Alpha 2 country code to prepopulate the departure. e.g. CA for Canada
destinationCodeStringThe ISO 3166 Alpha 2 country code to prepopulate the destination. e.g. IN for India
transitCodeStringThe ISO 3166 Alpha 2 country code to prepopulate the transit country. e.g. ES for Spain
nationalityStringThe ISO 3166 Alpha 2 country code to prepopulate the nationality. e.g. CA for Canada
departureDateStringThe date of departure using the format YYYY-MM-DD
vaccinatedBooleanIf true, will return only results for fully vaccinated travellers. If false, will return results for unvaccinated (or unknown) travellers. The unvaccinated data points will often have comments about vaccination status.
disableAirportBooleanIf true, will disable airport searching in the form inputs.
hideLegendBooleanIf true, will hide the legend.
tokenStringYour organization's public authentication token.
oStringA comma-separated list of ISO 3166 Alpha 2 country codes which are permitted for display.
reStringA string describing which travel restrictions should be excluded. See below.
eeStringA string describing which entry requirements should be excluded. See below.
ocBooleanIf true, will return names of various countries in a way that is acceptable for display by mainland China standards.
cturlStringOverride the link for COVID-19 test bookings.
entryColorsObjectAn object describing a color set for use on the map. See below.
colorBlindEntryColorsObjectAn object describing a color set for use on the map for color blind users. See below.
irregularFillColorsObjectAn object describing a color set for use on the map for regions that are not covered. See below.
hideHeaderBooleanIf true, will hide the search header.
hideMapBooleanIf true, will hide the map.
prioritySortedBooleanIf true, will sort entry requirements by priority.

Travel Restriction Exclusions

The re option allows you to remove certain categories of travel restrictions from display in the widget. The string has a specific format which starts with a country code separated by a separated by dash (-) and followed by a comma-separated list of Travel Restriction category types. Pairings are separated by a dash (-). This pairing will allow you to remove specific categories of information for specific countries. If you need to remove categories for all countries, you may use an asterisk (*).

Examples:

// remove travel restriction type 7 for all countries
{
re: "*-7"
}
// remove travel restriction types 1, 2, and 3 for Canada and India
{
re: "CA-1,2,3-IN-1,2,3"
}
// remove travel restriction types 1, 2, and 3 for Canada and India; and types 402 and 2 for Germany
{
re: "CA-1,2,3-IN-1,2,3-DE-402,2"
}

Entry Requirement Exclusions

The ee option allows you to remove certain categories of entry requirements from display in the widget. The format used to specify these exclusions is exactly the same as with Travel Restriction Exclusions.

Examples:

// remove entry requirement type 7 (insurance) for all countries
{
re: "*-7"
}
// remove entry requirement types 1, 2, and 3 for Canada and India
{
re: "CA-1,2,3-IN-1,2,3"
}
// remove entry requirement types 1, 2, and 3 for Canada and India; and types 5 and 2 for Germany
{
re: "CA-1,2,3-IN-1,2,3-DE-5,2"
}

Specifying Colors

The configuration options entryColors, colorBlindEntryColors, irregularFillColors allow you to minimally customize the colors used in the map.

The following is an exmaple of how to specify colors. pct represents the percentage range from 0.0 to 1.0 across a gradient. The color object represents the hexidecimal representation of the color across red, green and blue.

let irregular = [
{ pct: 0.0, color: { r: 0x59, g: 0x61, b: 0x69 } },
// { pct: 0.5, color: { r: 0xff, g: 0xff, b: 0 } },
{ pct: 1.0, color: { r: 0x2c, g: 0x3e, b: 0x50 } }
]
let entry = {
indeterminate: { pct: 1.0, color: { r: 0x34, g: 0x49, b: 0x5e } },
low: { pct: 1.0, color: { r: 0x27, g: 0xae, b: 0x60 } },
medium: { pct: 1.0, color: { r: 0xe6, g: 0x7e, b: 0x22 } },
high: { pct: 1.0, color: { r: 0xc0, g: 0x39, b: 0x2b } }

// options object
let opts = {
entryColors: entry,
irregularFillColors: irregular
}

Functions

The following functions are available:

FunctionArgumentsDescription
setDepartureCode(String)Set the departure country of the first segment
setDestinationCode(String)Set the destination country of the first segment
setNationality(String)Set the nationality country of the first segment
setTransitCode(String)Set the transit country of the first segment
setVaccinated(Boolean)Set the vaccination status
setDepartureDate(String)Set the departure date
setHideHeader(Boolean)Show or hide the search header
setHideMap(Boolean)Show or hide the map
setPrioritySorted(Boolean)If true, will sort entry requirements by priority. Default is false.
removeSegment(Integer)Will remove a segment based on the index (0-based) given.
addSegment(Object)Add a segment. See below.
doSearch()()Execute a search programatically

Segment

When adding a segment, you should specify an object with the following properties:

propertytypedescription
departureStringThe ISO 3166 Alpha 2 country code to prepopulate the departure. e.g. CA for Canada
transitStringThe ISO 3166 Alpha 2 country code to prepopulate the transit country. e.g. ES for Spain
destinationStringThe ISO 3166 Alpha 2 country code to prepopulate the destination. e.g. IN for India
departureDateDateA javascript date object for the departure date.

Events

The following events are available and are triggered on the window document object.

Event NameDescription
sitata:covidMapReadyFired when the widget has been downloaded and is ready to be initalized.
sitata:selectCountryFired when a country is selected. Event details contain the country selected and for which field.
sitata:entryClickFired when an entry requirement is clicked. Event details contain the country and type of restriction.
sitata:restrictionClickFired when a local travel restriction clicked. Event details contain the country and type of restriction.
sitata:vaccinatedClickFired when the user has selected a vaccination status. Event details contain the value selected.
sitata:doSearchFired when the user has made a search request.

Example:

window.document.addEventListener("sitata:selectCountry", function(event) {
let value = event.details
console.log('value', value)
});