@patternfly/chatbot 6.8.0-prerelease.8 → 6.8.0-prerelease.9
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/cjs/CodeModal/CodeModal.js +5 -0
- package/dist/cjs/MarkdownContent/MarkdownContent.d.ts +26 -7
- package/dist/cjs/MarkdownContent/MarkdownContent.js +79 -166
- package/dist/cjs/MarkdownContent/MarkdownRenderer.d.ts +6 -0
- package/dist/cjs/MarkdownContent/MarkdownRenderer.js +187 -0
- package/dist/cjs/Message/Message.d.ts +3 -4
- package/dist/cjs/Message/Message.js +0 -2
- package/dist/cjs/MessageBox/MessageBox.js +5 -1
- package/dist/cjs/index.d.ts +0 -8
- package/dist/cjs/index.js +1 -13
- package/dist/css/main.css +18 -3
- package/dist/css/main.css.map +1 -1
- package/dist/esm/CodeModal/CodeModal.js +5 -0
- package/dist/esm/MarkdownContent/MarkdownContent.d.ts +26 -7
- package/dist/esm/MarkdownContent/MarkdownContent.js +52 -165
- package/dist/esm/MarkdownContent/MarkdownRenderer.d.ts +6 -0
- package/dist/esm/MarkdownContent/MarkdownRenderer.js +182 -0
- package/dist/esm/Message/Message.d.ts +3 -4
- package/dist/esm/Message/Message.js +0 -2
- package/dist/esm/MessageBox/MessageBox.js +5 -1
- package/dist/esm/index.d.ts +0 -8
- package/dist/esm/index.js +0 -8
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/generate-index.js +41 -16
- package/generate-index.test.js +68 -0
- package/monaco-environment.js +45 -0
- package/package.json +20 -2
- package/patternfly-docs/content/extensions/chatbot/chatbot.md +1 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/BotMessage.tsx +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickStart.tsx +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessage.tsx +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/monitor-sampleapp-quickstart.ts +1 -0
- package/patternfly-docs/content/extensions/chatbot/tree-shaking.md +124 -0
- package/patternfly-docs/monaco-environment.js +45 -0
- package/patternfly-docs/patternfly-docs.css.js +6 -0
- package/src/Chatbot/Chatbot.scss +4 -0
- package/src/ChatbotContent/ChatbotContent.scss +1 -1
- package/src/ChatbotFooter/ChatbotFooter.scss +2 -2
- package/src/ChatbotHeader/ChatbotHeader.scss +4 -0
- package/src/ChatbotModal/ChatbotModal.scss +10 -0
- package/src/CodeModal/CodeModal.tsx +6 -0
- package/src/DeepThinking/DeepThinking.test.tsx +10 -12
- package/src/MarkdownContent/MarkdownContent.test.tsx +52 -5
- package/src/MarkdownContent/MarkdownContent.tsx +77 -220
- package/src/MarkdownContent/MarkdownRenderer.tsx +235 -0
- package/src/Message/Message.test.tsx +5 -0
- package/src/Message/Message.tsx +3 -5
- package/src/MessageBox/MessageBox.tsx +13 -1
- package/src/ResponseActions/ResponseActions.test.tsx +42 -48
- package/src/ToolCall/ToolCall.test.tsx +6 -9
- package/src/ToolResponse/ToolResponse.test.tsx +16 -22
- package/src/index.ts +0 -12
- package/src/test-utils/markdownTestUtils.ts +21 -0
- package/tsconfig.json +6 -1
- package/dist/cjs/AttachmentEdit/AttachmentEdit.test.d.ts +0 -1
- package/dist/cjs/AttachmentEdit/AttachmentEdit.test.js +0 -77
- package/dist/cjs/Chatbot/Chatbot.test.d.ts +0 -1
- package/dist/cjs/Chatbot/Chatbot.test.js +0 -32
- package/dist/cjs/ChatbotAlert/ChatbotAlert.test.d.ts +0 -1
- package/dist/cjs/ChatbotAlert/ChatbotAlert.test.js +0 -27
- package/dist/cjs/ChatbotContent/ChatbotContent.test.d.ts +0 -1
- package/dist/cjs/ChatbotContent/ChatbotContent.test.js +0 -22
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.d.ts +0 -1
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.js +0 -75
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.d.ts +0 -1
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +0 -601
- package/dist/cjs/ChatbotFooter/ChatbotFooter.test.d.ts +0 -1
- package/dist/cjs/ChatbotFooter/ChatbotFooter.test.js +0 -27
- package/dist/cjs/ChatbotFooter/ChatbotFooternote.test.d.ts +0 -1
- package/dist/cjs/ChatbotFooter/ChatbotFooternote.test.js +0 -87
- package/dist/cjs/ChatbotHeader/ChatbotHeader.test.d.ts +0 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeader.test.js +0 -18
- package/dist/cjs/ChatbotHeader/ChatbotHeaderActions.test.d.ts +0 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderActions.test.js +0 -18
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.test.d.ts +0 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.test.js +0 -22
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMain.test.d.ts +0 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMain.test.js +0 -18
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.d.ts +0 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.js +0 -22
- package/dist/cjs/ChatbotHeader/ChatbotHeaderNewChatButton.test.d.ts +0 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderNewChatButton.test.js +0 -22
- package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.d.ts +0 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +0 -46
- package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.d.ts +0 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +0 -44
- package/dist/cjs/ChatbotHeader/ChatbotHeaderTitle.test.d.ts +0 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderTitle.test.js +0 -55
- package/dist/cjs/ChatbotModal/ChatbotModal.test.d.ts +0 -1
- package/dist/cjs/ChatbotModal/ChatbotModal.test.js +0 -16
- package/dist/cjs/ChatbotToggle/ChatbotToggle.test.d.ts +0 -1
- package/dist/cjs/ChatbotToggle/ChatbotToggle.test.js +0 -64
- package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.d.ts +0 -1
- package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +0 -61
- package/dist/cjs/CodeModal/CodeModal.test.d.ts +0 -1
- package/dist/cjs/CodeModal/CodeModal.test.js +0 -34
- package/dist/cjs/Compare/Compare.test.d.ts +0 -1
- package/dist/cjs/Compare/Compare.test.js +0 -18
- package/dist/cjs/DeepThinking/DeepThinking.test.d.ts +0 -1
- package/dist/cjs/DeepThinking/DeepThinking.test.js +0 -146
- package/dist/cjs/FileDetails/FileDetails.test.d.ts +0 -1
- package/dist/cjs/FileDetails/FileDetails.test.js +0 -42
- package/dist/cjs/FileDetailsLabel/FileDetailsLabel.test.d.ts +0 -1
- package/dist/cjs/FileDetailsLabel/FileDetailsLabel.test.js +0 -79
- package/dist/cjs/FileDropZone/FileDropZone.test.d.ts +0 -1
- package/dist/cjs/FileDropZone/FileDropZone.test.js +0 -100
- package/dist/cjs/FilePreview/FilePreview.test.d.ts +0 -1
- package/dist/cjs/FilePreview/FilePreview.test.js +0 -97
- package/dist/cjs/ImagePreview/ImagePreview.test.d.ts +0 -1
- package/dist/cjs/ImagePreview/ImagePreview.test.js +0 -225
- package/dist/cjs/MarkdownContent/MarkdownContent.test.d.ts +0 -1
- package/dist/cjs/MarkdownContent/MarkdownContent.test.js +0 -192
- package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.test.d.ts +0 -1
- package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.test.js +0 -131
- package/dist/cjs/Message/ErrorMessage/ErrorMessage.test.d.ts +0 -1
- package/dist/cjs/Message/ErrorMessage/ErrorMessage.test.js +0 -30
- package/dist/cjs/Message/Message.test.d.ts +0 -1
- package/dist/cjs/Message/Message.test.js +0 -1128
- package/dist/cjs/Message/MessageAndActions/MessageAndActions.test.d.ts +0 -1
- package/dist/cjs/Message/MessageAndActions/MessageAndActions.test.js +0 -25
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentItem.test.d.ts +0 -1
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentItem.test.js +0 -25
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentsContainer.test.d.ts +0 -1
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentsContainer.test.js +0 -25
- package/dist/cjs/Message/MessageLoading.test.d.ts +0 -1
- package/dist/cjs/Message/MessageLoading.test.js +0 -25
- package/dist/cjs/Message/QuickResponse/QuickResponse.test.d.ts +0 -1
- package/dist/cjs/Message/QuickResponse/QuickResponse.test.js +0 -109
- package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.test.d.ts +0 -1
- package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.test.js +0 -76
- package/dist/cjs/Message/UserFeedback/UserFeedback.test.d.ts +0 -1
- package/dist/cjs/Message/UserFeedback/UserFeedback.test.js +0 -181
- package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.test.d.ts +0 -1
- package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.test.js +0 -243
- package/dist/cjs/MessageBar/AttachButton.test.d.ts +0 -1
- package/dist/cjs/MessageBar/AttachButton.test.js +0 -152
- package/dist/cjs/MessageBar/MessageBar.test.d.ts +0 -1
- package/dist/cjs/MessageBar/MessageBar.test.js +0 -338
- package/dist/cjs/MessageBar/SendButton.test.d.ts +0 -1
- package/dist/cjs/MessageBar/SendButton.test.js +0 -58
- package/dist/cjs/MessageBar/StopButton.test.d.ts +0 -1
- package/dist/cjs/MessageBar/StopButton.test.js +0 -58
- package/dist/cjs/MessageBox/JumpButton.test.d.ts +0 -1
- package/dist/cjs/MessageBox/JumpButton.test.js +0 -39
- package/dist/cjs/MessageBox/MessageBox.test.d.ts +0 -1
- package/dist/cjs/MessageBox/MessageBox.test.js +0 -294
- package/dist/cjs/MessageDivider/MessageDivider.test.d.ts +0 -1
- package/dist/cjs/MessageDivider/MessageDivider.test.js +0 -29
- package/dist/cjs/Onboarding/Onboarding.test.d.ts +0 -1
- package/dist/cjs/Onboarding/Onboarding.test.js +0 -80
- package/dist/cjs/PreviewAttachment/PreviewAttachment.test.d.ts +0 -1
- package/dist/cjs/PreviewAttachment/PreviewAttachment.test.js +0 -50
- package/dist/cjs/ResponseActions/ResponseActionButton.test.d.ts +0 -1
- package/dist/cjs/ResponseActions/ResponseActionButton.test.js +0 -54
- package/dist/cjs/ResponseActions/ResponseActions.test.d.ts +0 -1
- package/dist/cjs/ResponseActions/ResponseActions.test.js +0 -455
- package/dist/cjs/ResponseActions/ResponseActionsGroups.test.d.ts +0 -1
- package/dist/cjs/ResponseActions/ResponseActionsGroups.test.js +0 -25
- package/dist/cjs/Settings/SettingsForm.test.d.ts +0 -1
- package/dist/cjs/Settings/SettingsForm.test.js +0 -35
- package/dist/cjs/SourcesCard/SourcesCard.test.d.ts +0 -1
- package/dist/cjs/SourcesCard/SourcesCard.test.js +0 -39
- package/dist/cjs/SourcesCardBase/SourcesCardBase.test.d.ts +0 -1
- package/dist/cjs/SourcesCardBase/SourcesCardBase.test.js +0 -199
- package/dist/cjs/TermsOfUse/TermsOfUse.test.d.ts +0 -1
- package/dist/cjs/TermsOfUse/TermsOfUse.test.js +0 -77
- package/dist/cjs/ToolCall/ToolCall.test.d.ts +0 -1
- package/dist/cjs/ToolCall/ToolCall.test.js +0 -201
- package/dist/cjs/ToolResponse/ToolResponse.test.d.ts +0 -1
- package/dist/cjs/ToolResponse/ToolResponse.test.js +0 -184
- package/dist/cjs/__mocks__/monaco-editor.d.ts +0 -11
- package/dist/cjs/__mocks__/monaco-editor.js +0 -18
- package/dist/cjs/__mocks__/rehype-external-links.d.ts +0 -2
- package/dist/cjs/__mocks__/rehype-external-links.js +0 -4
- package/dist/cjs/__mocks__/rehype-highlight.d.ts +0 -2
- package/dist/cjs/__mocks__/rehype-highlight.js +0 -4
- package/dist/cjs/__mocks__/rehype-sanitize.d.ts +0 -2
- package/dist/cjs/__mocks__/rehype-sanitize.js +0 -4
- package/dist/cjs/__mocks__/rehype-unwrap-images.d.ts +0 -2
- package/dist/cjs/__mocks__/rehype-unwrap-images.js +0 -4
- package/dist/esm/AttachmentEdit/AttachmentEdit.test.d.ts +0 -1
- package/dist/esm/AttachmentEdit/AttachmentEdit.test.js +0 -72
- package/dist/esm/Chatbot/Chatbot.test.d.ts +0 -1
- package/dist/esm/Chatbot/Chatbot.test.js +0 -27
- package/dist/esm/ChatbotAlert/ChatbotAlert.test.d.ts +0 -1
- package/dist/esm/ChatbotAlert/ChatbotAlert.test.js +0 -22
- package/dist/esm/ChatbotContent/ChatbotContent.test.d.ts +0 -1
- package/dist/esm/ChatbotContent/ChatbotContent.test.js +0 -17
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.d.ts +0 -1
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.js +0 -70
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.d.ts +0 -1
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +0 -596
- package/dist/esm/ChatbotFooter/ChatbotFooter.test.d.ts +0 -1
- package/dist/esm/ChatbotFooter/ChatbotFooter.test.js +0 -22
- package/dist/esm/ChatbotFooter/ChatbotFooternote.test.d.ts +0 -1
- package/dist/esm/ChatbotFooter/ChatbotFooternote.test.js +0 -82
- package/dist/esm/ChatbotHeader/ChatbotHeader.test.d.ts +0 -1
- package/dist/esm/ChatbotHeader/ChatbotHeader.test.js +0 -13
- package/dist/esm/ChatbotHeader/ChatbotHeaderActions.test.d.ts +0 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderActions.test.js +0 -13
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.test.d.ts +0 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.test.js +0 -20
- package/dist/esm/ChatbotHeader/ChatbotHeaderMain.test.d.ts +0 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderMain.test.js +0 -13
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.d.ts +0 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.js +0 -20
- package/dist/esm/ChatbotHeader/ChatbotHeaderNewChatButton.test.d.ts +0 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderNewChatButton.test.js +0 -20
- package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.d.ts +0 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +0 -44
- package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.d.ts +0 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +0 -42
- package/dist/esm/ChatbotHeader/ChatbotHeaderTitle.test.d.ts +0 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderTitle.test.js +0 -50
- package/dist/esm/ChatbotModal/ChatbotModal.test.d.ts +0 -1
- package/dist/esm/ChatbotModal/ChatbotModal.test.js +0 -11
- package/dist/esm/ChatbotToggle/ChatbotToggle.test.d.ts +0 -1
- package/dist/esm/ChatbotToggle/ChatbotToggle.test.js +0 -59
- package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.d.ts +0 -1
- package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +0 -56
- package/dist/esm/CodeModal/CodeModal.test.d.ts +0 -1
- package/dist/esm/CodeModal/CodeModal.test.js +0 -29
- package/dist/esm/Compare/Compare.test.d.ts +0 -1
- package/dist/esm/Compare/Compare.test.js +0 -13
- package/dist/esm/DeepThinking/DeepThinking.test.d.ts +0 -1
- package/dist/esm/DeepThinking/DeepThinking.test.js +0 -141
- package/dist/esm/FileDetails/FileDetails.test.d.ts +0 -1
- package/dist/esm/FileDetails/FileDetails.test.js +0 -37
- package/dist/esm/FileDetailsLabel/FileDetailsLabel.test.d.ts +0 -1
- package/dist/esm/FileDetailsLabel/FileDetailsLabel.test.js +0 -74
- package/dist/esm/FileDropZone/FileDropZone.test.d.ts +0 -1
- package/dist/esm/FileDropZone/FileDropZone.test.js +0 -95
- package/dist/esm/FilePreview/FilePreview.test.d.ts +0 -1
- package/dist/esm/FilePreview/FilePreview.test.js +0 -92
- package/dist/esm/ImagePreview/ImagePreview.test.d.ts +0 -1
- package/dist/esm/ImagePreview/ImagePreview.test.js +0 -220
- package/dist/esm/MarkdownContent/MarkdownContent.test.d.ts +0 -1
- package/dist/esm/MarkdownContent/MarkdownContent.test.js +0 -187
- package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.test.d.ts +0 -1
- package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.test.js +0 -126
- package/dist/esm/Message/ErrorMessage/ErrorMessage.test.d.ts +0 -1
- package/dist/esm/Message/ErrorMessage/ErrorMessage.test.js +0 -25
- package/dist/esm/Message/Message.test.d.ts +0 -1
- package/dist/esm/Message/Message.test.js +0 -1123
- package/dist/esm/Message/MessageAndActions/MessageAndActions.test.d.ts +0 -1
- package/dist/esm/Message/MessageAndActions/MessageAndActions.test.js +0 -20
- package/dist/esm/Message/MessageAttachments/MessageAttachmentItem.test.d.ts +0 -1
- package/dist/esm/Message/MessageAttachments/MessageAttachmentItem.test.js +0 -20
- package/dist/esm/Message/MessageAttachments/MessageAttachmentsContainer.test.d.ts +0 -1
- package/dist/esm/Message/MessageAttachments/MessageAttachmentsContainer.test.js +0 -20
- package/dist/esm/Message/MessageLoading.test.d.ts +0 -1
- package/dist/esm/Message/MessageLoading.test.js +0 -20
- package/dist/esm/Message/QuickResponse/QuickResponse.test.d.ts +0 -1
- package/dist/esm/Message/QuickResponse/QuickResponse.test.js +0 -104
- package/dist/esm/Message/QuickStarts/QuickStartTileDescription.test.d.ts +0 -1
- package/dist/esm/Message/QuickStarts/QuickStartTileDescription.test.js +0 -48
- package/dist/esm/Message/UserFeedback/UserFeedback.test.d.ts +0 -1
- package/dist/esm/Message/UserFeedback/UserFeedback.test.js +0 -176
- package/dist/esm/Message/UserFeedback/UserFeedbackComplete.test.d.ts +0 -1
- package/dist/esm/Message/UserFeedback/UserFeedbackComplete.test.js +0 -238
- package/dist/esm/MessageBar/AttachButton.test.d.ts +0 -1
- package/dist/esm/MessageBar/AttachButton.test.js +0 -147
- package/dist/esm/MessageBar/MessageBar.test.d.ts +0 -1
- package/dist/esm/MessageBar/MessageBar.test.js +0 -333
- package/dist/esm/MessageBar/SendButton.test.d.ts +0 -1
- package/dist/esm/MessageBar/SendButton.test.js +0 -53
- package/dist/esm/MessageBar/StopButton.test.d.ts +0 -1
- package/dist/esm/MessageBar/StopButton.test.js +0 -53
- package/dist/esm/MessageBox/JumpButton.test.d.ts +0 -1
- package/dist/esm/MessageBox/JumpButton.test.js +0 -34
- package/dist/esm/MessageBox/MessageBox.test.d.ts +0 -1
- package/dist/esm/MessageBox/MessageBox.test.js +0 -289
- package/dist/esm/MessageDivider/MessageDivider.test.d.ts +0 -1
- package/dist/esm/MessageDivider/MessageDivider.test.js +0 -24
- package/dist/esm/Onboarding/Onboarding.test.d.ts +0 -1
- package/dist/esm/Onboarding/Onboarding.test.js +0 -75
- package/dist/esm/PreviewAttachment/PreviewAttachment.test.d.ts +0 -1
- package/dist/esm/PreviewAttachment/PreviewAttachment.test.js +0 -48
- package/dist/esm/ResponseActions/ResponseActionButton.test.d.ts +0 -1
- package/dist/esm/ResponseActions/ResponseActionButton.test.js +0 -49
- package/dist/esm/ResponseActions/ResponseActions.test.d.ts +0 -1
- package/dist/esm/ResponseActions/ResponseActions.test.js +0 -450
- package/dist/esm/ResponseActions/ResponseActionsGroups.test.d.ts +0 -1
- package/dist/esm/ResponseActions/ResponseActionsGroups.test.js +0 -20
- package/dist/esm/Settings/SettingsForm.test.d.ts +0 -1
- package/dist/esm/Settings/SettingsForm.test.js +0 -33
- package/dist/esm/SourcesCard/SourcesCard.test.d.ts +0 -1
- package/dist/esm/SourcesCard/SourcesCard.test.js +0 -34
- package/dist/esm/SourcesCardBase/SourcesCardBase.test.d.ts +0 -1
- package/dist/esm/SourcesCardBase/SourcesCardBase.test.js +0 -194
- package/dist/esm/TermsOfUse/TermsOfUse.test.d.ts +0 -1
- package/dist/esm/TermsOfUse/TermsOfUse.test.js +0 -72
- package/dist/esm/ToolCall/ToolCall.test.d.ts +0 -1
- package/dist/esm/ToolCall/ToolCall.test.js +0 -196
- package/dist/esm/ToolResponse/ToolResponse.test.d.ts +0 -1
- package/dist/esm/ToolResponse/ToolResponse.test.js +0 -179
- package/dist/esm/__mocks__/monaco-editor.d.ts +0 -11
- package/dist/esm/__mocks__/monaco-editor.js +0 -18
- package/dist/esm/__mocks__/rehype-external-links.d.ts +0 -2
- package/dist/esm/__mocks__/rehype-external-links.js +0 -2
- package/dist/esm/__mocks__/rehype-highlight.d.ts +0 -2
- package/dist/esm/__mocks__/rehype-highlight.js +0 -2
- package/dist/esm/__mocks__/rehype-sanitize.d.ts +0 -2
- package/dist/esm/__mocks__/rehype-sanitize.js +0 -2
- package/dist/esm/__mocks__/rehype-unwrap-images.d.ts +0 -2
- package/dist/esm/__mocks__/rehype-unwrap-images.js +0 -2
|
@@ -48,7 +48,7 @@ import MessageDivider from '@patternfly/chatbot/dist/dynamic/MessageDivider';
|
|
|
48
48
|
import ToolCall from '@patternfly/chatbot/dist/dynamic/ToolCall';
|
|
49
49
|
import ResponseActions, { ResponseActionsGroups } from '@patternfly/chatbot/dist/dynamic/ResponseActions';
|
|
50
50
|
import ToolResponse from '@patternfly/chatbot/dist/dynamic/ToolResponse';
|
|
51
|
-
import { rehypeCodeBlockToggle } from '@patternfly/chatbot/dist/
|
|
51
|
+
import { rehypeCodeBlockToggle } from '@patternfly/chatbot/dist/dynamic/Message';
|
|
52
52
|
import SourcesCard from '@patternfly/chatbot/dist/dynamic/SourcesCard';
|
|
53
53
|
import { RhUiArrowCircleDownFillIcon, RhUiArrowRightIcon, RhUiCheckCircleFillIcon, RhUiCopyFillIcon, RhUiExportIcon, RhMicronsInformationFillIcon, OutlinedQuestionCircleIcon, RhUiRedoIcon, RhUiBuildFillIcon, RhUiQuestionMarkCircleIcon } from '@patternfly/react-icons';
|
|
54
54
|
import patternflyAvatar from './patternfly_avatar.jpg';
|
|
@@ -59,7 +59,7 @@ import FileDropZone from '@patternfly/chatbot/dist/dynamic/FileDropZone';
|
|
|
59
59
|
import { PreviewAttachment } from '@patternfly/chatbot/dist/dynamic/PreviewAttachment';
|
|
60
60
|
import ChatbotAlert from '@patternfly/chatbot/dist/dynamic/ChatbotAlert';
|
|
61
61
|
import { explorePipelinesQuickStart } from './explore-pipeline-quickstart.ts';
|
|
62
|
-
import { monitorSampleAppQuickStart } from '
|
|
62
|
+
import { monitorSampleAppQuickStart } from './monitor-sampleapp-quickstart.ts';
|
|
63
63
|
import userAvatar from './user_avatar.svg';
|
|
64
64
|
import squareImg from './PF-social-color-square.svg';
|
|
65
65
|
import { CSSProperties, useState, Fragment, FunctionComponent, MouseEvent as ReactMouseEvent, KeyboardEvent as ReactKeyboardEvent, Ref, isValidElement, cloneElement, Children, ReactNode, useRef, useEffect } from 'react';
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
SelectList,
|
|
20
20
|
SelectOption
|
|
21
21
|
} from '@patternfly/react-core';
|
|
22
|
-
import { rehypeCodeBlockToggle } from '@patternfly/chatbot/dist/
|
|
22
|
+
import { rehypeCodeBlockToggle } from '@patternfly/chatbot/dist/dynamic/Message';
|
|
23
23
|
|
|
24
24
|
export const UserMessageExample: FunctionComponent = () => {
|
|
25
25
|
const messageInputRef = useRef<HTMLTextAreaElement>(null);
|
package/patternfly-docs/content/extensions/chatbot/examples/Messages/monitor-sampleapp-quickstart.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { monitorSampleAppQuickStart } from '../../../../../../src/Message/QuickStarts/monitor-sampleapp-quickstart.ts';
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: Tree-shaking
|
|
3
|
+
title: Tree-shaking
|
|
4
|
+
section: extensions
|
|
5
|
+
subsection: ChatBot
|
|
6
|
+
sortValue: 80
|
|
7
|
+
source: TreeShaking
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Note:** The PatternFly ChatBot extension lives in its own package [`@patternfly/chatbot`](https://www.npmjs.com/package/@patternfly/chatbot).
|
|
11
|
+
|
|
12
|
+
When you add ChatBot to your application, you want the bundler to include only the components you actually use — not the entire library or every PatternFly icon. ChatBot is designed to support tree-shaking when imported correctly.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Recommended import pattern
|
|
17
|
+
|
|
18
|
+
Import each component from its dynamic entry point:
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import ChatbotToggle from '@patternfly/chatbot/dist/dynamic/ChatbotToggle';
|
|
22
|
+
import ChatbotHeader from '@patternfly/chatbot/dist/dynamic/ChatbotHeader';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Named imports from the root barrel also tree-shake with modern bundlers:
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import { ChatbotToggle } from '@patternfly/chatbot';
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Sub-components can be imported from the same entry point:
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
import ChatbotHeader, {
|
|
35
|
+
ChatbotHeaderMenu,
|
|
36
|
+
ChatbotHeaderMain,
|
|
37
|
+
} from '@patternfly/chatbot/dist/dynamic/ChatbotHeader';
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Per-component `dist/dynamic` imports are preferred for faster builds and for components excluded from the root barrel (`CodeModal`, `PreviewAttachment`, `AttachmentEdit`).
|
|
41
|
+
|
|
42
|
+
## What to avoid
|
|
43
|
+
|
|
44
|
+
Do **not** use wildcard imports from the package root:
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
// Avoid — may pull in the entire library
|
|
48
|
+
import * as Chatbot from '@patternfly/chatbot';
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Icon imports
|
|
52
|
+
|
|
53
|
+
Which PatternFly icons end up in your bundle depends on **which ChatBot components you import**, not on whether ChatBot source code or your app uses barrel or deep icon paths. Importing `ChatbotToggle` via `dist/dynamic` includes only the icons that component uses.
|
|
54
|
+
|
|
55
|
+
## CSS import
|
|
56
|
+
|
|
57
|
+
ChatBot styles are side-effectful and must be imported explicitly:
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
import '@patternfly/chatbot/dist/css/main.css';
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Place this import after your PatternFly CSS imports so ChatBot overrides apply correctly.
|
|
64
|
+
|
|
65
|
+
## Monaco editor (`CodeModal`, attachment preview and edit)
|
|
66
|
+
|
|
67
|
+
`CodeModal` (used by `PreviewAttachment` and `AttachmentEdit`) lazy-loads Monaco. Web workers must be configured before the modal opens. Import the package worker helper once at application startup:
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
import '@patternfly/chatbot/monaco-environment';
|
|
71
|
+
import PreviewAttachment from '@patternfly/chatbot/dist/dynamic/PreviewAttachment';
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`CodeModal`, `PreviewAttachment`, and `AttachmentEdit` are excluded from the root barrel so Monaco stays out of root-barrel bundles. Import them from dynamic entry points:
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
import PreviewAttachment from '@patternfly/chatbot/dist/dynamic/PreviewAttachment';
|
|
78
|
+
import AttachmentEdit from '@patternfly/chatbot/dist/dynamic/AttachmentEdit';
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
`monaco-editor` and `@monaco-editor/react` are peer dependencies when you use these components.
|
|
82
|
+
|
|
83
|
+
## Markdown rendering (`Message`, `MarkdownContent`)
|
|
84
|
+
|
|
85
|
+
`MarkdownContent` lazy-loads its markdown parser so lightweight imports avoid pulling in `react-markdown`, syntax highlighting, and related dependencies until they are needed. That async chunk is roughly 400 KB.
|
|
86
|
+
|
|
87
|
+
`MessageBox` automatically preloads the markdown renderer and coordinates rendering so existing messages do not each flash an individual loading state — message chrome (avatars, timestamps, and so on) appears immediately, and markdown content fills in once the chunk is ready.
|
|
88
|
+
|
|
89
|
+
For chatbots that display messages on first render, you can call `preloadMarkdownRenderer()` earlier in your application — such as in your app's entry point or route loader — so the chunk is already loaded by the time the chatbot mounts:
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
// App.tsx or route loader — call once at startup
|
|
93
|
+
import { preloadMarkdownRenderer } from '@patternfly/chatbot/dist/dynamic/MarkdownContent';
|
|
94
|
+
|
|
95
|
+
preloadMarkdownRenderer();
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Migration: root barrel changes
|
|
99
|
+
|
|
100
|
+
The following modules are **not** re-exported from the root barrel (`@patternfly/chatbot`). They were removed so Monaco and internal utilities stay out of default bundles. Update existing root imports to subpath entry points:
|
|
101
|
+
|
|
102
|
+
| Module | Before (no longer works) | After |
|
|
103
|
+
|--------|--------------------------|-------|
|
|
104
|
+
| `CodeModal` | `import { CodeModal } from '@patternfly/chatbot'` | `import CodeModal from '@patternfly/chatbot/dist/dynamic/CodeModal'` |
|
|
105
|
+
| `PreviewAttachment` | `import { PreviewAttachment } from '@patternfly/chatbot'` | `import PreviewAttachment from '@patternfly/chatbot/dist/dynamic/PreviewAttachment'` |
|
|
106
|
+
| `AttachmentEdit` | `import { AttachmentEdit } from '@patternfly/chatbot'` | `import AttachmentEdit from '@patternfly/chatbot/dist/dynamic/AttachmentEdit'` |
|
|
107
|
+
| `tracking` | `import { getTrackingProviders } from '@patternfly/chatbot'` | `import { getTrackingProviders } from '@patternfly/chatbot/dist/dynamic/tracking'` |
|
|
108
|
+
|
|
109
|
+
All other components remain available from the root barrel and continue to tree-shake when your bundler respects the package `sideEffects` field.
|
|
110
|
+
|
|
111
|
+
When using `CodeModal`, `PreviewAttachment`, or `AttachmentEdit`, also import the Monaco worker helper once at application startup:
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
import '@patternfly/chatbot/monaco-environment';
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## How ChatBot supports tree-shaking
|
|
118
|
+
|
|
119
|
+
- **ESM output** with a `module` field pointing to `dist/esm/`
|
|
120
|
+
- **`sideEffects`** in `package.json` so bundlers can drop unused re-exports from the root barrel while preserving CSS and the documentation-site style entry (`patternfly-docs/**`)
|
|
121
|
+
- **Per-component dynamic entry points** at `dist/dynamic/<Component>/`
|
|
122
|
+
- **Unbundled compilation** — icons and dependencies remain as external imports for your bundler to resolve
|
|
123
|
+
- **`exports`** field maps public subpaths for bundler-friendly resolution
|
|
124
|
+
- **Explicit CSS imports** (see above)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/* global globalThis */
|
|
2
|
+
// Docs-site worker setup for rspack/webpack. Paths target hoisted monaco-editor in the
|
|
3
|
+
// workspace root (../../../node_modules/...). npm consumers should import
|
|
4
|
+
// @patternfly/chatbot/monaco-environment instead (../../monaco-editor/... layout).
|
|
5
|
+
// Each branch must use inline new Worker(new URL(...)) so rspack emits worker chunks.
|
|
6
|
+
const workerOptions = { type: 'module' };
|
|
7
|
+
|
|
8
|
+
if (typeof globalThis !== 'undefined' && !globalThis.MonacoEnvironment?.getWorker) {
|
|
9
|
+
globalThis.MonacoEnvironment = {
|
|
10
|
+
getWorker(_workerId, label) {
|
|
11
|
+
switch (label) {
|
|
12
|
+
case 'json':
|
|
13
|
+
return new Worker(
|
|
14
|
+
new URL('../../../node_modules/monaco-editor/esm/vs/language/json/json.worker.js', import.meta.url),
|
|
15
|
+
workerOptions
|
|
16
|
+
);
|
|
17
|
+
case 'css':
|
|
18
|
+
case 'scss':
|
|
19
|
+
case 'less':
|
|
20
|
+
return new Worker(
|
|
21
|
+
new URL('../../../node_modules/monaco-editor/esm/vs/language/css/css.worker.js', import.meta.url),
|
|
22
|
+
workerOptions
|
|
23
|
+
);
|
|
24
|
+
case 'html':
|
|
25
|
+
case 'handlebars':
|
|
26
|
+
case 'razor':
|
|
27
|
+
return new Worker(
|
|
28
|
+
new URL('../../../node_modules/monaco-editor/esm/vs/language/html/html.worker.js', import.meta.url),
|
|
29
|
+
workerOptions
|
|
30
|
+
);
|
|
31
|
+
case 'typescript':
|
|
32
|
+
case 'javascript':
|
|
33
|
+
return new Worker(
|
|
34
|
+
new URL('../../../node_modules/monaco-editor/esm/vs/language/typescript/ts.worker.js', import.meta.url),
|
|
35
|
+
workerOptions
|
|
36
|
+
);
|
|
37
|
+
default:
|
|
38
|
+
return new Worker(
|
|
39
|
+
new URL('../../../node_modules/monaco-editor/esm/vs/editor/editor.worker.js', import.meta.url),
|
|
40
|
+
workerOptions
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
// Patternfly
|
|
2
|
+
// Monaco workers for CodeModal attachment examples — load before any editor opens.
|
|
3
|
+
// The docs framework aliases this file as the global client entry (client-styles), so
|
|
4
|
+
// side-effect imports belong here even though the filename suggests CSS only.
|
|
5
|
+
// Uses patternfly-docs/monaco-environment.js (monorepo node_modules paths), not the package export.
|
|
6
|
+
// This file must stay side-effectful — see package.json "sideEffects" ("patternfly-docs/**").
|
|
7
|
+
import './monaco-environment.js';
|
|
2
8
|
import '@patternfly/patternfly/patternfly.css';
|
|
3
9
|
// Patternfly utilities
|
|
4
10
|
import '@patternfly/patternfly/patternfly-addons.css';
|
package/src/Chatbot/Chatbot.scss
CHANGED
|
@@ -48,6 +48,10 @@
|
|
|
48
48
|
var(--pf-t--global--background--color--secondary--default)
|
|
49
49
|
);
|
|
50
50
|
}
|
|
51
|
+
|
|
52
|
+
&:not(&--default):has(.pf-chatbot__content.pf-m-primary) {
|
|
53
|
+
background-color: var(--pf-t--global--background--color--primary--default);
|
|
54
|
+
}
|
|
51
55
|
}
|
|
52
56
|
|
|
53
57
|
:root:where(.pf-v6-theme-felt):not(.pf-v6-theme-glass) {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
.pf-chatbot:not(.pf-chatbot--default) {
|
|
22
|
-
.pf-chatbot__content {
|
|
22
|
+
.pf-chatbot__content:not(.pf-m-primary) {
|
|
23
23
|
background-color: var(
|
|
24
24
|
--pf-t--global--background--color--glass--primary--default,
|
|
25
25
|
var(--pf-t--global--background--color--secondary--default)
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
.pf-chatbot:not(.pf-
|
|
21
|
-
.pf-chatbot__footer {
|
|
20
|
+
.pf-chatbot:not(.pf-chatbot--default) {
|
|
21
|
+
.pf-chatbot__footer:not(.pf-m-primary) {
|
|
22
22
|
background-color: var(--pf-t--global--background--color--secondary--default);
|
|
23
23
|
|
|
24
24
|
@at-root :where(.pf-v6-theme-glass) & {
|
|
@@ -64,6 +64,10 @@
|
|
|
64
64
|
background-color: var(--pf-t--global--background--color--glass--primary--default);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
+
|
|
68
|
+
&:has(.pf-chatbot__content.pf-m-primary) .pf-chatbot__header {
|
|
69
|
+
background-color: var(--pf-t--global--background--color--primary--default);
|
|
70
|
+
}
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
// ============================================================================
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
.pf-chatbot__chatbot-modal {
|
|
6
6
|
--pf-v6-c-modal-box--BorderRadius: var(--pf-t--global--border--radius--medium) !important;
|
|
7
|
+
--pf-v6-c-modal-box--BackgroundColor: var(--pf-t--global--background--color--floating--secondary--default);
|
|
7
8
|
position: fixed !important;
|
|
8
9
|
inset-block-end: var(--pf-t--global--spacer--800); // no associated semantic token
|
|
9
10
|
inset-inline-end: var(--pf-t--global--spacer--lg);
|
|
@@ -26,6 +27,15 @@
|
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
|
|
30
|
+
:root:where(.pf-v6-theme-glass) {
|
|
31
|
+
.pf-chatbot__chatbot-modal {
|
|
32
|
+
--pf-v6-c-modal-box--BackgroundColor: var(
|
|
33
|
+
--pf-t--global--background--color--glass--primary--default,
|
|
34
|
+
var(--pf-t--global--background--color--secondary--default)
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
29
39
|
// ============================================================================
|
|
30
40
|
// Chatbot Display Mode - Fullscreen and Embedded
|
|
31
41
|
// ============================================================================
|
|
@@ -27,6 +27,12 @@ import ChatbotModal from '../ChatbotModal/ChatbotModal';
|
|
|
27
27
|
let monacoInstance: typeof import('monaco-editor') | null = null;
|
|
28
28
|
const loadMonaco = async () => {
|
|
29
29
|
if (!monacoInstance) {
|
|
30
|
+
if (!globalThis.MonacoEnvironment?.getWorker && !globalThis.MonacoEnvironment?.getWorkerUrl) {
|
|
31
|
+
// eslint-disable-next-line no-console
|
|
32
|
+
console.error(
|
|
33
|
+
'Monaco web workers are not configured. Import @patternfly/chatbot/monaco-environment before using CodeModal.'
|
|
34
|
+
);
|
|
35
|
+
}
|
|
30
36
|
const [monaco, { loader }] = await Promise.all([import('monaco-editor'), import('@monaco-editor/react')]);
|
|
31
37
|
monacoInstance = monaco;
|
|
32
38
|
loader.config({ monaco });
|
|
@@ -2,6 +2,7 @@ import { render, screen } from '@testing-library/react';
|
|
|
2
2
|
import userEvent from '@testing-library/user-event';
|
|
3
3
|
import '@testing-library/jest-dom';
|
|
4
4
|
import DeepThinking from './DeepThinking';
|
|
5
|
+
import { expectBoldMarkdownText } from '../test-utils/markdownTestUtils';
|
|
5
6
|
|
|
6
7
|
describe('DeepThinking', () => {
|
|
7
8
|
const defaultProps = {
|
|
@@ -120,11 +121,10 @@ describe('DeepThinking', () => {
|
|
|
120
121
|
expect(screen.getByText('Thinking content')).not.toBeVisible();
|
|
121
122
|
});
|
|
122
123
|
|
|
123
|
-
it('should render toggleContent as markdown when isToggleContentMarkdown is true', () => {
|
|
124
|
+
it('should render toggleContent as markdown when isToggleContentMarkdown is true', async () => {
|
|
124
125
|
const toggleContent = '**Bold thinking**';
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
expect(screen.getByText('Bold thinking')).toBeTruthy();
|
|
126
|
+
render(<DeepThinking toggleContent={toggleContent} isToggleContentMarkdown />);
|
|
127
|
+
await expectBoldMarkdownText('Bold thinking');
|
|
128
128
|
});
|
|
129
129
|
|
|
130
130
|
it('should not render toggleContent as markdown when isToggleContentMarkdown is false', () => {
|
|
@@ -134,11 +134,10 @@ describe('DeepThinking', () => {
|
|
|
134
134
|
expect(screen.getByText('**Bold thinking**')).toBeTruthy();
|
|
135
135
|
});
|
|
136
136
|
|
|
137
|
-
it('should render subheading as markdown when isSubheadingMarkdown is true', () => {
|
|
137
|
+
it('should render subheading as markdown when isSubheadingMarkdown is true', async () => {
|
|
138
138
|
const subheading = '**Bold subheading**';
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
expect(screen.getByText('Bold subheading')).toBeTruthy();
|
|
139
|
+
render(<DeepThinking {...defaultProps} subheading={subheading} isSubheadingMarkdown />);
|
|
140
|
+
await expectBoldMarkdownText('Bold subheading');
|
|
142
141
|
});
|
|
143
142
|
|
|
144
143
|
it('should not render subheading as markdown when isSubheadingMarkdown is false', () => {
|
|
@@ -147,11 +146,10 @@ describe('DeepThinking', () => {
|
|
|
147
146
|
expect(screen.getByText('**Bold subheading**')).toBeTruthy();
|
|
148
147
|
});
|
|
149
148
|
|
|
150
|
-
it('should render body as markdown when isBodyMarkdown is true', () => {
|
|
149
|
+
it('should render body as markdown when isBodyMarkdown is true', async () => {
|
|
151
150
|
const body = '**Bold body**';
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
expect(screen.getByText('Bold body')).toBeTruthy();
|
|
151
|
+
render(<DeepThinking {...defaultProps} body={body} isBodyMarkdown />);
|
|
152
|
+
await expectBoldMarkdownText('Bold body');
|
|
155
153
|
});
|
|
156
154
|
|
|
157
155
|
it('should not render body as markdown when isBodyMarkdown is false', () => {
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { render, screen } from '@testing-library/react';
|
|
2
2
|
import '@testing-library/jest-dom';
|
|
3
|
-
import MarkdownContent
|
|
3
|
+
import MarkdownContent, {
|
|
4
|
+
MarkdownRendererReadyContext,
|
|
5
|
+
preloadMarkdownRenderer,
|
|
6
|
+
whenMarkdownRendererReady
|
|
7
|
+
} from './MarkdownContent';
|
|
4
8
|
import rehypeExternalLinks from '../__mocks__/rehype-external-links';
|
|
9
|
+
import { expectBoldMarkdownText, warmupMarkdownRenderer } from '../test-utils/markdownTestUtils';
|
|
5
10
|
|
|
6
11
|
const BOLD_TEXT = '**Bold text**';
|
|
7
12
|
const ITALIC_TEXT = '*Italic text*';
|
|
@@ -33,14 +38,17 @@ const BLOCKQUOTE = '> This is a blockquote';
|
|
|
33
38
|
const IMAGE = '';
|
|
34
39
|
|
|
35
40
|
describe('MarkdownContent', () => {
|
|
41
|
+
beforeAll(async () => {
|
|
42
|
+
await warmupMarkdownRenderer();
|
|
43
|
+
});
|
|
44
|
+
|
|
36
45
|
beforeEach(() => {
|
|
37
46
|
jest.clearAllMocks();
|
|
38
47
|
});
|
|
39
48
|
|
|
40
|
-
it('should render bold text correctly', () => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
expect(screen.getByText('Bold text')).toBeTruthy();
|
|
49
|
+
it('should render bold text correctly', async () => {
|
|
50
|
+
render(<MarkdownContent content={BOLD_TEXT} />);
|
|
51
|
+
await expectBoldMarkdownText('Bold text');
|
|
44
52
|
});
|
|
45
53
|
|
|
46
54
|
it('should render italic text correctly', () => {
|
|
@@ -205,3 +213,42 @@ const x = 5;
|
|
|
205
213
|
expect(screen.getByRole('link', { name: /Link/i })).toBeTruthy();
|
|
206
214
|
});
|
|
207
215
|
});
|
|
216
|
+
|
|
217
|
+
describe('preloadMarkdownRenderer', () => {
|
|
218
|
+
it('starts loading the markdown renderer', async () => {
|
|
219
|
+
preloadMarkdownRenderer();
|
|
220
|
+
const module = await whenMarkdownRendererReady();
|
|
221
|
+
expect(module.default).toBeDefined();
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
describe('whenMarkdownRendererReady', () => {
|
|
226
|
+
it('should resolve to the MarkdownRenderer module', async () => {
|
|
227
|
+
const module = await whenMarkdownRendererReady();
|
|
228
|
+
expect(module.default).toBeDefined();
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
describe('MarkdownContent with MarkdownRendererReadyContext', () => {
|
|
233
|
+
it('renders nothing while markdown is not ready inside MessageBox', () => {
|
|
234
|
+
const { container } = render(
|
|
235
|
+
<MarkdownRendererReadyContext.Provider value={false}>
|
|
236
|
+
<MarkdownContent content={BOLD_TEXT} />
|
|
237
|
+
</MarkdownRendererReadyContext.Provider>
|
|
238
|
+
);
|
|
239
|
+
|
|
240
|
+
expect(container).toBeEmptyDOMElement();
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
describe('MarkdownContent lazy loading', () => {
|
|
245
|
+
it('renders nothing while markdown renderer is not ready', () => {
|
|
246
|
+
const { container } = render(
|
|
247
|
+
<MarkdownRendererReadyContext.Provider value={false}>
|
|
248
|
+
<MarkdownContent content={BOLD_TEXT} />
|
|
249
|
+
</MarkdownRendererReadyContext.Provider>
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
expect(container).toBeEmptyDOMElement();
|
|
253
|
+
});
|
|
254
|
+
});
|