@bugspotter/sdk 0.3.0 → 0.3.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/.prettierrc ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "semi": true,
3
+ "trailingComma": "es5",
4
+ "singleQuote": true,
5
+ "printWidth": 80,
6
+ "tabWidth": 2,
7
+ "useTabs": false,
8
+ "bracketSpacing": true,
9
+ "arrowParens": "always",
10
+ "endOfLine": "lf"
11
+ }
package/CHANGELOG.md CHANGED
@@ -5,176 +5,108 @@ All notable changes to the BugSpotter SDK will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [0.2.5-alpha.5](https://github.com/apexbridge-tech/bugspotter/compare/sdk-v0.2.4-alpha.5...sdk-v0.2.5-alpha.5) (2026-01-08)
8
+ ## [0.3.1] - 2026-01-13
9
9
 
10
+ ### Added
10
11
 
11
- ### Features
12
-
13
- * **sdk:** filter SDK internal logs and API calls from bug reports ([#584](https://github.com/apexbridge-tech/bugspotter/issues/584)) ([ab25673](https://github.com/apexbridge-tech/bugspotter/commit/ab25673abe1ac4f71caaffbd74119eedbefaa208))
14
-
15
- ## [0.2.4-alpha.5](https://github.com/apexbridge-tech/bugspotter/compare/sdk-v0.2.3-alpha.5...sdk-v0.2.4-alpha.5) (2026-01-06)
16
-
17
-
18
- ### Features
19
-
20
- * add upload progress feedback and screenshot proxy endpoint ([#565](https://github.com/apexbridge-tech/bugspotter/issues/565)) ([d0dd05f](https://github.com/apexbridge-tech/bugspotter/commit/d0dd05f96b6006af8f98ae9aab25ad82758bd80f))
21
-
22
- ## [0.2.3-alpha.5](https://github.com/apexbridge-tech/bugspotter/compare/sdk-v0.2.2-alpha.5...sdk-v0.2.3-alpha.5) (2026-01-03)
23
-
24
-
25
- ### Features
26
-
27
- * release SDK 0.3.0 with duplicate prevention system ([#532](https://github.com/apexbridge-tech/bugspotter/issues/532)) ([c61b8c8](https://github.com/apexbridge-tech/bugspotter/commit/c61b8c8e9ed99d0ef9b95e7422ed82b41a93a561))
28
-
29
- ## [0.2.2-alpha.5](https://github.com/apexbridge-tech/bugspotter/compare/sdk-v0.2.1-alpha.5...sdk-v0.2.2-alpha.5) (2025-11-24)
30
-
31
-
32
- ### Features
33
-
34
- * **sdk:** Add mouse event sampling settings support ([#313](https://github.com/apexbridge-tech/bugspotter/issues/313)) ([dd49bd0](https://github.com/apexbridge-tech/bugspotter/commit/dd49bd0fba99be1b3c6043669c9df8c4ae04f8c9))
35
-
36
-
37
- ### Bug Fixes
38
-
39
- * **ci:** auto-format CHANGELOG in release-please PRs ([#300](https://github.com/apexbridge-tech/bugspotter/issues/300)) ([35a5541](https://github.com/apexbridge-tech/bugspotter/commit/35a5541450d75029964d060587784682f2ac3613))
40
-
41
- ## [0.2.1-alpha.5](https://github.com/apexbridge-tech/bugspotter/compare/sdk-v0.2.0-alpha.5...sdk-v0.2.1-alpha.5) (2025-11-21)
42
-
43
- ### Bug Fixes
44
-
45
- - **test:** load rrweb from CDN for replay verification ([#297](https://github.com/apexbridge-tech/bugspotter/issues/297)) ([cbd575f](https://github.com/apexbridge-tech/bugspotter/commit/cbd575f4ab50da7b81df5be13d8a48fd48f391e6))
46
-
47
- ### Documentation
48
-
49
- - **sdk:** update README to mention session replay feature ([#298](https://github.com/apexbridge-tech/bugspotter/issues/298)) ([28535c2](https://github.com/apexbridge-tech/bugspotter/commit/28535c2cf9df4deaebb96a92a4503a7371813142))
50
-
51
- ## [0.2.0-alpha.5](https://github.com/apexbridge-tech/bugspotter/compare/sdk-v0.1.3-alpha.5...sdk-v0.2.0-alpha.5) (2025-11-21)
52
-
53
- ### ⚠ BREAKING CHANGES
54
-
55
- - **sdk:** BugSpotter.init() is now async and returns Promise<BugSpotter>. All callers must use `await BugSpotter.init(config)` instead of `BugSpotter.init(config)`. This change enables fetching replay quality settings from the backend before SDK initialization.
56
-
57
- ### Features
58
-
59
- - **sdk:** add backend-controlled replay settings support ([#290](https://github.com/apexbridge-tech/bugspotter/issues/290)) ([0ea7c3b](https://github.com/apexbridge-tech/bugspotter/commit/0ea7c3b1ab456def3fd37c26bca6cf70da0f3ff9))
60
-
61
- ## [0.1.3-alpha.5](https://github.com/apexbridge-tech/bugspotter/compare/sdk-v0.1.2-alpha.5...sdk-v0.1.3-alpha.5) (2025-11-13)
62
-
63
- ### Tests
12
+ - Node.js 22 LTS support for long-term stability
13
+ - pnpm 9.15.0 integration with improved dependency resolution
14
+ - Cross-browser E2E test suite (Chromium, Firefox, WebKit)
15
+ - Enhanced CI/CD pipeline with better error handling
16
+ - CDN deployment support in release workflow
64
17
 
65
- - **e2e:** migrate E2E tests from local storage to MinIO ([#229](https://github.com/apexbridge-tech/bugspotter/issues/229)) ([df5247d](https://github.com/apexbridge-tech/bugspotter/commit/df5247dee3a58d49dafe0c60f7f0bf6962c3cfb3))
18
+ ### Changed
66
19
 
67
- ## [0.1.2-alpha.6](https://github.com/apexbridge-tech/bugspotter/compare/sdk-v0.1.2-alpha.5...sdk-v0.1.2-alpha.6) (2025-11-13)
20
+ - Updated Firefox large DOM test timeout from 35s to 45s for better compatibility
21
+ - Improved ESLint configuration for test environments
22
+ - Better handling of runtime-injected globals in type checking
68
23
 
69
- ### Bug Fixes
24
+ ### Fixed
70
25
 
71
- - **sdk:** remove Content-Type header from presigned URL uploads to fix 403 errors - Presigned URLs from S3/B2 are signed with specific headers, and adding additional headers causes signature mismatch and 403 Forbidden errors. This critical fix removes the Content-Type header from both fetch() and XMLHttpRequest uploads to storage.
26
+ - Resolved pnpm version conflict between CI config and package.json
27
+ - Fixed E2E test timeouts for slower browser environments
28
+ - Corrected TypeScript type definitions for test mocks
72
29
 
73
- ## [0.1.2-alpha.5](https://github.com/apexbridge-tech/bugspotter/compare/sdk-v0.1.1-alpha.5...sdk-v0.1.2-alpha.5) (2025-11-12)
30
+ ## [0.3.0] - 2025-12-20
74
31
 
75
- ### Bug Fixes
32
+ ### Added
76
33
 
77
- - **ci:** update SDK publish workflow to support prerelease tags ([#221](https://github.com/apexbridge-tech/bugspotter/issues/221)) ([dc4d7f2](https://github.com/apexbridge-tech/bugspotter/commit/dc4d7f2ef519afcf232704f05295729c6402008c))
34
+ - **Duplicate Prevention System**: Automatic detection and prevention of duplicate bug reports
35
+ - **Backend-Controlled Replay Settings**: Dynamic replay configuration from server
36
+ - **Upload Progress Feedback**: Real-time progress indication for file uploads
37
+ - **Screenshot Proxy Endpoint**: Server-side screenshot proxy support
38
+ - **SDK Internal Log Filtering**: Automatic exclusion of SDK's own logs from reports
78
39
 
79
- ## [0.1.1-alpha.5](https://github.com/apexbridge-tech/bugspotter/compare/sdk-v0.1.0-alpha.5...sdk-v0.1.1-alpha.5) (2025-11-12)
40
+ ### Changed
80
41
 
81
- ### Features
42
+ - BugSpotter.init() is now async (returns Promise<BugSpotter>)
43
+ - Improved transport layer architecture
44
+ - Enhanced offline queue management
82
45
 
83
- - add exponential backoff retry and offline queue support ([c3c2106](https://github.com/apexbridge-tech/bugspotter/commit/c3c21063b777da37011449b89431a63f987ea777))
84
- - add FloatingButton widget and fix UMD exports ([b7e170e](https://github.com/apexbridge-tech/bugspotter/commit/b7e170eea47c7883722e59038a0d16b911c59588))
85
- - add FloatingButton widget with refactored architecture ([87a3d0e](https://github.com/apexbridge-tech/bugspotter/commit/87a3d0e69cea86db01e2847323440f296f045b16))
86
- - add gzip compression reducing payloads by 70-90% ([489e182](https://github.com/apexbridge-tech/bugspotter/commit/489e182ea072e3ffc43b58700b60288f6a255c22))
87
- - add gzip compression reducing payloads by 70-90% ([c545acf](https://github.com/apexbridge-tech/bugspotter/commit/c545acf6fe9a973c74a54f63a560b4fd96465e83))
88
- - add screenshot capture with html-to-image ([fae3eb7](https://github.com/apexbridge-tech/bugspotter/commit/fae3eb70fbf52d5b7c217f4d6d001735b661159d))
89
- - add session replay with rrweb ([175bd74](https://github.com/apexbridge-tech/bugspotter/commit/175bd74765d7f49b4be681c02eae0d7bbe8b1bc4))
90
- - add type safety system with shared types, Zod validation, and contract tests ([a3e436a](https://github.com/apexbridge-tech/bugspotter/commit/a3e436a931abda2cf30c85b32e5af2e011b7b3d9))
91
- - complete BugSpotter v0.1.0 with full documentation ([651153b](https://github.com/apexbridge-tech/bugspotter/commit/651153b2d4c86b9653df6164539991ea92c41942))
92
- - complete core SDK with all capture modules ([54fe97a](https://github.com/apexbridge-tech/bugspotter/commit/54fe97af32b2ee1aa09f5657b28b89e40454cb0a))
93
- - fixed bug in NetworkCapture + eslint + prettier ([75e2d92](https://github.com/apexbridge-tech/bugspotter/commit/75e2d9290d82ea3f9b377e3b189ce933f7e3e336))
94
- - initial project structure ([7109dc2](https://github.com/apexbridge-tech/bugspotter/commit/7109dc2e284ea8692081965e4b5a9cce4dc1b1e0))
95
- - **sdk:** bump to 0.1.0-alpha.5 with improved release workflow ([#219](https://github.com/apexbridge-tech/bugspotter/issues/219)) ([a191b7b](https://github.com/apexbridge-tech/bugspotter/commit/a191b7b998863f00df4bd24f529057e4c4160a73))
96
- - vitest configured + unit tests for capture ([381d11e](https://github.com/apexbridge-tech/bugspotter/commit/381d11e8ea45376c56ded0d62c2c37a726002acf))
46
+ ## [0.2.0] - 2025-11-21
97
47
 
98
- ### Bug Fixes
48
+ ### Added
99
49
 
100
- - increase browser test timeout and add GitHub release permissions ([#142](https://github.com/apexbridge-tech/bugspotter/issues/142)) ([301600e](https://github.com/apexbridge-tech/bugspotter/commit/301600e5fa6c01e0a6ef0e3281a0c27206cc00e2))
101
- - remove await from background queue processing ([174889d](https://github.com/apexbridge-tech/bugspotter/commit/174889d9df5541d0494b736d9b8c44bbcbdfbb7e))
102
- - **sdk:** remove unused @bugspotter/types workspace dependency ([#146](https://github.com/apexbridge-tech/bugspotter/issues/146)) ([7fed00b](https://github.com/apexbridge-tech/bugspotter/commit/7fed00bafab22f1854b78f861a90069b96a665c1))
50
+ - **Session Replay**: Recording with rrweb (configurable buffer duration up to 30s)
51
+ - **Mouse Event Sampling**: Configurable intervals for mouse tracking
52
+ - **Comprehensive E2E Tests**: Full test suite with Playwright (Chromium, Firefox, WebKit)
53
+ - **Shadow DOM Support**: Complete replay capture for Shadow DOM content
54
+ - **Type Safety Enhancements**: Improved Zod validation and type definitions
103
55
 
104
- ### Code Refactoring
56
+ ### Changed
105
57
 
106
- - Addressed comments on PR; ([fcb4888](https://github.com/apexbridge-tech/bugspotter/commit/fcb488813cd36147f6292c36f4540b23b7759e20))
107
- - improve capture classes with options, types, and performance ([616bd35](https://github.com/apexbridge-tech/bugspotter/commit/616bd3502c7620f65494ae813ea39e87781b5a2f))
108
- - improve transport and offline queue architecture ([01a27f3](https://github.com/apexbridge-tech/bugspotter/commit/01a27f3cc24d1211c65e4f0992fc969f40294e70))
109
- - optimize demo & documentation structure ([22c2171](https://github.com/apexbridge-tech/bugspotter/commit/22c21712229f19b1280d1406c2fac60655d41c4a))
110
- - Phase 2 - Extract shared capture architecture ([48d007c](https://github.com/apexbridge-tech/bugspotter/commit/48d007cecfc4651ded10a8c7fd4651fcec499fbd))
111
- - Phase 2 - Extract shared capture architecture ([ea88dda](https://github.com/apexbridge-tech/bugspotter/commit/ea88dda3cdbb07d72f96d707a3ebb97edf93379c))
112
- - Phase 2 - Extract shared capture architecture ([72f2425](https://github.com/apexbridge-tech/bugspotter/commit/72f242575c46c3c813bf15234ca95d5624b7d7d4))
113
- - remove deprecated code and unused variables ([392bbb9](https://github.com/apexbridge-tech/bugspotter/commit/392bbb9c91e3d57a49b9650782b778aea9607d50))
58
+ - Refactored capture classes with better options and performance
59
+ - Improved transport and offline queue architecture
60
+ - Enhanced error handling in retry logic
114
61
 
115
- ### Tests
62
+ ### Fixed
116
63
 
117
- - Add comprehensive edge case tests for DOM collector ([24b56b3](https://github.com/apexbridge-tech/bugspotter/commit/24b56b3317edd6df656f551c7d22db3cc03df7ac))
64
+ - Content-Type header removal from presigned URL uploads (fixed 403 errors)
65
+ - rrweb CDN loading for reliable replay verification
66
+ - Release workflow prerelease tag support
118
67
 
119
68
  ## [0.1.0] - 2025-11-01
120
69
 
121
70
  ### Added
122
71
 
123
- - Initial public release of BugSpotter SDK
124
- - Screenshot capture with CSP-safe implementation using html-to-image
125
- - Session replay recording with rrweb (configurable buffer duration)
126
- - Console log capture (all levels with stack traces)
127
- - Network request capture (fetch/XHR with timing)
128
- - Browser metadata capture (browser, OS, viewport detection)
129
- - Automatic PII detection and sanitization
72
+ #### Core Capture Features
73
+ - **Screenshot Capture**: Full-page screenshots with CSP-safe html-to-image library
74
+ - **Console Logging**: Capture all console messages with stack traces
75
+ - **Network Tracking**: Monitor all HTTP requests (fetch/XHR) with timing
76
+ - **Browser Metadata**: Automatic detection of browser, OS, viewport
77
+ - **DOM Capture**: Complete DOM structure preservation
78
+
79
+ #### Data Protection & Privacy
80
+ - **PII Sanitization**: Automatic detection and redaction of sensitive data
130
81
  - Built-in patterns: email, phone, credit card, SSN, IIN, IP address
131
- - Custom pattern support
132
- - Configurable exclusion selectors
133
- - Direct file uploads using presigned URLs (97% memory reduction)
134
- - Compression utilities for replay data (gzip)
135
- - Floating widget button with customizable position and styling
136
- - Bug report modal with form validation
137
- - Authentication support (API key, Bearer token, Custom headers)
138
- - Retry logic for failed requests
139
- - Offline queue for network resilience
140
- - TypeScript support with full type definitions
141
- - Multiple module formats: ESM, CommonJS, UMD
142
- - Framework integration examples for React, Vue, Angular, Next.js, Nuxt, Svelte
143
-
144
- ### Features
145
-
146
- - **Bundle size**: ~99 KB minified (with session replay)
147
- - **Performance**: Screenshot capture ~500ms, PII sanitization <10ms
148
- - **Browser support**: Chrome 55+, Firefox 55+, Safari 11+, Edge 79+ (ES2017+)
149
- - **Memory efficient**: <15 MB for 30s replay buffer
150
- - **CSP compliant**: No eval, no inline scripts
151
-
152
- ### Documentation
153
-
154
- - Complete API reference
155
- - Framework integration guide (React, Vue, Angular, Next.js, Nuxt, Svelte)
156
- - Session replay configuration guide
157
- - PII sanitization guide
158
- - Direct upload guide with examples
159
-
160
- ### Testing
161
-
162
- - 345 tests (unit + E2E + Playwright)
163
- - Full test coverage for core functionality
164
-
165
- ## [Unreleased]
166
-
167
- ### Planned Features
168
-
169
- - Real-time error tracking
170
- - Performance monitoring
171
- - User session tracking
172
- - Custom event tracking
173
- - Source map support
174
- - Analytics dashboard integration
175
- - Webhooks support
176
- - Additional integrations (Slack, Discord, Email)
177
-
178
- ---
179
-
180
- [0.1.0]: https://github.com/apexbridge-tech/bugspotter/releases/tag/sdk-v0.1.0
82
+ - Custom regex pattern support
83
+ - Per-element CSS selector-based exclusion
84
+ - **Content Security Policy (CSP) Compliant**: No eval, no inline scripts
85
+
86
+ #### Reliability & Performance
87
+ - **Compression**: gzip compression reduces payloads by 70-90%
88
+ - **Direct Upload**: Presigned URL uploads with 97% memory reduction vs base64
89
+ - **Offline Queue**: Store and sync bug reports when network unavailable
90
+ - **Exponential Backoff**: Intelligent retry strategy with configurable delays
91
+ - **Circular Buffering**: Efficient memory usage for long-running sessions
92
+
93
+ #### User Interface
94
+ - **Floating Widget Button**: Customizable position (corner/edge), styling, and icon
95
+ - **Bug Report Modal**: User-friendly form with validation for manual submission
96
+ - **Responsive Design**: Optimized for both desktop and mobile viewports
97
+
98
+ #### Authentication & Integration
99
+ - **Multiple Auth Types**: API Key, Bearer token, custom headers
100
+ - **Framework Agnostic**: Works with vanilla JavaScript and all major frameworks
101
+
102
+ #### Module Formats & TypeScript
103
+ - **ESM, CommonJS, UMD**: Support for all modern module systems
104
+ - **TypeScript Support**: Full type definitions with proper generic types
105
+ - **Source Maps**: Included for debugging and production support
106
+
107
+ #### Documentation
108
+ - Complete API reference with examples
109
+ - Framework integration guides (React, Vue, Angular, Next.js, Nuxt, Svelte)
110
+ - Session replay configuration and best practices
111
+ - PII sanitization customization guide
112
+ - Direct upload implementation guide
@@ -3,7 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ConsoleCapture = exports.SDK_LOG_PREFIX = void 0;
4
4
  const base_capture_1 = require("./base-capture");
5
5
  const circular_buffer_1 = require("../core/circular-buffer");
6
- const CONSOLE_METHODS = ['log', 'warn', 'error', 'info', 'debug'];
6
+ const CONSOLE_METHODS = [
7
+ 'log',
8
+ 'warn',
9
+ 'error',
10
+ 'info',
11
+ 'debug',
12
+ ];
7
13
  /**
8
14
  * Prefix used for SDK internal log messages
9
15
  * Exported for testing purposes
@@ -27,7 +33,9 @@ class ConsoleCapture extends base_capture_1.BaseCapture {
27
33
  return '';
28
34
  }
29
35
  // Sanitize args if sanitizer is enabled
30
- const sanitizedArgs = this.sanitizer ? this.sanitizer.sanitizeConsoleArgs(args) : args;
36
+ const sanitizedArgs = this.sanitizer
37
+ ? this.sanitizer.sanitizeConsoleArgs(args)
38
+ : args;
31
39
  return sanitizedArgs
32
40
  .map((arg) => {
33
41
  var _a;
@@ -57,7 +65,10 @@ class ConsoleCapture extends base_capture_1.BaseCapture {
57
65
  };
58
66
  if (this.captureStackTrace && method === 'error') {
59
67
  const stack = this.captureStack();
60
- log.stack = this.sanitizer && stack ? this.sanitizer.sanitize(stack) : stack;
68
+ log.stack =
69
+ this.sanitizer && stack
70
+ ? this.sanitizer.sanitize(stack)
71
+ : stack;
61
72
  }
62
73
  return log;
63
74
  }
@@ -17,14 +17,15 @@ class ScreenshotCapture extends base_capture_1.BaseCapture {
17
17
  }
18
18
  getErrorPlaceholder() {
19
19
  var _a;
20
- return (_a = this.options.errorPlaceholder) !== null && _a !== void 0 ? _a : DEFAULT_SCREENSHOT_OPTIONS.errorPlaceholder;
20
+ return ((_a = this.options.errorPlaceholder) !== null && _a !== void 0 ? _a : DEFAULT_SCREENSHOT_OPTIONS.errorPlaceholder);
21
21
  }
22
22
  shouldIncludeNode(node) {
23
23
  if (!('hasAttribute' in node)) {
24
24
  return true;
25
25
  }
26
26
  const element = node;
27
- const excludeAttr = this.options.excludeAttribute || DEFAULT_SCREENSHOT_OPTIONS.excludeAttribute;
27
+ const excludeAttr = this.options.excludeAttribute ||
28
+ DEFAULT_SCREENSHOT_OPTIONS.excludeAttribute;
28
29
  return !element.hasAttribute(excludeAttr);
29
30
  }
30
31
  buildCaptureOptions() {
@@ -57,7 +57,8 @@ class CircularBuffer {
57
57
  }
58
58
  }
59
59
  // Preserve full snapshot even if it's older than cutoff
60
- if (this.lastFullSnapshotIndex >= 0 && this.lastFullSnapshotIndex < firstValidIndex) {
60
+ if (this.lastFullSnapshotIndex >= 0 &&
61
+ this.lastFullSnapshotIndex < firstValidIndex) {
61
62
  firstValidIndex = this.lastFullSnapshotIndex;
62
63
  }
63
64
  // Nothing to prune
@@ -40,12 +40,16 @@ function isBugReportResponse(obj) {
40
40
  // When success is true, data.id must exist
41
41
  if (response.success) {
42
42
  const data = response.data;
43
- if (!data || typeof data !== 'object' || !('id' in data) || typeof data.id !== 'string') {
43
+ if (!data ||
44
+ typeof data !== 'object' ||
45
+ !('id' in data) ||
46
+ typeof data.id !== 'string') {
44
47
  return false;
45
48
  }
46
49
  // If presignedUrls exists, it must be an object
47
50
  if ('presignedUrls' in data && data.presignedUrls !== undefined) {
48
- if (typeof data.presignedUrls !== 'object' || data.presignedUrls === null) {
51
+ if (typeof data.presignedUrls !== 'object' ||
52
+ data.presignedUrls === null) {
49
53
  return false;
50
54
  }
51
55
  }
@@ -183,7 +187,9 @@ class BugReporter {
183
187
  success: result.success,
184
188
  bugId: bugData.id,
185
189
  hasPresignedUrls: !!bugData.presignedUrls,
186
- presignedUrlKeys: bugData.presignedUrls ? Object.keys(bugData.presignedUrls) : [],
190
+ presignedUrlKeys: bugData.presignedUrls
191
+ ? Object.keys(bugData.presignedUrls)
192
+ : [],
187
193
  });
188
194
  return bugData;
189
195
  }
@@ -197,7 +203,9 @@ class BugReporter {
197
203
  const { report } = payload;
198
204
  const fileAnalysis = analyzeReportFiles(report);
199
205
  if (!fileAnalysis.hasScreenshot && !fileAnalysis.hasReplay) {
200
- logger.debug('No files to upload, bug report created successfully', { bugId });
206
+ logger.debug('No files to upload, bug report created successfully', {
207
+ bugId,
208
+ });
201
209
  this.deduplicator.recordSubmission(dedupContext.title, dedupContext.description, dedupContext.errorStacks);
202
210
  return;
203
211
  }
@@ -217,7 +225,10 @@ class BugReporter {
217
225
  this.deduplicator.recordSubmission(dedupContext.title, dedupContext.description, dedupContext.errorStacks);
218
226
  }
219
227
  catch (error) {
220
- logger.error('File upload failed', { bugId, error: formatSubmissionError('Upload', error) });
228
+ logger.error('File upload failed', {
229
+ bugId,
230
+ error: formatSubmissionError('Upload', error),
231
+ });
221
232
  throw new Error(formatSubmissionError(`Bug report created (ID: ${bugId}) but file upload failed`, error));
222
233
  }
223
234
  }
@@ -39,7 +39,10 @@ class CircularBuffer {
39
39
  return [...this.items];
40
40
  }
41
41
  // Return items in chronological order when buffer is full
42
- return [...this.items.slice(this.index), ...this.items.slice(0, this.index)];
42
+ return [
43
+ ...this.items.slice(this.index),
44
+ ...this.items.slice(0, this.index),
45
+ ];
43
46
  }
44
47
  /**
45
48
  * Clear all items from the buffer.
@@ -128,7 +128,8 @@ function supportsWebP() {
128
128
  }
129
129
  try {
130
130
  const canvas = document.createElement('canvas');
131
- webpSupportCache = canvas.toDataURL('image/webp').indexOf('data:image/webp') === 0;
131
+ webpSupportCache =
132
+ canvas.toDataURL('image/webp').indexOf('data:image/webp') === 0;
132
133
  }
133
134
  catch (_a) {
134
135
  webpSupportCache = false;
@@ -35,7 +35,8 @@ class FileUploadHandler {
35
35
  async prepareFiles(report, presignedUrls) {
36
36
  const files = [];
37
37
  // Prepare screenshot
38
- if (report._screenshotPreview && report._screenshotPreview.startsWith('data:image/')) {
38
+ if (report._screenshotPreview &&
39
+ report._screenshotPreview.startsWith('data:image/')) {
39
40
  const screenshotUrl = this.getPresignedUrl('screenshot', presignedUrls);
40
41
  const screenshotBlob = await this.dataUrlToBlob(report._screenshotPreview);
41
42
  files.push({
@@ -49,7 +50,9 @@ class FileUploadHandler {
49
50
  if (report.replay && report.replay.length > 0) {
50
51
  const replayUrl = this.getPresignedUrl('replay', presignedUrls);
51
52
  const compressed = await (0, compress_1.compressData)(report.replay);
52
- const replayBlob = new Blob([compressed], { type: 'application/gzip' });
53
+ const replayBlob = new Blob([compressed], {
54
+ type: 'application/gzip',
55
+ });
53
56
  files.push({
54
57
  type: 'replay',
55
58
  url: replayUrl.uploadUrl,
@@ -247,7 +247,9 @@ class OfflineQueue {
247
247
  }
248
248
  // Check error message as fallback (Firefox, Chrome variants)
249
249
  const message = error.message.toLowerCase();
250
- return message.includes('quota') || message.includes('storage') || message.includes('exceeded');
250
+ return (message.includes('quota') ||
251
+ message.includes('storage') ||
252
+ message.includes('exceeded'));
251
253
  }
252
254
  /**
253
255
  * Clear oldest 50% of items and retry save
@@ -279,7 +281,8 @@ class OfflineQueue {
279
281
  else {
280
282
  // Fallback to Math.random for environments without crypto
281
283
  randomPart =
282
- Math.random().toString(36).substring(2, 9) + Math.random().toString(36).substring(2, 9);
284
+ Math.random().toString(36).substring(2, 9) +
285
+ Math.random().toString(36).substring(2, 9);
283
286
  }
284
287
  return `req_${Date.now()}_${this.requestCounter}_${randomPart}`;
285
288
  }
@@ -75,7 +75,8 @@ class RetryHandler {
75
75
  try {
76
76
  const response = await operation();
77
77
  // Check if we should retry based on status code
78
- if (shouldRetryStatus(response.status) && attempt < this.config.maxRetries) {
78
+ if (shouldRetryStatus(response.status) &&
79
+ attempt < this.config.maxRetries) {
79
80
  const delay = this.calculateDelay(attempt, response);
80
81
  this.logger.warn(`Request failed with status ${response.status}, retrying in ${delay}ms (attempt ${attempt + 1}/${this.config.maxRetries})`);
81
82
  await sleep(delay);
@@ -239,7 +240,8 @@ function isNetworkError(error) {
239
240
  error.name === 'NetworkError' ||
240
241
  error.name === 'AbortError' ||
241
242
  // TypeError only if it mentions fetch or network
242
- (error.name === 'TypeError' && (message.includes('fetch') || message.includes('network'))));
243
+ (error.name === 'TypeError' &&
244
+ (message.includes('fetch') || message.includes('network'))));
243
245
  }
244
246
  // Re-export offline queue utilities
245
247
  var offline_queue_2 = require("./offline-queue");
@@ -27,7 +27,9 @@ async function compressReplayEvents(events) {
27
27
  try {
28
28
  // Use modern streaming API: Blob → ReadableStream → CompressionStream → Response → Blob
29
29
  const blob = new Blob([data]);
30
- const compressedStream = blob.stream().pipeThrough(new CompressionStream('gzip'));
30
+ const compressedStream = blob
31
+ .stream()
32
+ .pipeThrough(new CompressionStream('gzip'));
31
33
  return await new Response(compressedStream, {
32
34
  headers: { 'Content-Type': 'application/gzip' },
33
35
  }).blob();
package/dist/index.d.ts CHANGED
@@ -132,8 +132,8 @@ export type { DOMCollectorConfig } from './collectors';
132
132
  export { CircularBuffer } from './core/buffer';
133
133
  export type { CircularBufferConfig } from './core/buffer';
134
134
  export { compressData, decompressData, compressImage, estimateSize, getCompressionRatio, } from './core/compress';
135
- export { submitWithAuth, getAuthHeaders, clearOfflineQueue } from './core/transport';
136
- export type { AuthConfig, TransportOptions, RetryConfig } from './core/transport';
135
+ export { submitWithAuth, getAuthHeaders, clearOfflineQueue, } from './core/transport';
136
+ export type { AuthConfig, TransportOptions, RetryConfig, } from './core/transport';
137
137
  export type { OfflineConfig } from './core/offline-queue';
138
138
  export type { Logger, LogLevel, LoggerConfig } from './utils/logger';
139
139
  export { getLogger, configureLogger, createLogger } from './utils/logger';
@@ -141,8 +141,8 @@ export { DirectUploader } from './core/uploader';
141
141
  export type { UploadResult } from './core/uploader';
142
142
  export { compressReplayEvents, canvasToBlob, estimateCompressedReplaySize, isWithinSizeLimit, } from './core/upload-helpers';
143
143
  export { createSanitizer, Sanitizer } from './utils/sanitize';
144
- export type { PIIPattern, CustomPattern, SanitizeConfig } from './utils/sanitize';
145
- export { getApiBaseUrl, stripEndpointSuffix, InvalidEndpointError } from './utils/url-helpers';
144
+ export type { PIIPattern, CustomPattern, SanitizeConfig, } from './utils/sanitize';
145
+ export { getApiBaseUrl, stripEndpointSuffix, InvalidEndpointError, } from './utils/url-helpers';
146
146
  export { validateAuthConfig } from './utils/config-validator';
147
147
  export type { ValidationContext } from './utils/config-validator';
148
148
  export { DEFAULT_PATTERNS, PATTERN_PRESETS, PATTERN_CATEGORIES, PatternBuilder, createPatternConfig, getPattern, getPatternsByCategory, validatePattern, } from './utils/sanitize';
@@ -150,7 +150,7 @@ export type { PIIPatternName, PatternDefinition } from './utils/sanitize';
150
150
  export { FloatingButton } from './widget/button';
151
151
  export type { FloatingButtonOptions } from './widget/button';
152
152
  export { BugReportModal } from './widget/modal';
153
- export type { BugReportData, BugReportModalOptions, PIIDetection } from './widget/modal';
153
+ export type { BugReportData, BugReportModalOptions, PIIDetection, } from './widget/modal';
154
154
  export type { eventWithTime } from '@rrweb/types';
155
155
  export { DEFAULT_REPLAY_DURATION_SECONDS, MAX_RECOMMENDED_REPLAY_DURATION_SECONDS, } from './constants';
156
156
  /**