@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,10 @@
|
|
|
1
|
+
export enum MessengerSlotFillNameEnum {
|
|
2
|
+
INBOX_RIGHT_SIDEBAR = 'inbox-right-sidebar',
|
|
3
|
+
INBOX_WITH_AI_RIGHT_SIDEBAR = 'inbox-with-ai-right-sidebar',
|
|
4
|
+
CHAT_SETTINGS = 'chat-settings',
|
|
5
|
+
TOOLUSE_NAME = 'tooluse',
|
|
6
|
+
THINKING_NAME = 'thinking',
|
|
7
|
+
CODEBLOCK_NAME = 'codeblock',
|
|
8
|
+
AIASSISTANT_NAME = 'aiassistant',
|
|
9
|
+
SERVICE_NAME = 'service',
|
|
10
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
export type ProviderId = 'openai' | 'anthropic' | 'gemini' | 'groq';
|
|
4
|
+
|
|
5
|
+
export type ModelConfigMetadata = {
|
|
6
|
+
formExtensionE2BAPIKey?: string;
|
|
7
|
+
formExtensionE2BClaudeTemplateId?: string;
|
|
8
|
+
formExtensionE2BDomain?: string;
|
|
9
|
+
formExtensionE2BTemplateId?: string;
|
|
10
|
+
formExtensionE2BViteReactTemplateId?: string;
|
|
11
|
+
formExtensionE2BVueTemplateId?: string;
|
|
12
|
+
formExtensionGithubOrg?: string;
|
|
13
|
+
formExtensionGithubReactBase?: string;
|
|
14
|
+
formExtensionGithubToken?: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export interface ModelConfig {
|
|
18
|
+
provider: ProviderId;
|
|
19
|
+
model: string;
|
|
20
|
+
apiKey: string;
|
|
21
|
+
template: 'vite-react' | 'nextjs' | 'vue';
|
|
22
|
+
extensionId: string;
|
|
23
|
+
formId: string;
|
|
24
|
+
functionId?: string;
|
|
25
|
+
stepName?: string;
|
|
26
|
+
metadata?: ModelConfigMetadata;
|
|
27
|
+
domain?: string;
|
|
28
|
+
mode: 'plan' | 'build';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const STORAGE_KEY = 'mbx:model-config';
|
|
32
|
+
|
|
33
|
+
const DEFAULT_METADATA: ModelConfigMetadata = {
|
|
34
|
+
formExtensionE2BAPIKey: '',
|
|
35
|
+
formExtensionE2BClaudeTemplateId: '',
|
|
36
|
+
formExtensionE2BDomain: '',
|
|
37
|
+
formExtensionE2BTemplateId: '',
|
|
38
|
+
formExtensionE2BViteReactTemplateId: '',
|
|
39
|
+
formExtensionE2BVueTemplateId: '',
|
|
40
|
+
formExtensionGithubOrg: '',
|
|
41
|
+
formExtensionGithubReactBase: '',
|
|
42
|
+
formExtensionGithubToken: '',
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const DEFAULTS: ModelConfig = {
|
|
46
|
+
provider: 'anthropic',
|
|
47
|
+
// model: 'claude-3-5-sonnet-20241022',
|
|
48
|
+
model: 'claude-sonnet-4-5-20250929',
|
|
49
|
+
apiKey: '',
|
|
50
|
+
template: 'vite-react',
|
|
51
|
+
extensionId: '',
|
|
52
|
+
formId: '',
|
|
53
|
+
functionId: '',
|
|
54
|
+
stepName: '',
|
|
55
|
+
domain: 'yarntra.ai',
|
|
56
|
+
mode: 'plan',
|
|
57
|
+
metadata: DEFAULT_METADATA,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// Simple module-level store so all hook instances stay in sync
|
|
61
|
+
let globalModelConfig: ModelConfig | null = null;
|
|
62
|
+
let subscribers: Array<(config: ModelConfig) => void> = [];
|
|
63
|
+
|
|
64
|
+
function notifySubscribers(config: ModelConfig) {
|
|
65
|
+
subscribers.forEach((cb) => {
|
|
66
|
+
try {
|
|
67
|
+
cb(config);
|
|
68
|
+
} catch {
|
|
69
|
+
// ignore subscriber errors
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function loadFromStorage(): ModelConfig | null {
|
|
75
|
+
try {
|
|
76
|
+
const raw = typeof window !== 'undefined' ? window.localStorage.getItem(STORAGE_KEY) : null;
|
|
77
|
+
if (!raw) return null;
|
|
78
|
+
const parsed = JSON.parse(raw);
|
|
79
|
+
// Merge with defaults to ensure all fields are present
|
|
80
|
+
return {
|
|
81
|
+
...DEFAULTS,
|
|
82
|
+
...parsed,
|
|
83
|
+
metadata: {
|
|
84
|
+
...DEFAULT_METADATA,
|
|
85
|
+
...(parsed?.metadata || {}),
|
|
86
|
+
},
|
|
87
|
+
} as ModelConfig;
|
|
88
|
+
} catch {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function saveToStorage(config: ModelConfig) {
|
|
94
|
+
try {
|
|
95
|
+
if (typeof window !== 'undefined') {
|
|
96
|
+
window.localStorage.setItem(STORAGE_KEY, JSON.stringify(config));
|
|
97
|
+
}
|
|
98
|
+
} catch {
|
|
99
|
+
// ignore
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function usePersistentModelConfig() {
|
|
104
|
+
const [modelConfig, setModelConfig] = useState<ModelConfig>(() => {
|
|
105
|
+
if (globalModelConfig) return globalModelConfig;
|
|
106
|
+
|
|
107
|
+
const loaded = loadFromStorage();
|
|
108
|
+
// Merge with defaults to ensure all fields are present even if loaded config is partial
|
|
109
|
+
const initial = loaded
|
|
110
|
+
? {
|
|
111
|
+
...DEFAULTS,
|
|
112
|
+
...loaded,
|
|
113
|
+
metadata: {
|
|
114
|
+
...DEFAULT_METADATA,
|
|
115
|
+
...(loaded.metadata || {}),
|
|
116
|
+
},
|
|
117
|
+
}
|
|
118
|
+
: DEFAULTS;
|
|
119
|
+
|
|
120
|
+
globalModelConfig = initial;
|
|
121
|
+
return initial;
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// Keep this hook instance in sync with global store
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
const subscriber = (config: ModelConfig) => {
|
|
127
|
+
setModelConfig(config);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
subscribers.push(subscriber);
|
|
131
|
+
|
|
132
|
+
return () => {
|
|
133
|
+
subscribers = subscribers.filter((s) => s !== subscriber);
|
|
134
|
+
};
|
|
135
|
+
}, []);
|
|
136
|
+
|
|
137
|
+
const updateModelConfig = useCallback((newConfig: Partial<ModelConfig> | ModelConfig) => {
|
|
138
|
+
setModelConfig((prev) => {
|
|
139
|
+
const base = globalModelConfig || prev || DEFAULTS;
|
|
140
|
+
const next = { ...DEFAULTS, ...base, ...newConfig } as ModelConfig;
|
|
141
|
+
next.metadata = {
|
|
142
|
+
...DEFAULT_METADATA,
|
|
143
|
+
...(base.metadata || {}),
|
|
144
|
+
...(newConfig?.metadata || {}),
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
globalModelConfig = next;
|
|
148
|
+
saveToStorage(next);
|
|
149
|
+
// Defer notification to avoid "Cannot update component X while rendering component Y"
|
|
150
|
+
queueMicrotask(() => notifySubscribers(next));
|
|
151
|
+
|
|
152
|
+
return next;
|
|
153
|
+
});
|
|
154
|
+
}, []);
|
|
155
|
+
|
|
156
|
+
const hasApiKey = useMemo(() => Boolean(modelConfig.apiKey && modelConfig.apiKey.trim().length > 0), [modelConfig]);
|
|
157
|
+
|
|
158
|
+
const getValidatedConfig = useCallback(() => {
|
|
159
|
+
if (!hasApiKey) return null;
|
|
160
|
+
return modelConfig;
|
|
161
|
+
}, [hasApiKey, modelConfig]);
|
|
162
|
+
|
|
163
|
+
return { modelConfig, updateModelConfig, getValidatedConfig, hasApiKey };
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export default usePersistentModelConfig;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-export from the centralized @messenger-box/platform-client package.
|
|
3
|
+
* This file is kept for backward compatibility so existing imports
|
|
4
|
+
* from tailwind-ui-inbox consumers continue to work.
|
|
5
|
+
*/
|
|
6
|
+
export { useStreamAssembler, parseStreamMessage } from '@messenger-box/platform-client';
|
|
7
|
+
export type { ActiveStream, CompletedStream } from '@messenger-box/platform-client';
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { useSettingsLoader } from '@adminide-stack/platform-client';
|
|
2
|
+
import { ContributionSchemaId } from 'common';
|
|
3
|
+
import { useMemo, useRef } from 'react';
|
|
4
|
+
import type { TemplateConfig } from '../types/templates';
|
|
5
|
+
|
|
6
|
+
export interface UseTemplatesReturn {
|
|
7
|
+
/** Marketplace templates for selector (same as aicode-stack useTemplates). */
|
|
8
|
+
marketplaceTemplates: TemplateConfig[];
|
|
9
|
+
/** Alias for marketplaceTemplates for backward compatibility. */
|
|
10
|
+
templates: TemplateConfig[];
|
|
11
|
+
loading: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Hook for fetching templates from marketplace/extension (from extension config).
|
|
16
|
+
* Aligned with aicode-stack use-templates: returns marketplaceTemplates and same TemplateConfig shape (E2B/GitHub fields).
|
|
17
|
+
*/
|
|
18
|
+
export function useTemplates(): UseTemplatesReturn {
|
|
19
|
+
const { data: marketplaceData, loading: marketplaceLoading } = useSettingsLoader({
|
|
20
|
+
configKey: 'marketplace.templates.codeAssistant' as any,
|
|
21
|
+
schemaId: ContributionSchemaId.UiLayout,
|
|
22
|
+
resourceUri: undefined,
|
|
23
|
+
includeMarketplace: true,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const templatesRef = useRef<TemplateConfig[]>([]);
|
|
27
|
+
|
|
28
|
+
const marketplaceTemplates = useMemo(() => {
|
|
29
|
+
if (!marketplaceData || typeof marketplaceData !== 'object') {
|
|
30
|
+
return templatesRef.current.length === 0 ? [] : templatesRef.current;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const result: TemplateConfig[] = [];
|
|
34
|
+
Object.entries(marketplaceData).forEach(([_, templateInfo]: [string, any]) => {
|
|
35
|
+
if (templateInfo?.enable === false || templateInfo?.enable === 'false') return;
|
|
36
|
+
if (!templateInfo?.templateName || !templateInfo?.formId || !templateInfo?.formExtensionId) return;
|
|
37
|
+
|
|
38
|
+
result.push({
|
|
39
|
+
formExtensionId: (templateInfo.formExtensionId as string) || '',
|
|
40
|
+
formFunctionId: (templateInfo.formFunctionId as string) || '',
|
|
41
|
+
formId: (templateInfo.formId as string) || '',
|
|
42
|
+
tags: (templateInfo.tags as Record<string, string>) || {},
|
|
43
|
+
enable: String(templateInfo.enable),
|
|
44
|
+
templateName: (templateInfo.templateName as string) || '',
|
|
45
|
+
displayName: (templateInfo.displayName as string) || (templateInfo.templateName as string) || '',
|
|
46
|
+
description: (templateInfo.description as string) || '',
|
|
47
|
+
category: (templateInfo.category as string) || (templateInfo.projectType as string) || 'Other',
|
|
48
|
+
icon: (templateInfo.icon as string) || 'Layout',
|
|
49
|
+
projectType: (templateInfo.projectType as string) || '',
|
|
50
|
+
keywords: (templateInfo.keywords as Record<string, string>) || {},
|
|
51
|
+
formExtensionE2BAPIKey: templateInfo.formExtensionE2BAPIKey as string,
|
|
52
|
+
formExtensionE2BClaudeTemplateId: templateInfo.formExtensionE2BClaudeTemplateId as string,
|
|
53
|
+
formExtensionE2BDomain: templateInfo.formExtensionE2BDomain as string,
|
|
54
|
+
formExtensionE2BTemplateId: templateInfo.formExtensionE2BTemplateId as string,
|
|
55
|
+
formExtensionE2BViteReactTemplateId: templateInfo.formExtensionE2BViteReactTemplateId as string,
|
|
56
|
+
formExtensionE2BVueTemplateId: templateInfo.formExtensionE2BVueTemplateId as string,
|
|
57
|
+
formExtensionGithubOrg: templateInfo.formExtensionGithubOrg as string,
|
|
58
|
+
formExtensionGithubReactBase: templateInfo.formExtensionGithubReactBase as string,
|
|
59
|
+
formExtensionGithubToken: templateInfo.formExtensionGithubToken as string,
|
|
60
|
+
formExtensionModelConfigAPIKey: templateInfo.formExtensionModelConfigAPIKey as string,
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const newStr = JSON.stringify(result);
|
|
65
|
+
const oldStr = JSON.stringify(templatesRef.current);
|
|
66
|
+
if (newStr !== oldStr) templatesRef.current = result;
|
|
67
|
+
return templatesRef.current;
|
|
68
|
+
}, [marketplaceData]);
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
marketplaceTemplates,
|
|
72
|
+
templates: marketplaceTemplates,
|
|
73
|
+
loading: marketplaceLoading ?? false,
|
|
74
|
+
};
|
|
75
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export { default } from './module';
|
|
2
|
+
export { ChatMessageFill } from './module';
|
|
3
|
+
export {
|
|
4
|
+
Inbox,
|
|
5
|
+
Threads,
|
|
6
|
+
ThreadMessages,
|
|
7
|
+
ServiceInbox,
|
|
8
|
+
InboxWithLoader,
|
|
9
|
+
InboxWithAiLoader,
|
|
10
|
+
InboxAiMessagesLoader,
|
|
11
|
+
InboxContainer,
|
|
12
|
+
AiLandingInput,
|
|
13
|
+
} from './container';
|
|
14
|
+
export {
|
|
15
|
+
MessageSliceRenderer,
|
|
16
|
+
Messages,
|
|
17
|
+
Popover,
|
|
18
|
+
MessageInput,
|
|
19
|
+
CommonMessage,
|
|
20
|
+
UploadImageButton,
|
|
21
|
+
MessageItem,
|
|
22
|
+
LeftSidebar,
|
|
23
|
+
FilesList,
|
|
24
|
+
ConversationItem,
|
|
25
|
+
UserModalContent,
|
|
26
|
+
ServiceInboxItem,
|
|
27
|
+
AIAgent,
|
|
28
|
+
ModelConfigPanel,
|
|
29
|
+
RightSidebarAi,
|
|
30
|
+
InputComponent,
|
|
31
|
+
RightSidebarFillDefault,
|
|
32
|
+
MessagesContainerUI,
|
|
33
|
+
PlanModeView,
|
|
34
|
+
} from './components';
|
|
35
|
+
export type { MessagesContainerUIProps, PlanModeViewProps, PlanModeViewInputToolbarProps } from './components';
|
|
36
|
+
export type { PlanMessage, CurrentUser } from './components/messages-container-ui/types';
|
|
37
|
+
export { InboxWithAi } from './templates';
|
|
38
|
+
export type { CardMessageAttachmentsInterface, AlertMessageAttachmentsInterface } from './interfaces';
|
|
39
|
+
export * from './enums';
|
|
40
|
+
export * from './machines';
|
|
41
|
+
export * from './hooks';
|
|
42
|
+
export type { TemplateConfig, TemplateModalItem } from './types/templates';
|
|
43
|
+
export type {
|
|
44
|
+
LeftItemsOverrides,
|
|
45
|
+
RightItemsOverrides,
|
|
46
|
+
LeftToolbarItemId,
|
|
47
|
+
RightToolbarItemId,
|
|
48
|
+
InputToolBarPropsOverrides,
|
|
49
|
+
} from './components/AIAgent/InputComponent';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CardMessageAttachmentsInterface, AlertMessageAttachmentsInterface } from './message-widgets.interface';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface AlertMessageAttachmentsInterface {
|
|
2
|
+
title: string;
|
|
3
|
+
isTitleHtml: boolean;
|
|
4
|
+
icon: string;
|
|
5
|
+
callToAction: {
|
|
6
|
+
title: string;
|
|
7
|
+
link: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface CardMessageAttachmentsInterface {
|
|
12
|
+
image: string;
|
|
13
|
+
title?: string;
|
|
14
|
+
isTitleHtml?: string;
|
|
15
|
+
description: string;
|
|
16
|
+
isDescriptionHtml: boolean;
|
|
17
|
+
callToAction: {
|
|
18
|
+
title: string;
|
|
19
|
+
link: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { createMachine, assign } from 'xstate';
|
|
2
|
+
import { AIAgentContext, AIAgentEvent, Message } from './types';
|
|
3
|
+
|
|
4
|
+
export const aiAgentMachine = createMachine(
|
|
5
|
+
{
|
|
6
|
+
id: 'aiAgentSimple',
|
|
7
|
+
types: {} as {
|
|
8
|
+
context: AIAgentContext;
|
|
9
|
+
events: AIAgentEvent;
|
|
10
|
+
},
|
|
11
|
+
initial: 'idle',
|
|
12
|
+
context: {
|
|
13
|
+
messages: [],
|
|
14
|
+
currentInput: '',
|
|
15
|
+
error: null,
|
|
16
|
+
isTyping: false,
|
|
17
|
+
regularMessages: [],
|
|
18
|
+
},
|
|
19
|
+
states: {
|
|
20
|
+
idle: {
|
|
21
|
+
on: {
|
|
22
|
+
SEND_MESSAGE: {
|
|
23
|
+
target: 'idle',
|
|
24
|
+
guard: 'hasValidMessage',
|
|
25
|
+
actions: 'addUserMessage',
|
|
26
|
+
},
|
|
27
|
+
INPUT_CHANGE: {
|
|
28
|
+
actions: 'updateInput',
|
|
29
|
+
},
|
|
30
|
+
CLEAR_ERROR: {
|
|
31
|
+
actions: 'clearError',
|
|
32
|
+
},
|
|
33
|
+
UPDATE_REGULAR_MESSAGES: {
|
|
34
|
+
actions: 'updateRegularMessages',
|
|
35
|
+
},
|
|
36
|
+
// Tolerate legacy events as no-ops
|
|
37
|
+
AUTO_RESPOND_TO_MESSAGE: {},
|
|
38
|
+
RETRY: {},
|
|
39
|
+
CONTINUE_PROCESSING: {},
|
|
40
|
+
UPDATE: {
|
|
41
|
+
actions: 'mergeUpdate',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
guards: {
|
|
49
|
+
hasValidMessage: ({ event }) => {
|
|
50
|
+
if (event.type === 'SEND_MESSAGE') {
|
|
51
|
+
return Boolean(event.message && event.message.trim().length > 0);
|
|
52
|
+
}
|
|
53
|
+
return false;
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
actions: {
|
|
57
|
+
addUserMessage: assign(({ context, event }) => {
|
|
58
|
+
if (event.type !== 'SEND_MESSAGE') return context;
|
|
59
|
+
const newMessage: Message = {
|
|
60
|
+
id: Date.now().toString(),
|
|
61
|
+
content: event.message,
|
|
62
|
+
sender: 'user',
|
|
63
|
+
timestamp: new Date(),
|
|
64
|
+
};
|
|
65
|
+
return {
|
|
66
|
+
...context,
|
|
67
|
+
messages: [...context.messages, newMessage],
|
|
68
|
+
currentInput: '',
|
|
69
|
+
error: null,
|
|
70
|
+
};
|
|
71
|
+
}),
|
|
72
|
+
updateInput: assign(({ context, event }) => {
|
|
73
|
+
if (event.type !== 'INPUT_CHANGE') return context;
|
|
74
|
+
return { ...context, currentInput: event.value };
|
|
75
|
+
}),
|
|
76
|
+
updateRegularMessages: assign(({ context, event }) => {
|
|
77
|
+
if (event.type !== 'UPDATE_REGULAR_MESSAGES') return context;
|
|
78
|
+
return { ...context, regularMessages: event.messages || [] };
|
|
79
|
+
}),
|
|
80
|
+
clearError: assign(({ context }) => ({ ...context, error: null })),
|
|
81
|
+
mergeUpdate: assign(({ context, event }) => {
|
|
82
|
+
// Supports events like { type: 'UPDATE', value: { messages: [] } }
|
|
83
|
+
if (event.type !== 'UPDATE') return context as any;
|
|
84
|
+
const value = (event as any).value || {};
|
|
85
|
+
return { ...context, ...value } as any;
|
|
86
|
+
}),
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
);
|