@bbearai/core 0.9.9 → 0.9.11
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.js +20 -12
- package/dist/index.mjs +20 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1426,6 +1426,7 @@ var BugBearClient = class {
|
|
|
1426
1426
|
try {
|
|
1427
1427
|
await this.ready();
|
|
1428
1428
|
const testerInfo = await this.getTesterInfo();
|
|
1429
|
+
const userInfo = await this.getCurrentUserInfo();
|
|
1429
1430
|
if (this.config.apiKey) {
|
|
1430
1431
|
const baseUrl = (this.config.apiBaseUrl || DEFAULT_API_BASE_URL).replace(/\/$/, "");
|
|
1431
1432
|
const response = await fetch(`${baseUrl}/api/v1/widget-feedback`, {
|
|
@@ -1442,8 +1443,9 @@ var BugBearClient = class {
|
|
|
1442
1443
|
screenshots: feedback.screenshots,
|
|
1443
1444
|
deviceInfo: this.getDeviceInfo(),
|
|
1444
1445
|
appContext: this.getAppContext(),
|
|
1445
|
-
|
|
1446
|
-
|
|
1446
|
+
reporterId: userInfo?.id || null,
|
|
1447
|
+
reporterName: testerInfo?.name || userInfo?.name || null,
|
|
1448
|
+
reporterEmail: testerInfo?.email || userInfo?.email || null
|
|
1447
1449
|
})
|
|
1448
1450
|
});
|
|
1449
1451
|
if (!response.ok) {
|
|
@@ -1452,8 +1454,12 @@ var BugBearClient = class {
|
|
|
1452
1454
|
}
|
|
1453
1455
|
return { success: true };
|
|
1454
1456
|
}
|
|
1457
|
+
if (!userInfo?.id) {
|
|
1458
|
+
return { success: false, error: "Unable to identify user. Ensure getCurrentUser returns { id, email }." };
|
|
1459
|
+
}
|
|
1455
1460
|
const { error } = await this.supabase.from("reports").insert({
|
|
1456
1461
|
project_id: this.config.projectId,
|
|
1462
|
+
reporter_id: userInfo.id,
|
|
1457
1463
|
report_type: feedback.type,
|
|
1458
1464
|
description: feedback.description.trim().slice(0, 1e4),
|
|
1459
1465
|
title: feedback.title?.slice(0, 500) || null,
|
|
@@ -1462,9 +1468,9 @@ var BugBearClient = class {
|
|
|
1462
1468
|
device_info: this.getDeviceInfo(),
|
|
1463
1469
|
app_context: this.getAppContext(),
|
|
1464
1470
|
report_source: "widget_feedback",
|
|
1465
|
-
reporter_name: testerInfo?.name || null,
|
|
1466
|
-
reporter_email: testerInfo?.email || null
|
|
1467
|
-
});
|
|
1471
|
+
reporter_name: testerInfo?.name || userInfo.name || null,
|
|
1472
|
+
reporter_email: testerInfo?.email || userInfo.email || null
|
|
1473
|
+
}).select("id").single();
|
|
1468
1474
|
if (error) {
|
|
1469
1475
|
console.error("BugBear: Failed to submit widget feedback", formatPgError(error));
|
|
1470
1476
|
return { success: false, error: error.message || "Failed to save feedback" };
|
|
@@ -1757,8 +1763,9 @@ var BugBearClient = class {
|
|
|
1757
1763
|
)
|
|
1758
1764
|
`).eq("id", assignmentId).single();
|
|
1759
1765
|
if (error || !data) return null;
|
|
1760
|
-
const
|
|
1761
|
-
const
|
|
1766
|
+
const row = data;
|
|
1767
|
+
const testCase = row.test_case;
|
|
1768
|
+
const rpt = row.original_report;
|
|
1762
1769
|
const originalReport = rpt ? {
|
|
1763
1770
|
id: rpt.id,
|
|
1764
1771
|
title: rpt.title,
|
|
@@ -1768,7 +1775,7 @@ var BugBearClient = class {
|
|
|
1768
1775
|
resolutionNotes: rpt.resolution_notes || void 0,
|
|
1769
1776
|
route: rpt.app_context?.currentRoute || void 0
|
|
1770
1777
|
} : void 0;
|
|
1771
|
-
if (!testCase && !
|
|
1778
|
+
if (!testCase && !row.is_verification) {
|
|
1772
1779
|
console.error("BugBear: Assignment returned without test_case");
|
|
1773
1780
|
return null;
|
|
1774
1781
|
}
|
|
@@ -1778,8 +1785,8 @@ var BugBearClient = class {
|
|
|
1778
1785
|
status: data.status,
|
|
1779
1786
|
startedAt: data.started_at,
|
|
1780
1787
|
durationSeconds: data.duration_seconds,
|
|
1781
|
-
isVerification:
|
|
1782
|
-
originalReportId:
|
|
1788
|
+
isVerification: row.is_verification || false,
|
|
1789
|
+
originalReportId: row.original_report_id ?? void 0,
|
|
1783
1790
|
originalReport,
|
|
1784
1791
|
testCase: testCase ? {
|
|
1785
1792
|
id: testCase.id,
|
|
@@ -1800,8 +1807,8 @@ var BugBearClient = class {
|
|
|
1800
1807
|
description: track.description
|
|
1801
1808
|
} : void 0
|
|
1802
1809
|
} : {
|
|
1803
|
-
id:
|
|
1804
|
-
title: rpt?.title || (
|
|
1810
|
+
id: row.original_report_id || data.id,
|
|
1811
|
+
title: rpt?.title || (row.notes?.replace(/^Verification:\s*/i, "") || "Bug Verification"),
|
|
1805
1812
|
testKey: "VERIFY",
|
|
1806
1813
|
description: rpt?.description || "Verify that the reported bug has been fixed",
|
|
1807
1814
|
steps: [],
|
|
@@ -2251,6 +2258,7 @@ var BugBearClient = class {
|
|
|
2251
2258
|
originalBugId: row.original_bug_id || void 0,
|
|
2252
2259
|
originalBugTitle: row.original_bug_title || void 0,
|
|
2253
2260
|
resolutionNotes: row.resolution_notes || void 0,
|
|
2261
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Supabase JSON column
|
|
2254
2262
|
fixCommitSha: row.code_context?.fix?.commit_sha || void 0,
|
|
2255
2263
|
fixCommitMessage: row.code_context?.fix?.commit_message || void 0,
|
|
2256
2264
|
fixFilesChanged: row.code_context?.fix?.files_changed || void 0
|
package/dist/index.mjs
CHANGED
|
@@ -1380,6 +1380,7 @@ var BugBearClient = class {
|
|
|
1380
1380
|
try {
|
|
1381
1381
|
await this.ready();
|
|
1382
1382
|
const testerInfo = await this.getTesterInfo();
|
|
1383
|
+
const userInfo = await this.getCurrentUserInfo();
|
|
1383
1384
|
if (this.config.apiKey) {
|
|
1384
1385
|
const baseUrl = (this.config.apiBaseUrl || DEFAULT_API_BASE_URL).replace(/\/$/, "");
|
|
1385
1386
|
const response = await fetch(`${baseUrl}/api/v1/widget-feedback`, {
|
|
@@ -1396,8 +1397,9 @@ var BugBearClient = class {
|
|
|
1396
1397
|
screenshots: feedback.screenshots,
|
|
1397
1398
|
deviceInfo: this.getDeviceInfo(),
|
|
1398
1399
|
appContext: this.getAppContext(),
|
|
1399
|
-
|
|
1400
|
-
|
|
1400
|
+
reporterId: userInfo?.id || null,
|
|
1401
|
+
reporterName: testerInfo?.name || userInfo?.name || null,
|
|
1402
|
+
reporterEmail: testerInfo?.email || userInfo?.email || null
|
|
1401
1403
|
})
|
|
1402
1404
|
});
|
|
1403
1405
|
if (!response.ok) {
|
|
@@ -1406,8 +1408,12 @@ var BugBearClient = class {
|
|
|
1406
1408
|
}
|
|
1407
1409
|
return { success: true };
|
|
1408
1410
|
}
|
|
1411
|
+
if (!userInfo?.id) {
|
|
1412
|
+
return { success: false, error: "Unable to identify user. Ensure getCurrentUser returns { id, email }." };
|
|
1413
|
+
}
|
|
1409
1414
|
const { error } = await this.supabase.from("reports").insert({
|
|
1410
1415
|
project_id: this.config.projectId,
|
|
1416
|
+
reporter_id: userInfo.id,
|
|
1411
1417
|
report_type: feedback.type,
|
|
1412
1418
|
description: feedback.description.trim().slice(0, 1e4),
|
|
1413
1419
|
title: feedback.title?.slice(0, 500) || null,
|
|
@@ -1416,9 +1422,9 @@ var BugBearClient = class {
|
|
|
1416
1422
|
device_info: this.getDeviceInfo(),
|
|
1417
1423
|
app_context: this.getAppContext(),
|
|
1418
1424
|
report_source: "widget_feedback",
|
|
1419
|
-
reporter_name: testerInfo?.name || null,
|
|
1420
|
-
reporter_email: testerInfo?.email || null
|
|
1421
|
-
});
|
|
1425
|
+
reporter_name: testerInfo?.name || userInfo.name || null,
|
|
1426
|
+
reporter_email: testerInfo?.email || userInfo.email || null
|
|
1427
|
+
}).select("id").single();
|
|
1422
1428
|
if (error) {
|
|
1423
1429
|
console.error("BugBear: Failed to submit widget feedback", formatPgError(error));
|
|
1424
1430
|
return { success: false, error: error.message || "Failed to save feedback" };
|
|
@@ -1711,8 +1717,9 @@ var BugBearClient = class {
|
|
|
1711
1717
|
)
|
|
1712
1718
|
`).eq("id", assignmentId).single();
|
|
1713
1719
|
if (error || !data) return null;
|
|
1714
|
-
const
|
|
1715
|
-
const
|
|
1720
|
+
const row = data;
|
|
1721
|
+
const testCase = row.test_case;
|
|
1722
|
+
const rpt = row.original_report;
|
|
1716
1723
|
const originalReport = rpt ? {
|
|
1717
1724
|
id: rpt.id,
|
|
1718
1725
|
title: rpt.title,
|
|
@@ -1722,7 +1729,7 @@ var BugBearClient = class {
|
|
|
1722
1729
|
resolutionNotes: rpt.resolution_notes || void 0,
|
|
1723
1730
|
route: rpt.app_context?.currentRoute || void 0
|
|
1724
1731
|
} : void 0;
|
|
1725
|
-
if (!testCase && !
|
|
1732
|
+
if (!testCase && !row.is_verification) {
|
|
1726
1733
|
console.error("BugBear: Assignment returned without test_case");
|
|
1727
1734
|
return null;
|
|
1728
1735
|
}
|
|
@@ -1732,8 +1739,8 @@ var BugBearClient = class {
|
|
|
1732
1739
|
status: data.status,
|
|
1733
1740
|
startedAt: data.started_at,
|
|
1734
1741
|
durationSeconds: data.duration_seconds,
|
|
1735
|
-
isVerification:
|
|
1736
|
-
originalReportId:
|
|
1742
|
+
isVerification: row.is_verification || false,
|
|
1743
|
+
originalReportId: row.original_report_id ?? void 0,
|
|
1737
1744
|
originalReport,
|
|
1738
1745
|
testCase: testCase ? {
|
|
1739
1746
|
id: testCase.id,
|
|
@@ -1754,8 +1761,8 @@ var BugBearClient = class {
|
|
|
1754
1761
|
description: track.description
|
|
1755
1762
|
} : void 0
|
|
1756
1763
|
} : {
|
|
1757
|
-
id:
|
|
1758
|
-
title: rpt?.title || (
|
|
1764
|
+
id: row.original_report_id || data.id,
|
|
1765
|
+
title: rpt?.title || (row.notes?.replace(/^Verification:\s*/i, "") || "Bug Verification"),
|
|
1759
1766
|
testKey: "VERIFY",
|
|
1760
1767
|
description: rpt?.description || "Verify that the reported bug has been fixed",
|
|
1761
1768
|
steps: [],
|
|
@@ -2205,6 +2212,7 @@ var BugBearClient = class {
|
|
|
2205
2212
|
originalBugId: row.original_bug_id || void 0,
|
|
2206
2213
|
originalBugTitle: row.original_bug_title || void 0,
|
|
2207
2214
|
resolutionNotes: row.resolution_notes || void 0,
|
|
2215
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Supabase JSON column
|
|
2208
2216
|
fixCommitSha: row.code_context?.fix?.commit_sha || void 0,
|
|
2209
2217
|
fixCommitMessage: row.code_context?.fix?.commit_message || void 0,
|
|
2210
2218
|
fixFilesChanged: row.code_context?.fix?.files_changed || void 0
|