@bbearai/core 0.9.6 → 0.9.7

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 CHANGED
@@ -413,6 +413,16 @@ interface TestAssignment {
413
413
  isVerification?: boolean;
414
414
  /** Original report ID if this is a verification assignment */
415
415
  originalReportId?: string;
416
+ /** Original bug report data (populated for verification assignments) */
417
+ originalReport?: {
418
+ id: string;
419
+ title: string;
420
+ description: string;
421
+ severity: Severity | null;
422
+ screenshotUrls: string[];
423
+ resolutionNotes?: string;
424
+ route?: string;
425
+ };
416
426
  }
417
427
  interface TestStep {
418
428
  stepNumber: number;
@@ -1280,6 +1290,20 @@ declare class BugBearClient {
1280
1290
  queued?: boolean;
1281
1291
  error?: string;
1282
1292
  }>;
1293
+ /**
1294
+ * Submit feedback about the BugBear widget itself.
1295
+ * Sends to BugBear's own internal project via a dedicated API endpoint.
1296
+ */
1297
+ submitWidgetFeedback(feedback: {
1298
+ description: string;
1299
+ type: 'bug' | 'feedback' | 'suggestion';
1300
+ severity?: Severity;
1301
+ title?: string;
1302
+ screenshots?: string[];
1303
+ }): Promise<{
1304
+ success: boolean;
1305
+ error?: string;
1306
+ }>;
1283
1307
  /**
1284
1308
  * Capture an email for QA testing.
1285
1309
  * Called by the email interceptor — not typically called directly.
package/dist/index.d.ts CHANGED
@@ -413,6 +413,16 @@ interface TestAssignment {
413
413
  isVerification?: boolean;
414
414
  /** Original report ID if this is a verification assignment */
415
415
  originalReportId?: string;
416
+ /** Original bug report data (populated for verification assignments) */
417
+ originalReport?: {
418
+ id: string;
419
+ title: string;
420
+ description: string;
421
+ severity: Severity | null;
422
+ screenshotUrls: string[];
423
+ resolutionNotes?: string;
424
+ route?: string;
425
+ };
416
426
  }
417
427
  interface TestStep {
418
428
  stepNumber: number;
@@ -1280,6 +1290,20 @@ declare class BugBearClient {
1280
1290
  queued?: boolean;
1281
1291
  error?: string;
1282
1292
  }>;
1293
+ /**
1294
+ * Submit feedback about the BugBear widget itself.
1295
+ * Sends to BugBear's own internal project via a dedicated API endpoint.
1296
+ */
1297
+ submitWidgetFeedback(feedback: {
1298
+ description: string;
1299
+ type: 'bug' | 'feedback' | 'suggestion';
1300
+ severity?: Severity;
1301
+ title?: string;
1302
+ screenshots?: string[];
1303
+ }): Promise<{
1304
+ success: boolean;
1305
+ error?: string;
1306
+ }>;
1283
1307
  /**
1284
1308
  * Capture an email for QA testing.
1285
1309
  * Called by the email interceptor — not typically called directly.
package/dist/index.js CHANGED
@@ -1417,6 +1417,43 @@ var BugBearClient = class {
1417
1417
  this.reportSubmitInFlight = false;
1418
1418
  }
1419
1419
  }
1420
+ /**
1421
+ * Submit feedback about the BugBear widget itself.
1422
+ * Sends to BugBear's own internal project via a dedicated API endpoint.
1423
+ */
1424
+ async submitWidgetFeedback(feedback) {
1425
+ try {
1426
+ await this.ready();
1427
+ const baseUrl = (this.config.apiBaseUrl || DEFAULT_API_BASE_URL).replace(/\/$/, "");
1428
+ const testerInfo = await this.getTesterInfo();
1429
+ const response = await fetch(`${baseUrl}/api/v1/widget-feedback`, {
1430
+ method: "POST",
1431
+ headers: {
1432
+ "Content-Type": "application/json",
1433
+ ...this.config.apiKey ? { "Authorization": `Bearer ${this.config.apiKey}` } : {}
1434
+ },
1435
+ body: JSON.stringify({
1436
+ description: feedback.description,
1437
+ type: feedback.type,
1438
+ severity: feedback.severity,
1439
+ title: feedback.title,
1440
+ screenshots: feedback.screenshots,
1441
+ deviceInfo: this.getDeviceInfo(),
1442
+ appContext: this.getAppContext(),
1443
+ reporterName: testerInfo?.name || null,
1444
+ reporterEmail: testerInfo?.email || null
1445
+ })
1446
+ });
1447
+ if (!response.ok) {
1448
+ const body = await response.json().catch(() => ({}));
1449
+ return { success: false, error: body.error || `HTTP ${response.status}` };
1450
+ }
1451
+ return { success: true };
1452
+ } catch (err) {
1453
+ const message = err instanceof Error ? err.message : "Widget feedback submission failed";
1454
+ return { success: false, error: message };
1455
+ }
1456
+ }
1420
1457
  /**
1421
1458
  * Capture an email for QA testing.
1422
1459
  * Called by the email interceptor — not typically called directly.
@@ -1475,6 +1512,15 @@ var BugBearClient = class {
1475
1512
  is_verification,
1476
1513
  original_report_id,
1477
1514
  notes,
1515
+ original_report:reports(
1516
+ id,
1517
+ title,
1518
+ description,
1519
+ severity,
1520
+ screenshot_urls,
1521
+ resolution_notes,
1522
+ app_context
1523
+ ),
1478
1524
  test_case:test_cases(
1479
1525
  id,
1480
1526
  title,
@@ -1524,6 +1570,16 @@ var BugBearClient = class {
1524
1570
  ];
1525
1571
  const mapItem = (item) => {
1526
1572
  const tc = item.test_case;
1573
+ const rpt = item.original_report;
1574
+ const originalReport = rpt ? {
1575
+ id: rpt.id,
1576
+ title: rpt.title,
1577
+ description: rpt.description,
1578
+ severity: rpt.severity,
1579
+ screenshotUrls: rpt.screenshot_urls || [],
1580
+ resolutionNotes: rpt.resolution_notes || void 0,
1581
+ route: rpt.app_context?.currentRoute || void 0
1582
+ } : void 0;
1527
1583
  return {
1528
1584
  id: item.id,
1529
1585
  status: item.status,
@@ -1531,6 +1587,7 @@ var BugBearClient = class {
1531
1587
  skipReason: item.skip_reason,
1532
1588
  isVerification: item.is_verification || false,
1533
1589
  originalReportId: item.original_report_id,
1590
+ originalReport,
1534
1591
  testCase: tc ? {
1535
1592
  id: tc.id,
1536
1593
  title: tc.title,
@@ -1565,15 +1622,15 @@ var BugBearClient = class {
1565
1622
  } : void 0,
1566
1623
  platforms: tc.platforms || void 0
1567
1624
  } : {
1568
- // Standalone verification assignment (bug reported without a test case)
1625
+ // Standalone verification use original report data when available
1569
1626
  id: item.original_report_id || item.id,
1570
- title: item.notes?.replace(/^Verification:\s*/i, "") || "Bug Verification",
1627
+ title: rpt?.title || (item.notes?.replace(/^Verification:\s*/i, "") || "Bug Verification"),
1571
1628
  testKey: "VERIFY",
1572
- description: "Verify that the reported bug has been fixed",
1629
+ description: rpt?.description || "Verify that the reported bug has been fixed",
1573
1630
  steps: [],
1574
1631
  expectedResult: "The bug should no longer be reproducible",
1575
1632
  priority: "P1",
1576
- targetRoute: void 0,
1633
+ targetRoute: rpt?.app_context?.currentRoute || void 0,
1577
1634
  track: void 0,
1578
1635
  group: void 0,
1579
1636
  role: void 0,
@@ -1609,6 +1666,18 @@ var BugBearClient = class {
1609
1666
  started_at,
1610
1667
  completed_at,
1611
1668
  duration_seconds,
1669
+ is_verification,
1670
+ original_report_id,
1671
+ notes,
1672
+ original_report:reports(
1673
+ id,
1674
+ title,
1675
+ description,
1676
+ severity,
1677
+ screenshot_urls,
1678
+ resolution_notes,
1679
+ app_context
1680
+ ),
1612
1681
  test_case:test_cases(
1613
1682
  id,
1614
1683
  title,
@@ -1631,17 +1700,30 @@ var BugBearClient = class {
1631
1700
  `).eq("id", assignmentId).single();
1632
1701
  if (error || !data) return null;
1633
1702
  const testCase = data.test_case;
1634
- if (!testCase) {
1703
+ const rpt = data.original_report;
1704
+ const originalReport = rpt ? {
1705
+ id: rpt.id,
1706
+ title: rpt.title,
1707
+ description: rpt.description,
1708
+ severity: rpt.severity,
1709
+ screenshotUrls: rpt.screenshot_urls || [],
1710
+ resolutionNotes: rpt.resolution_notes || void 0,
1711
+ route: rpt.app_context?.currentRoute || void 0
1712
+ } : void 0;
1713
+ if (!testCase && !data.is_verification) {
1635
1714
  console.error("BugBear: Assignment returned without test_case");
1636
1715
  return null;
1637
1716
  }
1638
- const track = testCase.track;
1717
+ const track = testCase?.track;
1639
1718
  return {
1640
1719
  id: data.id,
1641
1720
  status: data.status,
1642
1721
  startedAt: data.started_at,
1643
1722
  durationSeconds: data.duration_seconds,
1644
- testCase: {
1723
+ isVerification: data.is_verification || false,
1724
+ originalReportId: data.original_report_id,
1725
+ originalReport,
1726
+ testCase: testCase ? {
1645
1727
  id: testCase.id,
1646
1728
  title: testCase.title,
1647
1729
  testKey: testCase.test_key,
@@ -1659,6 +1741,16 @@ var BugBearClient = class {
1659
1741
  rubricMode: track.rubric_mode || "pass_fail",
1660
1742
  description: track.description
1661
1743
  } : void 0
1744
+ } : {
1745
+ id: data.original_report_id || data.id,
1746
+ title: rpt?.title || (data.notes?.replace(/^Verification:\s*/i, "") || "Bug Verification"),
1747
+ testKey: "VERIFY",
1748
+ description: rpt?.description || "Verify that the reported bug has been fixed",
1749
+ steps: [],
1750
+ expectedResult: "The bug should no longer be reproducible",
1751
+ priority: "P1",
1752
+ targetRoute: rpt?.app_context?.currentRoute || void 0,
1753
+ track: void 0
1662
1754
  }
1663
1755
  };
1664
1756
  } catch (err) {
package/dist/index.mjs CHANGED
@@ -1371,6 +1371,43 @@ var BugBearClient = class {
1371
1371
  this.reportSubmitInFlight = false;
1372
1372
  }
1373
1373
  }
1374
+ /**
1375
+ * Submit feedback about the BugBear widget itself.
1376
+ * Sends to BugBear's own internal project via a dedicated API endpoint.
1377
+ */
1378
+ async submitWidgetFeedback(feedback) {
1379
+ try {
1380
+ await this.ready();
1381
+ const baseUrl = (this.config.apiBaseUrl || DEFAULT_API_BASE_URL).replace(/\/$/, "");
1382
+ const testerInfo = await this.getTesterInfo();
1383
+ const response = await fetch(`${baseUrl}/api/v1/widget-feedback`, {
1384
+ method: "POST",
1385
+ headers: {
1386
+ "Content-Type": "application/json",
1387
+ ...this.config.apiKey ? { "Authorization": `Bearer ${this.config.apiKey}` } : {}
1388
+ },
1389
+ body: JSON.stringify({
1390
+ description: feedback.description,
1391
+ type: feedback.type,
1392
+ severity: feedback.severity,
1393
+ title: feedback.title,
1394
+ screenshots: feedback.screenshots,
1395
+ deviceInfo: this.getDeviceInfo(),
1396
+ appContext: this.getAppContext(),
1397
+ reporterName: testerInfo?.name || null,
1398
+ reporterEmail: testerInfo?.email || null
1399
+ })
1400
+ });
1401
+ if (!response.ok) {
1402
+ const body = await response.json().catch(() => ({}));
1403
+ return { success: false, error: body.error || `HTTP ${response.status}` };
1404
+ }
1405
+ return { success: true };
1406
+ } catch (err) {
1407
+ const message = err instanceof Error ? err.message : "Widget feedback submission failed";
1408
+ return { success: false, error: message };
1409
+ }
1410
+ }
1374
1411
  /**
1375
1412
  * Capture an email for QA testing.
1376
1413
  * Called by the email interceptor — not typically called directly.
@@ -1429,6 +1466,15 @@ var BugBearClient = class {
1429
1466
  is_verification,
1430
1467
  original_report_id,
1431
1468
  notes,
1469
+ original_report:reports(
1470
+ id,
1471
+ title,
1472
+ description,
1473
+ severity,
1474
+ screenshot_urls,
1475
+ resolution_notes,
1476
+ app_context
1477
+ ),
1432
1478
  test_case:test_cases(
1433
1479
  id,
1434
1480
  title,
@@ -1478,6 +1524,16 @@ var BugBearClient = class {
1478
1524
  ];
1479
1525
  const mapItem = (item) => {
1480
1526
  const tc = item.test_case;
1527
+ const rpt = item.original_report;
1528
+ const originalReport = rpt ? {
1529
+ id: rpt.id,
1530
+ title: rpt.title,
1531
+ description: rpt.description,
1532
+ severity: rpt.severity,
1533
+ screenshotUrls: rpt.screenshot_urls || [],
1534
+ resolutionNotes: rpt.resolution_notes || void 0,
1535
+ route: rpt.app_context?.currentRoute || void 0
1536
+ } : void 0;
1481
1537
  return {
1482
1538
  id: item.id,
1483
1539
  status: item.status,
@@ -1485,6 +1541,7 @@ var BugBearClient = class {
1485
1541
  skipReason: item.skip_reason,
1486
1542
  isVerification: item.is_verification || false,
1487
1543
  originalReportId: item.original_report_id,
1544
+ originalReport,
1488
1545
  testCase: tc ? {
1489
1546
  id: tc.id,
1490
1547
  title: tc.title,
@@ -1519,15 +1576,15 @@ var BugBearClient = class {
1519
1576
  } : void 0,
1520
1577
  platforms: tc.platforms || void 0
1521
1578
  } : {
1522
- // Standalone verification assignment (bug reported without a test case)
1579
+ // Standalone verification use original report data when available
1523
1580
  id: item.original_report_id || item.id,
1524
- title: item.notes?.replace(/^Verification:\s*/i, "") || "Bug Verification",
1581
+ title: rpt?.title || (item.notes?.replace(/^Verification:\s*/i, "") || "Bug Verification"),
1525
1582
  testKey: "VERIFY",
1526
- description: "Verify that the reported bug has been fixed",
1583
+ description: rpt?.description || "Verify that the reported bug has been fixed",
1527
1584
  steps: [],
1528
1585
  expectedResult: "The bug should no longer be reproducible",
1529
1586
  priority: "P1",
1530
- targetRoute: void 0,
1587
+ targetRoute: rpt?.app_context?.currentRoute || void 0,
1531
1588
  track: void 0,
1532
1589
  group: void 0,
1533
1590
  role: void 0,
@@ -1563,6 +1620,18 @@ var BugBearClient = class {
1563
1620
  started_at,
1564
1621
  completed_at,
1565
1622
  duration_seconds,
1623
+ is_verification,
1624
+ original_report_id,
1625
+ notes,
1626
+ original_report:reports(
1627
+ id,
1628
+ title,
1629
+ description,
1630
+ severity,
1631
+ screenshot_urls,
1632
+ resolution_notes,
1633
+ app_context
1634
+ ),
1566
1635
  test_case:test_cases(
1567
1636
  id,
1568
1637
  title,
@@ -1585,17 +1654,30 @@ var BugBearClient = class {
1585
1654
  `).eq("id", assignmentId).single();
1586
1655
  if (error || !data) return null;
1587
1656
  const testCase = data.test_case;
1588
- if (!testCase) {
1657
+ const rpt = data.original_report;
1658
+ const originalReport = rpt ? {
1659
+ id: rpt.id,
1660
+ title: rpt.title,
1661
+ description: rpt.description,
1662
+ severity: rpt.severity,
1663
+ screenshotUrls: rpt.screenshot_urls || [],
1664
+ resolutionNotes: rpt.resolution_notes || void 0,
1665
+ route: rpt.app_context?.currentRoute || void 0
1666
+ } : void 0;
1667
+ if (!testCase && !data.is_verification) {
1589
1668
  console.error("BugBear: Assignment returned without test_case");
1590
1669
  return null;
1591
1670
  }
1592
- const track = testCase.track;
1671
+ const track = testCase?.track;
1593
1672
  return {
1594
1673
  id: data.id,
1595
1674
  status: data.status,
1596
1675
  startedAt: data.started_at,
1597
1676
  durationSeconds: data.duration_seconds,
1598
- testCase: {
1677
+ isVerification: data.is_verification || false,
1678
+ originalReportId: data.original_report_id,
1679
+ originalReport,
1680
+ testCase: testCase ? {
1599
1681
  id: testCase.id,
1600
1682
  title: testCase.title,
1601
1683
  testKey: testCase.test_key,
@@ -1613,6 +1695,16 @@ var BugBearClient = class {
1613
1695
  rubricMode: track.rubric_mode || "pass_fail",
1614
1696
  description: track.description
1615
1697
  } : void 0
1698
+ } : {
1699
+ id: data.original_report_id || data.id,
1700
+ title: rpt?.title || (data.notes?.replace(/^Verification:\s*/i, "") || "Bug Verification"),
1701
+ testKey: "VERIFY",
1702
+ description: rpt?.description || "Verify that the reported bug has been fixed",
1703
+ steps: [],
1704
+ expectedResult: "The bug should no longer be reproducible",
1705
+ priority: "P1",
1706
+ targetRoute: rpt?.app_context?.currentRoute || void 0,
1707
+ track: void 0
1616
1708
  }
1617
1709
  };
1618
1710
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbearai/core",
3
- "version": "0.9.6",
3
+ "version": "0.9.7",
4
4
  "description": "Core utilities and types for BugBear QA platform",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",