@bbearai/core 0.9.10 → 0.9.12
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 +4 -6
- package/dist/index.d.ts +4 -6
- package/dist/index.js +16 -7
- package/dist/index.mjs +16 -7
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -828,11 +828,13 @@ interface QATask {
|
|
|
828
828
|
updatedAt: string;
|
|
829
829
|
}
|
|
830
830
|
/** Category for filtering tester issues in the widget */
|
|
831
|
-
type IssueCategory = 'open' | 'done' | 'reopened';
|
|
831
|
+
type IssueCategory = 'open' | 'retest' | 'done' | 'wont_fix' | 'reopened';
|
|
832
832
|
/** Issue counts for each category (HomeScreen cards) */
|
|
833
833
|
interface IssueCounts {
|
|
834
834
|
open: number;
|
|
835
|
+
retest: number;
|
|
835
836
|
done: number;
|
|
837
|
+
wont_fix: number;
|
|
836
838
|
reopened: number;
|
|
837
839
|
}
|
|
838
840
|
/** A report as seen by the tester in the widget */
|
|
@@ -1426,11 +1428,7 @@ declare class BugBearClient {
|
|
|
1426
1428
|
* Used by the widget HomeScreen cards
|
|
1427
1429
|
* @param mineOnly - If true (default), only counts the tester's own reports. If false, counts all project reports.
|
|
1428
1430
|
*/
|
|
1429
|
-
getIssueCounts(mineOnly?: boolean): Promise<
|
|
1430
|
-
open: number;
|
|
1431
|
-
done: number;
|
|
1432
|
-
reopened: number;
|
|
1433
|
-
}>;
|
|
1431
|
+
getIssueCounts(mineOnly?: boolean): Promise<IssueCounts>;
|
|
1434
1432
|
/**
|
|
1435
1433
|
* Get issues for the tester by category.
|
|
1436
1434
|
* Returns enriched data: done issues include verification proof,
|
package/dist/index.d.ts
CHANGED
|
@@ -828,11 +828,13 @@ interface QATask {
|
|
|
828
828
|
updatedAt: string;
|
|
829
829
|
}
|
|
830
830
|
/** Category for filtering tester issues in the widget */
|
|
831
|
-
type IssueCategory = 'open' | 'done' | 'reopened';
|
|
831
|
+
type IssueCategory = 'open' | 'retest' | 'done' | 'wont_fix' | 'reopened';
|
|
832
832
|
/** Issue counts for each category (HomeScreen cards) */
|
|
833
833
|
interface IssueCounts {
|
|
834
834
|
open: number;
|
|
835
|
+
retest: number;
|
|
835
836
|
done: number;
|
|
837
|
+
wont_fix: number;
|
|
836
838
|
reopened: number;
|
|
837
839
|
}
|
|
838
840
|
/** A report as seen by the tester in the widget */
|
|
@@ -1426,11 +1428,7 @@ declare class BugBearClient {
|
|
|
1426
1428
|
* Used by the widget HomeScreen cards
|
|
1427
1429
|
* @param mineOnly - If true (default), only counts the tester's own reports. If false, counts all project reports.
|
|
1428
1430
|
*/
|
|
1429
|
-
getIssueCounts(mineOnly?: boolean): Promise<
|
|
1430
|
-
open: number;
|
|
1431
|
-
done: number;
|
|
1432
|
-
reopened: number;
|
|
1433
|
-
}>;
|
|
1431
|
+
getIssueCounts(mineOnly?: boolean): Promise<IssueCounts>;
|
|
1434
1432
|
/**
|
|
1435
1433
|
* Get issues for the tester by category.
|
|
1436
1434
|
* Returns enriched data: done issues include verification proof,
|
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,8 +1468,8 @@ 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
|
|
1471
|
+
reporter_name: testerInfo?.name || userInfo.name || null,
|
|
1472
|
+
reporter_email: testerInfo?.email || userInfo.email || null
|
|
1467
1473
|
}).select("id").single();
|
|
1468
1474
|
if (error) {
|
|
1469
1475
|
console.error("BugBear: Failed to submit widget feedback", formatPgError(error));
|
|
@@ -2193,9 +2199,10 @@ var BugBearClient = class {
|
|
|
2193
2199
|
* @param mineOnly - If true (default), only counts the tester's own reports. If false, counts all project reports.
|
|
2194
2200
|
*/
|
|
2195
2201
|
async getIssueCounts(mineOnly = true) {
|
|
2202
|
+
const empty = { open: 0, retest: 0, done: 0, wont_fix: 0, reopened: 0 };
|
|
2196
2203
|
try {
|
|
2197
2204
|
const testerInfo = await this.getTesterInfo();
|
|
2198
|
-
if (!testerInfo) return
|
|
2205
|
+
if (!testerInfo) return empty;
|
|
2199
2206
|
const { data, error } = await this.supabase.rpc("get_tester_issue_counts", {
|
|
2200
2207
|
p_project_id: this.config.projectId,
|
|
2201
2208
|
p_tester_id: testerInfo.id,
|
|
@@ -2203,16 +2210,18 @@ var BugBearClient = class {
|
|
|
2203
2210
|
});
|
|
2204
2211
|
if (error) {
|
|
2205
2212
|
console.error("BugBear: Failed to fetch issue counts", formatPgError(error));
|
|
2206
|
-
return
|
|
2213
|
+
return empty;
|
|
2207
2214
|
}
|
|
2208
2215
|
return {
|
|
2209
2216
|
open: data?.open ?? 0,
|
|
2217
|
+
retest: data?.retest ?? 0,
|
|
2210
2218
|
done: data?.done ?? 0,
|
|
2219
|
+
wont_fix: data?.wont_fix ?? 0,
|
|
2211
2220
|
reopened: data?.reopened ?? 0
|
|
2212
2221
|
};
|
|
2213
2222
|
} catch (err) {
|
|
2214
2223
|
console.error("BugBear: Error fetching issue counts", err);
|
|
2215
|
-
return
|
|
2224
|
+
return empty;
|
|
2216
2225
|
}
|
|
2217
2226
|
}
|
|
2218
2227
|
/**
|
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,8 +1422,8 @@ 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
|
|
1425
|
+
reporter_name: testerInfo?.name || userInfo.name || null,
|
|
1426
|
+
reporter_email: testerInfo?.email || userInfo.email || null
|
|
1421
1427
|
}).select("id").single();
|
|
1422
1428
|
if (error) {
|
|
1423
1429
|
console.error("BugBear: Failed to submit widget feedback", formatPgError(error));
|
|
@@ -2147,9 +2153,10 @@ var BugBearClient = class {
|
|
|
2147
2153
|
* @param mineOnly - If true (default), only counts the tester's own reports. If false, counts all project reports.
|
|
2148
2154
|
*/
|
|
2149
2155
|
async getIssueCounts(mineOnly = true) {
|
|
2156
|
+
const empty = { open: 0, retest: 0, done: 0, wont_fix: 0, reopened: 0 };
|
|
2150
2157
|
try {
|
|
2151
2158
|
const testerInfo = await this.getTesterInfo();
|
|
2152
|
-
if (!testerInfo) return
|
|
2159
|
+
if (!testerInfo) return empty;
|
|
2153
2160
|
const { data, error } = await this.supabase.rpc("get_tester_issue_counts", {
|
|
2154
2161
|
p_project_id: this.config.projectId,
|
|
2155
2162
|
p_tester_id: testerInfo.id,
|
|
@@ -2157,16 +2164,18 @@ var BugBearClient = class {
|
|
|
2157
2164
|
});
|
|
2158
2165
|
if (error) {
|
|
2159
2166
|
console.error("BugBear: Failed to fetch issue counts", formatPgError(error));
|
|
2160
|
-
return
|
|
2167
|
+
return empty;
|
|
2161
2168
|
}
|
|
2162
2169
|
return {
|
|
2163
2170
|
open: data?.open ?? 0,
|
|
2171
|
+
retest: data?.retest ?? 0,
|
|
2164
2172
|
done: data?.done ?? 0,
|
|
2173
|
+
wont_fix: data?.wont_fix ?? 0,
|
|
2165
2174
|
reopened: data?.reopened ?? 0
|
|
2166
2175
|
};
|
|
2167
2176
|
} catch (err) {
|
|
2168
2177
|
console.error("BugBear: Error fetching issue counts", err);
|
|
2169
|
-
return
|
|
2178
|
+
return empty;
|
|
2170
2179
|
}
|
|
2171
2180
|
}
|
|
2172
2181
|
/**
|