@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,76 @@
1
+ import type { ImageFile } from '../types/imageUpload';
2
+
3
+ export const generateUUID = (): string => {
4
+ return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
5
+ };
6
+
7
+ export const isVideoFile = (filename: string | undefined): boolean => {
8
+ if (!filename) return false;
9
+ const mimeType = getMimeType(filename);
10
+ return mimeType.startsWith('video/');
11
+ };
12
+
13
+ // Best detection: check MIME type from picker response
14
+ export const isVideoFromPicker = (pickedItem: any): boolean => {
15
+ const mime = pickedItem?.mime;
16
+ if (!mime) return false;
17
+ return mime.startsWith('video/');
18
+ };
19
+
20
+ export const getMimeType = (fileName: string): string => {
21
+ const ext = fileName.split('.').pop()?.toLowerCase();
22
+ const mimeMap: Record<string, string> = {
23
+ jpg: 'image/jpeg',
24
+ jpeg: 'image/jpeg',
25
+ png: 'image/png',
26
+ webp: 'image/webp',
27
+ mp4: 'video/mp4',
28
+ mov: 'video/quicktime',
29
+ avi: 'video/x-msvideo',
30
+ mkv: 'video/x-matroska',
31
+ webm: 'video/webm',
32
+ m4v: 'video/mp4',
33
+ flv: 'video/x-flv',
34
+ wmv: 'video/x-ms-wmv',
35
+ mp3: 'audio/mpeg',
36
+ wav: 'audio/wav',
37
+ m4a: 'audio/mp4',
38
+ aac: 'audio/aac',
39
+ flac: 'audio/flac',
40
+ ogg: 'audio/ogg',
41
+ pdf: 'application/pdf',
42
+ doc: 'application/msword',
43
+ docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
44
+ xls: 'application/vnd.ms-excel',
45
+ xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
46
+ zip: 'application/zip',
47
+ };
48
+ return mimeMap[ext || ''] || 'application/octet-stream';
49
+ };
50
+
51
+ export const formatFileSize = (bytes: number): string => {
52
+ if (bytes === 0) return '0 Bytes';
53
+ const k = 1024;
54
+ const sizes = ['Bytes', 'KB', 'MB', 'GB'];
55
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
56
+ return Math.round((bytes / Math.pow(k, i)) * 100) / 100 + ' ' + sizes[i];
57
+ };
58
+
59
+ export const validateImageFile = (file: ImageFile): string | null => {
60
+ const MAX_SIZE = 5 * 1024 * 1024;
61
+
62
+ if (file.size > MAX_SIZE) {
63
+ return `Image too large. Max ${formatFileSize(MAX_SIZE)}`;
64
+ }
65
+
66
+ const validMimes = ['image/jpeg', 'image/png', 'image/webp'];
67
+ if (!validMimes.includes(file.mime)) {
68
+ return 'Unsupported format. Only JPEG, PNG, WebP';
69
+ }
70
+
71
+ return null;
72
+ };
73
+
74
+ export const getImageUploadEndpoint = (baseUrl: string): string => {
75
+ return `${baseUrl}?isPublic=true&path=livechat`;
76
+ };
@@ -30,6 +30,8 @@ export const resolveChatMessageType = (
30
30
  return DChatMessageType.Video;
31
31
  case MessageType.FileMessage:
32
32
  return DChatMessageType.File;
33
+ case 107: // MergerMessage (merged/grouped messages)
34
+ return DChatMessageType.Merged;
33
35
  case MessageType.CustomMessage: {
34
36
  const customType = parseCustomDataType(message);
35
37
 
@@ -0,0 +1,19 @@
1
+ import { Alert } from 'react-native';
2
+
3
+ interface ToastConfig {
4
+ title?: string;
5
+ message?: string;
6
+ theme?: 'success' | 'danger' | 'warning' | 'info';
7
+ }
8
+
9
+ const UIUtils = {
10
+ toast: {
11
+ open: (config: ToastConfig) => {
12
+ const { title = 'Message', message = '' } = config;
13
+ Alert.alert(title, message);
14
+ },
15
+ },
16
+ };
17
+
18
+ export default UIUtils;
19
+ export { UIUtils };
package/src/utils/url.ts CHANGED
@@ -1,4 +1,4 @@
1
- const URL_REGEX = /\bhttps?:\/\/[^\s<>"']*[^\s<>"',.!?()\[\]{}]/g;
1
+ const URL_REGEX = /\bhttps?:\/\/[^\s<>"']*[^\s<>"',.!?()[\]{}]/g;
2
2
 
3
3
  export function extractUrls(text: string): string[] {
4
4
  return text.match(URL_REGEX) ?? [];
@@ -0,0 +1,85 @@
1
+ import RNFS from 'react-native-fs';
2
+ import { createThumbnail } from 'react-native-create-thumbnail';
3
+
4
+ interface ThumbnailOptions {
5
+ time?: number; // timestamp in milliseconds (default: 0)
6
+ quality?: number; // 0-100 (default: 100)
7
+ }
8
+
9
+ interface ThumbnailResult {
10
+ path: string;
11
+ width: number;
12
+ height: number;
13
+ }
14
+
15
+ export const VideoThumbnailUtil = {
16
+ generateThumbnail: async (
17
+ videoPath: string,
18
+ options: ThumbnailOptions = {}
19
+ ): Promise<ThumbnailResult | null> => {
20
+ const { time = 1000, quality = 80 } = options; // time in milliseconds
21
+
22
+ try {
23
+ console.log('[VideoThumbnail] Generating thumbnail', {
24
+ videoPath,
25
+ timeMs: time,
26
+ quality,
27
+ });
28
+
29
+ const result = await createThumbnail({
30
+ url: videoPath,
31
+ timeStamp: time,
32
+ format: 'jpeg',
33
+ dirSize: 100,
34
+ cacheName: 'video-thumbnails',
35
+ });
36
+
37
+ console.log('✅ [VideoThumbnail] THUMBNAIL PATH:', result.path);
38
+ console.log('[VideoThumbnail] Thumbnail generated', {
39
+ path: result.path,
40
+ width: result.width || 0,
41
+ height: result.height || 0,
42
+ });
43
+
44
+ return {
45
+ path: result.path,
46
+ width: result.width || 0,
47
+ height: result.height || 0,
48
+ };
49
+ } catch (error) {
50
+ console.error('[VideoThumbnail] Failed to generate thumbnail', error);
51
+ return null;
52
+ }
53
+ },
54
+
55
+ cleanupThumbnail: async (thumbnailPath: string): Promise<void> => {
56
+ try {
57
+ if (!thumbnailPath) return;
58
+ await RNFS.unlink(thumbnailPath);
59
+ console.log('[VideoThumbnail] Cleaned up:', thumbnailPath);
60
+ } catch (err) {
61
+ console.warn('[VideoThumbnail] Cleanup failed:', err);
62
+ }
63
+ },
64
+
65
+ batchGenerateThumbnails: async (
66
+ videoPaths: string[],
67
+ options: ThumbnailOptions = {}
68
+ ): Promise<ThumbnailResult[]> => {
69
+ const results: ThumbnailResult[] = [];
70
+
71
+ for (const videoPath of videoPaths) {
72
+ const thumbnail = await VideoThumbnailUtil.generateThumbnail(
73
+ videoPath,
74
+ options
75
+ );
76
+ if (thumbnail) {
77
+ results.push(thumbnail);
78
+ }
79
+ }
80
+
81
+ return results;
82
+ },
83
+ };
84
+
85
+ export default VideoThumbnailUtil;
@@ -1,147 +0,0 @@
1
- "use strict";
2
-
3
- import { memo, useCallback, useMemo, useRef } from 'react';
4
- import { ActivityIndicator, StyleSheet } from 'react-native';
5
- import { GiftedChat } from 'react-native-gifted-chat';
6
- import { KContainer, KColors, KSpacingValue } from '@droppii/libs';
7
- import { mapOpenIMMessagesToGiftedChat } from "../../utils/giftedChatMessage.js";
8
- import { ChatDay } from "./ChatDay.js";
9
- import { ChatLoadEarlier } from "./ChatLoadEarlier.js";
10
- import { ChatScrollToBottom } from "./ChatScrollToBottom.js";
11
- import { ChatMessageBubble } from "./messages/ChatMessageBubble.js";
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- export const ChatList = /*#__PURE__*/memo(({
14
- messages = [],
15
- currentUserId = '',
16
- renderChat,
17
- onLoadEarlier,
18
- isLoading,
19
- isLoadingEarlier,
20
- hasMoreEarlier
21
- // Note: onLoadNewer, isLoadingNewer, hasMoreNewer are not used in GiftedChat
22
- // as it has its own pagination mechanism. They're kept for API compatibility.
23
- }) => {
24
- const giftedMessages = useMemo(() => mapOpenIMMessagesToGiftedChat(messages), [messages]);
25
- const user = useMemo(() => ({
26
- _id: String(currentUserId)
27
- }), [currentUserId]);
28
- const renderMessage = useCallback(props => {
29
- const currentMessage = props.currentMessage;
30
- if (!currentMessage) {
31
- return /*#__PURE__*/_jsx(KContainer.View, {});
32
- }
33
- const isOutgoing = props.position === 'right';
34
- return /*#__PURE__*/_jsx(KContainer.View, {
35
- style: [styles.messageRow, isOutgoing ? styles.messageRowRight : styles.messageRowLeft],
36
- children: renderChat ? renderChat(currentMessage.openIMMessage) : /*#__PURE__*/_jsx(ChatMessageBubble, {
37
- message: currentMessage,
38
- position: props.position
39
- })
40
- });
41
- }, [renderChat]);
42
- const renderDay = useCallback(props => /*#__PURE__*/_jsx(ChatDay, {
43
- ...props
44
- }), []);
45
- const renderLoadEarlier = useCallback(props => /*#__PURE__*/_jsx(ChatLoadEarlier, {
46
- ...props
47
- }), []);
48
- const onLoadEarlierRef = useRef(onLoadEarlier);
49
- onLoadEarlierRef.current = onLoadEarlier;
50
- const handleLoadEarlier = useCallback(() => {
51
- onLoadEarlierRef.current?.();
52
- }, []);
53
- const loadEarlierMessagesProps = useMemo(() => onLoadEarlier ? {
54
- isAvailable: !!hasMoreEarlier,
55
- isInfiniteScrollEnabled: true,
56
- onPress: handleLoadEarlier,
57
- isLoading: isLoadingEarlier ?? false
58
- } : undefined, [hasMoreEarlier, isLoadingEarlier, onLoadEarlier, handleLoadEarlier]);
59
- const renderScrollToBottom = useCallback(() => /*#__PURE__*/_jsx(ChatScrollToBottom, {}), []);
60
- return /*#__PURE__*/_jsx(KContainer.View, {
61
- flex: true,
62
- background: KColors.white,
63
- children: isLoading ? /*#__PURE__*/_jsx(KContainer.View, {
64
- flex: true,
65
- center: true,
66
- children: /*#__PURE__*/_jsx(ActivityIndicator, {
67
- color: KColors.palette.primary.w400,
68
- size: "small"
69
- })
70
- }) : /*#__PURE__*/_jsx(GiftedChat, {
71
- messages: giftedMessages,
72
- user: user,
73
- renderInputToolbar: () => null,
74
- renderAvatar: () => null,
75
- renderMessage: renderMessage,
76
- renderDay: renderDay,
77
- renderLoadEarlier: onLoadEarlier ? renderLoadEarlier : undefined,
78
- isDayAnimationEnabled: false,
79
- keyboardAvoidingViewProps: {
80
- enabled: false
81
- },
82
- messagesContainerStyle: styles.messagesContainer,
83
- minInputToolbarHeight: 0,
84
- loadEarlierMessagesProps: loadEarlierMessagesProps,
85
- listProps: {
86
- showsVerticalScrollIndicator: false,
87
- keyboardShouldPersistTaps: 'handled',
88
- contentContainerStyle: styles.content,
89
- onEndReachedThreshold: 0.5
90
- },
91
- reply: {
92
- swipe: {
93
- isEnabled: true,
94
- direction: 'left'
95
- }
96
- },
97
- isScrollToBottomEnabled: true,
98
- scrollToBottomComponent: renderScrollToBottom,
99
- scrollToBottomStyle: styles.scrollToBottom,
100
- scrollToBottomContentStyle: styles.scrollToBottomContent
101
- })
102
- });
103
- });
104
- ChatList.displayName = 'ChatList';
105
- const styles = StyleSheet.create({
106
- messagesContainer: {
107
- backgroundColor: KColors.white
108
- },
109
- content: {
110
- paddingVertical: KSpacingValue['0.75rem'],
111
- flexGrow: 1
112
- },
113
- messageRow: {
114
- width: '100%',
115
- paddingHorizontal: KSpacingValue['0.75rem'],
116
- marginBottom: KSpacingValue['0.25rem']
117
- },
118
- messageRowLeft: {
119
- alignItems: 'flex-start'
120
- },
121
- messageRowRight: {
122
- alignItems: 'flex-end'
123
- },
124
- scrollToBottom: {
125
- position: 'absolute',
126
- bottom: 20,
127
- right: 16,
128
- zIndex: 999
129
- },
130
- scrollToBottomContent: {
131
- backgroundColor: KColors.white,
132
- width: 32,
133
- height: 32,
134
- borderRadius: 16,
135
- shadowColor: KColors.black,
136
- shadowOffset: {
137
- width: 0,
138
- height: 1
139
- },
140
- shadowOpacity: 0.16,
141
- shadowRadius: 8,
142
- elevation: 8,
143
- justifyContent: 'center',
144
- alignItems: 'center'
145
- }
146
- });
147
- //# sourceMappingURL=ChatList.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["memo","useCallback","useMemo","useRef","ActivityIndicator","StyleSheet","GiftedChat","KContainer","KColors","KSpacingValue","mapOpenIMMessagesToGiftedChat","ChatDay","ChatLoadEarlier","ChatScrollToBottom","ChatMessageBubble","jsx","_jsx","ChatList","messages","currentUserId","renderChat","onLoadEarlier","isLoading","isLoadingEarlier","hasMoreEarlier","giftedMessages","user","_id","String","renderMessage","props","currentMessage","View","isOutgoing","position","style","styles","messageRow","messageRowRight","messageRowLeft","children","openIMMessage","message","renderDay","renderLoadEarlier","onLoadEarlierRef","current","handleLoadEarlier","loadEarlierMessagesProps","isAvailable","isInfiniteScrollEnabled","onPress","undefined","renderScrollToBottom","flex","background","white","center","color","palette","primary","w400","size","renderInputToolbar","renderAvatar","isDayAnimationEnabled","keyboardAvoidingViewProps","enabled","messagesContainerStyle","messagesContainer","minInputToolbarHeight","listProps","showsVerticalScrollIndicator","keyboardShouldPersistTaps","contentContainerStyle","content","onEndReachedThreshold","reply","swipe","isEnabled","direction","isScrollToBottomEnabled","scrollToBottomComponent","scrollToBottomStyle","scrollToBottom","scrollToBottomContentStyle","scrollToBottomContent","displayName","create","backgroundColor","paddingVertical","flexGrow","width","paddingHorizontal","marginBottom","alignItems","bottom","right","zIndex","height","borderRadius","shadowColor","black","shadowOffset","shadowOpacity","shadowRadius","elevation","justifyContent"],"sourceRoot":"../../../../src","sources":["screens/chat-detail/ChatList.tsx"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,WAAW,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAC1D,SAASC,iBAAiB,EAAEC,UAAU,QAAQ,cAAc;AAC5D,SACEC,UAAU,QAIL,0BAA0B;AACjC,SAASC,UAAU,EAAEC,OAAO,EAAEC,aAAa,QAAQ,eAAe;AAClE,SAASC,6BAA6B,QAAQ,kCAA+B;AAI7E,SAASC,OAAO,QAAQ,cAAW;AACnC,SAASC,eAAe,QAAQ,sBAAmB;AACnD,SAASC,kBA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C;EACD8B,cAAc,EAAE;IACdwD,UAAU,EAAE;EACd,CAAC;EACDzD,eAAe,EAAE;IACfyD,UAAU,EAAE;EACd,CAAC;EACDX,cAAc,EAAE;IACdlD,QAAQ,EAAE,UAAU;IACpB8D,MAAM,EAAE,EAAE;IACVC,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE;EACV,CAAC;EACDZ,qBAAqB,EAAE;IACrBG,eAAe,EAAEjF,OAAO,CAACgD,KAAK;IAC9BoC,KAAK,EAAE,EAAE;IACTO,MAAM,EAAE,EAAE;IACVC,YAAY,EAAE,EAAE;IAChBC,WAAW,EAAE7F,OAAO,CAAC8F,KAAK;IAC1BC,YAAY,EAAE;MAAEX,KAAK,EAAE,CAAC;MAAEO,MAAM,EAAE;IAAE,CAAC;IACrCK,aAAa,EAAE,IAAI;IACnBC,YAAY,EAAE,CAAC;IACfC,SAAS,EAAE,CAAC;IACZC,cAAc,EAAE,QAAQ;IACxBZ,UAAU,EAAE;EACd;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1,62 +0,0 @@
1
- "use strict";
2
-
3
- import { memo } from 'react';
4
- import { StyleSheet } from 'react-native';
5
- import { KContainer, KLabel, KSpacingValue } from '@droppii/libs';
6
- import { CHAT_BUBBLE_COLORS } from "./constants.js";
7
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
- const formatMessageTime = createdAt => {
9
- const date = new Date(createdAt);
10
- if (Number.isNaN(date.getTime())) {
11
- return '';
12
- }
13
- return date.toLocaleTimeString('vi-VN', {
14
- hour: '2-digit',
15
- minute: '2-digit',
16
- hour12: false
17
- });
18
- };
19
- export const ChatTextBubble = /*#__PURE__*/memo(({
20
- message,
21
- position
22
- }) => {
23
- const isOutgoing = position === 'right';
24
- const timeLabel = formatMessageTime(message.createdAt);
25
- if (!message.text?.trim()) {
26
- return null;
27
- }
28
- return /*#__PURE__*/_jsxs(KContainer.View, {
29
- style: styles.wrapper,
30
- children: [/*#__PURE__*/_jsx(KContainer.View, {
31
- style: [styles.bubble, isOutgoing ? styles.bubbleSent : styles.bubbleReceived],
32
- children: /*#__PURE__*/_jsx(KLabel.Text, {
33
- typo: "TextMdNormal",
34
- color: CHAT_BUBBLE_COLORS.text,
35
- children: message.text
36
- })
37
- }), !isOutgoing && timeLabel ? /*#__PURE__*/_jsx(KLabel.Text, {
38
- typo: "TextXsNormal",
39
- color: CHAT_BUBBLE_COLORS.timestamp,
40
- marginL: '0.25rem',
41
- children: timeLabel
42
- }) : null]
43
- });
44
- });
45
- ChatTextBubble.displayName = 'ChatTextBubble';
46
- const styles = StyleSheet.create({
47
- wrapper: {
48
- maxWidth: '80%'
49
- },
50
- bubble: {
51
- paddingHorizontal: KSpacingValue['0.75rem'],
52
- paddingVertical: KSpacingValue['0.5rem'],
53
- borderRadius: KSpacingValue['1.25rem']
54
- },
55
- bubbleReceived: {
56
- backgroundColor: CHAT_BUBBLE_COLORS.received
57
- },
58
- bubbleSent: {
59
- backgroundColor: CHAT_BUBBLE_COLORS.sent
60
- }
61
- });
62
- //# sourceMappingURL=ChatTextBubble.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["memo","StyleSheet","KContainer","KLabel","KSpacingValue","CHAT_BUBBLE_COLORS","jsx","_jsx","jsxs","_jsxs","formatMessageTime","createdAt","date","Date","Number","isNaN","getTime","toLocaleTimeString","hour","minute","hour12","ChatTextBubble","message","position","isOutgoing","timeLabel","text","trim","View","style","styles","wrapper","children","bubble","bubbleSent","bubbleReceived","Text","typo","color","timestamp","marginL","displayName","create","maxWidth","paddingHorizontal","paddingVertical","borderRadius","backgroundColor","received","sent"],"sourceRoot":"../../../../src","sources":["screens/chat-detail/ChatTextBubble.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,OAAO;AAC5B,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,UAAU,EAAEC,MAAM,EAAEC,aAAa,QAAQ,eAAe;AAEjE,SAASC,kBAAkB,QAAQ,gBAAa;AAAC,SAAAC,GAAA,I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AEjC,kBAAkB,CAACkC,SAAU;MACpCC,OAAO,EAAE,SAAU;MAAAR,QAAA,EAElBP;IAAS,CACC,CAAC,GACZ,IAAI;EAAA,CACO,CAAC;AAEtB,CACF,CAAC;AAEDJ,cAAc,CAACoB,WAAW,GAAG,gBAAgB;AAE7C,MAAMX,MAAM,GAAG7B,UAAU,CAACyC,MAAM,CAAC;EAC/BX,OAAO,EAAE;IACPY,QAAQ,EAAE;EACZ,CAAC;EACDV,MAAM,EAAE;IACNW,iBAAiB,EAAExC,aAAa,CAAC,SAAS,CAAC;IAC3CyC,eAAe,EAAEzC,aAAa,CAAC,QAAQ,CAAC;IACxC0C,YAAY,EAAE1C,aAAa,CAAC,SAAS;EACvC,CAAC;EACD+B,cAAc,EAAE;IACdY,eAAe,EAAE1C,kBAAkB,CAAC2C;EACtC,CAAC;EACDd,UAAU,EAAE;IACVa,eAAe,EAAE1C,kBAAkB,CAAC4C;EACtC;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1,244 +0,0 @@
1
- "use strict";
2
-
3
- import { memo } from 'react';
4
- import { Linking, StyleSheet, Text } from 'react-native';
5
- import { KContainer, KImage, KLabel, KColors, KSpacingValue } from '@droppii/libs';
6
- import { getMessageText } from "../../../utils/legendListMessage.js";
7
- import { CHAT_BUBBLE_COLORS } from "../constants.js";
8
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
- const formatMessageTime = createdAt => {
10
- const date = new Date(createdAt);
11
- if (Number.isNaN(date.getTime())) return '';
12
- return date.toLocaleTimeString('vi-VN', {
13
- hour: '2-digit',
14
- minute: '2-digit',
15
- hour12: false
16
- });
17
- };
18
-
19
- // Text Message Component
20
- export const LegendTextMessage = /*#__PURE__*/memo(({
21
- message,
22
- isOutgoing,
23
- createdAtTime
24
- }) => {
25
- const messageText = getMessageText(message);
26
- const timeLabel = formatMessageTime(createdAtTime);
27
- if (!messageText?.trim()) {
28
- return null;
29
- }
30
- return /*#__PURE__*/_jsxs(KContainer.View, {
31
- style: styles.wrapper,
32
- children: [/*#__PURE__*/_jsx(KContainer.View, {
33
- style: [styles.bubble, isOutgoing ? styles.bubbleSent : styles.bubbleReceived],
34
- children: /*#__PURE__*/_jsx(KLabel.Text, {
35
- typo: "TextMdNormal",
36
- color: CHAT_BUBBLE_COLORS.text,
37
- children: messageText
38
- })
39
- }), !isOutgoing && timeLabel ? /*#__PURE__*/_jsx(KLabel.Text, {
40
- typo: "TextXsNormal",
41
- color: CHAT_BUBBLE_COLORS.timestamp,
42
- marginL: "0.25rem",
43
- children: timeLabel
44
- }) : null]
45
- });
46
- });
47
- LegendTextMessage.displayName = 'LegendTextMessage';
48
-
49
- // Image Message Component (placeholder)
50
- export const LegendImageMessage = /*#__PURE__*/memo(({
51
- isOutgoing
52
- }) => {
53
- return /*#__PURE__*/_jsx(KContainer.View, {
54
- style: styles.wrapper,
55
- children: /*#__PURE__*/_jsx(KContainer.View, {
56
- style: [styles.bubble, isOutgoing ? styles.bubbleSent : styles.bubbleReceived],
57
- children: /*#__PURE__*/_jsx(KLabel.Text, {
58
- typo: "TextSmNormal",
59
- color: CHAT_BUBBLE_COLORS.text,
60
- children: "[Image]"
61
- })
62
- })
63
- });
64
- });
65
- LegendImageMessage.displayName = 'LegendImageMessage';
66
-
67
- // Video Message Component (placeholder)
68
- export const LegendVideoMessage = /*#__PURE__*/memo(({
69
- isOutgoing
70
- }) => {
71
- return /*#__PURE__*/_jsx(KContainer.View, {
72
- style: styles.wrapper,
73
- children: /*#__PURE__*/_jsx(KContainer.View, {
74
- style: [styles.bubble, isOutgoing ? styles.bubbleSent : styles.bubbleReceived],
75
- children: /*#__PURE__*/_jsx(KLabel.Text, {
76
- typo: "TextSmNormal",
77
- color: CHAT_BUBBLE_COLORS.text,
78
- children: "[Video]"
79
- })
80
- })
81
- });
82
- });
83
- LegendVideoMessage.displayName = 'LegendVideoMessage';
84
-
85
- // File Message Component
86
- export const LegendFileMessage = /*#__PURE__*/memo(({
87
- message,
88
- isOutgoing
89
- }) => {
90
- const fileName = message.fileElem?.fileName || message.content || '[File]';
91
- return /*#__PURE__*/_jsx(KContainer.View, {
92
- style: styles.wrapper,
93
- children: /*#__PURE__*/_jsx(KContainer.View, {
94
- style: [styles.bubble, isOutgoing ? styles.bubbleSent : styles.bubbleReceived],
95
- children: /*#__PURE__*/_jsxs(KLabel.Text, {
96
- typo: "TextSmNormal",
97
- color: CHAT_BUBBLE_COLORS.text,
98
- children: ["\uD83D\uDCCE ", fileName]
99
- })
100
- })
101
- });
102
- });
103
- LegendFileMessage.displayName = 'LegendFileMessage';
104
-
105
- // Link Message Component
106
- const parseUrlMetadata = ex => {
107
- if (!ex) return undefined;
108
- try {
109
- return JSON.parse(ex).urlMetadata;
110
- } catch {
111
- return undefined;
112
- }
113
- };
114
- const renderTextWithLinks = (content, urls) => {
115
- if (!urls.length) {
116
- return /*#__PURE__*/_jsx(KLabel.Text, {
117
- typo: "TextMdNormal",
118
- color: CHAT_BUBBLE_COLORS.text,
119
- children: content
120
- });
121
- }
122
- const parts = [];
123
- let remaining = content;
124
- for (const url of urls) {
125
- const idx = remaining.indexOf(url);
126
- if (idx === -1) continue;
127
- if (idx > 0) parts.push({
128
- text: remaining.slice(0, idx),
129
- isUrl: false
130
- });
131
- parts.push({
132
- text: url,
133
- isUrl: true
134
- });
135
- remaining = remaining.slice(idx + url.length);
136
- }
137
- if (remaining) parts.push({
138
- text: remaining,
139
- isUrl: false
140
- });
141
- return /*#__PURE__*/_jsx(KLabel.Text, {
142
- typo: "TextMdNormal",
143
- color: CHAT_BUBBLE_COLORS.text,
144
- children: parts.map((part, i) => part.isUrl ? /*#__PURE__*/_jsx(Text, {
145
- style: styles.urlText,
146
- onPress: () => Linking.openURL(part.text),
147
- children: part.text
148
- }, i) : /*#__PURE__*/_jsx(Text, {
149
- children: part.text
150
- }, i))
151
- });
152
- };
153
- export const LegendLinkMessage = /*#__PURE__*/memo(({
154
- message,
155
- isOutgoing,
156
- createdAtTime
157
- }) => {
158
- const content = message?.urlTextElem?.content;
159
- const urls = message?.urlTextElem?.urls ?? [];
160
- const metadata = parseUrlMetadata(message.ex);
161
- const timeLabel = formatMessageTime(createdAtTime);
162
- return /*#__PURE__*/_jsxs(KContainer.View, {
163
- style: styles.wrapper,
164
- children: [/*#__PURE__*/_jsxs(KContainer.View, {
165
- style: [styles.bubble, isOutgoing ? styles.bubbleSent : styles.bubbleReceived],
166
- children: [!!content?.trim() && /*#__PURE__*/_jsx(KContainer.View, {
167
- style: styles.textRow,
168
- children: renderTextWithLinks(content, urls)
169
- }), metadata && /*#__PURE__*/_jsxs(KContainer.Touchable, {
170
- style: styles.card,
171
- onPress: () => metadata.url && Linking.openURL(metadata.url),
172
- children: [!!metadata.image && /*#__PURE__*/_jsx(KImage.Base, {
173
- uri: metadata.image,
174
- style: styles.cardThumb,
175
- resizeMode: "cover"
176
- }), /*#__PURE__*/_jsxs(KContainer.View, {
177
- style: styles.cardBody,
178
- children: [!!metadata.title && /*#__PURE__*/_jsx(KLabel.Text, {
179
- typo: "TextNmMedium",
180
- color: KColors.palette.gray.w900,
181
- numberOfLines: 1,
182
- children: metadata.title
183
- }), !!metadata.url && /*#__PURE__*/_jsx(KLabel.Text, {
184
- typo: "TextXsMedium",
185
- color: KColors.palette.primary.w400,
186
- numberOfLines: 1,
187
- children: metadata.url
188
- }), !!metadata.description && /*#__PURE__*/_jsx(KLabel.Text, {
189
- typo: "TextXsNormal",
190
- color: KColors.gray.normal,
191
- numberOfLines: 2,
192
- children: metadata.description
193
- })]
194
- })]
195
- })]
196
- }), !isOutgoing && timeLabel ? /*#__PURE__*/_jsx(KLabel.Text, {
197
- typo: "TextXsNormal",
198
- color: CHAT_BUBBLE_COLORS.timestamp,
199
- marginL: "0.25rem",
200
- children: timeLabel
201
- }) : null]
202
- });
203
- });
204
- LegendLinkMessage.displayName = 'LegendLinkMessage';
205
- const styles = StyleSheet.create({
206
- wrapper: {
207
- maxWidth: '80%'
208
- },
209
- bubble: {
210
- paddingHorizontal: KSpacingValue['0.75rem'],
211
- paddingVertical: KSpacingValue['0.5rem'],
212
- borderRadius: KSpacingValue['1.25rem']
213
- },
214
- bubbleReceived: {
215
- backgroundColor: CHAT_BUBBLE_COLORS.received
216
- },
217
- bubbleSent: {
218
- backgroundColor: CHAT_BUBBLE_COLORS.sent
219
- },
220
- textRow: {
221
- paddingHorizontal: KSpacingValue['0.25rem']
222
- },
223
- urlText: {
224
- color: KColors.palette.primary.w400,
225
- fontWeight: '500'
226
- },
227
- card: {
228
- borderRadius: KSpacingValue['0.75rem'],
229
- borderWidth: 1,
230
- borderColor: 'rgba(57,62,64,0.1)',
231
- backgroundColor: KColors.white,
232
- overflow: 'hidden'
233
- },
234
- cardThumb: {
235
- width: '100%',
236
- aspectRatio: 16 / 9
237
- },
238
- cardBody: {
239
- paddingHorizontal: KSpacingValue['0.75rem'],
240
- paddingVertical: KSpacingValue['0.5rem'],
241
- gap: 2
242
- }
243
- });
244
- //# sourceMappingURL=message-types.js.map