@messenger-box/tailwind-ui-inbox 10.0.3-alpha.100
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/CHANGELOG.md +104 -0
- package/LICENSE +21 -0
- package/jest.config.js +9 -0
- package/lib/cdm-locales/en/translations.json +31 -0
- package/lib/cdm-locales/es/translations.json +31 -0
- package/lib/components/AIAgent/AIAgent.d.ts +21 -0
- package/lib/components/AIAgent/AIAgent.d.ts.map +1 -0
- package/lib/components/AIAgent/AIAgent.js +904 -0
- package/lib/components/AIAgent/AIAgent.js.map +1 -0
- package/lib/components/AIAgent/index.d.ts +2 -0
- package/lib/components/AIAgent/index.d.ts.map +1 -0
- package/lib/components/InboxMessage/CommonMessage.d.ts +8 -0
- package/lib/components/InboxMessage/CommonMessage.d.ts.map +1 -0
- package/lib/components/InboxMessage/CommonMessage.js +35 -0
- package/lib/components/InboxMessage/CommonMessage.js.map +1 -0
- package/lib/components/InboxMessage/ConversationItem.d.ts +14 -0
- package/lib/components/InboxMessage/ConversationItem.d.ts.map +1 -0
- package/lib/components/InboxMessage/ConversationItem.js +200 -0
- package/lib/components/InboxMessage/ConversationItem.js.map +1 -0
- package/lib/components/InboxMessage/InputComponent.d.ts +12 -0
- package/lib/components/InboxMessage/InputComponent.d.ts.map +1 -0
- package/lib/components/InboxMessage/InputComponent.js +359 -0
- package/lib/components/InboxMessage/InputComponent.js.map +1 -0
- package/lib/components/InboxMessage/LeftSidebar.d.ts +20 -0
- package/lib/components/InboxMessage/LeftSidebar.d.ts.map +1 -0
- package/lib/components/InboxMessage/LeftSidebar.js +102 -0
- package/lib/components/InboxMessage/LeftSidebar.js.map +1 -0
- package/lib/components/InboxMessage/MessageInput.d.ts +9 -0
- package/lib/components/InboxMessage/MessageInput.d.ts.map +1 -0
- package/lib/components/InboxMessage/MessageInput.js +154 -0
- package/lib/components/InboxMessage/MessageInput.js.map +1 -0
- package/lib/components/InboxMessage/MessageInputComponent.d.ts +9 -0
- package/lib/components/InboxMessage/MessageInputComponent.d.ts.map +1 -0
- package/lib/components/InboxMessage/Messages.d.ts +17 -0
- package/lib/components/InboxMessage/Messages.d.ts.map +1 -0
- package/lib/components/InboxMessage/Messages.js +99 -0
- package/lib/components/InboxMessage/Messages.js.map +1 -0
- package/lib/components/InboxMessage/MessagesBuilderUi.d.ts +17 -0
- package/lib/components/InboxMessage/MessagesBuilderUi.d.ts.map +1 -0
- package/lib/components/InboxMessage/Popover.d.ts +3 -0
- package/lib/components/InboxMessage/Popover.d.ts.map +1 -0
- package/lib/components/InboxMessage/Popover.js +31 -0
- package/lib/components/InboxMessage/Popover.js.map +1 -0
- package/lib/components/InboxMessage/RightSidebar.d.ts +9 -0
- package/lib/components/InboxMessage/RightSidebar.d.ts.map +1 -0
- package/lib/components/InboxMessage/RightSidebar.js +9 -0
- package/lib/components/InboxMessage/RightSidebar.js.map +1 -0
- package/lib/components/InboxMessage/RightSidebarAi.d.ts +23 -0
- package/lib/components/InboxMessage/RightSidebarAi.d.ts.map +1 -0
- package/lib/components/InboxMessage/RightSidebarAi.js +9 -0
- package/lib/components/InboxMessage/RightSidebarAi.js.map +1 -0
- package/lib/components/InboxMessage/ServiceConversationItem.d.ts +12 -0
- package/lib/components/InboxMessage/ServiceConversationItem.d.ts.map +1 -0
- package/lib/components/InboxMessage/ServiceConversationItem.js +185 -0
- package/lib/components/InboxMessage/ServiceConversationItem.js.map +1 -0
- package/lib/components/InboxMessage/ServiceInboxItem.d.ts +12 -0
- package/lib/components/InboxMessage/ServiceInboxItem.d.ts.map +1 -0
- package/lib/components/InboxMessage/ServiceInboxItem.js +182 -0
- package/lib/components/InboxMessage/ServiceInboxItem.js.map +1 -0
- package/lib/components/InboxMessage/SubscriptionHandler.d.ts +19 -0
- package/lib/components/InboxMessage/SubscriptionHandler.d.ts.map +1 -0
- package/lib/components/InboxMessage/SubscriptionHandler.js +41 -0
- package/lib/components/InboxMessage/SubscriptionHandler.js.map +1 -0
- package/lib/components/InboxMessage/UploadImageButton.d.ts +7 -0
- package/lib/components/InboxMessage/UploadImageButton.d.ts.map +1 -0
- package/lib/components/InboxMessage/UploadImageButton.js +34 -0
- package/lib/components/InboxMessage/UploadImageButton.js.map +1 -0
- package/lib/components/InboxMessage/UserModalContent.d.ts +3 -0
- package/lib/components/InboxMessage/UserModalContent.d.ts.map +1 -0
- package/lib/components/InboxMessage/UserModalContent.js +60 -0
- package/lib/components/InboxMessage/UserModalContent.js.map +1 -0
- package/lib/components/InboxMessage/index.d.ts +17 -0
- package/lib/components/InboxMessage/index.d.ts.map +1 -0
- package/lib/components/InboxMessage/message-widgets/CommonMessage.d.ts +11 -0
- package/lib/components/InboxMessage/message-widgets/CommonMessage.d.ts.map +1 -0
- package/lib/components/InboxMessage/message-widgets/CommonMessage.js +44 -0
- package/lib/components/InboxMessage/message-widgets/CommonMessage.js.map +1 -0
- package/lib/components/InboxMessage/message-widgets/ErrorFixCard.d.ts +11 -0
- package/lib/components/InboxMessage/message-widgets/ErrorFixCard.d.ts.map +1 -0
- package/lib/components/InboxMessage/message-widgets/ErrorFixCard.js +194 -0
- package/lib/components/InboxMessage/message-widgets/ErrorFixCard.js.map +1 -0
- package/lib/components/InboxMessage/message-widgets/MessageCard.d.ts +8 -0
- package/lib/components/InboxMessage/message-widgets/MessageCard.d.ts.map +1 -0
- package/lib/components/InboxMessage/message-widgets/MessageSliceRenderer.d.ts +12 -0
- package/lib/components/InboxMessage/message-widgets/MessageSliceRenderer.d.ts.map +1 -0
- package/lib/components/InboxMessage/message-widgets/MessageSliceRenderer.js +37 -0
- package/lib/components/InboxMessage/message-widgets/MessageSliceRenderer.js.map +1 -0
- package/lib/components/InboxMessage/message-widgets/ModernMessageGroup.d.ts +18 -0
- package/lib/components/InboxMessage/message-widgets/ModernMessageGroup.d.ts.map +1 -0
- package/lib/components/InboxMessage/message-widgets/ModernMessageGroup.js +1082 -0
- package/lib/components/InboxMessage/message-widgets/ModernMessageGroup.js.map +1 -0
- package/lib/components/InboxMessage/message-widgets/PlainMessage.d.ts +8 -0
- package/lib/components/InboxMessage/message-widgets/PlainMessage.d.ts.map +1 -0
- package/lib/components/InboxMessage/message-widgets/PlainMessage.js +14 -0
- package/lib/components/InboxMessage/message-widgets/PlainMessage.js.map +1 -0
- package/lib/components/InboxMessage/message-widgets/PropertyMessageWidget.d.ts +9 -0
- package/lib/components/InboxMessage/message-widgets/PropertyMessageWidget.d.ts.map +1 -0
- package/lib/components/InboxMessage/message-widgets/SlackLikeMessageGroup.d.ts +14 -0
- package/lib/components/InboxMessage/message-widgets/SlackLikeMessageGroup.d.ts.map +1 -0
- package/lib/components/InboxMessage/message-widgets/SlackLikeMessageGroup.js +333 -0
- package/lib/components/InboxMessage/message-widgets/SlackLikeMessageGroup.js.map +1 -0
- package/lib/components/InboxMessage/message-widgets/index.d.ts +4 -0
- package/lib/components/InboxMessage/message-widgets/index.d.ts.map +1 -0
- package/lib/components/ModelConfigPanel.d.ts +37 -0
- package/lib/components/ModelConfigPanel.d.ts.map +1 -0
- package/lib/components/ModelConfigPanel.js +317 -0
- package/lib/components/ModelConfigPanel.js.map +1 -0
- package/lib/components/filler-components/RightSiderBar.d.ts +24 -0
- package/lib/components/filler-components/RightSiderBar.d.ts.map +1 -0
- package/lib/components/filler-components/RightSiderBar.js +335 -0
- package/lib/components/filler-components/RightSiderBar.js.map +1 -0
- package/lib/components/inbox/FilesList.d.ts +20 -0
- package/lib/components/inbox/FilesList.d.ts.map +1 -0
- package/lib/components/inbox/FilesList.js +68 -0
- package/lib/components/inbox/FilesList.js.map +1 -0
- package/lib/components/inbox/MessageItem.d.ts +17 -0
- package/lib/components/inbox/MessageItem.d.ts.map +1 -0
- package/lib/components/inbox/MessageItem.js +50 -0
- package/lib/components/inbox/MessageItem.js.map +1 -0
- package/lib/components/inbox/ThreadItem.d.ts +11 -0
- package/lib/components/inbox/ThreadItem.d.ts.map +1 -0
- package/lib/components/inbox/ThreadItem.js +147 -0
- package/lib/components/inbox/ThreadItem.js.map +1 -0
- package/lib/components/inbox/index.d.ts +4 -0
- package/lib/components/inbox/index.d.ts.map +1 -0
- package/lib/components/index.d.ts +7 -0
- package/lib/components/index.d.ts.map +1 -0
- package/lib/components/live-code-editor/hybrid-live-editor.d.ts +20 -0
- package/lib/components/live-code-editor/hybrid-live-editor.d.ts.map +1 -0
- package/lib/components/live-code-editor/hybrid-live-editor.js +68 -0
- package/lib/components/live-code-editor/hybrid-live-editor.js.map +1 -0
- package/lib/components/live-code-editor/index.d.ts +4 -0
- package/lib/components/live-code-editor/index.d.ts.map +1 -0
- package/lib/components/live-code-editor/live-code-editor.d.ts +14 -0
- package/lib/components/live-code-editor/live-code-editor.d.ts.map +1 -0
- package/lib/components/live-code-editor/live-code-editor.js +207 -0
- package/lib/components/live-code-editor/live-code-editor.js.map +1 -0
- package/lib/components/slot-fill/chat-message-filler.d.ts +4 -0
- package/lib/components/slot-fill/chat-message-filler.d.ts.map +1 -0
- package/lib/components/slot-fill/chat-message-filler.js +5 -0
- package/lib/components/slot-fill/chat-message-filler.js.map +1 -0
- package/lib/components/slot-fill/chat-message-slot.d.ts +11 -0
- package/lib/components/slot-fill/chat-message-slot.d.ts.map +1 -0
- package/lib/components/slot-fill/chat-message-slot.js +6 -0
- package/lib/components/slot-fill/chat-message-slot.js.map +1 -0
- package/lib/components/slot-fill/index.d.ts +4 -0
- package/lib/components/slot-fill/index.d.ts.map +1 -0
- package/lib/components/slot-fill/right-sidebar-filler.d.ts +4 -0
- package/lib/components/slot-fill/right-sidebar-filler.d.ts.map +1 -0
- package/lib/components/slot-fill/right-sidebar-filler.js +13 -0
- package/lib/components/slot-fill/right-sidebar-filler.js.map +1 -0
- package/lib/components/ui/button.d.ts +9 -0
- package/lib/components/ui/button.d.ts.map +1 -0
- package/lib/compute.d.ts +8 -0
- package/lib/compute.d.ts.map +1 -0
- package/lib/compute.js +137 -0
- package/lib/compute.js.map +1 -0
- package/lib/config/env-config.d.ts +13 -0
- package/lib/config/env-config.d.ts.map +1 -0
- package/lib/config/env-config.js +34 -0
- package/lib/config/env-config.js.map +1 -0
- package/lib/config/index.d.ts +2 -0
- package/lib/config/index.d.ts.map +1 -0
- package/lib/constants/breakpoints.d.ts +8 -0
- package/lib/constants/breakpoints.d.ts.map +1 -0
- package/lib/constants/index.d.ts +3 -0
- package/lib/constants/index.d.ts.map +1 -0
- package/lib/container/AiInbox.d.ts +15 -0
- package/lib/container/AiInbox.d.ts.map +1 -0
- package/lib/container/AiInboxWithLoader.d.ts +36 -0
- package/lib/container/AiInboxWithLoader.d.ts.map +1 -0
- package/lib/container/AiLandingInput.d.ts +4 -0
- package/lib/container/AiLandingInput.d.ts.map +1 -0
- package/lib/container/AiLandingInput.js +101 -0
- package/lib/container/AiLandingInput.js.map +1 -0
- package/lib/container/Inbox.d.ts +15 -0
- package/lib/container/Inbox.d.ts.map +1 -0
- package/lib/container/Inbox.js +955 -0
- package/lib/container/Inbox.js.map +1 -0
- package/lib/container/InboxAiMessagesLoader.d.ts +15 -0
- package/lib/container/InboxAiMessagesLoader.d.ts.map +1 -0
- package/lib/container/InboxAiMessagesLoader.js +30 -0
- package/lib/container/InboxAiMessagesLoader.js.map +1 -0
- package/lib/container/InboxContainer.d.ts +12 -0
- package/lib/container/InboxContainer.d.ts.map +1 -0
- package/lib/container/InboxContainer.js +31 -0
- package/lib/container/InboxContainer.js.map +1 -0
- package/lib/container/InboxTemplate1.d.ts +15 -0
- package/lib/container/InboxTemplate1.d.ts.map +1 -0
- package/lib/container/InboxTemplate1WithLoader.d.ts +36 -0
- package/lib/container/InboxTemplate1WithLoader.d.ts.map +1 -0
- package/lib/container/InboxTemplate2.d.ts +15 -0
- package/lib/container/InboxTemplate2.d.ts.map +1 -0
- package/lib/container/InboxWithAiLoader.d.ts +15 -0
- package/lib/container/InboxWithAiLoader.d.ts.map +1 -0
- package/lib/container/InboxWithAiLoader.js +56 -0
- package/lib/container/InboxWithAiLoader.js.map +1 -0
- package/lib/container/InboxWithLoader.d.ts +36 -0
- package/lib/container/InboxWithLoader.d.ts.map +1 -0
- package/lib/container/InboxWithLoader.js +277 -0
- package/lib/container/InboxWithLoader.js.map +1 -0
- package/lib/container/ServiceInbox.d.ts +9 -0
- package/lib/container/ServiceInbox.d.ts.map +1 -0
- package/lib/container/ServiceInbox.js +144 -0
- package/lib/container/ServiceInbox.js.map +1 -0
- package/lib/container/ThreadMessages.d.ts +13 -0
- package/lib/container/ThreadMessages.d.ts.map +1 -0
- package/lib/container/ThreadMessages.js +314 -0
- package/lib/container/ThreadMessages.js.map +1 -0
- package/lib/container/ThreadMessagesInbox.d.ts +14 -0
- package/lib/container/ThreadMessagesInbox.d.ts.map +1 -0
- package/lib/container/ThreadMessagesInbox.js +341 -0
- package/lib/container/ThreadMessagesInbox.js.map +1 -0
- package/lib/container/Threads.d.ts +8 -0
- package/lib/container/Threads.d.ts.map +1 -0
- package/lib/container/Threads.js +231 -0
- package/lib/container/Threads.js.map +1 -0
- package/lib/container/ThreadsInbox.d.ts +21 -0
- package/lib/container/ThreadsInbox.d.ts.map +1 -0
- package/lib/container/ThreadsInbox.js +244 -0
- package/lib/container/ThreadsInbox.js.map +1 -0
- package/lib/container/apply-footer-styles.d.ts +2 -0
- package/lib/container/apply-footer-styles.d.ts.map +1 -0
- package/lib/container/apply-footer-styles.js +16 -0
- package/lib/container/apply-footer-styles.js.map +1 -0
- package/lib/container/index.d.ts +13 -0
- package/lib/container/index.d.ts.map +1 -0
- package/lib/enums/index.d.ts +2 -0
- package/lib/enums/index.d.ts.map +1 -0
- package/lib/enums/messenger-slot-fill-name-enum.d.ts +5 -0
- package/lib/enums/messenger-slot-fill-name-enum.d.ts.map +1 -0
- package/lib/enums/messenger-slot-fill-name-enum.js +5 -0
- package/lib/enums/messenger-slot-fill-name-enum.js.map +1 -0
- package/lib/hooks/index.d.ts +3 -0
- package/lib/hooks/index.d.ts.map +1 -0
- package/lib/hooks/use-file-sync.d.ts +16 -0
- package/lib/hooks/use-file-sync.d.ts.map +1 -0
- package/lib/hooks/use-file-sync.js +63 -0
- package/lib/hooks/use-file-sync.js.map +1 -0
- package/lib/hooks/usePersistentModelConfig.d.ts +15 -0
- package/lib/hooks/usePersistentModelConfig.d.ts.map +1 -0
- package/lib/hooks/usePersistentModelConfig.js +46 -0
- package/lib/hooks/usePersistentModelConfig.js.map +1 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -0
- package/lib/interfaces/index.d.ts +2 -0
- package/lib/interfaces/index.d.ts.map +1 -0
- package/lib/interfaces/message-widgets.interface.d.ts +21 -0
- package/lib/interfaces/message-widgets.interface.d.ts.map +1 -0
- package/lib/machines/aiAgentMachine.d.ts +3 -0
- package/lib/machines/aiAgentMachine.d.ts.map +1 -0
- package/lib/machines/aiAgentMachine.js +1083 -0
- package/lib/machines/aiAgentMachine.js.map +1 -0
- package/lib/machines/aiAgentMachine.simple.d.ts +3 -0
- package/lib/machines/aiAgentMachine.simple.d.ts.map +1 -0
- package/lib/machines/aiAgentMachine.simple.js +108 -0
- package/lib/machines/aiAgentMachine.simple.js.map +1 -0
- package/lib/machines/index.d.ts +3 -0
- package/lib/machines/index.d.ts.map +1 -0
- package/lib/machines/types.d.ts +77 -0
- package/lib/machines/types.d.ts.map +1 -0
- package/lib/module.d.ts +7 -0
- package/lib/module.d.ts.map +1 -0
- package/lib/module.js +26 -0
- package/lib/module.js.map +1 -0
- package/lib/routes.json +98 -0
- package/lib/styles/responsive.css +76 -0
- package/lib/templates/InboxWithAi.d.ts +15 -0
- package/lib/templates/InboxWithAi.d.ts.map +1 -0
- package/lib/templates/InboxWithAi.js +440 -0
- package/lib/templates/InboxWithAi.js.map +1 -0
- package/lib/templates/InboxWithAi.tsx +533 -0
- package/lib/templates/index.d.ts +2 -0
- package/lib/templates/index.d.ts.map +1 -0
- package/lib/templates/index.ts +1 -0
- package/lib/utils/utils.d.ts +2 -0
- package/lib/utils/utils.d.ts.map +1 -0
- package/lib/utils/utils.js +3 -0
- package/lib/utils/utils.js.map +1 -0
- package/package.json +62 -0
- package/rollup.config.mjs +35 -0
- package/src/cdm-locales/en/translations.json +31 -0
- package/src/cdm-locales/es/translations.json +31 -0
- package/src/components/AIAgent/AIAgent.tsx +1103 -0
- package/src/components/AIAgent/AIAgent.tsx.bk +1365 -0
- package/src/components/AIAgent/README.md +82 -0
- package/src/components/AIAgent/index.ts +1 -0
- package/src/components/InboxMessage/CommonMessage.tsx +40 -0
- package/src/components/InboxMessage/ConversationItem.tsx +255 -0
- package/src/components/InboxMessage/InputComponent.tsx +462 -0
- package/src/components/InboxMessage/LeftSidebar.tsx +140 -0
- package/src/components/InboxMessage/MessageInput.tsx +209 -0
- package/src/components/InboxMessage/MessageInputComponent.tsx +245 -0
- package/src/components/InboxMessage/Messages.tsx +137 -0
- package/src/components/InboxMessage/MessagesBuilderUi.tsx +205 -0
- package/src/components/InboxMessage/Popover.tsx +42 -0
- package/src/components/InboxMessage/RightSidebar.tsx +22 -0
- package/src/components/InboxMessage/RightSidebarAi.tsx +37 -0
- package/src/components/InboxMessage/ServiceConversationItem.tsx +234 -0
- package/src/components/InboxMessage/ServiceInboxItem.tsx +223 -0
- package/src/components/InboxMessage/SubscriptionHandler.tsx +55 -0
- package/src/components/InboxMessage/UploadImageButton.tsx +46 -0
- package/src/components/InboxMessage/UserModalContent.tsx +60 -0
- package/src/components/InboxMessage/index.ts +16 -0
- package/src/components/InboxMessage/message-widgets/CommonMessage.tsx +69 -0
- package/src/components/InboxMessage/message-widgets/ErrorFixCard.tsx +240 -0
- package/src/components/InboxMessage/message-widgets/MessageCard.tsx +127 -0
- package/src/components/InboxMessage/message-widgets/MessageSliceRenderer.tsx +40 -0
- package/src/components/InboxMessage/message-widgets/ModernMessageGroup.tsx +1295 -0
- package/src/components/InboxMessage/message-widgets/PlainMessage.tsx +18 -0
- package/src/components/InboxMessage/message-widgets/PropertyMessageWidget.tsx +29 -0
- package/src/components/InboxMessage/message-widgets/SlackLikeMessageGroup.tsx +492 -0
- package/src/components/InboxMessage/message-widgets/index.ts +3 -0
- package/src/components/ModelConfigPanel.tsx +345 -0
- package/src/components/filler-components/RightSiderBar.tsx +408 -0
- package/src/components/inbox/FilesList.tsx +89 -0
- package/src/components/inbox/MessageItem.tsx +50 -0
- package/src/components/inbox/ThreadItem.tsx +295 -0
- package/src/components/inbox/index.ts +3 -0
- package/src/components/index.ts +22 -0
- package/src/components/live-code-editor/hybrid-live-editor.tsx +105 -0
- package/src/components/live-code-editor/index.ts +3 -0
- package/src/components/live-code-editor/live-code-editor.tsx +257 -0
- package/src/components/slot-fill/chat-message-filler.tsx +18 -0
- package/src/components/slot-fill/chat-message-slot.tsx +18 -0
- package/src/components/slot-fill/index.ts +3 -0
- package/src/components/slot-fill/right-sidebar-filler.tsx +39 -0
- package/src/components/ui/button.tsx +32 -0
- package/src/compute.ts +134 -0
- package/src/config/env-config.ts +17 -0
- package/src/config/index.ts +1 -0
- package/src/constants/breakpoints.ts +7 -0
- package/src/constants/index.ts +5 -0
- package/src/container/AiInbox.tsx +1819 -0
- package/src/container/AiInboxWithLoader.tsx +356 -0
- package/src/container/AiLandingInput.tsx +221 -0
- package/src/container/Inbox.tsx +1092 -0
- package/src/container/InboxAiMessagesLoader.tsx +44 -0
- package/src/container/InboxContainer.tsx +35 -0
- package/src/container/InboxTemplate1.tsx +1542 -0
- package/src/container/InboxTemplate1WithLoader.tsx +338 -0
- package/src/container/InboxTemplate2.tsx +1606 -0
- package/src/container/InboxWithAiLoader.tsx +76 -0
- package/src/container/InboxWithLoader.tsx +341 -0
- package/src/container/ServiceInbox.tsx +190 -0
- package/src/container/ThreadMessages.tsx +371 -0
- package/src/container/ThreadMessagesInbox.tsx +450 -0
- package/src/container/Threads.tsx +270 -0
- package/src/container/ThreadsInbox.tsx +354 -0
- package/src/container/apply-footer-styles.ts +17 -0
- package/src/container/index.ts +31 -0
- package/src/enums/index.ts +1 -0
- package/src/enums/messenger-slot-fill-name-enum.ts +4 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/use-file-sync.ts +91 -0
- package/src/hooks/usePersistentModelConfig.ts +63 -0
- package/src/index.ts +37 -0
- package/src/interfaces/index.ts +1 -0
- package/src/interfaces/message-widgets.interface.ts +21 -0
- package/src/machines/aiAgentMachine.simple.ts +89 -0
- package/src/machines/aiAgentMachine.ts +1296 -0
- package/src/machines/aiAgentMachine.ts.bk +1296 -0
- package/src/machines/index.ts +2 -0
- package/src/machines/types.ts +59 -0
- package/src/module.tsx +32 -0
- package/src/styles/responsive.css +76 -0
- package/src/templates/InboxWithAi.tsx +533 -0
- package/src/templates/index.ts +1 -0
- package/src/utils/utils.ts +3 -0
- package/tsconfig.json +14 -0
- package/webpack.config.js +92 -0
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
import React, { ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { orderBy, uniqBy, startCase } from 'lodash-es';
|
|
3
|
+
import {
|
|
4
|
+
OnThreadChatMessageAddedDocument as CHAT_MESSAGE_ADDED,
|
|
5
|
+
useGetPostThreadQuery,
|
|
6
|
+
useCreatePostThreadMutation,
|
|
7
|
+
} from 'common/graphql';
|
|
8
|
+
import { useUploadFiles } from '@messenger-box/platform-client';
|
|
9
|
+
import { IFileInfo, RoomType, IPostThread } from 'common';
|
|
10
|
+
import { useSelector } from 'react-redux';
|
|
11
|
+
import { MessageInput, Messages } from '../components';
|
|
12
|
+
import { userSelector } from '@adminide-stack/user-auth0-client';
|
|
13
|
+
import { config } from '../config';
|
|
14
|
+
import { BiChevronLeftSquare } from '@react-icons/all-files/bi/BiChevronLeftSquare.js';
|
|
15
|
+
import { objectId } from '@messenger-box/core';
|
|
16
|
+
|
|
17
|
+
const { MESSAGES_PER_PAGE, WEB_INBOX_MESSEGE_PATH } = config;
|
|
18
|
+
|
|
19
|
+
export interface ThreadMessageInboxProps {
|
|
20
|
+
channelId: any;
|
|
21
|
+
postId?: any;
|
|
22
|
+
role?: string;
|
|
23
|
+
isPostParentIdThread?: boolean;
|
|
24
|
+
goBack?: boolean;
|
|
25
|
+
pathPrefix?: string;
|
|
26
|
+
setChannelId?: (channelId: any) => void;
|
|
27
|
+
setPostId?: (postId?: any) => void;
|
|
28
|
+
onMessageClick: (reservationId) => void;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const ThreadMessagesInbox = React.memo((props: ThreadMessageInboxProps) => {
|
|
32
|
+
const {
|
|
33
|
+
channelId,
|
|
34
|
+
postId,
|
|
35
|
+
role,
|
|
36
|
+
isPostParentIdThread,
|
|
37
|
+
goBack = false,
|
|
38
|
+
pathPrefix,
|
|
39
|
+
setPostId,
|
|
40
|
+
setChannelId,
|
|
41
|
+
onMessageClick,
|
|
42
|
+
} = props;
|
|
43
|
+
const threadMessageRootRef = React.useRef(null);
|
|
44
|
+
const messageListRef = useRef(null);
|
|
45
|
+
const currentUser: any = useSelector(userSelector);
|
|
46
|
+
const [channelToTop, setChannelToTop] = useState(0);
|
|
47
|
+
const [postThread, setPostThread] = useState<IPostThread>();
|
|
48
|
+
const [channelMessages, setChannelMessages] = React.useState<any>([]);
|
|
49
|
+
const [totalCount, setTotalCount] = React.useState<any>(0);
|
|
50
|
+
const [loadingOldMessages, setLoadingOldMessages] = React.useState<boolean>(false);
|
|
51
|
+
const [loading, setLoading] = React.useState<boolean>(true);
|
|
52
|
+
const [isScrollToBottom, setIsScrollToBottom] = useState(false);
|
|
53
|
+
const { startUpload } = useUploadFiles();
|
|
54
|
+
const [sendThreadMessage] = useCreatePostThreadMutation();
|
|
55
|
+
|
|
56
|
+
const {
|
|
57
|
+
data,
|
|
58
|
+
loading: threadLoading,
|
|
59
|
+
fetchMore: fetchMoreMessages,
|
|
60
|
+
refetch: refetchThreadMessages,
|
|
61
|
+
subscribeToMore,
|
|
62
|
+
} = useGetPostThreadQuery({
|
|
63
|
+
variables: {
|
|
64
|
+
channelId: channelId?.toString(),
|
|
65
|
+
role: role?.toString(),
|
|
66
|
+
postParentId: postId?.toString(),
|
|
67
|
+
limit: MESSAGES_PER_PAGE,
|
|
68
|
+
},
|
|
69
|
+
fetchPolicy: 'cache-and-network',
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
React.useEffect(() => {
|
|
73
|
+
if (postId) {
|
|
74
|
+
refetchThreadMessages({
|
|
75
|
+
channelId: channelId?.toString(),
|
|
76
|
+
role: role?.toString(),
|
|
77
|
+
postParentId: postId?.toString(),
|
|
78
|
+
limit: MESSAGES_PER_PAGE,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}, [postId]);
|
|
82
|
+
|
|
83
|
+
// React.useEffect(() => {
|
|
84
|
+
// if (data?.threadMessages) {
|
|
85
|
+
// const threads = data?.threadMessages ?? null;
|
|
86
|
+
// const threadsData = threads?.data ?? [];
|
|
87
|
+
// const messeageTotalCount = threadsData?.reduce((accumulator, thread) => {
|
|
88
|
+
// return accumulator + thread?.replyCount;
|
|
89
|
+
// }, 0);
|
|
90
|
+
// const replies = threadsData?.map((t: any) => t?.replies)?.flat(1) ?? [];
|
|
91
|
+
// const posts = threadsData?.map((t: any) => t?.post)?.flat(1) ?? [];
|
|
92
|
+
// const messages = [...posts, ...replies];
|
|
93
|
+
|
|
94
|
+
// if (
|
|
95
|
+
// (messages && messages.length > 0 && messages?.length > totalCount) ||
|
|
96
|
+
// (messages && messages.length > 0 && channelMessages.length === 0)
|
|
97
|
+
// ) {
|
|
98
|
+
// setThreadMessages(messages, messages?.length);
|
|
99
|
+
// }
|
|
100
|
+
// }
|
|
101
|
+
// if (isScrollToBottom && channelMessages) scrollToBottom();
|
|
102
|
+
// }, [data, channelMessages, loadingOldMessages, totalCount, isPostParentIdThread, isScrollToBottom]);
|
|
103
|
+
|
|
104
|
+
React.useEffect(() => {
|
|
105
|
+
if (data?.getPostThread) {
|
|
106
|
+
const threads: any = data.getPostThread;
|
|
107
|
+
const threadPost = threads?.post ?? {};
|
|
108
|
+
const threadReplies = threads?.replies ?? [];
|
|
109
|
+
const messeageTotalCount = threads?.replyCount ?? 0;
|
|
110
|
+
const messages = [threadPost, ...threadReplies];
|
|
111
|
+
if (
|
|
112
|
+
(messages && messages.length > 0 && messeageTotalCount > totalCount) ||
|
|
113
|
+
(messages && messages.length > 0 && channelMessages.length === 0)
|
|
114
|
+
) {
|
|
115
|
+
setThreadMessages(messages, messeageTotalCount);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (isScrollToBottom && channelMessages) scrollToBottom();
|
|
119
|
+
}, [data, channelMessages, loadingOldMessages, totalCount, isPostParentIdThread, isScrollToBottom]);
|
|
120
|
+
|
|
121
|
+
const lastMessage = useMemo(() => {
|
|
122
|
+
const threads: any = data?.getPostThread ?? null;
|
|
123
|
+
const threadPost = threads?.post ?? {};
|
|
124
|
+
const threadReplies = threads?.replies ?? [];
|
|
125
|
+
|
|
126
|
+
if (!threads) {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
let threadMessagesData;
|
|
130
|
+
if (threadReplies?.length) {
|
|
131
|
+
threadMessagesData = [...threadReplies];
|
|
132
|
+
} else if (threadPost && Object.keys(threadPost).length) {
|
|
133
|
+
threadMessagesData = [threadPost];
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
let filteredLastMessage =
|
|
137
|
+
threadMessagesData && threadMessagesData?.length > 1
|
|
138
|
+
? threadMessagesData?.reduce((a, b) => {
|
|
139
|
+
return new Date(a?.updatedAt) > new Date(b?.updatedAt) ? a : b;
|
|
140
|
+
}, []) ?? null
|
|
141
|
+
: threadMessagesData?.length <= 1
|
|
142
|
+
? threadMessagesData?.[0] ?? []
|
|
143
|
+
: null;
|
|
144
|
+
|
|
145
|
+
return filteredLastMessage;
|
|
146
|
+
}, [data?.getPostThread]);
|
|
147
|
+
|
|
148
|
+
// const lastMessage = useMemo(() => {
|
|
149
|
+
// const threads = data?.threadMessages ?? null;
|
|
150
|
+
// const threadsData = threads?.data ?? [];
|
|
151
|
+
// const replies = threadsData?.map((t: any) => t?.replies)?.flat(1) ?? [];
|
|
152
|
+
// const posts = threadsData?.map((t: any) => t?.post)?.flat(1) ?? [];
|
|
153
|
+
// if (!threadsData?.length) {
|
|
154
|
+
// return null;
|
|
155
|
+
// }
|
|
156
|
+
// let threadMessagesData;
|
|
157
|
+
// if (replies?.length) {
|
|
158
|
+
// threadMessagesData = [...replies];
|
|
159
|
+
// } else if (posts?.length) {
|
|
160
|
+
// threadMessagesData = [...posts];
|
|
161
|
+
// }
|
|
162
|
+
|
|
163
|
+
// let filteredLastMessage =
|
|
164
|
+
// threadMessagesData && threadMessagesData?.length > 1
|
|
165
|
+
// ? threadMessagesData?.reduce((a, b) => {
|
|
166
|
+
// return new Date(a?.updatedAt) > new Date(b?.updatedAt) ? a : b;
|
|
167
|
+
// }, []) ?? null
|
|
168
|
+
// : threadMessagesData?.length <= 1
|
|
169
|
+
// ? threadMessagesData?.[0] ?? []
|
|
170
|
+
// : null;
|
|
171
|
+
|
|
172
|
+
// return filteredLastMessage;
|
|
173
|
+
// // //return data[data.length - 1];
|
|
174
|
+
// }, [data?.threadMessages]);
|
|
175
|
+
|
|
176
|
+
React.useEffect(() => {
|
|
177
|
+
if (lastMessage && (!postId || postId == 0)) {
|
|
178
|
+
const sParentId = lastMessage?.parentId ? lastMessage?.parentId : lastMessage?.id;
|
|
179
|
+
setPostId?.(sParentId);
|
|
180
|
+
}
|
|
181
|
+
}, [lastMessage, postId]);
|
|
182
|
+
|
|
183
|
+
const setThreadMessages = useCallback((messages: any, messagesTotalCount: number) => {
|
|
184
|
+
setChannelMessages((oldMessages: any) => uniqBy([...messages, ...oldMessages], ({ id }) => id));
|
|
185
|
+
setTotalCount(messagesTotalCount);
|
|
186
|
+
}, []);
|
|
187
|
+
|
|
188
|
+
const scrollToBottom = React.useCallback(() => {
|
|
189
|
+
if (threadMessageRootRef?.current) {
|
|
190
|
+
setIsScrollToBottom(false);
|
|
191
|
+
threadMessageRootRef.current.scrollTop = threadMessageRootRef.current.scrollHeight;
|
|
192
|
+
}
|
|
193
|
+
}, [threadMessageRootRef]);
|
|
194
|
+
|
|
195
|
+
const handleSend = useCallback(
|
|
196
|
+
async (message: string, files: []) => {
|
|
197
|
+
if (!(message && channelId)) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
const newPostId = objectId();
|
|
201
|
+
|
|
202
|
+
if (files && files?.length > 0) {
|
|
203
|
+
const uploadResponse = await startUpload({
|
|
204
|
+
file: files,
|
|
205
|
+
saveUploadedFile: {
|
|
206
|
+
variables: {
|
|
207
|
+
newPostId,
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
createUploadLink: {
|
|
211
|
+
variables: {
|
|
212
|
+
newPostId,
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
});
|
|
216
|
+
if (uploadResponse?.error) setLoading(false);
|
|
217
|
+
const uploadedFiles = uploadResponse.data as unknown as IFileInfo[];
|
|
218
|
+
if (uploadResponse.data) {
|
|
219
|
+
const files = uploadedFiles?.map((f: any) => f.id) ?? null;
|
|
220
|
+
await sendThreadMessage({
|
|
221
|
+
variables: {
|
|
222
|
+
postId: newPostId,
|
|
223
|
+
channelId,
|
|
224
|
+
postThreadId: postThread && postThread?.id,
|
|
225
|
+
postParentId: !postId || postId == 0 ? null : postId,
|
|
226
|
+
threadMessageInput: {
|
|
227
|
+
content: message,
|
|
228
|
+
files,
|
|
229
|
+
role,
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
update: (cache, { data, errors }) => {
|
|
233
|
+
if (!data || errors) {
|
|
234
|
+
setLoading(false);
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
const responseMessage = data?.createPostThread?.lastMessage;
|
|
238
|
+
// setPostThread(data?.createPostThread?.data);
|
|
239
|
+
// if (!postId || postId == 0) {
|
|
240
|
+
// setPostId(data?.createPostThread?.lastMessage?.id);
|
|
241
|
+
// }
|
|
242
|
+
|
|
243
|
+
setChannelToTop(channelToTop + 1);
|
|
244
|
+
setLoading(false);
|
|
245
|
+
|
|
246
|
+
// scrollToBottom();
|
|
247
|
+
},
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
} else {
|
|
251
|
+
await sendThreadMessage({
|
|
252
|
+
variables: {
|
|
253
|
+
channelId,
|
|
254
|
+
postParentId: !postId || postId == 0 ? null : postId,
|
|
255
|
+
postThreadId: postThread && postThread?.id,
|
|
256
|
+
threadMessageInput: {
|
|
257
|
+
content: message,
|
|
258
|
+
role,
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
update: (cache, { data, errors }) => {
|
|
262
|
+
if (!data || errors) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
// setPostThread(data?.createPostThread.data);
|
|
266
|
+
// if (!postId || postId == 0) {
|
|
267
|
+
// setPostId(data?.createPostThread?.lastMessage?.id);
|
|
268
|
+
// }
|
|
269
|
+
setChannelToTop(channelToTop + 1);
|
|
270
|
+
//scrollToBottom();
|
|
271
|
+
},
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
[setChannelMessages, channelId, postId, channelToTop, postThread],
|
|
276
|
+
);
|
|
277
|
+
|
|
278
|
+
const onFetchOld = useCallback(
|
|
279
|
+
async (skip: number) => {
|
|
280
|
+
if (channelId && postId) {
|
|
281
|
+
setLoadingOldMessages(true);
|
|
282
|
+
fetchMoreMessages({
|
|
283
|
+
variables: {
|
|
284
|
+
channelId: channelId?.toString(),
|
|
285
|
+
role: role?.toString(),
|
|
286
|
+
postParentId: postId?.toString(),
|
|
287
|
+
// selectedFields: 'id channel post replies replyCount lastReplyAt createdAt updatedAt',
|
|
288
|
+
limit: MESSAGES_PER_PAGE,
|
|
289
|
+
skip: skip - 1,
|
|
290
|
+
},
|
|
291
|
+
})
|
|
292
|
+
.then((res: any) => {
|
|
293
|
+
if (res?.data?.getPostThread) {
|
|
294
|
+
const threads: any = res?.data?.getPostThread;
|
|
295
|
+
const threadReplies = threads?.replies ?? [];
|
|
296
|
+
const messeageTotalCount = threads?.replyCount ?? 0;
|
|
297
|
+
setThreadMessages(threadReplies, messeageTotalCount);
|
|
298
|
+
if (threadMessageRootRef?.current) {
|
|
299
|
+
threadMessageRootRef.current.scrollTop =
|
|
300
|
+
threadMessageRootRef.current.scrollTop +
|
|
301
|
+
threadMessageRootRef.current.clientHeight / 2;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
})
|
|
305
|
+
// .then((res) => {
|
|
306
|
+
// if (res?.data?.threadMessages?.data) {
|
|
307
|
+
// const threads = res?.data?.threadMessages ?? null;
|
|
308
|
+
// const threadsData = threads?.data ?? [];
|
|
309
|
+
// const threadReplies = threadsData?.map((t: any) => t?.replies)?.flat(1) ?? [];
|
|
310
|
+
// const messeageTotalCount = threadsData?.reduce((accumulator, thread) => {
|
|
311
|
+
// return accumulator + thread?.replyCount;
|
|
312
|
+
// }, 0);
|
|
313
|
+
// const posts = threadsData?.map((t: any) => t?.post)?.flat(1) ?? [];
|
|
314
|
+
// const messages = [...posts, ...threadReplies];
|
|
315
|
+
// setThreadMessages(threadReplies, messages?.length);
|
|
316
|
+
// if (threadMessageRootRef?.current) {
|
|
317
|
+
// threadMessageRootRef.current.scrollTop =
|
|
318
|
+
// threadMessageRootRef.current.scrollTop +
|
|
319
|
+
// threadMessageRootRef.current.clientHeight / 2;
|
|
320
|
+
// }
|
|
321
|
+
// }
|
|
322
|
+
// })
|
|
323
|
+
.finally(() => {
|
|
324
|
+
setLoadingOldMessages(false);
|
|
325
|
+
})
|
|
326
|
+
.catch((error: any) => {
|
|
327
|
+
setLoadingOldMessages(false);
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
[postId, channelId, threadMessageRootRef, channelMessages],
|
|
332
|
+
);
|
|
333
|
+
|
|
334
|
+
const onMessagesScroll = useCallback(
|
|
335
|
+
async (e) => {
|
|
336
|
+
if (threadMessageRootRef.current) {
|
|
337
|
+
const {
|
|
338
|
+
clientHeight: messageContainerClientHeight,
|
|
339
|
+
scrollHeight: messageContainerScrollHeight,
|
|
340
|
+
scrollTop: messageContainerScrollTop,
|
|
341
|
+
offsetTop: messageContainerOffsetTop,
|
|
342
|
+
} = threadMessageRootRef?.current;
|
|
343
|
+
if (
|
|
344
|
+
messageContainerClientHeight - messageContainerScrollTop == messageContainerScrollHeight &&
|
|
345
|
+
!loadingOldMessages &&
|
|
346
|
+
totalCount > channelMessages.length
|
|
347
|
+
) {
|
|
348
|
+
await onFetchOld(channelMessages?.length);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
},
|
|
352
|
+
[threadMessageRootRef, loadingOldMessages, channelMessages, totalCount],
|
|
353
|
+
);
|
|
354
|
+
|
|
355
|
+
const sortedMessages = useMemo(
|
|
356
|
+
() => channelMessages && orderBy(channelMessages, ['createdAt'], ['asc']),
|
|
357
|
+
[channelMessages],
|
|
358
|
+
);
|
|
359
|
+
|
|
360
|
+
return (
|
|
361
|
+
<React.Fragment>
|
|
362
|
+
{goBack && (
|
|
363
|
+
<button
|
|
364
|
+
className="absolute m-1.5 w-10 bg-transparent text-gray-300 z-10 text-xs hover:border-none hover:shadow-none focus:border-none focus:shadow-none focus:outline-none"
|
|
365
|
+
onClick={() => {
|
|
366
|
+
setChannelId?.(channelId);
|
|
367
|
+
setPostId?.(1);
|
|
368
|
+
}}
|
|
369
|
+
>
|
|
370
|
+
<BiChevronLeftSquare fontSize="32" />
|
|
371
|
+
</button>
|
|
372
|
+
)}
|
|
373
|
+
<div
|
|
374
|
+
ref={threadMessageRootRef}
|
|
375
|
+
className="flex flex-col-reverse overflow-y-auto flex-grow flex-shrink p-4 px-2.5 md:px-12 lg:px-20"
|
|
376
|
+
onScroll={onMessagesScroll}
|
|
377
|
+
>
|
|
378
|
+
<Messages
|
|
379
|
+
innerRef={messageListRef}
|
|
380
|
+
channelId={channelId}
|
|
381
|
+
currentUser={currentUser}
|
|
382
|
+
channelMessages={sortedMessages}
|
|
383
|
+
totalCount={totalCount}
|
|
384
|
+
onMessageClick={onMessageClick}
|
|
385
|
+
subscribeToNewMessages={() =>
|
|
386
|
+
subscribeToMore({
|
|
387
|
+
document: CHAT_MESSAGE_ADDED,
|
|
388
|
+
variables: {
|
|
389
|
+
channelId: channelId?.toString(),
|
|
390
|
+
postParentId: !postId || postId == 0 ? null : postId?.toString(),
|
|
391
|
+
},
|
|
392
|
+
updateQuery: (prev, { subscriptionData }: any) => {
|
|
393
|
+
if (!subscriptionData.data) return prev;
|
|
394
|
+
const newMessage: any = subscriptionData?.data?.threadChatMessageAdded;
|
|
395
|
+
const prevReplyCount = prev?.getPostThread?.replyCount;
|
|
396
|
+
const newReplyCount = prevReplyCount + 1;
|
|
397
|
+
|
|
398
|
+
return Object.assign({}, prev, {
|
|
399
|
+
getPostThread: {
|
|
400
|
+
...prev?.getPostThread,
|
|
401
|
+
lastReplyAt: newMessage.createdAt,
|
|
402
|
+
replies: [newMessage, ...prev?.getPostThread?.replies],
|
|
403
|
+
replyCount: newReplyCount,
|
|
404
|
+
updatedAt: newMessage.createdAt,
|
|
405
|
+
},
|
|
406
|
+
});
|
|
407
|
+
},
|
|
408
|
+
})
|
|
409
|
+
}
|
|
410
|
+
// subscribeToNewServiceMessages={() =>
|
|
411
|
+
// subscribeToMore({
|
|
412
|
+
// document: THREAD_CHAT_ADDED,
|
|
413
|
+
// variables: {
|
|
414
|
+
// channelId: channelId?.toString(),
|
|
415
|
+
// postParentId: !postId || postId == 0 ? null : postId?.toString(),
|
|
416
|
+
// },
|
|
417
|
+
// updateQuery: (prev, { subscriptionData }: any) => {
|
|
418
|
+
// if (!subscriptionData.data) return prev;
|
|
419
|
+
|
|
420
|
+
// const newPostThreadData: any = subscriptionData?.data?.threadCreatedUpdated?.data;
|
|
421
|
+
// const newMessage: any = subscriptionData?.data?.threadCreatedUpdated?.lastMessage;
|
|
422
|
+
// const updatedData = prev?.threadMessages?.data?.map((t: any) =>
|
|
423
|
+
// t.id === newPostThreadData?.id
|
|
424
|
+
// ? {
|
|
425
|
+
// ...t,
|
|
426
|
+
// replies: [...t?.replies, newMessage],
|
|
427
|
+
// replyCount: newPostThreadData?.replyCount,
|
|
428
|
+
// lastReplyAt: newPostThreadData?.lastReplyAt,
|
|
429
|
+
// updatedAt: newPostThreadData?.updatedAt,
|
|
430
|
+
// }
|
|
431
|
+
// : t,
|
|
432
|
+
// );
|
|
433
|
+
|
|
434
|
+
// return Object.assign({}, prev, {
|
|
435
|
+
// threadMessages: {
|
|
436
|
+
// ...prev?.threadMessages,
|
|
437
|
+
// totalCount: newPostThreadData?.totalCount ?? 0,
|
|
438
|
+
// // totalCount: prev?.threadMessages?.totalCount + 1,
|
|
439
|
+
// data: updatedData?.length > 0 ? updatedData : [newPostThreadData],
|
|
440
|
+
// },
|
|
441
|
+
// });
|
|
442
|
+
// },
|
|
443
|
+
// })
|
|
444
|
+
// }
|
|
445
|
+
/>
|
|
446
|
+
</div>
|
|
447
|
+
<MessageInput channelId={channelId} handleSend={handleSend} placeholder="Message" />
|
|
448
|
+
</React.Fragment>
|
|
449
|
+
);
|
|
450
|
+
});
|