@bugspotter/sdk 0.3.0 → 1.0.0
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/.husky/pre-commit +1 -0
- package/.prettierrc +11 -0
- package/CHANGELOG.md +91 -144
- package/CONTRIBUTING.md +200 -0
- package/README.md +18 -16
- package/SECURITY.md +65 -0
- package/dist/bugspotter.min.js +2 -1
- package/dist/bugspotter.min.js.map +1 -0
- package/dist/capture/console.js +14 -3
- package/dist/capture/screenshot.js +3 -2
- package/dist/core/buffer.js +2 -1
- package/dist/core/bug-reporter.js +16 -5
- package/dist/core/circular-buffer.js +4 -1
- package/dist/core/compress.js +2 -1
- package/dist/core/file-upload-handler.js +5 -2
- package/dist/core/offline-queue.d.ts +13 -0
- package/dist/core/offline-queue.js +54 -6
- package/dist/core/transport.js +24 -10
- package/dist/core/upload-helpers.js +3 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.esm.js +17379 -149
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +5 -1
- package/dist/utils/config-validator.js +6 -0
- package/dist/utils/sanitize-patterns.js +15 -3
- package/dist/utils/url-helpers.d.ts +15 -0
- package/dist/utils/url-helpers.js +37 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/widget/button.d.ts +10 -0
- package/dist/widget/button.js +200 -3
- package/dist/widget/components/form-validator.js +2 -1
- package/dist/widget/components/style-manager.js +2 -1
- package/dist/widget/components/template-manager.js +2 -1
- package/dist/widget/modal.js +11 -4
- package/docs/CDN.md +5 -5
- package/eslint.config.js +99 -0
- package/package.json +39 -15
- package/release_notes.md +19 -0
- package/rollup.config.js +25 -0
- package/tsconfig.cjs.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pnpm exec lint-staged
|
package/.prettierrc
ADDED
package/CHANGELOG.md
CHANGED
|
@@ -5,176 +5,123 @@ 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.
|
|
8
|
+
## [1.0.0] - 2026-01-17
|
|
9
9
|
|
|
10
|
+
### Changed
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
- **Stable Release**: First production-ready 1.0.0 release
|
|
13
|
+
- Improved code quality and readability across core modules
|
|
14
|
+
- Enhanced test infrastructure with better Node.js and browser compatibility
|
|
15
|
+
- Optimized transport layer and URL validation logic
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
### Fixed
|
|
14
18
|
|
|
15
|
-
|
|
19
|
+
- E2E test compatibility issues in Playwright test suite
|
|
20
|
+
- Integration test Node.js Buffer API compatibility
|
|
21
|
+
- ESLint configuration for test environment globals
|
|
16
22
|
|
|
23
|
+
## [0.3.1] - 2026-01-13
|
|
17
24
|
|
|
18
|
-
###
|
|
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)
|
|
25
|
+
### Added
|
|
62
26
|
|
|
63
|
-
|
|
27
|
+
- Node.js 22 LTS support for long-term stability
|
|
28
|
+
- pnpm 9.15.0 integration with improved dependency resolution
|
|
29
|
+
- Cross-browser E2E test suite (Chromium, Firefox, WebKit)
|
|
30
|
+
- Enhanced CI/CD pipeline with better error handling
|
|
31
|
+
- CDN deployment support in release workflow
|
|
64
32
|
|
|
65
|
-
|
|
33
|
+
### Changed
|
|
66
34
|
|
|
67
|
-
|
|
35
|
+
- Updated Firefox large DOM test timeout from 35s to 45s for better compatibility
|
|
36
|
+
- Improved ESLint configuration for test environments
|
|
37
|
+
- Better handling of runtime-injected globals in type checking
|
|
68
38
|
|
|
69
|
-
###
|
|
39
|
+
### Fixed
|
|
70
40
|
|
|
71
|
-
-
|
|
41
|
+
- Resolved pnpm version conflict between CI config and package.json
|
|
42
|
+
- Fixed E2E test timeouts for slower browser environments
|
|
43
|
+
- Corrected TypeScript type definitions for test mocks
|
|
72
44
|
|
|
73
|
-
## [0.
|
|
45
|
+
## [0.3.0] - 2025-12-20
|
|
74
46
|
|
|
75
|
-
###
|
|
47
|
+
### Added
|
|
76
48
|
|
|
77
|
-
- **
|
|
49
|
+
- **Duplicate Prevention System**: Automatic detection and prevention of duplicate bug reports
|
|
50
|
+
- **Backend-Controlled Replay Settings**: Dynamic replay configuration from server
|
|
51
|
+
- **Upload Progress Feedback**: Real-time progress indication for file uploads
|
|
52
|
+
- **Screenshot Proxy Endpoint**: Server-side screenshot proxy support
|
|
53
|
+
- **SDK Internal Log Filtering**: Automatic exclusion of SDK's own logs from reports
|
|
78
54
|
|
|
79
|
-
|
|
55
|
+
### Changed
|
|
80
56
|
|
|
81
|
-
|
|
57
|
+
- BugSpotter.init() is now async (returns Promise<BugSpotter>)
|
|
58
|
+
- Improved transport layer architecture
|
|
59
|
+
- Enhanced offline queue management
|
|
82
60
|
|
|
83
|
-
|
|
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))
|
|
61
|
+
## [0.2.0] - 2025-11-21
|
|
97
62
|
|
|
98
|
-
###
|
|
63
|
+
### Added
|
|
99
64
|
|
|
100
|
-
-
|
|
101
|
-
-
|
|
102
|
-
- **
|
|
65
|
+
- **Session Replay**: Recording with rrweb (configurable buffer duration up to 30s)
|
|
66
|
+
- **Mouse Event Sampling**: Configurable intervals for mouse tracking
|
|
67
|
+
- **Comprehensive E2E Tests**: Full test suite with Playwright (Chromium, Firefox, WebKit)
|
|
68
|
+
- **Shadow DOM Support**: Complete replay capture for Shadow DOM content
|
|
69
|
+
- **Type Safety Enhancements**: Improved Zod validation and type definitions
|
|
103
70
|
|
|
104
|
-
###
|
|
71
|
+
### Changed
|
|
105
72
|
|
|
106
|
-
-
|
|
107
|
-
-
|
|
108
|
-
-
|
|
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))
|
|
73
|
+
- Refactored capture classes with better options and performance
|
|
74
|
+
- Improved transport and offline queue architecture
|
|
75
|
+
- Enhanced error handling in retry logic
|
|
114
76
|
|
|
115
|
-
###
|
|
77
|
+
### Fixed
|
|
116
78
|
|
|
117
|
-
-
|
|
79
|
+
- Content-Type header removal from presigned URL uploads (fixed 403 errors)
|
|
80
|
+
- rrweb CDN loading for reliable replay verification
|
|
81
|
+
- Release workflow prerelease tag support
|
|
118
82
|
|
|
119
83
|
## [0.1.0] - 2025-11-01
|
|
120
84
|
|
|
121
85
|
### Added
|
|
122
86
|
|
|
123
|
-
|
|
124
|
-
- Screenshot
|
|
125
|
-
-
|
|
126
|
-
-
|
|
127
|
-
-
|
|
128
|
-
-
|
|
129
|
-
|
|
87
|
+
#### Core Capture Features
|
|
88
|
+
- **Screenshot Capture**: Full-page screenshots with CSP-safe html-to-image library
|
|
89
|
+
- **Console Logging**: Capture all console messages with stack traces
|
|
90
|
+
- **Network Tracking**: Monitor all HTTP requests (fetch/XHR) with timing
|
|
91
|
+
- **Browser Metadata**: Automatic detection of browser, OS, viewport
|
|
92
|
+
- **DOM Capture**: Complete DOM structure preservation
|
|
93
|
+
|
|
94
|
+
#### Data Protection & Privacy
|
|
95
|
+
- **PII Sanitization**: Automatic detection and redaction of sensitive data
|
|
130
96
|
- Built-in patterns: email, phone, credit card, SSN, IIN, IP address
|
|
131
|
-
- Custom pattern support
|
|
132
|
-
-
|
|
133
|
-
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
-
|
|
137
|
-
-
|
|
138
|
-
-
|
|
139
|
-
-
|
|
140
|
-
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
- **
|
|
149
|
-
- **
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
-
|
|
158
|
-
-
|
|
159
|
-
|
|
160
|
-
|
|
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
|
|
97
|
+
- Custom regex pattern support
|
|
98
|
+
- Per-element CSS selector-based exclusion
|
|
99
|
+
- **Content Security Policy (CSP) Compliant**: No eval, no inline scripts
|
|
100
|
+
|
|
101
|
+
#### Reliability & Performance
|
|
102
|
+
- **Compression**: gzip compression reduces payloads by 70-90%
|
|
103
|
+
- **Direct Upload**: Presigned URL uploads with 97% memory reduction vs base64
|
|
104
|
+
- **Offline Queue**: Store and sync bug reports when network unavailable
|
|
105
|
+
- **Exponential Backoff**: Intelligent retry strategy with configurable delays
|
|
106
|
+
- **Circular Buffering**: Efficient memory usage for long-running sessions
|
|
107
|
+
|
|
108
|
+
#### User Interface
|
|
109
|
+
- **Floating Widget Button**: Customizable position (corner/edge), styling, and icon
|
|
110
|
+
- **Bug Report Modal**: User-friendly form with validation for manual submission
|
|
111
|
+
- **Responsive Design**: Optimized for both desktop and mobile viewports
|
|
112
|
+
|
|
113
|
+
#### Authentication & Integration
|
|
114
|
+
- **Multiple Auth Types**: API Key, Bearer token, custom headers
|
|
115
|
+
- **Framework Agnostic**: Works with vanilla JavaScript and all major frameworks
|
|
116
|
+
|
|
117
|
+
#### Module Formats & TypeScript
|
|
118
|
+
- **ESM, CommonJS, UMD**: Support for all modern module systems
|
|
119
|
+
- **TypeScript Support**: Full type definitions with proper generic types
|
|
120
|
+
- **Source Maps**: Included for debugging and production support
|
|
121
|
+
|
|
122
|
+
#### Documentation
|
|
123
|
+
- Complete API reference with examples
|
|
124
|
+
- Framework integration guides (React, Vue, Angular, Next.js, Nuxt, Svelte)
|
|
125
|
+
- Session replay configuration and best practices
|
|
126
|
+
- PII sanitization customization guide
|
|
127
|
+
- Direct upload implementation guide
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# Contributing to BugSpotter SDK
|
|
2
|
+
|
|
3
|
+
Thank you for considering contributing to the BugSpotter SDK! This document outlines the process for contributing to this project.
|
|
4
|
+
|
|
5
|
+
## Development Setup
|
|
6
|
+
|
|
7
|
+
### Prerequisites
|
|
8
|
+
- Node.js 18+ (recommended: 18.x or 20.x)
|
|
9
|
+
- pnpm 8+
|
|
10
|
+
- Git
|
|
11
|
+
|
|
12
|
+
### Getting Started
|
|
13
|
+
|
|
14
|
+
1. **Fork and Clone**
|
|
15
|
+
```bash
|
|
16
|
+
git clone https://github.com/your-username/bugspotter-sdk.git
|
|
17
|
+
cd bugspotter-sdk
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
2. **Install Dependencies**
|
|
21
|
+
```bash
|
|
22
|
+
pnpm install
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
3. **Build the Project**
|
|
26
|
+
```bash
|
|
27
|
+
pnpm build
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
4. **Run Tests**
|
|
31
|
+
```bash
|
|
32
|
+
# Unit tests
|
|
33
|
+
pnpm test
|
|
34
|
+
|
|
35
|
+
# E2E tests (requires browsers)
|
|
36
|
+
pnpm test:e2e
|
|
37
|
+
|
|
38
|
+
# Watch mode for development
|
|
39
|
+
pnpm test:watch
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Project Structure
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
bugspotter-sdk/
|
|
46
|
+
├── packages/core/ # Main SDK package
|
|
47
|
+
│ ├── src/ # Source code
|
|
48
|
+
│ ├── tests/ # Unit tests
|
|
49
|
+
│ ├── docs/ # SDK documentation
|
|
50
|
+
│ └── scripts/ # Build scripts
|
|
51
|
+
├── examples/ # Integration examples
|
|
52
|
+
│ ├── react/ # React example
|
|
53
|
+
│ └── vanilla/ # Vanilla JS example
|
|
54
|
+
└── .github/ # GitHub workflows and templates
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Development Workflow
|
|
58
|
+
|
|
59
|
+
1. **Create a Branch**
|
|
60
|
+
```bash
|
|
61
|
+
git checkout -b feature/your-feature-name
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
2. **Make Changes**
|
|
65
|
+
- Write code in `packages/core/src/`
|
|
66
|
+
- Add tests in `packages/core/tests/`
|
|
67
|
+
- Update documentation as needed
|
|
68
|
+
|
|
69
|
+
3. **Test Your Changes**
|
|
70
|
+
```bash
|
|
71
|
+
pnpm test # Unit tests
|
|
72
|
+
pnpm test:e2e # E2E tests
|
|
73
|
+
pnpm lint # Code linting
|
|
74
|
+
pnpm format:check # Code formatting
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
4. **Commit Changes**
|
|
78
|
+
```bash
|
|
79
|
+
git add .
|
|
80
|
+
git commit -m "feat: add your feature"
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
5. **Push and Create PR**
|
|
84
|
+
```bash
|
|
85
|
+
git push origin feature/your-feature-name
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Code Style and Standards
|
|
89
|
+
|
|
90
|
+
### TypeScript Guidelines
|
|
91
|
+
- Use strict TypeScript settings
|
|
92
|
+
- Provide proper type annotations
|
|
93
|
+
- Avoid `any` types when possible
|
|
94
|
+
- Use interfaces for object shapes
|
|
95
|
+
|
|
96
|
+
### Code Formatting
|
|
97
|
+
- Use Prettier for formatting (automatic via `pnpm format`)
|
|
98
|
+
- Use ESLint for code quality (check via `pnpm lint`)
|
|
99
|
+
- Follow existing naming conventions
|
|
100
|
+
|
|
101
|
+
### Testing
|
|
102
|
+
- Write unit tests for all new functionality
|
|
103
|
+
- Maintain test coverage above 80%
|
|
104
|
+
- Add E2E tests for user-facing features
|
|
105
|
+
- Use descriptive test names and organize tests logically
|
|
106
|
+
|
|
107
|
+
### Commit Messages
|
|
108
|
+
Follow [Conventional Commits](https://conventionalcommits.org/):
|
|
109
|
+
|
|
110
|
+
- `feat: add new feature`
|
|
111
|
+
- `fix: bug fix`
|
|
112
|
+
- `docs: update documentation`
|
|
113
|
+
- `style: code formatting`
|
|
114
|
+
- `refactor: code refactoring`
|
|
115
|
+
- `test: add or update tests`
|
|
116
|
+
- `chore: maintenance tasks`
|
|
117
|
+
|
|
118
|
+
## Adding New Features
|
|
119
|
+
|
|
120
|
+
### Core SDK Features
|
|
121
|
+
1. Create feature in `packages/core/src/`
|
|
122
|
+
2. Add comprehensive tests
|
|
123
|
+
3. Update TypeScript types
|
|
124
|
+
4. Add documentation
|
|
125
|
+
5. Consider browser compatibility (ES2017+)
|
|
126
|
+
|
|
127
|
+
### Examples
|
|
128
|
+
1. Create new example in `examples/your-framework/`
|
|
129
|
+
2. Include `package.json` with dependencies
|
|
130
|
+
3. Add build configuration (Vite recommended)
|
|
131
|
+
4. Include README with setup instructions
|
|
132
|
+
|
|
133
|
+
## Testing
|
|
134
|
+
|
|
135
|
+
### Unit Tests
|
|
136
|
+
- Located in `packages/core/tests/`
|
|
137
|
+
- Use Vitest testing framework
|
|
138
|
+
- Mock external dependencies
|
|
139
|
+
- Test edge cases and error conditions
|
|
140
|
+
|
|
141
|
+
### E2E Tests
|
|
142
|
+
- Use Playwright for browser testing
|
|
143
|
+
- Test real browser interactions
|
|
144
|
+
- Verify SDK integration works end-to-end
|
|
145
|
+
|
|
146
|
+
### Test Commands
|
|
147
|
+
```bash
|
|
148
|
+
pnpm test # Run unit tests
|
|
149
|
+
pnpm test:watch # Watch mode
|
|
150
|
+
pnpm test:coverage # Coverage report
|
|
151
|
+
pnpm test:e2e # E2E tests
|
|
152
|
+
pnpm test:e2e --headed # E2E with browser UI
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Building and Publishing
|
|
156
|
+
|
|
157
|
+
### Local Development
|
|
158
|
+
```bash
|
|
159
|
+
pnpm dev # Watch mode for development
|
|
160
|
+
pnpm build # Production build
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Release Process
|
|
164
|
+
1. Update version in `packages/core/package.json`
|
|
165
|
+
2. Update `CHANGELOG.md` with changes
|
|
166
|
+
3. Create git tag: `git tag v0.3.1`
|
|
167
|
+
4. Push tag: `git push origin v0.3.1`
|
|
168
|
+
5. GitHub Actions will automatically publish to npm
|
|
169
|
+
|
|
170
|
+
## Pull Request Process
|
|
171
|
+
|
|
172
|
+
1. Fill out the PR template completely
|
|
173
|
+
2. Ensure all CI checks pass:
|
|
174
|
+
- ✅ Tests pass
|
|
175
|
+
- ✅ Linting passes
|
|
176
|
+
- ✅ Build succeeds
|
|
177
|
+
- ✅ Type checking passes
|
|
178
|
+
3. Request review from maintainers
|
|
179
|
+
4. Address feedback and update PR
|
|
180
|
+
5. Maintainer will merge after approval
|
|
181
|
+
|
|
182
|
+
## Code Review Criteria
|
|
183
|
+
|
|
184
|
+
- **Functionality**: Does the code work as intended?
|
|
185
|
+
- **Tests**: Are there adequate tests with good coverage?
|
|
186
|
+
- **Performance**: Does the change impact bundle size or performance?
|
|
187
|
+
- **Compatibility**: Works across supported browsers and Node versions?
|
|
188
|
+
- **Documentation**: Is the change properly documented?
|
|
189
|
+
- **Security**: No security vulnerabilities introduced?
|
|
190
|
+
|
|
191
|
+
## Getting Help
|
|
192
|
+
|
|
193
|
+
- **Questions**: Open a [Discussion](https://github.com/apexbridge-tech/bugspotter-sdk/discussions)
|
|
194
|
+
- **Bugs**: Open an [Issue](https://github.com/apexbridge-tech/bugspotter-sdk/issues) with the bug template
|
|
195
|
+
- **Features**: Open an [Issue](https://github.com/apexbridge-tech/bugspotter-sdk/issues) with the feature template
|
|
196
|
+
- **Security**: Email security@apexbridge.tech
|
|
197
|
+
|
|
198
|
+
## License
|
|
199
|
+
|
|
200
|
+
By contributing to BugSpotter SDK, you agree that your contributions will be licensed under the MIT License.
|
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ pnpm add @bugspotter/sdk
|
|
|
23
23
|
|
|
24
24
|
```html
|
|
25
25
|
<!-- BugSpotter CDN (versioned - recommended for production) -->
|
|
26
|
-
<script src="https://cdn.bugspotter.io/sdk/bugspotter-
|
|
26
|
+
<script src="https://cdn.bugspotter.io/sdk/bugspotter-1.0.0.min.js"></script>
|
|
27
27
|
|
|
28
28
|
<!-- Latest version (for development only) -->
|
|
29
29
|
<script src="https://cdn.bugspotter.io/sdk/bugspotter-latest.min.js"></script>
|
|
@@ -89,15 +89,17 @@ const bugSpotter = await BugSpotter.init({
|
|
|
89
89
|
<script src="https://cdn.bugspotter.io/sdk/bugspotter-latest.min.js"></script>
|
|
90
90
|
<script>
|
|
91
91
|
// Initialize with auto-widget
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
92
|
+
(async () => {
|
|
93
|
+
const bugSpotter = await BugSpotter.init({
|
|
94
|
+
endpoint: 'https://api.bugspotter.com/api/v1/reports',
|
|
95
|
+
auth: {
|
|
96
|
+
type: 'api-key',
|
|
97
|
+
apiKey: 'bgs_your_api_key',
|
|
98
|
+
projectId: 'your-project-uuid',
|
|
99
|
+
},
|
|
100
|
+
showWidget: true,
|
|
101
|
+
});
|
|
102
|
+
})();
|
|
101
103
|
</script>
|
|
102
104
|
```
|
|
103
105
|
|
|
@@ -109,7 +111,7 @@ The SDK automatically uses an **optimized presigned URL upload flow** (40% fewer
|
|
|
109
111
|
import BugSpotter from '@bugspotter/sdk';
|
|
110
112
|
|
|
111
113
|
// 1. Initialize SDK with required auth
|
|
112
|
-
const bugSpotter = BugSpotter.init({
|
|
114
|
+
const bugSpotter = await BugSpotter.init({
|
|
113
115
|
endpoint: 'https://api.bugspotter.com/api/v1/reports',
|
|
114
116
|
auth: {
|
|
115
117
|
type: 'api-key',
|
|
@@ -139,7 +141,7 @@ const bugSpotter = BugSpotter.init({
|
|
|
139
141
|
|
|
140
142
|
```javascript
|
|
141
143
|
// Initialize without widget
|
|
142
|
-
const bugSpotter = BugSpotter.init({
|
|
144
|
+
const bugSpotter = await BugSpotter.init({
|
|
143
145
|
endpoint: 'https://api.bugspotter.com/api/v1/reports',
|
|
144
146
|
auth: {
|
|
145
147
|
type: 'api-key',
|
|
@@ -174,7 +176,7 @@ await bugSpotter.submit({
|
|
|
174
176
|
|
|
175
177
|
```javascript
|
|
176
178
|
// Widget appears automatically with showWidget: true
|
|
177
|
-
const bugSpotter = BugSpotter.init({
|
|
179
|
+
const bugSpotter = await BugSpotter.init({
|
|
178
180
|
endpoint: 'https://api.bugspotter.com/api/v1/reports',
|
|
179
181
|
auth: {
|
|
180
182
|
type: 'api-key',
|
|
@@ -257,7 +259,7 @@ Automatic detection and masking of sensitive data before submission.
|
|
|
257
259
|
**Built-in patterns:** Email, phone, credit card, SSN, Kazakhstan IIN, IP address
|
|
258
260
|
|
|
259
261
|
```javascript
|
|
260
|
-
BugSpotter.init({
|
|
262
|
+
await BugSpotter.init({
|
|
261
263
|
sanitize: {
|
|
262
264
|
enabled: true, // Default
|
|
263
265
|
patterns: ['email', 'phone', 'creditcard'],
|
|
@@ -269,7 +271,7 @@ BugSpotter.init({
|
|
|
269
271
|
|
|
270
272
|
**Performance:** <10ms overhead, supports Cyrillic text
|
|
271
273
|
|
|
272
|
-
##
|
|
274
|
+
## 📋 API Reference
|
|
273
275
|
|
|
274
276
|
### BugSpotter Class
|
|
275
277
|
|
|
@@ -680,7 +682,7 @@ pnpm test --coverage # Coverage report
|
|
|
680
682
|
|
|
681
683
|
**345 tests** passing (unit + E2E + Playwright)
|
|
682
684
|
|
|
683
|
-
##
|
|
685
|
+
## 🛠️ Building
|
|
684
686
|
|
|
685
687
|
```bash
|
|
686
688
|
pnpm run dev # Development with watch
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
We provide security updates for the following versions of BugSpotter SDK:
|
|
6
|
+
|
|
7
|
+
| Version | Supported |
|
|
8
|
+
| ------- | ------------------ |
|
|
9
|
+
| 1.0.x | :white_check_mark: |
|
|
10
|
+
| < 1.0 | :x: |
|
|
11
|
+
|
|
12
|
+
## Reporting a Vulnerability
|
|
13
|
+
|
|
14
|
+
We take security seriously. If you discover a security vulnerability in the BugSpotter SDK, please report it to us privately.
|
|
15
|
+
|
|
16
|
+
### How to Report
|
|
17
|
+
|
|
18
|
+
1. **Do not** open a public GitHub issue for security vulnerabilities
|
|
19
|
+
2. Send an email to security@apexbridge.tech with:
|
|
20
|
+
- A description of the vulnerability
|
|
21
|
+
- Steps to reproduce the issue
|
|
22
|
+
- Potential impact assessment
|
|
23
|
+
- Any suggested fixes (optional)
|
|
24
|
+
|
|
25
|
+
### Response Timeline
|
|
26
|
+
|
|
27
|
+
- **Acknowledgment**: We'll acknowledge your report within 48 hours
|
|
28
|
+
- **Assessment**: We'll provide an initial assessment within 1 week
|
|
29
|
+
- **Fix Timeline**: Critical vulnerabilities will be patched within 2 weeks
|
|
30
|
+
- **Disclosure**: We'll coordinate responsible disclosure with you
|
|
31
|
+
|
|
32
|
+
### Security Best Practices
|
|
33
|
+
|
|
34
|
+
When using the BugSpotter SDK:
|
|
35
|
+
|
|
36
|
+
1. **API Key Security**:
|
|
37
|
+
- Never expose API keys in client-side code
|
|
38
|
+
- Use environment variables for configuration
|
|
39
|
+
- Rotate API keys regularly
|
|
40
|
+
|
|
41
|
+
2. **Data Privacy**:
|
|
42
|
+
- Configure PII detection appropriately
|
|
43
|
+
- Review captured data for sensitive information
|
|
44
|
+
- Implement proper data retention policies
|
|
45
|
+
|
|
46
|
+
3. **Content Security Policy**:
|
|
47
|
+
- Include appropriate CSP headers
|
|
48
|
+
- Whitelist necessary domains for the SDK
|
|
49
|
+
|
|
50
|
+
4. **Dependencies**:
|
|
51
|
+
- Keep the SDK updated to the latest version
|
|
52
|
+
- Monitor security advisories for dependencies
|
|
53
|
+
|
|
54
|
+
## Security Features
|
|
55
|
+
|
|
56
|
+
The BugSpotter SDK includes several security features:
|
|
57
|
+
|
|
58
|
+
- **PII Detection**: Automatic detection and sanitization of personally identifiable information
|
|
59
|
+
- **Content Sanitization**: XSS protection in captured content
|
|
60
|
+
- **Secure Uploads**: Encrypted transmission of screenshots and session data
|
|
61
|
+
- **Input Validation**: Strict validation of all user inputs
|
|
62
|
+
|
|
63
|
+
## Bug Bounty
|
|
64
|
+
|
|
65
|
+
We currently do not have a formal bug bounty program, but we appreciate responsible disclosure and will acknowledge security researchers who help improve our security.
|