Skip to main content

Constructor

Create a widget instance by passing a VIZOCHOKWidgetConfig object to the constructor:
The constructor validates that apiKey and storeId are provided and throws an Error immediately if either is missing.

Config Options

Required

Optional — Identity & Locale

Optional — Appearance

Optional — Callbacks

ThemeConfig

The theme property accepts a ThemeConfig object:

Full Example

Public Methods

After creating the widget instance, use these methods to control it:

MountOptions

Session Persistence

The widget automatically persists chat history and conversation state to sessionStorage under the key vz-session-{storeId}. This means:
  • Refreshing the page restores the previous conversation
  • The conversationId is preserved across page navigations
  • Cart state is restored on reconnect via the session_restored server message
  • Calling destroy() clears stored session data
  • Calling newChat() clears stored session data and resets the conversation
Session data is stored per-tab using sessionStorage, not localStorage. Opening a new tab starts a fresh session.