useBugReporter

Note: The React SDK does not export a dedicated useBugReporter hook. Bug reporting is handled through the BugReporterWidget component and the ErrorBoundary component.

If you need programmatic bug reporting, read the config from usePlatform() and POST directly to the bug-report endpoint:

import axios from 'axios';
import { usePlatform } from '@mpratyush54/sdk-react';

function useBugReporter() {
  const { config } = usePlatform();

  return async (description: string) => {
    await axios.post(`${config.apiBase}/api/sdk/bug-report`, {
      projectId: config.projectId,
      environment: config.environment || 'production',
      description,
      category: 'user-report',
      consoleLogs: [],       // optionally capture console entries
      browserInfo: {
        userAgent: navigator.userAgent,
        url: window.location.href,
        viewport: `${window.innerWidth}x${window.innerHeight}`,
      },
      appState: {},
    }, {
      headers: { Authorization: `Bearer ${config.token}` },
    });
  };
}

Component Purpose
BugReporterWidget Floating bug-report button + drawer with redacted console / network capture and opt-in screenshot
ErrorBoundary Catches React render errors and auto-submits a bug report