Embeddable widget

A requirement check your travellers can use without leaving your site. Two lines of HTML and a publishable key.

embed
<script src="https://sdk.haavisa.com/v1/embed.js"></script>
<div id="haavisa-widget"></div>
<script>
  Haavisa.mount('#haavisa-widget', {
    publishableKey: 'hv_pub_live_xxxxxxxx_secret',
    destination: 'KEN',
    nationality: 'SOM'
  });
</script>

Why a shadow root

The widget renders into a shadow root, so your CSS cannot reach in and ours cannot leak out. This is not a nicety — a partner’s stylesheet with a broad selector will break any widget it can reach, and the failure looks like our bug.

none of this affects the widget
/* Your page. The widget is unaffected. */
* { font-family: "Comic Sans MS" !important; color: magenta !important; }
button { display: none !important; }
select { width: 40px !important; }

Options

OptionTypeNotes
publishableKeystringRequired. Must start with hv_pub_.
destinationISO3Required. ETH, SOM, DJI or KEN. Fixed per instance.
nationalityISO3Pre-fills the passport selector.
baseUrlstringOverride the API host. Useful for staging.
localestringReserved. Not yet implemented.
themeobjectprimaryColor, textColor, surfaceColor, borderColor, radius, font.
theming
Haavisa.mount('#haavisa-widget', {
  publishableKey: 'hv_pub_live_xxxxxxxx_secret',
  destination: 'KEN',
  theme: {
    primaryColor: '#0f172a',
    radius: '10px',
    font: 'inherit'
  }
});

What it will not do

Unmounting

Haavisa.unmount('#haavisa-widget');

Mounting twice into the same selector replaces the first instance, so a single-page app re-rendering a route does not stack widgets.