@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,270 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ThreadItem } from '../components';
|
|
3
|
+
import {
|
|
4
|
+
useViewChannelDetailQuery,
|
|
5
|
+
useThreadMessagesQuery,
|
|
6
|
+
useOnThreadCreatedUpdatedSubscription,
|
|
7
|
+
OnThreadCreatedUpdatedDocument as THREAD_CHAT_ADDED,
|
|
8
|
+
} from 'common/graphql';
|
|
9
|
+
import { useSelector, useDispatch } from 'react-redux';
|
|
10
|
+
import { useTranslation } from 'react-i18next';
|
|
11
|
+
import { userSelector } from '@adminide-stack/user-auth0-client';
|
|
12
|
+
import { useNavigate, useLocation, useParams } from '@remix-run/react';
|
|
13
|
+
import { orderBy, uniqBy, startCase } from 'lodash-es';
|
|
14
|
+
import { push } from '@common-stack/remix-router-redux';
|
|
15
|
+
import { config } from '../config';
|
|
16
|
+
const { MESSAGES_PER_PAGE, WEB_INBOX_MESSEGE_PATH } = config;
|
|
17
|
+
|
|
18
|
+
// Skeleton component for loading state
|
|
19
|
+
const Skeleton = ({ className = '' }: { className?: string }) => (
|
|
20
|
+
<div className={`animate-pulse bg-gray-300 rounded ${className}`}></div>
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
const Threads = ({ channelId, role, pathPrefix = null }) => {
|
|
24
|
+
const path: any = useParams();
|
|
25
|
+
const location = useLocation();
|
|
26
|
+
const dispatch = useDispatch();
|
|
27
|
+
const threadsListRootRef = React.useRef(null);
|
|
28
|
+
const threadsListRef = React.useRef(null);
|
|
29
|
+
const auth = useSelector(userSelector);
|
|
30
|
+
const [threadData, setThreadsData] = React.useState<any>([]);
|
|
31
|
+
const { t } = useTranslation('translations');
|
|
32
|
+
const {
|
|
33
|
+
data: channelData,
|
|
34
|
+
loading: channelLoading,
|
|
35
|
+
refetch: channelDetailRefetch,
|
|
36
|
+
} = useViewChannelDetailQuery({
|
|
37
|
+
variables: {
|
|
38
|
+
id: channelId?.toString(),
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const {
|
|
43
|
+
data,
|
|
44
|
+
loading: threadLoading,
|
|
45
|
+
error,
|
|
46
|
+
refetch,
|
|
47
|
+
subscribeToMore,
|
|
48
|
+
} = useThreadMessagesQuery({
|
|
49
|
+
variables: {
|
|
50
|
+
channelId: channelId?.toString(),
|
|
51
|
+
role: role?.toString(),
|
|
52
|
+
limit: MESSAGES_PER_PAGE,
|
|
53
|
+
repliesLimit2: 5,
|
|
54
|
+
},
|
|
55
|
+
fetchPolicy: 'cache-and-network',
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
React.useEffect(() => {
|
|
59
|
+
// Do something when the screen is focused
|
|
60
|
+
channelDetailRefetch({ id: channelId?.toString() });
|
|
61
|
+
|
|
62
|
+
refetch({
|
|
63
|
+
channelId: channelId?.toString(),
|
|
64
|
+
role: role?.toString(),
|
|
65
|
+
limit: MESSAGES_PER_PAGE,
|
|
66
|
+
});
|
|
67
|
+
// .then(({ data }) => {
|
|
68
|
+
// if (!data?.threadMessages?.data) {
|
|
69
|
+
// return;
|
|
70
|
+
// }
|
|
71
|
+
|
|
72
|
+
// if (data?.threadMessages?.data?.length) {
|
|
73
|
+
// const { data: newThreads } = data?.threadMessages;
|
|
74
|
+
// setThreadsData((oldThreads: any) => uniqBy([...oldThreads, ...newThreads], ({ id }) => id));
|
|
75
|
+
// }
|
|
76
|
+
// });
|
|
77
|
+
return () => {};
|
|
78
|
+
}, []);
|
|
79
|
+
|
|
80
|
+
// React.useEffect(() => {
|
|
81
|
+
// if (data?.threadMessages?.data?.length) {
|
|
82
|
+
// const { data: newThreads } = data?.threadMessages;
|
|
83
|
+
// setThreadsData((oldThreads: any) => uniqBy([...oldThreads, ...newThreads], ({ id }) => id));
|
|
84
|
+
// }
|
|
85
|
+
// }, [data]);
|
|
86
|
+
|
|
87
|
+
// React.useEffect(() => {
|
|
88
|
+
// if (threadCreatedUpdated?.threadCreatedUpdated?.data) {
|
|
89
|
+
// const { data: newThreads } = threadCreatedUpdated?.threadCreatedUpdated;
|
|
90
|
+
|
|
91
|
+
// setData(newThreads);
|
|
92
|
+
// // setThreadsData((oldThreads: any) => {
|
|
93
|
+
// // const i = oldThreads.findIndex((el: any) => el.id === newThreads?.id);
|
|
94
|
+
// // if (i > -1) oldThreads[i] = newThreads; // (2)
|
|
95
|
+
// // else oldThreads.push(newThreads);
|
|
96
|
+
// // return oldThreads;
|
|
97
|
+
// // });
|
|
98
|
+
// }
|
|
99
|
+
// }, [threadCreatedUpdated]);
|
|
100
|
+
|
|
101
|
+
const setData = React.useCallback((newThreads: any) => {
|
|
102
|
+
setThreadsData((oldThreads: any) => {
|
|
103
|
+
const i = oldThreads.findIndex((el: any) => el.id === newThreads?.id);
|
|
104
|
+
if (i > -1) oldThreads[i] = newThreads; // (2)
|
|
105
|
+
else oldThreads.push(newThreads);
|
|
106
|
+
return oldThreads;
|
|
107
|
+
});
|
|
108
|
+
}, []);
|
|
109
|
+
|
|
110
|
+
const channelsDetail = React.useMemo(() => {
|
|
111
|
+
if (!channelData?.viewChannelDetail) return null;
|
|
112
|
+
return channelData?.viewChannelDetail;
|
|
113
|
+
}, [channelData]);
|
|
114
|
+
|
|
115
|
+
const threads = React.useMemo(() => {
|
|
116
|
+
if (!data?.threadMessages?.data?.length) return null;
|
|
117
|
+
const { data: newThreads } = data?.threadMessages;
|
|
118
|
+
const threadsFiltered = uniqBy([...newThreads], ({ id }) => id);
|
|
119
|
+
return orderBy(threadsFiltered, ['updatedAt'], ['desc']) || [];
|
|
120
|
+
}, [data]);
|
|
121
|
+
|
|
122
|
+
// const threads = React.useMemo(() => {
|
|
123
|
+
// if (!threadData?.length) return null;
|
|
124
|
+
// return orderBy(threadData, ['updatedAt'], ['desc']) || [];
|
|
125
|
+
// }, [threadData]);
|
|
126
|
+
|
|
127
|
+
// const handleRefresh = React.useCallback(() => {
|
|
128
|
+
// refetch({
|
|
129
|
+
// channelId: channelId?.toString(),
|
|
130
|
+
// role: role?.toString(),
|
|
131
|
+
// limit: MESSAGES_PER_PAGE,
|
|
132
|
+
// }).then(({ data }) => {
|
|
133
|
+
// if (!data?.threadMessages?.data) {
|
|
134
|
+
// return;
|
|
135
|
+
// }
|
|
136
|
+
|
|
137
|
+
// if (data?.threadMessages?.data?.length) {
|
|
138
|
+
// const { data: newThreads } = data?.threadMessages;
|
|
139
|
+
// setThreadsData((oldThreads: any) => uniqBy([...oldThreads, ...newThreads], ({ id }) => id));
|
|
140
|
+
// }
|
|
141
|
+
// });
|
|
142
|
+
// }, []);
|
|
143
|
+
|
|
144
|
+
const fetchMoreThreads = React.useCallback(() => {
|
|
145
|
+
refetch({
|
|
146
|
+
channelId: channelId?.toString(),
|
|
147
|
+
role: role?.toString(),
|
|
148
|
+
skip: threads?.length,
|
|
149
|
+
});
|
|
150
|
+
}, []);
|
|
151
|
+
|
|
152
|
+
const onMessagesScroll = React.useCallback(
|
|
153
|
+
(e) => {
|
|
154
|
+
if (threadsListRootRef.current) {
|
|
155
|
+
const { scrollTop, scrollHeight, clientHeight } = threadsListRootRef.current;
|
|
156
|
+
if (clientHeight - scrollTop > scrollHeight - 50 && !threadLoading) {
|
|
157
|
+
fetchMoreThreads();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
[fetchMoreThreads],
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
const handleSelectThread = React.useCallback(
|
|
165
|
+
(channelId: any, postId: any) => {
|
|
166
|
+
dispatch(
|
|
167
|
+
push(`${pathPrefix ? pathPrefix : ''}/${WEB_INBOX_MESSEGE_PATH}/${channelId}/${postId}?reply=true`),
|
|
168
|
+
);
|
|
169
|
+
},
|
|
170
|
+
[location, path],
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
if (threadLoading) {
|
|
174
|
+
return (
|
|
175
|
+
<div className="flex flex-col space-y-4">
|
|
176
|
+
{Array(10)
|
|
177
|
+
.fill(1)
|
|
178
|
+
.map((x, y) => (
|
|
179
|
+
<Skeleton key={y} className="h-10" />
|
|
180
|
+
))}
|
|
181
|
+
</div>
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (!threads || threads?.length == 0) {
|
|
186
|
+
return (
|
|
187
|
+
<div className="w-full bg-gray-100 h-full flex items-center justify-center">
|
|
188
|
+
<p className="text-gray-600">{t('tailwind_ui_inbox.you_dont_have_any_message_yet')}</p>
|
|
189
|
+
</div>
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return (
|
|
194
|
+
<>
|
|
195
|
+
<div
|
|
196
|
+
ref={threadsListRootRef}
|
|
197
|
+
className="flex flex-grow flex-shrink overflow-y-auto px-5 md:px-5 lg:px-5 bg-gray-100"
|
|
198
|
+
onScroll={onMessagesScroll}
|
|
199
|
+
>
|
|
200
|
+
<div className="w-full" ref={threadsListRef}>
|
|
201
|
+
<ThreadsList
|
|
202
|
+
handleSelectThread={handleSelectThread}
|
|
203
|
+
auth={auth}
|
|
204
|
+
threads={threads}
|
|
205
|
+
setData={setData}
|
|
206
|
+
role={role}
|
|
207
|
+
subscribeToNewMessages={() =>
|
|
208
|
+
subscribeToMore({
|
|
209
|
+
document: THREAD_CHAT_ADDED,
|
|
210
|
+
variables: {
|
|
211
|
+
channelId: channelId?.toString(),
|
|
212
|
+
postParentId: null,
|
|
213
|
+
},
|
|
214
|
+
updateQuery: (prev, { subscriptionData }: any) => {
|
|
215
|
+
if (!subscriptionData.data) return prev;
|
|
216
|
+
|
|
217
|
+
const newPostThreadData: any = subscriptionData?.data?.threadCreatedUpdated?.data;
|
|
218
|
+
const newMessage: any = subscriptionData?.data?.threadCreatedUpdated?.lastMessage;
|
|
219
|
+
const data = prev?.threadMessages?.data?.map((t: any) =>
|
|
220
|
+
t.id === newPostThreadData?.id
|
|
221
|
+
? {
|
|
222
|
+
...t,
|
|
223
|
+
replies: [newMessage, ...t?.replies],
|
|
224
|
+
replyCount: newPostThreadData?.replyCount,
|
|
225
|
+
lastReplyAt: newPostThreadData?.lastReplyAt,
|
|
226
|
+
updatedAt: newPostThreadData?.updatedAt,
|
|
227
|
+
}
|
|
228
|
+
: t,
|
|
229
|
+
);
|
|
230
|
+
|
|
231
|
+
return Object.assign({}, prev, {
|
|
232
|
+
threadMessages: {
|
|
233
|
+
...prev?.threadMessages,
|
|
234
|
+
// totalCount: prev?.threadMessages?.totalCount + 1,
|
|
235
|
+
data: data,
|
|
236
|
+
},
|
|
237
|
+
});
|
|
238
|
+
},
|
|
239
|
+
})
|
|
240
|
+
}
|
|
241
|
+
/>
|
|
242
|
+
</div>
|
|
243
|
+
</div>
|
|
244
|
+
</>
|
|
245
|
+
);
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
const ThreadsList = React.memo(({ threads, handleSelectThread, auth, setData, role, subscribeToNewMessages }: any) => {
|
|
249
|
+
React.useEffect(() => subscribeToNewMessages(), []);
|
|
250
|
+
return (
|
|
251
|
+
<>
|
|
252
|
+
{threads?.length > 0 &&
|
|
253
|
+
threads?.map((thread: any, index: any) => {
|
|
254
|
+
return (
|
|
255
|
+
<div key={'thread-key-' + index}>
|
|
256
|
+
<ThreadItem
|
|
257
|
+
onOpen={handleSelectThread}
|
|
258
|
+
currentUser={auth}
|
|
259
|
+
thread={thread}
|
|
260
|
+
setData={setData}
|
|
261
|
+
role={role}
|
|
262
|
+
/>
|
|
263
|
+
</div>
|
|
264
|
+
);
|
|
265
|
+
})}
|
|
266
|
+
</>
|
|
267
|
+
);
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
export default React.memo(Threads);
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { format, isToday, isYesterday } from 'date-fns';
|
|
3
|
+
import { orderBy, uniqBy, startCase } from 'lodash-es';
|
|
4
|
+
import { OnThreadCreatedUpdatedDocument as THREAD_CHAT_ADDED, useThreadMessagesQuery } from 'common/graphql';
|
|
5
|
+
import { useSelector } from 'react-redux';
|
|
6
|
+
import { useTranslation } from 'react-i18next';
|
|
7
|
+
import { userSelector } from '@adminide-stack/user-auth0-client';
|
|
8
|
+
import { config } from '../config';
|
|
9
|
+
|
|
10
|
+
const { MESSAGES_PER_PAGE, WEB_INBOX_MESSEGE_PATH } = config;
|
|
11
|
+
|
|
12
|
+
export interface ThreadsInboxProps {
|
|
13
|
+
channelId: any;
|
|
14
|
+
role?: string;
|
|
15
|
+
pathPrefix?: string;
|
|
16
|
+
setChannelId?: (channelId: any) => void;
|
|
17
|
+
setPostId?: (postId?: any) => void;
|
|
18
|
+
setGoBack?: (goBack: boolean) => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface IThreadItemProps {
|
|
22
|
+
thread: any;
|
|
23
|
+
onOpen: (channelId: any, postId: any) => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface IThreadListProps {
|
|
27
|
+
threads: any;
|
|
28
|
+
handleSelectThread: (channelId: any, postId: any) => void;
|
|
29
|
+
threadsListRef: any;
|
|
30
|
+
subscribeToNewThreads: () => void;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Skeleton component replacement
|
|
34
|
+
const SkeletonLoader = () => (
|
|
35
|
+
<div className="animate-pulse">
|
|
36
|
+
<div className="h-10 bg-gray-200 rounded"></div>
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
export const ThreadsInbox = React.memo(
|
|
41
|
+
({ channelId, role, setChannelId, setPostId, setGoBack, pathPrefix = null }: ThreadsInboxProps) => {
|
|
42
|
+
const threadsListRootRef = React.useRef(null);
|
|
43
|
+
const threadsListRef = React.useRef(null);
|
|
44
|
+
const auth = useSelector(userSelector);
|
|
45
|
+
const { t } = useTranslation('translations');
|
|
46
|
+
const {
|
|
47
|
+
data,
|
|
48
|
+
loading: threadLoading,
|
|
49
|
+
error,
|
|
50
|
+
refetch,
|
|
51
|
+
subscribeToMore,
|
|
52
|
+
} = useThreadMessagesQuery({
|
|
53
|
+
variables: {
|
|
54
|
+
channelId: channelId?.toString(),
|
|
55
|
+
role: role?.toString(),
|
|
56
|
+
limit: MESSAGES_PER_PAGE,
|
|
57
|
+
repliesLimit2: 5,
|
|
58
|
+
},
|
|
59
|
+
fetchPolicy: 'cache-and-network',
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (channelId) {
|
|
64
|
+
setGoBack?.(false);
|
|
65
|
+
refetch({
|
|
66
|
+
channelId: channelId?.toString(),
|
|
67
|
+
role: role?.toString(),
|
|
68
|
+
limit: MESSAGES_PER_PAGE,
|
|
69
|
+
repliesLimit2: 5,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}, [channelId]);
|
|
73
|
+
|
|
74
|
+
const threads = React.useMemo(() => {
|
|
75
|
+
if (!data?.threadMessages?.data?.length) return null;
|
|
76
|
+
const { data: newThreads } = data?.threadMessages;
|
|
77
|
+
const threadsFiltered = uniqBy([...newThreads], ({ id }) => id);
|
|
78
|
+
return orderBy(threadsFiltered, ['updatedAt'], ['desc']) || [];
|
|
79
|
+
}, [data?.threadMessages]);
|
|
80
|
+
|
|
81
|
+
const fetchMoreThreads = React.useCallback(() => {
|
|
82
|
+
refetch({
|
|
83
|
+
channelId: channelId?.toString(),
|
|
84
|
+
role: role?.toString(),
|
|
85
|
+
skip: threads?.length,
|
|
86
|
+
repliesLimit2: 5,
|
|
87
|
+
});
|
|
88
|
+
}, []);
|
|
89
|
+
|
|
90
|
+
const onMessagesScroll = React.useCallback(
|
|
91
|
+
(e) => {
|
|
92
|
+
if (threadsListRootRef.current) {
|
|
93
|
+
const { scrollTop, scrollHeight, clientHeight } = threadsListRootRef.current;
|
|
94
|
+
if (clientHeight - scrollTop > scrollHeight - 50 && !threadLoading) {
|
|
95
|
+
fetchMoreThreads();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
[fetchMoreThreads],
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
const handleSelectThread = React.useCallback((channelId: any, postId: any) => {
|
|
103
|
+
setChannelId?.(channelId);
|
|
104
|
+
setPostId?.(postId);
|
|
105
|
+
setGoBack?.(true);
|
|
106
|
+
}, []);
|
|
107
|
+
|
|
108
|
+
if (threadLoading) {
|
|
109
|
+
return (
|
|
110
|
+
<div className="space-y-4">
|
|
111
|
+
{Array(10)
|
|
112
|
+
.fill(1)
|
|
113
|
+
.map((_x, _y) => (
|
|
114
|
+
<SkeletonLoader key={_y} />
|
|
115
|
+
))}
|
|
116
|
+
</div>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (!threads || threads?.length == 0) {
|
|
121
|
+
return (
|
|
122
|
+
<div className="w-full bg-gray-100 h-full flex items-center justify-center">
|
|
123
|
+
<span className="text-gray-500">{t('tailwind_ui_inbox.you_dont_have_any_message_yet')}</span>
|
|
124
|
+
</div>
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return (
|
|
129
|
+
<div
|
|
130
|
+
ref={threadsListRootRef}
|
|
131
|
+
className="flex flex-grow flex-shrink overflow-y-auto px-5 bg-gray-100"
|
|
132
|
+
onScroll={onMessagesScroll}
|
|
133
|
+
>
|
|
134
|
+
<ThreadsList
|
|
135
|
+
threads={threads}
|
|
136
|
+
handleSelectThread={handleSelectThread}
|
|
137
|
+
threadsListRef={threadsListRef}
|
|
138
|
+
subscribeToNewThreads={() =>
|
|
139
|
+
subscribeToMore({
|
|
140
|
+
document: THREAD_CHAT_ADDED,
|
|
141
|
+
variables: {
|
|
142
|
+
channelId: channelId?.toString(),
|
|
143
|
+
postParentId: null,
|
|
144
|
+
},
|
|
145
|
+
updateQuery: (prev, { subscriptionData }: any) => {
|
|
146
|
+
if (!subscriptionData.data) return prev;
|
|
147
|
+
|
|
148
|
+
const newPostThreadData: any = subscriptionData?.data?.threadCreatedUpdated?.data;
|
|
149
|
+
const newMessage: any = subscriptionData?.data?.threadCreatedUpdated?.lastMessage;
|
|
150
|
+
|
|
151
|
+
const updatedData =
|
|
152
|
+
prev?.threadMessages?.data?.map((t: any) =>
|
|
153
|
+
t.id === newPostThreadData?.id
|
|
154
|
+
? {
|
|
155
|
+
...t,
|
|
156
|
+
replies: [...t?.replies, newMessage],
|
|
157
|
+
replyCount: newPostThreadData?.replyCount,
|
|
158
|
+
lastReplyAt: newPostThreadData?.lastReplyAt,
|
|
159
|
+
updatedAt: newPostThreadData?.updatedAt,
|
|
160
|
+
}
|
|
161
|
+
: t,
|
|
162
|
+
) ?? [];
|
|
163
|
+
|
|
164
|
+
const threadsData = updatedData?.length
|
|
165
|
+
? orderBy(updatedData, ['updatedAt'], ['desc'])
|
|
166
|
+
: [];
|
|
167
|
+
|
|
168
|
+
return Object.assign({}, prev, {
|
|
169
|
+
threadMessages: {
|
|
170
|
+
...prev?.threadMessages,
|
|
171
|
+
totalCount: newPostThreadData?.totalCount ?? 0,
|
|
172
|
+
data: threadsData?.length > 0 ? threadsData : [newPostThreadData],
|
|
173
|
+
},
|
|
174
|
+
});
|
|
175
|
+
},
|
|
176
|
+
})
|
|
177
|
+
}
|
|
178
|
+
/>
|
|
179
|
+
</div>
|
|
180
|
+
);
|
|
181
|
+
},
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
const ThreadsList = React.memo(
|
|
185
|
+
({ threads, handleSelectThread, threadsListRef, subscribeToNewThreads }: IThreadListProps) => {
|
|
186
|
+
React.useEffect(() => subscribeToNewThreads(), []);
|
|
187
|
+
return (
|
|
188
|
+
<div className="w-full" ref={threadsListRef}>
|
|
189
|
+
{threads?.length > 0 &&
|
|
190
|
+
threads?.map((thread: any, index: any) => {
|
|
191
|
+
return (
|
|
192
|
+
<div key={'thread-key-' + index}>
|
|
193
|
+
<ThreadItem onOpen={handleSelectThread} thread={thread} />
|
|
194
|
+
</div>
|
|
195
|
+
);
|
|
196
|
+
})}
|
|
197
|
+
</div>
|
|
198
|
+
);
|
|
199
|
+
},
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
const ThreadItem = React.memo(({ thread, onOpen }: IThreadItemProps) => {
|
|
203
|
+
const { t } = useTranslation('translations');
|
|
204
|
+
const threadPostReply = React.useMemo(() => {
|
|
205
|
+
if (!thread?.replies) return null;
|
|
206
|
+
return orderBy(thread?.replies, ['updatedAt'], ['desc']) || [];
|
|
207
|
+
}, [thread]);
|
|
208
|
+
|
|
209
|
+
const createdAtText = (value: string) => {
|
|
210
|
+
if (!value) return '';
|
|
211
|
+
let date = new Date(value);
|
|
212
|
+
if (isToday(date)) return t('tailwind_ui_inbox.today');
|
|
213
|
+
if (isYesterday(date)) return t('tailwind_ui_inbox.yesterday');
|
|
214
|
+
return format(new Date(value), 'MMM dd, yyyy');
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
return (
|
|
218
|
+
<div className="flex-1 py-2 my-2 space-y-4">
|
|
219
|
+
<div className="flex space-x-6">
|
|
220
|
+
<div className="w-full">
|
|
221
|
+
<div className="flex flex-col items-start pt-5 pb-5 pl-5 pr-2 space-y-5 bg-white rounded-md shadow-sm p-6">
|
|
222
|
+
{!threadPostReply ||
|
|
223
|
+
((threadPostReply?.length == 0 || threadPostReply?.length == 1) && (
|
|
224
|
+
<div className="flex w-full items-start space-x-4">
|
|
225
|
+
<div>
|
|
226
|
+
<img
|
|
227
|
+
className="w-9 h-9 object-cover rounded"
|
|
228
|
+
src={thread?.post?.author?.picture}
|
|
229
|
+
alt={startCase(thread?.post?.author?.username?.charAt(0))}
|
|
230
|
+
/>
|
|
231
|
+
</div>
|
|
232
|
+
<div className="leading-3">
|
|
233
|
+
<div className="flex flex-col flex-1 items-start space-y-3">
|
|
234
|
+
<div className="flex space-x-2">
|
|
235
|
+
<span className="text-lg text-gray-900 font-semibold flex-wrap">
|
|
236
|
+
{thread?.post?.author?.givenName ?? ''}{' '}
|
|
237
|
+
{thread?.post?.author?.familyName ?? ''}
|
|
238
|
+
</span>
|
|
239
|
+
<span className="text-sm text-gray-500 font-semibold flex-wrap">
|
|
240
|
+
{thread?.post ? createdAtText(thread?.post?.createdAt) : ''}
|
|
241
|
+
</span>
|
|
242
|
+
</div>
|
|
243
|
+
<div className="space-y-2">
|
|
244
|
+
<p className="text-sm text-gray-500 font-semibold flex-wrap">
|
|
245
|
+
{thread?.post?.message
|
|
246
|
+
? thread?.post?.message.length < 70
|
|
247
|
+
? `${thread?.post?.message}`
|
|
248
|
+
: `${thread?.post?.message.substring(0, 68)}....`
|
|
249
|
+
: ''}
|
|
250
|
+
</p>
|
|
251
|
+
|
|
252
|
+
{thread?.post?.files?.data?.length > 0 &&
|
|
253
|
+
thread?.post?.files?.data?.map((f: any, idx: number) => (
|
|
254
|
+
<div key={idx}>
|
|
255
|
+
<img
|
|
256
|
+
className="w-12 h-12 object-cover"
|
|
257
|
+
src={f?.url}
|
|
258
|
+
alt={'Image'}
|
|
259
|
+
/>
|
|
260
|
+
</div>
|
|
261
|
+
))}
|
|
262
|
+
</div>
|
|
263
|
+
{threadPostReply?.length == 0 && (
|
|
264
|
+
<button
|
|
265
|
+
onClick={() =>
|
|
266
|
+
onOpen(
|
|
267
|
+
thread?.channel?.id?.toString(),
|
|
268
|
+
thread?.post?.id?.toString(),
|
|
269
|
+
)
|
|
270
|
+
}
|
|
271
|
+
className="py-2 px-4 border border-gray-300 text-gray-700 bg-white hover:bg-gray-50 rounded-md text-sm font-medium w-37 focus:outline-none focus:ring-2 focus:ring-gray-500"
|
|
272
|
+
>
|
|
273
|
+
Reply
|
|
274
|
+
</button>
|
|
275
|
+
)}
|
|
276
|
+
</div>
|
|
277
|
+
</div>
|
|
278
|
+
</div>
|
|
279
|
+
))}
|
|
280
|
+
|
|
281
|
+
{threadPostReply?.length > 0 && (
|
|
282
|
+
<>
|
|
283
|
+
{threadPostReply
|
|
284
|
+
?.slice(0, 2)
|
|
285
|
+
?.reverse()
|
|
286
|
+
?.map((reply: any, index: any) => (
|
|
287
|
+
<div
|
|
288
|
+
key={'thread-post-reply-item-' + index}
|
|
289
|
+
className="flex w-full items-start space-x-4"
|
|
290
|
+
>
|
|
291
|
+
<div>
|
|
292
|
+
<img
|
|
293
|
+
className="w-9 h-9 object-cover rounded"
|
|
294
|
+
src={reply?.author?.picture}
|
|
295
|
+
alt={startCase(reply?.author?.username?.charAt(0))}
|
|
296
|
+
/>
|
|
297
|
+
</div>
|
|
298
|
+
|
|
299
|
+
<div className="leading-3">
|
|
300
|
+
<div className="flex flex-col flex-1 items-start space-y-3">
|
|
301
|
+
<div className="flex space-x-2">
|
|
302
|
+
<span className="text-lg text-gray-900 font-semibold flex-wrap">
|
|
303
|
+
{reply?.author?.givenName ?? ''}{' '}
|
|
304
|
+
{reply?.author?.familyName ?? ''}
|
|
305
|
+
</span>
|
|
306
|
+
<span className="text-sm text-gray-500 font-semibold flex-wrap">
|
|
307
|
+
{reply?.createdAt ? createdAtText(reply?.createdAt) : ''}
|
|
308
|
+
</span>
|
|
309
|
+
</div>
|
|
310
|
+
<div className="space-y-2">
|
|
311
|
+
<p className="text-sm text-gray-500 font-semibold flex-wrap">
|
|
312
|
+
{reply?.message
|
|
313
|
+
? reply?.message.length < 70
|
|
314
|
+
? `${reply?.message}`
|
|
315
|
+
: `${reply?.message.substring(0, 68)}....`
|
|
316
|
+
: ''}
|
|
317
|
+
</p>
|
|
318
|
+
|
|
319
|
+
{reply?.files?.data?.length > 0 &&
|
|
320
|
+
reply?.files?.data?.map((f: any, idx: number) => (
|
|
321
|
+
<div key={idx}>
|
|
322
|
+
<img
|
|
323
|
+
className="w-12 h-12 object-cover"
|
|
324
|
+
src={f?.url}
|
|
325
|
+
alt={'Image'}
|
|
326
|
+
/>
|
|
327
|
+
</div>
|
|
328
|
+
))}
|
|
329
|
+
</div>
|
|
330
|
+
{(threadPostReply?.length == 1 || index !== 0) && (
|
|
331
|
+
<button
|
|
332
|
+
onClick={() =>
|
|
333
|
+
onOpen(
|
|
334
|
+
thread?.channel?.id?.toString(),
|
|
335
|
+
thread?.post?.id?.toString(),
|
|
336
|
+
)
|
|
337
|
+
}
|
|
338
|
+
className="py-2 px-4 border border-gray-300 text-gray-700 bg-white hover:bg-gray-50 rounded-md text-sm font-medium w-37 focus:outline-none focus:ring-2 focus:ring-gray-500"
|
|
339
|
+
>
|
|
340
|
+
Reply
|
|
341
|
+
</button>
|
|
342
|
+
)}
|
|
343
|
+
</div>
|
|
344
|
+
</div>
|
|
345
|
+
</div>
|
|
346
|
+
))}
|
|
347
|
+
</>
|
|
348
|
+
)}
|
|
349
|
+
</div>
|
|
350
|
+
</div>
|
|
351
|
+
</div>
|
|
352
|
+
</div>
|
|
353
|
+
);
|
|
354
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const applyFooterStyles = () => {
|
|
2
|
+
const footerElement: any = document.querySelector('#nav-footer');
|
|
3
|
+
if (footerElement) {
|
|
4
|
+
footerElement.style.display = 'none';
|
|
5
|
+
}
|
|
6
|
+
const nkqmc7: any = document.querySelector('.css-nkqmc7'); // temp, check paddingBottom needed
|
|
7
|
+
if (nkqmc7) {
|
|
8
|
+
nkqmc7.style.paddingBottom = '0px';
|
|
9
|
+
nkqmc7.style.minHeight = '0px';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return () => {
|
|
13
|
+
if (footerElement?.style) {
|
|
14
|
+
footerElement.style.display = 'block';
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import Inbox from './Inbox';
|
|
2
|
+
import InboxWithLoader from './InboxWithLoader';
|
|
3
|
+
import Threads from './Threads';
|
|
4
|
+
import ThreadMessages from './ThreadMessages';
|
|
5
|
+
import ServiceInbox from './ServiceInbox';
|
|
6
|
+
import { ThreadsInbox } from './ThreadsInbox';
|
|
7
|
+
import { ThreadMessagesInbox } from './ThreadMessagesInbox';
|
|
8
|
+
////import AiInboxWithLoader from './AiInboxWithLoader';
|
|
9
|
+
//import AiInbox from './AiInbox';
|
|
10
|
+
//import InboxTemplate1 from './InboxTemplate1';
|
|
11
|
+
import InboxWithAiLoader from './InboxWithAiLoader';
|
|
12
|
+
import InboxAiMessagesLoader from './InboxAiMessagesLoader';
|
|
13
|
+
import InboxContainer from './InboxContainer';
|
|
14
|
+
import AiLandingInput from './AiLandingInput';
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
Inbox,
|
|
18
|
+
ThreadsInbox,
|
|
19
|
+
ThreadMessagesInbox,
|
|
20
|
+
Threads,
|
|
21
|
+
ThreadMessages,
|
|
22
|
+
ServiceInbox,
|
|
23
|
+
InboxWithLoader,
|
|
24
|
+
// AiInboxWithLoader,
|
|
25
|
+
// AiInbox,
|
|
26
|
+
// InboxTemplate1,
|
|
27
|
+
InboxWithAiLoader,
|
|
28
|
+
InboxAiMessagesLoader,
|
|
29
|
+
InboxContainer,
|
|
30
|
+
AiLandingInput,
|
|
31
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MessengerSlotFillNameEnum } from './messenger-slot-fill-name-enum';
|