JAVASCRIPT SDK
Properties and public state
Read integration state without reading the iframe or browser session storage.
Wait, then read
State updates arrive asynchronously. getState returns a snapshot; the named convenience properties below are read-only getters.
JavaScript
await TruComWidget.ready();
const state = TruComWidget.getState();
console.log(state.isOpen, state.unreadCount);
console.log(TruComWidget.visitorId);State reference
| Option | Behavior |
|---|---|
| ready | Boolean in getState(); use ready() to wait. |
| widgetKey | Public installation key. |
| isOpen / isVisible | Panel open state / installation visibility. |
| visitorId | Opaque visitor ID, null until a session exists. |
| conversationId / conversationState | Current conversation ID / active, waiting or closed state; null when unavailable. |
| unreadCount | Latest unread count delivered by the widget. |
| identityVerified | Whether the current session has a signed identity. |
| language / theme | Effective interface language / system, light or dark. |
| humanAvailable | Current widget human-availability projection. |
| view | Current screen: home, messages, help, conversation, prechat, knowledge or feedback. |
Authorization stays private
Bearer tokens, signing secrets, full customer profiles and message contents are not public state. Public IDs never replace session authorization. Use the signed-identity flow to recover a customer’s conversations.