@the-it-dept/bugsplat-react 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ import { SplatClient } from '../api/client';
2
+
3
+ interface HistoryListProps {
4
+ client: SplatClient;
5
+ onSelectReport: (id: string) => void;
6
+ previewMode?: boolean;
7
+ }
8
+ export declare function HistoryList({ client, onSelectReport, previewMode }: HistoryListProps): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,10 @@
1
+ import { SplatClient } from '../api/client';
2
+
3
+ interface ReportDetailProps {
4
+ client: SplatClient;
5
+ reportId: string;
6
+ onBack: () => void;
7
+ previewMode?: boolean;
8
+ }
9
+ export declare function ReportDetail({ client, reportId, onBack, previewMode }: ReportDetailProps): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,11 @@
1
+ import { SplatClient } from '../api/client';
2
+ import { Report } from '../types';
3
+
4
+ interface ReportFormProps {
5
+ client: SplatClient;
6
+ defaultEmail: string;
7
+ placeholder?: string;
8
+ onSubmit: (report: Report, token: string) => void;
9
+ }
10
+ export declare function ReportForm({ client, defaultEmail, placeholder, onSubmit }: ReportFormProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
package/dist/dev.d.ts ADDED
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,7 @@
1
+ export declare function useReporter(apiKey: string): {
2
+ reporterToken: string | null;
3
+ email: string | null;
4
+ setReporterToken: (token: string) => void;
5
+ setEmail: (email: string) => void;
6
+ clearReporter: () => void;
7
+ };
@@ -0,0 +1,20 @@
1
+ import { SplatConfig, WidgetConfig } from './types';
2
+
3
+ export type { SplatConfig, Report, ReportStatus, WidgetConfig } from './types';
4
+ export { Widget, Widget as SplatWidget } from './Widget';
5
+ export { useReporter } from './hooks/useReporter';
6
+ export { SplatClient } from './api/client';
7
+ export interface SplatInstance {
8
+ /** Update widget configuration and re-render */
9
+ update: (config: Partial<SplatConfig> & Partial<WidgetConfig>) => void;
10
+ /** Destroy widget and clean up */
11
+ destroy: () => void;
12
+ /** Open the widget (for trigger mode) */
13
+ trigger: () => void;
14
+ /** Close the widget (for trigger mode) */
15
+ close: () => void;
16
+ }
17
+ /**
18
+ * Initialize the Splat widget and mount it to the DOM
19
+ */
20
+ export declare function init(config: SplatConfig): SplatInstance;
@@ -0,0 +1,60 @@
1
+ export interface SplatConfig {
2
+ apiKey: string;
3
+ apiUrl?: string;
4
+ /**
5
+ * Position of the widget button.
6
+ * - 'bottom-right' / 'bottom-left': Floating button in corner
7
+ * - 'trigger': No button shown, use trigger() method to open as modal
8
+ */
9
+ position?: 'bottom-right' | 'bottom-left' | 'trigger';
10
+ primaryColor?: string;
11
+ onSubmit?: (report: Report) => void;
12
+ /** Container element or selector to constrain widget to (default: document.body) */
13
+ container?: HTMLElement | string;
14
+ /** Preview mode: skip API fetch and use these values directly */
15
+ previewMode?: boolean;
16
+ buttonText?: string;
17
+ accentColor?: string;
18
+ theme?: 'light' | 'dark';
19
+ title?: string;
20
+ placeholder?: string;
21
+ historyEnabled?: boolean;
22
+ }
23
+ export interface WidgetConfig {
24
+ position: 'bottom-right' | 'bottom-left' | 'trigger';
25
+ buttonText: string;
26
+ accentColor: string;
27
+ theme: 'light' | 'dark';
28
+ title: string;
29
+ placeholder: string;
30
+ /** Whether reporters can view their submission history */
31
+ historyEnabled: boolean;
32
+ }
33
+ export interface Report {
34
+ id: string;
35
+ title: string;
36
+ description: string;
37
+ email: string;
38
+ status: ReportStatus;
39
+ githubIssueUrl?: string;
40
+ createdAt: string;
41
+ }
42
+ export type ReportStatus = 'pending' | 'open' | 'closed';
43
+ export interface ReportSummary {
44
+ id: string;
45
+ title: string;
46
+ status: ReportStatus;
47
+ githubIssueUrl?: string;
48
+ createdAt: string;
49
+ }
50
+ export interface Comment {
51
+ id: string;
52
+ authorLogin: string;
53
+ authorAvatarUrl?: string;
54
+ body: string;
55
+ createdAt: string;
56
+ }
57
+ export interface ReportDetail extends Report {
58
+ comments: Comment[];
59
+ }
60
+ export type { ReportMetadata } from '../utils/metadata';
@@ -0,0 +1,25 @@
1
+ export interface ReportMetadata {
2
+ url: string;
3
+ referrer: string;
4
+ pageTitle: string;
5
+ userAgent: string;
6
+ browser: string;
7
+ browserVersion: string;
8
+ platform: string;
9
+ language: string;
10
+ cookiesEnabled: boolean;
11
+ screenWidth: number;
12
+ screenHeight: number;
13
+ viewportWidth: number;
14
+ viewportHeight: number;
15
+ devicePixelRatio: number;
16
+ colorDepth: number;
17
+ timestamp: string;
18
+ timezone: string;
19
+ timezoneOffset: number;
20
+ connection?: string;
21
+ }
22
+ /**
23
+ * Collect comprehensive browser/device metadata for bug reports
24
+ */
25
+ export declare function collectMetadata(): ReportMetadata;
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@the-it-dept/bugsplat-react",
3
+ "version": "0.0.2",
4
+ "description": "Embeddable bug report widget for BugSplat",
5
+ "type": "module",
6
+ "main": "./dist/bugsplat.umd.cjs",
7
+ "module": "./dist/bugsplat.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/bugsplat.js",
12
+ "require": "./dist/bugsplat.umd.cjs",
13
+ "types": "./dist/index.d.ts"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "scripts": {
20
+ "dev": "vite",
21
+ "build": "tsc && vite build",
22
+ "preview": "vite preview",
23
+ "lint": "eslint src --ext ts,tsx"
24
+ },
25
+ "dependencies": {
26
+ "html2canvas": "^1.4.1"
27
+ },
28
+ "peerDependencies": {
29
+ "react": "^18.0.0 || ^19.0.0",
30
+ "react-dom": "^18.0.0 || ^19.0.0"
31
+ },
32
+ "devDependencies": {
33
+ "@types/react": "^19.0.0",
34
+ "@types/react-dom": "^19.0.0",
35
+ "@vitejs/plugin-react": "^4.2.0",
36
+ "react": "^19.0.0",
37
+ "react-dom": "^19.0.0",
38
+ "typescript": "^5.3.0",
39
+ "vite": "^5.0.0",
40
+ "vite-plugin-dts": "^3.7.0"
41
+ }
42
+ }