Junco Guides

Widget reference

In short. https://desk.juncodesk.app/widget/junco.js defines one global, Junco, with init(options), open({ type }), close() and version. Only game is required (pass server too unless the page is on Junco's own address). Every other option is a function Junco calls when it needs the value; each may return a value, null or a promise, and may fail without breaking anything.

Junco.init(options)

Starts the widget. Call it once per page load; later calls are ignored and return Junco. If the page's <body> doesn't exist yet, it waits for DOMContentLoaded. Throws only if game is missing.

Option Type Default What it's for
game string required The product's public key, jk_....
server string the page's own origin Junco's address: https://desk.juncodesk.app. Always pass it on your own site.
context () => object none What's useful when something goes wrong: version, screen, device, settings. Called each time the panel opens. Up to 16 KB as JSON. No personal details.
screenshot () => Blob none An image of the screen (PNG, JPEG or WebP, under 2 MB). Called when the panel opens, before it covers the page. The user chooses whether to attach it.
save () => Blob | string none The user's save or state (under 1 MB). A string is sent as JSON text. Asked for only if the user ticks "Save and log".
log () => string none Recent log lines (UTF-8 text, under 512 KB). With "Save and log".
playerToken () => string none A signed token from your server for a signed-in user (Signed user tokens). Called before every request; return null for users who aren't signed in.
handle () => string none The user's display name (up to 40 characters), shown to your team. A signed token's name wins over it.
button boolean true false hides Junco's round button; open the panel from your own menu instead.
onUnread (count: number) => void none Called when the number of tickets with replies the user hasn't read changes, for a badge on your own button.

"Function" options may be async. If one throws or rejects, Junco carries on without that value.

Junco.open(options?)

Opens the panel. With no argument it shows the three choices (Report a bug, Suggest a feature, Get help) and the user's earlier tickets. Junco.open({ type: "bug" }) goes straight to one form; type is "bug", "idea" or "help". Returns a promise, or undefined before init.

Junco.close()

Closes the panel. The user can also press Esc or the close button; focus goes back to where it was.

Junco.version

The widget's version, such as "0.1.6".

What users see

How it behaves

Example with everything

Junco.init({
  game: "jk_...",
  server: "https://desk.juncodesk.app",
  button: false,
  context: () => ({ version: APP_VERSION, screen: router.current, device: navigator.userAgent, language: navigator.language }),
  screenshot: () => captureCanvasAsJpeg(),
  save: () => JSON.stringify(store.exportSave()),
  log: () => logger.recent(200).join("\n"),
  playerToken: () => fetch("/api/junco-token").then((r) => (r.ok ? r.text() : null)),
  handle: () => session.user?.displayName,
  onUnread: (n) => (supportBadge.textContent = n ? String(n) : ""),
});
document.querySelector("#support").addEventListener("click", () => Junco.open());

TypeScript declarations: For coding AIs, section 7.

For AI tools: this page as Markdown at /docs/widget.md, every guide in one file at /llms-full.txt, the API as OpenAPI. Checked against Junco on 2026-11-25.