The VIZOCHOK widget is a lightweight JavaScript SDK (Documentation Index
Fetch the complete documentation index at: https://docs.vizochok.com/llms.txt
Use this file to discover all available pages before exploring further.
@vizochok/widget) that embeds an AI-powered shopping assistant into any web page. It uses Shadow DOM for style isolation and communicates with the VIZOCHOK backend over WebSocket for real-time streaming.
Prerequisites
- A VIZOCHOK tenant with a public API key (
pk_...) - Your store ID (configured in the admin panel)
Quick Start
Install the SDK
Install via npm or load from CDN. See Installation for all options.
Inline Mode
By default, the widget renders as a floating button that opens a chat panel. You can embed it inline within a specific container instead:- The widget fills 100% width and height of the container
- The floating toggle button is hidden
- The chat panel is always open
- You control visibility via the container’s CSS
Switching Modes at Runtime
You can switch between inline and floating mode without losing the conversation:Programmatic Control
The widget instance exposes methods for programmatic control:Dynamic Store Switching
If the user changes their delivery address and the nearest store changes, update the widget without re-creating it:Shadow DOM & Style Isolation
The widget renders inside a Shadow DOM, which means:- Your page styles do not affect the widget
- The widget styles do not leak into your page
- CSS custom properties are used for theming (set via the
themeconfig)
Because the widget uses Shadow DOM, external CSS frameworks (Bootstrap, Tailwind) will not style the widget’s internals. Use the
theme configuration object instead.Content Security Policy (CSP)
If your site uses a strict Content Security Policy, add these directives:Performance Notes
- Bundle size: The SDK is ~12 KB gzipped with zero external dependencies.
- Lazy connection: The WebSocket connection is established on
mount(), not on instantiation. - Session persistence: Conversation state is saved to
sessionStorageso the user can refresh the page without losing context. - Heartbeat: The widget maintains a heartbeat ping every 30 seconds. If no response is received within 60 seconds, the connection is automatically closed and reconnected.