Appearance
reset and startTour
reset
Call reset() when the user signs out.
ts
import { reset } from "@justonecx/sdk";
await reset(); // clear identity, start a new anonymous visitor, run init() again
await reset({ remount: false }); // clear only, do not run init() againWhy it matters: the visitor id is a permanent id in localStorage. On a shared browser, the next person who signs in would otherwise inherit the previous person's open chat and other visitor state.
reset() does these steps:
- Removes the chat bubble and closes its connection.
- Stops any tour that is still playing and removes launcher buttons.
- Deletes the stored visitor id and creates a new one.
- Runs
init()again with the same key and URL, unlessremountisfalseorinit()never ran.
A new chat bubble appears after reset(). This is by design.
startTour
Replay a tour from your own button, for example a "Show me around" item in a help menu.
ts
import { startTour } from "@justonecx/sdk";
startTour("export-flow"); // the tour's key, or its idstartTour plays the tour immediately. It ignores the tour's targeting, frequency cap and completion state. Pass the tour's key (set when an AI assistant creates the tour, e.g. export-flow) or its id, which is in the URL of the tour's edit page in the dashboard. Only published tours start.
Preview links
A link like https://your-app.com/settings/export?jcx_preview=… (from the dashboard or an AI assistant) plays that tour's current draft for 24 hours, on any page where the SDK runs. The SDK removes the token from the address bar right away. Nothing else from your workspace shows on a preview page.
A tour can also show its own persistent launcher button. Enable it in the tour editor: Settings tab, Launcher section. The launcher calls startTour for you.