@bbearai/core 0.9.8 → 0.9.9
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/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +43 -22
- package/dist/index.mjs +43 -22
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1292,7 +1292,8 @@ declare class BugBearClient {
|
|
|
1292
1292
|
}>;
|
|
1293
1293
|
/**
|
|
1294
1294
|
* Submit feedback about the BugBear widget itself.
|
|
1295
|
-
*
|
|
1295
|
+
* When an API key is configured, sends via the dashboard API endpoint.
|
|
1296
|
+
* Otherwise, inserts directly via the Supabase connection.
|
|
1296
1297
|
*/
|
|
1297
1298
|
submitWidgetFeedback(feedback: {
|
|
1298
1299
|
description: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1292,7 +1292,8 @@ declare class BugBearClient {
|
|
|
1292
1292
|
}>;
|
|
1293
1293
|
/**
|
|
1294
1294
|
* Submit feedback about the BugBear widget itself.
|
|
1295
|
-
*
|
|
1295
|
+
* When an API key is configured, sends via the dashboard API endpoint.
|
|
1296
|
+
* Otherwise, inserts directly via the Supabase connection.
|
|
1296
1297
|
*/
|
|
1297
1298
|
submitWidgetFeedback(feedback: {
|
|
1298
1299
|
description: string;
|
package/dist/index.js
CHANGED
|
@@ -1419,34 +1419,55 @@ var BugBearClient = class {
|
|
|
1419
1419
|
}
|
|
1420
1420
|
/**
|
|
1421
1421
|
* Submit feedback about the BugBear widget itself.
|
|
1422
|
-
*
|
|
1422
|
+
* When an API key is configured, sends via the dashboard API endpoint.
|
|
1423
|
+
* Otherwise, inserts directly via the Supabase connection.
|
|
1423
1424
|
*/
|
|
1424
1425
|
async submitWidgetFeedback(feedback) {
|
|
1425
1426
|
try {
|
|
1426
1427
|
await this.ready();
|
|
1427
|
-
const baseUrl = (this.config.apiBaseUrl || DEFAULT_API_BASE_URL).replace(/\/$/, "");
|
|
1428
1428
|
const testerInfo = await this.getTesterInfo();
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1429
|
+
if (this.config.apiKey) {
|
|
1430
|
+
const baseUrl = (this.config.apiBaseUrl || DEFAULT_API_BASE_URL).replace(/\/$/, "");
|
|
1431
|
+
const response = await fetch(`${baseUrl}/api/v1/widget-feedback`, {
|
|
1432
|
+
method: "POST",
|
|
1433
|
+
headers: {
|
|
1434
|
+
"Content-Type": "application/json",
|
|
1435
|
+
"Authorization": `Bearer ${this.config.apiKey}`
|
|
1436
|
+
},
|
|
1437
|
+
body: JSON.stringify({
|
|
1438
|
+
description: feedback.description,
|
|
1439
|
+
type: feedback.type,
|
|
1440
|
+
severity: feedback.severity,
|
|
1441
|
+
title: feedback.title,
|
|
1442
|
+
screenshots: feedback.screenshots,
|
|
1443
|
+
deviceInfo: this.getDeviceInfo(),
|
|
1444
|
+
appContext: this.getAppContext(),
|
|
1445
|
+
reporterName: testerInfo?.name || null,
|
|
1446
|
+
reporterEmail: testerInfo?.email || null
|
|
1447
|
+
})
|
|
1448
|
+
});
|
|
1449
|
+
if (!response.ok) {
|
|
1450
|
+
const body = await response.json().catch(() => ({}));
|
|
1451
|
+
return { success: false, error: body.error || `HTTP ${response.status}` };
|
|
1452
|
+
}
|
|
1453
|
+
return { success: true };
|
|
1454
|
+
}
|
|
1455
|
+
const { error } = await this.supabase.from("reports").insert({
|
|
1456
|
+
project_id: this.config.projectId,
|
|
1457
|
+
report_type: feedback.type,
|
|
1458
|
+
description: feedback.description.trim().slice(0, 1e4),
|
|
1459
|
+
title: feedback.title?.slice(0, 500) || null,
|
|
1460
|
+
severity: feedback.severity || null,
|
|
1461
|
+
screenshot_urls: feedback.screenshots || [],
|
|
1462
|
+
device_info: this.getDeviceInfo(),
|
|
1463
|
+
app_context: this.getAppContext(),
|
|
1464
|
+
report_source: "widget_feedback",
|
|
1465
|
+
reporter_name: testerInfo?.name || null,
|
|
1466
|
+
reporter_email: testerInfo?.email || null
|
|
1446
1467
|
});
|
|
1447
|
-
if (
|
|
1448
|
-
|
|
1449
|
-
return { success: false, error:
|
|
1468
|
+
if (error) {
|
|
1469
|
+
console.error("BugBear: Failed to submit widget feedback", formatPgError(error));
|
|
1470
|
+
return { success: false, error: error.message || "Failed to save feedback" };
|
|
1450
1471
|
}
|
|
1451
1472
|
return { success: true };
|
|
1452
1473
|
} catch (err) {
|
package/dist/index.mjs
CHANGED
|
@@ -1373,34 +1373,55 @@ var BugBearClient = class {
|
|
|
1373
1373
|
}
|
|
1374
1374
|
/**
|
|
1375
1375
|
* Submit feedback about the BugBear widget itself.
|
|
1376
|
-
*
|
|
1376
|
+
* When an API key is configured, sends via the dashboard API endpoint.
|
|
1377
|
+
* Otherwise, inserts directly via the Supabase connection.
|
|
1377
1378
|
*/
|
|
1378
1379
|
async submitWidgetFeedback(feedback) {
|
|
1379
1380
|
try {
|
|
1380
1381
|
await this.ready();
|
|
1381
|
-
const baseUrl = (this.config.apiBaseUrl || DEFAULT_API_BASE_URL).replace(/\/$/, "");
|
|
1382
1382
|
const testerInfo = await this.getTesterInfo();
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1383
|
+
if (this.config.apiKey) {
|
|
1384
|
+
const baseUrl = (this.config.apiBaseUrl || DEFAULT_API_BASE_URL).replace(/\/$/, "");
|
|
1385
|
+
const response = await fetch(`${baseUrl}/api/v1/widget-feedback`, {
|
|
1386
|
+
method: "POST",
|
|
1387
|
+
headers: {
|
|
1388
|
+
"Content-Type": "application/json",
|
|
1389
|
+
"Authorization": `Bearer ${this.config.apiKey}`
|
|
1390
|
+
},
|
|
1391
|
+
body: JSON.stringify({
|
|
1392
|
+
description: feedback.description,
|
|
1393
|
+
type: feedback.type,
|
|
1394
|
+
severity: feedback.severity,
|
|
1395
|
+
title: feedback.title,
|
|
1396
|
+
screenshots: feedback.screenshots,
|
|
1397
|
+
deviceInfo: this.getDeviceInfo(),
|
|
1398
|
+
appContext: this.getAppContext(),
|
|
1399
|
+
reporterName: testerInfo?.name || null,
|
|
1400
|
+
reporterEmail: testerInfo?.email || null
|
|
1401
|
+
})
|
|
1402
|
+
});
|
|
1403
|
+
if (!response.ok) {
|
|
1404
|
+
const body = await response.json().catch(() => ({}));
|
|
1405
|
+
return { success: false, error: body.error || `HTTP ${response.status}` };
|
|
1406
|
+
}
|
|
1407
|
+
return { success: true };
|
|
1408
|
+
}
|
|
1409
|
+
const { error } = await this.supabase.from("reports").insert({
|
|
1410
|
+
project_id: this.config.projectId,
|
|
1411
|
+
report_type: feedback.type,
|
|
1412
|
+
description: feedback.description.trim().slice(0, 1e4),
|
|
1413
|
+
title: feedback.title?.slice(0, 500) || null,
|
|
1414
|
+
severity: feedback.severity || null,
|
|
1415
|
+
screenshot_urls: feedback.screenshots || [],
|
|
1416
|
+
device_info: this.getDeviceInfo(),
|
|
1417
|
+
app_context: this.getAppContext(),
|
|
1418
|
+
report_source: "widget_feedback",
|
|
1419
|
+
reporter_name: testerInfo?.name || null,
|
|
1420
|
+
reporter_email: testerInfo?.email || null
|
|
1400
1421
|
});
|
|
1401
|
-
if (
|
|
1402
|
-
|
|
1403
|
-
return { success: false, error:
|
|
1422
|
+
if (error) {
|
|
1423
|
+
console.error("BugBear: Failed to submit widget feedback", formatPgError(error));
|
|
1424
|
+
return { success: false, error: error.message || "Failed to save feedback" };
|
|
1404
1425
|
}
|
|
1405
1426
|
return { success: true };
|
|
1406
1427
|
} catch (err) {
|