Mite Instance API
Every method and property on the Mite class.
The Mite class is the imperative surface under every hook and component.
Reach it with useMite() inside the provider, or keep a
reference to the instance you constructed.
import { Mite } from '@usemite/sdk'
const mite = new Mite({ apiKey: process.env.EXPO_PUBLIC_MITE_API_KEY })
mite.init()Every method that talks to the API throws
[Mite] API key is required to … when apiKey is not configured. The
exceptions are logout, setIdentificationOptOut, the store review methods,
the last-seen-release methods, and flushOfflineQueue, which work without one.
Lifecycle
init(): void
Sets up the offline queue and kicks off a background identity
sync. Call once after constructing the instance. Calling it again logs
[Mite] SDK already initialized and returns.
Also warns when no persistent identityStorage
is configured.
destroy(): void
Stops the offline queue flush timer, discards anything pending, and marks the
instance uninitialized. init() can be called again afterward.
Bug reports
submitBug(payload): Promise<SubmitBugResult>
Submit a bug report. Enriches the payload with the current identity, device info, and the navigation trail, uploads any attachments, and posts the report.
Check result.ok before you read result.report. A false value means the
account is over a plan limit and no report was created. A quota
refusal does not throw.
On a network failure with the queue enabled, the report is queued and the error is re-thrown. See Bug Reports.
Identity
See Identity Management for the full picture.
identify(payload): Promise<IdentifyUserResponse>
Link a real user to the current anonymous session. Persists the resulting identity locally.
logout(): Promise<void>
Clear the identified user, keeping the anonymous ID stable. Reverts local state if persisting fails.
setIdentificationOptOut(optedOut): Promise<void>
Toggle anonymous-only mode. Opting out clears the stored user identifier.
whenIdentityReady(): Promise<void>
Resolves once persisted identity has been restored from storage. Await it before reading the identity getters on startup — every network method awaits it internally already.
Identity properties
| Property | Type | Description |
|---|---|---|
anonymousId | string | Current anonymous identifier |
userIdentifier | string | undefined | Identified user, when one exists |
isIdentificationOptedOut | boolean | Whether anonymous-only mode is on |
Releases
getReleases(options?): Promise<Release[]>
Fetch published releases. Both platform and limit are optional; omitted
options are left out of the query string. See Releases.
getLastSeenReleaseVersion(): Promise<string | null>
The app version last acknowledged by the What's New widget.
Resolves to null when nothing has been seen or storage fails.
setLastSeenReleaseVersion(version): Promise<void>
Record a version as seen. Logs a [Mite] warning on failure rather than
throwing.
Announcements
See Announcements.
getAnnouncements(options?): Promise<Announcement[]>
Fetch the currently active announcements, newest first. Both platform and
limit are optional; omitted options are left out of the query string.
getSeenAnnouncementIds(): Promise<string[]>
IDs of announcements this device has dismissed. Resolves to an empty list when nothing has been seen or storage fails.
markAnnouncementSeen(id): Promise<void>
Record an announcement as seen. Logs a [Mite] warning on failure rather than
throwing. The stored list is capped at the 100 most recent ids.
clearSeenAnnouncements(): Promise<void>
Forget every seen announcement, so active announcements show again.
Feature requests
See Feature Requests.
getFeatureRequests(): Promise<FeatureRequest[]>
Fetch the board.
createFeatureRequest(payload): Promise<CreateFeatureRequestResponse>
Create a request. author_email is required; emails are lowercased and trimmed.
voteFeatureRequest(payload): Promise<VoteFeatureRequestResponse>
Toggle a vote, attributed to the current end user.
getFeatureRequestVotes(voterEmail?): Promise<string[]>
IDs the current user has voted for. Passing voterEmail is deprecated and
looks votes up by email instead of by end user.
Store review
See Store Review Prompt.
isStoreReviewAvailable(): Promise<boolean>
Whether the native review dialog can be requested. false when
expo-store-review is missing.
requestStoreReview(): Promise<boolean>
Request the native review dialog. Resolves to true when the request was made.
Never throws — resolves false when unavailable.
Offline queue
See Offline Queue.
flushOfflineQueue(): Promise<void>
Retry queued requests now. Never rejects; concurrent calls share one flush.
pendingRequestCount: number
Number of requests waiting in the queue. 0 when the queue is disabled.