@bbearai/react-native 0.3.9 → 0.3.10

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
@@ -12655,6 +12655,7 @@ var BugBearClient = class {
12655
12655
  return false;
12656
12656
  }
12657
12657
  await this.supabase.from("discussion_threads").update({ last_message_at: (/* @__PURE__ */ new Date()).toISOString() }).eq("id", threadId);
12658
+ await this.markThreadAsRead(threadId);
12658
12659
  return true;
12659
12660
  } catch (err) {
12660
12661
  console.error("BugBear: Error sending message", err);
@@ -13799,11 +13800,14 @@ function TestDetailScreen({ testId, nav }) {
13799
13800
  setSelectedSkipReason(null);
13800
13801
  setSkipNotes("");
13801
13802
  setSkipping(false);
13802
- const remaining = assignments.filter(
13803
+ const currentIdx = assignments.indexOf(displayedAssignment);
13804
+ const pending = assignments.filter(
13803
13805
  (a) => (a.status === "pending" || a.status === "in_progress") && a.id !== displayedAssignment.id
13804
13806
  );
13805
- if (remaining.length > 0) {
13806
- nav.replace({ name: "TEST_DETAIL", testId: remaining[0].id });
13807
+ if (pending.length > 0) {
13808
+ const nextAfterCurrent = pending.find((a) => assignments.indexOf(a) > currentIdx);
13809
+ const nextTest = nextAfterCurrent || pending[0];
13810
+ nav.replace({ name: "TEST_DETAIL", testId: nextTest.id });
13807
13811
  } else {
13808
13812
  nav.reset();
13809
13813
  }
@@ -14001,6 +14005,9 @@ function TestListScreen({ nav }) {
14001
14005
  const { assignments, currentAssignment, refreshAssignments } = useBugBear();
14002
14006
  const [filter, setFilter] = (0, import_react5.useState)("all");
14003
14007
  const [collapsedFolders, setCollapsedFolders] = (0, import_react5.useState)(/* @__PURE__ */ new Set());
14008
+ (0, import_react5.useEffect)(() => {
14009
+ refreshAssignments();
14010
+ }, []);
14004
14011
  const groupedAssignments = (0, import_react5.useMemo)(() => {
14005
14012
  const groups = /* @__PURE__ */ new Map();
14006
14013
  for (const assignment of assignments) {
@@ -14333,9 +14340,12 @@ function TestFeedbackScreen({ status, assignmentId, nav }) {
14333
14340
  if (status === "failed") {
14334
14341
  nav.replace({ name: "REPORT", prefill: { type: "test_fail", assignmentId, testCaseId: assignment?.testCase.id } });
14335
14342
  } else {
14336
- const remaining = assignments.filter((a) => (a.status === "pending" || a.status === "in_progress") && a.id !== assignmentId);
14337
- if (remaining.length > 0) {
14338
- nav.replace({ name: "TEST_DETAIL", testId: remaining[0].id });
14343
+ const currentIdx = assignments.findIndex((a) => a.id === assignmentId);
14344
+ const pending = assignments.filter((a) => (a.status === "pending" || a.status === "in_progress") && a.id !== assignmentId);
14345
+ if (pending.length > 0) {
14346
+ const nextAfterCurrent = pending.find((a) => assignments.indexOf(a) > currentIdx);
14347
+ const nextTest = nextAfterCurrent || pending[0];
14348
+ nav.replace({ name: "TEST_DETAIL", testId: nextTest.id });
14339
14349
  } else {
14340
14350
  nav.reset();
14341
14351
  }
@@ -14345,9 +14355,12 @@ function TestFeedbackScreen({ status, assignmentId, nav }) {
14345
14355
  if (status === "failed") {
14346
14356
  nav.replace({ name: "REPORT", prefill: { type: "test_fail", assignmentId, testCaseId: assignment?.testCase.id } });
14347
14357
  } else {
14348
- const remaining = assignments.filter((a) => (a.status === "pending" || a.status === "in_progress") && a.id !== assignmentId);
14349
- if (remaining.length > 0) {
14350
- nav.replace({ name: "TEST_DETAIL", testId: remaining[0].id });
14358
+ const currentIdx = assignments.findIndex((a) => a.id === assignmentId);
14359
+ const pending = assignments.filter((a) => (a.status === "pending" || a.status === "in_progress") && a.id !== assignmentId);
14360
+ if (pending.length > 0) {
14361
+ const nextAfterCurrent = pending.find((a) => assignments.indexOf(a) > currentIdx);
14362
+ const nextTest = nextAfterCurrent || pending[0];
14363
+ nav.replace({ name: "TEST_DETAIL", testId: nextTest.id });
14351
14364
  } else {
14352
14365
  nav.reset();
14353
14366
  }
package/dist/index.mjs CHANGED
@@ -12624,6 +12624,7 @@ var BugBearClient = class {
12624
12624
  return false;
12625
12625
  }
12626
12626
  await this.supabase.from("discussion_threads").update({ last_message_at: (/* @__PURE__ */ new Date()).toISOString() }).eq("id", threadId);
12627
+ await this.markThreadAsRead(threadId);
12627
12628
  return true;
12628
12629
  } catch (err) {
12629
12630
  console.error("BugBear: Error sending message", err);
@@ -13783,11 +13784,14 @@ function TestDetailScreen({ testId, nav }) {
13783
13784
  setSelectedSkipReason(null);
13784
13785
  setSkipNotes("");
13785
13786
  setSkipping(false);
13786
- const remaining = assignments.filter(
13787
+ const currentIdx = assignments.indexOf(displayedAssignment);
13788
+ const pending = assignments.filter(
13787
13789
  (a) => (a.status === "pending" || a.status === "in_progress") && a.id !== displayedAssignment.id
13788
13790
  );
13789
- if (remaining.length > 0) {
13790
- nav.replace({ name: "TEST_DETAIL", testId: remaining[0].id });
13791
+ if (pending.length > 0) {
13792
+ const nextAfterCurrent = pending.find((a) => assignments.indexOf(a) > currentIdx);
13793
+ const nextTest = nextAfterCurrent || pending[0];
13794
+ nav.replace({ name: "TEST_DETAIL", testId: nextTest.id });
13791
13795
  } else {
13792
13796
  nav.reset();
13793
13797
  }
@@ -13979,12 +13983,15 @@ var styles2 = StyleSheet3.create({
13979
13983
  });
13980
13984
 
13981
13985
  // src/widget/screens/TestListScreen.tsx
13982
- import React4, { useState as useState3, useMemo as useMemo2, useCallback as useCallback3 } from "react";
13986
+ import React4, { useState as useState3, useMemo as useMemo2, useCallback as useCallback3, useEffect as useEffect4 } from "react";
13983
13987
  import { View as View3, Text as Text3, TouchableOpacity as TouchableOpacity3, StyleSheet as StyleSheet4 } from "react-native";
13984
13988
  function TestListScreen({ nav }) {
13985
13989
  const { assignments, currentAssignment, refreshAssignments } = useBugBear();
13986
13990
  const [filter, setFilter] = useState3("all");
13987
13991
  const [collapsedFolders, setCollapsedFolders] = useState3(/* @__PURE__ */ new Set());
13992
+ useEffect4(() => {
13993
+ refreshAssignments();
13994
+ }, []);
13988
13995
  const groupedAssignments = useMemo2(() => {
13989
13996
  const groups = /* @__PURE__ */ new Map();
13990
13997
  for (const assignment of assignments) {
@@ -14317,9 +14324,12 @@ function TestFeedbackScreen({ status, assignmentId, nav }) {
14317
14324
  if (status === "failed") {
14318
14325
  nav.replace({ name: "REPORT", prefill: { type: "test_fail", assignmentId, testCaseId: assignment?.testCase.id } });
14319
14326
  } else {
14320
- const remaining = assignments.filter((a) => (a.status === "pending" || a.status === "in_progress") && a.id !== assignmentId);
14321
- if (remaining.length > 0) {
14322
- nav.replace({ name: "TEST_DETAIL", testId: remaining[0].id });
14327
+ const currentIdx = assignments.findIndex((a) => a.id === assignmentId);
14328
+ const pending = assignments.filter((a) => (a.status === "pending" || a.status === "in_progress") && a.id !== assignmentId);
14329
+ if (pending.length > 0) {
14330
+ const nextAfterCurrent = pending.find((a) => assignments.indexOf(a) > currentIdx);
14331
+ const nextTest = nextAfterCurrent || pending[0];
14332
+ nav.replace({ name: "TEST_DETAIL", testId: nextTest.id });
14323
14333
  } else {
14324
14334
  nav.reset();
14325
14335
  }
@@ -14329,9 +14339,12 @@ function TestFeedbackScreen({ status, assignmentId, nav }) {
14329
14339
  if (status === "failed") {
14330
14340
  nav.replace({ name: "REPORT", prefill: { type: "test_fail", assignmentId, testCaseId: assignment?.testCase.id } });
14331
14341
  } else {
14332
- const remaining = assignments.filter((a) => (a.status === "pending" || a.status === "in_progress") && a.id !== assignmentId);
14333
- if (remaining.length > 0) {
14334
- nav.replace({ name: "TEST_DETAIL", testId: remaining[0].id });
14342
+ const currentIdx = assignments.findIndex((a) => a.id === assignmentId);
14343
+ const pending = assignments.filter((a) => (a.status === "pending" || a.status === "in_progress") && a.id !== assignmentId);
14344
+ if (pending.length > 0) {
14345
+ const nextAfterCurrent = pending.find((a) => assignments.indexOf(a) > currentIdx);
14346
+ const nextTest = nextAfterCurrent || pending[0];
14347
+ nav.replace({ name: "TEST_DETAIL", testId: nextTest.id });
14335
14348
  } else {
14336
14349
  nav.reset();
14337
14350
  }
@@ -14517,10 +14530,10 @@ var styles7 = StyleSheet8.create({
14517
14530
  });
14518
14531
 
14519
14532
  // src/widget/screens/ReportSuccessScreen.tsx
14520
- import React9, { useEffect as useEffect4 } from "react";
14533
+ import React9, { useEffect as useEffect5 } from "react";
14521
14534
  import { View as View8, Text as Text8, StyleSheet as StyleSheet9 } from "react-native";
14522
14535
  function ReportSuccessScreen({ nav }) {
14523
- useEffect4(() => {
14536
+ useEffect5(() => {
14524
14537
  const timer = setTimeout(() => nav.reset(), 2e3);
14525
14538
  return () => clearTimeout(timer);
14526
14539
  }, [nav]);
@@ -14579,7 +14592,7 @@ var styles9 = StyleSheet10.create({
14579
14592
  });
14580
14593
 
14581
14594
  // src/widget/screens/ThreadDetailScreen.tsx
14582
- import React11, { useState as useState7, useEffect as useEffect5 } from "react";
14595
+ import React11, { useState as useState7, useEffect as useEffect6 } from "react";
14583
14596
  import { View as View10, Text as Text10, TouchableOpacity as TouchableOpacity9, TextInput as TextInput4, StyleSheet as StyleSheet11, Image as Image2 } from "react-native";
14584
14597
  function ThreadDetailScreen({ thread, nav }) {
14585
14598
  const { getThreadMessages, sendMessage, markAsRead, uploadImage } = useBugBear();
@@ -14589,7 +14602,7 @@ function ThreadDetailScreen({ thread, nav }) {
14589
14602
  const [sending, setSending] = useState7(false);
14590
14603
  const [sendError, setSendError] = useState7(false);
14591
14604
  const replyImages = useImageAttachments(uploadImage, 3, "discussion-attachments");
14592
- useEffect5(() => {
14605
+ useEffect6(() => {
14593
14606
  (async () => {
14594
14607
  setLoading(true);
14595
14608
  const msgs = await getThreadMessages(thread.id);
@@ -14758,7 +14771,7 @@ var styles11 = StyleSheet12.create({
14758
14771
  });
14759
14772
 
14760
14773
  // src/widget/screens/ProfileScreen.tsx
14761
- import React13, { useState as useState9, useEffect as useEffect6 } from "react";
14774
+ import React13, { useState as useState9, useEffect as useEffect7 } from "react";
14762
14775
  import { View as View12, Text as Text12, TouchableOpacity as TouchableOpacity11, TextInput as TextInput6, StyleSheet as StyleSheet13 } from "react-native";
14763
14776
  function ProfileScreen({ nav }) {
14764
14777
  const { testerInfo, assignments, updateTesterProfile, refreshTesterInfo } = useBugBear();
@@ -14771,7 +14784,7 @@ function ProfileScreen({ nav }) {
14771
14784
  const [saved, setSaved] = useState9(false);
14772
14785
  const [showDetails, setShowDetails] = useState9(false);
14773
14786
  const completedCount = assignments.filter((a) => a.status === "passed" || a.status === "failed").length;
14774
- useEffect6(() => {
14787
+ useEffect7(() => {
14775
14788
  if (testerInfo) {
14776
14789
  setName(testerInfo.name);
14777
14790
  setAdditionalEmails(testerInfo.additionalEmails || []);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbearai/react-native",
3
- "version": "0.3.9",
3
+ "version": "0.3.10",
4
4
  "description": "BugBear React Native components for mobile apps",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",