import * as react from 'react'; import { ReactNode, Component, ErrorInfo, ElementType, ComponentPropsWithRef, ComponentPropsWithoutRef } from 'react'; import { MushiInitConfig, MushiReportCategory, MushiReporterReport, MushiReporterComment, MushiHallOfFameEntry, MushiReputationResult, MushiTierResult, MushiSDKInstance } from '@mushi-mushi/core'; export { MushiConfig, MushiEventHandler, MushiEventType, MushiHallOfFameEntry, MushiInitConfig, MushiReport, MushiReportCategory, MushiReporterComment, MushiReporterReport, MushiReputationResult, MushiSDKInstance, MushiTierResult, MushiWidgetConfig } from '@mushi-mushi/core'; export { Mushi } from '@mushi-mushi/web'; interface MushiProviderProps { /** Credentials may be omitted when NEXT_PUBLIC_MUSHI_* / VITE_MUSHI_* env vars supply them. */ config?: MushiInitConfig; children: ReactNode; } declare function MushiProvider({ config, children }: MushiProviderProps): react.JSX.Element; interface UseMushiResult { /** * Open the reporter widget, optionally pre-selecting a category or jumping * straight to the feature-request form. */ report: (options?: { category?: MushiReportCategory; featureRequest?: boolean; }) => void; /** * Briefly animate the bug-report trigger button to draw attention without * opening the full widget. Ideal for first-session nudges. */ pulseTrigger: () => void; /** True once the SDK has finished initializing and can accept reports. */ isReady: boolean; /** Returns the reporter's own report history (keyed to persistent token). */ listMyReports: () => Promise; /** Returns the comment thread for a given report. */ listMyComments: (reportId: string) => Promise; /** Post a follow-up comment on one of the reporter's own reports. */ replyToReport: (reportId: string, body: string) => Promise; /** Returns the global hall-of-fame ranked by total points. */ getHallOfFame: (limit?: number) => Promise; /** Returns the current user's reputation + points. */ getReputation: () => Promise; /** Returns the current user's tier. */ getTier: () => Promise; } /** * Primary ergonomic hook for the Mushi SDK in React apps. * * Returns `{ report, pulseTrigger, isReady }` — covers the 90% case without * the `getMushi()?.report()` optional-chain dance. * * @example * ```tsx * const { report, isReady } = useMushi() * * ``` */ declare function useMushi(): UseMushiResult; /** * Access the raw Mushi SDK instance. Returns null if SDK is not yet initialized. * Prefer `useMushi()` for the ergonomic destructurable shape. */ declare function useMushiSdk(): MushiSDKInstance | null; /** * Returns true when the Mushi SDK has finished initializing. */ declare function useMushiReady(): boolean; /** * Product-analytics hook: returns a stable `track(event, properties)` for * funnels, paths and people in the Mushi console. No-op (returns false) * until the SDK is ready, under DNT/GPC, or when `analytics.enabled` is false. * * @example * const track = useMushiTrack(); * */ declare function useMushiTrack(): (event: string, properties?: Record) => boolean; /** * Convenience hook for programmatic report triggering. * Returns a function that opens the widget with an optional pre-selected category. */ declare function useMushiReport(): (options?: { category?: MushiReportCategory; }) => void; interface MushiErrorBoundaryProps { children: ReactNode; fallback?: ReactNode | ((error: Error, reset: () => void) => ReactNode); onError?: (error: Error, errorInfo: ErrorInfo) => void; } interface MushiErrorBoundaryState { hasError: boolean; error: Error | null; } declare class MushiErrorBoundary extends Component { constructor(props: MushiErrorBoundaryProps); static getDerivedStateFromError(error: Error): MushiErrorBoundaryState; componentDidCatch(error: Error, errorInfo: ErrorInfo): void; private reset; render(): ReactNode; } type AsProp$1 = { /** Element or component to render as. Defaults to `button`. */ as?: C; /** Pre-select a report category when the panel opens. */ category?: MushiReportCategory; children?: ReactNode; }; type MushiTriggerProps = AsProp$1 & Omit, keyof AsProp$1>; /** * Polymorphic trigger that opens the Mushi reporter on click. * Passes through all native props and refs so it integrates cleanly * with any design system (Radix, Ariakit, shadcn, etc.). */ declare function MushiTrigger({ as, category, children, onClick, ...rest }: MushiTriggerProps): react.JSX.Element; interface MushiAttachProps { /** CSS selector of the host element to attach the click listener to. */ selector: string; /** Pre-select a category when the reporter opens. */ category?: MushiReportCategory; } /** * Declarative alternative to `sdk.attachTo(selector)`. * Renders nothing — only manages the event listener lifecycle. * * Use when you can't wrap the trigger element with a React component * (e.g. third-party UI, portal, or a non-React DOM node). * * When `category` is specified, a direct `sdk.report({ category })` click * handler is used instead of `sdk.attachTo()` because `attachTo` accepts * `MushiWidgetConfig` (position, theme, …) rather than a pre-selected category. */ declare function MushiAttach({ selector, category }: MushiAttachProps): null; /** Returns the current user's reputation totals, or null if unavailable. */ declare function useReputation(): MushiReputationResult | null; /** Returns the current user's tier, or null if unavailable. */ declare function useTier(): MushiTierResult | null; type AsProp = { as?: C; }; type PropsToOmit = keyof (AsProp & P); type PolymorphicComponentProp> = React.PropsWithChildren> & Omit, PropsToOmit>; interface BadgeOwnProps { /** Show a numeric point count alongside the tier name. Default false. */ showPoints?: boolean; /** Fallback content while data is loading. Default: null (nothing). */ loadingFallback?: React.ReactNode; /** Custom class name applied to the rendered element. */ className?: string; } type MushiRewardsBadgeProps = PolymorphicComponentProp; declare function MushiRewardsBadge({ as, showPoints, loadingFallback, className, ...rest }: MushiRewardsBadgeProps): react.JSX.Element; export { MushiAttach, MushiErrorBoundary, type MushiErrorBoundaryProps, MushiProvider, type MushiProviderProps, MushiRewardsBadge, MushiTrigger, type UseMushiResult, useMushi, useMushiReady, useMushiReport, useMushiSdk, useMushiTrack, useReputation, useTier };