@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,371 @@
|
|
|
1
|
+
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { MessageInput, Messages } from '../components';
|
|
3
|
+
import { BiChevronLeftSquare } from '@react-icons/all-files/bi/BiChevronLeftSquare.js';
|
|
4
|
+
import { IFileInfo, IPostThread } from 'common';
|
|
5
|
+
import {
|
|
6
|
+
OnThreadChatMessageAddedDocument as CHAT_MESSAGE_ADDED,
|
|
7
|
+
useCreatePostThreadMutation,
|
|
8
|
+
useThreadMessagesLazyQuery,
|
|
9
|
+
useGetPostThreadLazyQuery,
|
|
10
|
+
useViewChannelDetailQuery,
|
|
11
|
+
} from 'common/graphql';
|
|
12
|
+
import { useUploadFiles } from '@messenger-box/platform-client';
|
|
13
|
+
import { config } from '../config';
|
|
14
|
+
import { orderBy, uniqBy } from 'lodash-es';
|
|
15
|
+
import { useDispatch, useSelector } from 'react-redux';
|
|
16
|
+
import { userSelector } from '@adminide-stack/user-auth0-client';
|
|
17
|
+
import { useNavigate } from '@remix-run/react';
|
|
18
|
+
import { objectId } from '@messenger-box/core';
|
|
19
|
+
|
|
20
|
+
const { MESSAGES_PER_PAGE, WEB_INBOX_MESSEGE_PATH } = config;
|
|
21
|
+
|
|
22
|
+
interface ThreadMessagesProps {
|
|
23
|
+
channelId: any;
|
|
24
|
+
postParentId: any;
|
|
25
|
+
isPostParentIdThread?: any;
|
|
26
|
+
role: string;
|
|
27
|
+
goBack?: boolean;
|
|
28
|
+
pathPrefix?: string;
|
|
29
|
+
setPostId?: (id: any) => void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Custom Skeleton component using Tailwind
|
|
33
|
+
const Skeleton = ({ height = '40px' }: { height?: string }) => (
|
|
34
|
+
<div className="animate-pulse bg-gray-200 rounded" style={{ height }} />
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const ThreadMessages = ({
|
|
38
|
+
channelId,
|
|
39
|
+
postParentId,
|
|
40
|
+
role,
|
|
41
|
+
isPostParentIdThread,
|
|
42
|
+
goBack = false,
|
|
43
|
+
pathPrefix,
|
|
44
|
+
setPostId,
|
|
45
|
+
}: ThreadMessagesProps) => {
|
|
46
|
+
const navigate = useNavigate();
|
|
47
|
+
const currentUser: any = useSelector(userSelector);
|
|
48
|
+
const [parentId, setParentId] = React.useState<any>(postParentId);
|
|
49
|
+
const [channelMessages, setChannelMessages] = React.useState<any>([]);
|
|
50
|
+
const [totalCount, setTotalCount] = React.useState<any>(0);
|
|
51
|
+
const [loadingOldMessages, setLoadingOldMessages] = React.useState<boolean>(false);
|
|
52
|
+
const [loading, setLoading] = React.useState<boolean>(true);
|
|
53
|
+
const dispatch = useDispatch();
|
|
54
|
+
const threadMessageRootRef = React.useRef(null);
|
|
55
|
+
const threadMessageListRef = React.useRef(null);
|
|
56
|
+
const [postThread, setPostThread] = useState<IPostThread>();
|
|
57
|
+
const messageListRef = useRef(null);
|
|
58
|
+
const [channelToTop, setChannelToTop] = React.useState(0);
|
|
59
|
+
const [isScrollToBottom, setIsScrollToBottom] = useState(false);
|
|
60
|
+
const { startUpload } = useUploadFiles();
|
|
61
|
+
const { refetch: refetchChannel } = useViewChannelDetailQuery({
|
|
62
|
+
variables: {
|
|
63
|
+
id: channelId?.toString(),
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
const [sendThreadMessage] = useCreatePostThreadMutation();
|
|
67
|
+
const [
|
|
68
|
+
getThreadMessages,
|
|
69
|
+
{ data, loading: threadLoading, fetchMore: fetchMoreMessages, refetch: refetchThreadMessages, subscribeToMore },
|
|
70
|
+
] = useGetPostThreadLazyQuery({ fetchPolicy: 'cache-and-network' });
|
|
71
|
+
|
|
72
|
+
const [selectedPost, setSelectedPost] = useState(null);
|
|
73
|
+
|
|
74
|
+
const onMessageClick = (msg) => {
|
|
75
|
+
setSelectedPost(msg);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
React.useEffect(() => {
|
|
79
|
+
refetchChannel({ id: channelId?.toString() });
|
|
80
|
+
if (postParentId) {
|
|
81
|
+
refetchThreadMessages({
|
|
82
|
+
channelId: channelId?.toString(),
|
|
83
|
+
role: role?.toString(),
|
|
84
|
+
postParentId: postParentId?.toString(),
|
|
85
|
+
selectedFields: 'id channel post replies replyCount lastReplyAt createdAt updatedAt',
|
|
86
|
+
limit: MESSAGES_PER_PAGE,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
setParentId(postParentId);
|
|
90
|
+
}, [postParentId]);
|
|
91
|
+
|
|
92
|
+
React.useEffect(() => {
|
|
93
|
+
// if (parentId && parentId == 0) {
|
|
94
|
+
setLoading(false);
|
|
95
|
+
if (channelId && parentId) {
|
|
96
|
+
getThreadMessages({
|
|
97
|
+
variables: {
|
|
98
|
+
channelId: channelId?.toString(),
|
|
99
|
+
role: role?.toString(),
|
|
100
|
+
postParentId: !parentId || parentId == 0 ? null : parentId?.toString(),
|
|
101
|
+
selectedFields: 'id channel post replies replyCount lastReplyAt createdAt updatedAt',
|
|
102
|
+
limit: MESSAGES_PER_PAGE,
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}, [channelId, parentId]);
|
|
107
|
+
|
|
108
|
+
React.useEffect(() => {
|
|
109
|
+
if (data?.getPostThread) {
|
|
110
|
+
const threads: any = data.getPostThread;
|
|
111
|
+
const threadPost = threads?.post ?? [];
|
|
112
|
+
const threadReplies = threads?.replies ?? [];
|
|
113
|
+
const messeageTotalCount = threads?.replyCount ?? 0;
|
|
114
|
+
const messages = [threadPost, ...threadReplies];
|
|
115
|
+
if (
|
|
116
|
+
(messages && messages.length > 0 && messeageTotalCount > totalCount) ||
|
|
117
|
+
(messages && messages.length > 0 && channelMessages.length === 0)
|
|
118
|
+
) {
|
|
119
|
+
setThreadMessages(messages, messeageTotalCount);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (isScrollToBottom && channelMessages) scrollToBottom();
|
|
123
|
+
}, [data, channelMessages, loadingOldMessages, totalCount, isPostParentIdThread, isScrollToBottom]);
|
|
124
|
+
|
|
125
|
+
const setThreadMessages = (messages: any, messagesTotalCount: number) => {
|
|
126
|
+
setChannelMessages((oldMessages: any) => uniqBy([...messages, ...oldMessages], ({ id }) => id));
|
|
127
|
+
setTotalCount(messagesTotalCount);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const sortedMessages = useMemo(
|
|
131
|
+
() => channelMessages && orderBy(channelMessages, ['createdAt'], ['asc']),
|
|
132
|
+
[channelMessages],
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
const scrollToBottom = React.useCallback(() => {
|
|
136
|
+
if (threadMessageListRef?.current) {
|
|
137
|
+
setIsScrollToBottom(false);
|
|
138
|
+
threadMessageListRef.current.scrollTop = threadMessageListRef.current.scrollHeight;
|
|
139
|
+
}
|
|
140
|
+
}, [threadMessageListRef]);
|
|
141
|
+
|
|
142
|
+
const handleSend = useCallback(
|
|
143
|
+
async (message: string, files: []) => {
|
|
144
|
+
if (!(message && channelId)) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const postId = objectId();
|
|
148
|
+
|
|
149
|
+
if (files && files?.length > 0) {
|
|
150
|
+
const uploadResponse = await startUpload({
|
|
151
|
+
file: files,
|
|
152
|
+
saveUploadedFile: {
|
|
153
|
+
variables: {
|
|
154
|
+
postId,
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
createUploadLink: {
|
|
158
|
+
variables: {
|
|
159
|
+
postId,
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
if (uploadResponse?.error) setLoading(false);
|
|
164
|
+
const uploadedFiles = uploadResponse.data as unknown as IFileInfo[];
|
|
165
|
+
if (uploadResponse.data) {
|
|
166
|
+
const files = uploadedFiles?.map((f: any) => f.id) ?? null;
|
|
167
|
+
await sendThreadMessage({
|
|
168
|
+
variables: {
|
|
169
|
+
postId,
|
|
170
|
+
channelId,
|
|
171
|
+
postThreadId: postThread && postThread?.id,
|
|
172
|
+
postParentId: !parentId || parentId == 0 ? null : parentId,
|
|
173
|
+
threadMessageInput: {
|
|
174
|
+
content: message,
|
|
175
|
+
files,
|
|
176
|
+
role,
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
update: (cache, { data, errors }) => {
|
|
180
|
+
if (!data || errors) {
|
|
181
|
+
setLoading(false);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const responseMessage = data?.createPostThread?.lastMessage;
|
|
185
|
+
setPostThread(data?.createPostThread?.data);
|
|
186
|
+
if (!parentId || parentId == 0) {
|
|
187
|
+
setParentId(data?.createPostThread?.lastMessage?.id);
|
|
188
|
+
setPostId(data?.createPostThread?.lastMessage?.id);
|
|
189
|
+
// dispatch(
|
|
190
|
+
// push(
|
|
191
|
+
// `${pathPrefix ? pathPrefix : ''}/${WEB_INBOX_MESSEGE_PATH}/${channelId}/${
|
|
192
|
+
// data?.createPostThread?.lastMessage?.id
|
|
193
|
+
// }`,
|
|
194
|
+
// ),
|
|
195
|
+
// );
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
setChannelToTop(channelToTop + 1);
|
|
199
|
+
setLoading(false);
|
|
200
|
+
|
|
201
|
+
// scrollToBottom();
|
|
202
|
+
},
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
} else {
|
|
206
|
+
await sendThreadMessage({
|
|
207
|
+
variables: {
|
|
208
|
+
channelId,
|
|
209
|
+
postParentId: !parentId || parentId == 0 ? null : parentId,
|
|
210
|
+
postThreadId: postThread && postThread?.id,
|
|
211
|
+
threadMessageInput: {
|
|
212
|
+
content: message,
|
|
213
|
+
role,
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
update: (cache, { data, errors }) => {
|
|
217
|
+
if (!data || errors) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
setPostThread(data?.createPostThread.data);
|
|
221
|
+
if (!parentId || parentId == 0) {
|
|
222
|
+
setParentId(data?.createPostThread?.lastMessage?.id);
|
|
223
|
+
setPostId(data?.createPostThread?.lastMessage?.id);
|
|
224
|
+
// dispatch(
|
|
225
|
+
// push(
|
|
226
|
+
// `${pathPrefix ? pathPrefix : ''}/${WEB_INBOX_MESSEGE_PATH}/${channelId}/${
|
|
227
|
+
// data?.createPostThread?.lastMessage?.id
|
|
228
|
+
// }`,
|
|
229
|
+
// ),
|
|
230
|
+
// );
|
|
231
|
+
}
|
|
232
|
+
setChannelToTop(channelToTop + 1);
|
|
233
|
+
//scrollToBottom();
|
|
234
|
+
},
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
[setChannelMessages, channelId, parentId, channelToTop, postThread],
|
|
239
|
+
);
|
|
240
|
+
|
|
241
|
+
const onFetchOld = useCallback(
|
|
242
|
+
async (skip: number) => {
|
|
243
|
+
if (channelId && parentId) {
|
|
244
|
+
setLoadingOldMessages(true);
|
|
245
|
+
fetchMoreMessages({
|
|
246
|
+
variables: {
|
|
247
|
+
channelId: channelId?.toString(),
|
|
248
|
+
role: role?.toString(),
|
|
249
|
+
postParentId: parentId?.toString(),
|
|
250
|
+
selectedFields: 'id channel post replies replyCount lastReplyAt createdAt updatedAt',
|
|
251
|
+
limit: MESSAGES_PER_PAGE,
|
|
252
|
+
skip: skip - 1,
|
|
253
|
+
},
|
|
254
|
+
})
|
|
255
|
+
.then((res: any) => {
|
|
256
|
+
if (res?.data?.getPostThread) {
|
|
257
|
+
const threads: any = res?.data?.getPostThread;
|
|
258
|
+
const threadReplies = threads?.replies ?? [];
|
|
259
|
+
const messeageTotalCount = threads?.replyCount ?? 0;
|
|
260
|
+
setThreadMessages(threadReplies, messeageTotalCount);
|
|
261
|
+
if (threadMessageRootRef?.current) {
|
|
262
|
+
threadMessageRootRef.current.scrollTop =
|
|
263
|
+
threadMessageRootRef.current.scrollTop +
|
|
264
|
+
threadMessageRootRef.current.clientHeight / 2;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
})
|
|
268
|
+
.finally(() => {
|
|
269
|
+
setLoadingOldMessages(false);
|
|
270
|
+
})
|
|
271
|
+
.catch((error: any) => {
|
|
272
|
+
setLoadingOldMessages(false);
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
[parentId, channelId, threadMessageRootRef, channelMessages],
|
|
277
|
+
);
|
|
278
|
+
|
|
279
|
+
const onMessagesScroll = useCallback(
|
|
280
|
+
async (e) => {
|
|
281
|
+
if (threadMessageRootRef.current) {
|
|
282
|
+
const {
|
|
283
|
+
clientHeight: messageContainerClientHeight,
|
|
284
|
+
scrollHeight: messageContainerScrollHeight,
|
|
285
|
+
scrollTop: messageContainerScrollTop,
|
|
286
|
+
offsetTop: messageContainerOffsetTop,
|
|
287
|
+
} = threadMessageRootRef?.current;
|
|
288
|
+
if (
|
|
289
|
+
messageContainerClientHeight - messageContainerScrollTop == messageContainerScrollHeight &&
|
|
290
|
+
!loadingOldMessages &&
|
|
291
|
+
totalCount > channelMessages.length
|
|
292
|
+
) {
|
|
293
|
+
await onFetchOld(channelMessages?.length);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
[threadMessageRootRef, loadingOldMessages, channelMessages, totalCount],
|
|
298
|
+
);
|
|
299
|
+
|
|
300
|
+
const handleGoBack = useCallback(() => {
|
|
301
|
+
if (channelId) navigate(`${pathPrefix ? pathPrefix : ''}/${WEB_INBOX_MESSEGE_PATH}/${channelId}/1`);
|
|
302
|
+
}, [channelId]);
|
|
303
|
+
|
|
304
|
+
if ((loading || loadingOldMessages) && !parentId) {
|
|
305
|
+
return (
|
|
306
|
+
<div className="flex flex-col space-y-4">
|
|
307
|
+
{Array(10)
|
|
308
|
+
.fill(1)
|
|
309
|
+
.map((x, y) => (
|
|
310
|
+
<Skeleton height="40px" key={y} />
|
|
311
|
+
))}
|
|
312
|
+
</div>
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
return (
|
|
317
|
+
<>
|
|
318
|
+
{goBack && (
|
|
319
|
+
<button
|
|
320
|
+
className="absolute z-10 m-1.5 w-10 bg-transparent text-gray-400 hover:text-gray-300 focus:outline-none focus:ring-0 transition-colors duration-200"
|
|
321
|
+
onClick={() => navigate(-1)}
|
|
322
|
+
>
|
|
323
|
+
<BiChevronLeftSquare className="text-3xl" />
|
|
324
|
+
</button>
|
|
325
|
+
)}
|
|
326
|
+
|
|
327
|
+
<div
|
|
328
|
+
ref={threadMessageRootRef}
|
|
329
|
+
className="flex flex-col-reverse overflow-y-auto flex-grow flex-shrink p-4 px-2.5 md:px-12 lg:px-20"
|
|
330
|
+
onScroll={onMessagesScroll}
|
|
331
|
+
>
|
|
332
|
+
<Messages
|
|
333
|
+
innerRef={messageListRef}
|
|
334
|
+
channelId={channelId}
|
|
335
|
+
currentUser={currentUser}
|
|
336
|
+
channelMessages={sortedMessages}
|
|
337
|
+
totalCount={totalCount}
|
|
338
|
+
onMessageClick={onMessageClick}
|
|
339
|
+
subscribeToNewMessages={() =>
|
|
340
|
+
subscribeToMore({
|
|
341
|
+
document: CHAT_MESSAGE_ADDED,
|
|
342
|
+
variables: {
|
|
343
|
+
channelId: channelId?.toString(),
|
|
344
|
+
postParentId: !parentId || parentId == 0 ? null : parentId?.toString(),
|
|
345
|
+
},
|
|
346
|
+
updateQuery: (prev, { subscriptionData }: any) => {
|
|
347
|
+
if (!subscriptionData.data) return prev;
|
|
348
|
+
const newMessage: any = subscriptionData?.data?.threadChatMessageAdded;
|
|
349
|
+
const prevReplyCount = prev?.getPostThread?.replyCount;
|
|
350
|
+
const newReplyCount = prevReplyCount + 1;
|
|
351
|
+
|
|
352
|
+
return Object.assign({}, prev, {
|
|
353
|
+
getPostThread: {
|
|
354
|
+
...prev?.getPostThread,
|
|
355
|
+
lastReplyAt: newMessage.createdAt,
|
|
356
|
+
replies: [newMessage, ...prev?.getPostThread?.replies],
|
|
357
|
+
replyCount: newReplyCount,
|
|
358
|
+
updatedAt: newMessage.createdAt,
|
|
359
|
+
},
|
|
360
|
+
});
|
|
361
|
+
},
|
|
362
|
+
})
|
|
363
|
+
}
|
|
364
|
+
/>
|
|
365
|
+
</div>
|
|
366
|
+
<MessageInput channelId={channelId} handleSend={handleSend} placeholder="Message" />
|
|
367
|
+
</>
|
|
368
|
+
);
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
export default React.memo(ThreadMessages);
|