@parhelia/core 0.1.12554 → 0.1.12556
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/dist/agents-view/AgentCard.d.ts +4 -6
- package/dist/agents-view/AgentCard.js +24 -143
- package/dist/agents-view/AgentCard.js.map +1 -1
- package/dist/agents-view/AgentsInbox.d.ts +1 -1
- package/dist/agents-view/AgentsInbox.js +92 -7
- package/dist/agents-view/AgentsInbox.js.map +1 -1
- package/dist/agents-view/AgentsTitlebar.js +2 -3
- package/dist/agents-view/AgentsTitlebar.js.map +1 -1
- package/dist/agents-view/AgentsView.d.ts +7 -6
- package/dist/agents-view/AgentsView.js +98 -187
- package/dist/agents-view/AgentsView.js.map +1 -1
- package/dist/agents-view/AgentsWorkspaceView.d.ts +6 -2
- package/dist/agents-view/AgentsWorkspaceView.js +113 -266
- package/dist/agents-view/AgentsWorkspaceView.js.map +1 -1
- package/dist/agents-view/ProfileAgentsGroup.d.ts +1 -2
- package/dist/agents-view/ProfileAgentsGroup.js +3 -4
- package/dist/agents-view/ProfileAgentsGroup.js.map +1 -1
- package/dist/components/ActionButton.d.ts +1 -1
- package/dist/components/ActionButton.js.map +1 -1
- package/dist/components/FilterInput.d.ts +1 -1
- package/dist/components/FilterInput.js +1 -1
- package/dist/components/FilterInput.js.map +1 -1
- package/dist/components/ui/LanguageSelector.js +4 -2
- package/dist/components/ui/LanguageSelector.js.map +1 -1
- package/dist/components/ui/PlaceholderInput.js +3 -3
- package/dist/components/ui/PlaceholderInput.js.map +1 -1
- package/dist/components/ui/PlaceholderInputTypes.js +1 -1
- package/dist/components/ui/PlaceholderInputTypes.js.map +1 -1
- package/dist/components/ui/alert-dialog.d.ts +1 -1
- package/dist/components/ui/alert-dialog.js +10 -6
- package/dist/components/ui/alert-dialog.js.map +1 -1
- package/dist/components/ui/button.d.ts +4 -4
- package/dist/components/ui/button.js +1 -4
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/context-menu.d.ts +1 -1
- package/dist/components/ui/context-menu.js +4 -12
- package/dist/components/ui/context-menu.js.map +1 -1
- package/dist/components/ui/copy-button.d.ts +1 -2
- package/dist/components/ui/copy-button.js +2 -2
- package/dist/components/ui/copy-button.js.map +1 -1
- package/dist/components/ui/dialog.d.ts +1 -1
- package/dist/components/ui/dialog.js +126 -21
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/input.d.ts +1 -1
- package/dist/components/ui/input.js +3 -5
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/paste-button.d.ts +1 -2
- package/dist/components/ui/paste-button.js +2 -2
- package/dist/components/ui/paste-button.js.map +1 -1
- package/dist/components/ui/popover.js +9 -1
- package/dist/components/ui/popover.js.map +1 -1
- package/dist/components/ui/select.js +1 -1
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/styled-dialog-title.js +1 -1
- package/dist/components/ui/styled-dialog-title.js.map +1 -1
- package/dist/components/ui/tabs.d.ts +1 -1
- package/dist/components/ui/tabs.js +11 -4
- package/dist/components/ui/tabs.js.map +1 -1
- package/dist/config/config.d.ts +2 -4
- package/dist/config/config.js +70 -250
- package/dist/config/config.js.map +1 -1
- package/dist/config/types/workspace.d.ts +0 -6
- package/dist/config/types.d.ts +12 -63
- package/dist/config/types.js.map +1 -1
- package/dist/editor/ComponentInfo.d.ts +4 -0
- package/dist/editor/ComponentInfo.js +41 -0
- package/dist/editor/ComponentInfo.js.map +1 -0
- package/dist/editor/ConfirmationDialog.js +4 -20
- package/dist/editor/ConfirmationDialog.js.map +1 -1
- package/dist/editor/ContentTree.d.ts +1 -2
- package/dist/editor/ContentTree.js +32 -93
- package/dist/editor/ContentTree.js.map +1 -1
- package/dist/editor/Editor.js +22 -87
- package/dist/editor/Editor.js.map +1 -1
- package/dist/editor/FieldHistory.js +36 -84
- package/dist/editor/FieldHistory.js.map +1 -1
- package/dist/editor/FieldListField.js +9 -21
- package/dist/editor/FieldListField.js.map +1 -1
- package/dist/editor/FieldListFieldWithFallbacks.js +2 -23
- package/dist/editor/FieldListFieldWithFallbacks.js.map +1 -1
- package/dist/editor/GlobalMenuBar.js +2 -29
- package/dist/editor/GlobalMenuBar.js.map +1 -1
- package/dist/editor/ImageEditor.js +2 -5
- package/dist/editor/ImageEditor.js.map +1 -1
- package/dist/editor/ItemInfo.js +1 -36
- package/dist/editor/ItemInfo.js.map +1 -1
- package/dist/editor/LinkEditorDialog.js +0 -3
- package/dist/editor/LinkEditorDialog.js.map +1 -1
- package/dist/editor/MainLayout.d.ts +2 -0
- package/dist/editor/MainLayout.js +8 -65
- package/dist/editor/MainLayout.js.map +1 -1
- package/dist/editor/MigrationsView.js +5 -29
- package/dist/editor/MigrationsView.js.map +1 -1
- package/dist/editor/MobileLayout.js +12 -37
- package/dist/editor/MobileLayout.js.map +1 -1
- package/dist/editor/PictureCropper.js +45 -54
- package/dist/editor/PictureCropper.js.map +1 -1
- package/dist/editor/PictureEditor.js +15 -17
- package/dist/editor/PictureEditor.js.map +1 -1
- package/dist/editor/QuickItemSwitcher.js +21 -21
- package/dist/editor/QuickItemSwitcher.js.map +1 -1
- package/dist/editor/SetupWizard.js +12 -52
- package/dist/editor/SetupWizard.js.map +1 -1
- package/dist/editor/Titlebar.js +2 -7
- package/dist/editor/Titlebar.js.map +1 -1
- package/dist/editor/ai/AgentCostDisplay.d.ts +0 -1
- package/dist/editor/ai/AgentCostDisplay.js +1 -1
- package/dist/editor/ai/AgentCostDisplay.js.map +1 -1
- package/dist/editor/ai/AgentDocumentList.js +14 -32
- package/dist/editor/ai/AgentDocumentList.js.map +1 -1
- package/dist/editor/ai/AgentGreeting.js +2 -3
- package/dist/editor/ai/AgentGreeting.js.map +1 -1
- package/dist/editor/ai/AgentProfileSelector.js +1 -2
- package/dist/editor/ai/AgentProfileSelector.js.map +1 -1
- package/dist/editor/ai/AgentStatusBadge.d.ts +5 -0
- package/dist/editor/ai/AgentStatusBadge.js +65 -67
- package/dist/editor/ai/AgentStatusBadge.js.map +1 -1
- package/dist/editor/ai/AgentTerminal.d.ts +2 -14
- package/dist/editor/ai/AgentTerminal.js +483 -2377
- package/dist/editor/ai/AgentTerminal.js.map +1 -1
- package/dist/editor/ai/AgentTerminalStatusBar.d.ts +3 -8
- package/dist/editor/ai/AgentTerminalStatusBar.js +56 -460
- package/dist/editor/ai/AgentTerminalStatusBar.js.map +1 -1
- package/dist/editor/ai/Agents.js +113 -150
- package/dist/editor/ai/Agents.js.map +1 -1
- package/dist/editor/ai/AiResponseMessage.d.ts +1 -10
- package/dist/editor/ai/AiResponseMessage.js +23 -238
- package/dist/editor/ai/AiResponseMessage.js.map +1 -1
- package/dist/editor/ai/ContextInfoBar.d.ts +3 -2
- package/dist/editor/ai/ContextInfoBar.js +7 -64
- package/dist/editor/ai/ContextInfoBar.js.map +1 -1
- package/dist/editor/ai/GuidanceOverlay.js +11 -17
- package/dist/editor/ai/GuidanceOverlay.js.map +1 -1
- package/dist/editor/ai/HelpTerminal.d.ts +5 -0
- package/dist/editor/ai/HelpTerminal.js +166 -0
- package/dist/editor/ai/HelpTerminal.js.map +1 -0
- package/dist/editor/ai/InlineAiDialog.d.ts +1 -1
- package/dist/editor/ai/InlineAiDialog.js +192 -514
- package/dist/editor/ai/InlineAiDialog.js.map +1 -1
- package/dist/editor/ai/InlineAiTrigger.js +12 -115
- package/dist/editor/ai/InlineAiTrigger.js.map +1 -1
- package/dist/editor/ai/MediaImage.js +8 -40
- package/dist/editor/ai/MediaImage.js.map +1 -1
- package/dist/editor/ai/SpawnedAgentsPanel.js +12 -10
- package/dist/editor/ai/SpawnedAgentsPanel.js.map +1 -1
- package/dist/editor/ai/ToolCallDisplay.d.ts +2 -22
- package/dist/editor/ai/ToolCallDisplay.js +147 -518
- package/dist/editor/ai/ToolCallDisplay.js.map +1 -1
- package/dist/editor/ai/dialogs/AgentDialogHandler.d.ts +8 -1
- package/dist/editor/ai/dialogs/AgentDialogHandler.js +42 -379
- package/dist/editor/ai/dialogs/AgentDialogHandler.js.map +1 -1
- package/dist/editor/ai/dialogs/QuestionnaireInline.d.ts +1 -5
- package/dist/editor/ai/dialogs/QuestionnaireInline.js +60 -628
- package/dist/editor/ai/dialogs/QuestionnaireInline.js.map +1 -1
- package/dist/editor/ai/dialogs/agentDialogTypes.d.ts +0 -115
- package/dist/editor/ai/dialogs/agentDialogTypes.js +0 -2
- package/dist/editor/ai/dialogs/agentDialogTypes.js.map +1 -1
- package/dist/editor/ai/types.d.ts +1 -3
- package/dist/editor/ai/useAgentStatus.d.ts +1 -2
- package/dist/editor/ai/useAgentStatus.js +99 -86
- package/dist/editor/ai/useAgentStatus.js.map +1 -1
- package/dist/editor/ai/useInlineAiPosition.js +5 -45
- package/dist/editor/ai/useInlineAiPosition.js.map +1 -1
- package/dist/editor/client/AboutDialog.js +2 -4
- package/dist/editor/client/AboutDialog.js.map +1 -1
- package/dist/editor/client/EditorShell.d.ts +1 -4
- package/dist/editor/client/EditorShell.js +230 -730
- package/dist/editor/client/EditorShell.js.map +1 -1
- package/dist/editor/client/editContext.d.ts +19 -33
- package/dist/editor/client/editContext.js.map +1 -1
- package/dist/editor/client/helpers.js +0 -6
- package/dist/editor/client/helpers.js.map +1 -1
- package/dist/editor/client/hooks/useEditorUrlSync.js +2 -1
- package/dist/editor/client/hooks/useEditorUrlSync.js.map +1 -1
- package/dist/editor/client/hooks/useEditorWebSocket.d.ts +0 -10
- package/dist/editor/client/hooks/useEditorWebSocket.js +14 -209
- package/dist/editor/client/hooks/useEditorWebSocket.js.map +1 -1
- package/dist/editor/client/hooks/useQuota.d.ts +0 -8
- package/dist/editor/client/hooks/useQuota.js.map +1 -1
- package/dist/editor/client/hooks/useSocketMessageHandler.js +7 -68
- package/dist/editor/client/hooks/useSocketMessageHandler.js.map +1 -1
- package/dist/editor/client/itemsRepository.js +6 -10
- package/dist/editor/client/itemsRepository.js.map +1 -1
- package/dist/editor/client/operations.d.ts +3 -6
- package/dist/editor/client/operations.js +30 -208
- package/dist/editor/client/operations.js.map +1 -1
- package/dist/editor/client/pageModelBuilder.js +31 -4
- package/dist/editor/client/pageModelBuilder.js.map +1 -1
- package/dist/editor/client/ui/DevModeIndicator.js +2 -2
- package/dist/editor/client/ui/DevModeIndicator.js.map +1 -1
- package/dist/editor/client/ui/EditorChrome.d.ts +6 -0
- package/dist/editor/client/ui/EditorChrome.js +72 -55
- package/dist/editor/client/ui/EditorChrome.js.map +1 -1
- package/dist/editor/client/ui/FullscreenControls.js +3 -5
- package/dist/editor/client/ui/FullscreenControls.js.map +1 -1
- package/dist/editor/commands/commands.d.ts +1 -11
- package/dist/editor/commands/commands.js +1 -12
- package/dist/editor/commands/commands.js.map +1 -1
- package/dist/editor/commands/componentCommands.js +55 -109
- package/dist/editor/commands/componentCommands.js.map +1 -1
- package/dist/editor/commands/customCommandConverter.d.ts +1 -8
- package/dist/editor/commands/customCommandConverter.js +5 -35
- package/dist/editor/commands/customCommandConverter.js.map +1 -1
- package/dist/editor/commands/handlers/agentHandler.js +1 -2
- package/dist/editor/commands/handlers/agentHandler.js.map +1 -1
- package/dist/editor/commands/itemCommands.d.ts +0 -3
- package/dist/editor/commands/itemCommands.js +10 -93
- package/dist/editor/commands/itemCommands.js.map +1 -1
- package/dist/editor/commands/undo.d.ts +15 -9
- package/dist/editor/commands/undo.js +0 -24
- package/dist/editor/commands/undo.js.map +1 -1
- package/dist/editor/context-menu/InsertMenu.js +39 -83
- package/dist/editor/context-menu/InsertMenu.js.map +1 -1
- package/dist/editor/field-types/MultiLineText.js +1 -1
- package/dist/editor/field-types/MultiLineText.js.map +1 -1
- package/dist/editor/field-types/RawEditor.js +1 -1
- package/dist/editor/field-types/ReactQuill.d.ts +125 -0
- package/dist/editor/field-types/ReactQuill.js +385 -0
- package/dist/editor/field-types/ReactQuill.js.map +1 -0
- package/dist/editor/field-types/RichTextEditor.js +5 -13
- package/dist/editor/field-types/RichTextEditor.js.map +1 -1
- package/dist/editor/field-types/RichTextEditorComponent.js +3 -37
- package/dist/editor/field-types/RichTextEditorComponent.js.map +1 -1
- package/dist/editor/field-types/SingleLineText.js +1 -1
- package/dist/editor/field-types/TreeListEditor.js +2 -3
- package/dist/editor/field-types/TreeListEditor.js.map +1 -1
- package/dist/editor/field-types/richtext/components/ReactSlate.css +5 -23
- package/dist/editor/field-types/richtext/components/ReactSlate.d.ts +0 -2
- package/dist/editor/field-types/richtext/components/ReactSlate.js +4 -28
- package/dist/editor/field-types/richtext/components/ReactSlate.js.map +1 -1
- package/dist/editor/field-types/richtext/components/ToolbarButton.js +2 -4
- package/dist/editor/field-types/richtext/components/ToolbarButton.js.map +1 -1
- package/dist/editor/field-types/richtext/contextMenuFactory.d.ts +0 -13
- package/dist/editor/field-types/richtext/contextMenuFactory.js +24 -181
- package/dist/editor/field-types/richtext/contextMenuFactory.js.map +1 -1
- package/dist/editor/field-types/richtext/types.d.ts +0 -2
- package/dist/editor/field-types/richtext/types.js.map +1 -1
- package/dist/editor/field-types/richtext/utils/plugins.js +0 -4
- package/dist/editor/field-types/richtext/utils/plugins.js.map +1 -1
- package/dist/editor/field-types/textContextMenuFactory.js +2 -3
- package/dist/editor/field-types/textContextMenuFactory.js.map +1 -1
- package/dist/editor/media-selector/AiImageSearchPrompt.js +2 -4
- package/dist/editor/media-selector/AiImageSearchPrompt.js.map +1 -1
- package/dist/editor/media-selector/MediaFolderBrowser.js +1 -1
- package/dist/editor/media-selector/MediaFolderBrowser.js.map +1 -1
- package/dist/editor/media-selector/MediaSelector.js +1 -7
- package/dist/editor/media-selector/MediaSelector.js.map +1 -1
- package/dist/editor/media-selector/TreeSelector.js +35 -40
- package/dist/editor/media-selector/TreeSelector.js.map +1 -1
- package/dist/editor/menubar/ActiveUsers.js +1 -1
- package/dist/editor/menubar/ActiveUsers.js.map +1 -1
- package/dist/editor/menubar/GenericToolbar.js +2 -4
- package/dist/editor/menubar/GenericToolbar.js.map +1 -1
- package/dist/editor/menubar/ItemLanguageVersion.js +2 -2
- package/dist/editor/menubar/ItemLanguageVersion.js.map +1 -1
- package/dist/editor/menubar/PageSelector.js +147 -26
- package/dist/editor/menubar/PageSelector.js.map +1 -1
- package/dist/editor/menubar/Separator.js +1 -1
- package/dist/editor/menubar/VersionSelector.js +4 -2
- package/dist/editor/menubar/VersionSelector.js.map +1 -1
- package/dist/editor/menubar/WorkflowButton.js +12 -39
- package/dist/editor/menubar/WorkflowButton.js.map +1 -1
- package/dist/editor/menubar/toolbar-sections/CustomCommandsToolbar.js +38 -16
- package/dist/editor/menubar/toolbar-sections/CustomCommandsToolbar.js.map +1 -1
- package/dist/editor/menubar/toolbar-sections/EditControls.js +3 -3
- package/dist/editor/menubar/toolbar-sections/EditControls.js.map +1 -1
- package/dist/editor/menubar/toolbar-sections/HelpButton.js +0 -1
- package/dist/editor/menubar/toolbar-sections/HelpButton.js.map +1 -1
- package/dist/editor/menubar/toolbar-sections/ManualBrowser.d.ts +10 -6
- package/dist/editor/menubar/toolbar-sections/ManualBrowser.js +220 -597
- package/dist/editor/menubar/toolbar-sections/ManualBrowser.js.map +1 -1
- package/dist/editor/menubar/toolbar-sections/UtilityControls.js +2 -13
- package/dist/editor/menubar/toolbar-sections/UtilityControls.js.map +1 -1
- package/dist/editor/page-editor-chrome/CommentHighlighting.js +1 -42
- package/dist/editor/page-editor-chrome/CommentHighlighting.js.map +1 -1
- package/dist/editor/page-editor-chrome/FrameMenu.js +1 -1
- package/dist/editor/page-editor-chrome/FrameMenu.js.map +1 -1
- package/dist/editor/page-editor-chrome/InlineEditor.js +48 -97
- package/dist/editor/page-editor-chrome/InlineEditor.js.map +1 -1
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.js +17 -38
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.js.map +1 -1
- package/dist/editor/page-editor-chrome/PlaceholderDropZones.js +11 -17
- package/dist/editor/page-editor-chrome/PlaceholderDropZones.js.map +1 -1
- package/dist/editor/page-editor-chrome/useInlineAICompletion.js +301 -301
- package/dist/editor/page-editor-chrome/useInlineAICompletion.js.map +1 -1
- package/dist/editor/page-viewer/DeviceToolbar.js +1 -1
- package/dist/editor/page-viewer/DeviceToolbar.js.map +1 -1
- package/dist/editor/page-viewer/EditorForm.js +11 -69
- package/dist/editor/page-viewer/EditorForm.js.map +1 -1
- package/dist/editor/page-viewer/MiniMap.d.ts +4 -2
- package/dist/editor/page-viewer/MiniMap.js +28 -91
- package/dist/editor/page-viewer/MiniMap.js.map +1 -1
- package/dist/editor/page-viewer/PageViewer.d.ts +1 -3
- package/dist/editor/page-viewer/PageViewer.js +19 -92
- package/dist/editor/page-viewer/PageViewer.js.map +1 -1
- package/dist/editor/page-viewer/PageViewerFrame.d.ts +1 -2
- package/dist/editor/page-viewer/PageViewerFrame.js +115 -348
- package/dist/editor/page-viewer/PageViewerFrame.js.map +1 -1
- package/dist/editor/page-viewer/pageModelSkeletonBuilder.js +49 -114
- package/dist/editor/page-viewer/pageModelSkeletonBuilder.js.map +1 -1
- package/dist/editor/page-viewer/pageViewContext.d.ts +0 -1
- package/dist/editor/page-viewer/pageViewContext.js +14 -51
- package/dist/editor/page-viewer/pageViewContext.js.map +1 -1
- package/dist/editor/pageModel.d.ts +1 -14
- package/dist/editor/reviews/Comment.js +12 -26
- package/dist/editor/reviews/Comment.js.map +1 -1
- package/dist/editor/reviews/CommentDisplayPopover.js +5 -7
- package/dist/editor/reviews/CommentDisplayPopover.js.map +1 -1
- package/dist/editor/reviews/CommentView.js +4 -19
- package/dist/editor/reviews/CommentView.js.map +1 -1
- package/dist/editor/reviews/Comments.js +72 -89
- package/dist/editor/reviews/Comments.js.map +1 -1
- package/dist/editor/reviews/CreateReviewDialog.js +177 -281
- package/dist/editor/reviews/CreateReviewDialog.js.map +1 -1
- package/dist/editor/reviews/DecisionsMatrix.js +25 -96
- package/dist/editor/reviews/DecisionsMatrix.js.map +1 -1
- package/dist/editor/reviews/DiffView.js +14 -7
- package/dist/editor/reviews/DiffView.js.map +1 -1
- package/dist/editor/reviews/EditReviewSettingsDialog.js +4 -6
- package/dist/editor/reviews/EditReviewSettingsDialog.js.map +1 -1
- package/dist/editor/reviews/MultiReviewManager.js +3 -25
- package/dist/editor/reviews/MultiReviewManager.js.map +1 -1
- package/dist/editor/reviews/PagesPanel.js +15 -31
- package/dist/editor/reviews/PagesPanel.js.map +1 -1
- package/dist/editor/reviews/PreviewInfo.js +4 -1
- package/dist/editor/reviews/PreviewInfo.js.map +1 -1
- package/dist/editor/reviews/ReviewCard.js +7 -13
- package/dist/editor/reviews/ReviewCard.js.map +1 -1
- package/dist/editor/reviews/ReviewDetail.js +2 -3
- package/dist/editor/reviews/ReviewDetail.js.map +1 -1
- package/dist/editor/reviews/ReviewsList.js +3 -7
- package/dist/editor/reviews/ReviewsList.js.map +1 -1
- package/dist/editor/reviews/SuggestedEdit.js +3 -34
- package/dist/editor/reviews/SuggestedEdit.js.map +1 -1
- package/dist/editor/reviews/SuggestionDisplayPopover.js +5 -31
- package/dist/editor/reviews/SuggestionDisplayPopover.js.map +1 -1
- package/dist/editor/reviews/commentAi.js +6 -25
- package/dist/editor/reviews/commentAi.js.map +1 -1
- package/dist/editor/reviews/reviewCommands.js +1 -4
- package/dist/editor/reviews/reviewCommands.js.map +1 -1
- package/dist/editor/reviews/useMultiReview.js +2 -2
- package/dist/editor/reviews/useMultiReview.js.map +1 -1
- package/dist/editor/reviews/useReviews.d.ts +2 -2
- package/dist/editor/reviews/useReviews.js +30 -12
- package/dist/editor/reviews/useReviews.js.map +1 -1
- package/dist/editor/services/agentService.d.ts +5 -229
- package/dist/editor/services/agentService.js +39 -292
- package/dist/editor/services/agentService.js.map +1 -1
- package/dist/editor/services/aiService.d.ts +1 -57
- package/dist/editor/services/aiService.js +6 -79
- package/dist/editor/services/aiService.js.map +1 -1
- package/dist/editor/services/contentService.d.ts +3 -6
- package/dist/editor/services/contentService.js +12 -13
- package/dist/editor/services/contentService.js.map +1 -1
- package/dist/editor/services/editService.d.ts +1 -52
- package/dist/editor/services/editService.js +2 -94
- package/dist/editor/services/editService.js.map +1 -1
- package/dist/editor/services/indexService.js +1 -1
- package/dist/editor/services/indexService.js.map +1 -1
- package/dist/editor/services/reviewsService.d.ts +6 -3
- package/dist/editor/services/reviewsService.js +11 -2
- package/dist/editor/services/reviewsService.js.map +1 -1
- package/dist/editor/services/serviceHelper.d.ts +1 -2
- package/dist/editor/services/serviceHelper.js +20 -112
- package/dist/editor/services/serviceHelper.js.map +1 -1
- package/dist/editor/services/systemService.d.ts +1 -2
- package/dist/editor/services/systemService.js +0 -3
- package/dist/editor/services/systemService.js.map +1 -1
- package/dist/editor/services-server/api.d.ts +2 -1
- package/dist/editor/services-server/api.js +6 -11
- package/dist/editor/services-server/api.js.map +1 -1
- package/dist/editor/services-server/graphQL.d.ts +29 -0
- package/dist/editor/services-server/graphQL.js +53 -0
- package/dist/editor/services-server/graphQL.js.map +1 -0
- package/dist/editor/settings/About.js +3 -317
- package/dist/editor/settings/About.js.map +1 -1
- package/dist/editor/settings/AllAgentsPanel.d.ts +5 -0
- package/dist/editor/settings/AllAgentsPanel.js +139 -0
- package/dist/editor/settings/AllAgentsPanel.js.map +1 -0
- package/dist/editor/settings/LatestFeedback.d.ts +1 -0
- package/dist/editor/settings/LatestFeedback.js +136 -0
- package/dist/editor/settings/LatestFeedback.js.map +1 -0
- package/dist/editor/settings/QuotaInfo.js +4 -210
- package/dist/editor/settings/QuotaInfo.js.map +1 -1
- package/dist/editor/settings/SettingsView.js +23 -25
- package/dist/editor/settings/SettingsView.js.map +1 -1
- package/dist/editor/settings/Setup.d.ts +1 -0
- package/dist/editor/settings/Setup.js +211 -0
- package/dist/editor/settings/Setup.js.map +1 -0
- package/dist/editor/settings/Status.js +6 -7
- package/dist/editor/settings/Status.js.map +1 -1
- package/dist/editor/settings/index/useIndexStatus.js +22 -20
- package/dist/editor/settings/index/useIndexStatus.js.map +1 -1
- package/dist/editor/settings/panels/AgentsPanel.d.ts +4 -0
- package/dist/editor/settings/panels/AgentsPanel.js +121 -95
- package/dist/editor/settings/panels/AgentsPanel.js.map +1 -1
- package/dist/editor/settings/panels/DatabasePanel.d.ts +6 -0
- package/dist/editor/settings/panels/DatabasePanel.js +50 -0
- package/dist/editor/settings/panels/DatabasePanel.js.map +1 -0
- package/dist/editor/settings/panels/ModelsPanel.js +108 -329
- package/dist/editor/settings/panels/ModelsPanel.js.map +1 -1
- package/dist/editor/settings/panels/ProvidersPanel.d.ts +1 -1
- package/dist/editor/settings/panels/ProvidersPanel.js +59 -86
- package/dist/editor/settings/panels/ProvidersPanel.js.map +1 -1
- package/dist/editor/settings/panels/SearchConfigPanel.js +4 -4
- package/dist/editor/settings/panels/SearchConfigPanel.js.map +1 -1
- package/dist/editor/settings/panels/index.d.ts +2 -3
- package/dist/editor/settings/panels/index.js +2 -3
- package/dist/editor/settings/panels/index.js.map +1 -1
- package/dist/editor/settings/setup-steps/AiSetupStep/EmbeddingsModelSection.d.ts +2 -0
- package/dist/editor/settings/setup-steps/AiSetupStep/EmbeddingsModelSection.js +195 -0
- package/dist/editor/settings/setup-steps/AiSetupStep/EmbeddingsModelSection.js.map +1 -0
- package/dist/editor/settings/setup-steps/AiSetupStep/index.d.ts +2 -0
- package/dist/editor/settings/setup-steps/AiSetupStep/index.js +21 -0
- package/dist/editor/settings/setup-steps/AiSetupStep/index.js.map +1 -0
- package/dist/editor/settings/setup-steps/AiSetupStep/provider/ProviderSection.d.ts +1 -0
- package/dist/editor/settings/setup-steps/AiSetupStep/provider/ProviderSection.js +233 -0
- package/dist/editor/settings/setup-steps/AiSetupStep/provider/ProviderSection.js.map +1 -0
- package/dist/editor/settings/setup-steps/AiSetupStep/required-containers/RequiredContainersList.d.ts +15 -0
- package/dist/editor/settings/setup-steps/AiSetupStep/required-containers/RequiredContainersList.js +14 -0
- package/dist/editor/settings/setup-steps/AiSetupStep/required-containers/RequiredContainersList.js.map +1 -0
- package/dist/editor/settings/setup-steps/AiSetupStep/required-containers/RequiredContainersSection.d.ts +1 -0
- package/dist/editor/settings/setup-steps/AiSetupStep/required-containers/RequiredContainersSection.js +94 -0
- package/dist/editor/settings/setup-steps/AiSetupStep/required-containers/RequiredContainersSection.js.map +1 -0
- package/dist/editor/settings/setup-steps/AiSetupStep/types.d.ts +1 -0
- package/dist/editor/settings/setup-steps/AiSetupStep/types.js +2 -0
- package/dist/editor/settings/setup-steps/AiSetupStep/types.js.map +1 -0
- package/dist/editor/settings/setup-steps/AiSetupStep/utils.d.ts +5 -0
- package/dist/editor/settings/setup-steps/AiSetupStep/utils.js +44 -0
- package/dist/editor/settings/setup-steps/AiSetupStep/utils.js.map +1 -0
- package/dist/editor/settings/setup-steps/IndexSetupStep.d.ts +2 -0
- package/dist/editor/settings/setup-steps/IndexSetupStep.js +36 -0
- package/dist/editor/settings/setup-steps/IndexSetupStep.js.map +1 -0
- package/dist/editor/settings/setup-steps/SettingsSetupStep.d.ts +2 -0
- package/dist/editor/settings/setup-steps/SettingsSetupStep.js +111 -0
- package/dist/editor/settings/setup-steps/SettingsSetupStep.js.map +1 -0
- package/dist/editor/settings/setup-steps/SetupOverview.d.ts +14 -0
- package/dist/editor/settings/setup-steps/SetupOverview.js +38 -0
- package/dist/editor/settings/setup-steps/SetupOverview.js.map +1 -0
- package/dist/editor/settings/status/coreStatusChecks.js +19 -124
- package/dist/editor/settings/status/coreStatusChecks.js.map +1 -1
- package/dist/editor/settings/status/useStartupChecks.d.ts +1 -3
- package/dist/editor/settings/status/useStartupChecks.js +5 -9
- package/dist/editor/settings/status/useStartupChecks.js.map +1 -1
- package/dist/editor/setup-wizard/steps/CompleteStep.d.ts +1 -2
- package/dist/editor/setup-wizard/steps/CompleteStep.js +1 -2
- package/dist/editor/setup-wizard/steps/CompleteStep.js.map +1 -1
- package/dist/editor/sidebar/ComponentPalette.js +1 -2
- package/dist/editor/sidebar/ComponentPalette.js.map +1 -1
- package/dist/editor/sidebar/ComponentTree.d.ts +1 -8
- package/dist/editor/sidebar/ComponentTree.js +69 -216
- package/dist/editor/sidebar/ComponentTree.js.map +1 -1
- package/dist/editor/sidebar/Debug.d.ts +1 -0
- package/dist/editor/sidebar/Debug.js +70 -0
- package/dist/editor/sidebar/Debug.js.map +1 -0
- package/dist/editor/sidebar/EditHistory.js +46 -22
- package/dist/editor/sidebar/EditHistory.js.map +1 -1
- package/dist/editor/sidebar/Favorites.js +8 -4
- package/dist/editor/sidebar/Favorites.js.map +1 -1
- package/dist/editor/sidebar/GraphQL.d.ts +2 -0
- package/dist/editor/sidebar/GraphQL.js +234 -0
- package/dist/editor/sidebar/GraphQL.js.map +1 -0
- package/dist/editor/sidebar/LeftToolbar.d.ts +1 -0
- package/dist/editor/sidebar/LeftToolbar.js +12 -0
- package/dist/editor/sidebar/LeftToolbar.js.map +1 -0
- package/dist/editor/sidebar/MainContentTree.js +3 -4
- package/dist/editor/sidebar/MainContentTree.js.map +1 -1
- package/dist/editor/sidebar/NavigationSidebar.d.ts +4 -0
- package/dist/editor/sidebar/NavigationSidebar.js +254 -0
- package/dist/editor/sidebar/NavigationSidebar.js.map +1 -0
- package/dist/editor/sidebar/OperationItem.js +7 -21
- package/dist/editor/sidebar/OperationItem.js.map +1 -1
- package/dist/editor/sidebar/SidebarPanel.d.ts +1 -3
- package/dist/editor/sidebar/SidebarPanel.js +12 -44
- package/dist/editor/sidebar/SidebarPanel.js.map +1 -1
- package/dist/editor/sidebar/SidebarStack.d.ts +1 -2
- package/dist/editor/sidebar/SidebarStack.js +3 -4
- package/dist/editor/sidebar/SidebarStack.js.map +1 -1
- package/dist/editor/sidebar/Validation.js +12 -22
- package/dist/editor/sidebar/Validation.js.map +1 -1
- package/dist/editor/sidebar/Workbox.js +3 -53
- package/dist/editor/sidebar/Workbox.js.map +1 -1
- package/dist/editor/sidebar/WorkspaceRail.d.ts +1 -0
- package/dist/editor/sidebar/WorkspaceRail.js +167 -56
- package/dist/editor/sidebar/WorkspaceRail.js.map +1 -1
- package/dist/editor/tree-indicators/GutterColumns.d.ts +1 -3
- package/dist/editor/tree-indicators/GutterColumns.js +5 -26
- package/dist/editor/tree-indicators/GutterColumns.js.map +1 -1
- package/dist/editor/tree-indicators/GutterContext.d.ts +0 -4
- package/dist/editor/tree-indicators/GutterContext.js +0 -23
- package/dist/editor/tree-indicators/GutterContext.js.map +1 -1
- package/dist/editor/tree-indicators/GutterSelector.d.ts +5 -0
- package/dist/editor/tree-indicators/GutterSelector.js +91 -0
- package/dist/editor/tree-indicators/GutterSelector.js.map +1 -0
- package/dist/editor/tree-indicators/index.d.ts +1 -0
- package/dist/editor/tree-indicators/index.js +1 -0
- package/dist/editor/tree-indicators/index.js.map +1 -1
- package/dist/editor/tree-indicators/types.d.ts +1 -12
- package/dist/editor/ui/CopyMoveTargetSelectorDialog.js +1 -1
- package/dist/editor/ui/CopyMoveTargetSelectorDialog.js.map +1 -1
- package/dist/editor/ui/Icons.js +1 -1
- package/dist/editor/ui/Icons.js.map +1 -1
- package/dist/editor/ui/ItemNameDialogNew.d.ts +0 -2
- package/dist/editor/ui/ItemNameDialogNew.js +17 -33
- package/dist/editor/ui/ItemNameDialogNew.js.map +1 -1
- package/dist/editor/ui/ItemSearch.js +11 -7
- package/dist/editor/ui/ItemSearch.js.map +1 -1
- package/dist/editor/ui/SimpleIconButton.js +1 -1
- package/dist/editor/ui/SimpleIconButton.js.map +1 -1
- package/dist/editor/ui/SimpleTabs.d.ts +0 -1
- package/dist/editor/ui/SimpleTabs.js +25 -45
- package/dist/editor/ui/SimpleTabs.js.map +1 -1
- package/dist/editor/ui/Splitter.d.ts +0 -1
- package/dist/editor/ui/Splitter.js +86 -102
- package/dist/editor/ui/Splitter.js.map +1 -1
- package/dist/editor/ui/TemplateSelectorDialog.js +4 -4
- package/dist/editor/ui/TemplateSelectorDialog.js.map +1 -1
- package/dist/editor/ui/TreeListSelector.d.ts +1 -6
- package/dist/editor/ui/TreeListSelector.js +2 -2
- package/dist/editor/ui/TreeListSelector.js.map +1 -1
- package/dist/editor/utils/keyboardNavigation.d.ts +20 -6
- package/dist/editor/utils/keyboardNavigation.js +140 -48
- package/dist/editor/utils/keyboardNavigation.js.map +1 -1
- package/dist/editor/utils.js +9 -19
- package/dist/editor/utils.js.map +1 -1
- package/dist/editor/views/CompareView.d.ts +1 -3
- package/dist/editor/views/CompareView.js +5 -7
- package/dist/editor/views/CompareView.js.map +1 -1
- package/dist/editor/views/EditView.js +1 -1
- package/dist/editor/views/EditView.js.map +1 -1
- package/dist/editor/views/EditorSlot.js +34 -27
- package/dist/editor/views/EditorSlot.js.map +1 -1
- package/dist/editor/views/ItemEditor.js +3 -7
- package/dist/editor/views/ItemEditor.js.map +1 -1
- package/dist/editor/views/MediaFolderEditView.js +1 -1
- package/dist/editor/views/MediaFolderEditView.js.map +1 -1
- package/dist/editor/views/ParheliaView.js +6 -5
- package/dist/editor/views/ParheliaView.js.map +1 -1
- package/dist/editor/views/SingleEditView.d.ts +1 -2
- package/dist/editor/views/SingleEditView.js +8 -10
- package/dist/editor/views/SingleEditView.js.map +1 -1
- package/dist/editor/views/editorSlotContext.js +6 -35
- package/dist/editor/views/editorSlotContext.js.map +1 -1
- package/dist/index.d.ts +2 -16
- package/dist/index.js +0 -11
- package/dist/index.js.map +1 -1
- package/dist/revision.d.ts +2 -2
- package/dist/revision.js +2 -2
- package/dist/setup/services/setupWizardService.d.ts +13 -40
- package/dist/setup/services/setupWizardService.js +17 -32
- package/dist/setup/services/setupWizardService.js.map +1 -1
- package/dist/setup/wizard/steps/AddModelDialog.js +3 -12
- package/dist/setup/wizard/steps/AddModelDialog.js.map +1 -1
- package/dist/setup/wizard/steps/ImportModelDialog.js +22 -39
- package/dist/setup/wizard/steps/ImportModelDialog.js.map +1 -1
- package/dist/splash-screen/ModernSplashScreen.js +32 -112
- package/dist/splash-screen/ModernSplashScreen.js.map +1 -1
- package/dist/splash-screen/NewPage.js +50 -33
- package/dist/splash-screen/NewPage.js.map +1 -1
- package/dist/splash-screen/OpenPage.js +6 -2
- package/dist/splash-screen/OpenPage.js.map +1 -1
- package/dist/splash-screen/ParheliaAssistantChat.js +29 -12
- package/dist/splash-screen/ParheliaAssistantChat.js.map +1 -1
- package/dist/splash-screen/ParheliaLogo.js +37 -87
- package/dist/splash-screen/ParheliaLogo.js.map +1 -1
- package/dist/splash-screen/RecentPages.js +3 -3
- package/dist/splash-screen/RecentPages.js.map +1 -1
- package/dist/tour/Tour.d.ts +1 -2
- package/dist/tour/Tour.js +75 -256
- package/dist/tour/Tour.js.map +1 -1
- package/dist/tour/default-tour.js +96 -222
- package/dist/tour/default-tour.js.map +1 -1
- package/dist/types.d.ts +29 -63
- package/package.json +15 -19
- package/styles.css +10 -14
|
@@ -1,435 +1,38 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
2
|
-
import { useState, useCallback, useMemo
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useCallback, useMemo } from "react";
|
|
3
3
|
import { Button } from "../../../components/ui/button";
|
|
4
4
|
import { Checkbox } from "../../../components/ui/checkbox";
|
|
5
5
|
import { Textarea } from "../../../components/ui/textarea";
|
|
6
|
-
import { X, ClipboardList, MessageSquare
|
|
7
|
-
import { ItemCollectionEditor, } from "../../ui/ItemCollectionEditor";
|
|
8
|
-
import { TreeListSelector } from "../../ui/TreeListSelector";
|
|
9
|
-
import { useEditContext } from "../../client/editContext";
|
|
10
|
-
import { cn } from "../../../lib/utils";
|
|
11
|
-
import { uploadDocument } from "../../services/agentService";
|
|
12
|
-
import { uploadAttachmentFile } from "../../../task-board/services/taskService";
|
|
13
|
-
const questionnaireDrafts = new Map();
|
|
14
|
-
const questionnairePendingFileDrafts = new Map();
|
|
15
|
-
const QUESTIONNAIRE_MAX_FILE_SIZE_MB = 10;
|
|
16
|
-
const QUESTIONNAIRE_MAX_FILE_SIZE_BYTES = QUESTIONNAIRE_MAX_FILE_SIZE_MB * 1024 * 1024;
|
|
17
|
-
const QUESTIONNAIRE_FILE_ACCEPT = ".txt,.md,.pdf,.docx,.xlsx,.pptx,.csv,.json,.xml,.cs,.js,.ts,.tsx,.jsx,.py,.java,.cpp,.c,.h,.hpp,.cshtml,.razor,.vb,.php,.rb,.go,.rs,.swift,.kt,.scala,.sql,.sh,.ps1,.bat,.yaml,.yml,.png,.jpg,.jpeg,.gif,.webp";
|
|
18
|
-
function isItemSelectionType(type) {
|
|
19
|
-
return type === "item-picker" || type === "item-collection";
|
|
20
|
-
}
|
|
21
|
-
function isFileUploadType(type) {
|
|
22
|
-
return type === "file-upload";
|
|
23
|
-
}
|
|
24
|
-
function createEmptyAnswer(questionId) {
|
|
25
|
-
return {
|
|
26
|
-
questionId,
|
|
27
|
-
selectedOptions: [],
|
|
28
|
-
selectedItems: [],
|
|
29
|
-
uploadedDocuments: [],
|
|
30
|
-
freetext: undefined,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function shouldStoreInAgentDocumentStore(question) {
|
|
34
|
-
return question.storeInAgentDocumentStore !== false;
|
|
35
|
-
}
|
|
36
|
-
function toUploadedDocumentReference(document) {
|
|
37
|
-
if (!document) {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
return {
|
|
41
|
-
id: document.id,
|
|
42
|
-
agentId: document.agentId,
|
|
43
|
-
fileName: document.fileName,
|
|
44
|
-
fileSize: document.fileSize,
|
|
45
|
-
contentType: document.contentType,
|
|
46
|
-
uploadedBy: document.uploadedBy,
|
|
47
|
-
uploadedDate: document.uploadedDate,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
function toUploadedDocumentReferenceFromTaskAttachment(attachment) {
|
|
51
|
-
return {
|
|
52
|
-
fileName: attachment.fileName,
|
|
53
|
-
fileSize: attachment.fileSize,
|
|
54
|
-
contentType: attachment.fileType ?? undefined,
|
|
55
|
-
uploadedBy: attachment.uploadedBy,
|
|
56
|
-
uploadedDate: attachment.uploadedAt,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
function toItemCollectionItems(selectedItems, language) {
|
|
60
|
-
return (selectedItems ?? []).map((item) => ({
|
|
61
|
-
descriptor: {
|
|
62
|
-
id: item.id,
|
|
63
|
-
language,
|
|
64
|
-
version: 1,
|
|
65
|
-
name: item.name || "",
|
|
66
|
-
displayName: item.name || "",
|
|
67
|
-
path: item.path || "",
|
|
68
|
-
},
|
|
69
|
-
includeSubitems: Boolean(item.includeSubitems),
|
|
70
|
-
}));
|
|
71
|
-
}
|
|
72
|
-
function toSelectedItems(items) {
|
|
73
|
-
return items.map((item) => ({
|
|
74
|
-
id: item.descriptor.id,
|
|
75
|
-
name: item.descriptor.displayName ||
|
|
76
|
-
item.descriptor.name ||
|
|
77
|
-
item.descriptor.path ||
|
|
78
|
-
item.descriptor.id,
|
|
79
|
-
path: item.descriptor.path,
|
|
80
|
-
includeSubitems: item.includeSubitems,
|
|
81
|
-
}));
|
|
82
|
-
}
|
|
83
|
-
function createInitialAnswers(parameters, savedAnswers) {
|
|
84
|
-
const initial = new Map();
|
|
85
|
-
parameters.questions.forEach((q) => {
|
|
86
|
-
const preselectedItems = isItemSelectionType(q.type)
|
|
87
|
-
? (q.preselectedItemIds ?? [])
|
|
88
|
-
.slice(q.type === "item-picker" && !q.allowMultiple ? -1 : 0)
|
|
89
|
-
.filter((id) => Boolean(id && id.trim()))
|
|
90
|
-
.map((id) => ({
|
|
91
|
-
id,
|
|
92
|
-
includeSubitems: false,
|
|
93
|
-
}))
|
|
94
|
-
: [];
|
|
95
|
-
const savedAnswer = savedAnswers?.get(q.id);
|
|
96
|
-
const isTextQuestion = !isItemSelectionType(q.type) &&
|
|
97
|
-
!isFileUploadType(q.type) &&
|
|
98
|
-
(q.options?.length ?? 0) === 0;
|
|
99
|
-
initial.set(q.id, {
|
|
100
|
-
questionId: q.id,
|
|
101
|
-
selectedOptions: savedAnswer?.selectedOptions ?? [],
|
|
102
|
-
selectedItems: savedAnswer?.selectedItems ?? preselectedItems,
|
|
103
|
-
uploadedDocuments: savedAnswer?.uploadedDocuments ?? [],
|
|
104
|
-
freetext: savedAnswer?.freetext ?? (isTextQuestion ? q.default : undefined),
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
return initial;
|
|
108
|
-
}
|
|
109
|
-
function createInitialPendingFiles(parameters, savedFiles) {
|
|
110
|
-
const initial = new Map();
|
|
111
|
-
parameters.questions.forEach((question) => {
|
|
112
|
-
if (!isFileUploadType(question.type)) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
initial.set(question.id, [...(savedFiles?.get(question.id) ?? [])]);
|
|
116
|
-
});
|
|
117
|
-
return initial;
|
|
118
|
-
}
|
|
119
|
-
function QuestionnaireFileUploadField({ questionId, agentId, allowMultiple, selectedFiles, submissionError, disabled, storeInAgentDocumentStore, attachToTaskIfAvailable, taskId, onChange, }) {
|
|
120
|
-
const [isDragOver, setIsDragOver] = useState(false);
|
|
121
|
-
const [selectionError, setSelectionError] = useState(null);
|
|
122
|
-
const fileInputRef = useRef(null);
|
|
123
|
-
const canStoreInAgentDocumentStore = storeInAgentDocumentStore !== false;
|
|
124
|
-
const canAttachToTask = Boolean(attachToTaskIfAvailable && taskId);
|
|
125
|
-
const hasUploadDestination = canAttachToTask || Boolean(agentId && canStoreInAgentDocumentStore);
|
|
126
|
-
const handleFiles = useCallback((files) => {
|
|
127
|
-
if (!files || files.length === 0) {
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
if (!hasUploadDestination) {
|
|
131
|
-
setSelectionError("File upload is unavailable because this questionnaire has no valid upload destination.");
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
const nextValidFiles = [];
|
|
135
|
-
let nextError = null;
|
|
136
|
-
for (const file of Array.from(files)) {
|
|
137
|
-
if (file.size > QUESTIONNAIRE_MAX_FILE_SIZE_BYTES) {
|
|
138
|
-
nextError = `File "${file.name}" exceeds the maximum size of ${QUESTIONNAIRE_MAX_FILE_SIZE_MB} MB.`;
|
|
139
|
-
continue;
|
|
140
|
-
}
|
|
141
|
-
nextValidFiles.push(file);
|
|
142
|
-
}
|
|
143
|
-
if (nextValidFiles.length === 0) {
|
|
144
|
-
setSelectionError(nextError);
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
setSelectionError(nextError);
|
|
148
|
-
onChange(allowMultiple
|
|
149
|
-
? [...selectedFiles, ...nextValidFiles]
|
|
150
|
-
: nextValidFiles.slice(0, 1));
|
|
151
|
-
}, [allowMultiple, hasUploadDestination, onChange, selectedFiles]);
|
|
152
|
-
const removeSelectedFile = useCallback((fileIndex) => {
|
|
153
|
-
onChange(selectedFiles.filter((_, index) => index !== fileIndex));
|
|
154
|
-
}, [onChange, selectedFiles]);
|
|
155
|
-
return (_jsxs("div", { className: "space-y-2", children: [_jsx("div", { "data-testid": "questionnaire-file-upload", "data-question-id": questionId, className: cn("rounded-lg border-2 border-dashed p-3 transition-colors", isDragOver
|
|
156
|
-
? "border-indigo-400 bg-indigo-50"
|
|
157
|
-
: "border-gray-200 bg-gray-50/70"), onDragOver: (event) => {
|
|
158
|
-
event.preventDefault();
|
|
159
|
-
event.stopPropagation();
|
|
160
|
-
setIsDragOver(true);
|
|
161
|
-
}, onDragEnter: (event) => {
|
|
162
|
-
event.preventDefault();
|
|
163
|
-
event.stopPropagation();
|
|
164
|
-
setIsDragOver(true);
|
|
165
|
-
}, onDragLeave: (event) => {
|
|
166
|
-
event.preventDefault();
|
|
167
|
-
event.stopPropagation();
|
|
168
|
-
setIsDragOver(false);
|
|
169
|
-
}, onDrop: (event) => {
|
|
170
|
-
event.preventDefault();
|
|
171
|
-
event.stopPropagation();
|
|
172
|
-
setIsDragOver(false);
|
|
173
|
-
handleFiles(event.dataTransfer.files);
|
|
174
|
-
}, children: _jsxs("div", { className: "flex items-start gap-2", children: [_jsx(FileUp, { className: "mt-0.5 h-4 w-4 shrink-0 text-indigo-500" }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("p", { className: "text-xs font-medium text-gray-700", children: allowMultiple
|
|
175
|
-
? "Drop files here or browse to attach"
|
|
176
|
-
: "Drop a file here or browse to attach" }), _jsxs("p", { className: "mt-0.5 text-[11px] text-gray-500", children: ["Files stay local until you submit the questionnaire. Max", " ", QUESTIONNAIRE_MAX_FILE_SIZE_MB, " MB per file.", canStoreInAgentDocumentStore
|
|
177
|
-
? " Submitted files will be stored with this agent."
|
|
178
|
-
: "", canAttachToTask
|
|
179
|
-
? canStoreInAgentDocumentStore
|
|
180
|
-
? " They will also be attached to the current task."
|
|
181
|
-
: " Submitted files will be attached to the current task."
|
|
182
|
-
: ""] }), _jsxs("div", { className: "mt-2", children: [_jsx("input", { ref: fileInputRef, "data-testid": "questionnaire-file-input", "data-question-id": questionId, type: "file", className: "hidden", multiple: allowMultiple, accept: QUESTIONNAIRE_FILE_ACCEPT, onChange: (event) => {
|
|
183
|
-
handleFiles(event.target.files);
|
|
184
|
-
event.target.value = "";
|
|
185
|
-
} }), _jsx(Button, { type: "button", variant: "outline", size: "sm", disabled: disabled || !hasUploadDestination, onClick: () => fileInputRef.current?.click(), className: "h-8 text-xs", children: allowMultiple ? "Browse Files" : "Browse File" })] })] })] }) }), (selectionError || submissionError) && (_jsx("div", { "data-testid": "questionnaire-file-upload-error", "data-question-id": questionId, className: "rounded border border-red-200 bg-red-50 px-2 py-1.5 text-[11px] text-red-700", children: selectionError || submissionError })), selectedFiles.length > 0 && (_jsx("div", { className: "flex flex-wrap gap-2", children: selectedFiles.map((file, index) => (_jsxs("span", { "data-testid": "questionnaire-selected-file", "data-question-id": questionId, className: "inline-flex items-center gap-1.5 rounded-full border border-gray-200 bg-white px-2 py-1 text-xs text-gray-700", title: file.name, children: [_jsx(Paperclip, { className: "h-3 w-3 text-gray-500" }), _jsx("span", { className: "max-w-[220px] truncate", children: file.name }), _jsx("button", { type: "button", "data-testid": "questionnaire-remove-selected-file", "data-file-index": index, onClick: () => removeSelectedFile(index), className: "rounded p-0.5 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600", "aria-label": `Remove ${file.name}`, children: _jsx(Trash2, { className: "h-3 w-3" }) })] }, `${file.name}-${file.size}-${index}`))) }))] }));
|
|
186
|
-
}
|
|
187
|
-
function QuestionnaireItemCollectionField({ questionId, rootItemId, answer, language, onChange, }) {
|
|
188
|
-
const editContext = useEditContext();
|
|
189
|
-
const items = useMemo(() => toItemCollectionItems(answer?.selectedItems, language), [answer?.selectedItems, language]);
|
|
190
|
-
const [selectedInTree, setSelectedInTree] = useState([]);
|
|
191
|
-
const [selectedFromList, setSelectedFromList] = useState([]);
|
|
192
|
-
useEffect(() => {
|
|
193
|
-
setSelectedInTree([]);
|
|
194
|
-
setSelectedFromList([]);
|
|
195
|
-
}, [answer?.selectedItems]);
|
|
196
|
-
const commitItems = useCallback((nextItems) => {
|
|
197
|
-
onChange(toSelectedItems(nextItems));
|
|
198
|
-
}, [onChange]);
|
|
199
|
-
const addToList = useCallback(async (itemsToAdd) => {
|
|
200
|
-
const nextItems = [...items];
|
|
201
|
-
const sourceItems = itemsToAdd ?? selectedInTree;
|
|
202
|
-
const nodesToAdd = sourceItems.filter((node) => !nextItems.some((item) => item.descriptor.id === node.id));
|
|
203
|
-
const nodesNeedingFetch = nodesToAdd.filter((node) => !node.path || !node.name || !node.displayName);
|
|
204
|
-
if (nodesNeedingFetch.length > 0 && editContext?.itemsRepository) {
|
|
205
|
-
try {
|
|
206
|
-
const stubs = await editContext.itemsRepository.getItemsStubs(nodesNeedingFetch.map((node) => ({
|
|
207
|
-
id: node.id,
|
|
208
|
-
language: node.language || language,
|
|
209
|
-
version: node.version || 1,
|
|
210
|
-
})));
|
|
211
|
-
const stubMap = new Map(stubs.map((stub) => [stub.id, stub]));
|
|
212
|
-
nodesToAdd.forEach((node) => {
|
|
213
|
-
const stub = stubMap.get(node.id);
|
|
214
|
-
nextItems.push({
|
|
215
|
-
descriptor: {
|
|
216
|
-
id: node.id,
|
|
217
|
-
language: node.language || language,
|
|
218
|
-
version: node.version || 1,
|
|
219
|
-
name: stub?.name || node.name || "",
|
|
220
|
-
displayName: stub?.displayName || node.displayName || "",
|
|
221
|
-
path: stub?.path || node.path || node.idPath || "",
|
|
222
|
-
},
|
|
223
|
-
includeSubitems: false,
|
|
224
|
-
});
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
catch (error) {
|
|
228
|
-
console.error("Failed to fetch item stubs:", error);
|
|
229
|
-
nodesToAdd.forEach((node) => {
|
|
230
|
-
nextItems.push({
|
|
231
|
-
descriptor: {
|
|
232
|
-
id: node.id,
|
|
233
|
-
language: node.language || language,
|
|
234
|
-
version: node.version || 1,
|
|
235
|
-
name: node.name || "",
|
|
236
|
-
displayName: node.displayName || "",
|
|
237
|
-
path: node.path || node.idPath || "",
|
|
238
|
-
},
|
|
239
|
-
includeSubitems: false,
|
|
240
|
-
});
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
else {
|
|
245
|
-
nodesToAdd.forEach((node) => {
|
|
246
|
-
nextItems.push({
|
|
247
|
-
descriptor: {
|
|
248
|
-
id: node.id,
|
|
249
|
-
language: node.language || language,
|
|
250
|
-
version: node.version || 1,
|
|
251
|
-
name: node.name || "",
|
|
252
|
-
displayName: node.displayName || "",
|
|
253
|
-
path: node.path || node.idPath || "",
|
|
254
|
-
},
|
|
255
|
-
includeSubitems: false,
|
|
256
|
-
});
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
commitItems(nextItems);
|
|
260
|
-
setSelectedInTree([]);
|
|
261
|
-
setSelectedFromList([]);
|
|
262
|
-
}, [
|
|
263
|
-
items,
|
|
264
|
-
selectedInTree,
|
|
265
|
-
editContext?.itemsRepository,
|
|
266
|
-
language,
|
|
267
|
-
commitItems,
|
|
268
|
-
]);
|
|
269
|
-
const handleAddItem = useCallback(async (item) => {
|
|
270
|
-
const itemId = item.id;
|
|
271
|
-
if (items.some((existing) => existing.descriptor.id === itemId)) {
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
let itemDescriptor = {
|
|
275
|
-
id: itemId,
|
|
276
|
-
language: item.language || language,
|
|
277
|
-
version: item.version ?? 1,
|
|
278
|
-
name: item.name || "",
|
|
279
|
-
displayName: item.displayName || "",
|
|
280
|
-
path: item.path || "",
|
|
281
|
-
};
|
|
282
|
-
if ((!itemDescriptor.path ||
|
|
283
|
-
!itemDescriptor.name ||
|
|
284
|
-
!itemDescriptor.displayName) &&
|
|
285
|
-
editContext?.itemsRepository) {
|
|
286
|
-
try {
|
|
287
|
-
const stubs = await editContext.itemsRepository.getItemsStubs([
|
|
288
|
-
{
|
|
289
|
-
id: itemId,
|
|
290
|
-
language: itemDescriptor.language,
|
|
291
|
-
version: itemDescriptor.version,
|
|
292
|
-
},
|
|
293
|
-
]);
|
|
294
|
-
if (stubs[0]) {
|
|
295
|
-
itemDescriptor = {
|
|
296
|
-
...itemDescriptor,
|
|
297
|
-
name: stubs[0].name || itemDescriptor.name,
|
|
298
|
-
displayName: stubs[0].displayName || itemDescriptor.displayName,
|
|
299
|
-
path: stubs[0].path || itemDescriptor.path,
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
catch (error) {
|
|
304
|
-
console.error("Failed to fetch item stub:", error);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
commitItems([
|
|
308
|
-
...items,
|
|
309
|
-
{
|
|
310
|
-
descriptor: itemDescriptor,
|
|
311
|
-
includeSubitems: false,
|
|
312
|
-
},
|
|
313
|
-
]);
|
|
314
|
-
setSelectedFromList([]);
|
|
315
|
-
}, [items, editContext?.itemsRepository, language, commitItems]);
|
|
316
|
-
const removeFromList = useCallback(() => {
|
|
317
|
-
const idsToRemove = new Set(selectedFromList.map((item) => item.descriptor.id));
|
|
318
|
-
commitItems(items.filter((item) => !idsToRemove.has(item.descriptor.id)));
|
|
319
|
-
setSelectedFromList([]);
|
|
320
|
-
}, [items, selectedFromList, commitItems]);
|
|
321
|
-
const removeItem = useCallback((index) => {
|
|
322
|
-
commitItems(items.filter((_, itemIndex) => itemIndex !== index));
|
|
323
|
-
setSelectedFromList([]);
|
|
324
|
-
}, [items, commitItems]);
|
|
325
|
-
const toggleSubitems = useCallback((index) => {
|
|
326
|
-
commitItems(items.map((item, itemIndex) => itemIndex === index
|
|
327
|
-
? { ...item, includeSubitems: !item.includeSubitems }
|
|
328
|
-
: item));
|
|
329
|
-
setSelectedFromList([]);
|
|
330
|
-
}, [items, commitItems]);
|
|
331
|
-
return (_jsx(ItemCollectionEditor, { items: items, selectedInTree: selectedInTree, onSelectedInTreeChange: setSelectedInTree, selectedFromList: selectedFromList, onSelectedFromListChange: setSelectedFromList, onAddToList: addToList, onRemoveFromList: removeFromList, onAddItem: handleAddItem, onRemoveItem: removeItem, onToggleSubitems: toggleSubitems, language: language, rootItemIds: rootItemId ? [rootItemId] : undefined, selectedItemsLabel: "Selected Items", emptyMessage: "No items selected", emptyHint: "Browse or search to add items", height: 320, localStorageKey: `questionnaire-item-collection-${questionId}` }));
|
|
332
|
-
}
|
|
6
|
+
import { X, ClipboardList, MessageSquare } from "lucide-react";
|
|
333
7
|
/**
|
|
334
8
|
* QuestionnaireInline - Inline component for displaying a questionnaire
|
|
335
9
|
*
|
|
336
10
|
* This is rendered directly inside the AgentTerminal rather than as a modal dialog.
|
|
337
11
|
* Displays questions with multiple-choice options and optional freetext input.
|
|
338
12
|
*/
|
|
339
|
-
export function QuestionnaireInline({
|
|
340
|
-
const editContext = useEditContext();
|
|
341
|
-
const language = editContext?.currentItemDescriptor?.language || "en";
|
|
342
|
-
const questionsScrollAreaRef = useRef(null);
|
|
343
|
-
const taskId = parameters.taskId?.trim() || undefined;
|
|
344
|
-
const [isHighlighted, setIsHighlighted] = useState(false);
|
|
345
|
-
useEffect(() => {
|
|
346
|
-
// Flash highlight on mount to grab user's attention
|
|
347
|
-
setIsHighlighted(true);
|
|
348
|
-
const highlightTimer = setTimeout(() => {
|
|
349
|
-
setIsHighlighted(false);
|
|
350
|
-
}, 4000);
|
|
351
|
-
return () => {
|
|
352
|
-
clearTimeout(highlightTimer);
|
|
353
|
-
};
|
|
354
|
-
}, [parameters.questions.length, requestId, title]);
|
|
13
|
+
export function QuestionnaireInline({ onClose, onCancel, title = "Questionnaire", description, parameters, }) {
|
|
355
14
|
// State for each question's answers: Map<questionId, { selectedOptions, freetext }>
|
|
356
|
-
const [answers, setAnswers] = useState(() =>
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
setIsSubmitting(false);
|
|
365
|
-
}, [parameters, requestId]);
|
|
366
|
-
useEffect(() => {
|
|
367
|
-
const scrollArea = questionsScrollAreaRef.current;
|
|
368
|
-
if (!scrollArea) {
|
|
369
|
-
return;
|
|
370
|
-
}
|
|
371
|
-
scrollArea.scrollTop = 0;
|
|
372
|
-
}, [requestId, title, description, parameters.questions]);
|
|
373
|
-
useEffect(() => {
|
|
374
|
-
if (!requestId) {
|
|
375
|
-
return;
|
|
376
|
-
}
|
|
377
|
-
questionnaireDrafts.set(requestId, new Map(answers));
|
|
378
|
-
}, [answers, requestId]);
|
|
379
|
-
useEffect(() => {
|
|
380
|
-
if (!requestId) {
|
|
381
|
-
return;
|
|
382
|
-
}
|
|
383
|
-
questionnairePendingFileDrafts.set(requestId, new Map(pendingFiles));
|
|
384
|
-
}, [pendingFiles, requestId]);
|
|
385
|
-
const updateSelectedItems = useCallback((questionId, items) => {
|
|
386
|
-
setAnswers((prev) => {
|
|
387
|
-
const newMap = new Map(prev);
|
|
388
|
-
const currentAnswer = newMap.get(questionId) || createEmptyAnswer(questionId);
|
|
389
|
-
newMap.set(questionId, {
|
|
390
|
-
...currentAnswer,
|
|
391
|
-
selectedItems: items,
|
|
392
|
-
});
|
|
393
|
-
return newMap;
|
|
394
|
-
});
|
|
395
|
-
}, []);
|
|
396
|
-
const upsertSelectedItem = useCallback((questionId, item, allowMultiple) => {
|
|
397
|
-
setAnswers((prev) => {
|
|
398
|
-
const newMap = new Map(prev);
|
|
399
|
-
const currentAnswer = newMap.get(questionId) || createEmptyAnswer(questionId);
|
|
400
|
-
const existing = currentAnswer.selectedItems ?? [];
|
|
401
|
-
const next = allowMultiple
|
|
402
|
-
? existing.some((i) => i.id === item.id)
|
|
403
|
-
? existing
|
|
404
|
-
: [...existing, item]
|
|
405
|
-
: [item];
|
|
406
|
-
newMap.set(questionId, {
|
|
407
|
-
...currentAnswer,
|
|
408
|
-
selectedItems: next,
|
|
15
|
+
const [answers, setAnswers] = useState(() => {
|
|
16
|
+
const initial = new Map();
|
|
17
|
+
// Initialize empty answers for each question
|
|
18
|
+
parameters.questions.forEach((q) => {
|
|
19
|
+
initial.set(q.id, {
|
|
20
|
+
questionId: q.id,
|
|
21
|
+
selectedOptions: [],
|
|
22
|
+
freetext: undefined,
|
|
409
23
|
});
|
|
410
|
-
return newMap;
|
|
411
|
-
});
|
|
412
|
-
}, []);
|
|
413
|
-
const updatePendingFiles = useCallback((questionId, files) => {
|
|
414
|
-
setPendingFiles((prev) => {
|
|
415
|
-
const newMap = new Map(prev);
|
|
416
|
-
newMap.set(questionId, files);
|
|
417
|
-
return newMap;
|
|
418
|
-
});
|
|
419
|
-
setFileUploadErrors((prev) => {
|
|
420
|
-
if (!prev.has(questionId)) {
|
|
421
|
-
return prev;
|
|
422
|
-
}
|
|
423
|
-
const newMap = new Map(prev);
|
|
424
|
-
newMap.delete(questionId);
|
|
425
|
-
return newMap;
|
|
426
24
|
});
|
|
427
|
-
|
|
25
|
+
return initial;
|
|
26
|
+
});
|
|
428
27
|
// Toggle option selection for a question
|
|
429
28
|
const toggleOption = useCallback((questionId, optionId, allowMultiple) => {
|
|
430
29
|
setAnswers((prev) => {
|
|
431
30
|
const newMap = new Map(prev);
|
|
432
|
-
const currentAnswer = newMap.get(questionId) ||
|
|
31
|
+
const currentAnswer = newMap.get(questionId) || {
|
|
32
|
+
questionId,
|
|
33
|
+
selectedOptions: [],
|
|
34
|
+
freetext: undefined,
|
|
35
|
+
};
|
|
433
36
|
let newSelectedOptions;
|
|
434
37
|
if (allowMultiple) {
|
|
435
38
|
// Multi-select: toggle the option
|
|
@@ -460,7 +63,11 @@ export function QuestionnaireInline({ requestId, agentId, onClose, onCancel, tit
|
|
|
460
63
|
const updateFreetext = useCallback((questionId, text) => {
|
|
461
64
|
setAnswers((prev) => {
|
|
462
65
|
const newMap = new Map(prev);
|
|
463
|
-
const currentAnswer = newMap.get(questionId) ||
|
|
66
|
+
const currentAnswer = newMap.get(questionId) || {
|
|
67
|
+
questionId,
|
|
68
|
+
selectedOptions: [],
|
|
69
|
+
freetext: undefined,
|
|
70
|
+
};
|
|
464
71
|
newMap.set(questionId, {
|
|
465
72
|
...currentAnswer,
|
|
466
73
|
freetext: text || undefined,
|
|
@@ -469,239 +76,64 @@ export function QuestionnaireInline({ requestId, agentId, onClose, onCancel, tit
|
|
|
469
76
|
});
|
|
470
77
|
}, []);
|
|
471
78
|
// Check if a question has been answered (at least one option selected or freetext provided)
|
|
472
|
-
const isQuestionAnswered = useCallback((
|
|
473
|
-
|
|
474
|
-
return true;
|
|
475
|
-
const answer = answers.get(question.id);
|
|
79
|
+
const isQuestionAnswered = useCallback((questionId) => {
|
|
80
|
+
const answer = answers.get(questionId);
|
|
476
81
|
if (!answer)
|
|
477
82
|
return false;
|
|
478
|
-
if (isItemSelectionType(question.type)) {
|
|
479
|
-
return (answer.selectedItems?.length ?? 0) > 0;
|
|
480
|
-
}
|
|
481
|
-
if (isFileUploadType(question.type)) {
|
|
482
|
-
return ((pendingFiles.get(question.id)?.length ?? 0) > 0 ||
|
|
483
|
-
(answer.uploadedDocuments?.length ?? 0) > 0);
|
|
484
|
-
}
|
|
485
83
|
return (answer.selectedOptions.length > 0 ||
|
|
486
84
|
(answer.freetext !== undefined && answer.freetext.trim() !== ""));
|
|
487
|
-
}, [answers
|
|
488
|
-
// Check if all
|
|
489
|
-
const
|
|
490
|
-
return parameters.questions.every((q) =>
|
|
85
|
+
}, [answers]);
|
|
86
|
+
// Check if all questions have been answered
|
|
87
|
+
const allQuestionsAnswered = useMemo(() => {
|
|
88
|
+
return parameters.questions.every((q) => isQuestionAnswered(q.id));
|
|
491
89
|
}, [parameters.questions, isQuestionAnswered]);
|
|
492
|
-
// Count
|
|
90
|
+
// Count answered questions
|
|
493
91
|
const answeredCount = useMemo(() => {
|
|
494
|
-
return parameters.questions.filter((q) =>
|
|
495
|
-
const answer = answers.get(q.id);
|
|
496
|
-
if (!answer)
|
|
497
|
-
return false;
|
|
498
|
-
if (isItemSelectionType(q.type)) {
|
|
499
|
-
return (answer.selectedItems?.length ?? 0) > 0;
|
|
500
|
-
}
|
|
501
|
-
if (isFileUploadType(q.type)) {
|
|
502
|
-
return ((pendingFiles.get(q.id)?.length ?? 0) > 0 ||
|
|
503
|
-
(answer.uploadedDocuments?.length ?? 0) > 0);
|
|
504
|
-
}
|
|
505
|
-
return (answer.selectedOptions.length > 0 ||
|
|
506
|
-
(answer.freetext !== undefined && answer.freetext.trim() !== ""));
|
|
507
|
-
}).length;
|
|
508
|
-
}, [parameters.questions, answers, pendingFiles]);
|
|
509
|
-
const requiredQuestionCount = useMemo(() => {
|
|
510
|
-
return parameters.questions.filter((q) => !q.optional).length;
|
|
511
|
-
}, [parameters.questions]);
|
|
512
|
-
const answeredRequiredCount = useMemo(() => {
|
|
513
|
-
return parameters.questions.filter((q) => !q.optional && isQuestionAnswered(q)).length;
|
|
92
|
+
return parameters.questions.filter((q) => isQuestionAnswered(q.id)).length;
|
|
514
93
|
}, [parameters.questions, isQuestionAnswered]);
|
|
515
94
|
// Handle submit
|
|
516
|
-
const handleSubmit = useCallback(
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
const currentAnswer = answers.get(question.id) || createEmptyAnswer(question.id);
|
|
527
|
-
if (!isFileUploadType(question.type)) {
|
|
528
|
-
nextAnswers.push(currentAnswer);
|
|
529
|
-
continue;
|
|
530
|
-
}
|
|
531
|
-
const files = pendingFiles.get(question.id) ?? [];
|
|
532
|
-
if (files.length === 0) {
|
|
533
|
-
nextAnswers.push({
|
|
534
|
-
...currentAnswer,
|
|
535
|
-
uploadedDocuments: currentAnswer.uploadedDocuments ?? [],
|
|
536
|
-
});
|
|
537
|
-
continue;
|
|
538
|
-
}
|
|
539
|
-
const storeInAgentDocumentStore = shouldStoreInAgentDocumentStore(question);
|
|
540
|
-
const attachToTask = Boolean(question.attachToTaskIfAvailable && taskId);
|
|
541
|
-
if (storeInAgentDocumentStore && !agentId) {
|
|
542
|
-
nextErrors.set(question.id, "File upload to the agent document store is unavailable because no agent is associated with this questionnaire.");
|
|
543
|
-
continue;
|
|
544
|
-
}
|
|
545
|
-
if (!storeInAgentDocumentStore && !attachToTask) {
|
|
546
|
-
nextErrors.set(question.id, "This file upload question is configured without a valid upload destination.");
|
|
547
|
-
continue;
|
|
548
|
-
}
|
|
549
|
-
const uploadedDocuments = [];
|
|
550
|
-
for (const file of files) {
|
|
551
|
-
let uploadedDocument = null;
|
|
552
|
-
if (storeInAgentDocumentStore) {
|
|
553
|
-
const result = await uploadDocument(agentId, file);
|
|
554
|
-
if (!result.success || !result.document) {
|
|
555
|
-
nextErrors.set(question.id, result.error || `Failed to upload "${file.name}".`);
|
|
556
|
-
break;
|
|
557
|
-
}
|
|
558
|
-
uploadedDocument = toUploadedDocumentReference(result.document);
|
|
559
|
-
if (!uploadedDocument) {
|
|
560
|
-
nextErrors.set(question.id, `Failed to capture upload metadata for "${file.name}".`);
|
|
561
|
-
break;
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
if (attachToTask) {
|
|
565
|
-
const attachmentResult = await uploadAttachmentFile(taskId, file);
|
|
566
|
-
if (attachmentResult.type !== "success") {
|
|
567
|
-
nextErrors.set(question.id, attachmentResult.details ||
|
|
568
|
-
attachmentResult.summary ||
|
|
569
|
-
`Failed to attach "${file.name}" to the current task.`);
|
|
570
|
-
break;
|
|
571
|
-
}
|
|
572
|
-
if (!uploadedDocument && attachmentResult.data) {
|
|
573
|
-
uploadedDocument = toUploadedDocumentReferenceFromTaskAttachment(attachmentResult.data);
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
if (!uploadedDocument) {
|
|
577
|
-
nextErrors.set(question.id, `Failed to capture upload metadata for "${file.name}".`);
|
|
578
|
-
break;
|
|
579
|
-
}
|
|
580
|
-
uploadedDocuments.push(uploadedDocument);
|
|
581
|
-
}
|
|
582
|
-
if (nextErrors.has(question.id)) {
|
|
583
|
-
continue;
|
|
584
|
-
}
|
|
585
|
-
nextAnswers.push({
|
|
586
|
-
...currentAnswer,
|
|
587
|
-
uploadedDocuments,
|
|
588
|
-
});
|
|
589
|
-
}
|
|
590
|
-
if (nextErrors.size > 0) {
|
|
591
|
-
setFileUploadErrors(nextErrors);
|
|
592
|
-
return;
|
|
593
|
-
}
|
|
594
|
-
if (requestId) {
|
|
595
|
-
questionnaireDrafts.delete(requestId);
|
|
596
|
-
questionnairePendingFileDrafts.delete(requestId);
|
|
597
|
-
}
|
|
598
|
-
const result = {
|
|
599
|
-
answers: nextAnswers.filter((answer) => answer.selectedOptions.length > 0 ||
|
|
600
|
-
(answer.selectedItems?.length ?? 0) > 0 ||
|
|
601
|
-
(answer.uploadedDocuments?.length ?? 0) > 0 ||
|
|
602
|
-
(answer.freetext !== undefined && answer.freetext.trim() !== "")),
|
|
603
|
-
};
|
|
604
|
-
onClose(result);
|
|
605
|
-
}
|
|
606
|
-
finally {
|
|
607
|
-
setIsSubmitting(false);
|
|
608
|
-
}
|
|
609
|
-
}, [
|
|
610
|
-
agentId,
|
|
611
|
-
answers,
|
|
612
|
-
isSubmitting,
|
|
613
|
-
onClose,
|
|
614
|
-
parameters.questions,
|
|
615
|
-
pendingFiles,
|
|
616
|
-
requestId,
|
|
617
|
-
taskId,
|
|
618
|
-
]);
|
|
619
|
-
const handleCancel = useCallback(() => {
|
|
620
|
-
if (requestId) {
|
|
621
|
-
questionnaireDrafts.delete(requestId);
|
|
622
|
-
questionnairePendingFileDrafts.delete(requestId);
|
|
623
|
-
}
|
|
624
|
-
onCancel();
|
|
625
|
-
}, [onCancel, requestId]);
|
|
626
|
-
return (_jsxs("div", { "data-testid": "questionnaire-container", className: cn("flex h-full min-h-0 flex-col border-t border-gray-200 transition-all duration-1000", isHighlighted
|
|
627
|
-
? "bg-amber-50 shadow-[0_-8px_25px_rgba(245,158,11,0.15)] ring-2 ring-amber-400/50"
|
|
628
|
-
: "bg-linear-to-b from-indigo-50/50 to-white shadow-none ring-0"), children: [_jsxs("div", { className: cn("flex items-center justify-between border-b px-4 py-3 transition-all duration-1000", isHighlighted
|
|
629
|
-
? "border-amber-200 bg-amber-200/50"
|
|
630
|
-
: "border-gray-100"), children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: cn("transition-all duration-500", isHighlighted ? "scale-110" : "scale-100"), children: isHighlighted ? (_jsx(AlertCircle, { size: 18, className: "text-amber-600" })) : (_jsx(ClipboardList, { size: 18, className: "text-gray-400" })) }), _jsxs("div", { children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("h3", { "data-testid": "questionnaire-title", className: "text-sm font-semibold text-gray-900", children: title }), isHighlighted && (_jsx("span", { className: "rounded-full bg-amber-500 px-2 py-0.5 text-[9px] font-bold tracking-widest text-white uppercase shadow-sm", children: "Waiting for you" }))] }), description && (_jsx("p", { "data-testid": "questionnaire-description", className: "mt-0.5 text-xs text-gray-500", children: description }))] })] }), _jsx("button", { onClick: () => {
|
|
631
|
-
handleCancel();
|
|
632
|
-
}, "data-testid": "questionnaire-cancel-header", className: cn("rounded-full p-1.5 transition-colors duration-300", isHighlighted
|
|
633
|
-
? "bg-amber-100 hover:bg-amber-200"
|
|
634
|
-
: "hover:bg-gray-100"), "aria-label": "Cancel", children: _jsx(X, { size: 16, className: isHighlighted ? "text-amber-700" : "text-gray-400" }) })] }), _jsxs("div", { "data-testid": "questionnaire-progress", className: "flex items-center justify-between bg-gray-50/50 px-4 py-1.5 text-[11px] text-gray-400", children: [_jsxs("span", { children: [answeredRequiredCount, " of ", requiredQuestionCount, " required answered"] }), _jsx("span", { className: allRequiredQuestionsAnswered ? "text-green-600" : "text-amber-600", children: allRequiredQuestionsAnswered
|
|
95
|
+
const handleSubmit = useCallback(() => {
|
|
96
|
+
const result = {
|
|
97
|
+
answers: Array.from(answers.values()).filter((a) => a.selectedOptions.length > 0 ||
|
|
98
|
+
(a.freetext !== undefined && a.freetext.trim() !== "")),
|
|
99
|
+
};
|
|
100
|
+
onClose(result);
|
|
101
|
+
}, [answers, onClose]);
|
|
102
|
+
return (_jsxs("div", { "data-testid": "questionnaire-container", className: "border-t border-gray-200 bg-gradient-to-b from-indigo-50/50 to-white", children: [_jsxs("div", { className: "flex items-center justify-between border-b border-gray-100 px-4 py-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(ClipboardList, { size: 18, className: "text-indigo-600", strokeWidth: 1.5 }), _jsxs("div", { children: [_jsx("h3", { "data-testid": "questionnaire-title", className: "text-sm font-semibold text-gray-900", children: title }), description && (_jsx("p", { "data-testid": "questionnaire-description", className: "mt-0.5 text-xs text-gray-500", children: description }))] })] }), _jsx("button", { onClick: () => {
|
|
103
|
+
onCancel();
|
|
104
|
+
}, "data-testid": "questionnaire-cancel-header", className: "rounded-full p-1 transition-colors hover:bg-gray-100", "aria-label": "Cancel", children: _jsx(X, { size: 16, className: "text-gray-400" }) })] }), _jsxs("div", { "data-testid": "questionnaire-progress", className: "flex items-center justify-between bg-gray-50/50 px-4 py-1.5 text-[11px] text-gray-400", children: [_jsxs("span", { children: [answeredCount, " of ", parameters.questions.length, " answered"] }), _jsx("span", { className: allQuestionsAnswered ? "text-green-600" : "text-amber-600", children: allQuestionsAnswered
|
|
635
105
|
? "Ready to submit"
|
|
636
|
-
: "Please answer all
|
|
106
|
+
: "Please answer all questions" })] }), _jsx("div", { className: "max-h-[400px] overflow-auto", children: parameters.questions.length === 0 ? (_jsxs("div", { "data-testid": "questionnaire-empty", className: "flex flex-col items-center justify-center py-8 text-gray-400", children: [_jsx(ClipboardList, { size: 32, strokeWidth: 1, className: "mb-2 opacity-50" }), _jsx("p", { className: "text-xs", children: "No questions to display." })] })) : (_jsx("div", { className: "space-y-4 p-4", children: parameters.questions.map((question, index) => {
|
|
637
107
|
const answer = answers.get(question.id);
|
|
638
|
-
const isAnswered = isQuestionAnswered(question);
|
|
639
|
-
|
|
640
|
-
const isItemCollection = question.type === "item-collection";
|
|
641
|
-
const isFileUpload = isFileUploadType(question.type);
|
|
642
|
-
const isItemSelection = isItemPicker || isItemCollection;
|
|
643
|
-
const isStructuredQuestion = isItemSelection || isFileUpload;
|
|
644
|
-
// Auto-enable freetext if options array is empty, but not for structured question types.
|
|
108
|
+
const isAnswered = isQuestionAnswered(question.id);
|
|
109
|
+
// Auto-enable freetext if options array is empty (defensive handling)
|
|
645
110
|
const hasOptions = question.options && question.options.length > 0;
|
|
646
|
-
const effectiveAllowFreetext =
|
|
647
|
-
? (question.allowFreetext ?? false)
|
|
648
|
-
: question.allowFreetext || !hasOptions;
|
|
649
|
-
const effectiveRootItemId = question.rootItemId || question.root;
|
|
111
|
+
const effectiveAllowFreetext = question.allowFreetext || !hasOptions;
|
|
650
112
|
return (_jsxs("div", { "data-testid": "questionnaire-question", "data-question-id": question.id, className: `rounded-lg border p-3 transition-colors ${isAnswered
|
|
651
113
|
? "border-green-200 bg-green-50/30"
|
|
652
|
-
: "border-gray-200 bg-white"}`, children: [_jsxs("div", { className: "mb-2 flex items-start gap-2", children: [_jsx("span", { className: `flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-[10px] font-semibold ${isAnswered
|
|
114
|
+
: "border-gray-200 bg-white"}`, children: [_jsxs("div", { className: "mb-2 flex items-start gap-2", children: [_jsx("span", { className: `flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-full text-[10px] font-semibold ${isAnswered
|
|
653
115
|
? "bg-green-100 text-green-700"
|
|
654
|
-
: "bg-gray-100 text-gray-500"}`, children: index + 1 }), _jsxs("div", { className: "flex-1", children: [_jsx("p", { className: "text-sm font-medium text-gray-800", children: question.prompt }), _jsxs("p", { className: "mt-0.5 text-[10px] text-gray-400", children: [
|
|
655
|
-
? "
|
|
656
|
-
:
|
|
657
|
-
?
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
? question.allowMultiple
|
|
662
|
-
? "Upload one or more files"
|
|
663
|
-
: "Upload a file"
|
|
664
|
-
: !hasOptions
|
|
665
|
-
? "Open-ended question"
|
|
666
|
-
: question.allowMultiple
|
|
667
|
-
? "Select one or more options"
|
|
668
|
-
: "Select one option", isFileUpload &&
|
|
669
|
-
question.attachToTaskIfAvailable &&
|
|
670
|
-
taskId &&
|
|
671
|
-
" • Also attaches to task", question.optional && " (optional)", effectiveAllowFreetext &&
|
|
672
|
-
(isItemSelection || hasOptions) &&
|
|
673
|
-
" • Freetext allowed"] })] })] }), isItemCollection && (_jsx("div", { className: "mt-2 ml-7", children: _jsx(QuestionnaireItemCollectionField, { questionId: question.id, rootItemId: effectiveRootItemId, answer: answer, language: language, onChange: (items) => updateSelectedItems(question.id, items) }) })), isItemPicker && (_jsxs("div", { className: "mt-2 ml-7", children: [_jsx("div", { className: "h-[250px] overflow-hidden rounded border border-gray-200", children: _jsx(TreeListSelector, { language: language, rootItemIds: effectiveRootItemId
|
|
674
|
-
? [effectiveRootItemId]
|
|
675
|
-
: undefined, selectedItemIds: (answer?.selectedItems ?? []).map((i) => i.id), selectionMode: question.allowMultiple ? "multiple" : "single", multiSelectRequiresModifier: !question.allowMultiple, onSelectionChange: (items) => {
|
|
676
|
-
const effectiveItems = question.allowMultiple
|
|
677
|
-
? items
|
|
678
|
-
: items.slice(-1);
|
|
679
|
-
updateSelectedItems(question.id, effectiveItems.map((i) => ({
|
|
680
|
-
id: i.id,
|
|
681
|
-
name: i.displayName || i.name,
|
|
682
|
-
path: i.path,
|
|
683
|
-
})));
|
|
684
|
-
}, onItemSelected: (item) => {
|
|
685
|
-
const id = item.id;
|
|
686
|
-
const name = item.name || item.path || item.id;
|
|
687
|
-
upsertSelectedItem(question.id, { id, name, path: item.path }, question.allowMultiple ?? false);
|
|
688
|
-
}, className: "h-full" }) }), (answer?.selectedItems?.length ?? 0) > 0 && (_jsxs("div", { className: "mt-2 flex flex-wrap gap-1", children: [(answer?.selectedItems ?? [])
|
|
689
|
-
.slice(0, 8)
|
|
690
|
-
.map((i) => (_jsx("span", { className: "rounded border border-gray-200 bg-gray-50 px-1.5 py-0.5 text-[10px] text-gray-600", title: i.path || i.id, children: i.name || i.path || i.id }, i.id))), (answer?.selectedItems?.length ?? 0) > 8 && (_jsxs("span", { className: "px-1.5 py-0.5 text-[10px] text-gray-400", children: ["+", (answer?.selectedItems?.length ?? 0) - 8, " more"] }))] }))] })), isFileUpload && (_jsx("div", { className: "mt-2 ml-7", children: _jsx(QuestionnaireFileUploadField, { questionId: question.id, agentId: agentId, allowMultiple: question.allowMultiple ?? false, selectedFiles: pendingFiles.get(question.id) ?? [], submissionError: fileUploadErrors.get(question.id), disabled: isSubmitting, storeInAgentDocumentStore: question.storeInAgentDocumentStore, attachToTaskIfAvailable: question.attachToTaskIfAvailable, taskId: taskId, onChange: (files) => updatePendingFiles(question.id, files) }) })), !isStructuredQuestion && hasOptions && (_jsx("div", { className: "ml-7 space-y-1", children: question.options.map((option) => {
|
|
116
|
+
: "bg-gray-100 text-gray-500"}`, children: index + 1 }), _jsxs("div", { className: "flex-1", children: [_jsx("p", { className: "text-sm font-medium text-gray-800", children: question.prompt }), _jsxs("p", { className: "mt-0.5 text-[10px] text-gray-400", children: [!hasOptions
|
|
117
|
+
? "Open-ended question"
|
|
118
|
+
: question.allowMultiple
|
|
119
|
+
? "Select one or more options"
|
|
120
|
+
: "Select one option", effectiveAllowFreetext &&
|
|
121
|
+
hasOptions &&
|
|
122
|
+
" • Freetext allowed"] })] })] }), hasOptions && (_jsx("div", { className: "ml-7 space-y-1", children: question.options.map((option) => {
|
|
691
123
|
const isSelected = answer?.selectedOptions.includes(option.id) ?? false;
|
|
692
124
|
return (_jsxs("div", { "data-testid": "questionnaire-option", "data-option-id": option.id, "data-selected": isSelected, className: `flex cursor-pointer items-center gap-2 rounded border px-2 py-1.5 transition-colors ${isSelected
|
|
693
125
|
? "border-indigo-200 bg-indigo-50"
|
|
694
126
|
: "border-transparent hover:bg-gray-50"}`, onClick: () => toggleOption(question.id, option.id, question.allowMultiple ?? false), children: [question.allowMultiple ? (_jsx(Checkbox, { checked: isSelected, onCheckedChange: () => toggleOption(question.id, option.id, question.allowMultiple ?? false), className: "pointer-events-none h-3.5 w-3.5" })) : (_jsx("div", { className: `flex h-3.5 w-3.5 items-center justify-center rounded-full border-2 ${isSelected
|
|
695
127
|
? "border-indigo-600 bg-indigo-600"
|
|
696
128
|
: "border-gray-300"}`, children: isSelected && (_jsx("div", { className: "h-1.5 w-1.5 rounded-full bg-white" })) })), _jsx("span", { className: "flex-1 text-xs text-gray-700", children: option.label })] }, option.id));
|
|
697
|
-
}) })), effectiveAllowFreetext && (_jsxs("div", { className: hasOptions ? "mt-2
|
|
129
|
+
}) })), effectiveAllowFreetext && (_jsxs("div", { className: hasOptions ? "ml-7 mt-2" : "ml-7", children: [_jsxs("div", { className: "flex items-center gap-1 text-[10px] text-gray-400", children: [_jsx(MessageSquare, { size: 10 }), _jsx("span", { children: hasOptions
|
|
698
130
|
? "Additional comments (optional)"
|
|
699
131
|
: "Your response" })] }), _jsx(Textarea, { "data-testid": "questionnaire-freetext", value: answer?.freetext ?? "", onChange: (e) => updateFreetext(question.id, e.target.value), placeholder: "Enter your response...", className: "mt-1 min-h-[60px] text-xs" })] }))] }, question.id));
|
|
700
|
-
}) })) }), _jsxs("div", { className: "flex items-center justify-end gap-2 border-t border-gray-100 bg-gray-50/50 px-4 py-3", children: [
|
|
701
|
-
|
|
702
|
-
}, "data-testid": "questionnaire-cancel", className: "h-8 text-xs", children: "Cancel" }), _jsx(Button, { size: "sm", onClick:
|
|
703
|
-
|
|
704
|
-
|
|
132
|
+
}) })) }), _jsxs("div", { className: "flex items-center justify-end gap-2 border-t border-gray-100 bg-gray-50/50 px-4 py-3", children: [_jsx(Button, { variant: "outline", size: "sm", onClick: () => {
|
|
133
|
+
onCancel();
|
|
134
|
+
}, "data-testid": "questionnaire-cancel", className: "h-8 text-xs", children: "Cancel" }), _jsx(Button, { size: "sm", onClick: handleSubmit, disabled: !allQuestionsAnswered, "data-testid": "questionnaire-submit", className: "h-8 text-xs", children: answeredCount === 0
|
|
135
|
+
? "Submit Answers"
|
|
136
|
+
: `Submit ${answeredCount} Answer${answeredCount !== 1 ? "s" : ""}` })] })] }));
|
|
705
137
|
}
|
|
706
138
|
export default QuestionnaireInline;
|
|
707
139
|
//# sourceMappingURL=QuestionnaireInline.js.map
|