@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,572 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
// import { HybridLiveEditor, HybridLiveEditorRef } from '../live-code-editor/hybrid-live-editor';
|
|
3
|
+
// import { useOnChatMessageAddedSubscription } from 'common/graphql';
|
|
4
|
+
// import { AiAgentMessageRole, ICreateChannelInput, PostTypeEnum, RoomType } from 'common';
|
|
5
|
+
// import { Sandbox } from '@e2b/code-interpreter';
|
|
6
|
+
// import { useMachine } from '@xstate/react';
|
|
7
|
+
// import { fromPromise } from 'xstate';
|
|
8
|
+
// import { rightSidebarMachine } from '../../xstate';
|
|
9
|
+
|
|
10
|
+
// type RightSidebarProps = {
|
|
11
|
+
// channelId: string;
|
|
12
|
+
// detailSidebarOptions: {
|
|
13
|
+
// isMobileView: boolean;
|
|
14
|
+
// isSmallTabletView: boolean;
|
|
15
|
+
// isTabletView: boolean;
|
|
16
|
+
// isDesktopView: boolean;
|
|
17
|
+
// isLargeDesktopView: boolean;
|
|
18
|
+
// isSmallScreen: boolean;
|
|
19
|
+
// [key: string]: any;
|
|
20
|
+
// };
|
|
21
|
+
// windowWidth: number;
|
|
22
|
+
// windowHeight: number;
|
|
23
|
+
// activeTab?: string;
|
|
24
|
+
// 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 RightSidebarFillComponent = (props: RightSidebarProps) => {
|
|
37
|
+
// const {
|
|
38
|
+
// channelId,
|
|
39
|
+
// detailSidebarOptions,
|
|
40
|
+
// windowWidth,
|
|
41
|
+
// windowHeight,
|
|
42
|
+
// activeTab,
|
|
43
|
+
// messages,
|
|
44
|
+
// selectedPost,
|
|
45
|
+
// setIsLoading,
|
|
46
|
+
// isLoading,
|
|
47
|
+
// handleSendMessage,
|
|
48
|
+
// handleRecreateSandbox,
|
|
49
|
+
// isMinimized,
|
|
50
|
+
// isCreatingSandbox,
|
|
51
|
+
// setIsCreatingSandbox,
|
|
52
|
+
// } = props;
|
|
53
|
+
// const hybridLiveEditorRef = React.useRef<HybridLiveEditorRef>(null);
|
|
54
|
+
// const previewIframeRef = React.useRef<HTMLIFrameElement>(null);
|
|
55
|
+
// const previewIframeContainerRef = React.useRef<HTMLIFrameElement>(null);
|
|
56
|
+
// // State for subscription data
|
|
57
|
+
// const [subscriptionData, setSubscriptionData] = React.useState<any>(null);
|
|
58
|
+
// // XState machine for sidebar state
|
|
59
|
+
// const [state, send] = useMachine(
|
|
60
|
+
// rightSidebarMachine.provide({
|
|
61
|
+
// actors: {
|
|
62
|
+
// recreateSandbox: fromPromise(async ({ input }) => {
|
|
63
|
+
// const { id } = input as { id: string };
|
|
64
|
+
// if (handleRecreateSandbox) {
|
|
65
|
+
// await handleRecreateSandbox(id);
|
|
66
|
+
// }
|
|
67
|
+
// return { success: true } as const;
|
|
68
|
+
// }),
|
|
69
|
+
// },
|
|
70
|
+
// }),
|
|
71
|
+
// {
|
|
72
|
+
// input: {
|
|
73
|
+
// channelId: channelId || '',
|
|
74
|
+
// isMinimized: !!isMinimized,
|
|
75
|
+
// windowWidth,
|
|
76
|
+
// windowHeight,
|
|
77
|
+
// isLoading: !!isLoading,
|
|
78
|
+
// activeFragment: null,
|
|
79
|
+
// currentFiles: {},
|
|
80
|
+
// canvasLayers: [],
|
|
81
|
+
// previewStatus: null,
|
|
82
|
+
// },
|
|
83
|
+
// },
|
|
84
|
+
// );
|
|
85
|
+
// const activeFragment = state.context.activeFragment;
|
|
86
|
+
// const currentFiles = state.context.currentFiles;
|
|
87
|
+
// const canvasLayers = state.context.canvasLayers as any[];
|
|
88
|
+
// const previewStatus = state.context.previewStatus as { code?: number; message?: string; status?: string } | null;
|
|
89
|
+
// // const [isLoading, setIsLoading] = React.useState(false);
|
|
90
|
+
// const { data: chatMessageAddedData } = useOnChatMessageAddedSubscription({
|
|
91
|
+
// variables: { channelId: channelId?.toString() || '' },
|
|
92
|
+
// skip: !channelId,
|
|
93
|
+
// });
|
|
94
|
+
|
|
95
|
+
// // Component mount tracking
|
|
96
|
+
// const componentId = React.useMemo(
|
|
97
|
+
// () => `right-sidebar-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
|
|
98
|
+
// [],
|
|
99
|
+
// );
|
|
100
|
+
|
|
101
|
+
// const handleCopyToClipboard = React.useCallback((text: string) => {
|
|
102
|
+
// navigator.clipboard.writeText(text);
|
|
103
|
+
// }, []);
|
|
104
|
+
|
|
105
|
+
// const handleFileUpdate = React.useCallback(async (filePath: string, content: string) => {
|
|
106
|
+
// // TODO: Implement file update logic for the channel
|
|
107
|
+
// console.log('File update:', { filePath, content });
|
|
108
|
+
// }, []);
|
|
109
|
+
|
|
110
|
+
// // Create complete file context by merging currentFiles with activeFragment files
|
|
111
|
+
// const completeFileContext = React.useMemo(() => {
|
|
112
|
+
// if (!activeFragment?.files) {
|
|
113
|
+
// console.log('📂 Using currentFiles as complete context (no activeFragment.files)');
|
|
114
|
+
// return currentFiles;
|
|
115
|
+
// }
|
|
116
|
+
|
|
117
|
+
// // Merge currentFiles with activeFragment files, giving priority to activeFragment files
|
|
118
|
+
// const merged = { ...currentFiles };
|
|
119
|
+
|
|
120
|
+
// // Override with activeFragment files (these are the most recent changes)
|
|
121
|
+
// Object.entries(activeFragment.files).forEach(([path, content]) => {
|
|
122
|
+
// merged[path] = content as string;
|
|
123
|
+
// });
|
|
124
|
+
|
|
125
|
+
// // Validate file context integrity
|
|
126
|
+
// const hasPackageJson = 'package.json' in merged;
|
|
127
|
+
// const hasMainFiles = Object.keys(merged).some(
|
|
128
|
+
// (path) =>
|
|
129
|
+
// path.includes('index.') || path.includes('main.') || path.includes('App.') || path.includes('src/'),
|
|
130
|
+
// );
|
|
131
|
+
|
|
132
|
+
// console.log('📂 Complete file context created:', {
|
|
133
|
+
// currentFilesCount: Object.keys(currentFiles).length,
|
|
134
|
+
// activeFragmentFilesCount: Object.keys(activeFragment.files).length,
|
|
135
|
+
// mergedFilesCount: Object.keys(merged).length,
|
|
136
|
+
// hasPackageJson,
|
|
137
|
+
// hasMainFiles,
|
|
138
|
+
// activeFragmentFiles: Object.keys(activeFragment.files),
|
|
139
|
+
// allFiles: Object.keys(merged),
|
|
140
|
+
// validation: {
|
|
141
|
+
// isComplete: hasPackageJson && hasMainFiles,
|
|
142
|
+
// missingPackageJson: !hasPackageJson,
|
|
143
|
+
// missingMainFiles: !hasMainFiles,
|
|
144
|
+
// },
|
|
145
|
+
// });
|
|
146
|
+
|
|
147
|
+
// if (!hasPackageJson) {
|
|
148
|
+
// console.warn('⚠️ File context missing package.json - this may cause issues in sandbox');
|
|
149
|
+
// }
|
|
150
|
+
// if (!hasMainFiles) {
|
|
151
|
+
// console.warn('⚠️ File context missing main application files - this may cause issues in sandbox');
|
|
152
|
+
// }
|
|
153
|
+
|
|
154
|
+
// return merged;
|
|
155
|
+
// }, [currentFiles, activeFragment?.files]);
|
|
156
|
+
|
|
157
|
+
// // Determine if we should show preview or editor based on activeTab
|
|
158
|
+
// const isPreviewMode = activeTab === 'preview';
|
|
159
|
+
|
|
160
|
+
// // Turn on loader when new data is about to be processed
|
|
161
|
+
// React.useEffect(() => {
|
|
162
|
+
// if (chatMessageAddedData?.chatMessageAdded || selectedPost) {
|
|
163
|
+
// // sync external loader
|
|
164
|
+
// // setIsLoading?.(false);
|
|
165
|
+
// // send({ type: 'SET_LOADING', isLoading: false });
|
|
166
|
+
// }
|
|
167
|
+
// }, [chatMessageAddedData, selectedPost, send, setIsLoading]);
|
|
168
|
+
|
|
169
|
+
// // Handle subscription data updates - prefer response update structure like use-ai-messages.ts
|
|
170
|
+
// React.useEffect(() => {
|
|
171
|
+
// if (chatMessageAddedData?.chatMessageAdded || selectedPost) {
|
|
172
|
+
// // Prefer explicitly selected post to ensure UI updates when it changes
|
|
173
|
+
// const message = selectedPost || chatMessageAddedData?.chatMessageAdded;
|
|
174
|
+
|
|
175
|
+
// // Extract strictly from message.propsConfiguration (fragment only)
|
|
176
|
+
// let extracted: any = null;
|
|
177
|
+
// let fragmentSource:
|
|
178
|
+
// | 'propsConfiguration.contents.props.fragment'
|
|
179
|
+
// | 'propsConfiguration.contents.fragment'
|
|
180
|
+
// | 'propsConfiguration.fragment'
|
|
181
|
+
// | null = null;
|
|
182
|
+
|
|
183
|
+
// try {
|
|
184
|
+
// // 1) Preferred: contents.props.fragment
|
|
185
|
+
// const cfg: any = message.propsConfiguration || {};
|
|
186
|
+
// const contents: any = cfg.contents || cfg.content || {};
|
|
187
|
+
|
|
188
|
+
// if (contents?.props?.fragment) {
|
|
189
|
+
// const frag = contents.props.fragment;
|
|
190
|
+
// extracted = {
|
|
191
|
+
// sandboxUrl: frag.sandboxUrl || frag.url,
|
|
192
|
+
// sandboxId: frag.sandboxId,
|
|
193
|
+
// projectId: cfg.projectId || contents.projectId || frag.projectId,
|
|
194
|
+
// modelConfig: cfg.modelConfig || contents.modelConfig || frag.modelConfig,
|
|
195
|
+
// files: frag.files || {},
|
|
196
|
+
// canvasLayers: contents.canvasLayers || cfg.canvasLayers || frag.canvasLayers,
|
|
197
|
+
// summary: contents.summary || cfg.summary || frag.summary,
|
|
198
|
+
// title: frag.title || contents.title || cfg.title,
|
|
199
|
+
// isError: frag.isError,
|
|
200
|
+
// };
|
|
201
|
+
// fragmentSource = 'propsConfiguration.contents.props.fragment';
|
|
202
|
+
// }
|
|
203
|
+
|
|
204
|
+
// // 2) Fallback: contents.fragment
|
|
205
|
+
// if (!extracted && contents?.fragment) {
|
|
206
|
+
// const frag = contents.fragment;
|
|
207
|
+
// extracted = {
|
|
208
|
+
// sandboxUrl: frag.sandboxUrl || frag.url,
|
|
209
|
+
// sandboxId: frag.sandboxId,
|
|
210
|
+
// projectId: cfg.projectId || contents.projectId || frag.projectId,
|
|
211
|
+
// modelConfig: cfg.modelConfig || contents.modelConfig || frag.modelConfig,
|
|
212
|
+
// files: frag.files || {},
|
|
213
|
+
// canvasLayers: contents.canvasLayers || cfg.canvasLayers || frag.canvasLayers,
|
|
214
|
+
// summary: contents.summary || cfg.summary || frag.summary,
|
|
215
|
+
// title: frag.title || contents.title || cfg.title,
|
|
216
|
+
// isError: frag.isError,
|
|
217
|
+
// };
|
|
218
|
+
// fragmentSource = 'propsConfiguration.contents.fragment';
|
|
219
|
+
// }
|
|
220
|
+
|
|
221
|
+
// // 3) Fallback: propsConfiguration.fragment (top-level)
|
|
222
|
+
// if (!extracted && cfg?.fragment) {
|
|
223
|
+
// const frag = cfg.fragment;
|
|
224
|
+
// extracted = {
|
|
225
|
+
// sandboxUrl: frag.sandboxUrl || frag.url,
|
|
226
|
+
// sandboxId: frag.sandboxId,
|
|
227
|
+
// projectId: cfg.projectId || frag.projectId,
|
|
228
|
+
// modelConfig: cfg.modelConfig || frag.modelConfig,
|
|
229
|
+
// files: frag.files || {},
|
|
230
|
+
// canvasLayers: cfg.canvasLayers || frag.canvasLayers,
|
|
231
|
+
// summary: cfg.summary || frag.summary,
|
|
232
|
+
// title: frag.title || cfg.title,
|
|
233
|
+
// isError: frag.isError,
|
|
234
|
+
// };
|
|
235
|
+
// fragmentSource = 'propsConfiguration.fragment';
|
|
236
|
+
// }
|
|
237
|
+
// } catch (error) {
|
|
238
|
+
// console.error('Error extracting response from message:', error);
|
|
239
|
+
// }
|
|
240
|
+
|
|
241
|
+
// // console.log('Extracted response fragment source:', fragmentSource);
|
|
242
|
+
// // console.log('Extracted response:', extracted);
|
|
243
|
+
|
|
244
|
+
// if (extracted && (extracted.sandboxUrl || extracted.url)) {
|
|
245
|
+
// console.log('✅ Processing response update:', extracted);
|
|
246
|
+
|
|
247
|
+
// // Update subscription data snapshot
|
|
248
|
+
// setSubscriptionData(extracted);
|
|
249
|
+
|
|
250
|
+
// // Build active fragment
|
|
251
|
+
// const fragment = {
|
|
252
|
+
// id: message.id,
|
|
253
|
+
// sandboxUrl: extracted.sandboxUrl || extracted.url,
|
|
254
|
+
// sandboxId: extracted.sandboxId,
|
|
255
|
+
// title: extracted.title || 'Generated Code',
|
|
256
|
+
// files: extracted.files || {},
|
|
257
|
+
// projectId: extracted.projectId,
|
|
258
|
+
// modelConfig: extracted.modelConfig,
|
|
259
|
+
// canvasLayers: extracted.canvasLayers,
|
|
260
|
+
// summary: extracted.summary,
|
|
261
|
+
// isError: extracted.isError,
|
|
262
|
+
// };
|
|
263
|
+
|
|
264
|
+
// // If canvasLayers missing but present in summary, attempt to extract like use-ai-messages
|
|
265
|
+
// if ((!fragment.canvasLayers || !Array.isArray(fragment.canvasLayers)) && fragment.summary) {
|
|
266
|
+
// try {
|
|
267
|
+
// const match = (fragment.summary as string).match(/<canvas_layers>([\s\S]*?)<\/canvas_layers>/);
|
|
268
|
+
// if (match) {
|
|
269
|
+
// const parsed = JSON.parse(match[1]);
|
|
270
|
+
// if (Array.isArray(parsed)) {
|
|
271
|
+
// fragment.canvasLayers = parsed;
|
|
272
|
+
// }
|
|
273
|
+
// }
|
|
274
|
+
// } catch (e) {
|
|
275
|
+
// console.warn('Failed to parse canvas layers from summary:', e);
|
|
276
|
+
// }
|
|
277
|
+
// }
|
|
278
|
+
|
|
279
|
+
// console.log('✅ Setting active fragment via XState:', fragment);
|
|
280
|
+
// send({ type: 'SET_FRAGMENT', fragment });
|
|
281
|
+
// // setIsLoading?.(false);
|
|
282
|
+
// //send({ type: 'SET_LOADING', isLoading: false });
|
|
283
|
+
// } else {
|
|
284
|
+
// console.log('❌ No valid response found in message');
|
|
285
|
+
// // setIsLoading?.(false);
|
|
286
|
+
// // send({ type: 'SET_LOADING', isLoading: false });
|
|
287
|
+
// }
|
|
288
|
+
// }
|
|
289
|
+
// }, [chatMessageAddedData, selectedPost, send, setIsLoading]);
|
|
290
|
+
|
|
291
|
+
// // When switching tabs or when sandbox changes, show loader until ready
|
|
292
|
+
// // React.useEffect(() => {
|
|
293
|
+
// // if (isPreviewMode) {
|
|
294
|
+
// // if (activeFragment?.sandboxUrl) {
|
|
295
|
+
// // // setIsLoading(true);
|
|
296
|
+
// // }
|
|
297
|
+
// // } else {
|
|
298
|
+
// // // In code view, briefly show loader while editor reacts to new files
|
|
299
|
+
// // // setIsLoading(true);
|
|
300
|
+
// // const timeoutId = setTimeout(() => setIsLoading(false), 400);
|
|
301
|
+
// // return () => clearTimeout(timeoutId);
|
|
302
|
+
// // }
|
|
303
|
+
// // }, [isPreviewMode, activeFragment?.sandboxUrl, completeFileContext]);
|
|
304
|
+
|
|
305
|
+
// // Cleanup iframe resources on unmount to prevent renderer leaks in Chrome
|
|
306
|
+
// React.useEffect(() => {
|
|
307
|
+
// return () => {
|
|
308
|
+
// try {
|
|
309
|
+
// if (previewIframeRef.current) {
|
|
310
|
+
// previewIframeRef.current.src = 'about:blank';
|
|
311
|
+
// }
|
|
312
|
+
// } catch (e) {
|
|
313
|
+
// // no-op
|
|
314
|
+
// }
|
|
315
|
+
// };
|
|
316
|
+
// }, []);
|
|
317
|
+
|
|
318
|
+
// React.useEffect(() => {
|
|
319
|
+
// const handleVisualEditorMessage = (event: MessageEvent) => {
|
|
320
|
+
// // Handle AI changes
|
|
321
|
+
// if (event.data.type === 'VISUAL_EDITOR_CHANGES') {
|
|
322
|
+
// console.log('visual_editor_changes....', event.data.message);
|
|
323
|
+
|
|
324
|
+
// if (handleSendMessage && event.data.message) {
|
|
325
|
+
// // Call aiHandleSend directly - this is the handleSend function from AIAgent
|
|
326
|
+
// handleSendMessage({
|
|
327
|
+
// channelId,
|
|
328
|
+
// type: RoomType.Aiassistant,
|
|
329
|
+
// postData: {
|
|
330
|
+
// // postId: postId,
|
|
331
|
+
// type: PostTypeEnum.Aiassistant,
|
|
332
|
+
// content: event.data.message,
|
|
333
|
+
// },
|
|
334
|
+
// });
|
|
335
|
+
// } else {
|
|
336
|
+
// console.warn('⚠️ handleSendMessage not available or no message provided');
|
|
337
|
+
// }
|
|
338
|
+
// }
|
|
339
|
+
// };
|
|
340
|
+
|
|
341
|
+
// window.addEventListener('message', handleVisualEditorMessage);
|
|
342
|
+
// return () => window.removeEventListener('message', handleVisualEditorMessage);
|
|
343
|
+
// }, [handleSendMessage, channelId]);
|
|
344
|
+
|
|
345
|
+
// const recreateSandboxHandler = React.useCallback(
|
|
346
|
+
// async (id: string) => {
|
|
347
|
+
// if (id) {
|
|
348
|
+
// console.log('recreate sandbox id....', id);
|
|
349
|
+
// setIsLoading?.(true);
|
|
350
|
+
// send({ type: 'SET_LOADING', isLoading: true });
|
|
351
|
+
// try {
|
|
352
|
+
// send({ type: 'RECREATE_SANDBOX', id });
|
|
353
|
+
// } catch (e: any) {
|
|
354
|
+
// console.error('Error recreating sandbox:', e);
|
|
355
|
+
// setIsLoading?.(false);
|
|
356
|
+
// send({ type: 'SET_LOADING', isLoading: false });
|
|
357
|
+
// }
|
|
358
|
+
// }
|
|
359
|
+
// },
|
|
360
|
+
// [send, setIsLoading],
|
|
361
|
+
// );
|
|
362
|
+
|
|
363
|
+
// // Track if we've already attempted recreate for a given sandbox URL
|
|
364
|
+
// const recreateAttemptedByUrlRef = React.useRef<Record<string, boolean>>({});
|
|
365
|
+
|
|
366
|
+
// // Probe sandbox URL via XState actor
|
|
367
|
+
// React.useEffect(() => {
|
|
368
|
+
// const url = activeFragment?.sandboxUrl;
|
|
369
|
+
// if (url) {
|
|
370
|
+
// send({ type: 'PROBE', url, fragmentId: activeFragment?.id });
|
|
371
|
+
// }
|
|
372
|
+
// }, [activeFragment?.sandboxUrl, activeFragment?.id, send]);
|
|
373
|
+
|
|
374
|
+
// // Prefer using external loading when provided; otherwise fall back to machine state
|
|
375
|
+
// const derivedIsLoading = (typeof isLoading === 'boolean' ? isLoading : state.context.isLoading) as boolean;
|
|
376
|
+
|
|
377
|
+
// // Sync external loading prop with machine's loading state (no-op if setter not provided)
|
|
378
|
+
// // React.useEffect(() => {
|
|
379
|
+
// // console.log(
|
|
380
|
+
// // 'isLoading....',
|
|
381
|
+
// // isLoading,
|
|
382
|
+
// // ' state.context.isLoading',
|
|
383
|
+
// // state.context.isLoading,
|
|
384
|
+
// // ' previewStatus',
|
|
385
|
+
// // previewStatus,
|
|
386
|
+
// // );
|
|
387
|
+
// // if (!state.context.isLoading) {
|
|
388
|
+
// // setIsLoading?.(!!state.context.isLoading);
|
|
389
|
+
// // }
|
|
390
|
+
// // }, [state.context.isLoading, setIsLoading, isLoading]);
|
|
391
|
+
|
|
392
|
+
// return (
|
|
393
|
+
// <div ref={previewIframeContainerRef} className="right-sidebar-content h-full flex flex-col">
|
|
394
|
+
// <div className="flex-1 overflow-hidden" style={{ minHeight: windowHeight - 140 }}>
|
|
395
|
+
// {isPreviewMode ? (
|
|
396
|
+
// // Preview Mode - Show sandbox iframe or fallback
|
|
397
|
+
// (() => {
|
|
398
|
+
// if (activeFragment?.sandboxUrl) {
|
|
399
|
+
// return (
|
|
400
|
+
// <div
|
|
401
|
+
// className="w-full h-full relative"
|
|
402
|
+
// style={{
|
|
403
|
+
// width: isMinimized ? windowWidth * 0.8 + 'px' : '100%',
|
|
404
|
+
// height: windowHeight - 140,
|
|
405
|
+
// backgroundColor: '#f0f0f0',
|
|
406
|
+
// }}
|
|
407
|
+
// >
|
|
408
|
+
// {!previewStatus ? (
|
|
409
|
+
// <iframe
|
|
410
|
+
// key={activeFragment.sandboxUrl}
|
|
411
|
+
// ref={previewIframeRef}
|
|
412
|
+
// src={activeFragment.sandboxUrl}
|
|
413
|
+
// className="w-full w-fit h-full h-fit border border-gray-200 rounded-md bg-white shadow-sm"
|
|
414
|
+
// title="Live Preview"
|
|
415
|
+
// sandbox="allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-orientation-lock allow-pointer-lock allow-presentation allow-storage-access-by-user-activation allow-top-navigation-by-user-activation"
|
|
416
|
+
// loading="lazy"
|
|
417
|
+
// onLoad={() => {
|
|
418
|
+
// console.log('🎯 Iframe loaded successfully');
|
|
419
|
+
// setIsLoading?.(false);
|
|
420
|
+
// setIsCreatingSandbox?.(false);
|
|
421
|
+
// send({ type: 'SET_LOADING', isLoading: false });
|
|
422
|
+
// }}
|
|
423
|
+
// onError={(e) => {
|
|
424
|
+
// console.error('❌ Iframe error:', e);
|
|
425
|
+
// setIsLoading?.(false);
|
|
426
|
+
// send({ type: 'SET_LOADING', isLoading: false });
|
|
427
|
+
// }}
|
|
428
|
+
// style={
|
|
429
|
+
// {
|
|
430
|
+
// // maxHeight: windowHeight - 140,
|
|
431
|
+
// // width: isMinimized ? windowWidth * 0.82 + 'px' : '100%',
|
|
432
|
+
// //padding: isMinimized ? '10px' : '0px',
|
|
433
|
+
// }
|
|
434
|
+
// }
|
|
435
|
+
// />
|
|
436
|
+
// ) : (
|
|
437
|
+
// <div className="absolute inset-0 bg-white/60 flex items-center justify-center z-20">
|
|
438
|
+
// {handleRecreateSandbox && (
|
|
439
|
+
// <>
|
|
440
|
+
// {derivedIsLoading || isCreatingSandbox ? (
|
|
441
|
+
// <div className="flex flex-col items-center justify-center gap-2">
|
|
442
|
+
// <div className="animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500"></div>
|
|
443
|
+
// <p className="text-xs text-blue-700">Recreating...</p>
|
|
444
|
+
// </div>
|
|
445
|
+
// ) : (
|
|
446
|
+
// <div className="flex flex-col items-center justify-center gap-2">
|
|
447
|
+
// <div className="animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500"></div>
|
|
448
|
+
// <p className="text-sm text-muted-foreground">
|
|
449
|
+
// {isLoading ? 'Recreating...' : 'Refresh'}{' '}
|
|
450
|
+
// {/* Sandbox is not available. */}
|
|
451
|
+
// </p>
|
|
452
|
+
// {/* <button
|
|
453
|
+
// type="button"
|
|
454
|
+
// className="themed-button focus-themed px-3 py-1.5 text-xs"
|
|
455
|
+
// onClick={() =>
|
|
456
|
+
// recreateSandboxHandler(activeFragment?.id)
|
|
457
|
+
// }
|
|
458
|
+
// >
|
|
459
|
+
// Recreate
|
|
460
|
+
// </button> */}
|
|
461
|
+
// </div>
|
|
462
|
+
// )}
|
|
463
|
+
// </>
|
|
464
|
+
// )}
|
|
465
|
+
// </div>
|
|
466
|
+
// )}
|
|
467
|
+
// <div className="absolute top-2 right-2 bg-green-100 text-green-800 px-2 py-1 rounded text-xs z-10">
|
|
468
|
+
// Live Preview
|
|
469
|
+
// </div>
|
|
470
|
+
// {derivedIsLoading ||
|
|
471
|
+
// (isCreatingSandbox && (
|
|
472
|
+
// <>
|
|
473
|
+
// <div className="absolute inset-0 bg-white/60 flex items-center justify-center z-20">
|
|
474
|
+
// <div className="animate-spin rounded-full h-12 w-12 border-4 border-blue-500 border-t-transparent"></div>
|
|
475
|
+
// </div>
|
|
476
|
+
// <div className="absolute top-2 left-2 bg-blue-100 text-blue-800 px-2 py-1 rounded text-xs z-30">
|
|
477
|
+
// Loading...
|
|
478
|
+
// </div>
|
|
479
|
+
// </>
|
|
480
|
+
// ))}
|
|
481
|
+
// </div>
|
|
482
|
+
// );
|
|
483
|
+
// } else {
|
|
484
|
+
// return (
|
|
485
|
+
// <div
|
|
486
|
+
// className="h-full flex items-center justify-center text-gray-500 border border-gray-200 rounded-md bg-gray-50 "
|
|
487
|
+
// style={{ width: '100%', height: '80vh' }}
|
|
488
|
+
// >
|
|
489
|
+
// <div className="text-center space-y-3">
|
|
490
|
+
// <p className="font-medium">No preview available</p>
|
|
491
|
+
// <div className="flex flex-col items-center justify-center space-y-3">
|
|
492
|
+
// {derivedIsLoading || isCreatingSandbox ? (
|
|
493
|
+
// <div className="animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500"></div>
|
|
494
|
+
// ) : (
|
|
495
|
+
// <div className="w-8 h-8 bg-gray-300 rounded-full"></div>
|
|
496
|
+
// )}
|
|
497
|
+
// <p className="text-sm text-gray-400">
|
|
498
|
+
// {derivedIsLoading || isCreatingSandbox
|
|
499
|
+
// ? 'Generating code...'
|
|
500
|
+
// : 'Waiting for code generation...'}
|
|
501
|
+
// </p>
|
|
502
|
+
// </div>
|
|
503
|
+
// </div>
|
|
504
|
+
// </div>
|
|
505
|
+
// );
|
|
506
|
+
// }
|
|
507
|
+
// })()
|
|
508
|
+
// ) : (
|
|
509
|
+
// // Code Editor Mode - Show files from subscription or fallback
|
|
510
|
+
// <div
|
|
511
|
+
// className="h-full w-full relative"
|
|
512
|
+
// style={{
|
|
513
|
+
// minHeight: windowHeight - 140,
|
|
514
|
+
// height: windowHeight - 140,
|
|
515
|
+
// width: isMinimized ? windowWidth * 0.9 + 'px' : '100%',
|
|
516
|
+
// }}
|
|
517
|
+
// >
|
|
518
|
+
// <HybridLiveEditor
|
|
519
|
+
// ref={hybridLiveEditorRef}
|
|
520
|
+
// projectId={activeFragment?.projectId || channelId}
|
|
521
|
+
// fragmentId={activeFragment?.id || activeTab || 'default'}
|
|
522
|
+
// files={Object.keys(completeFileContext).length > 0 ? completeFileContext : {}}
|
|
523
|
+
// sandboxUrl={activeFragment?.sandboxUrl}
|
|
524
|
+
// onCopyToClipboard={handleCopyToClipboard}
|
|
525
|
+
// onFileUpdate={handleFileUpdate}
|
|
526
|
+
// readOnly={!activeFragment?.id}
|
|
527
|
+
// autoSave={false}
|
|
528
|
+
// debounceMs={500}
|
|
529
|
+
// //className={`h-full w-[100%] h-[75vh] border-b border-gray-200 rounded-md bg-white shadow-sm overflow-hidden`}
|
|
530
|
+
// className="h-full w-full"
|
|
531
|
+
// />
|
|
532
|
+
// {derivedIsLoading && (
|
|
533
|
+
// <>
|
|
534
|
+
// <div className="absolute inset-0 bg-white/60 flex items-center justify-center z-20">
|
|
535
|
+
// <div className="animate-spin rounded-full h-12 w-12 border-4 border-blue-500 border-t-transparent"></div>
|
|
536
|
+
// </div>
|
|
537
|
+
// <div className="absolute top-4 right-4 bg-blue-100 border border-blue-400 text-blue-700 px-3 py-2 rounded text-sm z-30">
|
|
538
|
+
// <div className="flex items-center gap-2">
|
|
539
|
+
// <div className="animate-spin rounded-full h-4 w-4 border-b-2 border-blue-500"></div>
|
|
540
|
+
// Processing...
|
|
541
|
+
// </div>
|
|
542
|
+
// </div>
|
|
543
|
+
// </>
|
|
544
|
+
// )}
|
|
545
|
+
// </div>
|
|
546
|
+
// )}
|
|
547
|
+
// </div>
|
|
548
|
+
|
|
549
|
+
// {/* <div className="p-2 border-t bg-gray-50 text-xs text-gray-500">
|
|
550
|
+
// <div className="flex justify-between">
|
|
551
|
+
// <span>Mobile: {detailSidebarOptions.isMobileView ? 'Yes' : 'No'}</span>
|
|
552
|
+
// <span>Desktop: {detailSidebarOptions.isDesktopView ? 'Yes' : 'No'}</span>
|
|
553
|
+
// {activeFragment && (
|
|
554
|
+
// <span className="text-green-600">{activeFragment.isError ? 'Error' : 'Ready'}</span>
|
|
555
|
+
// )}
|
|
556
|
+
// </div>
|
|
557
|
+
// {activeFragment && (
|
|
558
|
+
// <div className="mt-1 text-xs">
|
|
559
|
+
// <span className="text-gray-400">Files: {Object.keys(completeFileContext).length}</span>
|
|
560
|
+
// {canvasLayers.length > 0 && (
|
|
561
|
+
// <span className="ml-2 text-gray-400">Layers: {canvasLayers.length}</span>
|
|
562
|
+
// )}
|
|
563
|
+
// </div>
|
|
564
|
+
// )}
|
|
565
|
+
// </div> */}
|
|
566
|
+
// </div>
|
|
567
|
+
// );
|
|
568
|
+
// };
|
|
569
|
+
|
|
570
|
+
export const RightSidebarFillComponent = (props: any) => {
|
|
571
|
+
return <></>;
|
|
572
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import React, { useMemo, useState } from 'react';
|
|
2
|
+
import { useFileUrlQuery } from 'common/graphql';
|
|
3
|
+
|
|
4
|
+
interface FilesListProps {
|
|
5
|
+
files: any[];
|
|
6
|
+
uploaded?: boolean;
|
|
7
|
+
FileElementProps?: Omit<FileElementProps, 'file' | 'uploaded' | 'onRemove'>;
|
|
8
|
+
onRemove?: () => Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface FileElementProps {
|
|
12
|
+
file: any;
|
|
13
|
+
uploaded: boolean;
|
|
14
|
+
width?: number;
|
|
15
|
+
height?: number;
|
|
16
|
+
onRemove?: () => Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function FilesList({ files, uploaded = false }: FilesListProps) {
|
|
20
|
+
return (
|
|
21
|
+
<div className="flex flex-row">
|
|
22
|
+
{files.map((file, index) => (
|
|
23
|
+
<FilesList.FileElement key={`${index}`} uploaded={uploaded} file={file} />
|
|
24
|
+
))}
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
FilesList.FileElement = ({ file, uploaded, width = 120, height = 120 }: FileElementProps) => {
|
|
30
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
31
|
+
const src = useMemo(() => (uploaded ? file.url : URL.createObjectURL(file)), [file, uploaded]);
|
|
32
|
+
const { data } = useFileUrlQuery({
|
|
33
|
+
variables: {
|
|
34
|
+
id: file?.id,
|
|
35
|
+
},
|
|
36
|
+
skip: !file?.id,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const onOpen = () => setIsOpen(true);
|
|
40
|
+
const onClose = () => setIsOpen(false);
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<>
|
|
44
|
+
<img
|
|
45
|
+
className="cursor-pointer m-2 object-cover rounded"
|
|
46
|
+
style={{ height: `${height}px`, width: `${width}px` }}
|
|
47
|
+
src={src}
|
|
48
|
+
onClick={onOpen}
|
|
49
|
+
alt="File preview"
|
|
50
|
+
/>
|
|
51
|
+
|
|
52
|
+
{/* Modal */}
|
|
53
|
+
{isOpen && (
|
|
54
|
+
<div className="fixed inset-0 z-50 flex items-center justify-center p-4">
|
|
55
|
+
{/* Overlay */}
|
|
56
|
+
<div className="fixed inset-0 bg-black bg-opacity-75" onClick={onClose} />
|
|
57
|
+
|
|
58
|
+
{/* Modal Content */}
|
|
59
|
+
<div className="relative bg-white rounded-lg shadow-xl max-w-4xl max-h-[90vh] overflow-hidden">
|
|
60
|
+
{/* Close Button */}
|
|
61
|
+
<button
|
|
62
|
+
onClick={onClose}
|
|
63
|
+
className="absolute top-4 right-4 z-10 p-2 rounded-full bg-black bg-opacity-50 hover:bg-opacity-70 transition-all duration-200"
|
|
64
|
+
>
|
|
65
|
+
<svg className="w-6 h-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
66
|
+
<path
|
|
67
|
+
strokeLinecap="round"
|
|
68
|
+
strokeLinejoin="round"
|
|
69
|
+
strokeWidth={2}
|
|
70
|
+
d="M6 18L18 6M6 6l12 12"
|
|
71
|
+
/>
|
|
72
|
+
</svg>
|
|
73
|
+
</button>
|
|
74
|
+
|
|
75
|
+
{/* Image Container */}
|
|
76
|
+
<div className="p-4 flex items-center justify-center">
|
|
77
|
+
<img
|
|
78
|
+
src={data?.fileInfo?.url || src}
|
|
79
|
+
alt="File full view"
|
|
80
|
+
className="max-w-full max-h-[80vh] object-contain cursor-pointer"
|
|
81
|
+
onClick={onClose}
|
|
82
|
+
/>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
)}
|
|
87
|
+
</>
|
|
88
|
+
);
|
|
89
|
+
};
|