@bbearai/core 0.9.7 → 0.9.8
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 +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +37 -0
- package/dist/index.mjs +37 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1304,6 +1304,16 @@ declare class BugBearClient {
|
|
|
1304
1304
|
success: boolean;
|
|
1305
1305
|
error?: string;
|
|
1306
1306
|
}>;
|
|
1307
|
+
/**
|
|
1308
|
+
* Get a pre-authenticated dashboard URL for the given tester email.
|
|
1309
|
+
* Uses a server-generated magic link that bypasses the login page.
|
|
1310
|
+
* Falls back to raw dashboardUrl when no API key is configured.
|
|
1311
|
+
*/
|
|
1312
|
+
getDashboardLoginUrl(email: string): Promise<{
|
|
1313
|
+
success: boolean;
|
|
1314
|
+
loginUrl?: string;
|
|
1315
|
+
error?: string;
|
|
1316
|
+
}>;
|
|
1307
1317
|
/**
|
|
1308
1318
|
* Capture an email for QA testing.
|
|
1309
1319
|
* Called by the email interceptor — not typically called directly.
|
package/dist/index.d.ts
CHANGED
|
@@ -1304,6 +1304,16 @@ declare class BugBearClient {
|
|
|
1304
1304
|
success: boolean;
|
|
1305
1305
|
error?: string;
|
|
1306
1306
|
}>;
|
|
1307
|
+
/**
|
|
1308
|
+
* Get a pre-authenticated dashboard URL for the given tester email.
|
|
1309
|
+
* Uses a server-generated magic link that bypasses the login page.
|
|
1310
|
+
* Falls back to raw dashboardUrl when no API key is configured.
|
|
1311
|
+
*/
|
|
1312
|
+
getDashboardLoginUrl(email: string): Promise<{
|
|
1313
|
+
success: boolean;
|
|
1314
|
+
loginUrl?: string;
|
|
1315
|
+
error?: string;
|
|
1316
|
+
}>;
|
|
1307
1317
|
/**
|
|
1308
1318
|
* Capture an email for QA testing.
|
|
1309
1319
|
* Called by the email interceptor — not typically called directly.
|
package/dist/index.js
CHANGED
|
@@ -1454,6 +1454,43 @@ var BugBearClient = class {
|
|
|
1454
1454
|
return { success: false, error: message };
|
|
1455
1455
|
}
|
|
1456
1456
|
}
|
|
1457
|
+
/**
|
|
1458
|
+
* Get a pre-authenticated dashboard URL for the given tester email.
|
|
1459
|
+
* Uses a server-generated magic link that bypasses the login page.
|
|
1460
|
+
* Falls back to raw dashboardUrl when no API key is configured.
|
|
1461
|
+
*/
|
|
1462
|
+
async getDashboardLoginUrl(email) {
|
|
1463
|
+
try {
|
|
1464
|
+
if (!this.config.apiKey) {
|
|
1465
|
+
const fallback = this.config.dashboardUrl;
|
|
1466
|
+
if (fallback) return { success: true, loginUrl: fallback };
|
|
1467
|
+
return { success: false, error: "API key required for auto-login" };
|
|
1468
|
+
}
|
|
1469
|
+
await this.ready();
|
|
1470
|
+
const baseUrl = (this.config.apiBaseUrl || DEFAULT_API_BASE_URL).replace(/\/$/, "");
|
|
1471
|
+
const response = await fetch(`${baseUrl}/api/v1/auth/widget-login`, {
|
|
1472
|
+
method: "POST",
|
|
1473
|
+
headers: {
|
|
1474
|
+
"Content-Type": "application/json",
|
|
1475
|
+
"Authorization": `Bearer ${this.config.apiKey}`
|
|
1476
|
+
},
|
|
1477
|
+
body: JSON.stringify({ email })
|
|
1478
|
+
});
|
|
1479
|
+
if (!response.ok) {
|
|
1480
|
+
const body = await response.json().catch(() => ({}));
|
|
1481
|
+
return { success: false, error: body.error || `HTTP ${response.status}` };
|
|
1482
|
+
}
|
|
1483
|
+
const result = await response.json();
|
|
1484
|
+
const loginUrl = result?.data?.loginUrl;
|
|
1485
|
+
if (!loginUrl) {
|
|
1486
|
+
return { success: false, error: "No login URL in response" };
|
|
1487
|
+
}
|
|
1488
|
+
return { success: true, loginUrl };
|
|
1489
|
+
} catch (err) {
|
|
1490
|
+
const message = err instanceof Error ? err.message : "Failed to get dashboard login URL";
|
|
1491
|
+
return { success: false, error: message };
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1457
1494
|
/**
|
|
1458
1495
|
* Capture an email for QA testing.
|
|
1459
1496
|
* Called by the email interceptor — not typically called directly.
|
package/dist/index.mjs
CHANGED
|
@@ -1408,6 +1408,43 @@ var BugBearClient = class {
|
|
|
1408
1408
|
return { success: false, error: message };
|
|
1409
1409
|
}
|
|
1410
1410
|
}
|
|
1411
|
+
/**
|
|
1412
|
+
* Get a pre-authenticated dashboard URL for the given tester email.
|
|
1413
|
+
* Uses a server-generated magic link that bypasses the login page.
|
|
1414
|
+
* Falls back to raw dashboardUrl when no API key is configured.
|
|
1415
|
+
*/
|
|
1416
|
+
async getDashboardLoginUrl(email) {
|
|
1417
|
+
try {
|
|
1418
|
+
if (!this.config.apiKey) {
|
|
1419
|
+
const fallback = this.config.dashboardUrl;
|
|
1420
|
+
if (fallback) return { success: true, loginUrl: fallback };
|
|
1421
|
+
return { success: false, error: "API key required for auto-login" };
|
|
1422
|
+
}
|
|
1423
|
+
await this.ready();
|
|
1424
|
+
const baseUrl = (this.config.apiBaseUrl || DEFAULT_API_BASE_URL).replace(/\/$/, "");
|
|
1425
|
+
const response = await fetch(`${baseUrl}/api/v1/auth/widget-login`, {
|
|
1426
|
+
method: "POST",
|
|
1427
|
+
headers: {
|
|
1428
|
+
"Content-Type": "application/json",
|
|
1429
|
+
"Authorization": `Bearer ${this.config.apiKey}`
|
|
1430
|
+
},
|
|
1431
|
+
body: JSON.stringify({ email })
|
|
1432
|
+
});
|
|
1433
|
+
if (!response.ok) {
|
|
1434
|
+
const body = await response.json().catch(() => ({}));
|
|
1435
|
+
return { success: false, error: body.error || `HTTP ${response.status}` };
|
|
1436
|
+
}
|
|
1437
|
+
const result = await response.json();
|
|
1438
|
+
const loginUrl = result?.data?.loginUrl;
|
|
1439
|
+
if (!loginUrl) {
|
|
1440
|
+
return { success: false, error: "No login URL in response" };
|
|
1441
|
+
}
|
|
1442
|
+
return { success: true, loginUrl };
|
|
1443
|
+
} catch (err) {
|
|
1444
|
+
const message = err instanceof Error ? err.message : "Failed to get dashboard login URL";
|
|
1445
|
+
return { success: false, error: message };
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1411
1448
|
/**
|
|
1412
1449
|
* Capture an email for QA testing.
|
|
1413
1450
|
* Called by the email interceptor — not typically called directly.
|