@deftstar/support-widget
v0.1.0
Published
Embed the Support widget in any web app — floating button, ticket panel, and error reporting. Framework-agnostic.
Maintainers
Readme
@deftstar/support-widget
Embed the Support widget in any web app — floating button, ticket panel,
and "report a problem" flow. Framework-agnostic. Same source as the backend-served
/widget/v1.js, packaged for import.
Install
npm i @deftstar/support-widgetUse
import { SupportWidget } from '@deftstar/support-widget';
SupportWidget.init({
projectKey: 'pk_…',
userToken: JWT, // short-lived identity token minted by YOUR backend with the project secret
trigger: 'float',
baseUrl: 'https://support-api.deftstar.dev',
});Importing also attaches window.SupportWidget, so it works the same whether you
import it or load it via a <script> tag.
API
init(opts)— boot the widget (renders the button, prepares the panel).open()/close()— control the panel.setContext(meta)— merge context attached to new tickets.setTheme(theme)— update the theme at runtime.reportError({ errorRef, subject?, body? })— open a prefilled "report a problem" form for a captured error, carrying a correlation id through ticket creation.
The panel itself always loads from your Support origin (an iframe), so the widget stays small and updates server-side.
Error → ticket
Pair with a backend package (deftstar/support-laravel, gosupport) and, on the
frontend, call reportError() when a request fails — e.g. via
@deftstar/support-angular for Angular apps.
