@bugspotter/sdk 0.3.1 → 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/CHANGELOG.md +15 -0
- 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/core/offline-queue.d.ts +13 -0
- package/dist/core/offline-queue.js +49 -4
- package/dist/core/transport.js +20 -8
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +1281 -896
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/utils/config-validator.js +6 -0
- 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/docs/CDN.md +5 -5
- package/eslint.config.js +10 -0
- package/package.json +14 -4
- package/release_notes.md +19 -0
- package/tsconfig.cjs.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pnpm exec lint-staged
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,21 @@ 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
|
+
## [1.0.0] - 2026-01-17
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
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
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- E2E test compatibility issues in Playwright test suite
|
|
20
|
+
- Integration test Node.js Buffer API compatibility
|
|
21
|
+
- ESLint configuration for test environment globals
|
|
22
|
+
|
|
8
23
|
## [0.3.1] - 2026-01-13
|
|
9
24
|
|
|
10
25
|
### Added
|
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.
|