API reference

The interface of the ccaas web SDK instance.

Properties

This section contains some of the properties you might use.

version

The version of the web SDK.

  console 
 . 
 log 
 ( 
 ccaas 
 . 
 VERSION 
 ) 
 

client

This is an instance of the Headless client , it contains everything available on a headless client.

Here is an example:

 const  
 client 
  
 = 
  
ccaas.client
const  
 chat 
  
 = 
  
await  
client.loadOngoingChat () 
 

Methods

Available methods on the widget instance.

.config

Update the configuration of the widget.

 ccaas.config ({ 
  
accent:  
 'green' 
 }) 
 

For more information see the Configuration section.

.mount

Mount the widget on the given element. For example, on your webpage:

 <div  
 id 
 = 
 "my-ccaas" 
></div> 

Then, you can mount the web SDK widget with:

 ccaas.mount ( 
 '#my-ccaas' 
 ) 
 

.unmount

Remove the web SDK widget from your webpage.

 ccaas.unmount () 
 

.destroy

Unmount and destroy everything.

 ccaas.destroy () 
 

.show

Display the widget UI.

 ccaas.show () 
 

.hide

Hide the widget UI.

 ccaas.hide () 
 

.start

Show and start the widget with the given options.

 interface  
StartOption  
 { 
  
menuKey?:  
string ; 
  
ticketId?:  
string ; 
  
preferredChannel?:  
string ; 
 } 
 

Example:

 ccaas.start ({ 
  
menuKey:  
 'vip' 
  
 }) 
 

Events

Use .on method to add event listeners:

 const  
 trackChat 
  
 = 
  
 ( 
chat ) 
  
 = 
>  
 { 
  
console.log ( 
chat ) 
 } 
ccaas.on ( 
 'chat.updated' 
,  
trackChat ) 
 

Remove the event handler with .off :

 ccaas.off ( 
 'chat.updated' 
,  
trackChat ) 
 

The .on and .off methods are aliases to the headless client's .on and .off . To learn more, see Headless web SDK guide .

There is one more event added by widget:

 ccaas.on ( 
 'visible' 
,  
 ( 
visible ) 
  
 = 
>  
 { 
  
console.log ( 
visible ) 
  
//  
 true 
  
or  
 false 
 }) 
 
Create a Mobile Website
View Site in Mobile | Classic
Share by: