Skip to content

Configuration

Configure WidgetClient by passing a WidgetConfig object to the constructor. All options except widgetKey are optional.

OptionTypeRequiredDefaultDescription
widgetKeystringYesYour widget installation key
baseUrlstringNohttps://api.univerx.aiAPI base URL
containerstring | HTMLElementNoMount the widget inside a specific DOM element or CSS selector
themeWidgetThemeNoVisual customisation
cursorCursorConfigNoAgent cursor overlay settings
onReady() => voidNoCalled when the SDK is ready
onError(error: Error) => voidNoCalled on unhandled errors
onAgentAssigned(agent: Agent) => voidNoCalled when an agent accepts the session
onCallStarted() => voidNoCalled when the video call begins
onCallEnded() => voidNoCalled when the video call ends
onCobrowseStarted() => voidNoCalled when cobrowsing begins
onCobrowseEnded() => voidNoCalled when cobrowsing ends
onCobrowseConsentRequired(handlers: CobrowsingConsentHandlers) => voidNoCalled when the agent requests cobrowsing consent

Control the visual appearance of the widget with WidgetTheme:

const widget = new WidgetClient({
widgetKey: "your-widget-key",
theme: {
primaryColor: "#6366f1",
position: "bottom-right",
borderRadius: "12px",
fontFamily: "Inter, sans-serif",
},
});
OptionTypeDescription
primaryColorstringBrand color for buttons and accents (any CSS color value)
position"bottom-right" | "bottom-left" | "top-right" | "top-left"Widget position on screen. Defaults to bottom-right
borderRadiusstringCorner radius of the widget panel (any CSS value, e.g. "8px")
fontFamilystringFont used inside the widget (any CSS font stack)

Control the agent cursor overlay with CursorConfig:

const widget = new WidgetClient({
widgetKey: "your-widget-key",
cursor: {
enabled: true,
autoHideDelay: 2000,
showLabel: true,
clickAnimation: true,
},
});
OptionTypeDefaultDescription
enabledbooleantrueShow or hide the agent cursor overlay
autoHideDelaynumber2000Milliseconds before the cursor fades after the agent stops moving
showLabelbooleantrueShow the agent’s name next to the cursor
clickAnimationbooleantrueAnimate a ripple when the agent clicks

By default the widget renders a floating button in the corner defined by theme.position. To mount it inside your own element instead, pass a CSS selector or a DOM reference:

const widget = new WidgetClient({
widgetKey: "your-widget-key",
container: "#support-widget",
// or: container: document.getElementById("support-widget"),
});

The element must exist in the DOM before widget.init() is called.

Each widget key is locked to a set of trusted domains. Requests from other origins are rejected with a 403 error.

To add a domain:

  1. Open your Univerx dashboard and go to Settings → Widgets.
  2. Select your widget and open the Domains tab.
  3. Enter the full origin of your site, including protocol (e.g. https://example.com).
  4. Verify ownership using the DNS TXT record or HTML meta tag provided.