MiteSDK

Types Reference

All TypeScript types exported by the Mite SDK.

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

Request payloads use snake_case (author_name, user_identifier) because they map directly onto the wire format. Response objects use camelCase (authorName, voteCount). Watch for this when moving a value from a response into a request.

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
  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
}

Bug reports

SubmitBugReportPayload

interface SubmitBugReportPayload {
  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
  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 — see Bug Reports.

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

IdentifyUserPayload

Every field is optional — identify({}) re-syncs the current anonymous identity.

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

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'

CreateFeatureRequestPayload

author_email is required so the team can follow up.

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[]
}
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 PropsWithChildrenchildren 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