@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 @@
1
+ {"version":3,"names":["generateUUID","ImageAttachmentHandler","validate","attachment","MAX_SIZE","sourceFile","size","valid","reason","validMimes","includes","mimeType","metadata","width","height","buildPayload","uploadedUrl","console","log","filename","url","picInfo","uuid","type","payload","sourcePicture","bigPicture","snapshotPicture","fileName"],"sourceRoot":"../../../../src","sources":["services/attachmentHandlers/imageAttachmentHandler.ts"],"mappings":";;AAEA,SAASA,YAAY,QAAQ,2BAAwB;AAErD,OAAO,MAAMC,sBAA0C,GAAG;EACxDC,QAAQA,CAACC,UAA2B,EAAE;IACpC,MAAMC,QAAQ,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI;IAChC,IAAID,UAAU,CAACE,UAAU,CAACC,IAAI,GAAGF,QAAQ,EAAE;MACzC,OAAO;QAAEG,KAAK,EAAE,KAAK;QAAEC,MAAM,EAAE;MAA0B,CAAC;IAC5D;IAEA,MAAMC,UAAU,GAAG,CAAC,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,CAAC;IACzE,IAAI,CAACA,UAAU,CAACC,QAAQ,CAACP,UAAU,CAACE,UAAU,CAACM,QAAQ,CAAC,EAAE;MACxD,OAAO;QACLJ,KAAK,EAAE,KAAK;QACZC,MAAM,EAAE,uBAAuBL,UAAU,CAACE,UAAU,CAACM,QAAQ;MAC/D,CAAC;IACH;IAEA,IAAIR,UAAU,CAACS,QAAQ,CAACC,KAAK,IAAI,CAAC,IAAIV,UAAU,CAACS,QAAQ,CAACE,MAAM,IAAI,CAAC,EAAE;MACrE,OAAO;QAAEP,KAAK,EAAE,KAAK;QAAEC,MAAM,EAAE;MAA2B,CAAC;IAC7D;IAEA,OAAO;MAAED,KAAK,EAAE;IAAK,CAAC;EACxB,CAAC;EAED,MAAMQ,YAAYA,CAACZ,UAA2B,EAAEa,WAAmB,EAAE;IACnEC,OAAO,CAACC,GAAG,CAAC,+CAA+C,EAAE;MAC3DC,QAAQ,EAAEhB,UAAU,CAACE,UAAU,CAACc,QAAQ;MACxCC,GAAG,EAAEJ;IACP,CAAC,CAAC;IAEF,MAAMK,OAAO,GAAG;MACdC,IAAI,EAAEtB,YAAY,CAAC,CAAC;MACpBuB,IAAI,EAAEpB,UAAU,CAACE,UAAU,CAACM,QAAQ;MACpCL,IAAI,EAAEH,UAAU,CAACE,UAAU,CAACC,IAAI;MAChCO,KAAK,EAAEV,UAAU,CAACS,QAAQ,CAACC,KAAK;MAChCC,MAAM,EAAEX,UAAU,CAACS,QAAQ,CAACE,MAAM;MAClCM,GAAG,EAAEJ;IACP,CAAC;IAED,MAAMQ,OAAO,GAAG;MACdC,aAAa,EAAEJ,OAAO;MACtBK,UAAU,EAAEL,OAAO;MACnBM,eAAe,EAAEN;IACnB,CAAC;IAEDJ,OAAO,CAACC,GAAG,CAAC,8CAA8C,EAAE;MAC1DU,QAAQ,EAAEzB,UAAU,CAACE,UAAU,CAACc;IAClC,CAAC,CAAC;IAEF,OAAOK,OAAO;EAChB;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ // Handlers are now dispatched directly in getAttachmentHandler without registry
4
+
5
+ // Legacy export for backward compatibility
6
+ export function initializeAttachmentHandlers() {
7
+ // No longer needed - handlers are dispatched directly
8
+ }
9
+ export { ImageAttachmentHandler } from "./imageAttachmentHandler.js";
10
+ export { default as VideoAttachmentHandler } from "./videoAttachmentHandler.js";
11
+ export { default as FileAttachmentHandler } from "./fileAttachmentHandler.js";
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["initializeAttachmentHandlers","ImageAttachmentHandler","default","VideoAttachmentHandler","FileAttachmentHandler"],"sourceRoot":"../../../../src","sources":["services/attachmentHandlers/index.ts"],"mappings":";;AAAA;;AAEA;AACA,OAAO,SAASA,4BAA4BA,CAAA,EAAS;EACnD;AAAA;AAGF,SAASC,sBAAsB,QAAQ,6BAA0B;AACjE,SAASC,OAAO,IAAIC,sBAAsB,QAAQ,6BAA0B;AAC5E,SAASD,OAAO,IAAIE,qBAAqB,QAAQ,4BAAyB","ignoreList":[]}
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+
3
+ export class VideoAttachmentHandler {
4
+ static MAX_VIDEO_SIZE = 100 * 1024 * 1024; // 100MB
5
+ static SUPPORTED_TYPES = ['video/mp4', 'video/quicktime'];
6
+ validate(attachment) {
7
+ if (attachment.type !== 'video') {
8
+ return {
9
+ valid: false,
10
+ reason: 'Invalid attachment type for video handler'
11
+ };
12
+ }
13
+ const {
14
+ sourceFile
15
+ } = attachment;
16
+ if (!sourceFile?.size) {
17
+ return {
18
+ valid: false,
19
+ reason: 'Video file size is required'
20
+ };
21
+ }
22
+ if (sourceFile.size > VideoAttachmentHandler.MAX_VIDEO_SIZE) {
23
+ return {
24
+ valid: false,
25
+ reason: `Video size exceeds maximum (${VideoAttachmentHandler.MAX_VIDEO_SIZE / 1024 / 1024}MB)`
26
+ };
27
+ }
28
+ if (sourceFile.mimeType && !VideoAttachmentHandler.SUPPORTED_TYPES.includes(sourceFile.mimeType)) {
29
+ return {
30
+ valid: false,
31
+ reason: 'Unsupported video format'
32
+ };
33
+ }
34
+ return {
35
+ valid: true
36
+ };
37
+ }
38
+ async buildPayload(attachment, uploadedUrl) {
39
+ const video = attachment;
40
+ const {
41
+ sourceFile,
42
+ metadata
43
+ } = video;
44
+
45
+ // Use thumbnail URL if available, otherwise fall back to video URL
46
+ const snapshotUrl = metadata.thumbnail?.url || uploadedUrl;
47
+ const snapshotWidth = metadata.thumbnail?.width || metadata.width || 320;
48
+ const snapshotHeight = metadata.thumbnail?.height || metadata.height || 180;
49
+ const snapshotSize = metadata.thumbnail?.size || 0;
50
+ if (metadata.thumbnail?.url) {
51
+ console.log('✅ [VideoAttachmentHandler] Using thumbnail:', {
52
+ snapshotUrl: metadata.thumbnail.url,
53
+ snapshotWidth,
54
+ snapshotHeight,
55
+ snapshotSize
56
+ });
57
+ }
58
+ const picInfo = {
59
+ videoUUID: attachment.id,
60
+ videoType: sourceFile.mimeType || 'video/mp4',
61
+ videoSize: sourceFile.size,
62
+ duration: metadata.duration,
63
+ snapshotWidth: snapshotWidth,
64
+ snapshotHeight: snapshotHeight,
65
+ videoUrl: uploadedUrl,
66
+ videoPath: sourceFile.path,
67
+ snapshotPath: snapshotUrl,
68
+ snapshotUUID: `${attachment.id}-snapshot`,
69
+ snapshotSize: snapshotSize,
70
+ snapshotUrl: snapshotUrl,
71
+ snapShotType: 'image/jpeg'
72
+ };
73
+ console.warn('[VideoAttachmentHandler] Built payload', {
74
+ videoUUID: picInfo.videoUUID,
75
+ videoSize: picInfo.videoSize,
76
+ duration: picInfo.duration,
77
+ snapshotWidth: picInfo.snapshotWidth,
78
+ snapshotHeight: picInfo.snapshotHeight,
79
+ videoUrl: uploadedUrl.substring(0, 50) + '...'
80
+ });
81
+ return picInfo;
82
+ }
83
+ }
84
+ export default new VideoAttachmentHandler();
85
+ //# sourceMappingURL=videoAttachmentHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["VideoAttachmentHandler","MAX_VIDEO_SIZE","SUPPORTED_TYPES","validate","attachment","type","valid","reason","sourceFile","size","mimeType","includes","buildPayload","uploadedUrl","video","metadata","snapshotUrl","thumbnail","url","snapshotWidth","width","snapshotHeight","height","snapshotSize","console","log","picInfo","videoUUID","id","videoType","videoSize","duration","videoUrl","videoPath","path","snapshotPath","snapshotUUID","snapShotType","warn","substring"],"sourceRoot":"../../../../src","sources":["services/attachmentHandlers/videoAttachmentHandler.ts"],"mappings":";;AAmBA,OAAO,MAAMA,sBAAsB,CAA+B;EAChE,OAAwBC,cAAc,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;EAC5D,OAAwBC,eAAe,GAAG,CAAC,WAAW,EAAE,iBAAiB,CAAC;EAE1EC,QAAQA,CACNC,UAAsB,EAC8B;IACpD,IAAIA,UAAU,CAACC,IAAI,KAAK,OAAO,EAAE;MAC/B,OAAO;QACLC,KAAK,EAAE,KAAK;QACZC,MAAM,EAAE;MACV,CAAC;IACH;IAEA,MAAM;MAAEC;IAAW,CAAC,GAAGJ,UAAU;IAEjC,IAAI,CAACI,UAAU,EAAEC,IAAI,EAAE;MACrB,OAAO;QACLH,KAAK,EAAE,KAAK;QACZC,MAAM,EAAE;MACV,CAAC;IACH;IAEA,IAAIC,UAAU,CAACC,IAAI,GAAGT,sBAAsB,CAACC,cAAc,EAAE;MAC3D,OAAO;QACLK,KAAK,EAAE,KAAK;QACZC,MAAM,EAAE,+BAA+BP,sBAAsB,CAACC,cAAc,GAAG,IAAI,GAAG,IAAI;MAC5F,CAAC;IACH;IAEA,IACEO,UAAU,CAACE,QAAQ,IACnB,CAACV,sBAAsB,CAACE,eAAe,CAACS,QAAQ,CAACH,UAAU,CAACE,QAAQ,CAAC,EACrE;MACA,OAAO;QACLJ,KAAK,EAAE,KAAK;QACZC,MAAM,EAAE;MACV,CAAC;IACH;IAEA,OAAO;MAAED,KAAK,EAAE;IAAK,CAAC;EACxB;EAEA,MAAMM,YAAYA,CAChBR,UAAsB,EACtBS,WAAmB,EACI;IACvB,MAAMC,KAAK,GAAGV,UAA6B;IAC3C,MAAM;MAAEI,UAAU;MAAEO;IAAS,CAAC,GA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Q;MAC1BZ,aAAa,EAAEO,OAAO,CAACP,aAAa;MACpCE,cAAc,EAAEK,OAAO,CAACL,cAAc;MACtCW,QAAQ,EAAEnB,WAAW,CAAC0B,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG;IAC3C,CAAC,CAAC;IAEF,OAAOb,OAAO;EAChB;AACF;AAEA,eAAe,IAAI1B,sBAAsB,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,225 @@
1
+ "use strict";
2
+
3
+ import OpenIMSDK from '@droppii/openim-rn-client-sdk';
4
+ import { getAttachmentHandler } from "../types/attachmentHandler.js";
5
+ import { useConversationStore } from "../store/index.js";
6
+ import { getAttachmentPriorityConfig } from "../config/attachment-priority.js";
7
+ export let AttachmentOrchestratorService;
8
+ (function (_AttachmentOrchestratorService) {
9
+ async function sendPreparedAttachments(attachments, uploadedUrls, options = {
10
+ strategy: 'individual'
11
+ }, onMessageSent) {
12
+ const result = {
13
+ success: false,
14
+ sentAttachmentIds: [],
15
+ failedAttachmentIds: [],
16
+ errors: {}
17
+ };
18
+ if (!attachments || attachments.length === 0) {
19
+ return result;
20
+ }
21
+
22
+ // 1. Validate all attachments
23
+ console.log('[AttachmentOrchestrator] Validating prepared attachments...');
24
+ for (const att of attachments) {
25
+ try {
26
+ const handler = getAttachmentHandler(att.type);
27
+ const validation = handler.validate(att);
28
+ if (!validation.valid) {
29
+ result.failedAttachmentIds.push(att.id);
30
+ result.errors[att.id] = validation.reason;
31
+ }
32
+ } catch (error) {
33
+ const msg = error instanceof Error ? error.message : 'Validation failed';
34
+ result.failedAttachmentIds.push(att.id);
35
+ result.errors[att.id] = msg;
36
+ }
37
+ }
38
+ if (result.failedAttachmentIds.length === attachments.length) {
39
+ return result;
40
+ }
41
+ const validAttachments = attachments.filter(a => !result.failedAttachmentIds.includes(a.id));
42
+
43
+ // 2. Build message payloads directly (no upload)
44
+ console.log('[AttachmentOrchestrator] Building message payloads for prepared attachments...');
45
+ const payloads = [];
46
+ for (const att of validAttachments) {
47
+ try {
48
+ const uploadedUrl = uploadedUrls[att.id];
49
+ if (!uploadedUrl) {
50
+ result.failedAttachmentIds.push(att.id);
51
+ result.errors[att.id] = 'No uploaded URL provided';
52
+ continue;
53
+ }
54
+ const handler = getAttachmentHandler(att.type);
55
+ const payload = await handler.buildPayload(att, uploadedUrl);
56
+ payloads.push({
57
+ attachmentId: att.id,
58
+ payload
59
+ });
60
+ } catch (error) {
61
+ const msg = error instanceof Error ? error.message : 'Payload build failed';
62
+ result.failedAttachmentIds.push(att.id);
63
+ result.errors[att.id] = msg;
64
+ }
65
+ }
66
+
67
+ // 3. Send via OpenIM - always use createMergerMessage
68
+ console.log('[AttachmentOrchestrator] Sending via createMergerMessage', {
69
+ payloadCount: payloads.length,
70
+ attachmentIds: payloads.map(p => p.attachmentId)
71
+ });
72
+ try {
73
+ const mergedMsgId = await sendMergedMessage(payloads.map(p => p.payload), options.includeCaption, onMessageSent);
74
+ console.log('[AttachmentOrchestrator] Messages sent via merger:', {
75
+ messageId: mergedMsgId,
76
+ count: payloads.length
77
+ });
78
+ result.sentAttachmentIds = payloads.map(p => p.attachmentId);
79
+ result.mergedMessageId = mergedMsgId;
80
+ } catch (error) {
81
+ const msg = error instanceof Error ? error.message : 'Send failed';
82
+ console.error('[AttachmentOrchestrator] OpenIM send error:', {
83
+ error: msg,
84
+ stack: error instanceof Error ? error.stack : undefined
85
+ });
86
+ if (result.sentAttachmentIds.length === 0) {
87
+ result.errors._send = msg;
88
+ }
89
+ }
90
+ result.success = result.sentAttachmentIds.length > 0;
91
+ return result;
92
+ }
93
+ _AttachmentOrchestratorService.sendPreparedAttachments = sendPreparedAttachments;
94
+ async function sendMergedMessage(payloads, _caption, onMessageSent) {
95
+ const currentConversation = useConversationStore.getState().getCurrentConversation();
96
+ if (!currentConversation) {
97
+ throw new Error('No conversation selected');
98
+ }
99
+
100
+ // Get priority configuration
101
+ const priorityConfig = getAttachmentPriorityConfig();
102
+ console.log('[AttachmentOrchestrator] Using priority config:', {
103
+ enabled: priorityConfig.enabled,
104
+ order: priorityConfig.order
105
+ });
106
+
107
+ // Categorize payloads by type
108
+ const categorizedPayloads = {
109
+ image: [],
110
+ video: [],
111
+ file: [],
112
+ text: []
113
+ };
114
+ for (const p of payloads) {
115
+ const payload = p;
116
+ // Detect type from payload properties
117
+ if (payload.duration !== undefined || payload.videoPath !== undefined) {
118
+ categorizedPayloads.video.push(p);
119
+ } else if (payload.fileExtension !== undefined || payload.fileName && payload.fileName.includes('.')) {
120
+ categorizedPayloads.file.push(p);
121
+ } else if (payload.content && typeof payload.content === 'string') {
122
+ categorizedPayloads.text.push(p);
123
+ } else {
124
+ categorizedPayloads.image.push(p);
125
+ }
126
+ }
127
+ console.log('[AttachmentOrchestrator] Categorized payloads:', {
128
+ count: payloads.length,
129
+ images: categorizedPayloads.image.length,
130
+ videos: categorizedPayloads.video.length,
131
+ files: categorizedPayloads.file.length,
132
+ texts: categorizedPayloads.text.length
133
+ });
134
+
135
+ // AC2: Create message from payload based on type
136
+ const createMessageFromPayload = async p => {
137
+ if (p.duration !== undefined || p.videoPath !== undefined) {
138
+ console.log('[AttachmentOrchestrator] Creating video message');
139
+ return OpenIMSDK.createVideoMessageByURL(p);
140
+ }
141
+ if (p.fileExtension !== undefined || p.fileName && p.fileName.includes('.')) {
142
+ console.log('[AttachmentOrchestrator] Creating file message');
143
+ return OpenIMSDK.createFileMessageByURL(p);
144
+ }
145
+ if (p.content && typeof p.content === 'string') {
146
+ console.log('[AttachmentOrchestrator] Creating text message');
147
+ return OpenIMSDK.createTextMessage(p.content);
148
+ }
149
+ // Default to image
150
+ console.log('[AttachmentOrchestrator] Creating image message');
151
+ return OpenIMSDK.createImageMessageByURL(p);
152
+ };
153
+
154
+ // Process attachments in priority order from config
155
+ let lastMsgId = '';
156
+ const allMessages = [];
157
+ if (priorityConfig.enabled) {
158
+ // Use configured priority order
159
+ console.log('[AttachmentOrchestrator] Processing in priority order:', priorityConfig.order);
160
+ for (const attachmentType of priorityConfig.order) {
161
+ const payloadsForType = categorizedPayloads[attachmentType];
162
+ if (payloadsForType.length === 0) continue;
163
+ console.log(`[AttachmentOrchestrator] Processing ${attachmentType}:`, {
164
+ count: payloadsForType.length
165
+ });
166
+ const mergeStrategy = attachmentType === 'image' ? priorityConfig.mergeStrategy.images : attachmentType === 'video' ? priorityConfig.mergeStrategy.videos : attachmentType === 'file' ? priorityConfig.mergeStrategy.files : 'individual';
167
+ if (mergeStrategy === 'individual' || payloadsForType.length === 1) {
168
+ // Send individually
169
+ for (const p of payloadsForType) {
170
+ const message = await createMessageFromPayload(p);
171
+ allMessages.push(message);
172
+ }
173
+ } else {
174
+ // Merge multiple items
175
+ const messages = [];
176
+ for (const p of payloadsForType) {
177
+ const message = await createMessageFromPayload(p);
178
+ messages.push(message);
179
+ }
180
+ const typeLabel = attachmentType.charAt(0).toUpperCase() + attachmentType.slice(1);
181
+ const merged = await OpenIMSDK.createMergerMessage({
182
+ messageList: messages,
183
+ title: typeLabel + 's',
184
+ summaryList: messages.map((_, i) => `[${typeLabel} ${i + 1}]`)
185
+ });
186
+ if (merged) {
187
+ allMessages.push(merged);
188
+ }
189
+ }
190
+ }
191
+ } else {
192
+ // Original behavior (config disabled)
193
+ console.log('[AttachmentOrchestrator] Priority config disabled');
194
+ const allPayloads = [...categorizedPayloads.image, ...categorizedPayloads.video, ...categorizedPayloads.file, ...categorizedPayloads.text];
195
+ for (const p of allPayloads) {
196
+ const message = await createMessageFromPayload(p);
197
+ allMessages.push(message);
198
+ }
199
+ }
200
+
201
+ // Send all messages in priority order
202
+ console.log('[AttachmentOrchestrator] Sending all messages in priority order', {
203
+ totalMessages: allMessages.length
204
+ });
205
+ for (let i = 0; i < allMessages.length; i++) {
206
+ const message = allMessages[i];
207
+ console.log('[AttachmentOrchestrator] Sending message', i + 1, 'of', allMessages.length);
208
+ const result = await OpenIMSDK.sendMessageNotOss({
209
+ recvID: currentConversation.userID || '',
210
+ groupID: currentConversation.groupID || '',
211
+ message
212
+ });
213
+ lastMsgId = result?.clientMsgID || result?.serverMsgID || '';
214
+ console.log('[AttachmentOrchestrator] Message sent:', {
215
+ messageId: lastMsgId,
216
+ index: i + 1
217
+ });
218
+ if (onMessageSent && result) {
219
+ onMessageSent(result);
220
+ }
221
+ }
222
+ return lastMsgId;
223
+ }
224
+ })(AttachmentOrchestratorService || (AttachmentOrchestratorService = {}));
225
+ //# sourceMappingURL=attachmentOrchestrator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["OpenIMSDK","getAttachmentHandler","useConversationStore","getAttachmentPriorityConfig","AttachmentOrchestratorService","_AttachmentOrchestratorService","sendPreparedAttachments","attachments","uploadedUrls","options","strategy","onMessageSent","result","success","sentAttachmentIds","failedAttachmentIds","errors","length","console","log","att","handler","type","validation","validate","valid","push","id","reason","error","msg","Error","message","validAttachments","filter","a","includes","payloads","uploadedUrl","payload","buildPayload","attachmentId","payloadCount","attachmentIds","map","p","mergedMsgId","sendMergedMessage","includeCaption","messageId","count","mergedMessageId","stack","undefined","_send","_caption","currentConversation","getState","getCurrentConversation","priorityConfig","enabled","order","categorizedPayloads","image","video","file","text","duration","videoPath","fileExtension","fileName","content","images","videos","files","texts","createMessageFromPayload","createVideoMessageByURL","createFileMessageByURL","createTextMessage","createImageMessageByURL","lastMsgId","allMessages","attachmentType","payloadsForType","mergeStrategy","messages","typeLabel","charAt","toUpperCase","slice","merged","createMergerMessage","messageList","title","summaryList","_","i","allPayloads","totalMessages","sendMessageNotOss","recvID","userID","groupID","clientMsgID","serverMsgID","index"],"sourceRoot":"../../../src","sources":["services/attachmentOrchestrator.ts"],"mappings":";;AAAA,OAAOA,SAAS,MAA4B,+BAA+B;AAM3E,SAASC,oBAAoB,QAAQ,+BAA4B;AACjE,SAASC,oBAAoB,QAAQ,mBAAU;AAC/C,SACEC,2BAA2B,QAEtB,kCAA+B;AAAC,WAEtBC,6BAA6B;AAAA,WAAAC,8BAAA;EACrC,eAAeC,uBAAuBA,CAC3CC,WAAyB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QACpD8B,SAAS,EAAEgC,SAAS;QACpByB,KAAK,EAAET,CAAC,GAAG;MACb,CAAC,CAAC;MAEF,IAAItF,aAAa,IAAIC,MAAM,EAAE;QAC3BD,aAAa,CAACC,MAAM,CAAC;MACvB;IACF;IAEA,OAAOqE,SAAS;EAClB;AAAC,GA7Rc7E,6BAA6B,KAA7BA,6BAA6B","ignoreList":[]}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Auth token management
5
+ * Consumer app calls setAuthToken() once at startup
6
+ * Library services call getAuthToken() internally
7
+ */
8
+
9
+ let authToken = null;
10
+
11
+ /**
12
+ * Set auth token (call once at app startup)
13
+ */
14
+ export const setAuthToken = token => {
15
+ authToken = token;
16
+ };
17
+
18
+ /**
19
+ * Get auth token (called internally by library services)
20
+ * @throws Error if token not set
21
+ */
22
+ export const getAuthToken = () => {
23
+ if (!authToken) {
24
+ throw new Error('Auth token not initialized. Call setAuthToken(token) at app startup.');
25
+ }
26
+ return authToken;
27
+ };
28
+
29
+ /**
30
+ * Clear token (logout)
31
+ */
32
+ export const clearAuthToken = () => {
33
+ authToken = null;
34
+ };
35
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["authToken","setAuthToken","token","getAuthToken","Error","clearAuthToken"],"sourceRoot":"../../../src","sources":["services/auth.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;;AAEA,IAAIA,SAAwB,GAAG,IAAI;;AAEnC;AACA;AACA;AACA,OAAO,MAAMC,YAAY,GAAIC,KAAa,IAAK;EAC7CF,SAAS,GAAGE,KAAK;AACnB,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMC,YAAY,GAAGA,CAAA,KAAc;EACxC,IAAI,CAACH,SAAS,EAAE;IACd,MAAM,IAAII,KAAK,CACb,sEACF,CAAC;EACH;EACA,OAAOJ,SAAS;AAClB,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMK,cAAc,GAAGA,CAAA,KAAM;EAClCL,SAAS,GAAG,IAAI;AAClB,CAAC","ignoreList":[]}
@@ -1,8 +1,27 @@
1
1
  "use strict";
2
2
 
3
+ /**
4
+ * @deprecated Use config/api-endpoints.ts instead
5
+ * This file is kept for backward compatibility only.
6
+ * All endpoints should be managed through config/api-endpoints.ts
7
+ */
8
+
9
+ import { getApiEndpoint, setApiEndpoint, getAllApiEndpoints } from "../config/api-endpoints.js";
10
+
11
+ // Legacy interface - use api-endpoints.ts directly
3
12
  export const ENDPOINTS = {
4
13
  chatService: {
5
- urlMetadata: '/chat-service/v1/utils/url-metadata'
14
+ get urlMetadata() {
15
+ return getApiEndpoint('urlMetadata');
16
+ }
17
+ },
18
+ uploaderService: {
19
+ get uploadImage() {
20
+ return getApiEndpoint('imageUpload');
21
+ }
6
22
  }
7
23
  };
24
+
25
+ // Re-export proper API for new code
26
+ export { getApiEndpoint, setApiEndpoint, getAllApiEndpoints };
8
27
  //# sourceMappingURL=endpoints.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ENDPOINTS","chatService","urlMetadata"],"sourceRoot":"../../../src","sources":["services/endpoints.ts"],"mappings":";;AAAA,OAAO,MAAMA,SAAS,GAAG;EACvBC,WAAW,EAAE;IACXC,WAAW,EAAE;EACf;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["getApiEndpoint","setApiEndpoint","getAllApiEndpoints","ENDPOINTS","chatService","urlMetadata","uploaderService","uploadImage"],"sourceRoot":"../../../src","sources":["services/endpoints.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;;AAEA,SACEA,cAAc,EACdC,cAAc,EACdC,kBAAkB,QACb,4BAAyB;;AAEhC;AACA,OAAO,MAAMC,SAAS,GAAG;EACvBC,WAAW,EAAE;IACX,IAAIC,WAAWA,CAAA,EAAG;MAChB,OAAOL,cAAc,CAAC,aAAa,CAAC;IACtC;EACF,CAAC;EACDM,eAAe,EAAE;IACf,IAAIC,WAAWA,CAAA,EAAG;MAChB,OAAOP,cAAc,CAAC,aAAa,CAAC;IACtC;EACF;AACF,CAAC;;AAED;AACA,SAASA,cAAc,EAAEC,cAAc,EAAEC,kBAAkB","ignoreList":[]}
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+
3
+ import ReactNativeBlobUtil from 'react-native-blob-util';
4
+ import RNFS from 'react-native-fs';
5
+ import { getImageUploadEndpoint, getMimeType } from "../utils/imageUtils.js";
6
+ import { getAuthToken } from "./auth.js";
7
+ import { getApiEndpoint } from "../config/api-endpoints.js";
8
+ import { getBaseUrl } from "../config/configuration.js";
9
+ export let ImageUploadAPI;
10
+ (function (_ImageUploadAPI) {
11
+ const uploadImageFile = _ImageUploadAPI.uploadImageFile = async (file, onProgress) => {
12
+ let token;
13
+ let uploadUrl;
14
+ try {
15
+ token = getAuthToken();
16
+ const relativePath = getApiEndpoint('imageUpload');
17
+ const baseUrl = getBaseUrl();
18
+ if (!baseUrl) {
19
+ throw new Error('Image upload base URL not configured. Call initChatSdk() with apiBaseUrl during app initialization.');
20
+ }
21
+
22
+ // Construct absolute URL for ReactNativeBlobUtil.fetch()
23
+ uploadUrl = getImageUploadEndpoint(`${baseUrl}${relativePath}`);
24
+ } catch (e) {
25
+ if (__DEV__) console.error('[ImageUploadAPI] Auth error:', e);
26
+ throw e;
27
+ }
28
+ return new Promise((resolve, reject) => {
29
+ ReactNativeBlobUtil.fetch('POST', uploadUrl, {
30
+ Authorization: `Bearer ${token}`
31
+ }, [{
32
+ name: 'files',
33
+ filename: file.filename,
34
+ data: ReactNativeBlobUtil.wrap(file.path),
35
+ type: getMimeType(file.filename)
36
+ }]).uploadProgress((written, total) => {
37
+ const progress = Math.round(written / total * 100);
38
+ onProgress?.(progress);
39
+ }).then(response => {
40
+ // Check for HTTP error status
41
+ const status = response.respInfo?.status;
42
+ if (status && status >= 400) {
43
+ if (__DEV__) console.error('[ImageUploadAPI] Server error response', {
44
+ status,
45
+ data: response.data
46
+ });
47
+ reject(new Error(`Upload failed with status ${status}`));
48
+ return;
49
+ }
50
+ if (!response.data || response.data.length === 0) {
51
+ if (__DEV__) console.error('[ImageUploadAPI] Empty response', {
52
+ dataType: typeof response.data,
53
+ data: response.data
54
+ });
55
+ reject(new Error('Empty response from server'));
56
+ return;
57
+ }
58
+ try {
59
+ const json = JSON.parse(response.data);
60
+ const uploaded = json.data?.[0] || json.files?.[0];
61
+ const imageUrl = uploaded?.publicUrl || uploaded?.url || uploaded?.data;
62
+ if (imageUrl) {
63
+ resolve({
64
+ url: imageUrl,
65
+ name: uploaded?.fileName,
66
+ width: file.width,
67
+ height: file.height,
68
+ size: file.size
69
+ });
70
+ } else {
71
+ if (__DEV__) console.error('[ImageUploadAPI] No URL in response:', json);
72
+ reject(new Error('No URL in response'));
73
+ }
74
+ } catch (err) {
75
+ if (__DEV__) console.error('[ImageUploadAPI] Parse error:', err);
76
+ reject(new Error('Invalid response format'));
77
+ }
78
+ }).catch(error => {
79
+ if (__DEV__) console.error('[ImageUploadAPI] Fetch error:', error);
80
+ reject(error);
81
+ });
82
+ });
83
+ };
84
+ const uploadImageQueue = _ImageUploadAPI.uploadImageQueue = async (files, config = {}, onProgress) => {
85
+ const {
86
+ maxConcurrent = 2
87
+ } = config;
88
+ const results = [];
89
+ const queue = [...files];
90
+ let activeCount = 0;
91
+ return new Promise((resolve, _reject) => {
92
+ const processNext = async () => {
93
+ if (queue.length === 0 && activeCount === 0) {
94
+ resolve(results);
95
+ return;
96
+ }
97
+ if (queue.length > 0 && activeCount < maxConcurrent) {
98
+ const file = queue.shift();
99
+ if (!file) return;
100
+ activeCount++;
101
+ try {
102
+ const result = await uploadImageFile(file);
103
+ results.push(result);
104
+ onProgress?.(results.length, files.length);
105
+ } catch (error) {
106
+ if (__DEV__) console.error(`Failed to upload ${file.filename}:`, error);
107
+ } finally {
108
+ activeCount--;
109
+ processNext();
110
+ }
111
+ }
112
+ };
113
+ for (let i = 0; i < maxConcurrent && queue.length > 0; i++) {
114
+ processNext();
115
+ }
116
+ });
117
+ };
118
+ const cleanupImageFile = _ImageUploadAPI.cleanupImageFile = async filePath => {
119
+ try {
120
+ await RNFS.unlink(filePath);
121
+ } catch (err) {
122
+ if (__DEV__) console.warn('Cleanup failed:', err);
123
+ }
124
+ };
125
+ })(ImageUploadAPI || (ImageUploadAPI = {}));
126
+ //# sourceMappingURL=imageUpload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ReactNativeBlobUtil","RNFS","getImageUploadEndpoint","getMimeType","getAuthToken","getApiEndpoint","getBaseUrl","ImageUploadAPI","_ImageUploadAPI","uploadImageFile","file","onProgress","token","uploadUrl","relativePath","baseUrl","Error","e","__DEV__","console","error","Promise","resolve","reject","fetch","Authorization","name","filename","data","wrap","path","type","uploadProgress","written","total","progress","Math","round","then","response","status","respInfo","length","dataType","json","JSON","parse","uploaded","files","imageUrl","publicUrl","url","fileName","width","height","size","err","catch","uploadImageQueue","config","maxConcurrent","results","queue","activeCount","_reject","processNext","shift","result","push","i","cleanupImageFile","filePath","unlink","warn"],"sourceRoot":"../../../src","sources":["services/imageUpload.ts"],"mappings":";;AAAA,OAAOA,mBAAmB,MAAM,wBAAwB;AACxD,OAAOC,IAAI,MAAM,iBAAiB;AAClC,SAASC,sBAAsB,EAAEC,WAAW,QAAQ,wBAAqB;AACzE,SAASC,YAAY,QAAQ,WAAQ;AACrC,SAASC,cAAc,QAAQ,4BAAyB;AACxD,SAASC,UAAU,QAAQ,4BAAyB;AAAC,WAOpCC,cAAc;AAAA,WAAAC,eAAA;EACtB,MAAMC,eAAe,GAAAD,eAAA,CAAAC,eAAA,GAAG,OAC7BC,IAAe,EACfC,UAAuC,KACZ;IAC3B,IAAIC,KAAa;IACjB,IAAIC,SAAiB;IAErB,IAAI;MACFD,KAAK,GAAGR,YAAY,CAAC,CAAC;MACtB,MAAMU,YAAY,GAAGT,cAAc,CAAC,aAAa,CAAC;MAClD,MAAMU,OAAO,GAAGT,UAAU,CAAC,CAAC;MAE5B,IAAI,CAACS,OAAO,EAAE;QACZ,MAAM,IAAIC,KA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;UAC9D,CAAC,SAAS;YACR2C,WAAW,EAAE;YACbE,WAAW,CAAC,CAAC;UACf;QACF;MACF,CAAC;MAED,KAAK,IAAII,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGT,aAAa,IAAIE,KAAK,CAACpB,MAAM,GAAG,CAAC,EAAE2B,CAAC,EAAE,EAAE;QAC1DJ,WAAW,CAAC,CAAC;MACf;IACF,CAAC,CAAC;EACJ,CAAC;EAEM,MAAMK,gBAAgB,GAAA9D,eAAA,CAAA8D,gBAAA,GAAG,MAAOC,QAAgB,IAAoB;IACzE,IAAI;MACF,MAAMtE,IAAI,CAACuE,MAAM,CAACD,QAAQ,CAAC;IAC7B,CAAC,CAAC,OAAOf,GAAG,EAAE;MACZ,IAAItC,OAAO,EAAEC,OAAO,CAACsD,IAAI,CAAC,iBAAiB,EAAEjB,GAAG,CAAC;IACnD;EACF,CAAC;AAAC,GApJajD,cAAc,KAAdA,cAAc","ignoreList":[]}
@@ -1,14 +1,28 @@
1
1
  "use strict";
2
2
 
3
3
  const i18nKey = {
4
- thread_card_bot_crm_name: 'Droppii Hỗ Trợ',
5
- thread_card_fallback_name: 'Người dùng',
6
- msg_type_image: '[Hình ảnh]',
7
- msg_type_voice: '[Tin nhắn thoại]',
8
- msg_type_video: '[Video]',
9
- msg_type_file: '[File đính kèm]',
10
- msg_type_link: '[Liên kết]',
11
- msg_type_revoke: 'Đã thu hồi tin nhắn'
4
+ 'thread_card_bot_crm_name': 'Droppii Hỗ Trợ',
5
+ 'thread_card_fallback_name': 'Người dùng',
6
+ 'chat:image_preview': 'Xem trước ảnh',
7
+ 'chat:image_too_large': 'Ảnh quá lớn. Tối đa 5MB',
8
+ 'chat:image_sent': 'Đã gửi ảnh',
9
+ 'chat:image_upload_failed': 'Lỗi tải ảnh',
10
+ 'chat:failed_to_send_message': 'Không thể gửi tin nhắn. Thử lại?',
11
+ 'chat:filename': 'Tên tệp',
12
+ 'chat:file_size': 'Kích thước',
13
+ 'chat:dimensions': 'Kích cỡ',
14
+ 'chat:send': 'Gửi',
15
+ 'chat:retry': 'Thử lại',
16
+ 'chat:retry_failed_no_data': 'Không có dữ liệu để thử lại',
17
+ 'chat:retry_failed': 'Thử lại thất bại',
18
+ 'chat:upload_in_progress': 'Đang tải ảnh lên',
19
+ 'chat:wait_or_cancel': 'Vui lòng chờ hoặc hủy bỏ',
20
+ 'msg_type_image': '[Hình ảnh]',
21
+ 'msg_type_voice': '[Tin nhắn thoại]',
22
+ 'msg_type_video': '[Video]',
23
+ 'msg_type_file': '[File đính kèm]',
24
+ 'msg_type_link': '[Liên kết]',
25
+ 'msg_type_revoke': 'Đã thu hồi tin nhắn'
12
26
  };
13
27
  export default {
14
28
  vi: i18nKey
@@ -1 +1 @@
1
- {"version":3,"names":["i18nKey","thread_card_bot_crm_name","thread_card_fallback_name","msg_type_image","msg_type_voice","msg_type_video","msg_type_file","msg_type_link","msg_type_revoke","vi"],"sourceRoot":"../../../../src","sources":["translation/resources/i18n.ts"],"mappings":";;AAAA,MAAMA,OAA+B,GAAG;EACtCC,wBAAwB,EAAE,gBAAgB;EAC1CC,yBAAyB,EAAE,YAAY;EACvCC,cAAc,EAAE,YAAY;EAC5BC,cAAc,EAAE,kBAAkB;EAClCC,cAAc,EAAE,SAAS;EACzBC,aAAa,EAAE,iBAAiB;EAChCC,aAAa,EAAE,YAAY;EAC3BC,eAAe,EAAE;AACnB,CAAC;AAED,eAAe;EACbC,EAAE,EAAET;AACN,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["i18nKey","vi"],"sourceRoot":"../../../../src","sources":["translation/resources/i18n.ts"],"mappings":";;AAAA,MAAMA,OAA+B,GAAG;EACtC,0BAA0B,EAAE,gBAAgB;EAC5C,2BAA2B,EAAE,YAAY;EACzC,oBAAoB,EAAE,eAAe;EACrC,sBAAsB,EAAE,yBAAyB;EACjD,iBAAiB,EAAE,YAAY;EAC/B,0BAA0B,EAAE,aAAa;EACzC,6BAA6B,EAAE,kCAAkC;EACjE,eAAe,EAAE,SAAS;EAC1B,gBAAgB,EAAE,YAAY;EAC9B,iBAAiB,EAAE,SAAS;EAC5B,WAAW,EAAE,KAAK;EAClB,YAAY,EAAE,SAAS;EACvB,2BAA2B,EAAE,6BAA6B;EAC1D,mBAAmB,EAAE,kBAAkB;EACvC,yBAAyB,EAAE,kBAAkB;EAC7C,qBAAqB,EAAE,0BAA0B;EACjD,gBAAgB,EAAE,YAAY;EAC9B,gBAAgB,EAAE,kBAAkB;EACpC,gBAAgB,EAAE,SAAS;EAC3B,eAAe,EAAE,iBAAiB;EAClC,eAAe,EAAE,YAAY;EAC7B,iBAAiB,EAAE;AACrB,CAAC;AAED,eAAe;EACbC,EAAE,EAAED;AACN,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=attachment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/attachment.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ // Imported from handlers to provide dispatch
4
+ import { ImageAttachmentHandler } from "../services/attachmentHandlers/imageAttachmentHandler.js";
5
+ import VideoAttachmentHandlerDefault from "../services/attachmentHandlers/videoAttachmentHandler.js";
6
+ import FileAttachmentHandlerDefault from "../services/attachmentHandlers/fileAttachmentHandler.js";
7
+ export function getAttachmentHandler(type) {
8
+ console.log('[getAttachmentHandler] Getting handler for type:', type);
9
+ switch (type) {
10
+ case 'image':
11
+ return ImageAttachmentHandler;
12
+ case 'video':
13
+ return VideoAttachmentHandlerDefault;
14
+ case 'file':
15
+ return FileAttachmentHandlerDefault;
16
+ default:
17
+ throw new Error(`No handler for attachment type: ${type}`);
18
+ }
19
+ }
20
+ //# sourceMappingURL=attachmentHandler.js.map