Koala Smartblock docs

This section is not public yet. Enter the password you received from Koala.

Skip to main content

Events

Koala events live on window.CTStore.koala.events. Each event listener is an array of callbacks, and each callback receives (status, data). How to register handlers and how the basket flows through your page are explained in the concepts page Events and basket state.

There are five events, in the order they fire during a visit. Click one for what each status means and the shape data carries:

Fires

Fires START when the widget begins loading and END once the priced options have rendered. Between the two, Koala fetches its configuration and requests the quote. END only follows a successful quote: on failure, onAvail ERROR or onError fires instead.

Statuses
START
The widget has begun loading.
END
The widget has rendered; the priced options are visible. When the quote priced no bundle, it renders nothing and still fires END (check onAvail for the count).
Data

None: callbacks receive an empty object.

Basket state on window.CTStore.koala

Alongside the onBasket event, the widget writes the latest basket to window.CTStore.koala.basketPayload, so you can read the current state at any time without waiting for an event. Click a property to see the shape it carries:

basketPayload

The current basket, kept up to date on window.CTStore.koala.basketPayload.

  • PricedBundle

    A bundle priced for the trip.

    • idstringBundle identifier.
    • productsstring[]The product types included in this bundle.
    • titlestringDisplay name of the bundle.
    • Example24.9
    • Example'EUR'
    • Document

      A document attached to the bundle.

      • Example'TERMS_AND_CONDITIONS'
      • Example'en'
      • urlstringURL to the document.
  • PricedBundle

    A bundle priced for the trip.

    • idstringBundle identifier.
    • productsstring[]The product types included in this bundle.
    • titlestringDisplay name of the bundle.
    • Example24.9
    • Example'EUR'
    • Document

      A document attached to the bundle.

      • Example'TERMS_AND_CONDITIONS'
      • Example'en'
      • urlstringURL to the document.
  • bookobjectThe prepared request template, documented on its own reference page.

The book property is the request template the widget prepares for you; its shape and placeholders are documented in Request template.