Embedded SDK Reference
Including Kota.js
Include the Kota.js script on each page you want to run it on — it should always be loaded directly from https://js.kota.io or https://test.js.kota.io, rather than included in a bundle or hosted yourself. This ensures compliance and future updates.
When you are ready to go-live make sure your production environment is not including the test SDK.
Initialising Kota.js
Employer
Kota.Health.employer(employerAccessToken, options?)
Use Kota.Health.Employer(employerAccessToken, options?)
to create an instance of the Kota Health’s Employer
embedded UI.
The employerAccessToken
can be retrieved from the Embed Session endpoint.
Once initialised, if the optional container
has not been provided, the employer embedded will load in on a <div>
with id="employer"
.
Method parameters
/embed/session
endpoint to authenticate the user session.Employee
Kota.Health.employee(employeeAccessToken, options?)
Use Kota.Health.Employer(employeeAccessToken, options?)
to create an instance of the Kota Health’s Employee
embedded UI.
The employeeAccessToken
can be retrieved from the Embed Session endpoint.
Once initialised, if the optional container
has not been provided, the employer embedded will load in on a <div>
with id="employee"
.
Method parameters
/embed/session
endpoint to authenticate the user session.Browser events
The only way to communicate with your Embedded UI in the browser is by listening to an event.
You can set up listeners directly from your initialised employer
and employee
objects or by directly listening for the events on the window.
Event name | Description |
---|---|
employer.pageLoaded | Fires when a new page loads. Object contains page title. |
employer.healthSetupLoaded | Fires when the employer health insurance setup flow loads. |
employer.healthManagementLoaded | Fires when the employer health insurance setup management loads. |
employee.pageLoaded | Fires when a new page loads. Object contains page title. |
employee.healthSetupLoaded | Fires when the employee health insurance setup flow loads. |
employee.healthManagementLoaded | Fires when the employee health insurance setup management loads. |
pageLoaded
The pageLoaded
event fires each time a new page is loaded throughout an Embedded UI - both for employer
and employee
.
You can listen for it directly from your initialised objects, e.g. employerEmbed.on('pageLoaded', handler)
, or with event listeners. If listeningly directly be careful to listen for the correct event as they are namespaced by employer
and employee
- see the event list for more information.
Method parameters
handler(event) => void
is a callback function that you provide that will be called when the event is fired. After it’s called, it passes an event object with the following properties:
healthSetupLoaded
The healthSetupLoaded
event fires each time a new page is loaded throughout an Embedded UI - both for employer
and employee
.
You can listen for it directly from your initialised objects, e.g. employerEmbed.on('healthSetupLoaded', handler)
, or with event listeners. If listeningly directly be careful to listen for the correct event as they are namespaced by employer
and employee
- see the event list for more information.
Method parameters
handler(event) => void
is a callback function that you provide that will be called when the event is fired.healthManagementLoaded
The healthManagementLoaded
event fires each time a new page is loaded throughout an Embedded UI - both for employer
and employee
.
You can listen for it directly from your initialised objects, e.g. employerEmbed.on('healthManagementLoaded', handler)
, or with event listeners. If listeningly directly be careful to listen for the correct event as they are namespaced by employer
and employee
- see the event list below for more information.
Method parameters
handler(event) => void
is a callback function that you provide that will be called when the event is fired.