@patternfly/chatbot 2.2.1 → 6.3.0-prerelease.10
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/AttachmentEdit/AttachmentEdit.d.ts +2 -0
- package/dist/cjs/AttachmentEdit/AttachmentEdit.js +2 -2
- package/dist/cjs/Chatbot/Chatbot.d.ts +2 -0
- package/dist/cjs/Chatbot/Chatbot.js +2 -2
- package/dist/cjs/Chatbot/Chatbot.test.js +4 -0
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +6 -0
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +9 -3
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +27 -0
- package/dist/cjs/ChatbotFooter/ChatbotFooter.d.ts +1 -0
- package/dist/cjs/ChatbotFooter/ChatbotFooter.js +2 -2
- package/dist/cjs/ChatbotFooter/ChatbotFooter.test.d.ts +1 -1
- package/dist/cjs/ChatbotFooter/ChatbotFooter.test.js +5 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeader.js +1 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.d.ts +4 -2
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.js +20 -6
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.test.d.ts +1 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.test.js +5 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMain.js +1 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.d.ts +3 -2
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.js +20 -6
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.d.ts +1 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.js +5 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.d.ts +1 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.js +3 -3
- package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.d.ts +1 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +5 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.d.ts +1 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +2 -2
- package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.d.ts +1 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +5 -0
- package/dist/cjs/ChatbotModal/ChatbotModal.d.ts +3 -0
- package/dist/cjs/ChatbotModal/ChatbotModal.js +2 -2
- package/dist/cjs/ChatbotModal/ChatbotModal.test.d.ts +1 -0
- package/dist/cjs/ChatbotModal/ChatbotModal.test.js +28 -0
- package/dist/cjs/ChatbotPopover/ChatbotPopover.js +1 -1
- package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.d.ts +1 -0
- package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.js +3 -3
- package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +4 -0
- package/dist/cjs/CodeModal/CodeModal.d.ts +2 -0
- package/dist/cjs/CodeModal/CodeModal.js +3 -3
- package/dist/cjs/CodeModal/CodeModal.test.d.ts +1 -0
- package/dist/cjs/CodeModal/CodeModal.test.js +15 -0
- package/dist/cjs/FileDetails/FileDetails.js +1 -1
- package/dist/cjs/Message/Message.d.ts +19 -1
- package/dist/cjs/Message/Message.js +58 -39
- package/dist/cjs/Message/Message.test.js +64 -0
- package/dist/cjs/Message/MessageInput.d.ts +18 -0
- package/dist/cjs/Message/MessageInput.js +34 -0
- package/dist/cjs/Message/QuickResponse/QuickResponse.d.ts +2 -0
- package/dist/cjs/Message/QuickResponse/QuickResponse.js +2 -2
- package/dist/cjs/Message/QuickStarts/QuickStartTile.d.ts +2 -0
- package/dist/cjs/Message/QuickStarts/QuickStartTile.js +2 -2
- package/dist/cjs/Message/UserFeedback/UserFeedback.js +4 -4
- package/dist/cjs/Message/UserFeedback/UserFeedback.test.js +4 -0
- package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.js +4 -4
- package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.test.js +4 -0
- package/dist/cjs/MessageBar/AttachButton.d.ts +1 -0
- package/dist/cjs/MessageBar/AttachButton.js +3 -3
- package/dist/cjs/MessageBar/AttachButton.test.js +4 -0
- package/dist/cjs/MessageBar/MessageBar.d.ts +5 -0
- package/dist/cjs/MessageBar/MessageBar.js +14 -13
- package/dist/cjs/MessageBar/MessageBar.test.js +13 -0
- package/dist/cjs/MessageBar/MicrophoneButton.d.ts +1 -0
- package/dist/cjs/MessageBar/MicrophoneButton.js +4 -4
- package/dist/cjs/MessageBar/SendButton.d.ts +1 -0
- package/dist/cjs/MessageBar/SendButton.js +3 -3
- package/dist/cjs/MessageBar/SendButton.test.js +4 -0
- package/dist/cjs/MessageBar/StopButton.d.ts +1 -0
- package/dist/cjs/MessageBar/StopButton.js +3 -3
- package/dist/cjs/MessageBar/StopButton.test.js +4 -0
- package/dist/cjs/MessageBox/MessageBox.d.ts +4 -0
- package/dist/cjs/MessageBox/MessageBox.js +21 -7
- package/dist/cjs/MessageBox/MessageBox.test.js +43 -0
- package/dist/cjs/PreviewAttachment/PreviewAttachment.d.ts +2 -0
- package/dist/cjs/PreviewAttachment/PreviewAttachment.js +2 -2
- package/dist/cjs/Settings/SettingsForm.d.ts +2 -0
- package/dist/cjs/Settings/SettingsForm.js +2 -2
- package/dist/cjs/Settings/SettingsForm.test.d.ts +1 -1
- package/dist/cjs/Settings/SettingsForm.test.js +12 -0
- package/dist/cjs/SourcesCard/SourcesCard.d.ts +7 -1
- package/dist/cjs/SourcesCard/SourcesCard.js +17 -11
- package/dist/cjs/SourcesCard/SourcesCard.test.js +25 -15
- package/dist/cjs/TermsOfUse/TermsOfUse.d.ts +2 -0
- package/dist/cjs/TermsOfUse/TermsOfUse.js +5 -5
- package/dist/cjs/tracking/console_tracking_provider.d.ts +4 -5
- package/dist/cjs/tracking/console_tracking_provider.js +22 -15
- package/dist/cjs/tracking/posthog_tracking_provider.d.ts +2 -2
- package/dist/cjs/tracking/posthog_tracking_provider.js +21 -12
- package/dist/cjs/tracking/segment_tracking_provider.d.ts +2 -2
- package/dist/cjs/tracking/segment_tracking_provider.js +21 -12
- package/dist/cjs/tracking/trackingProviderProxy.d.ts +1 -1
- package/dist/cjs/tracking/trackingProviderProxy.js +2 -2
- package/dist/cjs/tracking/tracking_api.d.ts +1 -1
- package/dist/cjs/tracking/tracking_registry.js +46 -12
- package/dist/cjs/tracking/tracking_spi.d.ts +15 -5
- package/dist/cjs/tracking/tracking_spi.js +9 -0
- package/dist/cjs/tracking/umami_tracking_provider.d.ts +6 -2
- package/dist/cjs/tracking/umami_tracking_provider.js +66 -22
- package/dist/css/main.css +225 -22
- package/dist/css/main.css.map +1 -1
- package/dist/esm/AttachmentEdit/AttachmentEdit.d.ts +2 -0
- package/dist/esm/AttachmentEdit/AttachmentEdit.js +2 -2
- package/dist/esm/Chatbot/Chatbot.d.ts +2 -0
- package/dist/esm/Chatbot/Chatbot.js +2 -2
- package/dist/esm/Chatbot/Chatbot.test.js +4 -0
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +6 -0
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +9 -3
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +27 -0
- package/dist/esm/ChatbotFooter/ChatbotFooter.d.ts +1 -0
- package/dist/esm/ChatbotFooter/ChatbotFooter.js +2 -2
- package/dist/esm/ChatbotFooter/ChatbotFooter.test.d.ts +1 -1
- package/dist/esm/ChatbotFooter/ChatbotFooter.test.js +5 -0
- package/dist/esm/ChatbotHeader/ChatbotHeader.js +1 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.d.ts +4 -2
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.js +20 -6
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.test.d.ts +1 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.test.js +5 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderMain.js +1 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.d.ts +3 -2
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.js +20 -6
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.d.ts +1 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.js +5 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.d.ts +1 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.js +3 -3
- package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.d.ts +1 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +5 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.d.ts +1 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +2 -2
- package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.d.ts +1 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +5 -0
- package/dist/esm/ChatbotModal/ChatbotModal.d.ts +3 -0
- package/dist/esm/ChatbotModal/ChatbotModal.js +2 -2
- package/dist/esm/ChatbotModal/ChatbotModal.test.d.ts +1 -0
- package/dist/esm/ChatbotModal/ChatbotModal.test.js +23 -0
- package/dist/esm/ChatbotPopover/ChatbotPopover.js +1 -1
- package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.d.ts +1 -0
- package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.js +3 -3
- package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +4 -0
- package/dist/esm/CodeModal/CodeModal.d.ts +2 -0
- package/dist/esm/CodeModal/CodeModal.js +3 -3
- package/dist/esm/CodeModal/CodeModal.test.d.ts +1 -0
- package/dist/esm/CodeModal/CodeModal.test.js +10 -0
- package/dist/esm/FileDetails/FileDetails.js +1 -1
- package/dist/esm/Message/Message.d.ts +19 -1
- package/dist/esm/Message/Message.js +58 -39
- package/dist/esm/Message/Message.test.js +64 -0
- package/dist/esm/Message/MessageInput.d.ts +18 -0
- package/dist/esm/Message/MessageInput.js +29 -0
- package/dist/esm/Message/QuickResponse/QuickResponse.d.ts +2 -0
- package/dist/esm/Message/QuickResponse/QuickResponse.js +2 -2
- package/dist/esm/Message/QuickStarts/QuickStartTile.d.ts +2 -0
- package/dist/esm/Message/QuickStarts/QuickStartTile.js +2 -2
- package/dist/esm/Message/UserFeedback/UserFeedback.js +4 -4
- package/dist/esm/Message/UserFeedback/UserFeedback.test.js +4 -0
- package/dist/esm/Message/UserFeedback/UserFeedbackComplete.js +4 -4
- package/dist/esm/Message/UserFeedback/UserFeedbackComplete.test.js +4 -0
- package/dist/esm/MessageBar/AttachButton.d.ts +1 -0
- package/dist/esm/MessageBar/AttachButton.js +3 -3
- package/dist/esm/MessageBar/AttachButton.test.js +4 -0
- package/dist/esm/MessageBar/MessageBar.d.ts +5 -0
- package/dist/esm/MessageBar/MessageBar.js +14 -13
- package/dist/esm/MessageBar/MessageBar.test.js +13 -0
- package/dist/esm/MessageBar/MicrophoneButton.d.ts +1 -0
- package/dist/esm/MessageBar/MicrophoneButton.js +4 -4
- package/dist/esm/MessageBar/SendButton.d.ts +1 -0
- package/dist/esm/MessageBar/SendButton.js +3 -3
- package/dist/esm/MessageBar/SendButton.test.js +4 -0
- package/dist/esm/MessageBar/StopButton.d.ts +1 -0
- package/dist/esm/MessageBar/StopButton.js +3 -3
- package/dist/esm/MessageBar/StopButton.test.js +4 -0
- package/dist/esm/MessageBox/MessageBox.d.ts +4 -0
- package/dist/esm/MessageBox/MessageBox.js +21 -7
- package/dist/esm/MessageBox/MessageBox.test.js +44 -1
- package/dist/esm/PreviewAttachment/PreviewAttachment.d.ts +2 -0
- package/dist/esm/PreviewAttachment/PreviewAttachment.js +2 -2
- package/dist/esm/Settings/SettingsForm.d.ts +2 -0
- package/dist/esm/Settings/SettingsForm.js +2 -2
- package/dist/esm/Settings/SettingsForm.test.d.ts +1 -1
- package/dist/esm/Settings/SettingsForm.test.js +12 -0
- package/dist/esm/SourcesCard/SourcesCard.d.ts +7 -1
- package/dist/esm/SourcesCard/SourcesCard.js +18 -12
- package/dist/esm/SourcesCard/SourcesCard.test.js +25 -15
- package/dist/esm/TermsOfUse/TermsOfUse.d.ts +2 -0
- package/dist/esm/TermsOfUse/TermsOfUse.js +5 -5
- package/dist/esm/tracking/console_tracking_provider.d.ts +4 -5
- package/dist/esm/tracking/console_tracking_provider.js +22 -15
- package/dist/esm/tracking/posthog_tracking_provider.d.ts +2 -2
- package/dist/esm/tracking/posthog_tracking_provider.js +21 -12
- package/dist/esm/tracking/segment_tracking_provider.d.ts +2 -2
- package/dist/esm/tracking/segment_tracking_provider.js +21 -12
- package/dist/esm/tracking/trackingProviderProxy.d.ts +1 -1
- package/dist/esm/tracking/trackingProviderProxy.js +2 -2
- package/dist/esm/tracking/tracking_api.d.ts +1 -1
- package/dist/esm/tracking/tracking_registry.js +46 -12
- package/dist/esm/tracking/tracking_spi.d.ts +15 -5
- package/dist/esm/tracking/tracking_spi.js +8 -1
- package/dist/esm/tracking/umami_tracking_provider.d.ts +6 -2
- package/dist/esm/tracking/umami_tracking_provider.js +66 -22
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Analytics/Analytics.md +18 -14
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/AttachmentEdit.tsx +10 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/BotMessage.tsx +74 -104
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/FileDetailsLabel.tsx +48 -37
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithFeedback.tsx +33 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickResponses.tsx +34 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickStart.tsx +11 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithSources.tsx +71 -13
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md +3 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/PreviewAttachment.tsx +10 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessage.tsx +80 -104
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawer.tsx +44 -2
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerResizable.tsx +13 -2
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithActions.tsx +9 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithSelection.tsx +11 -2
- package/patternfly-docs/content/extensions/chatbot/examples/UI/CompactSettings.tsx +289 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/TermsOfUseCompact.tsx +136 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +15 -1
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.md +8 -1
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.tsx +6 -3
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachment.tsx +2 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachmentMenu.tsx +2 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotCompact.tsx +481 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotInDrawer.tsx +2 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/EmbeddedChatbot.tsx +2 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/EmbeddedComparisonChatbot.tsx +62 -57
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Feedback.tsx +2 -0
- package/src/AttachmentEdit/AttachmentEdit.tsx +5 -1
- package/src/Chatbot/Chatbot.scss +7 -0
- package/src/Chatbot/Chatbot.test.tsx +9 -0
- package/src/Chatbot/Chatbot.tsx +4 -1
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.scss +38 -3
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx +71 -0
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +23 -2
- package/src/ChatbotFooter/ChatbotFooter.scss +5 -0
- package/src/ChatbotFooter/ChatbotFooter.test.tsx +10 -0
- package/src/ChatbotFooter/ChatbotFooter.tsx +3 -1
- package/src/ChatbotHeader/ChatbotHeader.scss +25 -0
- package/src/ChatbotHeader/ChatbotHeader.tsx +1 -1
- package/src/ChatbotHeader/ChatbotHeaderCloseButton.test.tsx +6 -0
- package/src/ChatbotHeader/ChatbotHeaderCloseButton.tsx +12 -6
- package/src/ChatbotHeader/ChatbotHeaderMain.tsx +3 -1
- package/src/ChatbotHeader/ChatbotHeaderMenu.test.tsx +8 -0
- package/src/ChatbotHeader/ChatbotHeaderMenu.tsx +10 -5
- package/src/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.tsx +6 -0
- package/src/ChatbotHeader/ChatbotHeaderOptionsDropdown.tsx +5 -2
- package/src/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.tsx +10 -0
- package/src/ChatbotHeader/ChatbotHeaderSelectorDropdown.tsx +4 -0
- package/src/ChatbotModal/ChatbotModal.scss +15 -4
- package/src/ChatbotModal/ChatbotModal.test.tsx +59 -0
- package/src/ChatbotModal/ChatbotModal.tsx +5 -1
- package/src/ChatbotPopover/ChatbotPopover.scss +9 -5
- package/src/ChatbotPopover/ChatbotPopover.tsx +1 -1
- package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.scss +9 -1
- package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.tsx +13 -0
- package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.tsx +13 -2
- package/src/ChatbotWelcomePrompt/__snapshots__/ChatbotWelcomePrompt.test.tsx.snap +1 -1
- package/src/CodeModal/CodeModal.scss +11 -3
- package/src/CodeModal/CodeModal.test.tsx +24 -0
- package/src/CodeModal/CodeModal.tsx +6 -2
- package/src/FileDetails/FileDetails.tsx +1 -1
- package/src/FileDetails/__snapshots__/FileDetails.test.tsx.snap +1 -1
- package/src/FileDetailsLabel/__snapshots__/FileDetailsLabel.test.tsx.snap +1 -1
- package/src/Message/Message.scss +31 -0
- package/src/Message/Message.test.tsx +83 -0
- package/src/Message/Message.tsx +121 -56
- package/src/Message/MessageInput.tsx +59 -0
- package/src/Message/QuickResponse/QuickResponse.tsx +5 -1
- package/src/Message/QuickStarts/QuickStartTile.tsx +5 -1
- package/src/Message/TextMessage/TextMessage.scss +25 -0
- package/src/Message/UserFeedback/UserFeedback.scss +24 -3
- package/src/Message/UserFeedback/UserFeedback.test.tsx +13 -0
- package/src/Message/UserFeedback/UserFeedback.tsx +4 -2
- package/src/Message/UserFeedback/UserFeedbackComplete.test.tsx +4 -0
- package/src/Message/UserFeedback/UserFeedbackComplete.tsx +10 -2
- package/src/MessageBar/AttachButton.scss +10 -0
- package/src/MessageBar/AttachButton.test.tsx +4 -0
- package/src/MessageBar/AttachButton.tsx +5 -2
- package/src/MessageBar/MessageBar.scss +17 -0
- package/src/MessageBar/MessageBar.test.tsx +13 -0
- package/src/MessageBar/MessageBar.tsx +23 -8
- package/src/MessageBar/MicrophoneButton.scss +10 -0
- package/src/MessageBar/MicrophoneButton.tsx +6 -3
- package/src/MessageBar/SendButton.scss +10 -0
- package/src/MessageBar/SendButton.test.tsx +5 -1
- package/src/MessageBar/SendButton.tsx +5 -2
- package/src/MessageBar/StopButton.scss +10 -0
- package/src/MessageBar/StopButton.test.tsx +5 -1
- package/src/MessageBar/StopButton.tsx +5 -2
- package/src/MessageBox/MessageBox.scss +6 -0
- package/src/MessageBox/MessageBox.test.tsx +45 -1
- package/src/MessageBox/MessageBox.tsx +16 -6
- package/src/PreviewAttachment/PreviewAttachment.tsx +5 -1
- package/src/Settings/Settings.scss +11 -0
- package/src/Settings/SettingsForm.test.tsx +17 -0
- package/src/Settings/SettingsForm.tsx +12 -2
- package/src/SourcesCard/SourcesCard.scss +11 -7
- package/src/SourcesCard/SourcesCard.test.tsx +30 -22
- package/src/SourcesCard/SourcesCard.tsx +56 -13
- package/src/TermsOfUse/TermsOfUse.scss +20 -0
- package/src/TermsOfUse/TermsOfUse.tsx +9 -4
- package/src/tracking/console_tracking_provider.ts +21 -17
- package/src/tracking/posthog_tracking_provider.ts +20 -13
- package/src/tracking/segment_tracking_provider.ts +20 -13
- package/src/tracking/trackingProviderProxy.ts +2 -2
- package/src/tracking/tracking_api.ts +1 -1
- package/src/tracking/tracking_registry.ts +46 -13
- package/src/tracking/tracking_spi.ts +18 -7
- package/src/tracking/umami_tracking_provider.ts +76 -20
- package/src/SourcesCard/__snapshots__/SourcesCard.test.tsx.snap +0 -34
@@ -0,0 +1,59 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { render, screen } from '@testing-library/react';
|
3
|
+
import ChatbotModal from './ChatbotModal';
|
4
|
+
import '@testing-library/jest-dom';
|
5
|
+
import { ModalBody, ModalHeader } from '@patternfly/react-core';
|
6
|
+
|
7
|
+
describe('ChatbotModal', () => {
|
8
|
+
it('should render compact modal', () => {
|
9
|
+
render(
|
10
|
+
<ChatbotModal data-testid="modal" isCompact isOpen>
|
11
|
+
<ModalHeader
|
12
|
+
title="Modal with description"
|
13
|
+
labelId="modal-with-description-title"
|
14
|
+
description="A description is used when you want to provide more info about the modal than the title is able to describe. The content in the description is static and will not scroll with the rest of the modal body."
|
15
|
+
/>
|
16
|
+
<ModalBody tabIndex={0} id="modal-box-body-with-description">
|
17
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
|
18
|
+
magna aliqua. Quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Semper auctor neque vitae
|
19
|
+
tempus. Diam donec adipiscing tristique risus. Augue eget arcu dictum varius duis. Ut enim blandit volutpat
|
20
|
+
maecenas volutpat blandit aliquam. Sit amet mauris commodo quis imperdiet massa tincidunt. Habitant morbi
|
21
|
+
tristique senectus et netus. Fames ac turpis egestas sed tempus urna. Neque laoreet suspendisse interdum
|
22
|
+
consectetur libero id. Volutpat lacus laoreet non curabitur gravida arcu ac tortor. Porta nibh venenatis cras
|
23
|
+
sed felis eget velit. Nullam non nisi est sit amet facilisis. Nunc mi ipsum faucibus vitae. Lorem sed risus
|
24
|
+
ultricies tristique nulla aliquet enim tortor at. Egestas sed tempus urna et pharetra pharetra massa massa
|
25
|
+
ultricies. Lacinia quis vel eros donec ac odio tempor orci. Malesuada fames ac turpis egestas integer eget
|
26
|
+
aliquet.
|
27
|
+
<br />
|
28
|
+
<br />
|
29
|
+
Neque aliquam vestibulum morbi blandit cursus risus at ultrices. Molestie at elementum eu facilisis sed odio
|
30
|
+
morbi. Elit pellentesque habitant morbi tristique. Consequat nisl vel pretium lectus quam id leo in vitae.
|
31
|
+
Quis varius quam quisque id diam vel quam elementum. Viverra nam libero justo laoreet sit amet cursus.
|
32
|
+
Sollicitudin tempor id eu nisl nunc. Orci nulla pellentesque dignissim enim sit amet venenatis. Dignissim enim
|
33
|
+
sit amet venenatis urna cursus eget. Iaculis at erat pellentesque adipiscing commodo elit. Faucibus pulvinar
|
34
|
+
elementum integer enim neque volutpat. Nullam vehicula ipsum a arcu cursus vitae congue mauris. Nunc mattis
|
35
|
+
enim ut tellus elementum sagittis vitae. Blandit cursus risus at ultrices. Tellus mauris a diam maecenas sed
|
36
|
+
enim. Non diam phasellus vestibulum lorem sed risus ultricies tristique nulla.
|
37
|
+
<br />
|
38
|
+
<br />
|
39
|
+
Nulla pharetra diam sit amet nisl suscipit adipiscing. Ac tortor vitae purus faucibus ornare suspendisse sed
|
40
|
+
nisi. Sed felis eget velit aliquet sagittis id consectetur purus. Tincidunt tortor aliquam nulla facilisi cras
|
41
|
+
fermentum. Volutpat est velit egestas dui id ornare arcu odio. Pharetra magna ac placerat vestibulum. Ultrices
|
42
|
+
sagittis orci a scelerisque purus semper eget duis at. Nisi est sit amet facilisis magna etiam tempor orci eu.
|
43
|
+
Convallis tellus id interdum velit. Facilisis sed odio morbi quis commodo odio aenean sed.
|
44
|
+
<br />
|
45
|
+
<br />
|
46
|
+
Eu scelerisque felis imperdiet proin fermentum leo vel orci porta. Facilisi etiam dignissim diam quis enim
|
47
|
+
lobortis scelerisque fermentum. Eleifend donec pretium vulputate sapien nec sagittis aliquam malesuada. Magna
|
48
|
+
etiam tempor orci eu lobortis elementum. Quis auctor elit sed vulputate mi sit. Eleifend quam adipiscing vitae
|
49
|
+
proin sagittis nisl rhoncus mattis rhoncus. Erat velit scelerisque in dictum non. Sit amet nulla facilisi
|
50
|
+
morbi tempus iaculis urna. Enim ut tellus elementum sagittis vitae et leo duis ut. Lectus arcu bibendum at
|
51
|
+
varius vel pharetra vel turpis. Morbi tristique senectus et netus et. Eget aliquet nibh praesent tristique
|
52
|
+
magna sit amet purus gravida. Nisl purus in mollis nunc sed id semper risus. Id neque aliquam vestibulum
|
53
|
+
morbi. Mauris a diam maecenas sed enim ut sem. Egestas tellus rutrum tellus pellentesque.
|
54
|
+
</ModalBody>
|
55
|
+
</ChatbotModal>
|
56
|
+
);
|
57
|
+
expect(screen.getByTestId('modal')).toHaveClass('pf-m-compact');
|
58
|
+
});
|
59
|
+
});
|
@@ -10,7 +10,10 @@ import { ChatbotDisplayMode } from '../Chatbot';
|
|
10
10
|
export interface ChatbotModalProps extends Omit<ModalProps, 'ref'> {
|
11
11
|
/** Display mode for the Chatbot parent; this influences the styles applied */
|
12
12
|
displayMode?: ChatbotDisplayMode;
|
13
|
+
/** Additional className applied to modal */
|
13
14
|
className?: string;
|
15
|
+
/** Sets modal to compact styling. */
|
16
|
+
isCompact?: boolean;
|
14
17
|
}
|
15
18
|
|
16
19
|
export const ChatbotModal: React.FunctionComponent<ChatbotModalProps> = ({
|
@@ -18,6 +21,7 @@ export const ChatbotModal: React.FunctionComponent<ChatbotModalProps> = ({
|
|
18
21
|
displayMode = ChatbotDisplayMode.default,
|
19
22
|
className,
|
20
23
|
isOpen,
|
24
|
+
isCompact,
|
21
25
|
...props
|
22
26
|
}: ChatbotModalProps) => {
|
23
27
|
const modal = (
|
@@ -26,7 +30,7 @@ export const ChatbotModal: React.FunctionComponent<ChatbotModalProps> = ({
|
|
26
30
|
ouiaId="ChatbotModal"
|
27
31
|
aria-labelledby="chatbot-modal-title"
|
28
32
|
aria-describedby="chatbot-modal"
|
29
|
-
className={`pf-chatbot__chatbot-modal pf-chatbot__chatbot-modal--${displayMode} ${className}`}
|
33
|
+
className={`pf-chatbot__chatbot-modal pf-chatbot__chatbot-modal--${displayMode} ${isCompact ? 'pf-m-compact' : ''} ${className}`}
|
30
34
|
backdropClassName="pf-chatbot__chatbot-modal-backdrop"
|
31
35
|
{...props}
|
32
36
|
>
|
@@ -2,14 +2,19 @@
|
|
2
2
|
// Chatbot Popover
|
3
3
|
// ============================================================================
|
4
4
|
.pf-chatbot__popover {
|
5
|
-
.pf-v6-c-popover__arrow {
|
5
|
+
.pf-v6-c-popover__arrow {
|
6
|
+
display: none;
|
7
|
+
}
|
6
8
|
|
7
9
|
// Footnote popover
|
8
10
|
&--footnote.pf-chatbot__popover {
|
9
|
-
|
10
11
|
// Contents
|
11
|
-
img {
|
12
|
-
|
12
|
+
img {
|
13
|
+
border-radius: var(--pf-t--global--border--radius--small);
|
14
|
+
}
|
15
|
+
.pf-v6-c-content--h3 {
|
16
|
+
font-weight: var(--pf-t--global--font--weight--body--bold);
|
17
|
+
}
|
13
18
|
.pf-v6-c-content--p {
|
14
19
|
font-size: var(--pf-t--global--font--size--body--lg);
|
15
20
|
}
|
@@ -23,5 +28,4 @@
|
|
23
28
|
font-size: var(--pf-t--global--font--size--body--lg);
|
24
29
|
}
|
25
30
|
}
|
26
|
-
|
27
31
|
}
|
@@ -7,7 +7,7 @@ import React from 'react';
|
|
7
7
|
import { Popover, PopoverProps } from '@patternfly/react-core';
|
8
8
|
|
9
9
|
export const ChatbotPopover: React.FunctionComponent<PopoverProps> = ({ children, className, ...props }) => (
|
10
|
-
<Popover className={`pf-chatbot__popover
|
10
|
+
<Popover className={`pf-chatbot__popover ${className ?? ''}`} showClose={false} {...props}>
|
11
11
|
{children}
|
12
12
|
</Popover>
|
13
13
|
);
|
@@ -8,7 +8,6 @@
|
|
8
8
|
gap: var(--pf-t--global--spacer--lg);
|
9
9
|
|
10
10
|
.pf-v6-c-content--h1 {
|
11
|
-
--pf-v6-c-content--h1--FontSize: var(--pf-t--global--font--size--3xl); // larger than any of our semantic tokens
|
12
11
|
--pf-v6-c-content--h1--FontWeight: var(--pf-t--global--font--weight--400);
|
13
12
|
--pf-v6-c-content--h1--MarginBlockEnd: 0;
|
14
13
|
}
|
@@ -34,6 +33,15 @@
|
|
34
33
|
}
|
35
34
|
}
|
36
35
|
|
36
|
+
.pf-chatbot--layout--welcome.pf-m-compact {
|
37
|
+
gap: var(--pf-t--global--spacer--md);
|
38
|
+
padding-block-end: var(--pf-t--global--spacer--md);
|
39
|
+
|
40
|
+
.pf-chatbot__prompt-suggestions {
|
41
|
+
gap: var(--pf-t--global--spacer--md);
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
37
45
|
// ============================================================================
|
38
46
|
// Chatbot Display Mode - Fullscreen and Embedded
|
39
47
|
// ============================================================================
|
@@ -69,4 +69,17 @@ describe('ChatbotWelcomePrompt', () => {
|
|
69
69
|
const element = screen.getByTestId('welcome-prompt');
|
70
70
|
expect(element).toHaveClass('test');
|
71
71
|
});
|
72
|
+
|
73
|
+
it('should handle isCompact', () => {
|
74
|
+
render(
|
75
|
+
<ChatbotWelcomePrompt
|
76
|
+
title="Hi, ChatBot User!"
|
77
|
+
description="How can I help you today?"
|
78
|
+
className="test"
|
79
|
+
testId="welcome-prompt"
|
80
|
+
isCompact
|
81
|
+
/>
|
82
|
+
);
|
83
|
+
expect(screen.getByTestId('welcome-prompt')).toHaveClass('pf-m-compact');
|
84
|
+
});
|
72
85
|
});
|
@@ -16,6 +16,7 @@ export interface ChatbotWelcomePromptProps extends React.HTMLProps<HTMLDivElemen
|
|
16
16
|
className?: string;
|
17
17
|
/** Custom test id for the WelcomePrompt component */
|
18
18
|
testId?: string;
|
19
|
+
isCompact?: boolean;
|
19
20
|
}
|
20
21
|
|
21
22
|
export interface WelcomePrompt {
|
@@ -33,9 +34,14 @@ export const ChatbotWelcomePrompt: React.FunctionComponent<ChatbotWelcomePromptP
|
|
33
34
|
prompts,
|
34
35
|
className,
|
35
36
|
testId,
|
37
|
+
isCompact = false,
|
36
38
|
...props
|
37
39
|
}: ChatbotWelcomePromptProps) => (
|
38
|
-
<div
|
40
|
+
<div
|
41
|
+
data-testid={testId}
|
42
|
+
className={`pf-chatbot--layout--welcome ${isCompact ? 'pf-m-compact' : ''} ${className ?? ''}`}
|
43
|
+
{...props}
|
44
|
+
>
|
39
45
|
<Content component={ContentVariants.h1}>
|
40
46
|
<span className="pf-chatbot__hello">{title}</span>
|
41
47
|
<br />
|
@@ -45,7 +51,12 @@ export const ChatbotWelcomePrompt: React.FunctionComponent<ChatbotWelcomePromptP
|
|
45
51
|
{prompts && (
|
46
52
|
<div className="pf-chatbot__prompt-suggestions">
|
47
53
|
{prompts?.map((prompt, index) => (
|
48
|
-
<Card
|
54
|
+
<Card
|
55
|
+
key={`welcome-prompt-${index}`}
|
56
|
+
className="pf-chatbot__prompt-suggestion"
|
57
|
+
isClickable
|
58
|
+
isCompact={isCompact}
|
59
|
+
>
|
49
60
|
<CardHeader
|
50
61
|
selectableActions={{
|
51
62
|
onClickAction: prompt.onClick,
|
@@ -61,8 +61,10 @@
|
|
61
61
|
.pf-v6-c-code-editor__header-main {
|
62
62
|
display: none;
|
63
63
|
}
|
64
|
-
.pf-
|
65
|
-
|
64
|
+
.pf-v6-c-modal-box__close {
|
65
|
+
.pf-v6-c-button.pf-m-plain {
|
66
|
+
--pf-v6-c-button__icon--Color: var(--pf-t--global--icon--color--subtle);
|
67
|
+
}
|
66
68
|
}
|
67
69
|
}
|
68
70
|
|
@@ -78,10 +80,16 @@
|
|
78
80
|
}
|
79
81
|
}
|
80
82
|
|
81
|
-
.pf-chatbot__code-modal-
|
83
|
+
.pf-chatbot__code-modal-editor {
|
82
84
|
flex: 1;
|
83
85
|
}
|
84
86
|
|
85
87
|
.pf-chatbot__code-modal--fullscreen {
|
86
88
|
height: inherit !important; // override shared modal so code editor works in full screen
|
87
89
|
}
|
90
|
+
|
91
|
+
.pf-chatbot__code-modal.pf-m-compact {
|
92
|
+
.pf-chatbot__code-modal-body {
|
93
|
+
gap: var(--pf-t--global--spacer--md);
|
94
|
+
}
|
95
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { render, screen } from '@testing-library/react';
|
3
|
+
import '@testing-library/jest-dom';
|
4
|
+
import CodeModal from './CodeModal';
|
5
|
+
|
6
|
+
describe('ChatbotModal', () => {
|
7
|
+
it('should render compact modal', () => {
|
8
|
+
render(
|
9
|
+
<CodeModal
|
10
|
+
isCompact
|
11
|
+
code="Hello world"
|
12
|
+
fileName="greetings.txt"
|
13
|
+
isModalOpen={true}
|
14
|
+
handleModalToggle={jest.fn()}
|
15
|
+
onPrimaryAction={jest.fn()}
|
16
|
+
onSecondaryAction={jest.fn()}
|
17
|
+
title="Preview attachment"
|
18
|
+
primaryActionBtn="Submit"
|
19
|
+
secondaryActionBtn="Cancel"
|
20
|
+
></CodeModal>
|
21
|
+
);
|
22
|
+
expect(screen.getByRole('dialog')).toHaveClass('pf-m-compact');
|
23
|
+
});
|
24
|
+
});
|
@@ -40,6 +40,8 @@ export interface CodeModalProps {
|
|
40
40
|
title: string;
|
41
41
|
/** Display mode for the Chatbot parent; this influences the styles applied */
|
42
42
|
displayMode?: ChatbotDisplayMode;
|
43
|
+
/** Sets modal to compact styling. */
|
44
|
+
isCompact?: boolean;
|
43
45
|
}
|
44
46
|
|
45
47
|
export const CodeModal: React.FunctionComponent<CodeModalProps> = ({
|
@@ -57,6 +59,7 @@ export const CodeModal: React.FunctionComponent<CodeModalProps> = ({
|
|
57
59
|
secondaryActionBtn,
|
58
60
|
title,
|
59
61
|
displayMode = ChatbotDisplayMode.default,
|
62
|
+
isCompact,
|
60
63
|
...props
|
61
64
|
}: CodeModalProps) => {
|
62
65
|
const [newCode, setNewCode] = React.useState(code);
|
@@ -94,8 +97,9 @@ export const CodeModal: React.FunctionComponent<CodeModalProps> = ({
|
|
94
97
|
ouiaId="CodeModal"
|
95
98
|
aria-labelledby="code-modal-title"
|
96
99
|
aria-describedby="code-modal"
|
97
|
-
className={`pf-chatbot__code-modal pf-chatbot__code-modal--${displayMode}`}
|
100
|
+
className={`pf-chatbot__code-modal ${isCompact ? 'pf-m-compact' : ''} pf-chatbot__code-modal--${displayMode}`}
|
98
101
|
displayMode={displayMode}
|
102
|
+
isCompact={isCompact}
|
99
103
|
>
|
100
104
|
<ModalHeader title={title} labelId="code-modal-title" />
|
101
105
|
<ModalBody id="code-modal-body">
|
@@ -103,7 +107,7 @@ export const CodeModal: React.FunctionComponent<CodeModalProps> = ({
|
|
103
107
|
<StackItem className="pf-chatbot__code-modal-file-details">
|
104
108
|
<FileDetails fileName={fileName} />
|
105
109
|
</StackItem>
|
106
|
-
<StackItem className="pf-chatbot__code-modal-
|
110
|
+
<StackItem className="pf-chatbot__code-modal-editor">
|
107
111
|
<CodeEditor
|
108
112
|
isDarkTheme
|
109
113
|
isLineNumbersVisible={isLineNumbersVisible}
|
@@ -946,7 +946,7 @@ export const FileDetails = ({
|
|
946
946
|
}: PropsWithChildren<FileDetailsProps>) => {
|
947
947
|
const language = extensionToLanguage[path.extname(fileName).slice(1)]?.toUpperCase();
|
948
948
|
return (
|
949
|
-
<Flex className={`pf-chatbot__file-details ${className}`} gap={{ default: 'gapSm' }}>
|
949
|
+
<Flex className={`pf-chatbot__file-details ${className ? className : ''}`} gap={{ default: 'gapSm' }}>
|
950
950
|
<Flex
|
951
951
|
className="pf-chatbot__code-icon"
|
952
952
|
justifyContent={{ default: 'justifyContentCenter' }}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
exports[`FileDetails should render file details 1`] = `
|
4
4
|
<div>
|
5
5
|
<div
|
6
|
-
class="pf-v6-l-flex pf-m-gap-sm pf-chatbot__file-details
|
6
|
+
class="pf-v6-l-flex pf-m-gap-sm pf-chatbot__file-details "
|
7
7
|
>
|
8
8
|
<div
|
9
9
|
class="pf-v6-l-flex pf-m-align-items-center pf-m-align-self-center pf-m-justify-content-center pf-chatbot__code-icon"
|
@@ -15,7 +15,7 @@ exports[`FileDetailsLabel should render file details label 1`] = `
|
|
15
15
|
class="pf-chatbot__file-label-contents"
|
16
16
|
>
|
17
17
|
<div
|
18
|
-
class="pf-v6-l-flex pf-m-gap-sm pf-chatbot__file-details
|
18
|
+
class="pf-v6-l-flex pf-m-gap-sm pf-chatbot__file-details "
|
19
19
|
>
|
20
20
|
<div
|
21
21
|
class="pf-v6-l-flex pf-m-align-items-center pf-m-align-self-center pf-m-justify-content-center pf-chatbot__code-icon"
|
package/src/Message/Message.scss
CHANGED
@@ -97,6 +97,37 @@
|
|
97
97
|
flex-wrap: wrap;
|
98
98
|
}
|
99
99
|
|
100
|
+
.pf-chatbot__message-edit-buttons {
|
101
|
+
--pf-v6-c-form__group--m-action--MarginBlockStart: 0;
|
102
|
+
}
|
103
|
+
|
100
104
|
@import './MessageLoading';
|
101
105
|
@import './CodeBlockMessage/CodeBlockMessage';
|
102
106
|
@import './TextMessage/TextMessage';
|
107
|
+
|
108
|
+
// ============================================================================
|
109
|
+
// Information density styles
|
110
|
+
// ============================================================================
|
111
|
+
.pf-chatbot.pf-m-compact {
|
112
|
+
.pf-chatbot__message {
|
113
|
+
gap: var(--pf-t--global--spacer--md);
|
114
|
+
padding-bottom: var(--pf-t--global--spacer--sm);
|
115
|
+
|
116
|
+
.pf-chatbot__message-contents {
|
117
|
+
gap: var(--pf-t--global--spacer--xs);
|
118
|
+
}
|
119
|
+
}
|
120
|
+
|
121
|
+
.pf-chatbot__message-name {
|
122
|
+
font-size: var(--pf-t--global--font--size--xs);
|
123
|
+
}
|
124
|
+
|
125
|
+
.pf-chatbot__message-avatar.pf-chatbot__message-avatar--round.pf-v6-c-avatar {
|
126
|
+
--pf-v6-c-avatar--Width: 2rem;
|
127
|
+
--pf-v6-c-avatar--Height: 2rem;
|
128
|
+
}
|
129
|
+
|
130
|
+
.pf-chatbot__message-contents {
|
131
|
+
gap: var(--pf-t--global--spacer--xs);
|
132
|
+
}
|
133
|
+
}
|
@@ -334,6 +334,27 @@ describe('Message', () => {
|
|
334
334
|
await userEvent.click(quickResponse);
|
335
335
|
expect(spy).toHaveBeenCalledTimes(1);
|
336
336
|
});
|
337
|
+
it('should be able to handle isCompact', async () => {
|
338
|
+
render(
|
339
|
+
<Message
|
340
|
+
avatar="./img"
|
341
|
+
role="bot"
|
342
|
+
name="Bot"
|
343
|
+
content="Hi"
|
344
|
+
quickResponses={[
|
345
|
+
{
|
346
|
+
id: '1',
|
347
|
+
content: 'Yes',
|
348
|
+
onClick: jest.fn(),
|
349
|
+
className: 'test'
|
350
|
+
}
|
351
|
+
]}
|
352
|
+
isCompact
|
353
|
+
/>
|
354
|
+
);
|
355
|
+
const parent = screen.getByRole('button', { name: /Yes/i }).parentNode;
|
356
|
+
expect(parent).toHaveClass('pf-m-compact');
|
357
|
+
});
|
337
358
|
it('should be able to show more than 1 quick response', async () => {
|
338
359
|
const spy = jest.fn();
|
339
360
|
render(
|
@@ -784,6 +805,20 @@ describe('Message', () => {
|
|
784
805
|
// we are mocking rehype libraries, so we can't test target _blank addition on links directly with RTL
|
785
806
|
expect(rehypeExternalLinks).not.toHaveBeenCalled();
|
786
807
|
});
|
808
|
+
it('should handle extra link props correctly', async () => {
|
809
|
+
const spy = jest.fn();
|
810
|
+
render(
|
811
|
+
<Message
|
812
|
+
avatar="./img"
|
813
|
+
role="user"
|
814
|
+
name="User"
|
815
|
+
content={`[PatternFly](https://www.patternfly.org/)`}
|
816
|
+
linkProps={{ onClick: spy }}
|
817
|
+
/>
|
818
|
+
);
|
819
|
+
await userEvent.click(screen.getByRole('link', { name: /PatternFly/i }));
|
820
|
+
expect(spy).toHaveBeenCalledTimes(1);
|
821
|
+
});
|
787
822
|
it('should handle error correctly', () => {
|
788
823
|
render(<Message avatar="./img" role="user" name="User" error={ERROR} />);
|
789
824
|
expect(screen.getByRole('heading', { name: /Could not load chat/i })).toBeTruthy();
|
@@ -801,4 +836,52 @@ describe('Message', () => {
|
|
801
836
|
expect(screen.getByRole('heading', { name: /Could not load chat/i })).toBeTruthy();
|
802
837
|
expect(screen.queryByText('Test')).toBeFalsy();
|
803
838
|
});
|
839
|
+
it('should handle isEditable when there is message content', () => {
|
840
|
+
render(<Message avatar="./img" role="user" name="User" isEditable content="Test" />);
|
841
|
+
expect(screen.getByRole('textbox')).toBeTruthy();
|
842
|
+
expect(screen.getByRole('textbox')).toHaveValue('Test');
|
843
|
+
expect(screen.getByRole('button', { name: /Update/i })).toBeTruthy();
|
844
|
+
expect(screen.getByRole('button', { name: /Cancel/i })).toBeTruthy();
|
845
|
+
});
|
846
|
+
it('should handle isEditable when there is no message content', () => {
|
847
|
+
render(<Message avatar="./img" role="user" name="User" isEditable />);
|
848
|
+
expect(screen.getByRole('textbox')).toBeTruthy();
|
849
|
+
expect(screen.getByRole('textbox')).toHaveValue('');
|
850
|
+
expect(screen.getByRole('textbox')).toHaveAttribute('placeholder', 'Edit prompt message...');
|
851
|
+
expect(screen.getByRole('button', { name: /Update/i })).toBeTruthy();
|
852
|
+
expect(screen.getByRole('button', { name: /Cancel/i })).toBeTruthy();
|
853
|
+
});
|
854
|
+
it('should be able to change edit placeholder', () => {
|
855
|
+
render(<Message avatar="./img" role="user" name="User" isEditable editPlaceholder="I am a placeholder" />);
|
856
|
+
expect(screen.getByRole('textbox')).toBeTruthy();
|
857
|
+
expect(screen.getByRole('textbox')).toHaveValue('');
|
858
|
+
expect(screen.getByRole('textbox')).toHaveAttribute('placeholder', 'I am a placeholder');
|
859
|
+
});
|
860
|
+
it('should be able to change updateWord', () => {
|
861
|
+
render(<Message avatar="./img" role="user" name="User" isEditable updateWord="Submit" />);
|
862
|
+
expect(screen.getByRole('button', { name: /Submit/i })).toBeTruthy();
|
863
|
+
});
|
864
|
+
it('should be able to change cancelWord', () => {
|
865
|
+
render(<Message avatar="./img" role="user" name="User" isEditable cancelWord="Don't submit" />);
|
866
|
+
expect(screen.getByRole('button', { name: /Don't submit/i })).toBeTruthy();
|
867
|
+
});
|
868
|
+
it('should be able to add onEditUpdate', async () => {
|
869
|
+
const spy = jest.fn();
|
870
|
+
render(<Message avatar="./img" role="user" name="User" isEditable onEditUpdate={spy} />);
|
871
|
+
await userEvent.click(screen.getByRole('button', { name: /Update/i }));
|
872
|
+
expect(spy).toHaveBeenCalledTimes(1);
|
873
|
+
});
|
874
|
+
it('should be able to add onEditCancel', async () => {
|
875
|
+
const spy = jest.fn();
|
876
|
+
render(<Message avatar="./img" role="user" name="User" isEditable onEditCancel={spy} />);
|
877
|
+
await userEvent.click(screen.getByRole('button', { name: /Cancel/i }));
|
878
|
+
expect(spy).toHaveBeenCalledTimes(1);
|
879
|
+
});
|
880
|
+
it('should be able to add editFormProps', () => {
|
881
|
+
const { container } = render(
|
882
|
+
<Message avatar="./img" role="user" name="User" isEditable editFormProps={{ className: 'test' }} />
|
883
|
+
);
|
884
|
+
const form = container.querySelector('form');
|
885
|
+
expect(form).toHaveClass('test');
|
886
|
+
});
|
804
887
|
});
|