@bbearai/core 0.9.10 → 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 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
- reporterName: testerInfo?.name || null,
1446
- reporterEmail: testerInfo?.email || null
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));
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
- reporterName: testerInfo?.name || null,
1400
- reporterEmail: testerInfo?.email || null
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));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbearai/core",
3
- "version": "0.9.10",
3
+ "version": "0.9.11",
4
4
  "description": "Core utilities and types for BugBear QA platform",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",