@college-africa/chat-ui-native 0.1.1 → 1.1.2

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.
Files changed (53) hide show
  1. package/dist/cache/actions/groups.d.ts +2 -2
  2. package/dist/cache/actions/groups.d.ts.map +1 -1
  3. package/dist/cache/actions/messages.d.ts +3 -3
  4. package/dist/cache/actions/messages.d.ts.map +1 -1
  5. package/dist/cache/actions/summaries.d.ts +3 -2
  6. package/dist/cache/actions/summaries.d.ts.map +1 -1
  7. package/dist/cache/actions/summaries.js +9 -5
  8. package/dist/cache/actions/users.d.ts +2 -2
  9. package/dist/cache/actions/users.d.ts.map +1 -1
  10. package/dist/components/ChatApp.d.ts +3 -3
  11. package/dist/components/ChatApp.d.ts.map +1 -1
  12. package/dist/components/ChatApp.js +3 -3
  13. package/dist/components/ChatContainer.d.ts +6 -6
  14. package/dist/components/ChatContainer.d.ts.map +1 -1
  15. package/dist/components/ChatContainer.js +6 -6
  16. package/dist/components/ChatStack.d.ts +18 -0
  17. package/dist/components/ChatStack.d.ts.map +1 -0
  18. package/dist/components/ChatStack.js +55 -0
  19. package/dist/components/ChatView.d.ts.map +1 -1
  20. package/dist/components/ChatView.js +9 -0
  21. package/dist/components/ConversationList.d.ts +1 -1
  22. package/dist/components/ConversationList.d.ts.map +1 -1
  23. package/dist/components/ConversationList.js +5 -23
  24. package/dist/components/MessageBubble.d.ts +1 -1
  25. package/dist/components/MessageBubble.d.ts.map +1 -1
  26. package/dist/components/MessageInput.js +2 -1
  27. package/dist/components/MessageStatus.d.ts +1 -1
  28. package/dist/components/MessageStatus.d.ts.map +1 -1
  29. package/dist/components/UserAutocomplete.d.ts +1 -1
  30. package/dist/components/UserAutocomplete.d.ts.map +1 -1
  31. package/dist/hooks/useUnreadCount.d.ts +1 -1
  32. package/dist/hooks/useUnreadCount.d.ts.map +1 -1
  33. package/dist/hooks/useUnreadCount.js +14 -32
  34. package/dist/hooks/useWebSocket.d.ts +1 -1
  35. package/dist/hooks/useWebSocket.d.ts.map +1 -1
  36. package/dist/index.d.ts +3 -3
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +18 -5
  39. package/dist/screens/ChatScreen.d.ts +2 -2
  40. package/dist/screens/ChatScreen.d.ts.map +1 -1
  41. package/dist/screens/ConversationsScreen.d.ts +2 -2
  42. package/dist/screens/ConversationsScreen.d.ts.map +1 -1
  43. package/dist/screens/ConversationsScreen.js +1 -4
  44. package/dist/screens/CreateGroupScreen.d.ts +2 -2
  45. package/dist/screens/CreateGroupScreen.d.ts.map +1 -1
  46. package/dist/types/index.d.ts +1 -2
  47. package/dist/types/index.d.ts.map +1 -1
  48. package/dist/utils/messages.d.ts +1 -1
  49. package/dist/utils/messages.d.ts.map +1 -1
  50. package/dist/utils/sdk.d.ts +2 -2
  51. package/dist/utils/sdk.d.ts.map +1 -1
  52. package/dist/utils/sdk.js +2 -2
  53. package/package.json +3 -3
@@ -14,12 +14,12 @@ export interface CreateGroupData {
14
14
  * Fetch groups from server and cache in Realm
15
15
  * Clears existing groups first to remove groups user left
16
16
  */
17
- export declare const fetchGroups: (orgId: number) => Promise<import("sdk").Group[]>;
17
+ export declare const fetchGroups: (orgId: number) => Promise<import("@college-africa/chat-sdk").Group[]>;
18
18
  /**
19
19
  * Create a new group and refresh cache
20
20
  * Only available to admin/system users
21
21
  */
22
- export declare const createGroup: (data: CreateGroupData) => Promise<import("sdk").Group>;
22
+ export declare const createGroup: (data: CreateGroupData) => Promise<import("@college-africa/chat-sdk").Group>;
23
23
  /**
24
24
  * Join a group (admin only)
25
25
  */
@@ -1 +1 @@
1
- {"version":3,"file":"groups.d.ts","sourceRoot":"","sources":["../../../src/cache/actions/groups.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,KAAK,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,WAAW,GAAG,QAAQ,CAAC;KAC9B,CAAC,CAAC;CACJ;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAU,OAAO,MAAM,mCAgB9C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAU,MAAM,eAAe,iCA8BtD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,GACpB,SAAS,MAAM,EACf,OAAM,QAAQ,GAAG,WAAsB;;EAgBxC,CAAC"}
1
+ {"version":3,"file":"groups.d.ts","sourceRoot":"","sources":["../../../src/cache/actions/groups.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,KAAK,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,WAAW,GAAG,QAAQ,CAAC;KAC9B,CAAC,CAAC;CACJ;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAU,OAAO,MAAM,wDAgB9C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAU,MAAM,eAAe,sDA8BtD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,GACpB,SAAS,MAAM,EACf,OAAM,QAAQ,GAAG,WAAsB;;EAgBxC,CAAC"}
@@ -2,16 +2,16 @@
2
2
  * Message cache actions
3
3
  * Fetches data from SDK and writes to Realm
4
4
  */
5
- import type { GetMessagesParams, Message } from "sdk";
5
+ import type { GetMessagesParams, Message } from "@college-africa/chat-sdk";
6
6
  import { Conversation } from "../../utils/messages";
7
7
  /**
8
8
  * Fetch messages from server and cache in Realm
9
9
  */
10
- export declare const fetchMessages: (conversation: Conversation, params?: Partial<GetMessagesParams>) => Promise<import("sdk").MessagePage>;
10
+ export declare const fetchMessages: (conversation: Conversation, params?: Partial<GetMessagesParams>) => Promise<import("@college-africa/chat-sdk").MessagePage>;
11
11
  /**
12
12
  * Fetch older messages using cursor-based pagination
13
13
  * Reads stored cursor from MsgCursor and fetches messages before that timestamp
14
14
  */
15
- export declare const fetchOlderMessages: (conversation: Conversation) => Promise<import("sdk").MessagePage>;
15
+ export declare const fetchOlderMessages: (conversation: Conversation) => Promise<import("@college-africa/chat-sdk").MessagePage>;
16
16
  export declare const cacheIncomingMessage: (message: Message, currentUserId: number) => void;
17
17
  //# sourceMappingURL=messages.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/cache/actions/messages.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACtD,OAAO,EAAE,YAAY,EAAqB,MAAM,sBAAsB,CAAC;AAGvE;;GAEG;AACH,eAAO,MAAM,aAAa,GACxB,cAAc,YAAY,EAC1B,SAAQ,OAAO,CAAC,iBAAiB,CAAM,uCAgDxC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAU,cAAc,YAAY,uCAiBlE,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,SAAS,OAAO,EAChB,eAAe,MAAM,SAkEtB,CAAC"}
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/cache/actions/messages.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAqB,MAAM,sBAAsB,CAAC;AAGvE;;GAEG;AACH,eAAO,MAAM,aAAa,GACxB,cAAc,YAAY,EAC1B,SAAQ,OAAO,CAAC,iBAAiB,CAAM,4DAgDxC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAU,cAAc,YAAY,4DAiBlE,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,SAAS,OAAO,EAChB,eAAe,MAAM,SAkEtB,CAAC"}
@@ -2,11 +2,12 @@
2
2
  * Summary cache actions
3
3
  * Fetches data from SDK and writes to Realm
4
4
  */
5
- import type { GetMessagesSummaryParams, Message } from "sdk";
5
+ import type { GetMessagesSummaryParams, Message } from "@college-africa/chat-sdk";
6
+ export declare const setActiveConversation: (summaryId: string | null) => void;
6
7
  /**
7
8
  * Fetch summaries from server and cache in Realm
8
9
  */
9
- export declare const fetchSummaries: (params?: GetMessagesSummaryParams) => Promise<import("sdk").ConversationSummary[]>;
10
+ export declare const fetchSummaries: (params?: GetMessagesSummaryParams) => Promise<import("@college-africa/chat-sdk").ConversationSummary[]>;
10
11
  /**
11
12
  * Update summary for an incoming message
12
13
  * Creates new summary if it doesn't exist
@@ -1 +1 @@
1
- {"version":3,"file":"summaries.d.ts","sourceRoot":"","sources":["../../../src/cache/actions/summaries.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EAAE,wBAAwB,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAG7D;;GAEG;AACH,eAAO,MAAM,cAAc,GAAU,SAAQ,wBAA6B,iDAqBzE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAClC,SAAS,OAAO,EAChB,eAAe,MAAM,SAsCtB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,gBAAgB,MAAM,SAuBtD,CAAC"}
1
+ {"version":3,"file":"summaries.d.ts","sourceRoot":"","sources":["../../../src/cache/actions/summaries.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EAAE,wBAAwB,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAKlF,eAAO,MAAM,qBAAqB,GAAI,WAAW,MAAM,GAAG,IAAI,SAE7D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GAAU,SAAQ,wBAA6B,sEAqBzE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAClC,SAAS,OAAO,EAChB,eAAe,MAAM,SAoCtB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,gBAAgB,MAAM,SAuBtD,CAAC"}
@@ -7,12 +7,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
7
7
  return (mod && mod.__esModule) ? mod : { "default": mod };
8
8
  };
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.clearUnreadCount = exports.updateSummaryForMessage = exports.fetchSummaries = void 0;
10
+ exports.clearUnreadCount = exports.updateSummaryForMessage = exports.fetchSummaries = exports.setActiveConversation = void 0;
11
11
  const realm_1 = __importDefault(require("realm"));
12
12
  const sdk_1 = require("../../utils/sdk");
13
13
  const database_1 = require("../database");
14
14
  const misc_1 = require("../../utils/misc");
15
15
  const messages_1 = require("../../utils/messages");
16
+ let activeConversationId;
17
+ const setActiveConversation = (summaryId) => {
18
+ activeConversationId = summaryId;
19
+ };
20
+ exports.setActiveConversation = setActiveConversation;
16
21
  /**
17
22
  * Fetch summaries from server and cache in Realm
18
23
  */
@@ -41,14 +46,13 @@ exports.fetchSummaries = fetchSummaries;
41
46
  const updateSummaryForMessage = (message, currentUserId) => {
42
47
  const realm = (0, database_1.getRealm)();
43
48
  const otherUserId = message.sender === currentUserId ? message.receiver : message.sender;
44
- if (!otherUserId && !message.group) {
45
- console.warn("Cannot update summary: message has no group or valid user IDs");
46
- return;
47
- }
48
49
  const summaryId = (0, misc_1.getSummaryId)({
49
50
  group: message.group,
50
51
  user: otherUserId ?? undefined
51
52
  });
53
+ // Do not update unread_message count if conversation is opened
54
+ if (summaryId === activeConversationId)
55
+ return;
52
56
  const existingSummary = realm.objectForPrimaryKey("Summary", summaryId);
53
57
  if (existingSummary) {
54
58
  // Update existing summary
@@ -8,11 +8,11 @@ import { CurrentUser } from '../schema';
8
8
  */
9
9
  export declare const fetchUsers: (userIds: number[], options?: {
10
10
  fields?: string[];
11
- }) => Promise<import("sdk").User[]>;
11
+ }) => Promise<import("@college-africa/chat-sdk").User[]>;
12
12
  /**
13
13
  * Fetch single user from server and cache in Realm
14
14
  */
15
- export declare const fetchUser: (userId: number) => Promise<import("sdk").User>;
15
+ export declare const fetchUser: (userId: number) => Promise<import("@college-africa/chat-sdk").User>;
16
16
  /**
17
17
  * Get the current authenticated user from cache
18
18
  * Returns null if not set
@@ -1 +1 @@
1
- {"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../../src/cache/actions/users.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC;;GAEG;AACH,eAAO,MAAM,UAAU,GAAU,SAAS,MAAM,EAAE,EAAE,UAAS;IAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAAO,kCA8BtF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,GAAU,QAAQ,MAAM,gCAoB7C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,QAAO,WAAW,GAAG,IAI/C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,QAAO,MAAM,GAAG,IAG5C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,KAAG,IAoB/G,CAAC"}
1
+ {"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../../src/cache/actions/users.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC;;GAEG;AACH,eAAO,MAAM,UAAU,GAAU,SAAS,MAAM,EAAE,EAAE,UAAS;IAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAAO,uDA8BtF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,GAAU,QAAQ,MAAM,qDAoB7C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,QAAO,WAAW,GAAG,IAI/C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,QAAO,MAAM,GAAG,IAG5C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,KAAG,IAoB/G,CAAC"}
@@ -2,8 +2,8 @@
2
2
  * ChatApp - Main full-screen chat component
3
3
  */
4
4
  import React from "react";
5
- import type { ChatClientConfig } from "sdk";
6
- import type { NativeStackNavigationOptions } from "@react-navigation/native-stack";
5
+ import type { ChatClientConfig } from "@college-africa/chat-sdk";
6
+ import type { StackNavigationOptions } from "@react-navigation/stack";
7
7
  export interface ChatAppProps {
8
8
  /**
9
9
  * SDK configuration
@@ -24,7 +24,7 @@ export interface ChatAppProps {
24
24
  /**
25
25
  * Navigation screen options to pass to the stack navigator
26
26
  */
27
- screenOptions?: NativeStackNavigationOptions;
27
+ screenOptions?: StackNavigationOptions;
28
28
  }
29
29
  /**
30
30
  * Main chat application component
@@ -1 +1 @@
1
- {"version":3,"file":"ChatApp.d.ts","sourceRoot":"","sources":["../../src/components/ChatApp.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAA8B,MAAM,OAAO,CAAC;AAInD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAM5C,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAEnF,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,MAAM,EAAE,gBAAgB,CAAC;IAEzB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEnC;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEjC;;OAEG;IACH,aAAa,CAAC,EAAE,4BAA4B,CAAC;CAC9C;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,EACtB,MAAM,EACN,KAAK,EACL,gBAAgB,EAChB,OAAO,EACP,aAAa,EACd,EAAE,YAAY,qBA2Dd"}
1
+ {"version":3,"file":"ChatApp.d.ts","sourceRoot":"","sources":["../../src/components/ChatApp.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAA8B,MAAM,OAAO,CAAC;AAInD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAMjE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEtE,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,MAAM,EAAE,gBAAgB,CAAC;IAEzB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEnC;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEjC;;OAEG;IACH,aAAa,CAAC,EAAE,sBAAsB,CAAC;CACxC;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,EACtB,MAAM,EACN,KAAK,EACL,gBAAgB,EAChB,OAAO,EACP,aAAa,EACd,EAAE,YAAY,qBA2Dd"}
@@ -42,7 +42,7 @@ const react_native_1 = require("react-native");
42
42
  const sdk_1 = require("../utils/sdk");
43
43
  // @ts-ignore - react-native-paper is a peer dependency
44
44
  const react_native_paper_1 = require("react-native-paper");
45
- const ChatContainer_1 = require("./ChatContainer");
45
+ const ChatStack_1 = require("./ChatStack");
46
46
  /**
47
47
  * Main chat application component
48
48
  * Initializes SDK and provides the chat interface
@@ -92,8 +92,8 @@ function ChatApp({ config, token, loadingComponent, onError, screenOptions }) {
92
92
  <react_native_1.ActivityIndicator size="large"/>
93
93
  </react_native_1.View>);
94
94
  }
95
- // Phase 3: Render ChatContainer with conversation list and chat view
96
- return <ChatContainer_1.ChatContainer screenOptions={screenOptions}/>;
95
+ // Phase 3: Render ChatStack with conversation list and chat view
96
+ return <ChatStack_1.ChatStack screenOptions={screenOptions}/>;
97
97
  }
98
98
  const styles = react_native_1.StyleSheet.create({
99
99
  container: {
@@ -1,18 +1,18 @@
1
1
  /**
2
- * ChatContainer - React Navigation stack for conversation list and chat view
2
+ * ChatStack - React Navigation stack for conversation list and chat view
3
3
  * Note: This component exports a Stack.Navigator without NavigationContainer
4
4
  * The parent app must provide NavigationContainer
5
5
  */
6
6
  import React from "react";
7
- import type { NativeStackNavigationOptions } from "@react-navigation/native-stack";
8
- export interface ChatContainerProps {
9
- screenOptions?: NativeStackNavigationOptions;
7
+ import type { StackNavigationOptions } from "@react-navigation/stack";
8
+ export interface ChatStackProps {
9
+ screenOptions?: StackNavigationOptions;
10
10
  }
11
11
  /**
12
- * ChatContainer provides a navigation stack for the chat UI
12
+ * ChatStack provides a navigation stack for the chat UI
13
13
  * Uses native headers from React Navigation for better platform integration
14
14
  *
15
15
  * IMPORTANT: The parent app must wrap this in a NavigationContainer
16
16
  */
17
- export declare function ChatContainer({ screenOptions }: ChatContainerProps): React.JSX.Element;
17
+ export declare function ChatStack({ screenOptions }: ChatStackProps): React.JSX.Element;
18
18
  //# sourceMappingURL=ChatContainer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChatContainer.d.ts","sourceRoot":"","sources":["../../src/components/ChatContainer.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAInF,MAAM,WAAW,kBAAkB;IACjC,aAAa,CAAC,EAAE,4BAA4B,CAAC;CAC9C;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,EAAE,aAAa,EAAE,EAAE,kBAAkB,qBA4BlE"}
1
+ {"version":3,"file":"ChatContainer.d.ts","sourceRoot":"","sources":["../../src/components/ChatContainer.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAItE,MAAM,WAAW,cAAc;IAC7B,aAAa,CAAC,EAAE,sBAAsB,CAAC;CACxC;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,EAAE,aAAa,EAAE,EAAE,cAAc,qBA4B1D"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * ChatContainer - React Navigation stack for conversation list and chat view
3
+ * ChatStack - React Navigation stack for conversation list and chat view
4
4
  * Note: This component exports a Stack.Navigator without NavigationContainer
5
5
  * The parent app must provide NavigationContainer
6
6
  */
@@ -8,21 +8,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
8
8
  return (mod && mod.__esModule) ? mod : { "default": mod };
9
9
  };
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.ChatContainer = ChatContainer;
11
+ exports.ChatStack = ChatStack;
12
12
  const react_1 = __importDefault(require("react"));
13
13
  // @ts-ignore - react-navigation is a peer dependency
14
- const native_stack_1 = require("@react-navigation/native-stack");
14
+ const stack_1 = require("@react-navigation/stack");
15
15
  const ConversationsScreen_1 = require("../screens/ConversationsScreen");
16
16
  const ChatScreen_1 = require("../screens/ChatScreen");
17
17
  const CreateGroupScreen_1 = require("../screens/CreateGroupScreen");
18
- const Stack = (0, native_stack_1.createNativeStackNavigator)();
18
+ const Stack = (0, stack_1.createStackNavigator)();
19
19
  /**
20
- * ChatContainer provides a navigation stack for the chat UI
20
+ * ChatStack provides a navigation stack for the chat UI
21
21
  * Uses native headers from React Navigation for better platform integration
22
22
  *
23
23
  * IMPORTANT: The parent app must wrap this in a NavigationContainer
24
24
  */
25
- function ChatContainer({ screenOptions }) {
25
+ function ChatStack({ screenOptions }) {
26
26
  return (<Stack.Navigator screenOptions={{ headerShown: true, ...screenOptions }}>
27
27
  <Stack.Screen name="Conversations" component={ConversationsScreen_1.ConversationsScreen} options={{
28
28
  title: "Conversations"
@@ -0,0 +1,18 @@
1
+ /**
2
+ * ChatStack - React Navigation stack for conversation list and chat view
3
+ * Note: This component exports a Stack.Navigator without NavigationContainer
4
+ * The parent app must provide NavigationContainer
5
+ */
6
+ import React from "react";
7
+ import type { StackNavigationOptions } from "@react-navigation/stack";
8
+ export interface ChatStackProps {
9
+ screenOptions?: StackNavigationOptions;
10
+ }
11
+ /**
12
+ * ChatStack provides a navigation stack for the chat UI
13
+ * Uses native headers from React Navigation for better platform integration
14
+ *
15
+ * IMPORTANT: The parent app must wrap this in a NavigationContainer
16
+ */
17
+ export declare function ChatStack({ screenOptions: options }: ChatStackProps): React.JSX.Element;
18
+ //# sourceMappingURL=ChatStack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatStack.d.ts","sourceRoot":"","sources":["../../src/components/ChatStack.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAOtE,MAAM,WAAW,cAAc;IAC7B,aAAa,CAAC,EAAE,sBAAsB,CAAC;CACxC;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,EAAE,aAAa,EAAE,OAAO,EAAE,EAAE,cAAc,qBAiDnE"}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ /**
3
+ * ChatStack - React Navigation stack for conversation list and chat view
4
+ * Note: This component exports a Stack.Navigator without NavigationContainer
5
+ * The parent app must provide NavigationContainer
6
+ */
7
+ var __importDefault = (this && this.__importDefault) || function (mod) {
8
+ return (mod && mod.__esModule) ? mod : { "default": mod };
9
+ };
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.ChatStack = ChatStack;
12
+ const react_1 = __importDefault(require("react"));
13
+ // @ts-ignore - react-navigation is a peer dependency
14
+ const stack_1 = require("@react-navigation/stack");
15
+ // @ts-ignore - react-navigation is a peer dependency
16
+ const native_1 = require("@react-navigation/native");
17
+ const ConversationsScreen_1 = require("../screens/ConversationsScreen");
18
+ const ChatScreen_1 = require("../screens/ChatScreen");
19
+ const CreateGroupScreen_1 = require("../screens/CreateGroupScreen");
20
+ // @ts-ignore - react-native-paper is a peer dependency
21
+ const react_native_paper_1 = require("react-native-paper");
22
+ const users_1 = require("../cache/actions/users");
23
+ const Stack = (0, stack_1.createStackNavigator)();
24
+ /**
25
+ * ChatStack provides a navigation stack for the chat UI
26
+ * Uses native headers from React Navigation for better platform integration
27
+ *
28
+ * IMPORTANT: The parent app must wrap this in a NavigationContainer
29
+ */
30
+ function ChatStack({ screenOptions: options }) {
31
+ const navigation = (0, native_1.useNavigation)();
32
+ const currentUser = (0, users_1.getCurrentUser)();
33
+ const isAdmin = ["admin", "system"].includes(currentUser?.role) || undefined;
34
+ const screenOptions = {
35
+ headerBackTitle: " ",
36
+ headerShown: true,
37
+ headerBackButtonDisplayMode: "minimal",
38
+ ...options
39
+ };
40
+ return (<Stack.Navigator screenOptions={screenOptions}>
41
+ <Stack.Screen name="Conversations" component={ConversationsScreen_1.ConversationsScreen} options={() => ({
42
+ title: "Conversations",
43
+ headerRight: () => isAdmin && (<react_native_paper_1.IconButton icon="account-multiple-plus" size={20} onPress={() => {
44
+ // @ts-ignore - navigation type inference
45
+ navigation.navigate("CreateGroup");
46
+ }}/>)
47
+ })}/>
48
+ <Stack.Screen name="Chat" component={ChatScreen_1.ChatScreen} options={({ route }) => ({
49
+ title: route.params.conversationName
50
+ })}/>
51
+ <Stack.Screen name="CreateGroup" component={CreateGroupScreen_1.CreateGroupScreen} options={{
52
+ title: "Create Group"
53
+ }}/>
54
+ </Stack.Navigator>);
55
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"ChatView.d.ts","sourceRoot":"","sources":["../../src/components/ChatView.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAI9C,wBAAgB,QAAQ,CAAC,EAAE,cAAc,EAAE,EAAE,aAAa,qBAmFzD"}
1
+ {"version":3,"file":"ChatView.d.ts","sourceRoot":"","sources":["../../src/components/ChatView.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAM9C,wBAAgB,QAAQ,CAAC,EAAE,cAAc,EAAE,EAAE,aAAa,qBA4FzD"}
@@ -20,6 +20,8 @@ const useSenderNames_1 = require("../hooks/useSenderNames");
20
20
  const styles_1 = require("../styles");
21
21
  const messages_1 = require("../utils/messages");
22
22
  const database_1 = require("../cache/database");
23
+ const native_1 = require("@react-navigation/native");
24
+ const actions_1 = require("../cache/actions");
23
25
  function ChatView({ conversationId }) {
24
26
  const { messages, loading, isLoadingMore, hasOlderMessages, error, sendMessage, loadOlderMessages, currentUserId } = (0, useMessages_1.useMessages)({
25
27
  conversationId
@@ -43,6 +45,13 @@ function ChatView({ conversationId }) {
43
45
  const theme = (0, react_native_paper_1.useTheme)();
44
46
  // Check if user is a group member (for groups only)
45
47
  const conversation = react_1.default.useMemo(() => (0, messages_1.parseConversationId)(conversationId), [conversationId]);
48
+ (0, native_1.useFocusEffect)(() => {
49
+ (0, actions_1.setActiveConversation)(conversationId);
50
+ // Set active conversation id/summary id
51
+ return () => {
52
+ (0, actions_1.setActiveConversation)(null);
53
+ };
54
+ });
46
55
  const isGroupMember = react_1.default.useMemo(() => {
47
56
  if (conversation.type !== "group")
48
57
  return true; // DMs are always allowed
@@ -3,5 +3,5 @@
3
3
  */
4
4
  import React from "react";
5
5
  import type { ConversationListProps } from "../types";
6
- export declare function ConversationList({ onSelectConversation, onCreateGroup }: ConversationListProps): React.JSX.Element;
6
+ export declare function ConversationList({ onSelectConversation }: ConversationListProps): React.JSX.Element;
7
7
  //# sourceMappingURL=ConversationList.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConversationList.d.ts","sourceRoot":"","sources":["../../src/components/ConversationList.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAGtD,wBAAgB,gBAAgB,CAAC,EAC/B,oBAAoB,EACpB,aAAa,EACd,EAAE,qBAAqB,qBAqEvB"}
1
+ {"version":3,"file":"ConversationList.d.ts","sourceRoot":"","sources":["../../src/components/ConversationList.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAGtD,wBAAgB,gBAAgB,CAAC,EAC/B,oBAAoB,EACrB,EAAE,qBAAqB,qBAwDvB"}
@@ -14,13 +14,10 @@ const react_native_paper_1 = require("react-native-paper");
14
14
  const ConversationItem_1 = require("./ConversationItem");
15
15
  const useConversationList_1 = require("../hooks/useConversationList");
16
16
  const styles_1 = require("../styles");
17
- const users_1 = require("../cache/actions/users");
18
- function ConversationList({ onSelectConversation, onCreateGroup }) {
19
- const styles = useStyles();
17
+ function ConversationList({ onSelectConversation }) {
18
+ const theme = (0, react_native_paper_1.useTheme)();
19
+ const styles = useStyles(theme);
20
20
  const { conversations, loading, error } = (0, useConversationList_1.useConversationList)();
21
- const currentUser = (0, users_1.getCurrentUser)();
22
- // Check if user is admin or system role
23
- const isAdmin = currentUser?.role === "admin" || currentUser?.role === "system";
24
21
  const renderItem = ({ item }) => (<ConversationItem_1.ConversationItem conversation={item} onPress={() => onSelectConversation(item)}/>);
25
22
  const keyExtractor = (item) => item.id;
26
23
  if (loading) {
@@ -48,19 +45,10 @@ function ConversationList({ onSelectConversation, onCreateGroup }) {
48
45
  </react_native_paper_1.Text>
49
46
  </react_native_1.View>);
50
47
  }
51
- return (<react_native_1.View style={styles.container}>
52
- <react_native_1.FlatList data={conversations} renderItem={renderItem} keyExtractor={keyExtractor} style={styles.list}/>
53
-
54
- {isAdmin && onCreateGroup && (<react_native_paper_1.FAB icon="account-multiple-plus" style={styles.fab} onPress={onCreateGroup}/>)}
55
- </react_native_1.View>);
48
+ return (<react_native_1.FlatList data={conversations} renderItem={renderItem} keyExtractor={keyExtractor} style={styles.list}/>);
56
49
  }
57
- const useStyles = () => {
58
- const theme = (0, react_native_paper_1.useTheme)();
50
+ const useStyles = (theme) => {
59
51
  return (0, styles_1.useStyleSheet)({
60
- container: {
61
- flex: 1,
62
- backgroundColor: theme.colors.surface
63
- },
64
52
  list: {
65
53
  flex: 1,
66
54
  paddingTop: 8,
@@ -88,12 +76,6 @@ const useStyles = () => {
88
76
  emptySubtext: {
89
77
  color: theme.colors.onSurfaceVariant,
90
78
  textAlign: "center"
91
- },
92
- fab: {
93
- position: "absolute",
94
- margin: 16,
95
- right: 0,
96
- bottom: 0
97
79
  }
98
80
  });
99
81
  };
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import React from "react";
5
5
  import type { MessageBubbleProps } from "../types";
6
- import type { MessageStatus } from "sdk";
6
+ import type { MessageStatus } from "@college-africa/chat-sdk";
7
7
  export interface EnhancedMessageBubbleProps extends MessageBubbleProps {
8
8
  /** Message status (for own messages only) */
9
9
  status?: MessageStatus;
@@ -1 +1 @@
1
- {"version":3,"file":"MessageBubble.d.ts","sourceRoot":"","sources":["../../src/components/MessageBubble.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAGzC,MAAM,WAAW,0BAA2B,SAAQ,kBAAkB;IACpE,6CAA6C;IAC7C,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,kBAAkB;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gCAAgC;IAChC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,+BAA+B;IAC/B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,KAAK,EACL,UAAU,EACV,MAAM,EACN,UAAU,EACV,cAAsB,EACtB,aAAqB,EACtB,EAAE,0BAA0B,qBA8E5B"}
1
+ {"version":3,"file":"MessageBubble.d.ts","sourceRoot":"","sources":["../../src/components/MessageBubble.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAG9D,MAAM,WAAW,0BAA2B,SAAQ,kBAAkB;IACpE,6CAA6C;IAC7C,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,kBAAkB;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gCAAgC;IAChC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,+BAA+B;IAC/B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,KAAK,EACL,UAAU,EACV,MAAM,EACN,UAAU,EACV,cAAsB,EACtB,aAAqB,EACtB,EAAE,0BAA0B,qBA8E5B"}
@@ -75,7 +75,8 @@ const useStyles = (theme) => {
75
75
  borderRadius: 28
76
76
  },
77
77
  inputContent: {
78
- paddingHorizontal: 16
78
+ paddingHorizontal: 16,
79
+ height: 10
79
80
  },
80
81
  sendButton: {
81
82
  marginBottom: 4
@@ -2,7 +2,7 @@
2
2
  * MessageStatus - Display message delivery status (sent, delivered, read, failed)
3
3
  */
4
4
  import React from "react";
5
- import type { MessageStatus } from "sdk";
5
+ import type { MessageStatus } from "@college-africa/chat-sdk";
6
6
  export interface MessageStatusProps {
7
7
  /** Message status */
8
8
  status?: MessageStatus;
@@ -1 +1 @@
1
- {"version":3,"file":"MessageStatus.d.ts","sourceRoot":"","sources":["../../src/components/MessageStatus.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEzC,MAAM,WAAW,kBAAkB;IACjC,qBAAqB;IACrB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,0BAA0B;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,IAAS,EAAE,EAAE,kBAAkB,4BAgBtE"}
1
+ {"version":3,"file":"MessageStatus.d.ts","sourceRoot":"","sources":["../../src/components/MessageStatus.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,MAAM,WAAW,kBAAkB;IACjC,qBAAqB;IACrB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,0BAA0B;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,IAAS,EAAE,EAAE,kBAAkB,4BAgBtE"}
@@ -2,7 +2,7 @@
2
2
  * UserAutocomplete - Search and select users
3
3
  */
4
4
  import React from "react";
5
- import type { User } from "sdk";
5
+ import type { User } from "@college-africa/chat-sdk";
6
6
  interface UserAutocompleteProps {
7
7
  multiple?: boolean;
8
8
  value: User[];
@@ -1 +1 @@
1
- {"version":3,"file":"UserAutocomplete.d.ts","sourceRoot":"","sources":["../../src/components/UserAutocomplete.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAgC,MAAM,OAAO,CAAC;AAYrD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAGhC,UAAU,qBAAqB;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,QAAgB,EAChB,KAAU,EACV,QAAQ,EACR,QAAgB,EAChB,WAAuC,EACvC,SAAgB,EACjB,EAAE,qBAAqB,qBAuIvB"}
1
+ {"version":3,"file":"UserAutocomplete.d.ts","sourceRoot":"","sources":["../../src/components/UserAutocomplete.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAgC,MAAM,OAAO,CAAC;AAYrD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAGrD,UAAU,qBAAqB;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,QAAgB,EAChB,KAAU,EACV,QAAQ,EACR,QAAgB,EAChB,WAAuC,EACvC,SAAgB,EACjB,EAAE,qBAAqB,qBAuIvB"}
@@ -2,5 +2,5 @@
2
2
  * Hook to reactively compute total unread message count
3
3
  * Phase 5: Reactive pattern with Realm observer
4
4
  */
5
- export declare function useUnreadCount(): number;
5
+ export declare function useUnreadCount(): number | undefined;
6
6
  //# sourceMappingURL=useUnreadCount.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useUnreadCount.d.ts","sourceRoot":"","sources":["../../src/hooks/useUnreadCount.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,wBAAgB,cAAc,IAAI,MAAM,CAuCvC"}
1
+ {"version":3,"file":"useUnreadCount.d.ts","sourceRoot":"","sources":["../../src/hooks/useUnreadCount.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,wBAAgB,cAAc,uBAuB7B"}
@@ -6,41 +6,23 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.useUnreadCount = useUnreadCount;
8
8
  const react_1 = require("react");
9
- const sdk_1 = require("../utils/sdk");
10
9
  const database_1 = require("../cache/database");
11
10
  function useUnreadCount() {
12
- const [unreadCount, setUnreadCount] = (0, react_1.useState)(0);
11
+ const [unreadCount, setUnreadCount] = (0, react_1.useState)();
13
12
  (0, react_1.useEffect)(() => {
14
- // Check if SDK and Realm are ready
15
- if (!(0, sdk_1.isSDKInitialized)() || !(0, database_1.isRealmInitialized)()) {
16
- setUnreadCount(0);
17
- return;
18
- }
19
- try {
20
- const realm = (0, database_1.getRealm)();
21
- const summaries = realm.objects("Summary");
22
- const listener = () => {
23
- try {
24
- // Compute total unread count using Realm's sum aggregation
25
- const total = summaries.sum("unread_count");
26
- setUnreadCount(typeof total === "number" ? total : 0);
27
- }
28
- catch (err) {
29
- console.error("Error computing unread count:", err);
30
- setUnreadCount(0);
31
- }
32
- };
33
- summaries.addListener(listener);
34
- listener(); // Initial load
35
- return () => {
36
- summaries.removeListener(listener);
37
- };
38
- }
39
- catch (err) {
40
- console.error("Error setting up unread count observer:", err);
41
- setUnreadCount(0);
42
- return;
43
- }
13
+ const realm = (0, database_1.getRealm)();
14
+ const summaries = realm.objects("Summary");
15
+ const listener = () => {
16
+ if (!(0, database_1.isRealmInitialized)())
17
+ return;
18
+ const total = summaries.sum("unread_count");
19
+ setUnreadCount(total || undefined);
20
+ };
21
+ summaries.addListener(listener);
22
+ listener(); // Initial load
23
+ return () => {
24
+ summaries.removeListener(listener);
25
+ };
44
26
  }, []);
45
27
  return unreadCount;
46
28
  }
@@ -5,7 +5,7 @@
5
5
  * Note: Message handling is already implemented in SDK initialization (utils/sdk.ts)
6
6
  * This hook only provides connection status and event callbacks
7
7
  */
8
- import type { WSMessage } from "sdk";
8
+ import type { WSMessage } from "@college-africa/chat-sdk";
9
9
  export interface UseWebSocketParams {
10
10
  /** Callback when a message is received */
11
11
  onMessage?: (message: WSMessage) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"useWebSocket.d.ts","sourceRoot":"","sources":["../../src/hooks/useWebSocket.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAIV,SAAS,EAEV,MAAM,KAAK,CAAC;AAGb,MAAM,WAAW,kBAAkB;IACjC,0CAA0C;IAC1C,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,KAAK,IAAI,CAAC;IACzC,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,gDAAgD;IAChD,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,2CAA2C;IAC3C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,EAC3B,SAAS,EACT,SAAS,EACT,YAAY,EACZ,OAAO,EACR,GAAE,kBAAuB;;EA0EzB"}
1
+ {"version":3,"file":"useWebSocket.d.ts","sourceRoot":"","sources":["../../src/hooks/useWebSocket.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAIV,SAAS,EAEV,MAAM,0BAA0B,CAAC;AAGlC,MAAM,WAAW,kBAAkB;IACjC,0CAA0C;IAC1C,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,KAAK,IAAI,CAAC;IACzC,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,gDAAgD;IAChD,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,2CAA2C;IAC3C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,EAC3B,SAAS,EACT,SAAS,EACT,YAAY,EACZ,OAAO,EACR,GAAE,kBAAuB;;EA0EzB"}
package/dist/index.d.ts CHANGED
@@ -7,14 +7,14 @@
7
7
  import "event-target-polyfill";
8
8
  export { ChatApp } from "./components/ChatApp";
9
9
  export type { ChatAppProps } from "./components/ChatApp";
10
- export { ChatIconButton } from "./components/ChatIconButton";
11
- export type { ChatIconButtonProps } from "./components/ChatIconButton";
10
+ export { ChatStack } from "./components/ChatStack";
11
+ export type { ChatStackProps } from "./components/ChatStack";
12
12
  export { MessageStatus } from "./components/MessageStatus";
13
13
  export type { MessageStatusProps } from "./components/MessageStatus";
14
- export { KeyboardAvoidingContainer } from "./components/KeyboardAvoidingContainer";
15
14
  export { getRealm, closeRealm, isRealmInitialized } from "./cache/database";
16
15
  export { deleteDatabase, resetCache, logout } from "./cache";
17
16
  export { lightTheme, darkTheme, getTheme, useStyleSheet } from "./styles";
17
+ export * from "./cache/actions/summaries";
18
18
  export { initSDK, getSDK, disconnectSDK, isSDKInitialized } from "./utils/sdk";
19
19
  export { normaliseError } from "./utils/misc";
20
20
  export { useUnreadCount } from "./hooks/useUnreadCount";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,uBAAuB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AAO,EAAE,QAAQ,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAG7D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG1E,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC"}
package/dist/index.js CHANGED
@@ -5,20 +5,32 @@
5
5
  *
6
6
  * Only export utils and object that may be used to embed library or manage data
7
7
  */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
20
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
+ };
8
22
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.useUnreadCount = exports.normaliseError = exports.isSDKInitialized = exports.disconnectSDK = exports.getSDK = exports.initSDK = exports.useStyleSheet = exports.getTheme = exports.darkTheme = exports.lightTheme = exports.logout = exports.resetCache = exports.deleteDatabase = exports.isRealmInitialized = exports.closeRealm = exports.getRealm = exports.KeyboardAvoidingContainer = exports.MessageStatus = exports.ChatIconButton = exports.ChatApp = void 0;
23
+ exports.useUnreadCount = exports.normaliseError = exports.isSDKInitialized = exports.disconnectSDK = exports.getSDK = exports.initSDK = exports.useStyleSheet = exports.getTheme = exports.darkTheme = exports.lightTheme = exports.logout = exports.resetCache = exports.deleteDatabase = exports.isRealmInitialized = exports.closeRealm = exports.getRealm = exports.MessageStatus = exports.ChatStack = exports.ChatApp = void 0;
10
24
  // Apply polyfills for React Native environment
11
25
  require("event-target-polyfill");
12
26
  // Main Components
13
27
  var ChatApp_1 = require("./components/ChatApp");
14
28
  Object.defineProperty(exports, "ChatApp", { enumerable: true, get: function () { return ChatApp_1.ChatApp; } });
15
- var ChatIconButton_1 = require("./components/ChatIconButton");
16
- Object.defineProperty(exports, "ChatIconButton", { enumerable: true, get: function () { return ChatIconButton_1.ChatIconButton; } });
29
+ var ChatStack_1 = require("./components/ChatStack");
30
+ Object.defineProperty(exports, "ChatStack", { enumerable: true, get: function () { return ChatStack_1.ChatStack; } });
17
31
  // Chat Components
18
32
  var MessageStatus_1 = require("./components/MessageStatus");
19
33
  Object.defineProperty(exports, "MessageStatus", { enumerable: true, get: function () { return MessageStatus_1.MessageStatus; } });
20
- var KeyboardAvoidingContainer_1 = require("./components/KeyboardAvoidingContainer");
21
- Object.defineProperty(exports, "KeyboardAvoidingContainer", { enumerable: true, get: function () { return KeyboardAvoidingContainer_1.KeyboardAvoidingContainer; } });
22
34
  // Cache
23
35
  var database_1 = require("./cache/database");
24
36
  Object.defineProperty(exports, "getRealm", { enumerable: true, get: function () { return database_1.getRealm; } });
@@ -35,6 +47,7 @@ Object.defineProperty(exports, "darkTheme", { enumerable: true, get: function ()
35
47
  Object.defineProperty(exports, "getTheme", { enumerable: true, get: function () { return styles_1.getTheme; } });
36
48
  Object.defineProperty(exports, "useStyleSheet", { enumerable: true, get: function () { return styles_1.useStyleSheet; } });
37
49
  // Utilities
50
+ __exportStar(require("./cache/actions/summaries"), exports);
38
51
  var sdk_1 = require("./utils/sdk");
39
52
  Object.defineProperty(exports, "initSDK", { enumerable: true, get: function () { return sdk_1.initSDK; } });
40
53
  Object.defineProperty(exports, "getSDK", { enumerable: true, get: function () { return sdk_1.getSDK; } });
@@ -2,9 +2,9 @@
2
2
  * ChatScreen - Navigation screen wrapper for individual chat view with connection status
3
3
  */
4
4
  import React from "react";
5
- import type { NativeStackScreenProps } from "@react-navigation/native-stack";
5
+ import type { StackScreenProps } from "@react-navigation/stack";
6
6
  import type { RootStackParamList } from "../types";
7
- type Props = NativeStackScreenProps<RootStackParamList, "Chat">;
7
+ type Props = StackScreenProps<RootStackParamList, "Chat">;
8
8
  export declare function ChatScreen({ route, navigation }: Props): React.JSX.Element;
9
9
  export {};
10
10
  //# sourceMappingURL=ChatScreen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChatScreen.d.ts","sourceRoot":"","sources":["../../src/screens/ChatScreen.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAoC,MAAM,OAAO,CAAC;AAEzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAU7E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAGnD,KAAK,KAAK,GAAG,sBAAsB,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;AAoBhE,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,KAAK,qBAqEtD"}
1
+ {"version":3,"file":"ChatScreen.d.ts","sourceRoot":"","sources":["../../src/screens/ChatScreen.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAoC,MAAM,OAAO,CAAC;AAEzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAUhE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAGnD,KAAK,KAAK,GAAG,gBAAgB,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;AAoB1D,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,KAAK,qBAqEtD"}
@@ -2,9 +2,9 @@
2
2
  * ConversationsScreen - Navigation screen wrapper for conversation list
3
3
  */
4
4
  import React from "react";
5
- import type { NativeStackScreenProps } from "@react-navigation/native-stack";
5
+ import type { StackScreenProps } from "@react-navigation/stack";
6
6
  import type { RootStackParamList } from "../types";
7
- type Props = NativeStackScreenProps<RootStackParamList, "Conversations">;
7
+ type Props = StackScreenProps<RootStackParamList, "Conversations">;
8
8
  export declare function ConversationsScreen({ navigation }: Props): React.JSX.Element;
9
9
  export {};
10
10
  //# sourceMappingURL=ConversationsScreen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConversationsScreen.d.ts","sourceRoot":"","sources":["../../src/screens/ConversationsScreen.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAE7E,OAAO,KAAK,EAAE,kBAAkB,EAAoB,MAAM,UAAU,CAAC;AAErE,KAAK,KAAK,GAAG,sBAAsB,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC;AAEzE,wBAAgB,mBAAmB,CAAC,EAAE,UAAU,EAAE,EAAE,KAAK,qBAoBxD"}
1
+ {"version":3,"file":"ConversationsScreen.d.ts","sourceRoot":"","sources":["../../src/screens/ConversationsScreen.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,KAAK,EAAE,kBAAkB,EAAoB,MAAM,UAAU,CAAC;AAErE,KAAK,KAAK,GAAG,gBAAgB,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC;AAEnE,wBAAgB,mBAAmB,CAAC,EAAE,UAAU,EAAE,EAAE,KAAK,qBAWxD"}
@@ -18,8 +18,5 @@ function ConversationsScreen({ navigation }) {
18
18
  groupId: conversation.group
19
19
  });
20
20
  };
21
- const handleCreateGroup = () => {
22
- navigation.navigate("CreateGroup");
23
- };
24
- return (<ConversationList_1.ConversationList onSelectConversation={handleSelectConversation} onCreateGroup={handleCreateGroup}/>);
21
+ return <ConversationList_1.ConversationList onSelectConversation={handleSelectConversation}/>;
25
22
  }
@@ -2,9 +2,9 @@
2
2
  * CreateGroupScreen - Admin-only screen for creating new groups
3
3
  */
4
4
  import React from "react";
5
- import type { NativeStackScreenProps } from "@react-navigation/native-stack";
5
+ import type { StackScreenProps } from "@react-navigation/stack";
6
6
  import type { RootStackParamList } from "../types";
7
- type Props = NativeStackScreenProps<RootStackParamList, "CreateGroup">;
7
+ type Props = StackScreenProps<RootStackParamList, "CreateGroup">;
8
8
  export declare function CreateGroupScreen({ navigation }: Props): React.JSX.Element;
9
9
  export {};
10
10
  //# sourceMappingURL=CreateGroupScreen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CreateGroupScreen.d.ts","sourceRoot":"","sources":["../../src/screens/CreateGroupScreen.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAiB7E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAMnD,KAAK,KAAK,GAAG,sBAAsB,CAAC,kBAAkB,EAAE,aAAa,CAAC,CAAC;AA6BvE,wBAAgB,iBAAiB,CAAC,EAAE,UAAU,EAAE,EAAE,KAAK,qBA2LtD"}
1
+ {"version":3,"file":"CreateGroupScreen.d.ts","sourceRoot":"","sources":["../../src/screens/CreateGroupScreen.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAiBhE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAMnD,KAAK,KAAK,GAAG,gBAAgB,CAAC,kBAAkB,EAAE,aAAa,CAAC,CAAC;AA6BjE,wBAAgB,iBAAiB,CAAC,EAAE,UAAU,EAAE,EAAE,KAAK,qBA2LtD"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * TypeScript types for React Native UI components
3
3
  */
4
- import type { ConversationSummary, Message as SDKMessage } from "sdk";
4
+ import type { ConversationSummary, Message as SDKMessage } from "@college-africa/chat-sdk";
5
5
  /**
6
6
  * React Navigation types
7
7
  */
@@ -45,7 +45,6 @@ export interface ChatAppProps {
45
45
  */
46
46
  export interface ConversationListProps {
47
47
  onSelectConversation: (conversation: ConversationItem) => void;
48
- onCreateGroup?: () => void;
49
48
  }
50
49
  /**
51
50
  * Props for ConversationItem component
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,KAAK,CAAC;AAEtE;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,aAAa,EAAE,SAAS,CAAC;IACzB,IAAI,EAAE;QACJ,cAAc,EAAE,MAAM,CAAC;QACvB,gBAAgB,EAAE,MAAM,CAAC;QACzB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,WAAW,EAAE,SAAS,CAAC;CACxB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,mBAAmB;IAC3D,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,UAAU;IACpD,eAAe,EAAE,MAAM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/B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,kBAAkB,EAAE,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,kBAAkB,CAAC;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
@@ -2,7 +2,7 @@
2
2
  * Message utilities - grouping and formatting
3
3
  * Pure functions copied from packages/ui/src/utils/messages.ts (lines 13-120)
4
4
  */
5
- import type { Message } from "sdk";
5
+ import type { Message } from "@college-africa/chat-sdk";
6
6
  /**
7
7
  * Message group (consecutive messages from same sender within time window)
8
8
  */
@@ -1 +1 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/utils/messages.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEnC;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,Q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AE,OAAO,EAAE,EACnB,YAAY,GAAE,MAAkC,GAC/C,YAAY,EAAE,CA8ChB;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,OAAO,EACb,YAAY,GAAE,MAAkC,GAC/C,OAAO,CAQT;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,GAAE,MAAW,GAAG,MAAM,CAarD;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,cAAc,YAAY,KAAG,MAE9D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,IAAI,MAAM,KAAG,YAShD,CAAC"}
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * SDK Singleton - Global SDK instance management
3
3
  */
4
- import { ChatSDK } from "sdk";
5
- import type { ChatClientConfig } from "sdk";
4
+ import { ChatSDK } from "@college-africa/chat-sdk";
5
+ import type { ChatClientConfig } from "@college-africa/chat-sdk";
6
6
  /**
7
7
  * Initialize the SDK singleton
8
8
  * @param config - Chat client configuration
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/utils/sdk.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAC9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAM5C;;;;;;GAMG;AACH,wBAAsB,OAAO,CAC3B,MAAM,EAAE,gBAAgB,EACxB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,OAAO,CAAC,CAmClB;AAED;;;;GAIG;AACH,wBAAgB,MAAM,IAAI,OAAO,CAKhC;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAKpC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C"}
1
+ {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/utils/sdk.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAMjE;;;;;;GAMG;AACH,wBAAsB,OAAO,CAC3B,MAAM,EAAE,gBAAgB,EACxB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,OAAO,CAAC,CAmClB;AAED;;;;GAIG;AACH,wBAAgB,MAAM,IAAI,OAAO,CAKhC;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAKpC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C"}
package/dist/utils/sdk.js CHANGED
@@ -7,7 +7,7 @@ exports.initSDK = initSDK;
7
7
  exports.getSDK = getSDK;
8
8
  exports.disconnectSDK = disconnectSDK;
9
9
  exports.isSDKInitialized = isSDKInitialized;
10
- const sdk_1 = require("sdk");
10
+ const chat_sdk_1 = require("@college-africa/chat-sdk");
11
11
  const messages_1 = require("../cache/actions/messages");
12
12
  const users_1 = require("../cache/actions/users");
13
13
  let sdkInstance = null;
@@ -22,7 +22,7 @@ async function initSDK(config, token) {
22
22
  if (sdkInstance)
23
23
  return sdkInstance;
24
24
  // Create SDK instance with React Native's WebSocket
25
- sdkInstance = new sdk_1.ChatSDK({
25
+ sdkInstance = new chat_sdk_1.ChatSDK({
26
26
  ...config,
27
27
  wsImplementation: WebSocket
28
28
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@college-africa/chat-ui-native",
3
- "version": "0.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "React Native chat UI library for College Africa",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -23,7 +23,7 @@
23
23
  ],
24
24
  "peerDependencies": {
25
25
  "@react-navigation/native": "^6.0.0 || ^7.0.0",
26
- "@react-navigation/native-stack": "^6.0.0 || ^7.0.0",
26
+ "@react-navigation/stack": "^6.0.0 || ^7.0.0",
27
27
  "react": ">=18.0.0",
28
28
  "react-native": ">=0.70.0",
29
29
  "react-native-paper": "^5.0.0",
@@ -36,7 +36,7 @@
36
36
  "event-target-polyfill": "^0.0.4",
37
37
  "formik": "^2.4.5",
38
38
  "realm": "^12.0.0",
39
- "sdk": "npm:@college-africa/chat-sdk@^1.1.0",
39
+ "@college-africa/chat-sdk": "1.1.2",
40
40
  "yup": "^1.3.3"
41
41
  },
42
42
  "devDependencies": {