@messenger-box/tailwind-ui-inbox 10.0.3-alpha.0
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 +16 -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 +32 -0
- package/lib/components/AIAgent/AIAgent.d.ts.map +1 -0
- package/lib/components/AIAgent/AIAgent.js +1135 -0
- package/lib/components/AIAgent/AIAgent.js.map +1 -0
- package/lib/components/AIAgent/InputComponent.d.ts +84 -0
- package/lib/components/AIAgent/InputComponent.d.ts.map +1 -0
- package/lib/components/AIAgent/InputComponent.js +417 -0
- package/lib/components/AIAgent/InputComponent.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 +20 -0
- package/lib/components/InboxMessage/InputComponent.d.ts.map +1 -0
- package/lib/components/InboxMessage/InputComponent.js +148 -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 +37 -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/StreamingMessageBubble.d.ts +18 -0
- package/lib/components/InboxMessage/StreamingMessageBubble.d.ts.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/TypingIndicator.d.ts +11 -0
- package/lib/components/InboxMessage/TypingIndicator.d.ts.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 +30 -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 +19 -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 +10 -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 +42 -0
- package/lib/components/InboxMessage/message-widgets/ModernMessageGroup.d.ts.map +1 -0
- package/lib/components/InboxMessage/message-widgets/ModernMessageGroup.js +1339 -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 +74 -0
- package/lib/components/ModelConfigPanel.d.ts.map +1 -0
- package/lib/components/ModelConfigPanel.js +1152 -0
- package/lib/components/ModelConfigPanel.js.map +1 -0
- package/lib/components/filler-components/RightSiderBar.d.ts +3 -0
- package/lib/components/filler-components/RightSiderBar.d.ts.map +1 -0
- package/lib/components/filler-components/RightSiderBar.js +532 -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 +10 -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/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/messages-container-ui/MessagesContainerUI.d.ts +81 -0
- package/lib/components/messages-container-ui/MessagesContainerUI.d.ts.map +1 -0
- package/lib/components/messages-container-ui/MessagesContainerUI.js +77 -0
- package/lib/components/messages-container-ui/MessagesContainerUI.js.map +1 -0
- package/lib/components/messages-container-ui/PlanModeView.d.ts +82 -0
- package/lib/components/messages-container-ui/PlanModeView.d.ts.map +1 -0
- package/lib/components/messages-container-ui/PlanModeView.js +267 -0
- package/lib/components/messages-container-ui/PlanModeView.js.map +1 -0
- package/lib/components/messages-container-ui/index.d.ts +6 -0
- package/lib/components/messages-container-ui/index.d.ts.map +1 -0
- package/lib/components/messages-container-ui/types.d.ts +38 -0
- package/lib/components/messages-container-ui/types.d.ts.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 +264 -0
- package/lib/compute.js.map +1 -0
- package/lib/config/env-config.d.ts +20 -0
- package/lib/config/env-config.d.ts.map +1 -0
- package/lib/config/env-config.js +55 -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 +27 -0
- package/lib/container/AiLandingInput.d.ts.map +1 -0
- package/lib/container/AiLandingInput.js +149 -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 +964 -0
- package/lib/container/Inbox.js.map +1 -0
- package/lib/container/InboxAiMessagesLoader.d.ts +45 -0
- package/lib/container/InboxAiMessagesLoader.d.ts.map +1 -0
- package/lib/container/InboxAiMessagesLoader.js +80 -0
- package/lib/container/InboxAiMessagesLoader.js.map +1 -0
- package/lib/container/InboxContainer.d.ts +41 -0
- package/lib/container/InboxContainer.d.ts.map +1 -0
- package/lib/container/InboxContainer.js +27 -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 +47 -0
- package/lib/container/InboxWithAiLoader.d.ts.map +1 -0
- package/lib/container/InboxWithAiLoader.js +118 -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 +141 -0
- package/lib/container/ServiceInbox.js.map +1 -0
- package/lib/container/TestInboxWithAiLoader.d.ts +7 -0
- package/lib/container/TestInboxWithAiLoader.d.ts.map +1 -0
- package/lib/container/TestInboxWithAiLoader.js +135 -0
- package/lib/container/TestInboxWithAiLoader.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 +320 -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 +347 -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 +243 -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 +11 -0
- package/lib/enums/messenger-slot-fill-name-enum.d.ts.map +1 -0
- package/lib/enums/messenger-slot-fill-name-enum.js +11 -0
- package/lib/enums/messenger-slot-fill-name-enum.js.map +1 -0
- package/lib/hooks/index.d.ts +4 -0
- package/lib/hooks/index.d.ts.map +1 -0
- package/lib/hooks/usePersistentModelConfig.d.ts +33 -0
- package/lib/hooks/usePersistentModelConfig.d.ts.map +1 -0
- package/lib/hooks/usePersistentModelConfig.js +123 -0
- package/lib/hooks/usePersistentModelConfig.js.map +1 -0
- package/lib/hooks/useStreamAssembler.d.ts +8 -0
- package/lib/hooks/useStreamAssembler.d.ts.map +1 -0
- package/lib/hooks/useTemplates.d.ts +14 -0
- package/lib/hooks/useTemplates.d.ts.map +1 -0
- package/lib/hooks/useTemplates.js +59 -0
- package/lib/hooks/useTemplates.js.map +1 -0
- package/lib/index.d.ts +14 -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 +251 -0
- package/lib/styles/responsive.css +76 -0
- package/lib/templates/InboxWithAi.d.ts +44 -0
- package/lib/templates/InboxWithAi.d.ts.map +1 -0
- package/lib/templates/InboxWithAi.js +651 -0
- package/lib/templates/InboxWithAi.js.map +1 -0
- package/lib/templates/InboxWithAi.tsx +844 -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/types/templates.d.ts +35 -0
- package/lib/types/templates.d.ts.map +1 -0
- package/lib/utils/utils.d.ts +2 -0
- package/lib/utils/utils.d.ts.map +1 -0
- package/lib/xstate/index.d.ts +3 -0
- package/lib/xstate/index.d.ts.map +1 -0
- package/lib/xstate/rightSidebar.machine.d.ts +4 -0
- package/lib/xstate/rightSidebar.machine.d.ts.map +1 -0
- package/lib/xstate/rightSidebar.types.d.ts +57 -0
- package/lib/xstate/rightSidebar.types.d.ts.map +1 -0
- package/package.json +69 -0
- package/rollup.config.mjs +47 -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 +1468 -0
- package/src/components/AIAgent/AIAgent.tsx.bk +1365 -0
- package/src/components/AIAgent/InputComponent.tsx +608 -0
- package/src/components/AIAgent/README.md +174 -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 +198 -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 +47 -0
- package/src/components/InboxMessage/ServiceConversationItem.tsx +234 -0
- package/src/components/InboxMessage/ServiceInboxItem.tsx +223 -0
- package/src/components/InboxMessage/StreamingMessageBubble.tsx +270 -0
- package/src/components/InboxMessage/SubscriptionHandler.tsx +55 -0
- package/src/components/InboxMessage/TypingIndicator.tsx +38 -0
- package/src/components/InboxMessage/UploadImageButton.tsx +46 -0
- package/src/components/InboxMessage/UserModalContent.tsx +60 -0
- package/src/components/InboxMessage/index.ts +18 -0
- package/src/components/InboxMessage/message-widgets/CommonMessage.tsx +69 -0
- package/src/components/InboxMessage/message-widgets/ErrorFixCard.tsx +239 -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 +1733 -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 +8 -0
- package/src/components/ModelConfigPanel.tsx +1357 -0
- package/src/components/filler-components/RightSiderBar.tsx +572 -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 +29 -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/messages-container-ui/MessagesContainerUI.tsx +151 -0
- package/src/components/messages-container-ui/PlanModeView.tsx +426 -0
- package/src/components/messages-container-ui/README.md +91 -0
- package/src/components/messages-container-ui/index.ts +5 -0
- package/src/components/messages-container-ui/types.ts +40 -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 +48 -0
- package/src/components/ui/button.tsx +32 -0
- package/src/compute.ts +271 -0
- package/src/config/env-config.ts +24 -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 +1879 -0
- package/src/container/AiInboxWithLoader.tsx +356 -0
- package/src/container/AiLandingInput.tsx +200 -0
- package/src/container/Inbox.tsx +1095 -0
- package/src/container/InboxAiMessagesLoader.tsx +129 -0
- package/src/container/InboxContainer.tsx +61 -0
- package/src/container/InboxTemplate1.tsx +1553 -0
- package/src/container/InboxTemplate1WithLoader.tsx +338 -0
- package/src/container/InboxTemplate2.tsx +1617 -0
- package/src/container/InboxWithAiLoader.tsx +177 -0
- package/src/container/InboxWithLoader.tsx +341 -0
- package/src/container/ServiceInbox.tsx +188 -0
- package/src/container/TestInboxWithAiLoader.tsx +147 -0
- package/src/container/ThreadMessages.tsx +378 -0
- package/src/container/ThreadMessagesInbox.tsx +457 -0
- package/src/container/Threads.tsx +270 -0
- package/src/container/ThreadsInbox.tsx +351 -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 +10 -0
- package/src/hooks/index.ts +3 -0
- package/src/hooks/usePersistentModelConfig.ts +166 -0
- package/src/hooks/useStreamAssembler.ts +7 -0
- package/src/hooks/useTemplates.ts +75 -0
- package/src/index.ts +49 -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 +844 -0
- package/src/templates/index.ts +1 -0
- package/src/types/templates.ts +35 -0
- package/src/utils/utils.ts +3 -0
- package/src/xstate/index.ts +2 -0
- package/src/xstate/rightSidebar.machine.ts +304 -0
- package/src/xstate/rightSidebar.types.ts +58 -0
- package/tsconfig.json +14 -0
- package/webpack.config.js +92 -0
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import {
|
|
4
|
+
CodeFormatter,
|
|
5
|
+
detectContentType,
|
|
6
|
+
FormattedMessageContent,
|
|
7
|
+
ModernMessageGroupComponent,
|
|
8
|
+
} from '../InboxMessage/message-widgets/ModernMessageGroup';
|
|
9
|
+
import { AiAgentMessageRole, PostTypeEnum } from 'common';
|
|
10
|
+
import type { PlanMessage } from './types';
|
|
11
|
+
const ASSISTANT_BUBBLE_BG = 'bg-white';
|
|
12
|
+
const BORDER_COLOR = 'border-gray-200';
|
|
13
|
+
|
|
14
|
+
const HIDE_SCROLLBAR_CSS = `
|
|
15
|
+
/* Hide scrollbar while keeping scrollability */
|
|
16
|
+
.ym-hide-scrollbar {
|
|
17
|
+
-ms-overflow-style: none; /* IE/Edge */
|
|
18
|
+
scrollbar-width: none; /* Firefox */
|
|
19
|
+
}
|
|
20
|
+
.ym-hide-scrollbar::-webkit-scrollbar {
|
|
21
|
+
display: none; /* Chrome/Safari */
|
|
22
|
+
width: 0;
|
|
23
|
+
height: 0;
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
const DEFAULT_ASSISTANT_AUTHOR = {
|
|
28
|
+
id: 'ai-assistant',
|
|
29
|
+
givenName: 'AI',
|
|
30
|
+
familyName: 'Assistant',
|
|
31
|
+
fullName: 'AI Assistant',
|
|
32
|
+
username: 'ai-assistant',
|
|
33
|
+
email: 'ai@assistant.com',
|
|
34
|
+
picture: null,
|
|
35
|
+
alias: [],
|
|
36
|
+
tokens: [],
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export interface PlanModeViewInputToolbarProps {
|
|
40
|
+
value: string;
|
|
41
|
+
onChange: (text: string) => void;
|
|
42
|
+
onSend: () => void;
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface PlanModeViewProps {
|
|
47
|
+
messages: PlanMessage[];
|
|
48
|
+
streamingContent?: string;
|
|
49
|
+
currentUser: { id: string; name?: string; avatar?: string; [key: string]: any };
|
|
50
|
+
onSend: (text: string) => void;
|
|
51
|
+
disabled?: boolean;
|
|
52
|
+
isLoading?: boolean;
|
|
53
|
+
onStop?: () => void;
|
|
54
|
+
showDate?: boolean;
|
|
55
|
+
showAvatar?: boolean;
|
|
56
|
+
showMessageBubbleBorder?: boolean;
|
|
57
|
+
/** When false (default), do NOT create an internal scroll container (avoids nested scroll). */
|
|
58
|
+
useInternalScroll?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Optional ref for the scroll container element (defaults to the internal
|
|
61
|
+
* message list wrapper).
|
|
62
|
+
*
|
|
63
|
+
* If provided, it will be attached to the internal scroll container div
|
|
64
|
+
* (so parent code can read/scroll it).
|
|
65
|
+
*/
|
|
66
|
+
scrollContainerRef?: React.Ref<HTMLDivElement>;
|
|
67
|
+
/** Optional className applied to the scroll container element. */
|
|
68
|
+
scrollContainerClassName?: string;
|
|
69
|
+
/** When true, hide the scrollbar visuals but keep it scrollable. */
|
|
70
|
+
hideScrollbar?: boolean;
|
|
71
|
+
contentClassName?: string;
|
|
72
|
+
postContainerClassName?: string;
|
|
73
|
+
|
|
74
|
+
/** Optional className applied to the root wrapper element. */
|
|
75
|
+
className?: string;
|
|
76
|
+
/** When true, the built-in input toolbar area is not rendered. */
|
|
77
|
+
hideInputToolbar?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Where to place the input toolbar.
|
|
80
|
+
* - `bottom` (default): render toolbar in the bottom area.
|
|
81
|
+
* - `inlineWhenEmpty`: when there are no messages and no streaming/loading, render the toolbar inline
|
|
82
|
+
* inside the empty state (matches landing UI), otherwise use bottom placement.
|
|
83
|
+
*/
|
|
84
|
+
inputPlacement?: 'bottom' | 'inlineWhenEmpty';
|
|
85
|
+
/** Input is passed from outside; receives value, onChange, onSend, disabled */
|
|
86
|
+
renderInputToolbar: (props: PlanModeViewInputToolbarProps) => React.ReactNode;
|
|
87
|
+
/** Optional: passed to ModernMessageGroupComponent */
|
|
88
|
+
onOpen?: (element?: any) => void;
|
|
89
|
+
onMessageClick?: (msg: any) => void;
|
|
90
|
+
isDesktopView?: boolean;
|
|
91
|
+
isSmallScreen?: boolean;
|
|
92
|
+
sandboxErrors?: any[];
|
|
93
|
+
currentFiles?: Record<string, string>;
|
|
94
|
+
onFixError?: (errorMessage: string) => Promise<void>;
|
|
95
|
+
/** Optional: error message to show above messages; use with onRetry for retry button */
|
|
96
|
+
error?: string | null;
|
|
97
|
+
/** Optional: called when user clicks retry (e.g. after error) */
|
|
98
|
+
onRetry?: () => void;
|
|
99
|
+
/**
|
|
100
|
+
* Optional: custom content when there are no messages and no streaming/loading.
|
|
101
|
+
* Receives input toolbar props so you can render the composer inline (e.g. landing UI).
|
|
102
|
+
*/
|
|
103
|
+
renderEmptyState?: (ctx: { inputToolbarProps: PlanModeViewInputToolbarProps }) => React.ReactNode;
|
|
104
|
+
/**
|
|
105
|
+
* Optional: when provided, scroll to bottom whenever these deps change (e.g. [streamingContent, messages.length]).
|
|
106
|
+
* Lets the parent force scroll on each stream chunk when the internal ResizeObserver/layout effect miss.
|
|
107
|
+
*/
|
|
108
|
+
scrollToBottomDeps?: React.DependencyList;
|
|
109
|
+
/** When true, fenced / raw code blocks show copy and download actions (default: true). */
|
|
110
|
+
showCopyDownloadOnCodeBlock?: boolean;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** Map PlanMessage to the post-like shape expected by ModernMessageGroupComponent */
|
|
114
|
+
function planMessageToPost(msg: PlanMessage, currentUser: PlanModeViewProps['currentUser']): any {
|
|
115
|
+
const isUser = msg.role === 'user';
|
|
116
|
+
const author =
|
|
117
|
+
msg.author ??
|
|
118
|
+
(isUser
|
|
119
|
+
? {
|
|
120
|
+
id: currentUser.id,
|
|
121
|
+
givenName: currentUser.givenName ?? currentUser.name ?? 'User',
|
|
122
|
+
familyName: currentUser.familyName ?? '',
|
|
123
|
+
fullName: currentUser.fullName ?? currentUser.name ?? 'User',
|
|
124
|
+
username: currentUser.username ?? currentUser.id,
|
|
125
|
+
email: currentUser.email ?? '',
|
|
126
|
+
picture: currentUser.picture ?? currentUser.avatar ?? null,
|
|
127
|
+
alias: currentUser.alias ?? [],
|
|
128
|
+
tokens: currentUser.tokens ?? [],
|
|
129
|
+
}
|
|
130
|
+
: DEFAULT_ASSISTANT_AUTHOR);
|
|
131
|
+
|
|
132
|
+
return {
|
|
133
|
+
id: msg.id,
|
|
134
|
+
message: msg.content,
|
|
135
|
+
author,
|
|
136
|
+
createdAt: msg.createdAt ?? new Date().toISOString(),
|
|
137
|
+
type: msg.type ?? PostTypeEnum.Aiassistant,
|
|
138
|
+
isDelivered: false,
|
|
139
|
+
isRead: false,
|
|
140
|
+
parentId: null,
|
|
141
|
+
fromServer: null,
|
|
142
|
+
updatedAt: msg.createdAt ?? new Date().toISOString(),
|
|
143
|
+
propsConfiguration: {
|
|
144
|
+
...(msg.propsConfiguration ?? { contents: {} }),
|
|
145
|
+
contents: {
|
|
146
|
+
...((msg.propsConfiguration as any)?.contents ?? {}),
|
|
147
|
+
role:
|
|
148
|
+
(msg.propsConfiguration as any)?.contents?.role ??
|
|
149
|
+
(isUser ? AiAgentMessageRole.User : AiAgentMessageRole.Assistant),
|
|
150
|
+
// Plan/build mode: consumers (e.g. ModernMessageBubble) read propsConfiguration.contents.mode
|
|
151
|
+
...((msg.props as { mode?: string } | undefined)?.mode != null
|
|
152
|
+
? { mode: (msg.props as { mode?: string }).mode }
|
|
153
|
+
: {}),
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
props: msg.props ?? {},
|
|
157
|
+
files: msg.files ?? [],
|
|
158
|
+
replies: null,
|
|
159
|
+
channel: null,
|
|
160
|
+
isPinned: false,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export function PlanModeView({
|
|
165
|
+
messages,
|
|
166
|
+
streamingContent,
|
|
167
|
+
currentUser,
|
|
168
|
+
onSend,
|
|
169
|
+
disabled = false,
|
|
170
|
+
isLoading = false,
|
|
171
|
+
onStop,
|
|
172
|
+
showDate = false,
|
|
173
|
+
showAvatar = false,
|
|
174
|
+
showMessageBubbleBorder = false,
|
|
175
|
+
useInternalScroll = false,
|
|
176
|
+
scrollContainerRef,
|
|
177
|
+
scrollContainerClassName,
|
|
178
|
+
hideScrollbar = false,
|
|
179
|
+
contentClassName,
|
|
180
|
+
postContainerClassName,
|
|
181
|
+
className,
|
|
182
|
+
hideInputToolbar = false,
|
|
183
|
+
inputPlacement = 'bottom',
|
|
184
|
+
renderInputToolbar,
|
|
185
|
+
onOpen = () => {},
|
|
186
|
+
onMessageClick = () => {},
|
|
187
|
+
isDesktopView = false,
|
|
188
|
+
isSmallScreen = false,
|
|
189
|
+
sandboxErrors = [],
|
|
190
|
+
currentFiles = {},
|
|
191
|
+
onFixError,
|
|
192
|
+
error = null,
|
|
193
|
+
onRetry,
|
|
194
|
+
renderEmptyState,
|
|
195
|
+
scrollToBottomDeps,
|
|
196
|
+
showCopyDownloadOnCodeBlock = true,
|
|
197
|
+
}: PlanModeViewProps) {
|
|
198
|
+
const [inputValue, setInputValue] = useState('');
|
|
199
|
+
const internalListRef = useRef<HTMLDivElement>(null);
|
|
200
|
+
const contentRef = useRef<HTMLDivElement>(null);
|
|
201
|
+
const shouldAutoScrollRef = useRef(true);
|
|
202
|
+
|
|
203
|
+
const setScrollContainerRef = useCallback(
|
|
204
|
+
(node: HTMLDivElement | null) => {
|
|
205
|
+
internalListRef.current = node;
|
|
206
|
+
|
|
207
|
+
if (!scrollContainerRef) return;
|
|
208
|
+
if (typeof scrollContainerRef === 'function') {
|
|
209
|
+
scrollContainerRef(node);
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// RefObject / MutableRefObject
|
|
214
|
+
(scrollContainerRef as React.MutableRefObject<HTMLDivElement | null>).current = node;
|
|
215
|
+
},
|
|
216
|
+
[scrollContainerRef],
|
|
217
|
+
);
|
|
218
|
+
|
|
219
|
+
const scrollToBottom = useCallback(() => {
|
|
220
|
+
const el = internalListRef.current;
|
|
221
|
+
if (el && shouldAutoScrollRef.current) {
|
|
222
|
+
el.scrollTop = el.scrollHeight;
|
|
223
|
+
}
|
|
224
|
+
}, []);
|
|
225
|
+
|
|
226
|
+
const handleSendFromInput = useCallback(() => {
|
|
227
|
+
const t = inputValue.trim();
|
|
228
|
+
if (!t) return;
|
|
229
|
+
onSend(t);
|
|
230
|
+
setInputValue('');
|
|
231
|
+
}, [inputValue, onSend]);
|
|
232
|
+
|
|
233
|
+
const inputToolbarProps: PlanModeViewInputToolbarProps = {
|
|
234
|
+
value: inputValue,
|
|
235
|
+
onChange: setInputValue,
|
|
236
|
+
onSend: handleSendFromInput,
|
|
237
|
+
disabled: disabled || isLoading,
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
const currentUserForGroup = useMemo(
|
|
241
|
+
() => ({
|
|
242
|
+
id: currentUser.id,
|
|
243
|
+
givenName: currentUser.givenName ?? currentUser.name ?? 'You',
|
|
244
|
+
familyName: currentUser.familyName ?? '',
|
|
245
|
+
fullName: currentUser.fullName ?? currentUser.name ?? 'You',
|
|
246
|
+
username: currentUser.username ?? currentUser.id,
|
|
247
|
+
email: currentUser.email ?? '',
|
|
248
|
+
picture: currentUser.picture ?? currentUser.avatar ?? null,
|
|
249
|
+
alias: currentUser.alias ?? [],
|
|
250
|
+
tokens: currentUser.tokens ?? [],
|
|
251
|
+
}),
|
|
252
|
+
[currentUser],
|
|
253
|
+
);
|
|
254
|
+
|
|
255
|
+
const posts = useMemo(() => messages.map((m) => planMessageToPost(m, currentUser)), [messages, currentUser]);
|
|
256
|
+
|
|
257
|
+
const isEmpty = posts.length === 0 && !streamingContent?.trim() && !isLoading;
|
|
258
|
+
const shouldInlineToolbar = inputPlacement === 'inlineWhenEmpty' && isEmpty;
|
|
259
|
+
const shouldRenderBottomToolbar = !hideInputToolbar && !shouldInlineToolbar;
|
|
260
|
+
|
|
261
|
+
// Auto-scroll to bottom while user stays near bottom.
|
|
262
|
+
useLayoutEffect(() => {
|
|
263
|
+
if (!useInternalScroll) return;
|
|
264
|
+
if (!shouldAutoScrollRef.current) return;
|
|
265
|
+
scrollToBottom();
|
|
266
|
+
const id = requestAnimationFrame(() => {
|
|
267
|
+
scrollToBottom();
|
|
268
|
+
requestAnimationFrame(scrollToBottom);
|
|
269
|
+
});
|
|
270
|
+
return () => cancelAnimationFrame(id);
|
|
271
|
+
}, [useInternalScroll, scrollToBottom, posts.length, streamingContent, isLoading]);
|
|
272
|
+
|
|
273
|
+
// When internal scroll is (re)enabled, force follow-to-bottom.
|
|
274
|
+
useEffect(() => {
|
|
275
|
+
if (!useInternalScroll) return;
|
|
276
|
+
shouldAutoScrollRef.current = true;
|
|
277
|
+
scrollToBottom();
|
|
278
|
+
}, [useInternalScroll, scrollToBottom]);
|
|
279
|
+
|
|
280
|
+
// When inner content grows (stream chunks, markdown expand), scroll to bottom if user was near bottom.
|
|
281
|
+
// Observing the content wrapper ensures we react to content height changes; the scroll container size often does not change.
|
|
282
|
+
useEffect(() => {
|
|
283
|
+
if (!useInternalScroll) return;
|
|
284
|
+
const el = contentRef.current;
|
|
285
|
+
if (!el) return;
|
|
286
|
+
if (typeof ResizeObserver === 'undefined') return;
|
|
287
|
+
|
|
288
|
+
const ro = new ResizeObserver(() => {
|
|
289
|
+
if (!shouldAutoScrollRef.current) return;
|
|
290
|
+
scrollToBottom();
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
ro.observe(el);
|
|
294
|
+
return () => ro.disconnect();
|
|
295
|
+
}, [useInternalScroll, scrollToBottom]);
|
|
296
|
+
|
|
297
|
+
// Parent-controlled scroll: when scrollToBottomDeps change (e.g. each stream chunk), force scroll to bottom.
|
|
298
|
+
useEffect(() => {
|
|
299
|
+
if (!useInternalScroll || !scrollToBottomDeps?.length) return;
|
|
300
|
+
scrollToBottom();
|
|
301
|
+
const id = requestAnimationFrame(() => {
|
|
302
|
+
scrollToBottom();
|
|
303
|
+
});
|
|
304
|
+
return () => cancelAnimationFrame(id);
|
|
305
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- intentional: parent passes deps
|
|
306
|
+
}, scrollToBottomDeps ?? []);
|
|
307
|
+
|
|
308
|
+
const handleScroll = useCallback(() => {
|
|
309
|
+
const el = internalListRef.current;
|
|
310
|
+
if (!el) return;
|
|
311
|
+
const thresholdPx = 160;
|
|
312
|
+
const distanceFromBottom = el.scrollHeight - el.scrollTop - el.clientHeight;
|
|
313
|
+
shouldAutoScrollRef.current = distanceFromBottom <= thresholdPx;
|
|
314
|
+
}, []);
|
|
315
|
+
|
|
316
|
+
return (
|
|
317
|
+
<div className={clsx('flex flex-col flex-1 min-h-0 overflow-hidden', className)}>
|
|
318
|
+
{useInternalScroll && hideScrollbar && <style>{HIDE_SCROLLBAR_CSS}</style>}
|
|
319
|
+
<div
|
|
320
|
+
ref={setScrollContainerRef}
|
|
321
|
+
onScroll={useInternalScroll ? handleScroll : undefined}
|
|
322
|
+
className={
|
|
323
|
+
useInternalScroll
|
|
324
|
+
? clsx(
|
|
325
|
+
'flex-1 min-h-0 overflow-y-auto',
|
|
326
|
+
hideScrollbar && 'ym-hide-scrollbar',
|
|
327
|
+
scrollContainerClassName,
|
|
328
|
+
)
|
|
329
|
+
: scrollContainerClassName ?? ''
|
|
330
|
+
}
|
|
331
|
+
>
|
|
332
|
+
<div ref={contentRef} className={clsx('w-full pb-4 pt-2 space-y-3 px-4', contentClassName ?? '')}>
|
|
333
|
+
{error && (
|
|
334
|
+
<div className="rounded-lg border border-red-200 bg-red-50 px-4 py-3 flex items-center justify-between gap-2">
|
|
335
|
+
<span className="text-sm text-red-800">{error}</span>
|
|
336
|
+
{onRetry && (
|
|
337
|
+
<button
|
|
338
|
+
type="button"
|
|
339
|
+
onClick={onRetry}
|
|
340
|
+
className="shrink-0 px-3 py-1.5 text-sm font-medium text-red-700 hover:bg-red-100 rounded-md transition-colors"
|
|
341
|
+
>
|
|
342
|
+
Retry
|
|
343
|
+
</button>
|
|
344
|
+
)}
|
|
345
|
+
</div>
|
|
346
|
+
)}
|
|
347
|
+
{isEmpty && (
|
|
348
|
+
<div className="px-4 py-8 text-center">
|
|
349
|
+
{renderEmptyState ? (
|
|
350
|
+
renderEmptyState({ inputToolbarProps })
|
|
351
|
+
) : (
|
|
352
|
+
<>
|
|
353
|
+
<div className="text-gray-500 text-lg font-medium mb-2">
|
|
354
|
+
Describe your idea and I'll help you create it step by step
|
|
355
|
+
</div>
|
|
356
|
+
<div className="text-gray-400 text-sm">
|
|
357
|
+
Start a new conversation by typing your message below
|
|
358
|
+
</div>
|
|
359
|
+
</>
|
|
360
|
+
)}
|
|
361
|
+
{shouldInlineToolbar && (
|
|
362
|
+
<div className="mt-6 text-left">{renderInputToolbar(inputToolbarProps)}</div>
|
|
363
|
+
)}
|
|
364
|
+
</div>
|
|
365
|
+
)}
|
|
366
|
+
|
|
367
|
+
{posts.map((post) => (
|
|
368
|
+
<div key={post.id} className={clsx('mb-3', postContainerClassName)}>
|
|
369
|
+
<ModernMessageGroupComponent
|
|
370
|
+
messages={[post]}
|
|
371
|
+
currentUser={currentUserForGroup}
|
|
372
|
+
onOpen={onOpen}
|
|
373
|
+
onMessageClick={onMessageClick}
|
|
374
|
+
isDesktopView={isDesktopView}
|
|
375
|
+
isSmallScreen={isSmallScreen}
|
|
376
|
+
showAuthorName={showAvatar}
|
|
377
|
+
showAvatar={showAvatar}
|
|
378
|
+
showTimestamp={showDate}
|
|
379
|
+
sandboxErrors={sandboxErrors}
|
|
380
|
+
currentFiles={currentFiles}
|
|
381
|
+
onFixError={onFixError}
|
|
382
|
+
showCopyDownloadOnCodeBlock={showCopyDownloadOnCodeBlock}
|
|
383
|
+
/>
|
|
384
|
+
</div>
|
|
385
|
+
))}
|
|
386
|
+
|
|
387
|
+
{streamingContent?.trim() && (
|
|
388
|
+
<div className="flex justify-start">
|
|
389
|
+
<div
|
|
390
|
+
className={`max-w-[85%] rounded-2xl px-4 py-3 ${ASSISTANT_BUBBLE_BG} text-gray-900 ${
|
|
391
|
+
showMessageBubbleBorder ? `border ${BORDER_COLOR}` : ''
|
|
392
|
+
}`}
|
|
393
|
+
>
|
|
394
|
+
<div className="text-[15px] leading-relaxed break-words min-w-0">
|
|
395
|
+
{detectContentType(streamingContent) === 'code' ? (
|
|
396
|
+
<CodeFormatter
|
|
397
|
+
content={streamingContent}
|
|
398
|
+
showCopyDownload={showCopyDownloadOnCodeBlock}
|
|
399
|
+
/>
|
|
400
|
+
) : (
|
|
401
|
+
<FormattedMessageContent
|
|
402
|
+
content={streamingContent}
|
|
403
|
+
showCopyDownloadOnCodeBlock={showCopyDownloadOnCodeBlock}
|
|
404
|
+
/>
|
|
405
|
+
)}
|
|
406
|
+
</div>
|
|
407
|
+
</div>
|
|
408
|
+
</div>
|
|
409
|
+
)}
|
|
410
|
+
|
|
411
|
+
{isLoading && (
|
|
412
|
+
<div className="flex justify-start">
|
|
413
|
+
<div className="rounded-2xl px-4 py-3 bg-gray-100 border border-gray-200 flex items-center gap-2">
|
|
414
|
+
<div className="w-4 h-4 border-2 border-gray-300 border-t-gray-600 rounded-full animate-spin" />
|
|
415
|
+
<span className="text-sm text-gray-600">Thinking...</span>
|
|
416
|
+
</div>
|
|
417
|
+
</div>
|
|
418
|
+
)}
|
|
419
|
+
</div>
|
|
420
|
+
</div>
|
|
421
|
+
{shouldRenderBottomToolbar && (
|
|
422
|
+
<div className="border-t border-gray-200 bg-white p-3">{renderInputToolbar(inputToolbarProps)}</div>
|
|
423
|
+
)}
|
|
424
|
+
</div>
|
|
425
|
+
);
|
|
426
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# messages-container-ui
|
|
2
|
+
|
|
3
|
+
Plan-mode message container for chat, search, and research. Renders messages with **ModernMessageGroupComponent** (same as AIAgent) and delegates the input area to a toolbar you provide via props.
|
|
4
|
+
|
|
5
|
+
## Exports
|
|
6
|
+
|
|
7
|
+
| Export | Description |
|
|
8
|
+
| -------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
|
|
9
|
+
| `MessagesContainerUI` | Main container: message list + streaming + loading + input toolbar slot |
|
|
10
|
+
| `PlanModeView` | Lower-level view used by `MessagesContainerUI` |
|
|
11
|
+
| `PlanMessage`, `CurrentUser` | Types from `types.ts` |
|
|
12
|
+
| `MessagesContainerUIProps`, `PlanModeViewProps`, `PlanModeViewInputToolbarProps` | Component prop types |
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import {
|
|
18
|
+
MessagesContainerUI,
|
|
19
|
+
type PlanMessage,
|
|
20
|
+
type PlanModeViewInputToolbarProps,
|
|
21
|
+
} from '@messenger-box/tailwind-ui-inbox';
|
|
22
|
+
|
|
23
|
+
const [messages, setMessages] = useState<PlanMessage[]>([]);
|
|
24
|
+
|
|
25
|
+
<MessagesContainerUI
|
|
26
|
+
messages={messages}
|
|
27
|
+
currentUser={{ id: userId, name: 'You' }}
|
|
28
|
+
onSend={(text) => {
|
|
29
|
+
setMessages((prev) => [...prev, { id: crypto.randomUUID(), role: 'user', content: text }]);
|
|
30
|
+
// send to API / gateway...
|
|
31
|
+
}}
|
|
32
|
+
isLoading={isLoading}
|
|
33
|
+
renderInputToolbar={({ value, onChange, onSend, disabled }) => (
|
|
34
|
+
<div className="flex gap-2">
|
|
35
|
+
<input
|
|
36
|
+
value={value}
|
|
37
|
+
onChange={(e) => onChange(e.target.value)}
|
|
38
|
+
onKeyDown={(e) => e.key === 'Enter' && !e.shiftKey && onSend()}
|
|
39
|
+
disabled={disabled}
|
|
40
|
+
className="flex-1 border rounded-lg px-3 py-2"
|
|
41
|
+
/>
|
|
42
|
+
<button onClick={onSend} disabled={disabled}>
|
|
43
|
+
Send
|
|
44
|
+
</button>
|
|
45
|
+
</div>
|
|
46
|
+
)}
|
|
47
|
+
/>;
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Props (MessagesContainerUI)
|
|
51
|
+
|
|
52
|
+
| Prop | Type | Required | Description |
|
|
53
|
+
| ------------------------- | -------------------------------------------------------------------------- | -------- | -------------------------------------------------------------------------------------- |
|
|
54
|
+
| `messages` | `PlanMessage[]` | Yes | List of messages to show |
|
|
55
|
+
| `currentUser` | `CurrentUser` | Yes | Current user (id required; name, avatar, and full author fields optional) |
|
|
56
|
+
| `onSend` | `(text: string) => void` | Yes | Called when the user sends a message |
|
|
57
|
+
| `renderInputToolbar` | `(props: PlanModeViewInputToolbarProps) => ReactNode` | Yes | Renders the input area (value, onChange, onSend, disabled) |
|
|
58
|
+
| `streamingContent` | `string` | No | Optional streaming text shown below the last message |
|
|
59
|
+
| `disabled` | `boolean` | No | Disables input |
|
|
60
|
+
| `isLoading` | `boolean` | No | Shows “Thinking...” below messages |
|
|
61
|
+
| `onStop` | `() => void` | No | Stop handler (e.g. stop generation) |
|
|
62
|
+
| `showDate` | `boolean` | No | Show timestamps on messages |
|
|
63
|
+
| `showAvatar` | `boolean` | No | Show avatars (passed to ModernMessageGroupComponent) |
|
|
64
|
+
| `showMessageBubbleBorder` | `boolean` | No | Border on assistant bubbles |
|
|
65
|
+
| `onOpen` | `(element?: any) => void` | No | Passed to ModernMessageGroupComponent |
|
|
66
|
+
| `onMessageClick` | `(msg: any) => void` | No | Passed to ModernMessageGroupComponent |
|
|
67
|
+
| `isDesktopView` | `boolean` | No | Layout flag for ModernMessageGroupComponent |
|
|
68
|
+
| `isSmallScreen` | `boolean` | No | Layout flag for ModernMessageGroupComponent |
|
|
69
|
+
| `sandboxErrors` | `any[]` | No | Errors for fix UI (same as AIAgent) |
|
|
70
|
+
| `currentFiles` | `Record<string, string>` | No | File map for fix UI |
|
|
71
|
+
| `onFixError` | `(errorMessage: string) => Promise<void>` | No | Fix-error handler |
|
|
72
|
+
| `error` | `string \| null` | No | Error message to show above messages |
|
|
73
|
+
| `onRetry` | `() => void` | No | Called when user clicks retry (e.g. after error) |
|
|
74
|
+
| `useInternalScroll` | `boolean` | No | When false (default), avoids creating an internal scroll container (no nested scroll) |
|
|
75
|
+
| `hideInputToolbar` | `boolean` | No | When true, the built-in input toolbar area is not rendered |
|
|
76
|
+
| `renderEmptyState` | `(ctx: { inputToolbarProps: PlanModeViewInputToolbarProps }) => ReactNode` | No | Custom empty state; you can render the input/composer inline using `inputToolbarProps` |
|
|
77
|
+
|
|
78
|
+
## Types
|
|
79
|
+
|
|
80
|
+
- **PlanMessage**: `id`, `role` ('user' | 'assistant' | 'system'), `content`, optional `createdAt`, and optional `propsConfiguration`, `props`, `files`, `author`, `type` for full post-like data.
|
|
81
|
+
- **CurrentUser**: `id`; optional `name`, `avatar`, and full author fields (`givenName`, `familyName`, `username`, etc.) for ModernMessageGroupComponent.
|
|
82
|
+
- **PlanModeViewInputToolbarProps**: `value`, `onChange`, `onSend`, optional `disabled` — passed to `renderInputToolbar`.
|
|
83
|
+
|
|
84
|
+
## Integration with AIAgent
|
|
85
|
+
|
|
86
|
+
This container uses the same **ModernMessageGroupComponent** as AIAgent for message rendering. You can:
|
|
87
|
+
|
|
88
|
+
- Use **MessagesContainerUI** when you own the message list and send flow (e.g. Yantra chat/research) and pass everything as props.
|
|
89
|
+
- Use **AIAgent** when you want channel/GraphQL/subscriptions and the same message UI; both share the same message display.
|
|
90
|
+
|
|
91
|
+
Build/workflow flows can stay in the host app and be wired via `onSend` and other callbacks.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { MessagesContainerUI } from './MessagesContainerUI';
|
|
2
|
+
export { PlanModeView } from './PlanModeView';
|
|
3
|
+
export type { MessagesContainerUIProps } from './MessagesContainerUI';
|
|
4
|
+
export type { PlanModeViewProps, PlanModeViewInputToolbarProps } from './PlanModeView';
|
|
5
|
+
export type { PlanMessage, CurrentUser } from './types';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Messages container UI – types for plan mode (chat / search / research).
|
|
3
|
+
* Messages can be simple PlanMessage or full post-like shape for ModernMessageGroupComponent.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface PlanMessage {
|
|
7
|
+
id: string;
|
|
8
|
+
role: 'user' | 'assistant' | 'system';
|
|
9
|
+
content: string;
|
|
10
|
+
createdAt?: Date | string;
|
|
11
|
+
/** Optional: pass through to ModernMessageGroupComponent (propsConfiguration, props, files, etc.) */
|
|
12
|
+
propsConfiguration?: any;
|
|
13
|
+
props?: any;
|
|
14
|
+
files?: any;
|
|
15
|
+
author?: any;
|
|
16
|
+
type?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Props passed to the input toolbar render function. */
|
|
20
|
+
export interface PlanModeViewInputToolbarProps {
|
|
21
|
+
value: string;
|
|
22
|
+
onChange: (text: string) => void;
|
|
23
|
+
onSend: () => void;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface CurrentUser {
|
|
28
|
+
id: string;
|
|
29
|
+
name?: string;
|
|
30
|
+
avatar?: string;
|
|
31
|
+
/** Optional: full author shape for ModernMessageGroupComponent (givenName, familyName, username, etc.) */
|
|
32
|
+
givenName?: string;
|
|
33
|
+
familyName?: string;
|
|
34
|
+
fullName?: string;
|
|
35
|
+
username?: string;
|
|
36
|
+
email?: string;
|
|
37
|
+
picture?: string | null;
|
|
38
|
+
alias?: any[];
|
|
39
|
+
tokens?: any[];
|
|
40
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChatMessageFiller } from './chat-message-slot';
|
|
3
|
+
import { MessageSliceRenderer } from '../InboxMessage/message-widgets';
|
|
4
|
+
|
|
5
|
+
export const ChatMessageFill = () => {
|
|
6
|
+
return <ChatMessageFiller>{(props) => <MessageSliceRenderer {...props} />}</ChatMessageFiller>;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const ChatMessageFill2 = () => {
|
|
10
|
+
return (
|
|
11
|
+
<ChatMessageFiller>
|
|
12
|
+
{(props) => {
|
|
13
|
+
const { message, index, onOpen, currentUser } = props;
|
|
14
|
+
return <div>{message.message}</div>;
|
|
15
|
+
}}
|
|
16
|
+
</ChatMessageFiller>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React, { FunctionComponent } from 'react';
|
|
2
|
+
import { Slot, Fill } from '@common-stack/components-pro';
|
|
3
|
+
import { MESSAGE_SLOT_FILL_NAME } from '@messenger-box/core';
|
|
4
|
+
|
|
5
|
+
type ChatMessageProps = {
|
|
6
|
+
index: number;
|
|
7
|
+
message: any;
|
|
8
|
+
onOpen: any;
|
|
9
|
+
currentUser: any;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const ChatMessageSlot: FunctionComponent<ChatMessageProps> = (props) => {
|
|
13
|
+
return <Slot name={MESSAGE_SLOT_FILL_NAME} fillProps={{ active: true, ...props }} />;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const ChatMessageFiller = (props: any) => {
|
|
17
|
+
return <Fill {...props} name={MESSAGE_SLOT_FILL_NAME} />;
|
|
18
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Fill } from '@common-stack/components-pro';
|
|
3
|
+
import { MessengerSlotFillNameEnum } from '../../enums';
|
|
4
|
+
import { RightSidebarFillComponent } from '../filler-components/RightSiderBar';
|
|
5
|
+
import { ICreateChannelInput } from 'common';
|
|
6
|
+
|
|
7
|
+
type RightSidebarProps = {
|
|
8
|
+
channelId: string;
|
|
9
|
+
detailSidebarOptions: {
|
|
10
|
+
isMobileView: boolean;
|
|
11
|
+
isSmallTabletView: boolean;
|
|
12
|
+
isTabletView: boolean;
|
|
13
|
+
isDesktopView: boolean;
|
|
14
|
+
isLargeDesktopView: boolean;
|
|
15
|
+
isSmallScreen: boolean;
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
};
|
|
18
|
+
windowWidth: number;
|
|
19
|
+
windowHeight: number;
|
|
20
|
+
activeTab?: string;
|
|
21
|
+
selectedPost?: any;
|
|
22
|
+
contextData?: any;
|
|
23
|
+
showContextTab?: boolean;
|
|
24
|
+
ContextTabComponent?: React.ComponentType<{ context: any; selectedPost?: any }>;
|
|
25
|
+
messages?: any[];
|
|
26
|
+
setIsLoading?: (isLoading: boolean) => void;
|
|
27
|
+
handleSendMessage?: (createChannelInput: ICreateChannelInput) => void;
|
|
28
|
+
handleRecreateSandbox?: (messageId: string) => void | Promise<any>;
|
|
29
|
+
isMinimized?: boolean;
|
|
30
|
+
isLoading?: boolean;
|
|
31
|
+
isCreatingSandbox?: boolean;
|
|
32
|
+
setIsCreatingSandbox?: (isCreatingSandbox: boolean) => void;
|
|
33
|
+
[key: string]: any;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const RightSidebarFiller = (props: any) => {
|
|
37
|
+
return <Fill {...props} name={MessengerSlotFillNameEnum.INBOX_WITH_AI_RIGHT_SIDEBAR} />;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const RightSidebarFill = () => {
|
|
41
|
+
return (
|
|
42
|
+
<RightSidebarFiller>
|
|
43
|
+
{(props: RightSidebarProps) => {
|
|
44
|
+
return <RightSidebarFillComponent {...props} />;
|
|
45
|
+
}}
|
|
46
|
+
</RightSidebarFiller>
|
|
47
|
+
);
|
|
48
|
+
};
|