npm.io
0.1.7 • Published 6d ago

@tmls-ai/support

Licence
UNLICENSED
Version
0.1.7
Deps
1
Size
28 kB
Vulns
0
Weekly
961

@tmls/support

Embeddable Timeless support widget — bottom-right report overlay (type / severity / screenshot) + ticket thread. Auto-captures context and talks to tmls-support-api.

Usage (React)

import { SupportWidget } from '@tmls/support';

<SupportWidget
  productId="drona"
  apiUrl="https://support.timeless.app"
  getToken={() => fetch('/api/support-token').then(r => r.text())}
  user={{ id, email, name, plan }}
  accent="#0a84ff"
  appVersion={import.meta.env.VITE_BUILD}
  getContext={() => ({ route: location.pathname, config, specs, conversationId })}
/>

Usage (any app, Shadow-DOM isolated)

import { mountSupportWidget } from '@tmls/support';
const unmount = mountSupportWidget({ productId, apiUrl, getToken, getContext });

Host backend contract

Expose an endpoint that signs a short-lived JWT with the product's JWT_SECRET_<PRODUCT> (same secret the Worker holds):

jwt.sign({ productId: 'drona', userId, email, plan }, JWT_SECRET_DRONA, { expiresIn: '10m' })

The widget never holds a secret; the server trusts the signed token.

Build

npm run build   # → dist/ (ESM + types)

v1: src/types.ts mirrors tmls-support-api/src/types.ts — keep in sync.

Keywords