@droppii-org/chat-mobile 0.2.7 → 0.2.8

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 (323) hide show
  1. package/lib/module/components/AttachmentPreview.js +250 -0
  2. package/lib/module/components/AttachmentPreview.js.map +1 -0
  3. package/lib/module/components/MediaViewer/index.js +2 -0
  4. package/lib/module/components/MediaViewer/index.js.map +1 -0
  5. package/lib/module/components/MediaViewerModal.js +57 -0
  6. package/lib/module/components/MediaViewerModal.js.map +1 -0
  7. package/lib/module/components/MergedImageGrid.js +173 -0
  8. package/lib/module/components/MergedImageGrid.js.map +1 -0
  9. package/lib/module/components/ThreadCard/thread-card.utils.js +80 -4
  10. package/lib/module/components/ThreadCard/thread-card.utils.js.map +1 -1
  11. package/lib/module/components/messages/fileMessage/index.js +26 -0
  12. package/lib/module/components/messages/fileMessage/index.js.map +1 -0
  13. package/lib/module/components/messages/imageMessage/index.js +118 -0
  14. package/lib/module/components/messages/imageMessage/index.js.map +1 -0
  15. package/lib/module/components/messages/linkMessage/index.js +122 -0
  16. package/lib/module/components/messages/linkMessage/index.js.map +1 -0
  17. package/lib/module/components/messages/mergedMessage/index.js +37 -0
  18. package/lib/module/components/messages/mergedMessage/index.js.map +1 -0
  19. package/lib/module/components/messages/styles.js +41 -0
  20. package/lib/module/components/messages/styles.js.map +1 -0
  21. package/lib/module/components/messages/textMessage/index.js +38 -0
  22. package/lib/module/components/messages/textMessage/index.js.map +1 -0
  23. package/lib/module/components/messages/types.js +14 -0
  24. package/lib/module/components/messages/types.js.map +1 -0
  25. package/lib/module/components/messages/videoMessage/index.js +110 -0
  26. package/lib/module/components/messages/videoMessage/index.js.map +1 -0
  27. package/lib/module/config/api-endpoints.js +66 -0
  28. package/lib/module/config/api-endpoints.js.map +1 -0
  29. package/lib/module/config/attachment-priority.js +81 -0
  30. package/lib/module/config/attachment-priority.js.map +1 -0
  31. package/lib/module/config/configuration.js +50 -0
  32. package/lib/module/config/configuration.js.map +1 -0
  33. package/lib/module/config/index.js +22 -0
  34. package/lib/module/config/index.js.map +1 -0
  35. package/lib/module/core/index.js +19 -1
  36. package/lib/module/core/index.js.map +1 -1
  37. package/lib/module/core/useChatListener.js +0 -14
  38. package/lib/module/core/useChatListener.js.map +1 -1
  39. package/lib/module/hooks/message/useSendMessage.js +10 -5
  40. package/lib/module/hooks/message/useSendMessage.js.map +1 -1
  41. package/lib/module/hooks/useChatMessages.js +0 -3
  42. package/lib/module/hooks/useChatMessages.js.map +1 -1
  43. package/lib/module/hooks/useImageAttachment.js +263 -0
  44. package/lib/module/hooks/useImageAttachment.js.map +1 -0
  45. package/lib/module/hooks/useMediaViewer.js +24 -0
  46. package/lib/module/hooks/useMediaViewer.js.map +1 -0
  47. package/lib/module/hooks/useSendAttachment.js +182 -0
  48. package/lib/module/hooks/useSendAttachment.js.map +1 -0
  49. package/lib/module/hooks/useVideoAttachment.js +251 -0
  50. package/lib/module/hooks/useVideoAttachment.js.map +1 -0
  51. package/lib/module/index.js +13 -1
  52. package/lib/module/index.js.map +1 -1
  53. package/lib/module/screens/MediaView/VideoPlayer.js +177 -0
  54. package/lib/module/screens/MediaView/VideoPlayer.js.map +1 -0
  55. package/lib/module/screens/MediaView/index.js +264 -0
  56. package/lib/module/screens/MediaView/index.js.map +1 -0
  57. package/lib/module/screens/chat-detail/ChatComposer.js +190 -196
  58. package/lib/module/screens/chat-detail/ChatComposer.js.map +1 -1
  59. package/lib/module/screens/chat-detail/ChatDetail.js +94 -63
  60. package/lib/module/screens/chat-detail/ChatDetail.js.map +1 -1
  61. package/lib/module/screens/chat-detail/ChatListLegend.js +5 -13
  62. package/lib/module/screens/chat-detail/ChatListLegend.js.map +1 -1
  63. package/lib/module/screens/chat-detail/components/ChatInputActions.js +51 -0
  64. package/lib/module/screens/chat-detail/components/ChatInputActions.js.map +1 -0
  65. package/lib/module/screens/chat-detail/components/ChatMessageInput.js +93 -0
  66. package/lib/module/screens/chat-detail/components/ChatMessageInput.js.map +1 -0
  67. package/lib/module/screens/chat-detail/hooks/useAttachmentSendHandler.js +221 -0
  68. package/lib/module/screens/chat-detail/hooks/useAttachmentSendHandler.js.map +1 -0
  69. package/lib/module/screens/chat-detail/hooks/useChatComposerAnimation.js +114 -0
  70. package/lib/module/screens/chat-detail/hooks/useChatComposerAnimation.js.map +1 -0
  71. package/lib/module/screens/chat-detail/hooks/useChatComposerState.js +26 -0
  72. package/lib/module/screens/chat-detail/hooks/useChatComposerState.js.map +1 -0
  73. package/lib/module/screens/chat-detail/index.js +0 -1
  74. package/lib/module/screens/chat-detail/index.js.map +1 -1
  75. package/lib/module/screens/chat-detail/legend/LegendChatMessage.js +33 -13
  76. package/lib/module/screens/chat-detail/legend/LegendChatMessage.js.map +1 -1
  77. package/lib/module/screens/chat-detail/legend/messageTypes.js +15 -0
  78. package/lib/module/screens/chat-detail/legend/messageTypes.js.map +1 -0
  79. package/lib/module/screens/inbox/MessagesTab.js.map +1 -1
  80. package/lib/module/services/attachmentHandlers/fileAttachmentHandler.js +61 -0
  81. package/lib/module/services/attachmentHandlers/fileAttachmentHandler.js.map +1 -0
  82. package/lib/module/services/attachmentHandlers/imageAttachmentHandler.js +54 -0
  83. package/lib/module/services/attachmentHandlers/imageAttachmentHandler.js.map +1 -0
  84. package/lib/module/services/attachmentHandlers/index.js +12 -0
  85. package/lib/module/services/attachmentHandlers/index.js.map +1 -0
  86. package/lib/module/services/attachmentHandlers/videoAttachmentHandler.js +85 -0
  87. package/lib/module/services/attachmentHandlers/videoAttachmentHandler.js.map +1 -0
  88. package/lib/module/services/attachmentOrchestrator.js +225 -0
  89. package/lib/module/services/attachmentOrchestrator.js.map +1 -0
  90. package/lib/module/services/auth.js +35 -0
  91. package/lib/module/services/auth.js.map +1 -0
  92. package/lib/module/services/endpoints.js +20 -1
  93. package/lib/module/services/endpoints.js.map +1 -1
  94. package/lib/module/services/imageUpload.js +126 -0
  95. package/lib/module/services/imageUpload.js.map +1 -0
  96. package/lib/module/translation/resources/i18n.js +22 -8
  97. package/lib/module/translation/resources/i18n.js.map +1 -1
  98. package/lib/module/types/attachment.js +2 -0
  99. package/lib/module/types/attachment.js.map +1 -0
  100. package/lib/module/types/attachmentHandler.js +20 -0
  101. package/lib/module/types/attachmentHandler.js.map +1 -0
  102. package/lib/module/types/imageUpload.js +2 -0
  103. package/lib/module/types/imageUpload.js.map +1 -0
  104. package/lib/module/types/message.js +1 -0
  105. package/lib/module/types/message.js.map +1 -1
  106. package/lib/module/utils/chatImageDimens.js +148 -0
  107. package/lib/module/utils/chatImageDimens.js.map +1 -0
  108. package/lib/module/utils/device.js +65 -0
  109. package/lib/module/utils/device.js.map +1 -0
  110. package/lib/module/utils/imageUrlOptimizer.js +41 -0
  111. package/lib/module/utils/imageUrlOptimizer.js.map +1 -0
  112. package/lib/module/utils/imageUtils.js +69 -0
  113. package/lib/module/utils/imageUtils.js.map +1 -0
  114. package/lib/module/utils/resolveMessageType.js +3 -0
  115. package/lib/module/utils/resolveMessageType.js.map +1 -1
  116. package/lib/module/utils/ui.js +17 -0
  117. package/lib/module/utils/ui.js.map +1 -0
  118. package/lib/module/utils/url.js +1 -1
  119. package/lib/module/utils/url.js.map +1 -1
  120. package/lib/module/utils/videoThumbnail.js +62 -0
  121. package/lib/module/utils/videoThumbnail.js.map +1 -0
  122. package/lib/typescript/src/components/AttachmentPreview.d.ts +28 -0
  123. package/lib/typescript/src/components/AttachmentPreview.d.ts.map +1 -0
  124. package/lib/typescript/src/components/MediaViewer/index.d.ts +1 -0
  125. package/lib/typescript/src/components/MediaViewer/index.d.ts.map +1 -0
  126. package/lib/typescript/src/components/MediaViewerModal.d.ts +10 -0
  127. package/lib/typescript/src/components/MediaViewerModal.d.ts.map +1 -0
  128. package/lib/typescript/src/components/MergedImageGrid.d.ts +16 -0
  129. package/lib/typescript/src/components/MergedImageGrid.d.ts.map +1 -0
  130. package/lib/typescript/src/components/ThreadCard/thread-card.utils.d.ts.map +1 -1
  131. package/lib/typescript/src/components/messages/fileMessage/index.d.ts +3 -0
  132. package/lib/typescript/src/components/messages/fileMessage/index.d.ts.map +1 -0
  133. package/lib/typescript/src/components/messages/imageMessage/index.d.ts +3 -0
  134. package/lib/typescript/src/components/messages/imageMessage/index.d.ts.map +1 -0
  135. package/lib/typescript/src/components/messages/linkMessage/index.d.ts +9 -0
  136. package/lib/typescript/src/components/messages/linkMessage/index.d.ts.map +1 -0
  137. package/lib/typescript/src/components/messages/mergedMessage/index.d.ts +3 -0
  138. package/lib/typescript/src/components/messages/mergedMessage/index.d.ts.map +1 -0
  139. package/lib/typescript/src/components/messages/styles.d.ts +36 -0
  140. package/lib/typescript/src/components/messages/styles.d.ts.map +1 -0
  141. package/lib/typescript/src/components/messages/textMessage/index.d.ts +9 -0
  142. package/lib/typescript/src/components/messages/textMessage/index.d.ts.map +1 -0
  143. package/lib/typescript/src/components/messages/types.d.ts +10 -0
  144. package/lib/typescript/src/components/messages/types.d.ts.map +1 -0
  145. package/lib/typescript/src/components/messages/videoMessage/index.d.ts +3 -0
  146. package/lib/typescript/src/components/messages/videoMessage/index.d.ts.map +1 -0
  147. package/lib/typescript/src/config/api-endpoints.d.ts +40 -0
  148. package/lib/typescript/src/config/api-endpoints.d.ts.map +1 -0
  149. package/lib/typescript/src/config/attachment-priority.d.ts +31 -0
  150. package/lib/typescript/src/config/attachment-priority.d.ts.map +1 -0
  151. package/lib/typescript/src/config/configuration.d.ts +30 -0
  152. package/lib/typescript/src/config/configuration.d.ts.map +1 -0
  153. package/lib/typescript/src/config/index.d.ts +15 -0
  154. package/lib/typescript/src/config/index.d.ts.map +1 -0
  155. package/lib/typescript/src/core/index.d.ts +13 -1
  156. package/lib/typescript/src/core/index.d.ts.map +1 -1
  157. package/lib/typescript/src/core/useChatListener.d.ts.map +1 -1
  158. package/lib/typescript/src/hooks/message/useSendMessage.d.ts.map +1 -1
  159. package/lib/typescript/src/hooks/useChatMessages.d.ts.map +1 -1
  160. package/lib/typescript/src/hooks/useImageAttachment.d.ts +20 -0
  161. package/lib/typescript/src/hooks/useImageAttachment.d.ts.map +1 -0
  162. package/lib/typescript/src/hooks/useMediaViewer.d.ts +13 -0
  163. package/lib/typescript/src/hooks/useMediaViewer.d.ts.map +1 -0
  164. package/lib/typescript/src/hooks/useSendAttachment.d.ts +59 -0
  165. package/lib/typescript/src/hooks/useSendAttachment.d.ts.map +1 -0
  166. package/lib/typescript/src/hooks/useVideoAttachment.d.ts +29 -0
  167. package/lib/typescript/src/hooks/useVideoAttachment.d.ts.map +1 -0
  168. package/lib/typescript/src/index.d.ts +14 -1
  169. package/lib/typescript/src/index.d.ts.map +1 -1
  170. package/lib/typescript/src/screens/MediaView/VideoPlayer.d.ts +12 -0
  171. package/lib/typescript/src/screens/MediaView/VideoPlayer.d.ts.map +1 -0
  172. package/lib/typescript/src/screens/MediaView/index.d.ts +11 -0
  173. package/lib/typescript/src/screens/MediaView/index.d.ts.map +1 -0
  174. package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts +1 -1
  175. package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts.map +1 -1
  176. package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts +1 -1
  177. package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts.map +1 -1
  178. package/lib/typescript/src/screens/chat-detail/ChatListLegend.d.ts +1 -1
  179. package/lib/typescript/src/screens/chat-detail/ChatListLegend.d.ts.map +1 -1
  180. package/lib/typescript/src/screens/chat-detail/components/ChatInputActions.d.ts +8 -0
  181. package/lib/typescript/src/screens/chat-detail/components/ChatInputActions.d.ts.map +1 -0
  182. package/lib/typescript/src/screens/chat-detail/components/ChatMessageInput.d.ts +15 -0
  183. package/lib/typescript/src/screens/chat-detail/components/ChatMessageInput.d.ts.map +1 -0
  184. package/lib/typescript/src/screens/chat-detail/hooks/useAttachmentSendHandler.d.ts +23 -0
  185. package/lib/typescript/src/screens/chat-detail/hooks/useAttachmentSendHandler.d.ts.map +1 -0
  186. package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerAnimation.d.ts +15 -0
  187. package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerAnimation.d.ts.map +1 -0
  188. package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerState.d.ts +13 -0
  189. package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerState.d.ts.map +1 -0
  190. package/lib/typescript/src/screens/chat-detail/index.d.ts +0 -2
  191. package/lib/typescript/src/screens/chat-detail/index.d.ts.map +1 -1
  192. package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts +3 -1
  193. package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts.map +1 -1
  194. package/lib/typescript/src/screens/chat-detail/legend/messageTypes.d.ts +13 -0
  195. package/lib/typescript/src/screens/chat-detail/legend/messageTypes.d.ts.map +1 -0
  196. package/lib/typescript/src/screens/chat-detail/types.d.ts +4 -1
  197. package/lib/typescript/src/screens/chat-detail/types.d.ts.map +1 -1
  198. package/lib/typescript/src/services/attachmentHandlers/fileAttachmentHandler.d.ts +22 -0
  199. package/lib/typescript/src/services/attachmentHandlers/fileAttachmentHandler.d.ts.map +1 -0
  200. package/lib/typescript/src/services/attachmentHandlers/imageAttachmentHandler.d.ts +3 -0
  201. package/lib/typescript/src/services/attachmentHandlers/imageAttachmentHandler.d.ts.map +1 -0
  202. package/lib/typescript/src/services/attachmentHandlers/index.d.ts +5 -0
  203. package/lib/typescript/src/services/attachmentHandlers/index.d.ts.map +1 -0
  204. package/lib/typescript/src/services/attachmentHandlers/videoAttachmentHandler.d.ts +31 -0
  205. package/lib/typescript/src/services/attachmentHandlers/videoAttachmentHandler.d.ts.map +1 -0
  206. package/lib/typescript/src/services/attachmentOrchestrator.d.ts +5 -0
  207. package/lib/typescript/src/services/attachmentOrchestrator.d.ts.map +1 -0
  208. package/lib/typescript/src/services/auth.d.ts +19 -0
  209. package/lib/typescript/src/services/auth.d.ts.map +1 -0
  210. package/lib/typescript/src/services/endpoints.d.ts +11 -1
  211. package/lib/typescript/src/services/endpoints.d.ts.map +1 -1
  212. package/lib/typescript/src/services/imageUpload.d.ts +7 -0
  213. package/lib/typescript/src/services/imageUpload.d.ts.map +1 -0
  214. package/lib/typescript/src/translation/resources/i18n.d.ts.map +1 -1
  215. package/lib/typescript/src/types/attachment.d.ts +72 -0
  216. package/lib/typescript/src/types/attachment.d.ts.map +1 -0
  217. package/lib/typescript/src/types/attachmentHandler.d.ts +13 -0
  218. package/lib/typescript/src/types/attachmentHandler.d.ts.map +1 -0
  219. package/lib/typescript/src/types/imageUpload.d.ts +26 -0
  220. package/lib/typescript/src/types/imageUpload.d.ts.map +1 -0
  221. package/lib/typescript/src/types/message.d.ts +1 -0
  222. package/lib/typescript/src/types/message.d.ts.map +1 -1
  223. package/lib/typescript/src/utils/chatImageDimens.d.ts +34 -0
  224. package/lib/typescript/src/utils/chatImageDimens.d.ts.map +1 -0
  225. package/lib/typescript/src/utils/device.d.ts +7 -0
  226. package/lib/typescript/src/utils/device.d.ts.map +1 -0
  227. package/lib/typescript/src/utils/imageUrlOptimizer.d.ts +12 -0
  228. package/lib/typescript/src/utils/imageUrlOptimizer.d.ts.map +1 -0
  229. package/lib/typescript/src/utils/imageUtils.d.ts +9 -0
  230. package/lib/typescript/src/utils/imageUtils.d.ts.map +1 -0
  231. package/lib/typescript/src/utils/resolveMessageType.d.ts.map +1 -1
  232. package/lib/typescript/src/utils/ui.d.ts +13 -0
  233. package/lib/typescript/src/utils/ui.d.ts.map +1 -0
  234. package/lib/typescript/src/utils/videoThumbnail.d.ts +16 -0
  235. package/lib/typescript/src/utils/videoThumbnail.d.ts.map +1 -0
  236. package/package.json +15 -3
  237. package/src/components/AttachmentPreview.tsx +304 -0
  238. package/src/components/MediaViewer/index.tsx +0 -0
  239. package/src/components/MediaViewerModal.tsx +70 -0
  240. package/src/components/MergedImageGrid.tsx +238 -0
  241. package/src/components/ThreadCard/thread-card.utils.ts +95 -4
  242. package/src/components/messages/fileMessage/index.tsx +30 -0
  243. package/src/components/messages/imageMessage/index.tsx +137 -0
  244. package/src/components/messages/linkMessage/index.tsx +162 -0
  245. package/src/components/messages/mergedMessage/index.tsx +45 -0
  246. package/src/components/messages/styles.ts +39 -0
  247. package/src/components/messages/textMessage/index.tsx +53 -0
  248. package/src/components/messages/types.ts +22 -0
  249. package/src/components/messages/videoMessage/index.tsx +120 -0
  250. package/src/config/api-endpoints.ts +72 -0
  251. package/src/config/attachment-priority.ts +93 -0
  252. package/src/config/configuration.ts +50 -0
  253. package/src/config/index.ts +19 -0
  254. package/src/core/index.ts +25 -1
  255. package/src/core/useChatListener.ts +0 -21
  256. package/src/hooks/message/useSendMessage.ts +12 -5
  257. package/src/hooks/useChatMessages.ts +0 -4
  258. package/src/hooks/useImageAttachment.ts +348 -0
  259. package/src/hooks/useMediaViewer.ts +32 -0
  260. package/src/hooks/useSendAttachment.ts +295 -0
  261. package/src/hooks/useVideoAttachment.ts +334 -0
  262. package/src/index.tsx +13 -1
  263. package/src/screens/MediaView/VideoPlayer.tsx +211 -0
  264. package/src/screens/MediaView/index.tsx +327 -0
  265. package/src/screens/chat-detail/ChatComposer.tsx +206 -271
  266. package/src/screens/chat-detail/ChatDetail.tsx +142 -89
  267. package/src/screens/chat-detail/ChatListLegend.tsx +9 -11
  268. package/src/screens/chat-detail/components/ChatInputActions.tsx +71 -0
  269. package/src/screens/chat-detail/components/ChatMessageInput.tsx +127 -0
  270. package/src/screens/chat-detail/hooks/useAttachmentSendHandler.ts +291 -0
  271. package/src/screens/chat-detail/hooks/useChatComposerAnimation.ts +184 -0
  272. package/src/screens/chat-detail/hooks/useChatComposerState.ts +40 -0
  273. package/src/screens/chat-detail/index.ts +0 -2
  274. package/src/screens/chat-detail/legend/LegendChatMessage.tsx +47 -24
  275. package/src/screens/chat-detail/legend/messageTypes.tsx +13 -0
  276. package/src/screens/chat-detail/types.ts +5 -1
  277. package/src/screens/inbox/MessagesTab.tsx +1 -1
  278. package/src/services/attachmentHandlers/fileAttachmentHandler.ts +78 -0
  279. package/src/services/attachmentHandlers/imageAttachmentHandler.ts +54 -0
  280. package/src/services/attachmentHandlers/index.ts +10 -0
  281. package/src/services/attachmentHandlers/videoAttachmentHandler.ts +114 -0
  282. package/src/services/attachmentOrchestrator.ts +300 -0
  283. package/src/services/auth.ts +34 -0
  284. package/src/services/endpoints.ts +24 -1
  285. package/src/services/imageUpload.ts +162 -0
  286. package/src/translation/resources/i18n.ts +22 -8
  287. package/src/types/attachment.ts +85 -0
  288. package/src/types/attachmentHandler.ts +31 -0
  289. package/src/types/imageUpload.ts +28 -0
  290. package/src/types/message.ts +1 -0
  291. package/src/utils/chatImageDimens.ts +178 -0
  292. package/src/utils/device.ts +73 -0
  293. package/src/utils/imageUrlOptimizer.ts +56 -0
  294. package/src/utils/imageUtils.ts +76 -0
  295. package/src/utils/resolveMessageType.ts +2 -0
  296. package/src/utils/ui.ts +19 -0
  297. package/src/utils/url.ts +1 -1
  298. package/src/utils/videoThumbnail.ts +85 -0
  299. package/lib/module/screens/chat-detail/ChatList.js +0 -147
  300. package/lib/module/screens/chat-detail/ChatList.js.map +0 -1
  301. package/lib/module/screens/chat-detail/ChatTextBubble.js +0 -62
  302. package/lib/module/screens/chat-detail/ChatTextBubble.js.map +0 -1
  303. package/lib/module/screens/chat-detail/legend/message-types.js +0 -244
  304. package/lib/module/screens/chat-detail/legend/message-types.js.map +0 -1
  305. package/lib/module/screens/chat-detail/messages/ChatMessageBubble.js +0 -24
  306. package/lib/module/screens/chat-detail/messages/ChatMessageBubble.js.map +0 -1
  307. package/lib/module/screens/chat-detail/messages/types.js +0 -4
  308. package/lib/module/screens/chat-detail/messages/types.js.map +0 -1
  309. package/lib/typescript/src/screens/chat-detail/ChatList.d.ts +0 -3
  310. package/lib/typescript/src/screens/chat-detail/ChatList.d.ts.map +0 -1
  311. package/lib/typescript/src/screens/chat-detail/ChatTextBubble.d.ts +0 -3
  312. package/lib/typescript/src/screens/chat-detail/ChatTextBubble.d.ts.map +0 -1
  313. package/lib/typescript/src/screens/chat-detail/legend/message-types.d.ts +0 -13
  314. package/lib/typescript/src/screens/chat-detail/legend/message-types.d.ts.map +0 -1
  315. package/lib/typescript/src/screens/chat-detail/messages/ChatMessageBubble.d.ts +0 -3
  316. package/lib/typescript/src/screens/chat-detail/messages/ChatMessageBubble.d.ts.map +0 -1
  317. package/lib/typescript/src/screens/chat-detail/messages/types.d.ts +0 -13
  318. package/lib/typescript/src/screens/chat-detail/messages/types.d.ts.map +0 -1
  319. package/src/screens/chat-detail/ChatList.tsx +0 -190
  320. package/src/screens/chat-detail/ChatTextBubble.tsx +0 -73
  321. package/src/screens/chat-detail/legend/message-types.tsx +0 -304
  322. package/src/screens/chat-detail/messages/ChatMessageBubble.tsx +0 -23
  323. package/src/screens/chat-detail/messages/types.ts +0 -14
@@ -0,0 +1,78 @@
1
+ import type { Attachment, FileAttachment } from '../../types/attachment';
2
+ import type { IAttachmentHandler } from '../../types/attachmentHandler';
3
+
4
+ interface FileElem {
5
+ uuid: string;
6
+ fileName: string;
7
+ fileSize: number;
8
+ fileType: string;
9
+ url: string;
10
+ }
11
+
12
+ export class FileAttachmentHandler implements IAttachmentHandler {
13
+ private static readonly MAX_FILE_SIZE = 200 * 1024 * 1024; // 200MB
14
+
15
+ validate(
16
+ attachment: Attachment
17
+ ): { valid: true } | { valid: false; reason: string } {
18
+ if (attachment.type !== 'file') {
19
+ return {
20
+ valid: false,
21
+ reason: 'Invalid attachment type for file handler',
22
+ };
23
+ }
24
+
25
+ const { sourceFile } = attachment;
26
+
27
+ if (!sourceFile.filename) {
28
+ return {
29
+ valid: false,
30
+ reason: 'File name is required',
31
+ };
32
+ }
33
+
34
+ if (!sourceFile.size) {
35
+ return {
36
+ valid: false,
37
+ reason: 'File size is required',
38
+ };
39
+ }
40
+
41
+ if (sourceFile.size > FileAttachmentHandler.MAX_FILE_SIZE) {
42
+ return {
43
+ valid: false,
44
+ reason: `File size exceeds maximum (${FileAttachmentHandler.MAX_FILE_SIZE / 1024 / 1024}MB)`,
45
+ };
46
+ }
47
+
48
+ return { valid: true };
49
+ }
50
+
51
+ async buildPayload(
52
+ attachment: Attachment,
53
+ uploadedUrl: string
54
+ ): Promise<FileElem> {
55
+ const file = attachment as FileAttachment;
56
+ const { sourceFile } = file;
57
+
58
+ const fileElem: FileElem = {
59
+ uuid: attachment.id,
60
+ fileName: sourceFile.filename,
61
+ fileSize: sourceFile.size,
62
+ fileType: sourceFile.mimeType,
63
+ url: uploadedUrl,
64
+ };
65
+
66
+ console.warn('[FileAttachmentHandler] Built payload', {
67
+ uuid: fileElem.uuid,
68
+ fileName: fileElem.fileName,
69
+ fileSize: fileElem.fileSize,
70
+ fileType: fileElem.fileType,
71
+ url: uploadedUrl.substring(0, 50) + '...',
72
+ });
73
+
74
+ return fileElem;
75
+ }
76
+ }
77
+
78
+ export default new FileAttachmentHandler();
@@ -0,0 +1,54 @@
1
+ import type { ImageAttachment } from '../../types/attachment';
2
+ import type { IAttachmentHandler } from '../../types/attachmentHandler';
3
+ import { generateUUID } from '../../utils/imageUtils';
4
+
5
+ export const ImageAttachmentHandler: IAttachmentHandler = {
6
+ validate(attachment: ImageAttachment) {
7
+ const MAX_SIZE = 5 * 1024 * 1024;
8
+ if (attachment.sourceFile.size > MAX_SIZE) {
9
+ return { valid: false, reason: 'Image exceeds 5MB limit' };
10
+ }
11
+
12
+ const validMimes = ['image/jpeg', 'image/png', 'image/webp', 'image/jpg'];
13
+ if (!validMimes.includes(attachment.sourceFile.mimeType)) {
14
+ return {
15
+ valid: false,
16
+ reason: `Unsupported format: ${attachment.sourceFile.mimeType}`,
17
+ };
18
+ }
19
+
20
+ if (attachment.metadata.width <= 0 || attachment.metadata.height <= 0) {
21
+ return { valid: false, reason: 'Invalid image dimensions' };
22
+ }
23
+
24
+ return { valid: true };
25
+ },
26
+
27
+ async buildPayload(attachment: ImageAttachment, uploadedUrl: string) {
28
+ console.log('[ImageAttachmentHandler] Building payload for', {
29
+ filename: attachment.sourceFile.filename,
30
+ url: uploadedUrl,
31
+ });
32
+
33
+ const picInfo = {
34
+ uuid: generateUUID(),
35
+ type: attachment.sourceFile.mimeType,
36
+ size: attachment.sourceFile.size,
37
+ width: attachment.metadata.width,
38
+ height: attachment.metadata.height,
39
+ url: uploadedUrl,
40
+ };
41
+
42
+ const payload = {
43
+ sourcePicture: picInfo,
44
+ bigPicture: picInfo,
45
+ snapshotPicture: picInfo,
46
+ };
47
+
48
+ console.log('[ImageAttachmentHandler] Payload created for', {
49
+ fileName: attachment.sourceFile.filename,
50
+ });
51
+
52
+ return payload;
53
+ },
54
+ };
@@ -0,0 +1,10 @@
1
+ // Handlers are now dispatched directly in getAttachmentHandler without registry
2
+
3
+ // Legacy export for backward compatibility
4
+ export function initializeAttachmentHandlers(): void {
5
+ // No longer needed - handlers are dispatched directly
6
+ }
7
+
8
+ export { ImageAttachmentHandler } from './imageAttachmentHandler';
9
+ export { default as VideoAttachmentHandler } from './videoAttachmentHandler';
10
+ export { default as FileAttachmentHandler } from './fileAttachmentHandler';
@@ -0,0 +1,114 @@
1
+ import type { Attachment, VideoAttachment } from '../../types/attachment';
2
+ import type { IAttachmentHandler } from '../../types/attachmentHandler';
3
+
4
+ interface VideoPicInfo {
5
+ videoUUID: string;
6
+ videoType: string;
7
+ videoSize: number;
8
+ duration: number;
9
+ snapshotWidth: number;
10
+ snapshotHeight: number;
11
+ videoUrl: string;
12
+ videoPath: string;
13
+ snapshotPath: string;
14
+ snapshotUUID: string;
15
+ snapshotSize: number;
16
+ snapshotUrl: string;
17
+ snapShotType: string;
18
+ }
19
+
20
+ export class VideoAttachmentHandler implements IAttachmentHandler {
21
+ private static readonly MAX_VIDEO_SIZE = 100 * 1024 * 1024; // 100MB
22
+ private static readonly SUPPORTED_TYPES = ['video/mp4', 'video/quicktime'];
23
+
24
+ validate(
25
+ attachment: Attachment
26
+ ): { valid: true } | { valid: false; reason: string } {
27
+ if (attachment.type !== 'video') {
28
+ return {
29
+ valid: false,
30
+ reason: 'Invalid attachment type for video handler',
31
+ };
32
+ }
33
+
34
+ const { sourceFile } = attachment;
35
+
36
+ if (!sourceFile?.size) {
37
+ return {
38
+ valid: false,
39
+ reason: 'Video file size is required',
40
+ };
41
+ }
42
+
43
+ if (sourceFile.size > VideoAttachmentHandler.MAX_VIDEO_SIZE) {
44
+ return {
45
+ valid: false,
46
+ reason: `Video size exceeds maximum (${VideoAttachmentHandler.MAX_VIDEO_SIZE / 1024 / 1024}MB)`,
47
+ };
48
+ }
49
+
50
+ if (
51
+ sourceFile.mimeType &&
52
+ !VideoAttachmentHandler.SUPPORTED_TYPES.includes(sourceFile.mimeType)
53
+ ) {
54
+ return {
55
+ valid: false,
56
+ reason: 'Unsupported video format',
57
+ };
58
+ }
59
+
60
+ return { valid: true };
61
+ }
62
+
63
+ async buildPayload(
64
+ attachment: Attachment,
65
+ uploadedUrl: string
66
+ ): Promise<VideoPicInfo> {
67
+ const video = attachment as VideoAttachment;
68
+ const { sourceFile, metadata } = video;
69
+
70
+ // Use thumbnail URL if available, otherwise fall back to video URL
71
+ const snapshotUrl = metadata.thumbnail?.url || uploadedUrl;
72
+ const snapshotWidth = metadata.thumbnail?.width || metadata.width || 320;
73
+ const snapshotHeight = metadata.thumbnail?.height || metadata.height || 180;
74
+ const snapshotSize = metadata.thumbnail?.size || 0;
75
+
76
+ if (metadata.thumbnail?.url) {
77
+ console.log('✅ [VideoAttachmentHandler] Using thumbnail:', {
78
+ snapshotUrl: metadata.thumbnail.url,
79
+ snapshotWidth,
80
+ snapshotHeight,
81
+ snapshotSize,
82
+ });
83
+ }
84
+
85
+ const picInfo: VideoPicInfo = {
86
+ videoUUID: attachment.id,
87
+ videoType: sourceFile.mimeType || 'video/mp4',
88
+ videoSize: sourceFile.size,
89
+ duration: metadata.duration,
90
+ snapshotWidth: snapshotWidth,
91
+ snapshotHeight: snapshotHeight,
92
+ videoUrl: uploadedUrl,
93
+ videoPath: sourceFile.path,
94
+ snapshotPath: snapshotUrl,
95
+ snapshotUUID: `${attachment.id}-snapshot`,
96
+ snapshotSize: snapshotSize,
97
+ snapshotUrl: snapshotUrl,
98
+ snapShotType: 'image/jpeg',
99
+ };
100
+
101
+ console.warn('[VideoAttachmentHandler] Built payload', {
102
+ videoUUID: picInfo.videoUUID,
103
+ videoSize: picInfo.videoSize,
104
+ duration: picInfo.duration,
105
+ snapshotWidth: picInfo.snapshotWidth,
106
+ snapshotHeight: picInfo.snapshotHeight,
107
+ videoUrl: uploadedUrl.substring(0, 50) + '...',
108
+ });
109
+
110
+ return picInfo;
111
+ }
112
+ }
113
+
114
+ export default new VideoAttachmentHandler();
@@ -0,0 +1,300 @@
1
+ import OpenIMSDK, { type MessageItem } from '@droppii/openim-rn-client-sdk';
2
+ import type {
3
+ Attachment,
4
+ AttachmentSendOptions,
5
+ AttachmentSendResult,
6
+ } from '../types/attachment';
7
+ import { getAttachmentHandler } from '../types/attachmentHandler';
8
+ import { useConversationStore } from '../store';
9
+ import {
10
+ getAttachmentPriorityConfig,
11
+ type AttachmentType,
12
+ } from '../config/attachment-priority';
13
+
14
+ export namespace AttachmentOrchestratorService {
15
+ export async function sendPreparedAttachments(
16
+ attachments: Attachment[],
17
+ uploadedUrls: Record<string, string>,
18
+ options: AttachmentSendOptions = { strategy: 'individual' },
19
+ onMessageSent?: (message: any) => void
20
+ ): Promise<AttachmentSendResult> {
21
+ const result: AttachmentSendResult = {
22
+ success: false,
23
+ sentAttachmentIds: [],
24
+ failedAttachmentIds: [],
25
+ errors: {},
26
+ };
27
+
28
+ if (!attachments || attachments.length === 0) {
29
+ return result;
30
+ }
31
+
32
+ // 1. Validate all attachments
33
+ console.log('[AttachmentOrchestrator] Validating prepared attachments...');
34
+ for (const att of attachments) {
35
+ try {
36
+ const handler = getAttachmentHandler(att.type);
37
+ const validation = handler.validate(att);
38
+ if (!validation.valid) {
39
+ result.failedAttachmentIds.push(att.id);
40
+ result.errors[att.id] = (
41
+ validation as { valid: false; reason: string }
42
+ ).reason;
43
+ }
44
+ } catch (error) {
45
+ const msg =
46
+ error instanceof Error ? error.message : 'Validation failed';
47
+ result.failedAttachmentIds.push(att.id);
48
+ result.errors[att.id] = msg;
49
+ }
50
+ }
51
+
52
+ if (result.failedAttachmentIds.length === attachments.length) {
53
+ return result;
54
+ }
55
+
56
+ const validAttachments = attachments.filter(
57
+ (a) => !result.failedAttachmentIds.includes(a.id)
58
+ );
59
+
60
+ // 2. Build message payloads directly (no upload)
61
+ console.log(
62
+ '[AttachmentOrchestrator] Building message payloads for prepared attachments...'
63
+ );
64
+ const payloads: Array<{ attachmentId: string; payload: unknown }> = [];
65
+ for (const att of validAttachments) {
66
+ try {
67
+ const uploadedUrl = uploadedUrls[att.id];
68
+ if (!uploadedUrl) {
69
+ result.failedAttachmentIds.push(att.id);
70
+ result.errors[att.id] = 'No uploaded URL provided';
71
+ continue;
72
+ }
73
+
74
+ const handler = getAttachmentHandler(att.type);
75
+ const payload = await handler.buildPayload(att, uploadedUrl);
76
+ payloads.push({ attachmentId: att.id, payload });
77
+ } catch (error) {
78
+ const msg =
79
+ error instanceof Error ? error.message : 'Payload build failed';
80
+ result.failedAttachmentIds.push(att.id);
81
+ result.errors[att.id] = msg;
82
+ }
83
+ }
84
+
85
+ // 3. Send via OpenIM - always use createMergerMessage
86
+ console.log('[AttachmentOrchestrator] Sending via createMergerMessage', {
87
+ payloadCount: payloads.length,
88
+ attachmentIds: payloads.map((p) => p.attachmentId),
89
+ });
90
+ try {
91
+ const mergedMsgId = await sendMergedMessage(
92
+ payloads.map((p) => p.payload),
93
+ options.includeCaption,
94
+ onMessageSent
95
+ );
96
+ console.log('[AttachmentOrchestrator] Messages sent via merger:', {
97
+ messageId: mergedMsgId,
98
+ count: payloads.length,
99
+ });
100
+ result.sentAttachmentIds = payloads.map((p) => p.attachmentId);
101
+ result.mergedMessageId = mergedMsgId;
102
+ } catch (error) {
103
+ const msg = error instanceof Error ? error.message : 'Send failed';
104
+ console.error('[AttachmentOrchestrator] OpenIM send error:', {
105
+ error: msg,
106
+ stack: error instanceof Error ? error.stack : undefined,
107
+ });
108
+ if (result.sentAttachmentIds.length === 0) {
109
+ result.errors._send = msg;
110
+ }
111
+ }
112
+
113
+ result.success = result.sentAttachmentIds.length > 0;
114
+ return result;
115
+ }
116
+
117
+ async function sendMergedMessage(
118
+ payloads: unknown[],
119
+ _caption?: string,
120
+ onMessageSent?: (message: any) => void
121
+ ): Promise<string> {
122
+ const currentConversation = useConversationStore
123
+ .getState()
124
+ .getCurrentConversation();
125
+
126
+ if (!currentConversation) {
127
+ throw new Error('No conversation selected');
128
+ }
129
+
130
+ // Get priority configuration
131
+ const priorityConfig = getAttachmentPriorityConfig();
132
+ console.log('[AttachmentOrchestrator] Using priority config:', {
133
+ enabled: priorityConfig.enabled,
134
+ order: priorityConfig.order,
135
+ });
136
+
137
+ // Categorize payloads by type
138
+ const categorizedPayloads: Record<AttachmentType, unknown[]> = {
139
+ image: [],
140
+ video: [],
141
+ file: [],
142
+ text: [],
143
+ };
144
+
145
+ for (const p of payloads) {
146
+ const payload = p as any;
147
+ // Detect type from payload properties
148
+ if (payload.duration !== undefined || payload.videoPath !== undefined) {
149
+ categorizedPayloads.video.push(p);
150
+ } else if (
151
+ payload.fileExtension !== undefined ||
152
+ (payload.fileName && payload.fileName.includes('.'))
153
+ ) {
154
+ categorizedPayloads.file.push(p);
155
+ } else if (payload.content && typeof payload.content === 'string') {
156
+ categorizedPayloads.text.push(p);
157
+ } else {
158
+ categorizedPayloads.image.push(p);
159
+ }
160
+ }
161
+
162
+ console.log('[AttachmentOrchestrator] Categorized payloads:', {
163
+ count: payloads.length,
164
+ images: categorizedPayloads.image.length,
165
+ videos: categorizedPayloads.video.length,
166
+ files: categorizedPayloads.file.length,
167
+ texts: categorizedPayloads.text.length,
168
+ });
169
+
170
+ // AC2: Create message from payload based on type
171
+ const createMessageFromPayload = async (p: any) => {
172
+ if (p.duration !== undefined || p.videoPath !== undefined) {
173
+ console.log('[AttachmentOrchestrator] Creating video message');
174
+ return OpenIMSDK.createVideoMessageByURL(p);
175
+ }
176
+ if (
177
+ p.fileExtension !== undefined ||
178
+ (p.fileName && p.fileName.includes('.'))
179
+ ) {
180
+ console.log('[AttachmentOrchestrator] Creating file message');
181
+ return OpenIMSDK.createFileMessageByURL(p);
182
+ }
183
+ if (p.content && typeof p.content === 'string') {
184
+ console.log('[AttachmentOrchestrator] Creating text message');
185
+ return OpenIMSDK.createTextMessage(p.content);
186
+ }
187
+ // Default to image
188
+ console.log('[AttachmentOrchestrator] Creating image message');
189
+ return OpenIMSDK.createImageMessageByURL(p);
190
+ };
191
+
192
+ // Process attachments in priority order from config
193
+ let lastMsgId = '';
194
+ const allMessages = [];
195
+
196
+ if (priorityConfig.enabled) {
197
+ // Use configured priority order
198
+ console.log(
199
+ '[AttachmentOrchestrator] Processing in priority order:',
200
+ priorityConfig.order
201
+ );
202
+
203
+ for (const attachmentType of priorityConfig.order) {
204
+ const payloadsForType = categorizedPayloads[attachmentType];
205
+ if (payloadsForType.length === 0) continue;
206
+
207
+ console.log(`[AttachmentOrchestrator] Processing ${attachmentType}:`, {
208
+ count: payloadsForType.length,
209
+ });
210
+
211
+ const mergeStrategy =
212
+ attachmentType === 'image'
213
+ ? priorityConfig.mergeStrategy.images
214
+ : attachmentType === 'video'
215
+ ? priorityConfig.mergeStrategy.videos
216
+ : attachmentType === 'file'
217
+ ? priorityConfig.mergeStrategy.files
218
+ : 'individual';
219
+
220
+ if (mergeStrategy === 'individual' || payloadsForType.length === 1) {
221
+ // Send individually
222
+ for (const p of payloadsForType) {
223
+ const message = await createMessageFromPayload(p as any);
224
+ allMessages.push(message);
225
+ }
226
+ } else {
227
+ // Merge multiple items
228
+ const messages = [];
229
+ for (const p of payloadsForType) {
230
+ const message = await createMessageFromPayload(p as any);
231
+ messages.push(message);
232
+ }
233
+
234
+ const typeLabel =
235
+ attachmentType.charAt(0).toUpperCase() + attachmentType.slice(1);
236
+ const merged = await OpenIMSDK.createMergerMessage({
237
+ messageList: messages,
238
+ title: typeLabel + 's',
239
+ summaryList: messages.map((_, i) => `[${typeLabel} ${i + 1}]`),
240
+ });
241
+
242
+ if (merged) {
243
+ allMessages.push(merged);
244
+ }
245
+ }
246
+ }
247
+ } else {
248
+ // Original behavior (config disabled)
249
+ console.log('[AttachmentOrchestrator] Priority config disabled');
250
+
251
+ const allPayloads = [
252
+ ...categorizedPayloads.image,
253
+ ...categorizedPayloads.video,
254
+ ...categorizedPayloads.file,
255
+ ...categorizedPayloads.text,
256
+ ];
257
+
258
+ for (const p of allPayloads) {
259
+ const message = await createMessageFromPayload(p as any);
260
+ allMessages.push(message);
261
+ }
262
+ }
263
+
264
+ // Send all messages in priority order
265
+ console.log(
266
+ '[AttachmentOrchestrator] Sending all messages in priority order',
267
+ {
268
+ totalMessages: allMessages.length,
269
+ }
270
+ );
271
+
272
+ for (let i = 0; i < allMessages.length; i++) {
273
+ const message = allMessages[i] as MessageItem;
274
+ console.log(
275
+ '[AttachmentOrchestrator] Sending message',
276
+ i + 1,
277
+ 'of',
278
+ allMessages.length
279
+ );
280
+
281
+ const result = await OpenIMSDK.sendMessageNotOss({
282
+ recvID: currentConversation.userID || '',
283
+ groupID: currentConversation.groupID || '',
284
+ message,
285
+ });
286
+
287
+ lastMsgId = result?.clientMsgID || result?.serverMsgID || '';
288
+ console.log('[AttachmentOrchestrator] Message sent:', {
289
+ messageId: lastMsgId,
290
+ index: i + 1,
291
+ });
292
+
293
+ if (onMessageSent && result) {
294
+ onMessageSent(result);
295
+ }
296
+ }
297
+
298
+ return lastMsgId;
299
+ }
300
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Auth token management
3
+ * Consumer app calls setAuthToken() once at startup
4
+ * Library services call getAuthToken() internally
5
+ */
6
+
7
+ let authToken: string | null = null;
8
+
9
+ /**
10
+ * Set auth token (call once at app startup)
11
+ */
12
+ export const setAuthToken = (token: string) => {
13
+ authToken = token;
14
+ };
15
+
16
+ /**
17
+ * Get auth token (called internally by library services)
18
+ * @throws Error if token not set
19
+ */
20
+ export const getAuthToken = (): string => {
21
+ if (!authToken) {
22
+ throw new Error(
23
+ 'Auth token not initialized. Call setAuthToken(token) at app startup.'
24
+ );
25
+ }
26
+ return authToken;
27
+ };
28
+
29
+ /**
30
+ * Clear token (logout)
31
+ */
32
+ export const clearAuthToken = () => {
33
+ authToken = null;
34
+ };
@@ -1,5 +1,28 @@
1
+ /**
2
+ * @deprecated Use config/api-endpoints.ts instead
3
+ * This file is kept for backward compatibility only.
4
+ * All endpoints should be managed through config/api-endpoints.ts
5
+ */
6
+
7
+ import {
8
+ getApiEndpoint,
9
+ setApiEndpoint,
10
+ getAllApiEndpoints,
11
+ } from '../config/api-endpoints';
12
+
13
+ // Legacy interface - use api-endpoints.ts directly
1
14
  export const ENDPOINTS = {
2
15
  chatService: {
3
- urlMetadata: '/chat-service/v1/utils/url-metadata',
16
+ get urlMetadata() {
17
+ return getApiEndpoint('urlMetadata');
18
+ },
19
+ },
20
+ uploaderService: {
21
+ get uploadImage() {
22
+ return getApiEndpoint('imageUpload');
23
+ },
4
24
  },
5
25
  };
26
+
27
+ // Re-export proper API for new code
28
+ export { getApiEndpoint, setApiEndpoint, getAllApiEndpoints };