crisp-im / crisp-sdk-web

:package: Include the Crisp chat widget from using frameworks such as React, VueJS, Angular...
https://www.npmjs.com/package/crisp-sdk-web
MIT License
39 stars 13 forks source link

Implement Crisp.chat.onChatLoaded() function #23

Closed piotrkulpinski closed 5 months ago

piotrkulpinski commented 12 months ago

Hi, I'm integrating the Crisp into my React app and I'd love to be able to know when the Crisp chat is fully loaded. I'm using the autoload: false option and loading Crisp manually via Crisp.load() method.

I'd like to add a UI loader to let users know when the chat is loading.

I've tried onChatOpened and onChatInitiated but it does not trigger after first programatic open.

Thanks!

eliottvincent commented 5 months ago

You can use the session loaded callback:

Crisp.session.onLoaded((sessionId) => {
  // Executed once the Crisp session is loaded

  console.log(sessionId);
})