MiteSDK

Types Reference

All TypeScript types exported by the Mite SDK.

Every type below is exported from @usemite/sdk, except where noted.

The namespaced inputs (SendFeedbackInput, RequestFeatureInput, IdentifyOptions) and response objects use camelCase. The 1.0 payloads (SubmitBugReportPayload, CreateFeatureRequestPayload, IdentifyUserPayload) and SubmitFeatureRequestInput use snake_case, because they map directly onto the wire format.

Configuration

MiteConfig

interface MiteConfig {
  apiKey?: string
  endpoint?: string
  timeout?: number
  retries?: number
  anonymousId?: string
  identityStorage?: MiteIdentityStorage | MiteMMKVLikeStorage
  identificationOptOut?: boolean
  enableOfflineQueue?: boolean
  enableNavigationBreadcrumbs?: boolean
  maxNavigationBreadcrumbs?: number
  captureUncaughtErrors?: boolean
  captureUnhandledRejections?: boolean
  enableErrorTracking?: boolean
  ignoreErrors?: Array<string | RegExp>
  beforeSendError?: (event: MiteErrorEvent) => MiteErrorEvent | null
  onQuotaExceeded?: (refusal: MiteQuotaRefusal) => void
}

See Configuration options for defaults.

MiteIdentityStorage

AsyncStorage-compatible adapter. Methods may be sync or async.

interface MiteIdentityStorage {
  getItem(key: string): string | null | Promise<string | null>
  setItem(key: string, value: string): void | Promise<void>
  removeItem(key: string): void | Promise<void>
}

MiteMMKVLikeStorage

react-native-mmkv shape. Pass an MMKV instance directly — the SDK detects it and wraps it.

interface MiteMMKVLikeStorage {
  getString(key: string): string | undefined
  set(key: string, value: string): void
  delete(key: string): void
}

MiteProviderProps

Pass client. miteInstance is the deprecated 1.0 name.

type MiteProviderProps = { children: React.ReactNode } & (
  | { client: Mite; miteInstance?: never }
  | { /** @deprecated Use `client`. */ miteInstance: Mite; client?: never }
)

Feedback

FeedbackType

type FeedbackType = 'bug' | 'question' | 'idea' | 'other'

SendFeedbackInput

The input for mite.feedback.send() and useFeedback().send. The bug-only fields exist only when type is 'bug', so TypeScript rejects steps on a question.

interface FeedbackFields {
  message: string
  /** Defaults to the message's first line, set by the server. */
  title?: string
  /** Defaults to the identified user. */
  reporter?: { name?: string; email?: string }
  /** Local URI of a screenshot. Shorthand for the first attachment. */
  screenshot?: string
  attachments?: MiteAttachment[]
  /** Extra flat context, merged over the SDK's own environment keys. */
  context?: Record<string, string>
}

type SendFeedbackInput =
  | (FeedbackFields & {
      type: 'bug'
      steps?: string
      expected?: string
      actual?: string
    })
  | (FeedbackFields & {
      /** Defaults to 'other'. */
      type?: Exclude<FeedbackType, 'bug'>
      steps?: never
      expected?: never
      actual?: never
    })

FeedbackFields is internal and not exported.

SendFeedbackResult

The same shape as SubmitBugResult. ok: false is a plan limit, not a fault.

type SendFeedbackResult = SubmitBugResult

MiteAttachment

A file to attach, by local URI.

interface MiteAttachment {
  uri: string
  /** MIME type, such as `image/png`. Read from the file when omitted. */
  type?: string
  name?: string
}

UseFeedbackResult

interface UseFeedbackResult {
  send: (input: SendFeedbackInput) => Promise<SendFeedbackResult>
  sending: boolean
  error: Error | null
  lastResponse: SubmitBugReportResponse | null
  refusal: MiteQuotaRefusal | null
  reset: () => void
}

Bug reports (1.0)

These types back the deprecated submitBug and the useBugReport hook.

SubmitBugReportPayload

interface SubmitBugReportPayload {
  /** Set by `feedback.send()`. The server treats a report without one as a bug. */
  kind?: FeedbackType
  title: string
  description: string
  user_identifier?: string
  anonymous_id?: string
  reporter_name?: string
  reporter_email?: string
  steps_to_reproduce?: string
  expected_behavior?: string
  actual_behavior?: string
  app_version?: string
  eas_update_id?: string
  channel?: string
  runtime_version?: string
  device_info?: Record<string, unknown>
  environment?: Record<string, unknown>
  navigation_trail?: NavigationBreadcrumb[]
  attachments?: Array<{ uri: string; type?: string; name?: string }>
}

title and description are both required. There is no priority field. Priority is set during triage in the dashboard.

BugReportPayload

The payload accepted by useBugReport:

type BugReportPayload = Omit<SubmitBugReportPayload, 'appId' | 'deviceInfo'>

SubmitBugReportResponse

interface SubmitBugReportResponse {
  id: string
  status: 'NEEDS_TRIAGE'
}

SubmitBugResult

The outcome of a submission. See Plan Quotas.

type SubmitBugResult =
  | {
      ok: true
      report: SubmitBugReportResponse
      droppedAttachments?: { count: number; refusal: MiteQuotaRefusal }
    }
  | { ok: false; refusal: MiteQuotaRefusal }

MiteQuotaRefusal

type MiteQuotaCode = 'REPORT_QUOTA_EXCEEDED' | 'STORAGE_QUOTA_EXCEEDED'

interface MiteQuota {
  limit: number
  used: number
  /** Milliseconds since the epoch. On the report code only. */
  resetsAt?: number
}

interface MiteQuotaRefusal {
  code: MiteQuotaCode
  /** Written for the developer who owns the account, not for end users. */
  message: string
  quota: MiteQuota
}

UseBugReportResult

interface UseBugReportResult {
  submitBug: (payload: BugReportPayload) => Promise<SubmitBugResult>
  submitting: boolean
  error: Error | null
  lastResponse: SubmitBugReportResponse | null
  refusal: MiteQuotaRefusal | null
  reset: () => void
}

Identity

IdentifyOptions

The options for mite.user.identify(id, options).

interface IdentifyOptions {
  email?: string
  name?: string
  /** Mite alerts you when a paying user's report shows churn risk. */
  isPaying?: boolean
  /** Any other traits to keep on the user's profile. */
  traits?: Record<string, unknown>
}

IdentifyUserPayload

The payload of the deprecated 1.0 identify(). Every field is optional.

interface IdentifyUserPayload {
  user_identifier?: string
  anonymous_id?: string
  email?: string
  name?: string
  device_info?: Record<string, unknown>
  app_version?: string
  metadata?: Record<string, unknown>
  isPaying?: boolean
}

IdentifyUserResponse

interface IdentifyUserResponse {
  id: string
  created: boolean
}

Releases

Release

interface Release {
  id: string
  version: string
  versionCode: number
  platform: ReleasePlatform
  notes?: string
  releasedAt?: number
  createdAt: number
}

ReleasePlatform

type ReleasePlatform = 'ios' | 'android' | 'all'

ReleasePlatform is not currently exported from the package root, even though Release and GetReleasesOptions are built on it. Write the union inline — 'ios' | 'android' | 'all' — or derive it with Release['platform'].

GetReleasesOptions

interface GetReleasesOptions {
  platform?: ReleasePlatform
  limit?: number
}

UseReleasesOptions

interface UseReleasesOptions extends GetReleasesOptions {
  enabled?: boolean // default: false
}

UseReleasesResult

interface UseReleasesResult {
  releases: Release[]
  loading: boolean
  error: Error | null
  refetch: () => Promise<void>
}

UseWhatsNewOptions

interface UseWhatsNewOptions {
  currentVersion?: string
  platform?: ReleasePlatform
  showOnFirstLaunch?: boolean // default: false
  limit?: number // default: 20
  enabled?: boolean // default: true
}

UseWhatsNewResult

interface UseWhatsNewResult {
  visible: boolean
  releases: Release[]
  currentVersion: string | null
  loading: boolean
  error: Error | null
  show: () => void
  dismiss: () => Promise<void>
}

Announcements

Announcement

interface Announcement {
  id: string
  title: string
  content: string // markdown
  platform: ReleasePlatform
  ctaLabel?: string
  ctaUrl?: string
  publishedAt?: number
  updatedAt?: number
  createdAt: number
}

AnnouncementsResponse

interface AnnouncementsResponse {
  announcements: Announcement[]
}

GetAnnouncementsOptions

interface GetAnnouncementsOptions {
  platform?: ReleasePlatform
  limit?: number
}

UseAnnouncementsOptions

interface UseAnnouncementsOptions extends GetAnnouncementsOptions {
  enabled?: boolean // default: false
}

UseAnnouncementsResult

interface UseAnnouncementsResult {
  announcements: Announcement[]
  loading: boolean
  error: Error | null
  refetch: () => Promise<void>
}

UseAnnouncementPopupOptions

interface UseAnnouncementPopupOptions {
  platform?: ReleasePlatform
  limit?: number // default: 10
  enabled?: boolean // default: true
}

UseAnnouncementPopupResult

interface UseAnnouncementPopupResult {
  visible: boolean
  announcement: Announcement | null
  loading: boolean
  error: Error | null
  show: () => void
  dismiss: () => Promise<void>
}

Feature requests

FeatureRequest

interface FeatureRequest {
  id: string
  title: string
  description: string
  authorName: string
  voteCount: number
  status: FeatureRequestStatus
  createdAt: number
}

FeatureRequestStatus

type FeatureRequestStatus = 'OPEN' | 'IN_PROGRESS' | 'COMPLETED' | 'CLOSED'

RequestFeatureInput

The input for mite.features.request(). author.email is required so the team can follow up.

interface RequestFeatureInput {
  title: string
  description?: string
  author: { email: string; name?: string }
}

CreateFeatureRequestPayload

The payload of the deprecated 1.0 createFeatureRequest(). author_email is required.

interface CreateFeatureRequestPayload {
  title: string
  description?: string
  author_name?: string
  author_email: string
  anonymous_id?: string
  user_identifier?: string
}

CreateFeatureRequestResponse

interface CreateFeatureRequestResponse {
  id: string
  status: FeatureRequestStatus
}

VoteFeatureRequestPayload

interface VoteFeatureRequestPayload {
  feature_request_id: string
  /** @deprecated Votes are tied to the SDK's identified/anonymous end user. */
  voter_email?: string
  anonymous_id?: string
  user_identifier?: string
}

VoteFeatureRequestResponse

interface VoteFeatureRequestResponse {
  voted: boolean
  voteCount: number
}

FeatureRequestsResponse

interface FeatureRequestsResponse {
  requests: FeatureRequest[]
}

FeatureRequestVotesResponse

interface FeatureRequestVotesResponse {
  featureRequestIds: string[]
}

SubmitFeatureRequestInput

The input accepted by the hook's submitFeatureRequest:

interface SubmitFeatureRequestInput {
  title: string
  description?: string
  author_name?: string
  author_email: string
}

UseFeatureRequestsOptions

interface UseFeatureRequestsOptions {
  enabled?: boolean // default: false
  /** @deprecated */
  voterEmail?: string
}

UseFeatureRequestsResult

interface UseFeatureRequestsResult {
  featureRequests: FeatureRequest[]
  votedFeatureRequestIds: string[]
  loading: boolean
  error: Error | null
  refetch: () => Promise<void>
  submitFeatureRequest: (
    input: SubmitFeatureRequestInput,
  ) => Promise<CreateFeatureRequestResponse>
  submitting: boolean
  submitError: Error | null
  toggleVote: (featureRequestId: string) => Promise<VoteFeatureRequestResponse>
  votingFeatureRequestIds: string[]
}

Errors

CaptureOptions

The options for mite.errors.capture() and captureError().

interface CaptureOptions {
  fatal?: boolean
  /** Defaults to true for explicit calls. */
  handled?: boolean
  context?: Record<string, string>
}

MiteErrorEvent

One error occurrence, as beforeSendError receives it.

interface MiteErrorEvent {
  name: string
  message: string
  stack?: string
  is_fatal: boolean
  handled: boolean
  occurred_at: number
  user_identifier?: string
  anonymous_id?: string
  app_version?: string
  eas_update_id?: string
  channel?: string
  runtime_version?: string
  device_info?: Record<string, string>
  environment?: Record<string, string>
  navigation_trail?: NavigationBreadcrumb[]
}

Namespaces

The interface of each namespace on the instance. See Mite Instance API for what each method does.

interface MiteFeedbackApi {
  send(input: SendFeedbackInput): Promise<SendFeedbackResult>
}

interface MiteFeaturesApi {
  list(): Promise<FeatureRequest[]>
  request(input: RequestFeatureInput): Promise<CreateFeatureRequestResponse>
  vote(id: string): Promise<VoteFeatureRequestResponse>
  myVotes(): Promise<string[]>
}

interface MiteErrorsApi {
  capture(error: unknown, options?: CaptureOptions): void
  flush(): Promise<void>
}

interface MiteUserApi {
  identify(id: string, options?: IdentifyOptions): Promise<IdentifyUserResponse>
  reset(): Promise<void>
  optOut(): Promise<void>
  optIn(): Promise<void>
  readonly id: string | undefined
  readonly anonymousId: string
  readonly isOptedOut: boolean
}

interface MiteReleasesApi {
  list(options?: GetReleasesOptions): Promise<Release[]>
  lastSeen(): Promise<string | null>
  markSeen(version: string): Promise<void>
}

interface MiteAnnouncementsApi {
  list(options?: GetAnnouncementsOptions): Promise<Announcement[]>
  markSeen(id: string): Promise<void>
  seenIds(): Promise<string[]>
  clearSeen(): Promise<void>
}

interface MiteStoreReviewApi {
  isAvailable(): Promise<boolean>
  request(): Promise<boolean>
}
interface NavigationBreadcrumb {
  screen: string
  timestamp: number
}

MiteNavigationContainerRefLike

The structural shape useMiteNavigationTracking accepts. It matches React Navigation's and Expo Router's useNavigationContainerRef() without requiring either library.

interface MiteNavigationContainerRefLike {
  isReady?: () => boolean
  getCurrentRoute?: () => { name: string } | undefined
  addListener?: (type: 'state', callback: () => void) => () => void
}

Components

ShakeDetectorOptions

interface ShakeDetectorOptions {
  threshold?: number // default: 1.8
  minShakes?: number // default: 3
  shakeWindowMs?: number // default: 1000
  cooldownMs?: number // default: 2000
  updateIntervalMs?: number // default: 100
  accelerometerModule?: AccelerometerModule // testing override
}

AccelerometerModule is an internal type and is not exported. ShakeToReportProps['shakeOptions'] omits it for that reason.

ShakeToReportProps

interface ShakeToReportProps {
  shakeEnabled?: boolean // default: true
  showFloatingButton?: boolean // default: false
  screenshotEnabled?: boolean // default: true
  shakeOptions?: Omit<ShakeDetectorOptions, 'accelerometerModule'>
  onSubmitted?: (response: SubmitBugReportResponse) => void
  onError?: (error: Error) => void
}

ScreenshotAnnotatorProps

interface ScreenshotAnnotatorProps {
  imageUri: string
  onDone: (annotatedUri: string) => void
  onCancel: () => void
}

WhatsNewProps

interface WhatsNewProps extends UseWhatsNewOptions {
  title?: string // default: "What's New"
  dismissLabel?: string // default: 'Got it'
  onDismiss?: () => void
}

FeatureRequestsSheetProps

interface FeatureRequestsSheetProps {
  title?: string // default: 'Feature requests'
  accentColor?: string // default: '#0a7ea4'
  onSubmitted?: (featureRequestId: string) => void
}

Rendered with PropsWithChildren — children is the trigger element.

StoreReviewPromptProps

interface StoreReviewPromptProps {
  visible: boolean
  onClose: () => void
  title?: string
  message?: string
  positiveText?: string
  negativeText?: string
  feedbackTitle?: string
  feedbackPlaceholder?: string
  feedbackSubmitText?: string
  dismissText?: string
  feedbackReportTitle?: string
  onPositive?: (reviewRequested: boolean) => void
  onNegative?: () => void
  onFeedbackSubmitted?: (response: SubmitBugReportResponse) => void
}

See Store Review Prompt for defaults.

On this page