@preethamsaiesh/faas-sdk
v1.0.0
Published
(# Feedback-as-a-Service — FaaS SDK)
Readme
(# Feedback-as-a-Service — FaaS SDK)
Lightweight, framework-agnostic JavaScript/TypeScript SDK for embedding a feedback capture widget (text + screenshot) into host web applications.
Purpose
FaaS provides a drop-in feedback widget that lets end users submit textual feedback and optional screenshots. Feedback is sent securely to a backend API for aggregation and later review by administrators.
Features
- Small, single-file SDK build intended for browser embedding
- Drop-in floating button with lightweight feedback panel (text + image)
- Programmatic API:
init,open,close,destroy,on,off,submit - Event-driven integration:
initialized,opened,closed,destroyed,submitted,error - Minimal DOM helpers and no framework dependency
Public API
FaaS.init(config: FaaSConfig)— initialize the SDK and mount the widget.FaaS.open()/FaaS.close()/FaaS.destroy()— control widget lifecycle.FaaS.on(event, cb)/FaaS.off(event, cb?)— subscribe/unsubscribe to SDK events.FaaS.submit(payload)— programmatically submit feedback (returns a Promise).
FaaSConfig (key fields):
apiKey: string— API key for authenticating to your FaaS backend.projectId: string— project identifier used by the backend.apiBaseUrl: string— base URL for the backend API.position?: 'bottom-right' | 'bottom-left'— widget placement (defaults tobottom-right).theme?: 'light' | 'dark'— optional visual theme.debug?: boolean— enable debug logging.
Security & GDPR
- API requests use bearer tokens (
Authorization: Bearer <apiKey>). Protect API keys on server-side configuration and limit scopes where possible. - The widget collects screenshots and text. Hosts should disclose data collection in privacy notices and provide users a way to opt out.
Building
Install dev dependencies and build with Vite:
npm install
npm run buildThe build outputs are controlled by vite.config.ts and will generate ESM + type declarations.
