@ethora/chat-component-rn 26.4.1

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 (273) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +148 -0
  3. package/empty-shim.js +15 -0
  4. package/index.js +13 -0
  5. package/metro.js +72 -0
  6. package/package.json +99 -0
  7. package/src/api.config.ts +34 -0
  8. package/src/assets/BG.png +0 -0
  9. package/src/assets/BG.tsx +56 -0
  10. package/src/assets/File.svg +4 -0
  11. package/src/assets/ForzaCare.png +0 -0
  12. package/src/assets/ForzaCare.tsx +27 -0
  13. package/src/assets/icons.tsx +685 -0
  14. package/src/assets/images.tsx +41 -0
  15. package/src/assets/test.xml +243 -0
  16. package/src/components/AuthForms/Login.tsx +295 -0
  17. package/src/components/AuthForms/LoginAnonym.tsx +68 -0
  18. package/src/components/AuthForms/Register.tsx +8 -0
  19. package/src/components/ContextMenu/ContextMenuComponents.tsx +87 -0
  20. package/src/components/DropdownMenu/DropdownMenu.tsx +244 -0
  21. package/src/components/ExampleComponents/CustomMessage.tsx +92 -0
  22. package/src/components/ExampleComponents/CustomTypingIndicatorExamples.tsx +239 -0
  23. package/src/components/Header/HeaderRoomList.tsx +104 -0
  24. package/src/components/InputComponents/AudioInput.tsx +24 -0
  25. package/src/components/InputComponents/AudioRecorder.tsx +100 -0
  26. package/src/components/InputComponents/MediaInput.tsx +114 -0
  27. package/src/components/InputComponents/RecordingIndicator.tsx +77 -0
  28. package/src/components/InputComponents/Search.tsx +135 -0
  29. package/src/components/InputComponents/TextInput.tsx +66 -0
  30. package/src/components/MainComponents/ChatHeader.tsx +163 -0
  31. package/src/components/MainComponents/ChatRoom.tsx +392 -0
  32. package/src/components/MainComponents/ChatWrapper.tsx +318 -0
  33. package/src/components/MainComponents/ChooseChatMessage.tsx +44 -0
  34. package/src/components/MainComponents/ConnectionBanner.tsx +33 -0
  35. package/src/components/MainComponents/EditWrapper.tsx +72 -0
  36. package/src/components/MainComponents/LoginWrapper.tsx +134 -0
  37. package/src/components/MainComponents/MediaMessage.tsx +55 -0
  38. package/src/components/MainComponents/MessageContainer.tsx +122 -0
  39. package/src/components/MainComponents/MessageList.tsx +429 -0
  40. package/src/components/MainComponents/NoMessagesPlaceholder.tsx +49 -0
  41. package/src/components/MainComponents/ProfileImagePlaceholder.tsx +143 -0
  42. package/src/components/MainComponents/RNStyled.tsx +34 -0
  43. package/src/components/MainComponents/ReduxWrapper.tsx +40 -0
  44. package/src/components/MainComponents/RoomList.tsx +246 -0
  45. package/src/components/MainComponents/Select.tsx +165 -0
  46. package/src/components/MainComponents/Switch.tsx +73 -0
  47. package/src/components/MainComponents/SystemMessage.tsx +42 -0
  48. package/src/components/Menu/HeaderRoomListMenu.tsx +169 -0
  49. package/src/components/MenuRoom/MenuRoom.tsx +46 -0
  50. package/src/components/MessageBubble/Avatar.tsx +84 -0
  51. package/src/components/MessageBubble/BottomReplyContainer.tsx +117 -0
  52. package/src/components/MessageBubble/CustomDivider.tsx +10 -0
  53. package/src/components/MessageBubble/DeletedMessage.tsx +36 -0
  54. package/src/components/MessageBubble/Message.tsx +400 -0
  55. package/src/components/MessageBubble/MessageInteractions.tsx +247 -0
  56. package/src/components/MessageBubble/MessageReaction.tsx +149 -0
  57. package/src/components/MessageBubble/MessageReply.tsx +50 -0
  58. package/src/components/MessageBubble/MessageTranslations.tsx +30 -0
  59. package/src/components/Modals/AddMembersModal/AddMembersModal.tsx +142 -0
  60. package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +471 -0
  61. package/src/components/Modals/ChatProfileModal/DeleteChatModal.tsx +91 -0
  62. package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +298 -0
  63. package/src/components/Modals/Modal/Modal.tsx +52 -0
  64. package/src/components/Modals/ModalHeaderComponent.tsx +41 -0
  65. package/src/components/Modals/ModalSelectMedia/ModalSelectMedia.tsx +285 -0
  66. package/src/components/Modals/ModalWrapper/ModalWrapper.tsx +103 -0
  67. package/src/components/Modals/NewChatModal/ModalContent.tsx +151 -0
  68. package/src/components/Modals/NewChatModal/NewChatModal.tsx +391 -0
  69. package/src/components/Modals/NewChatModal/UpdNewChatModal.tsx +136 -0
  70. package/src/components/Modals/SelectUsersModal/SelectUsersModal.tsx +134 -0
  71. package/src/components/Modals/SettingsModals/BlockedUsers/BlockedUsersModal.tsx +63 -0
  72. package/src/components/Modals/SettingsModals/DocumentShares/DocumentSharesModal.tsx +115 -0
  73. package/src/components/Modals/SettingsModals/ManageDataModal/ManageDataModal.tsx +121 -0
  74. package/src/components/Modals/SettingsModals/ManageDataModal/StyledComponents.ts +0 -0
  75. package/src/components/Modals/SettingsModals/ProfileShares/ProfileShares.tsx +65 -0
  76. package/src/components/Modals/SettingsModals/Referrals/Referrals.tsx +90 -0
  77. package/src/components/Modals/SettingsModals/SharedStyledComponents.ts +74 -0
  78. package/src/components/Modals/SettingsModals/Visibility/RadioInput.tsx +59 -0
  79. package/src/components/Modals/SettingsModals/Visibility/StyledComponents.ts +32 -0
  80. package/src/components/Modals/SettingsModals/Visibility/VisibilityModal.tsx +146 -0
  81. package/src/components/Modals/UserProfileModal/EditUserModal.tsx +163 -0
  82. package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +410 -0
  83. package/src/components/Modals/UserSettingsModal/UserSettingsModal.tsx +85 -0
  84. package/src/components/Modals/styledModalComponents.tsx +181 -0
  85. package/src/components/OperationalModal/OperationalModal.tsx +78 -0
  86. package/src/components/RoomComponents/ChatRoomItem.tsx +219 -0
  87. package/src/components/RoomComponents/LastMessageItem.tsx +47 -0
  88. package/src/components/RoomComponents/styled/LastAudioMessage.tsx +62 -0
  89. package/src/components/RoomComponents/styled/LastMessageEmoji.tsx +26 -0
  90. package/src/components/RoomComponents/styled/LastMessageFile.tsx +54 -0
  91. package/src/components/RoomComponents/styled/LastMessagePhoto.tsx +54 -0
  92. package/src/components/RoomComponents/styled/LastMessageVideo.tsx +70 -0
  93. package/src/components/RoomComponents/styled/LastTextMessage.tsx +65 -0
  94. package/src/components/RoomComponents/styled/StyledRoomComponents.ts +53 -0
  95. package/src/components/SortDropDown/index.tsx +76 -0
  96. package/src/components/Thread/ThreadHeader.tsx +41 -0
  97. package/src/components/Thread/ThreadWrapper.tsx +270 -0
  98. package/src/components/Toast/Toast.tsx +128 -0
  99. package/src/components/Toast/index.ts +13 -0
  100. package/src/components/UsersList/StyledComponents.ts +30 -0
  101. package/src/components/UsersList/UsersList.tsx +112 -0
  102. package/src/components/styled/ActionButton.tsx +40 -0
  103. package/src/components/styled/AudioMessage.tsx +82 -0
  104. package/src/components/styled/Button.tsx +107 -0
  105. package/src/components/styled/ChatWrapperBox.tsx +9 -0
  106. package/src/components/styled/DateLabel.tsx +77 -0
  107. package/src/components/styled/Loader.tsx +65 -0
  108. package/src/components/styled/MediaFilePreview.tsx +42 -0
  109. package/src/components/styled/MediaModal.tsx +54 -0
  110. package/src/components/styled/MessageImage.tsx +54 -0
  111. package/src/components/styled/NewMessageLabel.tsx +50 -0
  112. package/src/components/styled/RoomListComponents/index.tsx +164 -0
  113. package/src/components/styled/SendInput.tsx +297 -0
  114. package/src/components/styled/StyledComponents.ts +320 -0
  115. package/src/components/styled/StyledInput.tsx +101 -0
  116. package/src/components/styled/StyledInputComponents/AudioComponents.tsx +1 -0
  117. package/src/components/styled/StyledInputComponents/Composing.tsx +97 -0
  118. package/src/components/styled/StyledInputComponents/CustomTypingIndicator.tsx +261 -0
  119. package/src/components/styled/StyledInputComponents/MediaComponents.tsx +90 -0
  120. package/src/components/styled/StyledInputComponents/StyledInputComponents.tsx +131 -0
  121. package/src/components/styled/StyledInputComponents/VideoComponents.tsx +49 -0
  122. package/src/components/styled/TreadLabel.tsx +50 -0
  123. package/src/components/styled/UnsupportedType.tsx +95 -0
  124. package/src/components/styled/VideoMessage.tsx +68 -0
  125. package/src/context/MessageNotificationContext.tsx +335 -0
  126. package/src/context/PushNotificationProvider.tsx +78 -0
  127. package/src/context/ToastContext.tsx +63 -0
  128. package/src/context/toastProvider.tsx +0 -0
  129. package/src/context/xmppProvider.tsx +364 -0
  130. package/src/helpers/block_scroll.ts +95 -0
  131. package/src/helpers/chatAutoEnterer.ts +46 -0
  132. package/src/helpers/checkUniqueUsers.tsx +31 -0
  133. package/src/helpers/constants/CHAT_TYPES.ts +6 -0
  134. package/src/helpers/constants/LANGUAGE_OPTIONS.ts +14 -0
  135. package/src/helpers/constants/LOCAL_STORAGE.ts +3 -0
  136. package/src/helpers/constants/MESSAGE_INTERACTIONS.ts +29 -0
  137. package/src/helpers/constants/MODAL_TYPES.ts +57 -0
  138. package/src/helpers/constants/PLATFORM_CONSTANTS.ts +3 -0
  139. package/src/helpers/createMainMessageForThread.ts +23 -0
  140. package/src/helpers/createMessageFromXml.ts +118 -0
  141. package/src/helpers/createRoomFromApi.tsx +27 -0
  142. package/src/helpers/createUserNameFromSetUser.ts +15 -0
  143. package/src/helpers/dateComparison.ts +12 -0
  144. package/src/helpers/debounce.ts +10 -0
  145. package/src/helpers/ensureScopedChatCache.ts +61 -0
  146. package/src/helpers/extractUniqueMembersFromRooms.ts +45 -0
  147. package/src/helpers/formatNumberWithCommas.ts +3 -0
  148. package/src/helpers/getBooleanFromString.ts +7 -0
  149. package/src/helpers/getDataFromXml.ts +80 -0
  150. package/src/helpers/getNumberFromString.ts +5 -0
  151. package/src/helpers/getRoomsWithRetry.ts +45 -0
  152. package/src/helpers/getTintedColor.ts +28 -0
  153. package/src/helpers/getUnnamedUsers.ts +39 -0
  154. package/src/helpers/handleCopyClick.ts +3 -0
  155. package/src/helpers/handleXmppError.ts +14 -0
  156. package/src/helpers/hashcolor.ts +34 -0
  157. package/src/helpers/historyPreloadScheduler.ts +264 -0
  158. package/src/helpers/initRoomsPresence.ts +32 -0
  159. package/src/helpers/initXmppRooms.tsx +71 -0
  160. package/src/helpers/insertMessageWithDelimiter.ts +96 -0
  161. package/src/helpers/isChatIdPresentInArray.ts +54 -0
  162. package/src/helpers/localStorageUser.ts +9 -0
  163. package/src/helpers/markdownParser.tsx +295 -0
  164. package/src/helpers/nanoToMs.ts +3 -0
  165. package/src/helpers/parseMessageBody.tsx +516 -0
  166. package/src/helpers/parseUrls.tsx +42 -0
  167. package/src/helpers/resolveInitBeforeLoadUser.ts +240 -0
  168. package/src/helpers/storeConsole.ts +26 -0
  169. package/src/helpers/transformTranslatations.ts +16 -0
  170. package/src/helpers/updateMessagesTillLast.tsx +104 -0
  171. package/src/helpers/updatedChatLastTimestamps.ts +29 -0
  172. package/src/helpers/validator.ts +20 -0
  173. package/src/helpers/walletUsername.ts +12 -0
  174. package/src/hooks/hooks.ts +6 -0
  175. package/src/hooks/useChatSettingState.tsx +38 -0
  176. package/src/hooks/useChatWrapperInit.ts +266 -0
  177. package/src/hooks/useComposing.tsx +59 -0
  178. package/src/hooks/useCustomTypingIndicator.tsx +193 -0
  179. package/src/hooks/useEventHandlers.tsx +81 -0
  180. package/src/hooks/useGetNewArchRoom.tsx +57 -0
  181. package/src/hooks/useHeapSender.tsx +88 -0
  182. package/src/hooks/useLocalStorage.tsx +53 -0
  183. package/src/hooks/useLogout.tsx +31 -0
  184. package/src/hooks/useMessageHeapState.tsx +11 -0
  185. package/src/hooks/useMessageLoaderQueue.tsx +90 -0
  186. package/src/hooks/useMessageQueue.ts +146 -0
  187. package/src/hooks/usePendingNotification.ts +49 -0
  188. package/src/hooks/usePrevious.tsx +15 -0
  189. package/src/hooks/usePushNotifications.ts +106 -0
  190. package/src/hooks/useQRCodeChatHandler.ts +58 -0
  191. package/src/hooks/useRoomInitialization.tsx +160 -0
  192. package/src/hooks/useRoomState.tsx +47 -0
  193. package/src/hooks/useRoomUrl.tsx +41 -0
  194. package/src/hooks/useSendMessage.tsx +306 -0
  195. package/src/hooks/useUnreadMessagesCounter.ts +55 -0
  196. package/src/hooks/useXmppInitialization.ts +148 -0
  197. package/src/main.ts +45 -0
  198. package/src/networking/api-requests/auth.api.ts +140 -0
  199. package/src/networking/api-requests/push.api.ts +55 -0
  200. package/src/networking/api-requests/roomMembers.api.ts +20 -0
  201. package/src/networking/api-requests/rooms.api.ts +142 -0
  202. package/src/networking/api-requests/user.api.ts +65 -0
  203. package/src/networking/apiClient.ts +149 -0
  204. package/src/networking/helpers/refreshChecker.ts +13 -0
  205. package/src/networking/stanzaHandlers.ts +418 -0
  206. package/src/networking/xmpp/actionSetTimestampToPrivateStore.xmpp.ts +37 -0
  207. package/src/networking/xmpp/allRoomPresences.xmpp.ts +10 -0
  208. package/src/networking/xmpp/createPrivateRoom.xmpp.ts +26 -0
  209. package/src/networking/xmpp/createRoom.xmpp.ts +35 -0
  210. package/src/networking/xmpp/createRoomPresence.xmpp.ts +74 -0
  211. package/src/networking/xmpp/createTimeoutPromise.xmpp.ts +15 -0
  212. package/src/networking/xmpp/deleteMessage.xmpp.ts +19 -0
  213. package/src/networking/xmpp/editMessage.xmpp.ts +46 -0
  214. package/src/networking/xmpp/getChatsPrivateStoreRequest.xmpp.ts +57 -0
  215. package/src/networking/xmpp/getHistory.xmpp.ts +140 -0
  216. package/src/networking/xmpp/getLastMessageArchive.xmpp.ts +24 -0
  217. package/src/networking/xmpp/getRoomInfo.xmpp.ts +15 -0
  218. package/src/networking/xmpp/getRoomMembers.xmpp.ts +13 -0
  219. package/src/networking/xmpp/getRooms.xmpp.ts +43 -0
  220. package/src/networking/xmpp/getRoomsPaged.xmpp.ts +59 -0
  221. package/src/networking/xmpp/handlePong.xmpp.ts +7 -0
  222. package/src/networking/xmpp/handleStanzas.xmpp.ts +55 -0
  223. package/src/networking/xmpp/inviteRoomRequest.xmpp.ts +25 -0
  224. package/src/networking/xmpp/leaveTheRoom.xmpp.ts +15 -0
  225. package/src/networking/xmpp/listenerManager.ts +116 -0
  226. package/src/networking/xmpp/presenceInRoom.xmpp.ts +57 -0
  227. package/src/networking/xmpp/roomConfig.xmpp.ts +71 -0
  228. package/src/networking/xmpp/sendMediaMessage.xmpp.ts +97 -0
  229. package/src/networking/xmpp/sendMessageReaction.xmpp.ts +41 -0
  230. package/src/networking/xmpp/sendPing.xmpp.ts +21 -0
  231. package/src/networking/xmpp/sendTextMessage.xmpp.ts +99 -0
  232. package/src/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.ts +44 -0
  233. package/src/networking/xmpp/sendTypingRequest.xmpp.ts +26 -0
  234. package/src/networking/xmpp/setChatsPrivateStoreRequest.xmpp.ts +48 -0
  235. package/src/networking/xmpp/setMeAsOwner.xmpp.ts +52 -0
  236. package/src/networking/xmpp/setRoomImage.xmpp.ts +26 -0
  237. package/src/networking/xmpp/setVCard.xmpp.ts +19 -0
  238. package/src/networking/xmpp/subscribeToRoomMessages.xmpp.ts +75 -0
  239. package/src/networking/xmppClient.ts +603 -0
  240. package/src/roomStore/Middleware/logoutMiddleware.tsx +24 -0
  241. package/src/roomStore/Middleware/newMessageMidlleware.tsx +87 -0
  242. package/src/roomStore/Middleware/reactionsMiddleware.tsx +77 -0
  243. package/src/roomStore/Middleware/testMiddleware.tsx +20 -0
  244. package/src/roomStore/Middleware/unreadMidlleware.tsx +58 -0
  245. package/src/roomStore/chatSettingsSlice.ts +178 -0
  246. package/src/roomStore/index.ts +68 -0
  247. package/src/roomStore/persistence.ts +152 -0
  248. package/src/roomStore/roomHeapSlice.ts +37 -0
  249. package/src/roomStore/roomsSlice.ts +353 -0
  250. package/src/services/pushNotifications.ts +170 -0
  251. package/src/services/pushSubscriptionService.ts +145 -0
  252. package/src/types/messages.ts +61 -0
  253. package/src/types/models/action.model.ts +30 -0
  254. package/src/types/models/config.model.ts +16 -0
  255. package/src/types/models/customComponents.model.ts +53 -0
  256. package/src/types/models/language.model.ts +11 -0
  257. package/src/types/models/media.model.ts +5 -0
  258. package/src/types/models/message.model.ts +69 -0
  259. package/src/types/models/modal.model.ts +9 -0
  260. package/src/types/models/room.model.ts +120 -0
  261. package/src/types/models/user.model.ts +90 -0
  262. package/src/types/models/xmpp.model.ts +155 -0
  263. package/src/types/types.ts +505 -0
  264. package/src/utils/PriorityQueue.ts +47 -0
  265. package/src/utils/actionHelpers.ts +40 -0
  266. package/src/utils/actionLogger.ts +64 -0
  267. package/src/utils/clientRegistry.ts +80 -0
  268. package/src/utils/devLogger.ts +197 -0
  269. package/src/utils/messageNotificationManager.ts +108 -0
  270. package/src/utils/resendMessage.ts +87 -0
  271. package/src/utils/toastEmitter.ts +27 -0
  272. package/src/utils/xmppMemoryMonitor.ts +63 -0
  273. package/src/version.ts +1 -0
@@ -0,0 +1,61 @@
1
+ export interface MainFields {
2
+ id: string;
3
+ body: string;
4
+ roomJID: string;
5
+ date: Date;
6
+ key: string;
7
+ coinsInMessage: number;
8
+ numberOfReplies: number;
9
+ }
10
+
11
+ export interface DataFields {
12
+ photoURL: string; // sender's photo
13
+ roomJid: string; // room JID (which room message belongs to) TO DO: remove this from Data - looks like a duplicate ?
14
+ senderFirstName: string; // TO DO: review - may replace with vCard / users store
15
+ senderLastName: string; // TO DO: review - may replace with vCard / users store
16
+ senderWalletAddress: string; // TO DO: review - may be deprecated, we can derive this from 'from' user's JID
17
+ senderJID?: string;
18
+ xmlns?: string; // probably system - websockets endpoint? not sure if used
19
+ isEdited?: boolean; // if message was edited (to display 'edited' in UI)
20
+
21
+ // push notifications
22
+ mucName?: string; // chat Room name to display in Push Notifications
23
+ push?: boolean; // specifies whether this message should be included in push notifications. Offline users subscribed to the Room will receive push alerts to their devices for those messages that have this parameter enabled. Should be enabled for all standard messages. E.g. don't specify this for system messages.
24
+
25
+ // replies and threads
26
+ quickReplies?: string[]; // number of responses in the thread ? TO DO: review, may be deprecated due to threads feature
27
+ isReply?: boolean; // if this is a response to another message (replies/threads)
28
+ showInChannel?: boolean; // for thread responses, whether user ticked 'copy to room', if not this will only be shown in the thread
29
+ mainMessage?: string; // for thread responses, the ID of the main message (or text quote?)
30
+
31
+ // system messages
32
+ isSystemMessage?: boolean; // if this flag is set, App UI will not process this as a standard text message, and will instead process this as a system message. For example, this could be a system message informing others about a Coin transfer from one User to another. Such message will be displayed in a different, more subtle way, in order to not clutter the Room
33
+ tokenAmount?: number; // (system message) for coin transfers - the number of tokens being sent - used in system type transfer messages. Typically this is used for “tipping” or social ranking mechanism. Users can tap on Messages of other users and tip them with Coins. Message will display a counter of Coins received, similarly to ‘likes’ in social networks
34
+ receiverMessageId?: boolean; // (system message) for coin transfers - the ID of the message that receives the transfer
35
+ }
36
+
37
+ export interface FileAttachmentParams {
38
+ createdAt: Date; // when file was created (from our API - mongodb)
39
+ fileName: string; // for file attachments this is used to display the file name
40
+ imageLocation: string; // for file attachments this is URL of the file itself, typically from our IPFS or Minio buckets based files service
41
+ imagePreview: string; // for file attachments that are pictures and some other supported file types (PDF etc) this will be a path to the preview / thumbnail version of the attachment
42
+ mimeType: string; // for file attachments this is the mimeType of the file, so that App interface can display the correct UI and/or icon (e.g. PDF, DOC) for this type of file
43
+ originalName: string; // similar to fileName, but uses full system name of the file attachments including extension etc. TF: either this or fileName may be deprecated
44
+ size: number; // for file attachments this will be used to display the file size so that users can estimate the impact of opening or downloading it
45
+ duration: number; // for attachments that are audio or video, this is their duration in seconds to inform the users how long it would take to to play it
46
+ waveForm: string; // for attachments that are audio, this will display the waveForm so that users can visually estimate the contents of the record
47
+ attachmentId: string; // this refers to the file object ID as per /files/ API. This is used to enable actions over the files in certain use cases
48
+ }
49
+
50
+ export interface NFTAttachmentParams {
51
+ wrappable: boolean; // this is used for the purposes of digital art and NFT. If enabled, this means users can wrap this content into NFT
52
+ nftId: string; // this is used for the purposes of digital art and NFT. This is used to link content with an NFT collection
53
+ nftActionType: string; // this is used for the purposes of digital art and NFT. This is to inform App interface of what type of actions are available
54
+ contractAddress: string; // this is used when messages are linked to smart contracts
55
+ }
56
+
57
+ export interface MessageType extends MainFields, DataFields {}
58
+
59
+ export interface FileAttachment extends MainFields, FileAttachmentParams {}
60
+
61
+ export interface NFTAttachment extends MainFields, NFTAttachmentParams {}
@@ -0,0 +1,30 @@
1
+ import { IMessage } from './message.model';
2
+
3
+ export interface DeleteModal {
4
+ isDeleteModal: boolean;
5
+ roomJid?: string;
6
+ messageId?: string;
7
+ }
8
+
9
+ export interface EditAction {
10
+ isEdit: boolean;
11
+ roomJid?: string;
12
+ messageId?: string;
13
+ text?: string;
14
+ }
15
+
16
+ // Consolidated ReactionAction, using the more comprehensive definition
17
+ export interface ReactionAction {
18
+ roomJID: string;
19
+ messageId: string;
20
+ from: string; // Included from the first definition
21
+ reactions: string[];
22
+ latestReactionTimestamp?: string; // Included from the first definition
23
+ data?: Record<string, string>; // Included from the first definition
24
+ }
25
+
26
+ export interface AddRoomMessageAction {
27
+ roomJID: string;
28
+ message: IMessage;
29
+ start?: boolean;
30
+ }
@@ -0,0 +1,16 @@
1
+ // Canonical IConfig now lives in `src/types/types.ts` (it's the surface
2
+ // the XMPP provider, ChatWrapper, useSendMessage, persistence, scheduler,
3
+ // and notification provider all import). This file re-exports it so the
4
+ // UI layer (which imports from `types/models/config.model`) keeps working
5
+ // without drifting from the flow layer.
6
+ //
7
+ // Add NEW fields to `src/types/types.ts:IConfig`, not here.
8
+
9
+ export type {
10
+ IConfig,
11
+ FBConfig,
12
+ MessageBubble,
13
+ PartialRoomWithMandatoryKeys,
14
+ HistoryQoSConfig,
15
+ InAppNotificationConfig,
16
+ } from '../types';
@@ -0,0 +1,53 @@
1
+ /** @format */
2
+
3
+ import React from 'react';
4
+ import { IConfig, IMessage, MessageProps } from '../types';
5
+ import { ViewStyle } from 'react-native';
6
+
7
+ export interface DaySeparatorProps {
8
+ date: Date;
9
+ formattedDate: string;
10
+ }
11
+
12
+ export interface NewMessageLabelProps {
13
+ color?: string;
14
+ }
15
+
16
+ export interface DecoratedMessage {
17
+ message: IMessage;
18
+ showDateLabel: boolean;
19
+ }
20
+
21
+ export interface ScrollControllerApi {
22
+ scrollToBottom: () => void;
23
+ waitForImagesLoaded: () => Promise<void>;
24
+ showScrollButton: boolean;
25
+ newMessagesCount: number;
26
+ resetNewMessageCounter: () => void;
27
+ }
28
+
29
+ export interface CustomScrollableAreaProps {
30
+ roomJID: string;
31
+ messages: IMessage[];
32
+ decoratedMessages: DecoratedMessage[];
33
+ isLoading: boolean;
34
+ isReply: boolean;
35
+ activeMessage?: IMessage;
36
+ loadMoreMessages: (
37
+ chatJID: string,
38
+ max: number,
39
+ amount?: number
40
+ ) => Promise<void>;
41
+ renderMessage: (decorated: DecoratedMessage) => React.ReactNode;
42
+ scrollController: ScrollControllerApi;
43
+ typingIndicator?: React.ReactNode;
44
+ config?: IConfig;
45
+ }
46
+
47
+ export interface CustomComponentsContextValue {
48
+ CustomMessageComponent?: React.ComponentType<MessageProps>;
49
+ CustomInputComponent?: React.ComponentType<any>;
50
+ CustomScrollableArea?: React.ComponentType<CustomScrollableAreaProps>;
51
+ CustomDaySeparator?: React.ComponentType<DaySeparatorProps>;
52
+ CustomNewMessageLabel?: React.ComponentType<NewMessageLabelProps>;
53
+ }
@@ -0,0 +1,11 @@
1
+ export type Iso639_1Codes = 'en' | 'es' | 'pt' | 'ht' | 'zh';
2
+
3
+ export interface Language {
4
+ iso639_1: Iso639_1Codes;
5
+ name: string;
6
+ }
7
+
8
+ export type LanguageOptions = {
9
+ languages: Array<Language>;
10
+ language?: Iso639_1Codes;
11
+ };
@@ -0,0 +1,5 @@
1
+ export type MediaFile = {
2
+ uri: string;
3
+ type: string;
4
+ name: string;
5
+ };
@@ -0,0 +1,69 @@
1
+ import { IUser } from './user.model';
2
+ import { TranslationObject } from '../types';
3
+ import { Iso639_1Codes } from './language.model';
4
+
5
+ export interface IMessage {
6
+ id: string;
7
+ user: IUser;
8
+ date: Date | string;
9
+ body: string;
10
+ roomJid: string;
11
+ key?: string;
12
+ coinsInMessage?: string | number;
13
+ numberOfReplies?: number[] | number;
14
+ isSystemMessage?: string;
15
+ isMediafile?: string;
16
+ locationPreview?: string;
17
+ mimetype?: string;
18
+ location?: string;
19
+ pending?: boolean;
20
+ timestamp?: number;
21
+ showInChannel?: string;
22
+ activeMessage?: boolean;
23
+ isReply?: boolean | string;
24
+ isDeleted?: boolean;
25
+ mainMessage?: string;
26
+ reply?: IReply[];
27
+ reaction?: Record<string, ReactionMessage>;
28
+ fileName?: string;
29
+ translations?: TranslationObject;
30
+ langSource?: Iso639_1Codes;
31
+ originalName?: string;
32
+ size?: string;
33
+ xmppId?: string;
34
+ xmppFrom?: string;
35
+ deleted?: boolean;
36
+ }
37
+
38
+ export interface ReactionMessage {
39
+ emoji: string[];
40
+ data: Record<string, string> | undefined;
41
+ }
42
+
43
+ export interface IReply extends IMessage {}
44
+
45
+ export interface MessageBubble {
46
+ backgroundMessageUser?: string;
47
+ backgroundMessage?: string;
48
+ colorUser?: string;
49
+ color?: string;
50
+ borderRadius?: number;
51
+ }
52
+
53
+ export interface MessageProps {
54
+ message: IMessage;
55
+ isUser: boolean;
56
+ isReply: boolean;
57
+ }
58
+
59
+ export interface MediaMessageType {}
60
+
61
+ export interface LastMessage extends Omit<Partial<IMessage>, 'date'> {
62
+ body: string;
63
+ date?: string | Date;
64
+ emoji?: string;
65
+ locationPreview?: string;
66
+ filename?: string;
67
+ mimetype?: string;
68
+ originalName?: string;
69
+ }
@@ -0,0 +1,9 @@
1
+ import { MODAL_TYPES } from '../types'; // Corrected path to use re-export from types.ts
2
+
3
+ export type ModalType = (typeof MODAL_TYPES)[keyof typeof MODAL_TYPES];
4
+
5
+ export interface ModalFile {
6
+ fileName: string;
7
+ fileURL: string;
8
+ mimetype: string;
9
+ }
@@ -0,0 +1,120 @@
1
+ import { IMessage, LastMessage } from './message.model';
2
+
3
+ export interface RoomMember {
4
+ firstName: string;
5
+ lastName: string;
6
+ xmppUsername: string;
7
+ _id: string;
8
+
9
+ ban_status?: string;
10
+ jid?: string;
11
+ name?: string;
12
+ role?: string;
13
+ last_active?: number;
14
+ }
15
+
16
+ export interface RoomLastMessage {
17
+ name: string;
18
+ body: string;
19
+ }
20
+
21
+ export interface IRoom {
22
+ name: string;
23
+ jid: string;
24
+ title: string;
25
+ usersCnt: number;
26
+ messages: IMessage[];
27
+ isLoading: boolean;
28
+ roomBg: string | null;
29
+
30
+ members?: RoomMember[];
31
+ type?: 'public' | 'group' | 'private';
32
+ creteadAt?: string; // Typo? Should it be createdAt?
33
+
34
+ appId?: string;
35
+ createdAt?: string;
36
+ createdBy?: string;
37
+ description?: string;
38
+ isAppChat?: boolean;
39
+ picture?: string;
40
+ updatedAt?: string;
41
+ __v?: number | string;
42
+ _id?: string;
43
+
44
+ id?: string;
45
+ lastMessage?: LastMessage;
46
+ lastMessageTimestamp?: number;
47
+ lastRoomMessage?: RoomLastMessage;
48
+ icon?: string | null;
49
+ composing?: boolean;
50
+ composingList?: string[];
51
+ lastViewedTimestamp?: number;
52
+ unreadMessages?: number;
53
+ noMessages?: boolean;
54
+ role?: string;
55
+
56
+ messageStats?: {
57
+ lastMessageTimestamp?: number;
58
+ firstMessageTimestamp?: number;
59
+ };
60
+ historyComplete?: boolean;
61
+ }
62
+
63
+ export interface ApiRoom {
64
+ name: string;
65
+ type: 'public' | 'group' | 'private';
66
+
67
+ title?: string;
68
+ description?: string;
69
+ picture?: string;
70
+ members?: RoomMember[];
71
+ createdBy?: string;
72
+ appId?: any;
73
+
74
+ _id?: string;
75
+ isAppChat?: boolean;
76
+ createdAt?: string;
77
+ updatedAt?: string;
78
+ __v?: string;
79
+ }
80
+
81
+ export interface PostRoom {
82
+ title: string;
83
+ uuid?: string;
84
+ type: 'public' | 'group';
85
+
86
+ description?: string;
87
+ picture?: string;
88
+ members?: string[];
89
+ }
90
+
91
+ export interface PostReportRoom {
92
+ chatName: string;
93
+ category: string;
94
+ text?: string;
95
+ }
96
+
97
+ export interface PostAddRoomMember {
98
+ chatName: string;
99
+ members: string[];
100
+ }
101
+
102
+ export interface DeleteRoomMember {
103
+ roomId: string;
104
+ members: string[];
105
+ }
106
+
107
+ export interface IRoomCompressed extends Pick<IRoom, 'jid'> {}
108
+
109
+ export type PartialRoomWithMandatoryKeys = Partial<IRoom> &
110
+ Pick<IRoom, 'jid' | 'title'>;
111
+
112
+ export interface ConfigRoom {
113
+ jid: string;
114
+ pinned: boolean;
115
+ _id?: string;
116
+ }
117
+
118
+ export type ChatAccessOption =
119
+ | { name: 'Public'; id: 'public' }
120
+ | { name: 'Members-only'; id: 'group' };
@@ -0,0 +1,90 @@
1
+ import { Iso639_1Codes } from './language.model';
2
+ import { IMessage } from './message.model';
3
+
4
+ export interface IUser extends Partial<User> {
5
+ id: string;
6
+ name?: string;
7
+ userJID?: string | null;
8
+ token?: string;
9
+ refreshToken?: string;
10
+ }
11
+
12
+ export interface User {
13
+ walletAddress: string;
14
+
15
+ description?: string;
16
+ token: string;
17
+ refreshToken: string;
18
+
19
+ defaultWallet: {
20
+ walletAddress: string;
21
+ };
22
+ _id: string;
23
+ firstName: string;
24
+ lastName: string;
25
+ email?: string;
26
+ profileImage?: string;
27
+ emails?: [
28
+ {
29
+ loginType: string;
30
+ email: string;
31
+ verified: boolean;
32
+ _id: string;
33
+ },
34
+ ];
35
+ appId: string;
36
+
37
+ username: string;
38
+ xmppPassword: string;
39
+
40
+ langSource?: Iso639_1Codes;
41
+
42
+ homeScreen?: string;
43
+ registrationChannelType?: string;
44
+ updatedAt?: string;
45
+ authMethod?: string;
46
+ resetPasswordExpires?: string;
47
+ resetPasswordToken?: string;
48
+ xmppUsername?: string;
49
+ roles?: string[];
50
+ tags?: string[];
51
+ __v?: number;
52
+
53
+ isProfileOpen?: boolean;
54
+ isAssetsOpen?: boolean;
55
+ isAgreeWithTerms?: boolean;
56
+ isSuperAdmin?: boolean;
57
+ }
58
+
59
+ export interface ConfigUser {
60
+ email: string;
61
+ password: string;
62
+ }
63
+
64
+ export interface StorageUser {
65
+ appId: string;
66
+ company: any[];
67
+ firstName: string;
68
+ homeScreen: string;
69
+
70
+ lastName: string;
71
+ referrerId: string;
72
+ refreshToken: string;
73
+ token: string;
74
+ walletAddress: string;
75
+ xmppPassword: string;
76
+ _id: string;
77
+
78
+ isAgreeWithTerms?: boolean;
79
+ isAllowedNewAppCreate?: boolean;
80
+ isAssetsOpen?: boolean;
81
+ isProfileOpen?: boolean;
82
+ }
83
+
84
+ // review
85
+ export interface UserType extends IMessage {
86
+ id: any;
87
+ user: any;
88
+ timestamp: any;
89
+ text: any;
90
+ }
@@ -0,0 +1,155 @@
1
+ // Canonical xmpp types now live in `src/types/types.ts`. This file
2
+ // re-exports them so callers importing from `types/models/xmpp.model`
3
+ // stay aligned with the flow layer. Add NEW fields/methods to
4
+ // `src/types/types.ts` (or `src/networking/xmppClient.ts` for class
5
+ // methods) rather than duplicating here.
6
+
7
+ import { Client } from '@xmpp/client';
8
+ import XmppClient from '../../networking/xmppClient';
9
+ import { Iso639_1Codes } from './language.model';
10
+ import { IMessage } from './message.model';
11
+
12
+ export type { xmppSettingsInterface, HistoryQoSConfig } from '../types';
13
+
14
+ export interface XmppState {
15
+ client: XmppClient | null;
16
+ loading: boolean;
17
+ }
18
+
19
+ export interface MediaUploadData {
20
+ file: any; // RN: usually a {uri,name,type} object; web: File
21
+ type: string;
22
+ name?: string;
23
+ }
24
+
25
+ export type HistorySource =
26
+ | 'active'
27
+ | 'send_ack'
28
+ | 'background'
29
+ | 'default';
30
+
31
+ export interface HistoryFetchOptions {
32
+ coalesceRoom?: boolean;
33
+ skipIfPreloaded?: boolean;
34
+ source?: HistorySource;
35
+ }
36
+
37
+ export interface XmppClientInterface {
38
+ client: Client;
39
+ devServer?: string;
40
+ host: string;
41
+ service: string;
42
+ conference: string;
43
+ username: string;
44
+ status: string;
45
+
46
+ password: string;
47
+ reconnectAttempts: number;
48
+ maxReconnectAttempts: number;
49
+ reconnectDelay: number;
50
+
51
+ // ---- lifecycle ----
52
+ checkOnline(): boolean;
53
+ initializeClient(): void;
54
+ attachEventListeners(): void;
55
+ reconnect(): void;
56
+ close(): Promise<void>;
57
+ ensureConnected(timeout?: number): Promise<void>;
58
+ waitForOnline(timeout?: number): Promise<void>;
59
+ disconnect?(options?: { suppressReconnect?: boolean }): Promise<void>;
60
+
61
+ // ---- QoS / MAM ----
62
+ setActiveRoomJid(roomJID: string | null): void;
63
+ isActiveRoomGateOpen(): boolean;
64
+ promoteRoomHistory(roomJID: string): void;
65
+ onCriticalSend(roomJID: string, messageId?: string): void;
66
+ prioritizeRoomPresence(roomJID: string): Promise<boolean>;
67
+ enqueueHistoryTask(params: {
68
+ chatJID: string;
69
+ max: number;
70
+ before?: number;
71
+ id?: string;
72
+ source?: HistorySource;
73
+ }): Promise<any>;
74
+
75
+ // ---- rooms ----
76
+ getRoomsStanza(disableGetRooms?: boolean): Promise<void>;
77
+ createRoomStanza(
78
+ title: string,
79
+ description: string,
80
+ to?: string
81
+ ): Promise<string | object>;
82
+ inviteRoomRequestStanza(to: string, roomJid: string): Promise<void>;
83
+ leaveTheRoomStanza(roomJID: string): void;
84
+ presenceInRoomStanza(roomJID: string): void;
85
+ getHistoryStanza(
86
+ chatJID: string,
87
+ max: number,
88
+ before?: number,
89
+ otherStanzaId?: string,
90
+ options?: HistoryFetchOptions
91
+ ): Promise<IMessage[]>;
92
+ getLastMessageArchiveStanza(roomJID: string): void;
93
+ setRoomImageStanza(
94
+ roomJid: string,
95
+ roomThumbnail: string,
96
+ type: string,
97
+ roomBackground?: string
98
+ ): void;
99
+ getRoomInfoStanza(roomJID: string): void;
100
+ getRoomMembersStanza(roomJID: string): void;
101
+ setVCardStanza?(xmppUsername: string): void;
102
+ createPrivateRoomStanza?(
103
+ title: string,
104
+ description: string,
105
+ to: string
106
+ ): Promise<string>;
107
+
108
+ // ---- messages ----
109
+ sendMessage(
110
+ roomJID: string,
111
+ firstName: string,
112
+ lastName: string,
113
+ photo: string,
114
+ walletAddress: string,
115
+ userMessage: string,
116
+ notDisplayedValue?: string,
117
+ isReply?: boolean,
118
+ showInChannel?: boolean,
119
+ mainMessage?: string,
120
+ customId?: string
121
+ ): void;
122
+ deleteMessageStanza(room: string, msgId: string): void;
123
+ editMessageStanza(room: string, msgId: string, text: string): void;
124
+ sendTypingRequestStanza(
125
+ chatId: string,
126
+ fullName: string,
127
+ start: boolean
128
+ ): void;
129
+ getChatsPrivateStoreRequestStanza(): Promise<any>;
130
+ actionSetTimestampToPrivateStoreStanza(
131
+ chatId: string,
132
+ timestamp: number,
133
+ chats?: string[]
134
+ ): Promise<void>;
135
+ sendMediaMessageStanza(roomJID: string, data: any, id?: string): void;
136
+ sendMessageReactionStanza?(
137
+ messageId: string,
138
+ roomJid: string,
139
+ reactionsList: string[],
140
+ reactionSymbol?: string
141
+ ): void;
142
+ sendTextMessageWithTranslateTagStanza?(
143
+ roomJID: string,
144
+ firstName: string,
145
+ lastName: string,
146
+ photo: string,
147
+ walletAddress: string,
148
+ userMessage: string,
149
+ notDisplayedValue?: string,
150
+ isReply?: boolean,
151
+ showInChannel?: boolean,
152
+ mainMessage?: string,
153
+ langSource?: Iso639_1Codes
154
+ ): void;
155
+ }