/** * Public surface for the Mushi Mushi Capacitor plugin. * * The Capacitor bridge is intentionally thin — actual transport, queue, and * categorization live in `@mushi-mushi/core`. The native side only handles * shake detection, screenshot capture, and presenting the native bottom * sheet (when `useNativeWidget = true`); everything else flows through the * shared TS API client so behaviour is identical with the web SDK. */ type MushiTriggerMode = 'shake' | 'button' | 'both' | 'none'; type MushiTriggerInsetPreset = 'tabBarSafe' | 'dockSafe'; declare const triggerInsetPresets: Record; interface MushiCapacitorPluginConfig { /** Project UUID from the Mushi admin console. */ projectId: string; /** Mushi API key (`mushi_...`). Mint one in the admin console under Projects → API Keys. */ apiKey: string; /** * Supabase Edge Function URL for the ingest endpoint. * Required for reports to be delivered. Example: `https://xyz.supabase.co/functions/v1/api`. */ endpoint?: string; /** Defaults to `'shake'`. */ triggerMode?: MushiTriggerMode; /** When `true`, captures a base64 screenshot via the native bridge. */ captureScreenshot?: boolean; /** Minimum description length in the widget. Mirrors the web SDK. */ minDescriptionLength?: number; /** * When `true`, presents the native iOS/Android bottom sheet instead of * letting your Ionic/web layer render the report form. * Defaults to `false` (web widget). */ useNativeWidget?: boolean; /** Theme overrides for the native bottom sheet. */ theme?: { accentColor?: string; dark?: boolean; }; /** Native trigger offset in logical px/dp. Defaults keep the historical bottom-right button. */ triggerInset?: { bottom?: number; leading?: number; trailing?: number; start?: number; end?: number; }; /** Convenience preset for common mobile shells; explicit `triggerInset` wins when both are provided. */ triggerInsetPreset?: MushiTriggerInsetPreset; } interface MushiCapacitorReport { description: string; category?: 'bug' | 'slow' | 'visual' | 'confusing' | string; metadata?: Record; } interface MushiCapacitorUser { id?: string; email?: string | null; name?: string | null; [key: string]: unknown; } interface MushiCapacitorWidgetOptions { category?: 'bug' | 'slow' | 'visual' | 'confusing' | string; metadata?: Record; } interface MushiCapacitorBreadcrumb { timestamp?: number; category: 'navigation' | 'ui.tap' | 'console' | 'network' | 'lifecycle' | 'custom'; level?: 'debug' | 'info' | 'warning' | 'error'; message: string; data?: Record; } interface MushiCapacitorPlugin { /** Initialize the plugin. Idempotent. */ configure(options: MushiCapacitorPluginConfig): Promise; /** Submit a report immediately, flowing through the offline queue if the * network is unreachable. */ report(payload: MushiCapacitorReport): Promise<{ accepted: boolean; }>; /** Capture a screenshot of the active webview as a base64-encoded PNG. * Returns `null` if `captureScreenshot` is disabled or unsupported. */ captureScreenshot(): Promise<{ image: string | null; }>; /** Present the native bottom-sheet widget. Resolves when the user * dismisses or submits. */ showWidget(options?: MushiCapacitorWidgetOptions): Promise; /** Attach app/user identity to subsequent native reports. */ setUser(payload: { user: MushiCapacitorUser | null; }): Promise; /** * Identify the current end user with a signed Mushi identity JWT minted by * the host server. The backend verifies the signature before trusting any * claim; this is the trust anchor for "My Reports", rewards, and the * per-user assistant index. Pass `{ token: null }` on logout. */ identifyWithToken(payload: { token: string | null; }): Promise; /** Attach or clear a metadata key on subsequent native reports. */ setMetadata(payload: { key: string; value?: unknown; }): Promise; /** Force a flush of the offline queue. */ flushQueue(): Promise<{ delivered: number; }>; /** * Append a breadcrumb to the native ring buffer. Mirrors `Mushi.addBreadcrumb()` * from the web SDK — the same 50-entry FIFO is flushed with every report. */ addBreadcrumb(crumb: MushiCapacitorBreadcrumb): Promise; /** * Return a snapshot of the current native breadcrumb ring buffer, oldest first. */ getBreadcrumbs(): Promise<{ breadcrumbs: MushiCapacitorBreadcrumb[]; }>; /** Listener API — fired on every successful report submission. */ addListener(eventName: 'reportSubmitted', listenerFunc: (event: MushiCapacitorReport & { context: unknown; }) => void): Promise<{ remove: () => Promise; }>; /** List the reporter's own reports (two-way inbox data API). */ listMyReports(): Promise<{ reports: Array>; }>; /** List comments visible to the reporter on a report. */ listMyComments(options: { reportId: string; }): Promise<{ comments: Array>; }>; /** Post a reply or feedback signal on a report. */ replyToReport(options: { reportId: string; body?: string; feedbackSignal?: string; }): Promise<{ comment?: Record; feedback?: Record; }>; /** Reporter-initiated regression reopen. */ reopenReport(options: { reportId: string; note?: string; }): Promise<{ outcome: Record; }>; } /** `init` is an alias for `configure` — matches the web SDK entry point. */ declare const Mushi: MushiCapacitorPlugin & { init: (options: Parameters[0]) => Promise; }; export { Mushi, type MushiCapacitorBreadcrumb, type MushiCapacitorPlugin, type MushiCapacitorPluginConfig, type MushiCapacitorReport, type MushiCapacitorUser, type MushiCapacitorWidgetOptions, type MushiTriggerInsetPreset, type MushiTriggerMode, triggerInsetPresets };