Click for detailed documentation
Our widget fires a LIVESUPP_LOADED event on the window object after the widget has finished loading and is ready to be used. The details property of the event object contains a property api representing the PageAPI object.
window.addEventListener('LIVESUPP_LOADED', async event => {
const lsAPI = event.detail.api // we will refer to the PageAPI object as lsAPI
// now you can use the api
})
PageAPI.renderCobrowsingCode - Render a cobrowsing code into a custom elementPageAPI.disable - Hide Livesupp and disconnect customer from backendPageAPI.enable - Establish connection to backend and show Livesupp again after using PageAPI.disable()PageAPI.enable() cannot be used before PageAPI.disable()
/*
element - the HTMLElement you wish to render the cobrowsing code component into
returns a Promise that resolves after the element is rendered
*/
await lsAPI.renderCobrowsingCode({
element: document.getElementById('target-element'),
})
PageAPI.on - Listens to an eventcobrowsing.startedlsAPI.on('cobrowsing.started', () => {
/*
This function gets called when cobrowsing starts.
*/
})
PageAPI.getResolvingOperator() - retuns id of operator the customer is assigned to/*
Note: If the customer is not assigned to any operator, the returned value is null.
*/
lsAPI.getResolvingOperator()