@bbearai/core 0.2.8 → 0.2.9

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
@@ -270,6 +270,8 @@ interface SubmitFeedbackOptions {
270
270
  feedback: TestFeedback;
271
271
  /** Time taken to complete in seconds */
272
272
  timeToCompleteSeconds?: number;
273
+ /** Screenshot URLs attached to the feedback */
274
+ screenshotUrls?: string[];
273
275
  }
274
276
  interface TesterInfo {
275
277
  id: string;
@@ -720,7 +722,7 @@ declare class BugBearClient {
720
722
  /**
721
723
  * Upload a screenshot (web - uses File/Blob)
722
724
  */
723
- uploadScreenshot(file: File | Blob, filename?: string): Promise<string | null>;
725
+ uploadScreenshot(file: File | Blob, filename?: string, bucket?: 'screenshots' | 'discussion-attachments'): Promise<string | null>;
724
726
  /**
725
727
  * Upload an image from a local file URI (React Native compatible).
726
728
  * Fetches the URI as a blob and uploads to Supabase Storage.
package/dist/index.d.ts CHANGED
@@ -270,6 +270,8 @@ interface SubmitFeedbackOptions {
270
270
  feedback: TestFeedback;
271
271
  /** Time taken to complete in seconds */
272
272
  timeToCompleteSeconds?: number;
273
+ /** Screenshot URLs attached to the feedback */
274
+ screenshotUrls?: string[];
273
275
  }
274
276
  interface TesterInfo {
275
277
  id: string;
@@ -720,7 +722,7 @@ declare class BugBearClient {
720
722
  /**
721
723
  * Upload a screenshot (web - uses File/Blob)
722
724
  */
723
- uploadScreenshot(file: File | Blob, filename?: string): Promise<string | null>;
725
+ uploadScreenshot(file: File | Blob, filename?: string, bucket?: 'screenshots' | 'discussion-attachments'): Promise<string | null>;
724
726
  /**
725
727
  * Upload an image from a local file URI (React Native compatible).
726
728
  * Fetches the URI as a blob and uploads to Supabase Storage.
package/dist/index.js CHANGED
@@ -296,6 +296,11 @@ var BugBearClient = class {
296
296
  try {
297
297
  const { data: currentAssignment, error: fetchError } = await this.supabase.from("test_assignments").select("status, started_at").eq("id", assignmentId).single();
298
298
  if (fetchError || !currentAssignment) {
299
+ console.error("BugBear: Assignment not found", {
300
+ message: fetchError?.message,
301
+ code: fetchError?.code,
302
+ assignmentId
303
+ });
299
304
  return { success: false, error: "Assignment not found" };
300
305
  }
301
306
  const updateData = { status };
@@ -320,7 +325,15 @@ var BugBearClient = class {
320
325
  }
321
326
  const { error } = await this.supabase.from("test_assignments").update(updateData).eq("id", assignmentId);
322
327
  if (error) {
323
- console.error("BugBear: Failed to update assignment status", error);
328
+ console.error("BugBear: Failed to update assignment status", {
329
+ message: error.message,
330
+ details: error.details,
331
+ hint: error.hint,
332
+ code: error.code,
333
+ assignmentId,
334
+ status,
335
+ updateData
336
+ });
324
337
  return { success: false, error: error.message };
325
338
  }
326
339
  if (options?.feedback && ["passed", "failed", "blocked"].includes(status)) {
@@ -382,7 +395,7 @@ var BugBearClient = class {
382
395
  if (!testerInfo) {
383
396
  return { success: false, error: "Not authenticated as tester" };
384
397
  }
385
- const { testCaseId, assignmentId, feedback, timeToCompleteSeconds } = options;
398
+ const { testCaseId, assignmentId, feedback, timeToCompleteSeconds, screenshotUrls } = options;
386
399
  if (feedback.rating < 1 || feedback.rating > 5) {
387
400
  return { success: false, error: "Rating must be between 1 and 5" };
388
401
  }
@@ -402,7 +415,8 @@ var BugBearClient = class {
402
415
  steps_unclear: feedback.stepsUnclear || false,
403
416
  expected_result_unclear: feedback.expectedResultUnclear || false,
404
417
  platform: this.getDeviceInfo().platform,
405
- time_to_complete_seconds: timeToCompleteSeconds || null
418
+ time_to_complete_seconds: timeToCompleteSeconds || null,
419
+ screenshot_urls: screenshotUrls || []
406
420
  });
407
421
  if (feedbackError) {
408
422
  console.error("BugBear: Failed to submit feedback", feedbackError);
@@ -717,19 +731,21 @@ var BugBearClient = class {
717
731
  /**
718
732
  * Upload a screenshot (web - uses File/Blob)
719
733
  */
720
- async uploadScreenshot(file, filename) {
734
+ async uploadScreenshot(file, filename, bucket = "screenshots") {
721
735
  try {
722
- const name = filename || `screenshot-${Date.now()}.png`;
736
+ const contentType = file.type || "image/png";
737
+ const ext = contentType.includes("png") ? "png" : "jpg";
738
+ const name = filename || `screenshot-${Date.now()}.${ext}`;
723
739
  const path = `${this.config.projectId}/${name}`;
724
- const { error } = await this.supabase.storage.from("screenshots").upload(path, file, {
725
- contentType: "image/png",
740
+ const { error } = await this.supabase.storage.from(bucket).upload(path, file, {
741
+ contentType,
726
742
  upsert: false
727
743
  });
728
744
  if (error) {
729
745
  console.error("BugBear: Failed to upload screenshot", error);
730
746
  return null;
731
747
  }
732
- const { data: { publicUrl } } = this.supabase.storage.from("screenshots").getPublicUrl(path);
748
+ const { data: { publicUrl } } = this.supabase.storage.from(bucket).getPublicUrl(path);
733
749
  return publicUrl;
734
750
  } catch (err) {
735
751
  console.error("BugBear: Error uploading screenshot", err);
package/dist/index.mjs CHANGED
@@ -267,6 +267,11 @@ var BugBearClient = class {
267
267
  try {
268
268
  const { data: currentAssignment, error: fetchError } = await this.supabase.from("test_assignments").select("status, started_at").eq("id", assignmentId).single();
269
269
  if (fetchError || !currentAssignment) {
270
+ console.error("BugBear: Assignment not found", {
271
+ message: fetchError?.message,
272
+ code: fetchError?.code,
273
+ assignmentId
274
+ });
270
275
  return { success: false, error: "Assignment not found" };
271
276
  }
272
277
  const updateData = { status };
@@ -291,7 +296,15 @@ var BugBearClient = class {
291
296
  }
292
297
  const { error } = await this.supabase.from("test_assignments").update(updateData).eq("id", assignmentId);
293
298
  if (error) {
294
- console.error("BugBear: Failed to update assignment status", error);
299
+ console.error("BugBear: Failed to update assignment status", {
300
+ message: error.message,
301
+ details: error.details,
302
+ hint: error.hint,
303
+ code: error.code,
304
+ assignmentId,
305
+ status,
306
+ updateData
307
+ });
295
308
  return { success: false, error: error.message };
296
309
  }
297
310
  if (options?.feedback && ["passed", "failed", "blocked"].includes(status)) {
@@ -353,7 +366,7 @@ var BugBearClient = class {
353
366
  if (!testerInfo) {
354
367
  return { success: false, error: "Not authenticated as tester" };
355
368
  }
356
- const { testCaseId, assignmentId, feedback, timeToCompleteSeconds } = options;
369
+ const { testCaseId, assignmentId, feedback, timeToCompleteSeconds, screenshotUrls } = options;
357
370
  if (feedback.rating < 1 || feedback.rating > 5) {
358
371
  return { success: false, error: "Rating must be between 1 and 5" };
359
372
  }
@@ -373,7 +386,8 @@ var BugBearClient = class {
373
386
  steps_unclear: feedback.stepsUnclear || false,
374
387
  expected_result_unclear: feedback.expectedResultUnclear || false,
375
388
  platform: this.getDeviceInfo().platform,
376
- time_to_complete_seconds: timeToCompleteSeconds || null
389
+ time_to_complete_seconds: timeToCompleteSeconds || null,
390
+ screenshot_urls: screenshotUrls || []
377
391
  });
378
392
  if (feedbackError) {
379
393
  console.error("BugBear: Failed to submit feedback", feedbackError);
@@ -688,19 +702,21 @@ var BugBearClient = class {
688
702
  /**
689
703
  * Upload a screenshot (web - uses File/Blob)
690
704
  */
691
- async uploadScreenshot(file, filename) {
705
+ async uploadScreenshot(file, filename, bucket = "screenshots") {
692
706
  try {
693
- const name = filename || `screenshot-${Date.now()}.png`;
707
+ const contentType = file.type || "image/png";
708
+ const ext = contentType.includes("png") ? "png" : "jpg";
709
+ const name = filename || `screenshot-${Date.now()}.${ext}`;
694
710
  const path = `${this.config.projectId}/${name}`;
695
- const { error } = await this.supabase.storage.from("screenshots").upload(path, file, {
696
- contentType: "image/png",
711
+ const { error } = await this.supabase.storage.from(bucket).upload(path, file, {
712
+ contentType,
697
713
  upsert: false
698
714
  });
699
715
  if (error) {
700
716
  console.error("BugBear: Failed to upload screenshot", error);
701
717
  return null;
702
718
  }
703
- const { data: { publicUrl } } = this.supabase.storage.from("screenshots").getPublicUrl(path);
719
+ const { data: { publicUrl } } = this.supabase.storage.from(bucket).getPublicUrl(path);
704
720
  return publicUrl;
705
721
  } catch (err) {
706
722
  console.error("BugBear: Error uploading screenshot", err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbearai/core",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "Core utilities and types for BugBear QA platform",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",