Timatic Widget Implementation Guide

To integrate the Timatic widget into your webpage, follow these steps:

  1. Include the Script: The latest version of the script can be obtained here. Ensure that the script is placed at the end of the <body> HTML element to guarantee that all required DOM elements have been loaded before the script executes. If that's not possible, another solution is to use the defer attribute when including the script. By adding the "defer" attribute to the script tag, the script will only execute after the HTML document has been fully parsed. E.g.:
    <script src="https://widget.timatic.iata.org/scripts/v2/iata-timatic-widget-2.0.0.js" type="text/javascript"></script>
  2. Add the HTML Element: Insert a <div> element at the location on your webpage where you want the widget to appear. This <div> must have the id id="iata-timatic-widget".
    <div id="iata-timatic-widget"></div>
  3. Include the CSS: The latest version is available here. E.g.:
    <link rel="stylesheet" href="https://widget.timatic.iata.org/scripts/v2/iata-timatic-style-2.0.0.css">

Data Input

1. Language Configuration

Set the language for the widget on the window object using the property "timaticWidgetLanguage.languageCode". The languageCode is a string with one of the following values:

  • EN - English
  • DE - German
  • ES - Spanish
  • FR - French
  • PT - Portuguese
  • TR - Turkish

If not set, the widget defaults to English.

// Example: Set the widget language to French
window.timaticWidgetLanguage.languageCode = 'FR';

2. Detailed search mode

Timatic widget v2 supports detailed search view mode. This is intended only for internal testing. Set the widget in detailed search mode by setting the property "timaticWidgetModes.openInDetailedSearch" on true. It's default value is false.

// Example: Open in detailed view
window.timaticWidgetModes.openInDetailedSearch = true;

3. Default Trip Type Configuration

To configure the default trip type for the widget, utilize the window property timaticDefaultTripType.defaultTripType. The defaultTripType is represented by a numerical value corresponding to the desired trip type. The available options are:

  • 1 - Roundtrip
  • 2 - One-Way
  • 3 - Multi-City
// Example: Set the default trip type to One-Way
window.timaticDefaultTripType.defaultTripType = 2;

Ensure that these configurations are applied before the widget is loaded to guarantee that the settings take effect.

4. Toggle content groupings

To manage the visibility of content groupings, use the window property timaticVisibleSectionOrder.visibleSectionOrder. This property is an array of string values, each representing a section you wish to display, in your specified order. It's important to note that configuring this property is optional, but if you choose to use it, it must contain at least one section and cannot be an empty array. The available sections are listed below:

  • C1 - Visa and other border measures
  • C2 - Passport and other travel documents
  • C3 - Public Health and Vaccinations
  • C4 - Travelling with Pets
  • C5 - Customs, Currencies and Airport Tax
// Example: See the first five sections
window.timaticVisibleSectionOrder.visibleSectionOrder = ["C1", "C2", "C3", "C4", "C5"];
 // Example:  the first three sections in a specific order (C3, C1, C2):
window.timaticVisibleSectionOrder.visibleSectionOrder = ["C3", "C2", "C1"];

Ensure that these configurations are applied before the widget is loaded to guarantee that the settings take effect.

5. External Data Input Configuration

The widget supports external data inputs via "timaticWidgetInputData" on the window object. This property contains an object with the following fields:

{
    tripType: number,
    journeyLegs: [{
        departureAirportCode: string,
        arrivalAirportCode: string,
        durationOfStay: number
    }],
    travelerDetails: {
        countryCodeOfNationality: string,
        countryCodeOfResidency: string,
        documentType: number,
        countryCodeOfIssuing: string,
        travelDocumentCode: string
    }
}

Where:

  • "tripType" - a number with one of the following values:
    • 1 - Roundtrip
    • 2 - One-Way
    • 3 - Multi-City
  • "journeyLegs" - an array of objects with the following fields:
    • "departureAirportCode" - a string representing a 3-letter airport code (e.g., "AMS", "CLJ", "MUC")
    • "arrivalAirportCode" - a string representing a 3-letter airport code (e.g., "AMS", "CLJ", "MUC")
    • "durationOfStay" - a number with one of the following values:
      • 1 - Transit (only for MultiCity)
      • 2 - Up to 7 days
      • 3 - Up to 14 days
      • 4 - Up to 30 days
      • 5 - Over 30 days
      • 6 - Less than 1 day (only for Round trip and Multicity)
    • The default value is option 2 - Up to 7 days

  • "travelerDetails" - an object with the following fields:
    • "countryCodeOfNationality" - a string representing a 2-letter country code (e.g., "NL", "RO", "DE")
    • "countryCodeOfResidency" - a string representing a 2-letter country code (e.g., "NL", "RO", "DE")
    • "documentType" - a number with one of the following values. Note that the value 8 is missing:
      • 1 - Tourist/Vacation
      • 2 - Business
      • 3 - Airline Crew (On Duty)
      • 4 - Government personnel (Off Duty)
      • 5 - Government personnel (On Duty)
      • 6 - Seafarer
      • 7 - Military personnel (On Duty)
      • 9 - Stateless/Refugee
    • !"countryCodeOfIssuing" and "travelDocumentCode" are needed only when the documentType is not Tourist (1) or Business (2)
      • "countryCodeOfIssuing" - a string representing a 2-letter country code where the travel document was issued (e.g., "NL", "RO", "DE")
      • "travelDocumentCode" - required and varies based on "documentType":
        • 3: CREWMEMBERLICENCE, CREWMEMBERIDCARD, CREWMEMBERCERTIFICATE, CREWGENERALDECLARATIONFORM
        • 4: CONSULARPASSPORT, DIPLOMATICPASSPORT, OFFICIALPASSPORT, SERVICEPASSPORT, SPECIALPASSPORT, LAISSEZ-PASSER
        • 5: CONSULARPASSPORT, DIPLOMATICPASSPORT, OFFICIALPASSPORT, SERVICEPASSPORT, SPECIALPASSPORT, LAISSEZ-PASSER
        • 6: SEAMANBOOK, SEAFARERID
        • 7: MILITARYIDENTITYDOCUMENT, MILITARYIDCARD
        • 9: TITREDEVOYAGE, ALIENSPASSPORT, CTD1951, CTD1954, FORMI571

Observations:

  • A one-way trip should contain only one element in the journeyLegs array, a round trip should contain 2 elements, and a multi-city trip should contain at least one element and a maximum of 5 elements.
  • This object is reactive; every time you change one of these fields, the updated values will be available for the widget to perform an API call.
  • If external data parameters are needed, all of them are mandatory.

Example Implementation with Search Mode Switch

Below is an example of a simple HTML page that includes the Timatic widget script, CSS, and the required <div> element, along with a switch to toggle between simple and detailed search modes:

<!DOCTYPE html>
<html lang="EN">
  <head>
    <meta charset="UTF-8">
    <title>Timatic Widget Example</title>
    <link rel="stylesheet" href="https://widget.timatic.iata.org/scripts/v2/iata-timatic-style-2.0.0.css">
  </head>
  <body>
    <h1>Timatic Widget Example</h1>
    <div>
      <label>Toggle Detailed Search:</label>
      <input type="checkbox" id="detailedSearchToggle">
    </div>
    <div id="iata-timatic-widget"></div>
    <script src="https://widget.timatic.iata.org/scripts/v2/iata-timatic-widget-2.0.0.js"></script>
    <script>
      document.getElementById('detailedSearchToggle').addEventListener('change', function() {
        window.timaticWidgetModes.openInDetailedSearch = this.checked;
      });
    </script>
  </body>
</html>

FAQ

1. Widget is not loading

  • Check if the script is included at the end of the <body> HTML element or use the "defer" attribute with the script.
  • Ensure the <div> element with id "iata-timatic-widget" is present.
  • Verify the CSS file is correctly included.
  • Check for JavaScript errors in the console.
  • Check for network errors in the console.

2. CORS error

  • Check the console for error details.
  • If the error is to Access-Control-Allow-Origin, contact us to include the origin URL in the whitelist.

CSS Customization

The styling of the widget is achieved by the use of CSS custom properties (often called CSS variables). For changing the styling, a client needs to edit the client-customization.css file and change the values for the desired properties. For convenience, we have provided a full set of properties in the “client-customization.css” file and assigned some values for demo purposes. The client will need to uncomment the lines for the properties they wish to customize. There are approx. 50 properties built in the CSS, and they are named using the following BEM similar notation: "--timatic-widget__property-name--variation". The name usually speaks for itself, but for added clarification we have also added some remarks in the table below. The degree of built-in customization is very high. However, if for some reason, a client needs to customize more in depth how the widget looks, they can certainly do so by writing their own CSS and load it after widget’s CSS.

Customizable Properties

Property name Remarks
--timatic-widget__background-color Default widget bg color
--timatic-widget__background-color--highlight
--timatic-widget__background-color--alert-level-high Alert note bg color
--timatic-widget__background-color--alert-level-medium
--timatic-widget__background-color--alert-level-low
--timatic-widget__button__background-color Next and Search button bg color
--timatic-widget__button__background-color--focus
--timatic-widget__button__background-color--hover
--timatic-widget__button__border-color Next and Search button border color
--timatic-widget__button__border-color--focus
--timatic-widget__button__border-color--hover
--timatic-widget__button__border-radius
--timatic-widget__button__border-width
--timatic-widget__button__font-family
--timatic-widget__button__font-size
--timatic-widget__button__font-weight
--timatic-widget__button__height
--timatic-widget__button__padding-h Paddings inside the button
--timatic-widget__button__padding-v
--timatic-widget__button__text__color Next and Search button text color
--timatic-widget__button__text__color--focus
--timatic-widget__button__text__color--hover
--timatic-widget__button__text__uppercase
--timatic-widget__color--action
--timatic-widget__color--alert-level-high
--timatic-widget__color--alert-level-medium
--timatic-widget__color--alert-level-low
--timatic-widget__font__family
--timatic-widget__font__line-height
--timatic-widget__font__size
--timatic-widget__font__size--large
--timatic-widget__font__size--small
--timatic-widget__gutter
--timatic-widget__gutter--Y
--timatic-widget__heading__color Main heading property
--timatic-widget__heading__font-family
--timatic-widget__heading__font-size
--timatic-widget__heading__font-size--s
--timatic-widget__heading__font-size--xs
--timatic-widget__heading__font-weight
--timatic-widget__icon__font-size
--timatic-widget__input__background-color Text input property
--timatic-widget__input__border-color
--timatic-widget__input__border-color--focus
--timatic-widget__input__border-color--hover
--timatic-widget__input__border__width
--timatic-widget__input__height
--timatic-widget__input__max-width
--timatic-widget__input__paddings
--timatic-widget__loader__color
--timatic-widget__loader__size
--timatic-widget__max-width Max width of the widget
--timatic-widget__min-width
--timatic-widget__padding Padding of the widget
--timatic-widget__panel__header__background-color
--timatic-widget__panel__header__text__color
--timatic-widget__radio-button__size
--timatic-widget__radio-button__inner__color
--timatic-widget__radio-button__inner__size
--timatic-widget__radio-button__border__color
--timatic-widget__results__header__background-color
--timatic-widget__results__header__text__color
--timatic-widget__spacer
--timatic-widget__text__color
--timatic-widget__text__highlight-color
--timatic-widget__timeline__color