API Reference
Complete method reference for the JotReview JavaScript SDK.
Overview
The JotReview SDK exposes all methods through the global window.uj object. Every method call is queued until the SDK script finishes loading, so you can call methods immediately after the snippet without waiting for a load event.
All methods are safe to call before the SDK has fully initialized — they will be replayed in order once the script is ready.
init(projectId, options?)
Initializes the SDK with your project credentials. This must be the first method you call.
Parameters
| Parameter | Type | Required | Description | ||
|---|---|---|---|---|---|
projectId | string | Yes | Your project ID from the JotReview dashboard | ||
options.widget | boolean | No | Show the floating feedback button. Default: true | ||
options.position | `'left' \ | 'right'` | No | Widget button position. Default: 'right' | |
options.theme | `'light' \ | 'dark' \ | 'auto'` | No | Color theme. 'auto' follows system preference. Default: 'auto' |
options.language | string | No | Force a locale (e.g. 'es', 'fr'). Defaults to browser language | ||
options.trigger | `'default' \ | 'custom'` | No | 'custom' hides the built-in button so you can use your own trigger. Default: 'default' | |
options.onReady | () => void | No | Callback fired when the SDK has fully loaded | ||
options.onError | (err: Error) => void | No | Callback fired if initialization fails |
Returns void
identify(userData | null)
Associates the current user with their JotReview identity. Call this as soon as you know who the user is — typically right after login or on app load if the user has an active session.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Your internal user ID. Must be stable and unique |
email | string | No | User's email address |
firstName | string | No | User's first name |
lastName | string | No | User's last name |
avatar | string | No | Publicly accessible URL to the user's profile image |
signature | string | No | HMAC-SHA256 signature for secure identity verification |
Pass null to log out the current user and return to anonymous mode.
Returns void
// Log out
window.uj.identify(null);
`
showWidget({ section? })
Programmatically opens the widget panel. Useful for custom trigger buttons or guided flows.
Parameters
| Parameter | Type | Required | Description | ||
|---|---|---|---|---|---|
options.section | `'feedback' \ | 'roadmap' \ | 'updates'` | No | Open directly to a specific tab. Defaults to the last active section |
Returns void
// Open directly to the Roadmap tab window.uj.showWidget({ section: 'roadmap' });
// Open directly to the Updates (changelog) tab
window.uj.showWidget({ section: 'updates' });
`
hideWidget()
Closes the widget panel if it is currently open.
Returns void
getWidgetState()
Returns the current state of the widget panel. Because SDK calls are asynchronous, this method returns a Promise.
| Returns `Promise<{ isOpen: boolean; section: 'feedback' | 'roadmap' | 'updates' | null }>` |
|---|
| console.log(state.isOpen); // true | false |
|---|---|
` |
setWidgetPosition('left' | 'right')
Changes the position of the floating widget button at runtime. Useful when the button overlaps important UI at certain scroll positions.
Returns void
setTheme('light' | 'dark' | 'auto')
Updates the widget's color theme at runtime. Use this to synchronize the widget with a theme toggle in your application.
Returns void
// Or always follow the system preference
window.uj.setTheme('auto');
`
setWidgetEnabled(boolean)
Shows or hides the widget button and disables all widget interactions. Use this to conditionally expose the widget only to certain users (e.g., beta testers or paying customers).
Returns void
embed(options?)
Renders the full JotReview board as an inline embed inside a container element instead of as a floating widget. Returns an EmbedController for programmatic control.
EmbedOptions
| Option | Type | Required | Description | ||
|---|---|---|---|---|---|
container | `HTMLElement \ | string` | Yes | Target element or CSS selector | |
path | string | No | Initial path to load (e.g. '/roadmap'). Defaults to '/' | ||
theme | `'light' \ | 'dark' \ | 'auto'` | No | Color theme. Default: 'auto' |
navbar | boolean | No | Show the board's top navigation bar. Default: true | ||
basePath | string | No | Path prefix in your app's router (e.g. '/feedback'). Used for URL syncing | ||
onReady | (controller: EmbedController) => void | No | Callback fired when the embed is ready | ||
onError | (err: Error) => void | No | Callback fired if the embed fails to load |
EmbedController
| Method | Description |
|---|---|
navigate(path) | Navigate to a path within the embed |
destroy() | Remove the embed and clean up |
Returns EmbedController
// Navigate programmatically embed.navigate('/updates');
// Clean up
embed.destroy();
`
open() / close() — deprecated
These are aliases for showWidget() and hideWidget() from an earlier version of the SDK. They continue to work but will be removed in a future major version.
Migration
// After
window.uj.showWidget();
window.uj.hideWidget();
`
destroy()
Completely removes the JotReview widget from the page, cleans up all event listeners, and unloads the SDK script. After calling destroy(), you must call init() again to reinitialize.
This is useful in single-page applications when navigating to a page where the widget should not appear.
Returns void