@droppii-org/chat-mobile 0.2.6 → 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 (398) 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/AvatarSection.js +4 -4
  10. package/lib/module/components/ThreadCard/AvatarSection.js.map +1 -1
  11. package/lib/module/components/ThreadCard/NamePrefixIcon.js +13 -16
  12. package/lib/module/components/ThreadCard/NamePrefixIcon.js.map +1 -1
  13. package/lib/module/components/ThreadCard/ThreadCard.js +13 -33
  14. package/lib/module/components/ThreadCard/ThreadCard.js.map +1 -1
  15. package/lib/module/components/ThreadCard/thread-card.utils.js +80 -4
  16. package/lib/module/components/ThreadCard/thread-card.utils.js.map +1 -1
  17. package/lib/module/components/messages/fileMessage/index.js +26 -0
  18. package/lib/module/components/messages/fileMessage/index.js.map +1 -0
  19. package/lib/module/components/messages/imageMessage/index.js +118 -0
  20. package/lib/module/components/messages/imageMessage/index.js.map +1 -0
  21. package/lib/module/components/messages/linkMessage/index.js +122 -0
  22. package/lib/module/components/messages/linkMessage/index.js.map +1 -0
  23. package/lib/module/components/messages/mergedMessage/index.js +37 -0
  24. package/lib/module/components/messages/mergedMessage/index.js.map +1 -0
  25. package/lib/module/components/messages/styles.js +41 -0
  26. package/lib/module/components/messages/styles.js.map +1 -0
  27. package/lib/module/components/messages/textMessage/index.js +38 -0
  28. package/lib/module/components/messages/textMessage/index.js.map +1 -0
  29. package/lib/module/components/messages/types.js +14 -0
  30. package/lib/module/components/messages/types.js.map +1 -0
  31. package/lib/module/components/messages/videoMessage/index.js +110 -0
  32. package/lib/module/components/messages/videoMessage/index.js.map +1 -0
  33. package/lib/module/config/api-endpoints.js +66 -0
  34. package/lib/module/config/api-endpoints.js.map +1 -0
  35. package/lib/module/config/attachment-priority.js +81 -0
  36. package/lib/module/config/attachment-priority.js.map +1 -0
  37. package/lib/module/config/configuration.js +50 -0
  38. package/lib/module/config/configuration.js.map +1 -0
  39. package/lib/module/config/index.js +22 -0
  40. package/lib/module/config/index.js.map +1 -0
  41. package/lib/module/context/ChatContext.js +7 -6
  42. package/lib/module/context/ChatContext.js.map +1 -1
  43. package/lib/module/core/index.js +19 -1
  44. package/lib/module/core/index.js.map +1 -1
  45. package/lib/module/core/useChatListener.js +0 -14
  46. package/lib/module/core/useChatListener.js.map +1 -1
  47. package/lib/module/hooks/message/useSendMessage.js +106 -0
  48. package/lib/module/hooks/message/useSendMessage.js.map +1 -0
  49. package/lib/module/hooks/useChatMessages.js +36 -121
  50. package/lib/module/hooks/useChatMessages.js.map +1 -1
  51. package/lib/module/hooks/useConversationList.js +29 -17
  52. package/lib/module/hooks/useConversationList.js.map +1 -1
  53. package/lib/module/hooks/useImageAttachment.js +263 -0
  54. package/lib/module/hooks/useImageAttachment.js.map +1 -0
  55. package/lib/module/hooks/useLinkPreview/useLinkPreview.js +3 -2
  56. package/lib/module/hooks/useLinkPreview/useLinkPreview.js.map +1 -1
  57. package/lib/module/hooks/useMediaViewer.js +24 -0
  58. package/lib/module/hooks/useMediaViewer.js.map +1 -0
  59. package/lib/module/hooks/useSendAttachment.js +182 -0
  60. package/lib/module/hooks/useSendAttachment.js.map +1 -0
  61. package/lib/module/hooks/useVideoAttachment.js +251 -0
  62. package/lib/module/hooks/useVideoAttachment.js.map +1 -0
  63. package/lib/module/index.js +13 -1
  64. package/lib/module/index.js.map +1 -1
  65. package/lib/module/screens/MediaView/VideoPlayer.js +177 -0
  66. package/lib/module/screens/MediaView/VideoPlayer.js.map +1 -0
  67. package/lib/module/screens/MediaView/index.js +264 -0
  68. package/lib/module/screens/MediaView/index.js.map +1 -0
  69. package/lib/module/screens/chat-detail/ChatComposer.js +190 -196
  70. package/lib/module/screens/chat-detail/ChatComposer.js.map +1 -1
  71. package/lib/module/screens/chat-detail/ChatDetail.js +106 -71
  72. package/lib/module/screens/chat-detail/ChatDetail.js.map +1 -1
  73. package/lib/module/screens/chat-detail/ChatDetailHeader.js +5 -8
  74. package/lib/module/screens/chat-detail/ChatDetailHeader.js.map +1 -1
  75. package/lib/module/screens/chat-detail/ChatLinkPreview.js +1 -1
  76. package/lib/module/screens/chat-detail/ChatLinkPreview.js.map +1 -1
  77. package/lib/module/screens/chat-detail/ChatListLegend.js +5 -15
  78. package/lib/module/screens/chat-detail/ChatListLegend.js.map +1 -1
  79. package/lib/module/screens/chat-detail/components/ChatInputActions.js +51 -0
  80. package/lib/module/screens/chat-detail/components/ChatInputActions.js.map +1 -0
  81. package/lib/module/screens/chat-detail/components/ChatMessageInput.js +93 -0
  82. package/lib/module/screens/chat-detail/components/ChatMessageInput.js.map +1 -0
  83. package/lib/module/screens/chat-detail/conversationHeader.utils.js +7 -9
  84. package/lib/module/screens/chat-detail/conversationHeader.utils.js.map +1 -1
  85. package/lib/module/screens/chat-detail/hooks/useAttachmentSendHandler.js +221 -0
  86. package/lib/module/screens/chat-detail/hooks/useAttachmentSendHandler.js.map +1 -0
  87. package/lib/module/screens/chat-detail/hooks/useChatComposerAnimation.js +114 -0
  88. package/lib/module/screens/chat-detail/hooks/useChatComposerAnimation.js.map +1 -0
  89. package/lib/module/screens/chat-detail/hooks/useChatComposerState.js +26 -0
  90. package/lib/module/screens/chat-detail/hooks/useChatComposerState.js.map +1 -0
  91. package/lib/module/screens/chat-detail/index.js +0 -1
  92. package/lib/module/screens/chat-detail/index.js.map +1 -1
  93. package/lib/module/screens/chat-detail/legend/LegendChatMessage.js +32 -25
  94. package/lib/module/screens/chat-detail/legend/LegendChatMessage.js.map +1 -1
  95. package/lib/module/screens/chat-detail/legend/messageTypes.js +15 -0
  96. package/lib/module/screens/chat-detail/legend/messageTypes.js.map +1 -0
  97. package/lib/module/screens/inbox/MessagesTab.js.map +1 -1
  98. package/lib/module/services/attachmentHandlers/fileAttachmentHandler.js +61 -0
  99. package/lib/module/services/attachmentHandlers/fileAttachmentHandler.js.map +1 -0
  100. package/lib/module/services/attachmentHandlers/imageAttachmentHandler.js +54 -0
  101. package/lib/module/services/attachmentHandlers/imageAttachmentHandler.js.map +1 -0
  102. package/lib/module/services/attachmentHandlers/index.js +12 -0
  103. package/lib/module/services/attachmentHandlers/index.js.map +1 -0
  104. package/lib/module/services/attachmentHandlers/videoAttachmentHandler.js +85 -0
  105. package/lib/module/services/attachmentHandlers/videoAttachmentHandler.js.map +1 -0
  106. package/lib/module/services/attachmentOrchestrator.js +225 -0
  107. package/lib/module/services/attachmentOrchestrator.js.map +1 -0
  108. package/lib/module/services/auth.js +35 -0
  109. package/lib/module/services/auth.js.map +1 -0
  110. package/lib/module/services/endpoints.js +20 -1
  111. package/lib/module/services/endpoints.js.map +1 -1
  112. package/lib/module/services/imageUpload.js +126 -0
  113. package/lib/module/services/imageUpload.js.map +1 -0
  114. package/lib/module/store/conversation.js +1 -1
  115. package/lib/module/store/conversation.js.map +1 -1
  116. package/lib/module/store/message.js +45 -0
  117. package/lib/module/store/message.js.map +1 -0
  118. package/lib/module/translation/resources/i18n.js +22 -2
  119. package/lib/module/translation/resources/i18n.js.map +1 -1
  120. package/lib/module/types/attachment.js +2 -0
  121. package/lib/module/types/attachment.js.map +1 -0
  122. package/lib/module/types/attachmentHandler.js +20 -0
  123. package/lib/module/types/attachmentHandler.js.map +1 -0
  124. package/lib/module/types/chat.js +2 -7
  125. package/lib/module/types/chat.js.map +1 -1
  126. package/lib/module/types/imageUpload.js +2 -0
  127. package/lib/module/types/imageUpload.js.map +1 -0
  128. package/lib/module/types/message.js +1 -0
  129. package/lib/module/types/message.js.map +1 -1
  130. package/lib/module/utils/chatImageDimens.js +148 -0
  131. package/lib/module/utils/chatImageDimens.js.map +1 -0
  132. package/lib/module/utils/conversation.js +34 -13
  133. package/lib/module/utils/conversation.js.map +1 -1
  134. package/lib/module/utils/device.js +65 -0
  135. package/lib/module/utils/device.js.map +1 -0
  136. package/lib/module/utils/imageUrlOptimizer.js +41 -0
  137. package/lib/module/utils/imageUrlOptimizer.js.map +1 -0
  138. package/lib/module/utils/imageUtils.js +69 -0
  139. package/lib/module/utils/imageUtils.js.map +1 -0
  140. package/lib/module/utils/legendListMessage.js +0 -3
  141. package/lib/module/utils/legendListMessage.js.map +1 -1
  142. package/lib/module/utils/message.js +5 -8
  143. package/lib/module/utils/message.js.map +1 -1
  144. package/lib/module/utils/resolveMessageType.js +3 -0
  145. package/lib/module/utils/resolveMessageType.js.map +1 -1
  146. package/lib/module/utils/ui.js +17 -0
  147. package/lib/module/utils/ui.js.map +1 -0
  148. package/lib/module/utils/url.js +3 -3
  149. package/lib/module/utils/url.js.map +1 -1
  150. package/lib/module/utils/videoThumbnail.js +62 -0
  151. package/lib/module/utils/videoThumbnail.js.map +1 -0
  152. package/lib/typescript/src/components/AttachmentPreview.d.ts +28 -0
  153. package/lib/typescript/src/components/AttachmentPreview.d.ts.map +1 -0
  154. package/lib/typescript/src/components/MediaViewer/index.d.ts +1 -0
  155. package/lib/typescript/src/components/MediaViewer/index.d.ts.map +1 -0
  156. package/lib/typescript/src/components/MediaViewerModal.d.ts +10 -0
  157. package/lib/typescript/src/components/MediaViewerModal.d.ts.map +1 -0
  158. package/lib/typescript/src/components/MergedImageGrid.d.ts +16 -0
  159. package/lib/typescript/src/components/MergedImageGrid.d.ts.map +1 -0
  160. package/lib/typescript/src/components/ThreadCard/AvatarSection.d.ts +2 -2
  161. package/lib/typescript/src/components/ThreadCard/AvatarSection.d.ts.map +1 -1
  162. package/lib/typescript/src/components/ThreadCard/NamePrefixIcon.d.ts +3 -4
  163. package/lib/typescript/src/components/ThreadCard/NamePrefixIcon.d.ts.map +1 -1
  164. package/lib/typescript/src/components/ThreadCard/ThreadCard.d.ts.map +1 -1
  165. package/lib/typescript/src/components/ThreadCard/thread-card.utils.d.ts.map +1 -1
  166. package/lib/typescript/src/components/messages/fileMessage/index.d.ts +3 -0
  167. package/lib/typescript/src/components/messages/fileMessage/index.d.ts.map +1 -0
  168. package/lib/typescript/src/components/messages/imageMessage/index.d.ts +3 -0
  169. package/lib/typescript/src/components/messages/imageMessage/index.d.ts.map +1 -0
  170. package/lib/typescript/src/components/messages/linkMessage/index.d.ts +9 -0
  171. package/lib/typescript/src/components/messages/linkMessage/index.d.ts.map +1 -0
  172. package/lib/typescript/src/components/messages/mergedMessage/index.d.ts +3 -0
  173. package/lib/typescript/src/components/messages/mergedMessage/index.d.ts.map +1 -0
  174. package/lib/typescript/src/components/messages/styles.d.ts +36 -0
  175. package/lib/typescript/src/components/messages/styles.d.ts.map +1 -0
  176. package/lib/typescript/src/components/messages/textMessage/index.d.ts +9 -0
  177. package/lib/typescript/src/components/messages/textMessage/index.d.ts.map +1 -0
  178. package/lib/typescript/src/components/messages/types.d.ts +10 -0
  179. package/lib/typescript/src/components/messages/types.d.ts.map +1 -0
  180. package/lib/typescript/src/components/messages/videoMessage/index.d.ts +3 -0
  181. package/lib/typescript/src/components/messages/videoMessage/index.d.ts.map +1 -0
  182. package/lib/typescript/src/config/api-endpoints.d.ts +40 -0
  183. package/lib/typescript/src/config/api-endpoints.d.ts.map +1 -0
  184. package/lib/typescript/src/config/attachment-priority.d.ts +31 -0
  185. package/lib/typescript/src/config/attachment-priority.d.ts.map +1 -0
  186. package/lib/typescript/src/config/configuration.d.ts +30 -0
  187. package/lib/typescript/src/config/configuration.d.ts.map +1 -0
  188. package/lib/typescript/src/config/index.d.ts +15 -0
  189. package/lib/typescript/src/config/index.d.ts.map +1 -0
  190. package/lib/typescript/src/context/ChatContext.d.ts +1 -1
  191. package/lib/typescript/src/context/ChatContext.d.ts.map +1 -1
  192. package/lib/typescript/src/core/index.d.ts +13 -1
  193. package/lib/typescript/src/core/index.d.ts.map +1 -1
  194. package/lib/typescript/src/core/useChatListener.d.ts.map +1 -1
  195. package/lib/typescript/src/hooks/message/useSendMessage.d.ts +12 -0
  196. package/lib/typescript/src/hooks/message/useSendMessage.d.ts.map +1 -0
  197. package/lib/typescript/src/hooks/useChatMessages.d.ts +0 -1
  198. package/lib/typescript/src/hooks/useChatMessages.d.ts.map +1 -1
  199. package/lib/typescript/src/hooks/useConversationList.d.ts +2 -1
  200. package/lib/typescript/src/hooks/useConversationList.d.ts.map +1 -1
  201. package/lib/typescript/src/hooks/useImageAttachment.d.ts +20 -0
  202. package/lib/typescript/src/hooks/useImageAttachment.d.ts.map +1 -0
  203. package/lib/typescript/src/hooks/useLinkPreview/useLinkPreview.d.ts.map +1 -1
  204. package/lib/typescript/src/hooks/useMediaViewer.d.ts +13 -0
  205. package/lib/typescript/src/hooks/useMediaViewer.d.ts.map +1 -0
  206. package/lib/typescript/src/hooks/useSendAttachment.d.ts +59 -0
  207. package/lib/typescript/src/hooks/useSendAttachment.d.ts.map +1 -0
  208. package/lib/typescript/src/hooks/useVideoAttachment.d.ts +29 -0
  209. package/lib/typescript/src/hooks/useVideoAttachment.d.ts.map +1 -0
  210. package/lib/typescript/src/index.d.ts +14 -1
  211. package/lib/typescript/src/index.d.ts.map +1 -1
  212. package/lib/typescript/src/screens/MediaView/VideoPlayer.d.ts +12 -0
  213. package/lib/typescript/src/screens/MediaView/VideoPlayer.d.ts.map +1 -0
  214. package/lib/typescript/src/screens/MediaView/index.d.ts +11 -0
  215. package/lib/typescript/src/screens/MediaView/index.d.ts.map +1 -0
  216. package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts +1 -1
  217. package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts.map +1 -1
  218. package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts +1 -1
  219. package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts.map +1 -1
  220. package/lib/typescript/src/screens/chat-detail/ChatDetailHeader.d.ts +1 -1
  221. package/lib/typescript/src/screens/chat-detail/ChatDetailHeader.d.ts.map +1 -1
  222. package/lib/typescript/src/screens/chat-detail/ChatListLegend.d.ts +1 -1
  223. package/lib/typescript/src/screens/chat-detail/ChatListLegend.d.ts.map +1 -1
  224. package/lib/typescript/src/screens/chat-detail/components/ChatInputActions.d.ts +8 -0
  225. package/lib/typescript/src/screens/chat-detail/components/ChatInputActions.d.ts.map +1 -0
  226. package/lib/typescript/src/screens/chat-detail/components/ChatMessageInput.d.ts +15 -0
  227. package/lib/typescript/src/screens/chat-detail/components/ChatMessageInput.d.ts.map +1 -0
  228. package/lib/typescript/src/screens/chat-detail/conversationHeader.utils.d.ts +1 -1
  229. package/lib/typescript/src/screens/chat-detail/conversationHeader.utils.d.ts.map +1 -1
  230. package/lib/typescript/src/screens/chat-detail/hooks/useAttachmentSendHandler.d.ts +23 -0
  231. package/lib/typescript/src/screens/chat-detail/hooks/useAttachmentSendHandler.d.ts.map +1 -0
  232. package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerAnimation.d.ts +15 -0
  233. package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerAnimation.d.ts.map +1 -0
  234. package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerState.d.ts +13 -0
  235. package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerState.d.ts.map +1 -0
  236. package/lib/typescript/src/screens/chat-detail/index.d.ts +0 -2
  237. package/lib/typescript/src/screens/chat-detail/index.d.ts.map +1 -1
  238. package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts +3 -3
  239. package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts.map +1 -1
  240. package/lib/typescript/src/screens/chat-detail/legend/messageTypes.d.ts +13 -0
  241. package/lib/typescript/src/screens/chat-detail/legend/messageTypes.d.ts.map +1 -0
  242. package/lib/typescript/src/screens/chat-detail/types.d.ts +10 -8
  243. package/lib/typescript/src/screens/chat-detail/types.d.ts.map +1 -1
  244. package/lib/typescript/src/services/attachmentHandlers/fileAttachmentHandler.d.ts +22 -0
  245. package/lib/typescript/src/services/attachmentHandlers/fileAttachmentHandler.d.ts.map +1 -0
  246. package/lib/typescript/src/services/attachmentHandlers/imageAttachmentHandler.d.ts +3 -0
  247. package/lib/typescript/src/services/attachmentHandlers/imageAttachmentHandler.d.ts.map +1 -0
  248. package/lib/typescript/src/services/attachmentHandlers/index.d.ts +5 -0
  249. package/lib/typescript/src/services/attachmentHandlers/index.d.ts.map +1 -0
  250. package/lib/typescript/src/services/attachmentHandlers/videoAttachmentHandler.d.ts +31 -0
  251. package/lib/typescript/src/services/attachmentHandlers/videoAttachmentHandler.d.ts.map +1 -0
  252. package/lib/typescript/src/services/attachmentOrchestrator.d.ts +5 -0
  253. package/lib/typescript/src/services/attachmentOrchestrator.d.ts.map +1 -0
  254. package/lib/typescript/src/services/auth.d.ts +19 -0
  255. package/lib/typescript/src/services/auth.d.ts.map +1 -0
  256. package/lib/typescript/src/services/endpoints.d.ts +11 -1
  257. package/lib/typescript/src/services/endpoints.d.ts.map +1 -1
  258. package/lib/typescript/src/services/imageUpload.d.ts +7 -0
  259. package/lib/typescript/src/services/imageUpload.d.ts.map +1 -0
  260. package/lib/typescript/src/store/message.d.ts +3 -0
  261. package/lib/typescript/src/store/message.d.ts.map +1 -0
  262. package/lib/typescript/src/translation/resources/i18n.d.ts.map +1 -1
  263. package/lib/typescript/src/types/attachment.d.ts +72 -0
  264. package/lib/typescript/src/types/attachment.d.ts.map +1 -0
  265. package/lib/typescript/src/types/attachmentHandler.d.ts +13 -0
  266. package/lib/typescript/src/types/attachmentHandler.d.ts.map +1 -0
  267. package/lib/typescript/src/types/chat.d.ts +28 -27
  268. package/lib/typescript/src/types/chat.d.ts.map +1 -1
  269. package/lib/typescript/src/types/common.d.ts +1 -0
  270. package/lib/typescript/src/types/common.d.ts.map +1 -1
  271. package/lib/typescript/src/types/imageUpload.d.ts +26 -0
  272. package/lib/typescript/src/types/imageUpload.d.ts.map +1 -0
  273. package/lib/typescript/src/types/message.d.ts +1 -0
  274. package/lib/typescript/src/types/message.d.ts.map +1 -1
  275. package/lib/typescript/src/utils/chatImageDimens.d.ts +34 -0
  276. package/lib/typescript/src/utils/chatImageDimens.d.ts.map +1 -0
  277. package/lib/typescript/src/utils/conversation.d.ts +3 -2
  278. package/lib/typescript/src/utils/conversation.d.ts.map +1 -1
  279. package/lib/typescript/src/utils/device.d.ts +7 -0
  280. package/lib/typescript/src/utils/device.d.ts.map +1 -0
  281. package/lib/typescript/src/utils/imageUrlOptimizer.d.ts +12 -0
  282. package/lib/typescript/src/utils/imageUrlOptimizer.d.ts.map +1 -0
  283. package/lib/typescript/src/utils/imageUtils.d.ts +9 -0
  284. package/lib/typescript/src/utils/imageUtils.d.ts.map +1 -0
  285. package/lib/typescript/src/utils/legendListMessage.d.ts +0 -2
  286. package/lib/typescript/src/utils/legendListMessage.d.ts.map +1 -1
  287. package/lib/typescript/src/utils/message.d.ts.map +1 -1
  288. package/lib/typescript/src/utils/resolveMessageType.d.ts.map +1 -1
  289. package/lib/typescript/src/utils/ui.d.ts +13 -0
  290. package/lib/typescript/src/utils/ui.d.ts.map +1 -0
  291. package/lib/typescript/src/utils/url.d.ts +1 -1
  292. package/lib/typescript/src/utils/url.d.ts.map +1 -1
  293. package/lib/typescript/src/utils/videoThumbnail.d.ts +16 -0
  294. package/lib/typescript/src/utils/videoThumbnail.d.ts.map +1 -0
  295. package/package.json +15 -3
  296. package/src/components/AttachmentPreview.tsx +304 -0
  297. package/src/components/MediaViewer/index.tsx +0 -0
  298. package/src/components/MediaViewerModal.tsx +70 -0
  299. package/src/components/MergedImageGrid.tsx +238 -0
  300. package/src/components/ThreadCard/AvatarSection.tsx +5 -8
  301. package/src/components/ThreadCard/NamePrefixIcon.tsx +27 -38
  302. package/src/components/ThreadCard/ThreadCard.tsx +16 -30
  303. package/src/components/ThreadCard/thread-card.utils.ts +95 -4
  304. package/src/components/messages/fileMessage/index.tsx +30 -0
  305. package/src/components/messages/imageMessage/index.tsx +137 -0
  306. package/src/components/messages/linkMessage/index.tsx +162 -0
  307. package/src/components/messages/mergedMessage/index.tsx +45 -0
  308. package/src/components/messages/styles.ts +39 -0
  309. package/src/components/messages/textMessage/index.tsx +53 -0
  310. package/src/components/messages/types.ts +22 -0
  311. package/src/components/messages/videoMessage/index.tsx +120 -0
  312. package/src/config/api-endpoints.ts +72 -0
  313. package/src/config/attachment-priority.ts +93 -0
  314. package/src/config/configuration.ts +50 -0
  315. package/src/config/index.ts +19 -0
  316. package/src/context/ChatContext.tsx +12 -4
  317. package/src/core/index.ts +25 -1
  318. package/src/core/useChatListener.ts +0 -21
  319. package/src/hooks/message/useSendMessage.ts +143 -0
  320. package/src/hooks/useChatMessages.ts +69 -161
  321. package/src/hooks/useConversationList.ts +34 -16
  322. package/src/hooks/useImageAttachment.ts +348 -0
  323. package/src/hooks/useLinkPreview/useLinkPreview.ts +3 -2
  324. package/src/hooks/useMediaViewer.ts +32 -0
  325. package/src/hooks/useSendAttachment.ts +295 -0
  326. package/src/hooks/useVideoAttachment.ts +334 -0
  327. package/src/index.tsx +13 -1
  328. package/src/screens/MediaView/VideoPlayer.tsx +211 -0
  329. package/src/screens/MediaView/index.tsx +327 -0
  330. package/src/screens/chat-detail/ChatComposer.tsx +206 -271
  331. package/src/screens/chat-detail/ChatDetail.tsx +164 -104
  332. package/src/screens/chat-detail/ChatDetailHeader.tsx +4 -10
  333. package/src/screens/chat-detail/ChatLinkPreview.tsx +1 -1
  334. package/src/screens/chat-detail/ChatListLegend.tsx +10 -13
  335. package/src/screens/chat-detail/components/ChatInputActions.tsx +71 -0
  336. package/src/screens/chat-detail/components/ChatMessageInput.tsx +127 -0
  337. package/src/screens/chat-detail/conversationHeader.utils.ts +11 -14
  338. package/src/screens/chat-detail/hooks/useAttachmentSendHandler.ts +291 -0
  339. package/src/screens/chat-detail/hooks/useChatComposerAnimation.ts +184 -0
  340. package/src/screens/chat-detail/hooks/useChatComposerState.ts +40 -0
  341. package/src/screens/chat-detail/index.ts +0 -2
  342. package/src/screens/chat-detail/legend/LegendChatMessage.tsx +44 -39
  343. package/src/screens/chat-detail/legend/messageTypes.tsx +13 -0
  344. package/src/screens/chat-detail/types.ts +11 -9
  345. package/src/screens/inbox/MessagesTab.tsx +1 -1
  346. package/src/services/attachmentHandlers/fileAttachmentHandler.ts +78 -0
  347. package/src/services/attachmentHandlers/imageAttachmentHandler.ts +54 -0
  348. package/src/services/attachmentHandlers/index.ts +10 -0
  349. package/src/services/attachmentHandlers/videoAttachmentHandler.ts +114 -0
  350. package/src/services/attachmentOrchestrator.ts +300 -0
  351. package/src/services/auth.ts +34 -0
  352. package/src/services/endpoints.ts +24 -1
  353. package/src/services/imageUpload.ts +162 -0
  354. package/src/store/conversation.ts +1 -1
  355. package/src/store/message.ts +44 -0
  356. package/src/translation/resources/i18n.ts +22 -2
  357. package/src/types/attachment.ts +85 -0
  358. package/src/types/attachmentHandler.ts +31 -0
  359. package/src/types/chat.ts +31 -30
  360. package/src/types/common.ts +1 -0
  361. package/src/types/imageUpload.ts +28 -0
  362. package/src/types/message.ts +1 -0
  363. package/src/utils/chatImageDimens.ts +178 -0
  364. package/src/utils/conversation.ts +44 -17
  365. package/src/utils/device.ts +73 -0
  366. package/src/utils/imageUrlOptimizer.ts +56 -0
  367. package/src/utils/imageUtils.ts +76 -0
  368. package/src/utils/legendListMessage.ts +0 -5
  369. package/src/utils/message.ts +10 -12
  370. package/src/utils/resolveMessageType.ts +2 -0
  371. package/src/utils/ui.ts +19 -0
  372. package/src/utils/url.ts +3 -3
  373. package/src/utils/videoThumbnail.ts +85 -0
  374. package/lib/module/screens/chat-detail/ChatList.js +0 -147
  375. package/lib/module/screens/chat-detail/ChatList.js.map +0 -1
  376. package/lib/module/screens/chat-detail/ChatTextBubble.js +0 -62
  377. package/lib/module/screens/chat-detail/ChatTextBubble.js.map +0 -1
  378. package/lib/module/screens/chat-detail/legend/message-types.js +0 -122
  379. package/lib/module/screens/chat-detail/legend/message-types.js.map +0 -1
  380. package/lib/module/screens/chat-detail/messages/ChatMessageBubble.js +0 -24
  381. package/lib/module/screens/chat-detail/messages/ChatMessageBubble.js.map +0 -1
  382. package/lib/module/screens/chat-detail/messages/types.js +0 -4
  383. package/lib/module/screens/chat-detail/messages/types.js.map +0 -1
  384. package/lib/typescript/src/screens/chat-detail/ChatList.d.ts +0 -3
  385. package/lib/typescript/src/screens/chat-detail/ChatList.d.ts.map +0 -1
  386. package/lib/typescript/src/screens/chat-detail/ChatTextBubble.d.ts +0 -3
  387. package/lib/typescript/src/screens/chat-detail/ChatTextBubble.d.ts.map +0 -1
  388. package/lib/typescript/src/screens/chat-detail/legend/message-types.d.ts +0 -12
  389. package/lib/typescript/src/screens/chat-detail/legend/message-types.d.ts.map +0 -1
  390. package/lib/typescript/src/screens/chat-detail/messages/ChatMessageBubble.d.ts +0 -3
  391. package/lib/typescript/src/screens/chat-detail/messages/ChatMessageBubble.d.ts.map +0 -1
  392. package/lib/typescript/src/screens/chat-detail/messages/types.d.ts +0 -13
  393. package/lib/typescript/src/screens/chat-detail/messages/types.d.ts.map +0 -1
  394. package/src/screens/chat-detail/ChatList.tsx +0 -190
  395. package/src/screens/chat-detail/ChatTextBubble.tsx +0 -73
  396. package/src/screens/chat-detail/legend/message-types.tsx +0 -149
  397. package/src/screens/chat-detail/messages/ChatMessageBubble.tsx +0 -23
  398. package/src/screens/chat-detail/messages/types.ts +0 -14
@@ -0,0 +1,137 @@
1
+ import { memo, useState, useCallback, useMemo } from 'react';
2
+ import { StyleSheet, Image, useWindowDimensions } from 'react-native';
3
+ import { KContainer, KImage } from '@droppii/libs';
4
+ import ChatImageDimens from '../../../utils/chatImageDimens';
5
+ import { messageStyles } from '../styles';
6
+ import type { BaseLegendMessageProps } from '../types';
7
+
8
+ export const ImageMessage = memo(
9
+ ({ message, onMediaPress }: BaseLegendMessageProps) => {
10
+ const windowWidth = useWindowDimensions().width;
11
+ const [isLoading, setIsLoading] = useState(true);
12
+ const pictureElem = (message as any).pictureElem;
13
+ const rawImageUrl =
14
+ pictureElem?.snapshotPicture?.url ||
15
+ pictureElem?.bigPicture?.url ||
16
+ pictureElem?.sourcePicture?.url;
17
+
18
+ // Calculate dimensions respecting aspect ratio and 80% device width
19
+ const imageDimensions = useMemo(() => {
20
+ if (!rawImageUrl) return { width: 250, height: 250 };
21
+
22
+ const responseWidth =
23
+ pictureElem?.width ||
24
+ pictureElem?.bigPicture?.width ||
25
+ pictureElem?.snapshotPicture?.width;
26
+ const responseHeight =
27
+ pictureElem?.height ||
28
+ pictureElem?.bigPicture?.height ||
29
+ pictureElem?.snapshotPicture?.height;
30
+
31
+ let imgWidth = responseWidth;
32
+ let imgHeight = responseHeight;
33
+
34
+ // If no dimensions in response, try to resolve from image source
35
+ if (!imgWidth || !imgHeight) {
36
+ try {
37
+ const source = Image.resolveAssetSource({ uri: rawImageUrl });
38
+ imgWidth = source?.width || 300;
39
+ imgHeight = source?.height || 300;
40
+ } catch {
41
+ // Fallback to default if resolution fails
42
+ imgWidth = 300;
43
+ imgHeight = 300;
44
+ }
45
+ }
46
+
47
+ const aspectRatio = imgWidth / imgHeight;
48
+ // Account for all margins/padding: use 75% of window width with buffer
49
+ const horizontalBuffer = 16; // Left and right combined buffer
50
+ const maxWidth = Math.floor(windowWidth * 0.75 - horizontalBuffer);
51
+
52
+ // Calculate final dimensions
53
+ let finalWidth = maxWidth;
54
+ let finalHeight = maxWidth / aspectRatio;
55
+
56
+ // Cap maximum height to avoid overly tall images
57
+ const maxHeight = 500;
58
+ if (finalHeight > maxHeight) {
59
+ finalHeight = maxHeight;
60
+ finalWidth = finalHeight * aspectRatio;
61
+ }
62
+
63
+ return {
64
+ width: Math.round(finalWidth),
65
+ height: Math.round(finalHeight),
66
+ };
67
+ }, [pictureElem, rawImageUrl, windowWidth]);
68
+
69
+ const handleLoadEnd = useCallback(() => {
70
+ setIsLoading(false);
71
+ }, []);
72
+
73
+ const handlePress = useCallback(() => {
74
+ onMediaPress?.([{ url: rawImageUrl }], 0);
75
+ }, [onMediaPress, rawImageUrl]);
76
+
77
+ if (!rawImageUrl) {
78
+ return null;
79
+ }
80
+
81
+ // Use dynamic optimization matching calculated dimensions
82
+ const optimizedUrl = ChatImageDimens.getOptimizedImageUrlWithDimensions(
83
+ rawImageUrl,
84
+ imageDimensions.width,
85
+ imageDimensions.height
86
+ );
87
+
88
+ return (
89
+ <KContainer.View style={[messageStyles.wrapper, styles.wrapper]}>
90
+ <KContainer.Touchable
91
+ onPress={handlePress}
92
+ style={[
93
+ messageStyles.imageBubble,
94
+ styles.imageContainer,
95
+ {
96
+ width: imageDimensions.width,
97
+ height: imageDimensions.height,
98
+ },
99
+ ]}
100
+ >
101
+ <KImage.Base
102
+ uri={optimizedUrl}
103
+ width={imageDimensions.width}
104
+ height={imageDimensions.height}
105
+ style={[messageStyles.imageBubble]}
106
+ onLoadEnd={handleLoadEnd}
107
+ />
108
+
109
+ {isLoading && <KContainer.View style={styles.skeleton} />}
110
+ </KContainer.Touchable>
111
+ </KContainer.View>
112
+ );
113
+ }
114
+ );
115
+
116
+ ImageMessage.displayName = 'ImageMessage';
117
+
118
+ const styles = StyleSheet.create({
119
+ wrapper: {
120
+ // paddingRight: 8,
121
+ overflow: 'hidden',
122
+ },
123
+ skeleton: {
124
+ position: 'absolute',
125
+ top: 0,
126
+ left: 0,
127
+ right: 0,
128
+ bottom: 0,
129
+ backgroundColor: '#f0f0f0',
130
+ borderRadius: 8,
131
+ },
132
+ imageContainer: {
133
+ position: 'relative',
134
+ overflow: 'hidden',
135
+ borderRadius: 8,
136
+ },
137
+ });
@@ -0,0 +1,162 @@
1
+ import { memo } from 'react';
2
+ import { Linking, StyleSheet } from 'react-native';
3
+ import {
4
+ KContainer,
5
+ KImage,
6
+ KLabel,
7
+ KColors,
8
+ KSpacingValue,
9
+ } from '@droppii/libs';
10
+ import type { DMessageItem } from '../../../types/chat';
11
+ import type { IUrlMetadata } from '../../../types/common';
12
+ import { formatMessageTime } from '../types';
13
+ import { CHAT_BUBBLE_COLORS } from '../../../screens/chat-detail/constants';
14
+
15
+ interface BaseLegendMessageProps {
16
+ message: DMessageItem;
17
+ isOutgoing: boolean;
18
+ createdAtTime: number;
19
+ }
20
+
21
+ const parseUrlMetadata = (ex?: string): IUrlMetadata | undefined => {
22
+ if (!ex) return undefined;
23
+ try {
24
+ const parsed = JSON.parse(ex) as any;
25
+ // Handle nested urlMetadata structure
26
+ return parsed.urlMetadata || parsed;
27
+ } catch {
28
+ return undefined;
29
+ }
30
+ };
31
+
32
+ const renderTextWithLinks = (content: string, urls: string[]) => {
33
+ if (!urls.length) {
34
+ return <KLabel.Text typo="TextMdNormal">{content}</KLabel.Text>;
35
+ }
36
+
37
+ return (
38
+ <KLabel.Text typo="TextMdNormal" color={CHAT_BUBBLE_COLORS.text}>
39
+ {content}
40
+ </KLabel.Text>
41
+ );
42
+ };
43
+
44
+ export const LinkMessage = memo(
45
+ ({ message, isOutgoing, createdAtTime }: BaseLegendMessageProps) => {
46
+ const content = message?.urlTextElem?.content;
47
+ const urls = message?.urlTextElem?.urls ?? [];
48
+ const metadata = parseUrlMetadata(message.ex);
49
+ const timeLabel = formatMessageTime(createdAtTime);
50
+
51
+ return (
52
+ <KContainer.View style={styles.wrapper}>
53
+ <KContainer.View
54
+ style={[
55
+ styles.bubble,
56
+ isOutgoing ? styles.bubbleSent : styles.bubbleReceived,
57
+ ]}
58
+ >
59
+ {!!content?.trim() && (
60
+ <KContainer.View style={styles.textRow}>
61
+ {renderTextWithLinks(content, urls)}
62
+ </KContainer.View>
63
+ )}
64
+
65
+ {metadata && (
66
+ <KContainer.Touchable
67
+ style={styles.card}
68
+ onPress={() => metadata.url && Linking.openURL(metadata.url)}
69
+ >
70
+ {!!metadata.image && (
71
+ <KContainer.View style={styles.cardThumb}>
72
+ <KImage.Base
73
+ uri={metadata.image}
74
+ style={StyleSheet.absoluteFill}
75
+ resizeMode="cover"
76
+ />
77
+ </KContainer.View>
78
+ )}
79
+ <KContainer.View style={styles.cardBody}>
80
+ {!!metadata.title && (
81
+ <KLabel.Text
82
+ typo="TextNmMedium"
83
+ color={KColors.palette.gray.w900}
84
+ numberOfLines={1}
85
+ >
86
+ {metadata.title}
87
+ </KLabel.Text>
88
+ )}
89
+ {!!metadata.url && (
90
+ <KLabel.Text
91
+ typo="TextXsMedium"
92
+ color={KColors.palette.primary.w400}
93
+ numberOfLines={1}
94
+ >
95
+ {metadata.url}
96
+ </KLabel.Text>
97
+ )}
98
+ {!!metadata.description && (
99
+ <KLabel.Text
100
+ typo="TextXsNormal"
101
+ color={KColors.gray.normal}
102
+ numberOfLines={2}
103
+ >
104
+ {metadata.description}
105
+ </KLabel.Text>
106
+ )}
107
+ </KContainer.View>
108
+ </KContainer.Touchable>
109
+ )}
110
+ </KContainer.View>
111
+
112
+ {!isOutgoing && timeLabel ? (
113
+ <KLabel.Text
114
+ typo="TextXsNormal"
115
+ color={CHAT_BUBBLE_COLORS.timestamp}
116
+ marginL="0.25rem"
117
+ >
118
+ {timeLabel}
119
+ </KLabel.Text>
120
+ ) : null}
121
+ </KContainer.View>
122
+ );
123
+ }
124
+ );
125
+
126
+ LinkMessage.displayName = 'LinkMessage';
127
+
128
+ const styles = StyleSheet.create({
129
+ wrapper: {
130
+ maxWidth: '80%',
131
+ },
132
+ bubble: {
133
+ paddingHorizontal: KSpacingValue['0.75rem'],
134
+ paddingVertical: KSpacingValue['0.5rem'],
135
+ borderRadius: KSpacingValue['1.25rem'],
136
+ },
137
+ bubbleReceived: {
138
+ backgroundColor: CHAT_BUBBLE_COLORS.received,
139
+ },
140
+ bubbleSent: {
141
+ backgroundColor: CHAT_BUBBLE_COLORS.sent,
142
+ },
143
+ textRow: {
144
+ paddingHorizontal: KSpacingValue['0.25rem'],
145
+ },
146
+ card: {
147
+ borderRadius: KSpacingValue['0.75rem'],
148
+ borderWidth: 1,
149
+ borderColor: 'rgba(57,62,64,0.1)',
150
+ backgroundColor: KColors.white,
151
+ overflow: 'hidden',
152
+ },
153
+ cardThumb: {
154
+ width: '100%',
155
+ aspectRatio: 16 / 9,
156
+ },
157
+ cardBody: {
158
+ paddingHorizontal: KSpacingValue['0.75rem'],
159
+ paddingVertical: KSpacingValue['0.5rem'],
160
+ gap: 2,
161
+ },
162
+ });
@@ -0,0 +1,45 @@
1
+ import { memo } from 'react';
2
+ import { KContainer } from '@droppii/libs';
3
+ import { MergedImageGrid } from '../../MergedImageGrid';
4
+ import { messageStyles } from '../styles';
5
+ import type { BaseLegendMessageProps } from '../types';
6
+
7
+ export const MergedMessage = memo(
8
+ ({ message, isOutgoing, onMediaPress }: BaseLegendMessageProps) => {
9
+ const mergeElem = (message as any).mergeElem;
10
+
11
+ if (!mergeElem?.multiMessage) {
12
+ return null;
13
+ }
14
+
15
+ const { multiMessage } = mergeElem;
16
+ const imageMessages = multiMessage.filter(
17
+ (msg: any) => msg.contentType === 102
18
+ );
19
+
20
+ return (
21
+ <KContainer.View style={messageStyles.wrapper}>
22
+ <KContainer.View
23
+ style={[
24
+ messageStyles.bubble,
25
+ isOutgoing
26
+ ? messageStyles.bubbleSent
27
+ : messageStyles.bubbleReceived,
28
+ ]}
29
+ >
30
+ {imageMessages.length > 0 && (
31
+ <KContainer.View marginB="0.5rem">
32
+ <MergedImageGrid
33
+ images={imageMessages}
34
+ maxDisplay={4}
35
+ onMediaPress={onMediaPress}
36
+ />
37
+ </KContainer.View>
38
+ )}
39
+ </KContainer.View>
40
+ </KContainer.View>
41
+ );
42
+ }
43
+ );
44
+
45
+ MergedMessage.displayName = 'MergedMessage';
@@ -0,0 +1,39 @@
1
+ import { StyleSheet } from 'react-native';
2
+ import { KSpacingValue } from '@droppii/libs';
3
+ import { CHAT_BUBBLE_COLORS } from '../../screens/chat-detail/constants';
4
+
5
+ export const messageStyles = StyleSheet.create({
6
+ wrapper: {
7
+ maxWidth: '80%',
8
+ },
9
+ bubble: {
10
+ paddingHorizontal: KSpacingValue['0.75rem'],
11
+ paddingVertical: KSpacingValue['0.5rem'],
12
+ borderRadius: KSpacingValue['1.25rem'],
13
+ },
14
+ bubbleReceived: {
15
+ backgroundColor: CHAT_BUBBLE_COLORS.received,
16
+ },
17
+ bubbleSent: {
18
+ backgroundColor: CHAT_BUBBLE_COLORS.sent,
19
+ },
20
+ imageBubble: {
21
+ borderRadius: KSpacingValue['0.75rem'],
22
+ },
23
+ videoPlaceholder: {
24
+ backgroundColor: CHAT_BUBBLE_COLORS.received,
25
+ },
26
+ videoContainer: {
27
+ position: 'relative',
28
+ overflow: 'hidden',
29
+ borderRadius: KSpacingValue['0.75rem'],
30
+ },
31
+ playButtonOverlay: {
32
+ position: 'absolute',
33
+ top: 0,
34
+ left: 0,
35
+ right: 0,
36
+ bottom: 0,
37
+ backgroundColor: 'rgba(0, 0, 0, 0.3)',
38
+ },
39
+ });
@@ -0,0 +1,53 @@
1
+ import { memo } from 'react';
2
+ import { KContainer, KLabel } from '@droppii/libs';
3
+ import { getMessageText } from '../../../utils/legendListMessage';
4
+ import type { DMessageItem } from '../../../types/chat';
5
+ import { CHAT_BUBBLE_COLORS } from '../../../screens/chat-detail/constants';
6
+ import { messageStyles } from '../styles';
7
+ import { formatMessageTime } from '../types';
8
+
9
+ interface TextMessageProps {
10
+ message: DMessageItem;
11
+ isOutgoing: boolean;
12
+ createdAtTime: number;
13
+ }
14
+
15
+ export const TextMessage = memo(
16
+ ({ message, isOutgoing, createdAtTime }: TextMessageProps) => {
17
+ const messageText = getMessageText(message);
18
+ const timeLabel = formatMessageTime(createdAtTime);
19
+
20
+ if (!messageText?.trim()) {
21
+ return null;
22
+ }
23
+
24
+ return (
25
+ <KContainer.View style={messageStyles.wrapper}>
26
+ <KContainer.View
27
+ style={[
28
+ messageStyles.bubble,
29
+ isOutgoing
30
+ ? messageStyles.bubbleSent
31
+ : messageStyles.bubbleReceived,
32
+ ]}
33
+ >
34
+ <KLabel.Text typo="TextMdNormal" color={CHAT_BUBBLE_COLORS.text}>
35
+ {messageText}
36
+ </KLabel.Text>
37
+ </KContainer.View>
38
+
39
+ {!isOutgoing && timeLabel ? (
40
+ <KLabel.Text
41
+ typo="TextXsNormal"
42
+ color={CHAT_BUBBLE_COLORS.timestamp}
43
+ marginL={'0.25rem'}
44
+ >
45
+ {timeLabel}
46
+ </KLabel.Text>
47
+ ) : null}
48
+ </KContainer.View>
49
+ );
50
+ }
51
+ );
52
+
53
+ TextMessage.displayName = 'TextMessage';
@@ -0,0 +1,22 @@
1
+ import type { DMessageItem } from '../../types/chat';
2
+ import type { MediaItem } from '../../hooks/useMediaViewer';
3
+
4
+ export interface BaseLegendMessageProps {
5
+ message: DMessageItem;
6
+ isOutgoing: boolean;
7
+ createdAtTime: number;
8
+ onMediaPress?: (items: MediaItem[], index?: number) => void;
9
+ }
10
+
11
+ export const formatMessageTime = (createdAt: number) => {
12
+ const date = new Date(createdAt);
13
+ if (Number.isNaN(date.getTime())) {
14
+ return '';
15
+ }
16
+
17
+ return date.toLocaleTimeString('vi-VN', {
18
+ hour: '2-digit',
19
+ minute: '2-digit',
20
+ hour12: false,
21
+ });
22
+ };
@@ -0,0 +1,120 @@
1
+ import { memo, useCallback } from 'react';
2
+ import { StyleSheet } from 'react-native';
3
+ import { KContainer, KImage, KLabel } from '@droppii/libs';
4
+ import ChatImageDimens, {
5
+ CHAT_IMAGE_VIEW_SOURCE,
6
+ } from '../../../utils/chatImageDimens';
7
+ import { CHAT_BUBBLE_COLORS } from '../../../screens/chat-detail/constants';
8
+ import { messageStyles } from '../styles';
9
+ import type { BaseLegendMessageProps } from '../types';
10
+
11
+ const formatDuration = (durationMs: number): string => {
12
+ const totalSeconds = Math.floor(durationMs / 1000);
13
+ const minutes = Math.floor(totalSeconds / 60);
14
+ const seconds = totalSeconds % 60;
15
+ return `${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`;
16
+ };
17
+
18
+ export const VideoMessage = memo(
19
+ ({ message, onMediaPress }: BaseLegendMessageProps) => {
20
+ const videoElem = message?.videoElem;
21
+ const videoUrl = videoElem?.videoUrl;
22
+ const duration = videoElem?.duration;
23
+ const thumbnail = videoElem?.snapshotUrl;
24
+
25
+ const handlePress = useCallback(() => {
26
+ if (videoUrl && onMediaPress) {
27
+ onMediaPress([{ url: videoUrl, isVideo: true }], 0);
28
+ }
29
+ }, [videoUrl, onMediaPress]);
30
+
31
+ if (!videoUrl) {
32
+ return (
33
+ <KContainer.View style={messageStyles.wrapper}>
34
+ <KContainer.View
35
+ style={[messageStyles.bubble, messageStyles.videoPlaceholder]}
36
+ >
37
+ <KLabel.Text typo="TextSmNormal" color={CHAT_BUBBLE_COLORS.text}>
38
+ 📹 [Video unavailable]
39
+ </KLabel.Text>
40
+ </KContainer.View>
41
+ </KContainer.View>
42
+ );
43
+ }
44
+
45
+ const dimen = ChatImageDimens.getDimensions(
46
+ CHAT_IMAGE_VIEW_SOURCE.MessageListThumbnail
47
+ );
48
+
49
+ return (
50
+ <KContainer.View style={messageStyles.wrapper}>
51
+ <KContainer.Touchable
52
+ onPress={handlePress}
53
+ style={[
54
+ styles.videoContainer,
55
+ { width: dimen.width, height: dimen.height },
56
+ ]}
57
+ >
58
+ {thumbnail ? (
59
+ <KImage.Base
60
+ uri={thumbnail}
61
+ width={dimen.width}
62
+ height={dimen.height}
63
+ resizeMode="cover"
64
+ />
65
+ ) : (
66
+ <KContainer.View style={styles.videoBg} />
67
+ )}
68
+
69
+ <KContainer.View style={styles.playOverlay} center>
70
+ <KImage.VectorIcons
71
+ name="play-circle"
72
+ provider="MaterialCommunityIcons"
73
+ size={48}
74
+ color="white"
75
+ />
76
+ </KContainer.View>
77
+
78
+ {duration && (
79
+ <KContainer.View style={styles.durationBadge}>
80
+ <KLabel.Text typo="TextXsNormal" color="white">
81
+ {formatDuration(duration)}
82
+ </KLabel.Text>
83
+ </KContainer.View>
84
+ )}
85
+ </KContainer.Touchable>
86
+ </KContainer.View>
87
+ );
88
+ }
89
+ );
90
+
91
+ VideoMessage.displayName = 'VideoMessage';
92
+
93
+ const styles = StyleSheet.create({
94
+ videoContainer: {
95
+ overflow: 'hidden',
96
+ borderRadius: 8,
97
+ backgroundColor: '#000',
98
+ },
99
+ videoBg: {
100
+ flex: 1,
101
+ backgroundColor: '#000',
102
+ },
103
+ playOverlay: {
104
+ position: 'absolute',
105
+ top: 0,
106
+ left: 0,
107
+ right: 0,
108
+ bottom: 0,
109
+ backgroundColor: 'rgba(0, 0, 0, 0.3)',
110
+ },
111
+ durationBadge: {
112
+ position: 'absolute',
113
+ bottom: 8,
114
+ right: 8,
115
+ backgroundColor: 'rgba(0, 0, 0, 0.7)',
116
+ paddingHorizontal: 6,
117
+ paddingVertical: 3,
118
+ borderRadius: 4,
119
+ },
120
+ });
@@ -0,0 +1,72 @@
1
+ /**
2
+ * API Endpoints Configuration
3
+ *
4
+ * Centralized endpoint management for all API calls.
5
+ * Can be overridden per environment or feature flag.
6
+ *
7
+ * Note: imageUpload is a relative path because ReactNativeBlobUtil.fetch()
8
+ * is used for image uploads (not axios). The full URL is constructed
9
+ * in the imageUpload service using the base URL from environment/config.
10
+ */
11
+
12
+ export interface ApiEndpoints {
13
+ // Chat service (relative paths - used with axios baseURL)
14
+ urlMetadata: string;
15
+ // Image upload service (relative path - full URL constructed in imageUpload service)
16
+ imageUpload: string;
17
+ }
18
+
19
+ const DEFAULT_ENDPOINTS: ApiEndpoints = {
20
+ urlMetadata: '/chat-service/v1/utils/url-metadata',
21
+ imageUpload: '/uploader-service/v1/uploader/permanently',
22
+ };
23
+
24
+ let endpoints: ApiEndpoints = { ...DEFAULT_ENDPOINTS };
25
+
26
+ /**
27
+ * Get a specific API endpoint
28
+ * @param key - Endpoint key
29
+ * @returns Full endpoint URL
30
+ */
31
+ export const getApiEndpoint = <K extends keyof ApiEndpoints>(
32
+ key: K
33
+ ): ApiEndpoints[K] => {
34
+ return endpoints[key];
35
+ };
36
+
37
+ /**
38
+ * Set a specific API endpoint (useful for testing/override)
39
+ * @param key - Endpoint key
40
+ * @param value - New endpoint URL
41
+ */
42
+ export const setApiEndpoint = <K extends keyof ApiEndpoints>(
43
+ key: K,
44
+ value: ApiEndpoints[K]
45
+ ) => {
46
+ endpoints[key] = value;
47
+ };
48
+
49
+ /**
50
+ * Set all endpoints at once
51
+ * @param newEndpoints - New endpoints object
52
+ */
53
+ export const setAllApiEndpoints = (newEndpoints: Partial<ApiEndpoints>) => {
54
+ endpoints = {
55
+ ...endpoints,
56
+ ...newEndpoints,
57
+ };
58
+ };
59
+
60
+ /**
61
+ * Reset to default endpoints
62
+ */
63
+ export const resetApiEndpoints = () => {
64
+ endpoints = { ...DEFAULT_ENDPOINTS };
65
+ };
66
+
67
+ /**
68
+ * Get all endpoints (returns copy)
69
+ */
70
+ export const getAllApiEndpoints = (): ApiEndpoints => ({
71
+ ...endpoints,
72
+ });