@hanzo/ui

Feedback

import { reportFeedback, reportException, installGlobalExceptionReporter, DEFAULT_FEEDBACK_API } from '@hanzo/ui/product'

No examples yet.

Types

export type FeedbackKind = 'bug' | 'billing' | 'feature' | 'exception' | 'feedback'
export interface FeedbackPayload {
  kind: FeedbackKind
  subject?: string
  message?: string
  email?: string
  user?: string
  app?: string
  page?: string
  version?: string
  error?: string
  stack?: string
  context?: Record<string, string>
}
export interface FeedbackResult {
  id: string
  status: string
  kind: string
}
export interface FeedbackRequestOptions {
  /** Base API URL (defaults to `https://api.hanzo.ai`). */
  apiBase?: string
  /** Optional IAM Bearer token; omitted for anonymous submissions. */
  token?: string | null
  headers?: Record<string, string>
  signal?: AbortSignal
  fetch?: typeof fetch
}
export interface ReportExceptionOptions extends FeedbackRequestOptions {
  app?: string
  user?: string
  email?: string
  version?: string
  page?: string
  subject?: string
  message?: string
  context?: Record<string, string>
}
export interface GlobalExceptionTarget {
  addEventListener: (type: string, listener: (e: Event) => void) => void
  removeEventListener: (type: string, listener: (e: Event) => void) => void
}
export interface GlobalExceptionReporterOptions {
  apiBase?: string
  app: string
  version?: string
  /** Return user id/name string or `{ user, email }` for attribution. */
  getUser?: () => string | { user?: string; email?: string } | null | undefined
  /** Return current Bearer token if signed in. */
  getToken?: () => string | null | undefined
  /** Minimum ms before the same error signature is reported again. Default 60000 (1 min). */
  dedupeWindowMs?: number
  /** Maximum exception reports sent per session. Default 10. */
  maxReports?: number
  /** Clock override for tests. */
  now?: () => number
  /** Fetch override for tests. */
  fetch?: typeof fetch
  /** Event target override for tests (defaults to `window`). */
  target?: GlobalExceptionTarget
}

Exports

reportFeedbackreportExceptioninstallGlobalExceptionReporterDEFAULT_FEEDBACK_APItype FeedbackKindtype FeedbackPayloadtype FeedbackResulttype FeedbackRequestOptionstype ReportExceptionOptionstype GlobalExceptionTargettype GlobalExceptionReporterOptions