@bugspotter/sdk 0.2.5-alpha.5 → 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 +11 -0
- package/CHANGELOG.md +81 -149
- package/dist/bugspotter.min.js +1 -1
- package/dist/capture/console.d.ts +1 -0
- package/dist/capture/console.js +17 -4
- package/dist/capture/network.d.ts +6 -0
- package/dist/capture/network.js +12 -2
- 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.js +5 -2
- package/dist/core/transport.js +4 -2
- package/dist/core/upload-helpers.js +3 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.esm.js +16889 -44
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +3 -1
- package/dist/utils/sanitize-patterns.js +15 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/widget/components/form-validator.js +2 -1
- package/dist/widget/components/style-manager.d.ts +17 -0
- package/dist/widget/components/style-manager.js +318 -108
- package/dist/widget/components/template-manager.js +2 -1
- package/dist/widget/modal.js +11 -4
- package/eslint.config.js +89 -0
- package/package.json +28 -14
- package/rollup.config.js +25 -0
package/dist/widget/modal.js
CHANGED
|
@@ -126,7 +126,10 @@ class BugReportModal {
|
|
|
126
126
|
});
|
|
127
127
|
// Submit button click (manually trigger form submit for test compatibility)
|
|
128
128
|
elements.submitButton.addEventListener('click', () => {
|
|
129
|
-
const submitEvent = new Event('submit', {
|
|
129
|
+
const submitEvent = new Event('submit', {
|
|
130
|
+
bubbles: true,
|
|
131
|
+
cancelable: true,
|
|
132
|
+
});
|
|
130
133
|
elements.form.dispatchEvent(submitEvent);
|
|
131
134
|
});
|
|
132
135
|
// Cancel button
|
|
@@ -159,7 +162,9 @@ class BugReportModal {
|
|
|
159
162
|
}
|
|
160
163
|
validateField(fieldName) {
|
|
161
164
|
const elements = this.domCache.get();
|
|
162
|
-
const value = fieldName === 'title'
|
|
165
|
+
const value = fieldName === 'title'
|
|
166
|
+
? elements.titleInput.value
|
|
167
|
+
: elements.descriptionTextarea.value;
|
|
163
168
|
const error = this.validator.validateField(fieldName, value);
|
|
164
169
|
const errorElement = fieldName === 'title' ? elements.titleError : elements.descriptionError;
|
|
165
170
|
if (error) {
|
|
@@ -278,7 +283,8 @@ class BugReportModal {
|
|
|
278
283
|
updateProgress('Preparing screenshot...');
|
|
279
284
|
// Prepare screenshot with redactions
|
|
280
285
|
let finalScreenshot = this.originalScreenshot;
|
|
281
|
-
if (this.redactionCanvas &&
|
|
286
|
+
if (this.redactionCanvas &&
|
|
287
|
+
this.redactionCanvas.getRedactions().length > 0) {
|
|
282
288
|
try {
|
|
283
289
|
finalScreenshot = await this.screenshotProcessor.mergeRedactions(this.originalScreenshot, this.redactionCanvas.getCanvas());
|
|
284
290
|
}
|
|
@@ -302,7 +308,8 @@ class BugReportModal {
|
|
|
302
308
|
catch (error) {
|
|
303
309
|
(0, logger_1.getLogger)().error('Error submitting bug report:', error);
|
|
304
310
|
// Show error message in modal instead of blocking alert
|
|
305
|
-
elements.submitError.textContent =
|
|
311
|
+
elements.submitError.textContent =
|
|
312
|
+
'Failed to submit bug report. Please try again.';
|
|
306
313
|
elements.submitError.style.display = 'block';
|
|
307
314
|
// Clear stale progress status for screen readers
|
|
308
315
|
elements.progressStatus.textContent = '';
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import tsParser from '@typescript-eslint/parser';
|
|
3
|
+
import tsPlugin from '@typescript-eslint/eslint-plugin';
|
|
4
|
+
import prettierConfig from 'eslint-config-prettier';
|
|
5
|
+
|
|
6
|
+
export default [
|
|
7
|
+
js.configs.recommended,
|
|
8
|
+
{
|
|
9
|
+
files: ['**/*.{ts,js}'],
|
|
10
|
+
languageOptions: {
|
|
11
|
+
parser: tsParser,
|
|
12
|
+
parserOptions: {
|
|
13
|
+
ecmaVersion: 2020,
|
|
14
|
+
sourceType: 'module',
|
|
15
|
+
},
|
|
16
|
+
globals: {
|
|
17
|
+
// Browser globals
|
|
18
|
+
window: 'readonly',
|
|
19
|
+
document: 'readonly',
|
|
20
|
+
console: 'readonly',
|
|
21
|
+
navigator: 'readonly',
|
|
22
|
+
localStorage: 'readonly',
|
|
23
|
+
fetch: 'readonly',
|
|
24
|
+
XMLHttpRequest: 'readonly',
|
|
25
|
+
Request: 'readonly',
|
|
26
|
+
Response: 'readonly',
|
|
27
|
+
URL: 'readonly',
|
|
28
|
+
Blob: 'readonly',
|
|
29
|
+
File: 'readonly',
|
|
30
|
+
FileReader: 'readonly',
|
|
31
|
+
Image: 'readonly',
|
|
32
|
+
setTimeout: 'readonly',
|
|
33
|
+
clearTimeout: 'readonly',
|
|
34
|
+
setInterval: 'readonly',
|
|
35
|
+
clearInterval: 'readonly',
|
|
36
|
+
crypto: 'readonly',
|
|
37
|
+
alert: 'readonly',
|
|
38
|
+
// DOM types
|
|
39
|
+
HTMLElement: 'readonly',
|
|
40
|
+
HTMLDivElement: 'readonly',
|
|
41
|
+
HTMLButtonElement: 'readonly',
|
|
42
|
+
HTMLFormElement: 'readonly',
|
|
43
|
+
HTMLInputElement: 'readonly',
|
|
44
|
+
HTMLTextAreaElement: 'readonly',
|
|
45
|
+
HTMLImageElement: 'readonly',
|
|
46
|
+
HTMLCanvasElement: 'readonly',
|
|
47
|
+
HTMLStyleElement: 'readonly',
|
|
48
|
+
Element: 'readonly',
|
|
49
|
+
Node: 'readonly',
|
|
50
|
+
Document: 'readonly',
|
|
51
|
+
ShadowRoot: 'readonly',
|
|
52
|
+
Event: 'readonly',
|
|
53
|
+
MouseEvent: 'readonly',
|
|
54
|
+
KeyboardEvent: 'readonly',
|
|
55
|
+
EventListener: 'readonly',
|
|
56
|
+
CanvasRenderingContext2D: 'readonly',
|
|
57
|
+
// Web APIs
|
|
58
|
+
TextEncoder: 'readonly',
|
|
59
|
+
TextDecoder: 'readonly',
|
|
60
|
+
AbortController: 'readonly',
|
|
61
|
+
CompressionStream: 'readonly',
|
|
62
|
+
Console: 'readonly',
|
|
63
|
+
BlobPart: 'readonly',
|
|
64
|
+
BodyInit: 'readonly',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
plugins: {
|
|
68
|
+
'@typescript-eslint': tsPlugin,
|
|
69
|
+
},
|
|
70
|
+
rules: {
|
|
71
|
+
...tsPlugin.configs.recommended.rules,
|
|
72
|
+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
|
73
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
74
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
75
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
76
|
+
'@typescript-eslint/no-non-null-assertion': 'warn',
|
|
77
|
+
'no-console': 'warn',
|
|
78
|
+
'prefer-const': 'error',
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
files: ['**/*.test.{ts,js}', '**/*.spec.{ts,js}'],
|
|
83
|
+
rules: {
|
|
84
|
+
'no-console': 'off',
|
|
85
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
prettierConfig,
|
|
89
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bugspotter/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Professional bug reporting SDK with screenshots, session replay, and automatic error capture for web applications",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -17,20 +17,22 @@
|
|
|
17
17
|
"scripts": {
|
|
18
18
|
"dev": "webpack --watch --mode development",
|
|
19
19
|
"generate-version": "node scripts/generate-version.js",
|
|
20
|
-
"prebuild": "
|
|
21
|
-
"build": "
|
|
20
|
+
"prebuild": "pnpm generate-version",
|
|
21
|
+
"build": "pnpm build:webpack && pnpm build:esm && pnpm build:cjs",
|
|
22
22
|
"build:webpack": "webpack --mode production",
|
|
23
|
-
"build:esm": "
|
|
23
|
+
"build:esm": "rollup -c rollup.config.js",
|
|
24
24
|
"build:cjs": "tsc --project tsconfig.cjs.json",
|
|
25
|
-
"prepublishOnly": "npm run build && npm test",
|
|
26
|
-
"lint": "eslint \"src/**/*.{ts,js}\"",
|
|
27
|
-
"lint:fix": "eslint \"src/**/*.{ts,js}\" --fix",
|
|
28
|
-
"pretest": "npm run generate-version",
|
|
29
25
|
"test": "vitest run",
|
|
30
26
|
"test:watch": "vitest",
|
|
31
|
-
"test:ui": "vitest --ui",
|
|
32
27
|
"test:coverage": "vitest run --coverage",
|
|
33
|
-
"test:e2e": "
|
|
28
|
+
"test:e2e": "playwright test",
|
|
29
|
+
"prepublishOnly": "pnpm build && pnpm test",
|
|
30
|
+
"lint": "eslint \"src/**/*.{ts,js}\"",
|
|
31
|
+
"lint:fix": "eslint \"src/**/*.{ts,js}\" --fix",
|
|
32
|
+
"format": "prettier --write \"src/**/*.{ts,js,json,md}\"",
|
|
33
|
+
"format:check": "prettier --check \"src/**/*.{ts,js,json,md}\"",
|
|
34
|
+
"pretest": "pnpm generate-version",
|
|
35
|
+
"test:ui": "vitest --ui",
|
|
34
36
|
"test:e2e:watch": "vitest --config vitest.e2e.config.ts",
|
|
35
37
|
"test:playwright": "playwright test",
|
|
36
38
|
"test:playwright:ui": "playwright test --ui"
|
|
@@ -53,13 +55,13 @@
|
|
|
53
55
|
"license": "MIT",
|
|
54
56
|
"repository": {
|
|
55
57
|
"type": "git",
|
|
56
|
-
"url": "https://github.com/apexbridge-tech/bugspotter.git",
|
|
57
|
-
"directory": "packages/
|
|
58
|
+
"url": "https://github.com/apexbridge-tech/bugspotter-sdk.git",
|
|
59
|
+
"directory": "packages/core"
|
|
58
60
|
},
|
|
59
61
|
"bugs": {
|
|
60
|
-
"url": "https://github.com/apexbridge-tech/bugspotter/issues"
|
|
62
|
+
"url": "https://github.com/apexbridge-tech/bugspotter-sdk/issues"
|
|
61
63
|
},
|
|
62
|
-
"homepage": "https://github.com/apexbridge-tech/bugspotter#readme",
|
|
64
|
+
"homepage": "https://github.com/apexbridge-tech/bugspotter-sdk#readme",
|
|
63
65
|
"engines": {
|
|
64
66
|
"node": ">=16.0.0"
|
|
65
67
|
},
|
|
@@ -76,14 +78,26 @@
|
|
|
76
78
|
},
|
|
77
79
|
"devDependencies": {
|
|
78
80
|
"@playwright/test": "^1.48.0",
|
|
81
|
+
"@rollup/plugin-commonjs": "^29.0.0",
|
|
82
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
83
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
79
84
|
"@types/node": "^20.11.0",
|
|
80
85
|
"@types/pako": "^2.0.4",
|
|
86
|
+
"@typescript-eslint/eslint-plugin": "^8.18.2",
|
|
87
|
+
"@typescript-eslint/parser": "^8.18.2",
|
|
81
88
|
"@vitest/coverage-v8": "^3.2.4",
|
|
82
89
|
"@vitest/ui": "^3.2.4",
|
|
90
|
+
"eslint": "^9.17.0",
|
|
91
|
+
"eslint-config-prettier": "^10.1.8",
|
|
92
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
83
93
|
"happy-dom": "^19.0.2",
|
|
84
94
|
"jsdom": "^24.1.0",
|
|
95
|
+
"prettier": "^3.4.2",
|
|
96
|
+
"rollup": "^4.55.1",
|
|
97
|
+
"rollup-plugin-dts": "^6.3.0",
|
|
85
98
|
"shx": "^0.4.0",
|
|
86
99
|
"ts-loader": "^9.5.1",
|
|
100
|
+
"tslib": "^2.8.1",
|
|
87
101
|
"typescript": "^5.3.3",
|
|
88
102
|
"vitest": "^3.2.4",
|
|
89
103
|
"webpack": "^5.90.0",
|
package/rollup.config.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import resolve from '@rollup/plugin-node-resolve';
|
|
2
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
3
|
+
import typescript from '@rollup/plugin-typescript';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
input: 'src/index.ts',
|
|
7
|
+
output: {
|
|
8
|
+
file: 'dist/index.esm.js',
|
|
9
|
+
format: 'es',
|
|
10
|
+
sourcemap: true,
|
|
11
|
+
},
|
|
12
|
+
plugins: [
|
|
13
|
+
resolve({
|
|
14
|
+
browser: true,
|
|
15
|
+
preferBuiltins: false,
|
|
16
|
+
}),
|
|
17
|
+
commonjs(),
|
|
18
|
+
typescript({
|
|
19
|
+
tsconfig: 'tsconfig.build.json',
|
|
20
|
+
declaration: false, // We'll generate declarations separately
|
|
21
|
+
declarationMap: false,
|
|
22
|
+
}),
|
|
23
|
+
],
|
|
24
|
+
external: [], // Bundle everything for now
|
|
25
|
+
};
|