@bbearai/react-native 0.5.5 → 0.5.6

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
@@ -11394,6 +11394,7 @@ function shouldShowDeprecationWarning() {
11394
11394
  if (shouldShowDeprecationWarning()) console.warn("\u26A0\uFE0F Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");
11395
11395
 
11396
11396
  // ../core/dist/index.mjs
11397
+ var BUG_CATEGORIES = ["ui_ux", "functional", "crash", "security", "other"];
11397
11398
  var MAX_CONSOLE_LOGS = 50;
11398
11399
  var MAX_NETWORK_REQUESTS = 20;
11399
11400
  var MAX_NAVIGATION_HISTORY = 20;
@@ -12336,6 +12337,9 @@ var BugBearClient = class {
12336
12337
  if (report.severity && !validSeverities.includes(report.severity)) {
12337
12338
  return `Invalid severity: ${report.severity}. Must be one of: ${validSeverities.join(", ")}`;
12338
12339
  }
12340
+ if (report.category && !BUG_CATEGORIES.includes(report.category)) {
12341
+ return `Invalid category: ${report.category}. Must be one of: ${BUG_CATEGORIES.join(", ")}`;
12342
+ }
12339
12343
  if (report.title && report.title.length > 500) {
12340
12344
  return "Title must be 500 characters or less";
12341
12345
  }
@@ -12408,6 +12412,10 @@ var BugBearClient = class {
12408
12412
  });
12409
12413
  if (error) {
12410
12414
  console.warn("BugBear: Rate limit check failed, allowing request", error.message);
12415
+ this.config.onError?.(new Error(`Rate limit check failed: ${error.message}`), {
12416
+ projectId: this.config.projectId,
12417
+ context: "rate_limit_check_failed_open"
12418
+ });
12411
12419
  return { allowed: true };
12412
12420
  }
12413
12421
  if (!data.allowed) {
@@ -12424,7 +12432,12 @@ var BugBearClient = class {
12424
12432
  resetAt: data.reset_at
12425
12433
  };
12426
12434
  } catch (err) {
12435
+ const message = err instanceof Error ? err.message : "Unknown rate limit error";
12427
12436
  console.warn("BugBear: Rate limit check error", err);
12437
+ this.config.onError?.(err instanceof Error ? err : new Error(message), {
12438
+ projectId: this.config.projectId,
12439
+ context: "rate_limit_check_failed_open"
12440
+ });
12428
12441
  return { allowed: true };
12429
12442
  }
12430
12443
  }
@@ -12488,6 +12501,9 @@ var BugBearClient = class {
12488
12501
  }
12489
12502
  return data ?? true;
12490
12503
  } catch (err) {
12504
+ const message = err instanceof Error ? err.message : "Unknown error checking QA status";
12505
+ console.error("BugBear: Error checking QA status", err);
12506
+ this.config.onError?.(err instanceof Error ? err : new Error(message), { projectId: this.config.projectId });
12491
12507
  return true;
12492
12508
  }
12493
12509
  }
@@ -12516,13 +12532,24 @@ var BugBearClient = class {
12516
12532
  upsert: false
12517
12533
  });
12518
12534
  if (error) {
12519
- console.error("BugBear: Failed to upload screenshot", formatPgError(error));
12535
+ const formattedError = formatPgError(error);
12536
+ const errorMessage = formattedError.message || "Failed to upload screenshot";
12537
+ console.error("BugBear: Failed to upload screenshot", formattedError);
12538
+ this.config.onError?.(new Error(errorMessage), {
12539
+ projectId: this.config.projectId,
12540
+ context: "screenshot_upload_failed"
12541
+ });
12520
12542
  return null;
12521
12543
  }
12522
12544
  const { data: { publicUrl } } = this.supabase.storage.from(bucket).getPublicUrl(path);
12523
12545
  return publicUrl;
12524
12546
  } catch (err) {
12547
+ const message = err instanceof Error ? err.message : "Unknown error uploading screenshot";
12525
12548
  console.error("BugBear: Error uploading screenshot", err);
12549
+ this.config.onError?.(err instanceof Error ? err : new Error(message), {
12550
+ projectId: this.config.projectId,
12551
+ context: "screenshot_upload_failed"
12552
+ });
12526
12553
  return null;
12527
12554
  }
12528
12555
  }
@@ -12547,13 +12574,24 @@ var BugBearClient = class {
12547
12574
  upsert: false
12548
12575
  });
12549
12576
  if (error) {
12550
- console.error("BugBear: Failed to upload image from URI", formatPgError(error));
12577
+ const formattedError = formatPgError(error);
12578
+ const errorMessage = formattedError.message || "Failed to upload image";
12579
+ console.error("BugBear: Failed to upload image from URI", formattedError);
12580
+ this.config.onError?.(new Error(errorMessage), {
12581
+ projectId: this.config.projectId,
12582
+ context: "image_upload_failed"
12583
+ });
12551
12584
  return null;
12552
12585
  }
12553
12586
  const { data: { publicUrl } } = this.supabase.storage.from(bucket).getPublicUrl(path);
12554
12587
  return publicUrl;
12555
12588
  } catch (err) {
12589
+ const message = err instanceof Error ? err.message : "Unknown error uploading image";
12556
12590
  console.error("BugBear: Error uploading image from URI", err);
12591
+ this.config.onError?.(err instanceof Error ? err : new Error(message), {
12592
+ projectId: this.config.projectId,
12593
+ context: "image_upload_failed"
12594
+ });
12557
12595
  return null;
12558
12596
  }
12559
12597
  }
@@ -14398,7 +14436,12 @@ function useImageAttachments(uploadFn, maxImages, bucket = "screenshots") {
14398
14436
  launchImageLibrary(
14399
14437
  { mediaType: "photo", quality: 0.7, maxWidth: 1920, maxHeight: 1920, selectionLimit: maxImages - images.length },
14400
14438
  async (response) => {
14401
- if (response.didCancel || response.errorCode || !response.assets) return;
14439
+ if (response.didCancel) return;
14440
+ if (response.errorCode) {
14441
+ console.error("BugBear: Image picker error", response.errorCode, response.errorMessage);
14442
+ return;
14443
+ }
14444
+ if (!response.assets) return;
14402
14445
  for (const asset of response.assets) {
14403
14446
  const uri = asset.uri;
14404
14447
  if (!uri) continue;
@@ -14412,6 +14455,11 @@ function useImageAttachments(uploadFn, maxImages, bucket = "screenshots") {
14412
14455
  setImages((prev) => prev.map(
14413
14456
  (img) => img.id === id ? { ...img, remoteUrl: url, status: url ? "done" : "error" } : img
14414
14457
  ));
14458
+ }).catch((err) => {
14459
+ console.error("BugBear: Image upload failed", err);
14460
+ setImages((prev) => prev.map(
14461
+ (img) => img.id === id ? { ...img, status: "error" } : img
14462
+ ));
14415
14463
  });
14416
14464
  }
14417
14465
  }
@@ -14422,7 +14470,12 @@ function useImageAttachments(uploadFn, maxImages, bucket = "screenshots") {
14422
14470
  launchCamera(
14423
14471
  { mediaType: "photo", quality: 0.7, maxWidth: 1920, maxHeight: 1920 },
14424
14472
  async (response) => {
14425
- if (response.didCancel || response.errorCode || !response.assets?.[0]) return;
14473
+ if (response.didCancel) return;
14474
+ if (response.errorCode) {
14475
+ console.error("BugBear: Camera error", response.errorCode, response.errorMessage);
14476
+ return;
14477
+ }
14478
+ if (!response.assets?.[0]) return;
14426
14479
  const asset = response.assets[0];
14427
14480
  const uri = asset.uri;
14428
14481
  if (!uri) return;
@@ -14436,6 +14489,11 @@ function useImageAttachments(uploadFn, maxImages, bucket = "screenshots") {
14436
14489
  setImages((prev) => prev.map(
14437
14490
  (img) => img.id === id ? { ...img, remoteUrl: url, status: url ? "done" : "error" } : img
14438
14491
  ));
14492
+ }).catch((err) => {
14493
+ console.error("BugBear: Image upload failed", err);
14494
+ setImages((prev) => prev.map(
14495
+ (img) => img.id === id ? { ...img, status: "error" } : img
14496
+ ));
14439
14497
  });
14440
14498
  }
14441
14499
  );
@@ -15139,7 +15197,7 @@ function ThreadDetailScreen({ thread, nav }) {
15139
15197
  })();
15140
15198
  }, [thread.id]);
15141
15199
  const handleSend = async () => {
15142
- if (!replyText.trim()) return;
15200
+ if (!replyText.trim() && replyImages.images.length === 0 || sending || replyImages.isUploading) return;
15143
15201
  setSending(true);
15144
15202
  setSendError(false);
15145
15203
  const attachments = replyImages.getAttachments();
package/dist/index.mjs CHANGED
@@ -11361,6 +11361,7 @@ function shouldShowDeprecationWarning() {
11361
11361
  if (shouldShowDeprecationWarning()) console.warn("\u26A0\uFE0F Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");
11362
11362
 
11363
11363
  // ../core/dist/index.mjs
11364
+ var BUG_CATEGORIES = ["ui_ux", "functional", "crash", "security", "other"];
11364
11365
  var MAX_CONSOLE_LOGS = 50;
11365
11366
  var MAX_NETWORK_REQUESTS = 20;
11366
11367
  var MAX_NAVIGATION_HISTORY = 20;
@@ -12303,6 +12304,9 @@ var BugBearClient = class {
12303
12304
  if (report.severity && !validSeverities.includes(report.severity)) {
12304
12305
  return `Invalid severity: ${report.severity}. Must be one of: ${validSeverities.join(", ")}`;
12305
12306
  }
12307
+ if (report.category && !BUG_CATEGORIES.includes(report.category)) {
12308
+ return `Invalid category: ${report.category}. Must be one of: ${BUG_CATEGORIES.join(", ")}`;
12309
+ }
12306
12310
  if (report.title && report.title.length > 500) {
12307
12311
  return "Title must be 500 characters or less";
12308
12312
  }
@@ -12375,6 +12379,10 @@ var BugBearClient = class {
12375
12379
  });
12376
12380
  if (error) {
12377
12381
  console.warn("BugBear: Rate limit check failed, allowing request", error.message);
12382
+ this.config.onError?.(new Error(`Rate limit check failed: ${error.message}`), {
12383
+ projectId: this.config.projectId,
12384
+ context: "rate_limit_check_failed_open"
12385
+ });
12378
12386
  return { allowed: true };
12379
12387
  }
12380
12388
  if (!data.allowed) {
@@ -12391,7 +12399,12 @@ var BugBearClient = class {
12391
12399
  resetAt: data.reset_at
12392
12400
  };
12393
12401
  } catch (err) {
12402
+ const message = err instanceof Error ? err.message : "Unknown rate limit error";
12394
12403
  console.warn("BugBear: Rate limit check error", err);
12404
+ this.config.onError?.(err instanceof Error ? err : new Error(message), {
12405
+ projectId: this.config.projectId,
12406
+ context: "rate_limit_check_failed_open"
12407
+ });
12395
12408
  return { allowed: true };
12396
12409
  }
12397
12410
  }
@@ -12455,6 +12468,9 @@ var BugBearClient = class {
12455
12468
  }
12456
12469
  return data ?? true;
12457
12470
  } catch (err) {
12471
+ const message = err instanceof Error ? err.message : "Unknown error checking QA status";
12472
+ console.error("BugBear: Error checking QA status", err);
12473
+ this.config.onError?.(err instanceof Error ? err : new Error(message), { projectId: this.config.projectId });
12458
12474
  return true;
12459
12475
  }
12460
12476
  }
@@ -12483,13 +12499,24 @@ var BugBearClient = class {
12483
12499
  upsert: false
12484
12500
  });
12485
12501
  if (error) {
12486
- console.error("BugBear: Failed to upload screenshot", formatPgError(error));
12502
+ const formattedError = formatPgError(error);
12503
+ const errorMessage = formattedError.message || "Failed to upload screenshot";
12504
+ console.error("BugBear: Failed to upload screenshot", formattedError);
12505
+ this.config.onError?.(new Error(errorMessage), {
12506
+ projectId: this.config.projectId,
12507
+ context: "screenshot_upload_failed"
12508
+ });
12487
12509
  return null;
12488
12510
  }
12489
12511
  const { data: { publicUrl } } = this.supabase.storage.from(bucket).getPublicUrl(path);
12490
12512
  return publicUrl;
12491
12513
  } catch (err) {
12514
+ const message = err instanceof Error ? err.message : "Unknown error uploading screenshot";
12492
12515
  console.error("BugBear: Error uploading screenshot", err);
12516
+ this.config.onError?.(err instanceof Error ? err : new Error(message), {
12517
+ projectId: this.config.projectId,
12518
+ context: "screenshot_upload_failed"
12519
+ });
12493
12520
  return null;
12494
12521
  }
12495
12522
  }
@@ -12514,13 +12541,24 @@ var BugBearClient = class {
12514
12541
  upsert: false
12515
12542
  });
12516
12543
  if (error) {
12517
- console.error("BugBear: Failed to upload image from URI", formatPgError(error));
12544
+ const formattedError = formatPgError(error);
12545
+ const errorMessage = formattedError.message || "Failed to upload image";
12546
+ console.error("BugBear: Failed to upload image from URI", formattedError);
12547
+ this.config.onError?.(new Error(errorMessage), {
12548
+ projectId: this.config.projectId,
12549
+ context: "image_upload_failed"
12550
+ });
12518
12551
  return null;
12519
12552
  }
12520
12553
  const { data: { publicUrl } } = this.supabase.storage.from(bucket).getPublicUrl(path);
12521
12554
  return publicUrl;
12522
12555
  } catch (err) {
12556
+ const message = err instanceof Error ? err.message : "Unknown error uploading image";
12523
12557
  console.error("BugBear: Error uploading image from URI", err);
12558
+ this.config.onError?.(err instanceof Error ? err : new Error(message), {
12559
+ projectId: this.config.projectId,
12560
+ context: "image_upload_failed"
12561
+ });
12524
12562
  return null;
12525
12563
  }
12526
12564
  }
@@ -14380,7 +14418,12 @@ function useImageAttachments(uploadFn, maxImages, bucket = "screenshots") {
14380
14418
  launchImageLibrary(
14381
14419
  { mediaType: "photo", quality: 0.7, maxWidth: 1920, maxHeight: 1920, selectionLimit: maxImages - images.length },
14382
14420
  async (response) => {
14383
- if (response.didCancel || response.errorCode || !response.assets) return;
14421
+ if (response.didCancel) return;
14422
+ if (response.errorCode) {
14423
+ console.error("BugBear: Image picker error", response.errorCode, response.errorMessage);
14424
+ return;
14425
+ }
14426
+ if (!response.assets) return;
14384
14427
  for (const asset of response.assets) {
14385
14428
  const uri = asset.uri;
14386
14429
  if (!uri) continue;
@@ -14394,6 +14437,11 @@ function useImageAttachments(uploadFn, maxImages, bucket = "screenshots") {
14394
14437
  setImages((prev) => prev.map(
14395
14438
  (img) => img.id === id ? { ...img, remoteUrl: url, status: url ? "done" : "error" } : img
14396
14439
  ));
14440
+ }).catch((err) => {
14441
+ console.error("BugBear: Image upload failed", err);
14442
+ setImages((prev) => prev.map(
14443
+ (img) => img.id === id ? { ...img, status: "error" } : img
14444
+ ));
14397
14445
  });
14398
14446
  }
14399
14447
  }
@@ -14404,7 +14452,12 @@ function useImageAttachments(uploadFn, maxImages, bucket = "screenshots") {
14404
14452
  launchCamera(
14405
14453
  { mediaType: "photo", quality: 0.7, maxWidth: 1920, maxHeight: 1920 },
14406
14454
  async (response) => {
14407
- if (response.didCancel || response.errorCode || !response.assets?.[0]) return;
14455
+ if (response.didCancel) return;
14456
+ if (response.errorCode) {
14457
+ console.error("BugBear: Camera error", response.errorCode, response.errorMessage);
14458
+ return;
14459
+ }
14460
+ if (!response.assets?.[0]) return;
14408
14461
  const asset = response.assets[0];
14409
14462
  const uri = asset.uri;
14410
14463
  if (!uri) return;
@@ -14418,6 +14471,11 @@ function useImageAttachments(uploadFn, maxImages, bucket = "screenshots") {
14418
14471
  setImages((prev) => prev.map(
14419
14472
  (img) => img.id === id ? { ...img, remoteUrl: url, status: url ? "done" : "error" } : img
14420
14473
  ));
14474
+ }).catch((err) => {
14475
+ console.error("BugBear: Image upload failed", err);
14476
+ setImages((prev) => prev.map(
14477
+ (img) => img.id === id ? { ...img, status: "error" } : img
14478
+ ));
14421
14479
  });
14422
14480
  }
14423
14481
  );
@@ -15121,7 +15179,7 @@ function ThreadDetailScreen({ thread, nav }) {
15121
15179
  })();
15122
15180
  }, [thread.id]);
15123
15181
  const handleSend = async () => {
15124
- if (!replyText.trim()) return;
15182
+ if (!replyText.trim() && replyImages.images.length === 0 || sending || replyImages.isUploading) return;
15125
15183
  setSending(true);
15126
15184
  setSendError(false);
15127
15185
  const attachments = replyImages.getAttachments();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbearai/react-native",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "description": "BugBear React Native components for mobile apps",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",