@droppii-org/chat-mobile 0.2.6 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/module/components/AttachmentPreview.js +250 -0
- package/lib/module/components/AttachmentPreview.js.map +1 -0
- package/lib/module/components/MediaViewer/index.js +2 -0
- package/lib/module/components/MediaViewer/index.js.map +1 -0
- package/lib/module/components/MediaViewerModal.js +57 -0
- package/lib/module/components/MediaViewerModal.js.map +1 -0
- package/lib/module/components/MergedImageGrid.js +173 -0
- package/lib/module/components/MergedImageGrid.js.map +1 -0
- package/lib/module/components/ThreadCard/AvatarSection.js +4 -4
- package/lib/module/components/ThreadCard/AvatarSection.js.map +1 -1
- package/lib/module/components/ThreadCard/NamePrefixIcon.js +13 -16
- package/lib/module/components/ThreadCard/NamePrefixIcon.js.map +1 -1
- package/lib/module/components/ThreadCard/ThreadCard.js +13 -33
- package/lib/module/components/ThreadCard/ThreadCard.js.map +1 -1
- package/lib/module/components/ThreadCard/thread-card.utils.js +80 -4
- package/lib/module/components/ThreadCard/thread-card.utils.js.map +1 -1
- package/lib/module/components/messages/fileMessage/index.js +26 -0
- package/lib/module/components/messages/fileMessage/index.js.map +1 -0
- package/lib/module/components/messages/imageMessage/index.js +118 -0
- package/lib/module/components/messages/imageMessage/index.js.map +1 -0
- package/lib/module/components/messages/linkMessage/index.js +122 -0
- package/lib/module/components/messages/linkMessage/index.js.map +1 -0
- package/lib/module/components/messages/mergedMessage/index.js +37 -0
- package/lib/module/components/messages/mergedMessage/index.js.map +1 -0
- package/lib/module/components/messages/styles.js +41 -0
- package/lib/module/components/messages/styles.js.map +1 -0
- package/lib/module/components/messages/textMessage/index.js +38 -0
- package/lib/module/components/messages/textMessage/index.js.map +1 -0
- package/lib/module/components/messages/types.js +14 -0
- package/lib/module/components/messages/types.js.map +1 -0
- package/lib/module/components/messages/videoMessage/index.js +110 -0
- package/lib/module/components/messages/videoMessage/index.js.map +1 -0
- package/lib/module/config/api-endpoints.js +66 -0
- package/lib/module/config/api-endpoints.js.map +1 -0
- package/lib/module/config/attachment-priority.js +81 -0
- package/lib/module/config/attachment-priority.js.map +1 -0
- package/lib/module/config/configuration.js +50 -0
- package/lib/module/config/configuration.js.map +1 -0
- package/lib/module/config/index.js +22 -0
- package/lib/module/config/index.js.map +1 -0
- package/lib/module/context/ChatContext.js +7 -6
- package/lib/module/context/ChatContext.js.map +1 -1
- package/lib/module/core/index.js +19 -1
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/core/useChatListener.js +0 -14
- package/lib/module/core/useChatListener.js.map +1 -1
- package/lib/module/hooks/message/useSendMessage.js +106 -0
- package/lib/module/hooks/message/useSendMessage.js.map +1 -0
- package/lib/module/hooks/useChatMessages.js +36 -121
- package/lib/module/hooks/useChatMessages.js.map +1 -1
- package/lib/module/hooks/useConversationList.js +29 -17
- package/lib/module/hooks/useConversationList.js.map +1 -1
- package/lib/module/hooks/useImageAttachment.js +263 -0
- package/lib/module/hooks/useImageAttachment.js.map +1 -0
- package/lib/module/hooks/useLinkPreview/useLinkPreview.js +3 -2
- package/lib/module/hooks/useLinkPreview/useLinkPreview.js.map +1 -1
- package/lib/module/hooks/useMediaViewer.js +24 -0
- package/lib/module/hooks/useMediaViewer.js.map +1 -0
- package/lib/module/hooks/useSendAttachment.js +182 -0
- package/lib/module/hooks/useSendAttachment.js.map +1 -0
- package/lib/module/hooks/useVideoAttachment.js +251 -0
- package/lib/module/hooks/useVideoAttachment.js.map +1 -0
- package/lib/module/index.js +13 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/screens/MediaView/VideoPlayer.js +177 -0
- package/lib/module/screens/MediaView/VideoPlayer.js.map +1 -0
- package/lib/module/screens/MediaView/index.js +264 -0
- package/lib/module/screens/MediaView/index.js.map +1 -0
- package/lib/module/screens/chat-detail/ChatComposer.js +190 -196
- package/lib/module/screens/chat-detail/ChatComposer.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatDetail.js +106 -71
- package/lib/module/screens/chat-detail/ChatDetail.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatDetailHeader.js +5 -8
- package/lib/module/screens/chat-detail/ChatDetailHeader.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatLinkPreview.js +1 -1
- package/lib/module/screens/chat-detail/ChatLinkPreview.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatListLegend.js +5 -15
- package/lib/module/screens/chat-detail/ChatListLegend.js.map +1 -1
- package/lib/module/screens/chat-detail/components/ChatInputActions.js +51 -0
- package/lib/module/screens/chat-detail/components/ChatInputActions.js.map +1 -0
- package/lib/module/screens/chat-detail/components/ChatMessageInput.js +93 -0
- package/lib/module/screens/chat-detail/components/ChatMessageInput.js.map +1 -0
- package/lib/module/screens/chat-detail/conversationHeader.utils.js +7 -9
- package/lib/module/screens/chat-detail/conversationHeader.utils.js.map +1 -1
- package/lib/module/screens/chat-detail/hooks/useAttachmentSendHandler.js +221 -0
- package/lib/module/screens/chat-detail/hooks/useAttachmentSendHandler.js.map +1 -0
- package/lib/module/screens/chat-detail/hooks/useChatComposerAnimation.js +114 -0
- package/lib/module/screens/chat-detail/hooks/useChatComposerAnimation.js.map +1 -0
- package/lib/module/screens/chat-detail/hooks/useChatComposerState.js +26 -0
- package/lib/module/screens/chat-detail/hooks/useChatComposerState.js.map +1 -0
- package/lib/module/screens/chat-detail/index.js +0 -1
- package/lib/module/screens/chat-detail/index.js.map +1 -1
- package/lib/module/screens/chat-detail/legend/LegendChatMessage.js +32 -25
- package/lib/module/screens/chat-detail/legend/LegendChatMessage.js.map +1 -1
- package/lib/module/screens/chat-detail/legend/messageTypes.js +15 -0
- package/lib/module/screens/chat-detail/legend/messageTypes.js.map +1 -0
- package/lib/module/screens/inbox/MessagesTab.js.map +1 -1
- package/lib/module/services/attachmentHandlers/fileAttachmentHandler.js +61 -0
- package/lib/module/services/attachmentHandlers/fileAttachmentHandler.js.map +1 -0
- package/lib/module/services/attachmentHandlers/imageAttachmentHandler.js +54 -0
- package/lib/module/services/attachmentHandlers/imageAttachmentHandler.js.map +1 -0
- package/lib/module/services/attachmentHandlers/index.js +12 -0
- package/lib/module/services/attachmentHandlers/index.js.map +1 -0
- package/lib/module/services/attachmentHandlers/videoAttachmentHandler.js +85 -0
- package/lib/module/services/attachmentHandlers/videoAttachmentHandler.js.map +1 -0
- package/lib/module/services/attachmentOrchestrator.js +225 -0
- package/lib/module/services/attachmentOrchestrator.js.map +1 -0
- package/lib/module/services/auth.js +35 -0
- package/lib/module/services/auth.js.map +1 -0
- package/lib/module/services/endpoints.js +20 -1
- package/lib/module/services/endpoints.js.map +1 -1
- package/lib/module/services/imageUpload.js +126 -0
- package/lib/module/services/imageUpload.js.map +1 -0
- package/lib/module/store/conversation.js +1 -1
- package/lib/module/store/conversation.js.map +1 -1
- package/lib/module/store/message.js +45 -0
- package/lib/module/store/message.js.map +1 -0
- package/lib/module/translation/resources/i18n.js +22 -2
- package/lib/module/translation/resources/i18n.js.map +1 -1
- package/lib/module/types/attachment.js +2 -0
- package/lib/module/types/attachment.js.map +1 -0
- package/lib/module/types/attachmentHandler.js +20 -0
- package/lib/module/types/attachmentHandler.js.map +1 -0
- package/lib/module/types/chat.js +2 -7
- package/lib/module/types/chat.js.map +1 -1
- package/lib/module/types/imageUpload.js +2 -0
- package/lib/module/types/imageUpload.js.map +1 -0
- package/lib/module/types/message.js +1 -0
- package/lib/module/types/message.js.map +1 -1
- package/lib/module/utils/chatImageDimens.js +148 -0
- package/lib/module/utils/chatImageDimens.js.map +1 -0
- package/lib/module/utils/conversation.js +34 -13
- package/lib/module/utils/conversation.js.map +1 -1
- package/lib/module/utils/device.js +65 -0
- package/lib/module/utils/device.js.map +1 -0
- package/lib/module/utils/imageUrlOptimizer.js +41 -0
- package/lib/module/utils/imageUrlOptimizer.js.map +1 -0
- package/lib/module/utils/imageUtils.js +69 -0
- package/lib/module/utils/imageUtils.js.map +1 -0
- package/lib/module/utils/legendListMessage.js +0 -3
- package/lib/module/utils/legendListMessage.js.map +1 -1
- package/lib/module/utils/message.js +5 -8
- package/lib/module/utils/message.js.map +1 -1
- package/lib/module/utils/resolveMessageType.js +3 -0
- package/lib/module/utils/resolveMessageType.js.map +1 -1
- package/lib/module/utils/ui.js +17 -0
- package/lib/module/utils/ui.js.map +1 -0
- package/lib/module/utils/url.js +3 -3
- package/lib/module/utils/url.js.map +1 -1
- package/lib/module/utils/videoThumbnail.js +62 -0
- package/lib/module/utils/videoThumbnail.js.map +1 -0
- package/lib/typescript/src/components/AttachmentPreview.d.ts +28 -0
- package/lib/typescript/src/components/AttachmentPreview.d.ts.map +1 -0
- package/lib/typescript/src/components/MediaViewer/index.d.ts +1 -0
- package/lib/typescript/src/components/MediaViewer/index.d.ts.map +1 -0
- package/lib/typescript/src/components/MediaViewerModal.d.ts +10 -0
- package/lib/typescript/src/components/MediaViewerModal.d.ts.map +1 -0
- package/lib/typescript/src/components/MergedImageGrid.d.ts +16 -0
- package/lib/typescript/src/components/MergedImageGrid.d.ts.map +1 -0
- package/lib/typescript/src/components/ThreadCard/AvatarSection.d.ts +2 -2
- package/lib/typescript/src/components/ThreadCard/AvatarSection.d.ts.map +1 -1
- package/lib/typescript/src/components/ThreadCard/NamePrefixIcon.d.ts +3 -4
- package/lib/typescript/src/components/ThreadCard/NamePrefixIcon.d.ts.map +1 -1
- package/lib/typescript/src/components/ThreadCard/ThreadCard.d.ts.map +1 -1
- package/lib/typescript/src/components/ThreadCard/thread-card.utils.d.ts.map +1 -1
- package/lib/typescript/src/components/messages/fileMessage/index.d.ts +3 -0
- package/lib/typescript/src/components/messages/fileMessage/index.d.ts.map +1 -0
- package/lib/typescript/src/components/messages/imageMessage/index.d.ts +3 -0
- package/lib/typescript/src/components/messages/imageMessage/index.d.ts.map +1 -0
- package/lib/typescript/src/components/messages/linkMessage/index.d.ts +9 -0
- package/lib/typescript/src/components/messages/linkMessage/index.d.ts.map +1 -0
- package/lib/typescript/src/components/messages/mergedMessage/index.d.ts +3 -0
- package/lib/typescript/src/components/messages/mergedMessage/index.d.ts.map +1 -0
- package/lib/typescript/src/components/messages/styles.d.ts +36 -0
- package/lib/typescript/src/components/messages/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/messages/textMessage/index.d.ts +9 -0
- package/lib/typescript/src/components/messages/textMessage/index.d.ts.map +1 -0
- package/lib/typescript/src/components/messages/types.d.ts +10 -0
- package/lib/typescript/src/components/messages/types.d.ts.map +1 -0
- package/lib/typescript/src/components/messages/videoMessage/index.d.ts +3 -0
- package/lib/typescript/src/components/messages/videoMessage/index.d.ts.map +1 -0
- package/lib/typescript/src/config/api-endpoints.d.ts +40 -0
- package/lib/typescript/src/config/api-endpoints.d.ts.map +1 -0
- package/lib/typescript/src/config/attachment-priority.d.ts +31 -0
- package/lib/typescript/src/config/attachment-priority.d.ts.map +1 -0
- package/lib/typescript/src/config/configuration.d.ts +30 -0
- package/lib/typescript/src/config/configuration.d.ts.map +1 -0
- package/lib/typescript/src/config/index.d.ts +15 -0
- package/lib/typescript/src/config/index.d.ts.map +1 -0
- package/lib/typescript/src/context/ChatContext.d.ts +1 -1
- package/lib/typescript/src/context/ChatContext.d.ts.map +1 -1
- package/lib/typescript/src/core/index.d.ts +13 -1
- package/lib/typescript/src/core/index.d.ts.map +1 -1
- package/lib/typescript/src/core/useChatListener.d.ts.map +1 -1
- package/lib/typescript/src/hooks/message/useSendMessage.d.ts +12 -0
- package/lib/typescript/src/hooks/message/useSendMessage.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useChatMessages.d.ts +0 -1
- package/lib/typescript/src/hooks/useChatMessages.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useConversationList.d.ts +2 -1
- package/lib/typescript/src/hooks/useConversationList.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useImageAttachment.d.ts +20 -0
- package/lib/typescript/src/hooks/useImageAttachment.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useLinkPreview/useLinkPreview.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useMediaViewer.d.ts +13 -0
- package/lib/typescript/src/hooks/useMediaViewer.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useSendAttachment.d.ts +59 -0
- package/lib/typescript/src/hooks/useSendAttachment.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useVideoAttachment.d.ts +29 -0
- package/lib/typescript/src/hooks/useVideoAttachment.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +14 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/screens/MediaView/VideoPlayer.d.ts +12 -0
- package/lib/typescript/src/screens/MediaView/VideoPlayer.d.ts.map +1 -0
- package/lib/typescript/src/screens/MediaView/index.d.ts +11 -0
- package/lib/typescript/src/screens/MediaView/index.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatDetailHeader.d.ts +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatDetailHeader.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatListLegend.d.ts +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatListLegend.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/components/ChatInputActions.d.ts +8 -0
- package/lib/typescript/src/screens/chat-detail/components/ChatInputActions.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/components/ChatMessageInput.d.ts +15 -0
- package/lib/typescript/src/screens/chat-detail/components/ChatMessageInput.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/conversationHeader.utils.d.ts +1 -1
- package/lib/typescript/src/screens/chat-detail/conversationHeader.utils.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/hooks/useAttachmentSendHandler.d.ts +23 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useAttachmentSendHandler.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerAnimation.d.ts +15 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerAnimation.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerState.d.ts +13 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerState.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/index.d.ts +0 -2
- package/lib/typescript/src/screens/chat-detail/index.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts +3 -3
- package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/legend/messageTypes.d.ts +13 -0
- package/lib/typescript/src/screens/chat-detail/legend/messageTypes.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/types.d.ts +10 -8
- package/lib/typescript/src/screens/chat-detail/types.d.ts.map +1 -1
- package/lib/typescript/src/services/attachmentHandlers/fileAttachmentHandler.d.ts +22 -0
- package/lib/typescript/src/services/attachmentHandlers/fileAttachmentHandler.d.ts.map +1 -0
- package/lib/typescript/src/services/attachmentHandlers/imageAttachmentHandler.d.ts +3 -0
- package/lib/typescript/src/services/attachmentHandlers/imageAttachmentHandler.d.ts.map +1 -0
- package/lib/typescript/src/services/attachmentHandlers/index.d.ts +5 -0
- package/lib/typescript/src/services/attachmentHandlers/index.d.ts.map +1 -0
- package/lib/typescript/src/services/attachmentHandlers/videoAttachmentHandler.d.ts +31 -0
- package/lib/typescript/src/services/attachmentHandlers/videoAttachmentHandler.d.ts.map +1 -0
- package/lib/typescript/src/services/attachmentOrchestrator.d.ts +5 -0
- package/lib/typescript/src/services/attachmentOrchestrator.d.ts.map +1 -0
- package/lib/typescript/src/services/auth.d.ts +19 -0
- package/lib/typescript/src/services/auth.d.ts.map +1 -0
- package/lib/typescript/src/services/endpoints.d.ts +11 -1
- package/lib/typescript/src/services/endpoints.d.ts.map +1 -1
- package/lib/typescript/src/services/imageUpload.d.ts +7 -0
- package/lib/typescript/src/services/imageUpload.d.ts.map +1 -0
- package/lib/typescript/src/store/message.d.ts +3 -0
- package/lib/typescript/src/store/message.d.ts.map +1 -0
- package/lib/typescript/src/translation/resources/i18n.d.ts.map +1 -1
- package/lib/typescript/src/types/attachment.d.ts +72 -0
- package/lib/typescript/src/types/attachment.d.ts.map +1 -0
- package/lib/typescript/src/types/attachmentHandler.d.ts +13 -0
- package/lib/typescript/src/types/attachmentHandler.d.ts.map +1 -0
- package/lib/typescript/src/types/chat.d.ts +28 -27
- package/lib/typescript/src/types/chat.d.ts.map +1 -1
- package/lib/typescript/src/types/common.d.ts +1 -0
- package/lib/typescript/src/types/common.d.ts.map +1 -1
- package/lib/typescript/src/types/imageUpload.d.ts +26 -0
- package/lib/typescript/src/types/imageUpload.d.ts.map +1 -0
- package/lib/typescript/src/types/message.d.ts +1 -0
- package/lib/typescript/src/types/message.d.ts.map +1 -1
- package/lib/typescript/src/utils/chatImageDimens.d.ts +34 -0
- package/lib/typescript/src/utils/chatImageDimens.d.ts.map +1 -0
- package/lib/typescript/src/utils/conversation.d.ts +3 -2
- package/lib/typescript/src/utils/conversation.d.ts.map +1 -1
- package/lib/typescript/src/utils/device.d.ts +7 -0
- package/lib/typescript/src/utils/device.d.ts.map +1 -0
- package/lib/typescript/src/utils/imageUrlOptimizer.d.ts +12 -0
- package/lib/typescript/src/utils/imageUrlOptimizer.d.ts.map +1 -0
- package/lib/typescript/src/utils/imageUtils.d.ts +9 -0
- package/lib/typescript/src/utils/imageUtils.d.ts.map +1 -0
- package/lib/typescript/src/utils/legendListMessage.d.ts +0 -2
- package/lib/typescript/src/utils/legendListMessage.d.ts.map +1 -1
- package/lib/typescript/src/utils/message.d.ts.map +1 -1
- package/lib/typescript/src/utils/resolveMessageType.d.ts.map +1 -1
- package/lib/typescript/src/utils/ui.d.ts +13 -0
- package/lib/typescript/src/utils/ui.d.ts.map +1 -0
- package/lib/typescript/src/utils/url.d.ts +1 -1
- package/lib/typescript/src/utils/url.d.ts.map +1 -1
- package/lib/typescript/src/utils/videoThumbnail.d.ts +16 -0
- package/lib/typescript/src/utils/videoThumbnail.d.ts.map +1 -0
- package/package.json +15 -3
- package/src/components/AttachmentPreview.tsx +304 -0
- package/src/components/MediaViewer/index.tsx +0 -0
- package/src/components/MediaViewerModal.tsx +70 -0
- package/src/components/MergedImageGrid.tsx +238 -0
- package/src/components/ThreadCard/AvatarSection.tsx +5 -8
- package/src/components/ThreadCard/NamePrefixIcon.tsx +27 -38
- package/src/components/ThreadCard/ThreadCard.tsx +16 -30
- package/src/components/ThreadCard/thread-card.utils.ts +95 -4
- package/src/components/messages/fileMessage/index.tsx +30 -0
- package/src/components/messages/imageMessage/index.tsx +137 -0
- package/src/components/messages/linkMessage/index.tsx +162 -0
- package/src/components/messages/mergedMessage/index.tsx +45 -0
- package/src/components/messages/styles.ts +39 -0
- package/src/components/messages/textMessage/index.tsx +53 -0
- package/src/components/messages/types.ts +22 -0
- package/src/components/messages/videoMessage/index.tsx +120 -0
- package/src/config/api-endpoints.ts +72 -0
- package/src/config/attachment-priority.ts +93 -0
- package/src/config/configuration.ts +50 -0
- package/src/config/index.ts +19 -0
- package/src/context/ChatContext.tsx +12 -4
- package/src/core/index.ts +25 -1
- package/src/core/useChatListener.ts +0 -21
- package/src/hooks/message/useSendMessage.ts +143 -0
- package/src/hooks/useChatMessages.ts +69 -161
- package/src/hooks/useConversationList.ts +34 -16
- package/src/hooks/useImageAttachment.ts +348 -0
- package/src/hooks/useLinkPreview/useLinkPreview.ts +3 -2
- package/src/hooks/useMediaViewer.ts +32 -0
- package/src/hooks/useSendAttachment.ts +295 -0
- package/src/hooks/useVideoAttachment.ts +334 -0
- package/src/index.tsx +13 -1
- package/src/screens/MediaView/VideoPlayer.tsx +211 -0
- package/src/screens/MediaView/index.tsx +327 -0
- package/src/screens/chat-detail/ChatComposer.tsx +206 -271
- package/src/screens/chat-detail/ChatDetail.tsx +164 -104
- package/src/screens/chat-detail/ChatDetailHeader.tsx +4 -10
- package/src/screens/chat-detail/ChatLinkPreview.tsx +1 -1
- package/src/screens/chat-detail/ChatListLegend.tsx +10 -13
- package/src/screens/chat-detail/components/ChatInputActions.tsx +71 -0
- package/src/screens/chat-detail/components/ChatMessageInput.tsx +127 -0
- package/src/screens/chat-detail/conversationHeader.utils.ts +11 -14
- package/src/screens/chat-detail/hooks/useAttachmentSendHandler.ts +291 -0
- package/src/screens/chat-detail/hooks/useChatComposerAnimation.ts +184 -0
- package/src/screens/chat-detail/hooks/useChatComposerState.ts +40 -0
- package/src/screens/chat-detail/index.ts +0 -2
- package/src/screens/chat-detail/legend/LegendChatMessage.tsx +44 -39
- package/src/screens/chat-detail/legend/messageTypes.tsx +13 -0
- package/src/screens/chat-detail/types.ts +11 -9
- package/src/screens/inbox/MessagesTab.tsx +1 -1
- package/src/services/attachmentHandlers/fileAttachmentHandler.ts +78 -0
- package/src/services/attachmentHandlers/imageAttachmentHandler.ts +54 -0
- package/src/services/attachmentHandlers/index.ts +10 -0
- package/src/services/attachmentHandlers/videoAttachmentHandler.ts +114 -0
- package/src/services/attachmentOrchestrator.ts +300 -0
- package/src/services/auth.ts +34 -0
- package/src/services/endpoints.ts +24 -1
- package/src/services/imageUpload.ts +162 -0
- package/src/store/conversation.ts +1 -1
- package/src/store/message.ts +44 -0
- package/src/translation/resources/i18n.ts +22 -2
- package/src/types/attachment.ts +85 -0
- package/src/types/attachmentHandler.ts +31 -0
- package/src/types/chat.ts +31 -30
- package/src/types/common.ts +1 -0
- package/src/types/imageUpload.ts +28 -0
- package/src/types/message.ts +1 -0
- package/src/utils/chatImageDimens.ts +178 -0
- package/src/utils/conversation.ts +44 -17
- package/src/utils/device.ts +73 -0
- package/src/utils/imageUrlOptimizer.ts +56 -0
- package/src/utils/imageUtils.ts +76 -0
- package/src/utils/legendListMessage.ts +0 -5
- package/src/utils/message.ts +10 -12
- package/src/utils/resolveMessageType.ts +2 -0
- package/src/utils/ui.ts +19 -0
- package/src/utils/url.ts +3 -3
- package/src/utils/videoThumbnail.ts +85 -0
- package/lib/module/screens/chat-detail/ChatList.js +0 -147
- package/lib/module/screens/chat-detail/ChatList.js.map +0 -1
- package/lib/module/screens/chat-detail/ChatTextBubble.js +0 -62
- package/lib/module/screens/chat-detail/ChatTextBubble.js.map +0 -1
- package/lib/module/screens/chat-detail/legend/message-types.js +0 -122
- package/lib/module/screens/chat-detail/legend/message-types.js.map +0 -1
- package/lib/module/screens/chat-detail/messages/ChatMessageBubble.js +0 -24
- package/lib/module/screens/chat-detail/messages/ChatMessageBubble.js.map +0 -1
- package/lib/module/screens/chat-detail/messages/types.js +0 -4
- package/lib/module/screens/chat-detail/messages/types.js.map +0 -1
- package/lib/typescript/src/screens/chat-detail/ChatList.d.ts +0 -3
- package/lib/typescript/src/screens/chat-detail/ChatList.d.ts.map +0 -1
- package/lib/typescript/src/screens/chat-detail/ChatTextBubble.d.ts +0 -3
- package/lib/typescript/src/screens/chat-detail/ChatTextBubble.d.ts.map +0 -1
- package/lib/typescript/src/screens/chat-detail/legend/message-types.d.ts +0 -12
- package/lib/typescript/src/screens/chat-detail/legend/message-types.d.ts.map +0 -1
- package/lib/typescript/src/screens/chat-detail/messages/ChatMessageBubble.d.ts +0 -3
- package/lib/typescript/src/screens/chat-detail/messages/ChatMessageBubble.d.ts.map +0 -1
- package/lib/typescript/src/screens/chat-detail/messages/types.d.ts +0 -13
- package/lib/typescript/src/screens/chat-detail/messages/types.d.ts.map +0 -1
- package/src/screens/chat-detail/ChatList.tsx +0 -190
- package/src/screens/chat-detail/ChatTextBubble.tsx +0 -73
- package/src/screens/chat-detail/legend/message-types.tsx +0 -149
- package/src/screens/chat-detail/messages/ChatMessageBubble.tsx +0 -23
- package/src/screens/chat-detail/messages/types.ts +0 -14
|
@@ -1,5 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Use config/api-endpoints.ts instead
|
|
3
|
+
* This file is kept for backward compatibility only.
|
|
4
|
+
* All endpoints should be managed through config/api-endpoints.ts
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
getApiEndpoint,
|
|
9
|
+
setApiEndpoint,
|
|
10
|
+
getAllApiEndpoints,
|
|
11
|
+
} from '../config/api-endpoints';
|
|
12
|
+
|
|
13
|
+
// Legacy interface - use api-endpoints.ts directly
|
|
1
14
|
export const ENDPOINTS = {
|
|
2
15
|
chatService: {
|
|
3
|
-
urlMetadata
|
|
16
|
+
get urlMetadata() {
|
|
17
|
+
return getApiEndpoint('urlMetadata');
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
uploaderService: {
|
|
21
|
+
get uploadImage() {
|
|
22
|
+
return getApiEndpoint('imageUpload');
|
|
23
|
+
},
|
|
4
24
|
},
|
|
5
25
|
};
|
|
26
|
+
|
|
27
|
+
// Re-export proper API for new code
|
|
28
|
+
export { getApiEndpoint, setApiEndpoint, getAllApiEndpoints };
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import ReactNativeBlobUtil from 'react-native-blob-util';
|
|
2
|
+
import RNFS from 'react-native-fs';
|
|
3
|
+
import { getImageUploadEndpoint, getMimeType } from '../utils/imageUtils';
|
|
4
|
+
import { getAuthToken } from './auth';
|
|
5
|
+
import { getApiEndpoint } from '../config/api-endpoints';
|
|
6
|
+
import { getBaseUrl } from '../config/configuration';
|
|
7
|
+
import type {
|
|
8
|
+
ImageFile,
|
|
9
|
+
UploadedImage,
|
|
10
|
+
ImageUploadConfig,
|
|
11
|
+
} from '../types/imageUpload';
|
|
12
|
+
|
|
13
|
+
export namespace ImageUploadAPI {
|
|
14
|
+
export const uploadImageFile = async (
|
|
15
|
+
file: ImageFile,
|
|
16
|
+
onProgress?: (progress: number) => void
|
|
17
|
+
): Promise<UploadedImage> => {
|
|
18
|
+
let token: string;
|
|
19
|
+
let uploadUrl: string;
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
token = getAuthToken();
|
|
23
|
+
const relativePath = getApiEndpoint('imageUpload');
|
|
24
|
+
const baseUrl = getBaseUrl();
|
|
25
|
+
|
|
26
|
+
if (!baseUrl) {
|
|
27
|
+
throw new Error(
|
|
28
|
+
'Image upload base URL not configured. Call initChatSdk() with apiBaseUrl during app initialization.'
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Construct absolute URL for ReactNativeBlobUtil.fetch()
|
|
33
|
+
uploadUrl = getImageUploadEndpoint(`${baseUrl}${relativePath}`);
|
|
34
|
+
} catch (e) {
|
|
35
|
+
if (__DEV__) console.error('[ImageUploadAPI] Auth error:', e);
|
|
36
|
+
throw e;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return new Promise((resolve, reject) => {
|
|
40
|
+
ReactNativeBlobUtil.fetch(
|
|
41
|
+
'POST',
|
|
42
|
+
uploadUrl,
|
|
43
|
+
{
|
|
44
|
+
Authorization: `Bearer ${token}`,
|
|
45
|
+
},
|
|
46
|
+
[
|
|
47
|
+
{
|
|
48
|
+
name: 'files',
|
|
49
|
+
filename: file.filename,
|
|
50
|
+
data: ReactNativeBlobUtil.wrap(file.path),
|
|
51
|
+
type: getMimeType(file.filename),
|
|
52
|
+
},
|
|
53
|
+
]
|
|
54
|
+
)
|
|
55
|
+
.uploadProgress((written, total) => {
|
|
56
|
+
const progress = Math.round((written / total) * 100);
|
|
57
|
+
onProgress?.(progress);
|
|
58
|
+
})
|
|
59
|
+
.then((response) => {
|
|
60
|
+
// Check for HTTP error status
|
|
61
|
+
const status = response.respInfo?.status;
|
|
62
|
+
if (status && status >= 400) {
|
|
63
|
+
if (__DEV__)
|
|
64
|
+
console.error('[ImageUploadAPI] Server error response', {
|
|
65
|
+
status,
|
|
66
|
+
data: response.data,
|
|
67
|
+
});
|
|
68
|
+
reject(new Error(`Upload failed with status ${status}`));
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (!response.data || response.data.length === 0) {
|
|
73
|
+
if (__DEV__)
|
|
74
|
+
console.error('[ImageUploadAPI] Empty response', {
|
|
75
|
+
dataType: typeof response.data,
|
|
76
|
+
data: response.data,
|
|
77
|
+
});
|
|
78
|
+
reject(new Error('Empty response from server'));
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
try {
|
|
83
|
+
const json = JSON.parse(response.data);
|
|
84
|
+
const uploaded = json.data?.[0] || json.files?.[0];
|
|
85
|
+
const imageUrl =
|
|
86
|
+
uploaded?.publicUrl || uploaded?.url || uploaded?.data;
|
|
87
|
+
if (imageUrl) {
|
|
88
|
+
resolve({
|
|
89
|
+
url: imageUrl,
|
|
90
|
+
name: uploaded?.fileName,
|
|
91
|
+
width: file.width,
|
|
92
|
+
height: file.height,
|
|
93
|
+
size: file.size,
|
|
94
|
+
});
|
|
95
|
+
} else {
|
|
96
|
+
if (__DEV__)
|
|
97
|
+
console.error('[ImageUploadAPI] No URL in response:', json);
|
|
98
|
+
reject(new Error('No URL in response'));
|
|
99
|
+
}
|
|
100
|
+
} catch (err) {
|
|
101
|
+
if (__DEV__) console.error('[ImageUploadAPI] Parse error:', err);
|
|
102
|
+
reject(new Error('Invalid response format'));
|
|
103
|
+
}
|
|
104
|
+
})
|
|
105
|
+
.catch((error) => {
|
|
106
|
+
if (__DEV__) console.error('[ImageUploadAPI] Fetch error:', error);
|
|
107
|
+
reject(error);
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export const uploadImageQueue = async (
|
|
113
|
+
files: ImageFile[],
|
|
114
|
+
config: ImageUploadConfig = {},
|
|
115
|
+
onProgress?: (completed: number, total: number) => void
|
|
116
|
+
): Promise<UploadedImage[]> => {
|
|
117
|
+
const { maxConcurrent = 2 } = config;
|
|
118
|
+
const results: UploadedImage[] = [];
|
|
119
|
+
const queue = [...files];
|
|
120
|
+
let activeCount = 0;
|
|
121
|
+
|
|
122
|
+
return new Promise((resolve, _reject) => {
|
|
123
|
+
const processNext = async () => {
|
|
124
|
+
if (queue.length === 0 && activeCount === 0) {
|
|
125
|
+
resolve(results);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (queue.length > 0 && activeCount < maxConcurrent) {
|
|
130
|
+
const file = queue.shift();
|
|
131
|
+
if (!file) return;
|
|
132
|
+
|
|
133
|
+
activeCount++;
|
|
134
|
+
|
|
135
|
+
try {
|
|
136
|
+
const result = await uploadImageFile(file);
|
|
137
|
+
results.push(result);
|
|
138
|
+
onProgress?.(results.length, files.length);
|
|
139
|
+
} catch (error) {
|
|
140
|
+
if (__DEV__)
|
|
141
|
+
console.error(`Failed to upload ${file.filename}:`, error);
|
|
142
|
+
} finally {
|
|
143
|
+
activeCount--;
|
|
144
|
+
processNext();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
for (let i = 0; i < maxConcurrent && queue.length > 0; i++) {
|
|
150
|
+
processNext();
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export const cleanupImageFile = async (filePath: string): Promise<void> => {
|
|
156
|
+
try {
|
|
157
|
+
await RNFS.unlink(filePath);
|
|
158
|
+
} catch (err) {
|
|
159
|
+
if (__DEV__) console.warn('Cleanup failed:', err);
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { create } from 'zustand';
|
|
2
|
+
import type { MessageItem } from '@droppii/openim-rn-client-sdk';
|
|
3
|
+
import type { DMessageItem, MessageStore } from '../types/chat';
|
|
4
|
+
import { mergeMessages } from '../utils/message';
|
|
5
|
+
|
|
6
|
+
export const useMessageStore = create<MessageStore>()((set, get) => ({
|
|
7
|
+
messages: [],
|
|
8
|
+
hasMoreEarlier: false,
|
|
9
|
+
hasMoreNewer: false,
|
|
10
|
+
|
|
11
|
+
setMessages: (messages, hasMore) => {
|
|
12
|
+
set({ messages, hasMoreEarlier: hasMore });
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
pushNewMessage: (message: MessageItem) => {
|
|
16
|
+
set((state) => ({
|
|
17
|
+
messages: mergeMessages(state.messages, [message as DMessageItem]),
|
|
18
|
+
}));
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
updateOneMessage: (message: MessageItem) => {
|
|
22
|
+
const tmpList = [...get().messages];
|
|
23
|
+
const idx = tmpList.findIndex(
|
|
24
|
+
(msg) => msg.clientMsgID === message.clientMsgID
|
|
25
|
+
);
|
|
26
|
+
if (idx < 0) return;
|
|
27
|
+
tmpList[idx] = { ...tmpList[idx]!, ...message } as DMessageItem;
|
|
28
|
+
set({ messages: tmpList });
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
deleteOneMessage: (clientMsgID: string) => {
|
|
32
|
+
set((state) => ({
|
|
33
|
+
messages: state.messages.filter((msg) => msg.clientMsgID !== clientMsgID),
|
|
34
|
+
}));
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
reset: () => {
|
|
38
|
+
set({
|
|
39
|
+
messages: [],
|
|
40
|
+
hasMoreEarlier: false,
|
|
41
|
+
hasMoreNewer: false,
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
}));
|
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
const i18nKey: Record<string, string> = {
|
|
2
|
-
thread_card_bot_crm_name: 'Droppii Hỗ Trợ',
|
|
3
|
-
thread_card_fallback_name: 'Người dùng',
|
|
2
|
+
'thread_card_bot_crm_name': 'Droppii Hỗ Trợ',
|
|
3
|
+
'thread_card_fallback_name': 'Người dùng',
|
|
4
|
+
'chat:image_preview': 'Xem trước ảnh',
|
|
5
|
+
'chat:image_too_large': 'Ảnh quá lớn. Tối đa 5MB',
|
|
6
|
+
'chat:image_sent': 'Đã gửi ảnh',
|
|
7
|
+
'chat:image_upload_failed': 'Lỗi tải ảnh',
|
|
8
|
+
'chat:failed_to_send_message': 'Không thể gửi tin nhắn. Thử lại?',
|
|
9
|
+
'chat:filename': 'Tên tệp',
|
|
10
|
+
'chat:file_size': 'Kích thước',
|
|
11
|
+
'chat:dimensions': 'Kích cỡ',
|
|
12
|
+
'chat:send': 'Gửi',
|
|
13
|
+
'chat:retry': 'Thử lại',
|
|
14
|
+
'chat:retry_failed_no_data': 'Không có dữ liệu để thử lại',
|
|
15
|
+
'chat:retry_failed': 'Thử lại thất bại',
|
|
16
|
+
'chat:upload_in_progress': 'Đang tải ảnh lên',
|
|
17
|
+
'chat:wait_or_cancel': 'Vui lòng chờ hoặc hủy bỏ',
|
|
18
|
+
'msg_type_image': '[Hình ảnh]',
|
|
19
|
+
'msg_type_voice': '[Tin nhắn thoại]',
|
|
20
|
+
'msg_type_video': '[Video]',
|
|
21
|
+
'msg_type_file': '[File đính kèm]',
|
|
22
|
+
'msg_type_link': '[Liên kết]',
|
|
23
|
+
'msg_type_revoke': 'Đã thu hồi tin nhắn',
|
|
4
24
|
};
|
|
5
25
|
|
|
6
26
|
export default {
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export type AttachmentType = 'image' | 'video' | 'file' | 'audio';
|
|
2
|
+
|
|
3
|
+
export interface BaseAttachment {
|
|
4
|
+
id: string;
|
|
5
|
+
type: AttachmentType;
|
|
6
|
+
sourceFile: {
|
|
7
|
+
path: string;
|
|
8
|
+
filename: string;
|
|
9
|
+
size: number;
|
|
10
|
+
mimeType: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface ImageAttachment extends BaseAttachment {
|
|
15
|
+
type: 'image';
|
|
16
|
+
metadata: {
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
orientation?: 'portrait' | 'landscape' | 'square';
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface VideoAttachment extends BaseAttachment {
|
|
24
|
+
type: 'video';
|
|
25
|
+
metadata: {
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
duration: number;
|
|
29
|
+
thumbnail?: {
|
|
30
|
+
url: string;
|
|
31
|
+
width: number;
|
|
32
|
+
height: number;
|
|
33
|
+
size?: number;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface FileAttachment extends BaseAttachment {
|
|
39
|
+
type: 'file';
|
|
40
|
+
metadata: {
|
|
41
|
+
extension: string;
|
|
42
|
+
category: 'document' | 'spreadsheet' | 'presentation' | 'other';
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface AudioAttachment extends BaseAttachment {
|
|
47
|
+
type: 'audio';
|
|
48
|
+
metadata: {
|
|
49
|
+
duration: number;
|
|
50
|
+
bitrate?: number;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type Attachment =
|
|
55
|
+
| ImageAttachment
|
|
56
|
+
| VideoAttachment
|
|
57
|
+
| FileAttachment
|
|
58
|
+
| AudioAttachment;
|
|
59
|
+
|
|
60
|
+
export interface AttachmentUploadStatus {
|
|
61
|
+
attachmentId: string;
|
|
62
|
+
state: 'pending' | 'uploading' | 'uploaded' | 'failed' | 'cancelled';
|
|
63
|
+
progress: number;
|
|
64
|
+
uploadedUrl?: string;
|
|
65
|
+
error?: string;
|
|
66
|
+
uploadedAt?: number;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export type BatchStrategy = 'individual' | 'merged' | 'grouped';
|
|
70
|
+
|
|
71
|
+
export interface AttachmentSendOptions {
|
|
72
|
+
strategy: BatchStrategy;
|
|
73
|
+
includeCaption?: string;
|
|
74
|
+
uploadConcurrency?: number;
|
|
75
|
+
retryFailedUploads?: boolean;
|
|
76
|
+
maxRetries?: number;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface AttachmentSendResult {
|
|
80
|
+
success: boolean;
|
|
81
|
+
sentAttachmentIds: string[];
|
|
82
|
+
failedAttachmentIds: string[];
|
|
83
|
+
mergedMessageId?: string;
|
|
84
|
+
errors: Record<string, string>;
|
|
85
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Attachment } from './attachment';
|
|
2
|
+
// Imported from handlers to provide dispatch
|
|
3
|
+
import { ImageAttachmentHandler } from '../services/attachmentHandlers/imageAttachmentHandler';
|
|
4
|
+
import VideoAttachmentHandlerDefault from '../services/attachmentHandlers/videoAttachmentHandler';
|
|
5
|
+
import FileAttachmentHandlerDefault from '../services/attachmentHandlers/fileAttachmentHandler';
|
|
6
|
+
|
|
7
|
+
export interface IAttachmentHandler {
|
|
8
|
+
validate(
|
|
9
|
+
attachment: Attachment
|
|
10
|
+
): { valid: true } | { valid: false; reason: string };
|
|
11
|
+
|
|
12
|
+
prepare?(attachment: Attachment): Promise<Attachment>;
|
|
13
|
+
|
|
14
|
+
buildPayload(attachment: Attachment, uploadedUrl: string): Promise<unknown>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function getAttachmentHandler(
|
|
18
|
+
type: Attachment['type']
|
|
19
|
+
): IAttachmentHandler {
|
|
20
|
+
console.log('[getAttachmentHandler] Getting handler for type:', type);
|
|
21
|
+
switch (type) {
|
|
22
|
+
case 'image':
|
|
23
|
+
return ImageAttachmentHandler;
|
|
24
|
+
case 'video':
|
|
25
|
+
return VideoAttachmentHandlerDefault;
|
|
26
|
+
case 'file':
|
|
27
|
+
return FileAttachmentHandlerDefault;
|
|
28
|
+
default:
|
|
29
|
+
throw new Error(`No handler for attachment type: ${type}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
package/src/types/chat.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
type MessageItem,
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
type GroupAtType,
|
|
3
|
+
type ConversationItem,
|
|
4
|
+
PeerType,
|
|
6
5
|
} from '@droppii/openim-rn-client-sdk';
|
|
7
6
|
import type { PropsWithChildren } from 'react';
|
|
7
|
+
import type { IUrlMetadata } from './common';
|
|
8
8
|
|
|
9
9
|
export const EventProvider = {
|
|
10
10
|
ga: 'ga',
|
|
@@ -20,16 +20,17 @@ type LogGA = (
|
|
|
20
20
|
|
|
21
21
|
export interface ChatContextType {
|
|
22
22
|
logGA?: LogGA;
|
|
23
|
+
applicationType: DChatApplicationType;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export type ChatProviderProps = PropsWithChildren<{
|
|
26
|
-
enabled?: boolean;
|
|
27
27
|
logGA?: LogGA;
|
|
28
|
+
applicationType: DChatApplicationType;
|
|
28
29
|
}>;
|
|
29
30
|
|
|
30
31
|
export enum DChatApplicationType {
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
DROPPII = 'DROPPII',
|
|
33
|
+
OBEFE = 'OBEFE',
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
export enum DChatCategory {
|
|
@@ -40,11 +41,6 @@ export enum DChatCategory {
|
|
|
40
41
|
BIZ_BOT_CRM = 'BIZ_BOT_CRM',
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
export enum DChatType {
|
|
44
|
-
SINGLE = 'SINGLE',
|
|
45
|
-
GROUP = 'GROUP',
|
|
46
|
-
}
|
|
47
|
-
|
|
48
44
|
export enum DMemberRole {
|
|
49
45
|
AGENT = 'AGENT',
|
|
50
46
|
MEMBER = 'MEMBER',
|
|
@@ -65,11 +61,11 @@ export interface DConversationPeer {
|
|
|
65
61
|
group: null; // to be defined when group is implemented
|
|
66
62
|
}
|
|
67
63
|
|
|
68
|
-
export interface DConversationItem {
|
|
64
|
+
export interface DConversationItem extends ConversationItem {
|
|
69
65
|
// Droppii API fields
|
|
70
66
|
conversationId: string;
|
|
71
67
|
chatCategory: DChatCategory;
|
|
72
|
-
chatType:
|
|
68
|
+
chatType: PeerType;
|
|
73
69
|
applicationType: string;
|
|
74
70
|
memberRole: DMemberRole;
|
|
75
71
|
pinnedAt: string | null;
|
|
@@ -77,23 +73,6 @@ export interface DConversationItem {
|
|
|
77
73
|
peer: DConversationPeerUser;
|
|
78
74
|
// Merged from OpenIM (available after getConversationListSplit merge)
|
|
79
75
|
lastMessage?: DMessageItem;
|
|
80
|
-
unreadCount?: number;
|
|
81
|
-
conversationType?: SessionType;
|
|
82
|
-
userID?: string;
|
|
83
|
-
groupID?: string;
|
|
84
|
-
showName?: string;
|
|
85
|
-
faceURL?: string;
|
|
86
|
-
recvMsgOpt?: MessageReceiveOptType;
|
|
87
|
-
groupAtType?: GroupAtType;
|
|
88
|
-
latestMsgSendTime?: number;
|
|
89
|
-
draftText?: string;
|
|
90
|
-
draftTextTime?: number;
|
|
91
|
-
isPinned?: boolean;
|
|
92
|
-
isNotInGroup?: boolean;
|
|
93
|
-
isPrivateChat?: boolean;
|
|
94
|
-
isMsgDestruct?: boolean;
|
|
95
|
-
attachedInfo?: string;
|
|
96
|
-
ex?: string;
|
|
97
76
|
}
|
|
98
77
|
|
|
99
78
|
export interface DConversationQueryParams {
|
|
@@ -134,3 +113,25 @@ export interface DMessagePushInfoEx {
|
|
|
134
113
|
title: string;
|
|
135
114
|
desc: string;
|
|
136
115
|
}
|
|
116
|
+
|
|
117
|
+
export interface IMessageItemEx {
|
|
118
|
+
applicationType: DChatApplicationType;
|
|
119
|
+
sessionId?: string;
|
|
120
|
+
messageInfo?: {
|
|
121
|
+
type: 'MESSAGE_INFO';
|
|
122
|
+
data: 'rich_text';
|
|
123
|
+
content: string;
|
|
124
|
+
};
|
|
125
|
+
urlMetadata?: IUrlMetadata;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface MessageStore {
|
|
129
|
+
messages: DMessageItem[];
|
|
130
|
+
hasMoreEarlier: boolean;
|
|
131
|
+
hasMoreNewer: boolean;
|
|
132
|
+
setMessages: (messages: DMessageItem[], hasMore: boolean) => void;
|
|
133
|
+
pushNewMessage: (message: MessageItem) => void;
|
|
134
|
+
updateOneMessage: (message: MessageItem) => void;
|
|
135
|
+
deleteOneMessage: (clientMsgID: string) => void;
|
|
136
|
+
reset: () => void;
|
|
137
|
+
}
|
package/src/types/common.ts
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface ImageFile {
|
|
2
|
+
path: string;
|
|
3
|
+
filename: string;
|
|
4
|
+
size: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
mime: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface UploadedImage {
|
|
11
|
+
url: string;
|
|
12
|
+
name: string;
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
size: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface ImageUploadConfig {
|
|
19
|
+
maxConcurrent?: number;
|
|
20
|
+
timeout?: number;
|
|
21
|
+
retryAttempts?: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface UploadProgress {
|
|
25
|
+
completed: number;
|
|
26
|
+
total: number;
|
|
27
|
+
percentage: number;
|
|
28
|
+
}
|