@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.
@@ -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', { bubbles: true, cancelable: true });
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' ? elements.titleInput.value : elements.descriptionTextarea.value;
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 && this.redactionCanvas.getRedactions().length > 0) {
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 = 'Failed to submit bug report. Please try again.';
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 = '';
@@ -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.2.5-alpha.5",
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": "npm run generate-version",
21
- "build": "npm run build:webpack && npm run build:esm && npm run build:cjs",
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": "tsc --project tsconfig.build.json --module ES2020 --outDir dist/esm && shx mv dist/esm/index.js dist/index.esm.js && shx rm -rf dist/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": "vitest run --config vitest.e2e.config.ts",
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/sdk"
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",
@@ -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
+ };