@bugdump/sdk 0.0.1

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.
package/README.md ADDED
@@ -0,0 +1,154 @@
1
+ # @bugdump/sdk
2
+
3
+ Official TypeScript SDK for [Bugdump](https://bugdump.com) - embed a bug reporting widget on your website and collect detailed reports from your users.
4
+
5
+ ## Features
6
+
7
+ - **Embeddable widget** - Floating bug report button with screenshot, screen recording, and voice notes
8
+ - **Auto-collects telemetry** - Console logs, network requests, session replay, and performance data
9
+ - **Screenshot annotations** - Users can draw, highlight, and blur parts of screenshots
10
+ - **TypeScript-first** - Full type definitions out of the box
11
+ - **Shadow DOM isolated** - Widget styles never leak into your app
12
+ - **IIFE bundle** - Drop a `<script>` tag and go, no build step required
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ npm install @bugdump/sdk
18
+ # or
19
+ pnpm add @bugdump/sdk
20
+ # or
21
+ yarn add @bugdump/sdk
22
+ ```
23
+
24
+ Or via `<script>` tag (IIFE):
25
+
26
+ ```html
27
+ <script src="https://unpkg.com/@bugdump/sdk/dist/index.global.js"></script>
28
+ <script>
29
+ Bugdump.Bugdump.init({ projectKey: 'your-project-key' });
30
+ </script>
31
+ ```
32
+
33
+ ## Quick Start
34
+
35
+ ```typescript
36
+ import { Bugdump } from '@bugdump/sdk';
37
+
38
+ const bugdump = Bugdump.init({
39
+ projectKey: 'your-project-key',
40
+ });
41
+ ```
42
+
43
+ That's it — a floating bug report button will appear on your page.
44
+
45
+ ## Configuration
46
+
47
+ ```typescript
48
+ const bugdump = Bugdump.init({
49
+ projectKey: 'your-project-key',
50
+ endpoint: 'https://api.bugdump.com', // optional, custom API endpoint
51
+ });
52
+ ```
53
+
54
+ | Option | Type | Required | Description |
55
+ |---|---|---|---|
56
+ | `projectKey` | `string` | Yes | Your Bugdump project key |
57
+ | `endpoint` | `string` | No | Custom API endpoint URL |
58
+
59
+ ## Identify Users
60
+
61
+ Associate bug reports with your authenticated users:
62
+
63
+ ```typescript
64
+ bugdump.identify({
65
+ id: 'user-123',
66
+ name: 'Jane Doe',
67
+ email: 'jane@example.com',
68
+ });
69
+ ```
70
+
71
+ ## Custom Context
72
+
73
+ Attach arbitrary data to every report:
74
+
75
+ ```typescript
76
+ bugdump.setContext({
77
+ plan: 'pro',
78
+ feature: 'checkout',
79
+ buildVersion: '1.2.3',
80
+ });
81
+ ```
82
+
83
+ ## Programmatic Control
84
+
85
+ ```typescript
86
+ // Open the report panel
87
+ bugdump.open();
88
+
89
+ // Close the report panel
90
+ bugdump.close();
91
+
92
+ // Check if the panel is open
93
+ bugdump.isWidgetOpen();
94
+
95
+ // Collect telemetry snapshot without submitting
96
+ const telemetry = bugdump.collectTelemetry();
97
+
98
+ // Clean up and remove the widget
99
+ bugdump.destroy();
100
+ ```
101
+
102
+ ## Telemetry Snapshot
103
+
104
+ `collectTelemetry()` returns:
105
+
106
+ ```typescript
107
+ interface TelemetrySnapshot {
108
+ consoleLogs: ConsoleLogEntry[];
109
+ networkRequests: NetworkRequestEntry[];
110
+ sessionReplayEvents: eventWithTime[];
111
+ performance: PerformanceSnapshot;
112
+ metadata: MetadataSnapshot;
113
+ }
114
+ ```
115
+
116
+ ## Error Handling
117
+
118
+ ```typescript
119
+ import { Bugdump, BugdumpApiError } from '@bugdump/sdk';
120
+
121
+ try {
122
+ await bugdump.getHttpClient().submitReport(payload);
123
+ } catch (error) {
124
+ if (error instanceof BugdumpApiError) {
125
+ console.error(`Error ${error.status}: ${error.message}`);
126
+ }
127
+ }
128
+ ```
129
+
130
+ ## TypeScript
131
+
132
+ The SDK exports all types you need:
133
+
134
+ ```typescript
135
+ import type {
136
+ BugdumpConfig,
137
+ BugdumpUserContext,
138
+ ReportPayload,
139
+ ReportResponse,
140
+ TelemetrySnapshot,
141
+ ConsoleLogEntry,
142
+ NetworkRequestEntry,
143
+ PerformanceSnapshot,
144
+ MetadataSnapshot,
145
+ ScreenshotOptions,
146
+ ScreenshotResult,
147
+ AnnotationTool,
148
+ DrawOperation,
149
+ } from '@bugdump/sdk';
150
+ ```
151
+
152
+ ## License
153
+
154
+ MIT