@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
@@ -18,7 +18,7 @@ import { Button, Tooltip, Icon } from '@patternfly/react-core';
|
|
18
18
|
// Import FontAwesome icons
|
19
19
|
import { MicrophoneIcon } from '@patternfly/react-icons/dist/esm/icons/microphone-icon';
|
20
20
|
export const MicrophoneButton = (_a) => {
|
21
|
-
var { isListening, onIsListeningChange, onSpeechRecognition, className, tooltipProps, tooltipContent = { active: 'Stop listening', inactive: 'Use microphone' }, language = 'en-US' } = _a, props = __rest(_a, ["isListening", "onIsListeningChange", "onSpeechRecognition", "className", "tooltipProps", "tooltipContent", "language"]);
|
21
|
+
var { isListening, onIsListeningChange, onSpeechRecognition, className, tooltipProps, tooltipContent = { active: 'Stop listening', inactive: 'Use microphone' }, language = 'en-US', isCompact } = _a, props = __rest(_a, ["isListening", "onIsListeningChange", "onSpeechRecognition", "className", "tooltipProps", "tooltipContent", "language", "isCompact"]);
|
22
22
|
// Microphone
|
23
23
|
// --------------------------------------------------------------------------
|
24
24
|
const [speechRecognition, setSpeechRecognition] = React.useState();
|
@@ -58,12 +58,12 @@ export const MicrophoneButton = (_a) => {
|
|
58
58
|
};
|
59
59
|
setSpeechRecognition(recognition);
|
60
60
|
}
|
61
|
-
}, [onSpeechRecognition]);
|
61
|
+
}, [onSpeechRecognition, language, onIsListeningChange]);
|
62
62
|
if (!speechRecognition) {
|
63
63
|
return null;
|
64
64
|
}
|
65
65
|
return (React.createElement(Tooltip, Object.assign({ aria: "none", "aria-live": "polite", id: "pf-chatbot__tooltip--use-microphone", content: isListening ? tooltipContent.active : tooltipContent.inactive, position: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.position) || 'top', entryDelay: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.entryDelay) || 0, exitDelay: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.exitDelay) || 0, distance: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.distance) || 8, animationDuration: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.animationDuration) || 0 }, tooltipProps),
|
66
|
-
React.createElement(Button, Object.assign({ variant: "plain", className: `pf-chatbot__button--microphone ${isListening ? 'pf-chatbot__button--microphone--active' : ''} ${className !== null && className !== void 0 ? className : ''}`, "aria-label": props['aria-label'] || 'Microphone button', onClick: isListening ? stopListening : startListening, icon: React.createElement(Icon, { iconSize:
|
67
|
-
React.createElement(MicrophoneIcon, null)) }, props))));
|
66
|
+
React.createElement(Button, Object.assign({ variant: "plain", className: `pf-chatbot__button--microphone ${isListening ? 'pf-chatbot__button--microphone--active' : ''} ${isCompact ? 'pf-m-compact' : ''} ${className !== null && className !== void 0 ? className : ''}`, "aria-label": props['aria-label'] || 'Microphone button', onClick: isListening ? stopListening : startListening, icon: React.createElement(Icon, { iconSize: isCompact ? 'lg' : 'xl', isInline: true },
|
67
|
+
React.createElement(MicrophoneIcon, null)), size: isCompact ? 'sm' : undefined }, props))));
|
68
68
|
};
|
69
69
|
export default MicrophoneButton;
|
@@ -9,6 +9,7 @@ export interface SendButtonProps extends ButtonProps {
|
|
9
9
|
tooltipProps?: Omit<TooltipProps, 'content'>;
|
10
10
|
/** English text "Send" used in the tooltip */
|
11
11
|
tooltipContent?: string;
|
12
|
+
isCompact?: boolean;
|
12
13
|
}
|
13
14
|
export declare const SendButton: React.FunctionComponent<SendButtonProps>;
|
14
15
|
export default SendButton;
|
@@ -17,11 +17,11 @@ import React from 'react';
|
|
17
17
|
import { Button, Tooltip, Icon } from '@patternfly/react-core';
|
18
18
|
import { PaperPlaneIcon } from '@patternfly/react-icons/dist/esm/icons/paper-plane-icon';
|
19
19
|
export const SendButton = (_a) => {
|
20
|
-
var { className, onClick, tooltipProps, tooltipContent = 'Send' } = _a, props = __rest(_a, ["className", "onClick", "tooltipProps", "tooltipContent"]);
|
20
|
+
var { className, onClick, tooltipProps, tooltipContent = 'Send', isCompact } = _a, props = __rest(_a, ["className", "onClick", "tooltipProps", "tooltipContent", "isCompact"]);
|
21
21
|
return (React.createElement(Tooltip, Object.assign({ id: "pf-chatbot__tooltip--send", content: tooltipContent, position: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.position) || 'top', entryDelay: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.entryDelay) || 0, exitDelay: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.exitDelay) || 0, distance: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.distance) || 8, animationDuration: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.animationDuration) || 0,
|
22
22
|
// prevents VO announcements of both aria label and tooltip
|
23
23
|
aria: "none" }, tooltipProps),
|
24
|
-
React.createElement(Button, Object.assign({ variant: "plain", className: `pf-chatbot__button--send ${className !== null && className !== void 0 ? className : ''}`, "aria-label": props['aria-label'] || 'Send button', onClick: onClick, icon: React.createElement(Icon, { iconSize:
|
25
|
-
React.createElement(PaperPlaneIcon, null)) }, props))));
|
24
|
+
React.createElement(Button, Object.assign({ variant: "plain", className: `pf-chatbot__button--send ${isCompact ? 'pf-m-compact' : ''} ${className !== null && className !== void 0 ? className : ''}`, "aria-label": props['aria-label'] || 'Send button', onClick: onClick, icon: React.createElement(Icon, { iconSize: isCompact ? 'lg' : 'xl', isInline: true },
|
25
|
+
React.createElement(PaperPlaneIcon, null)), size: isCompact ? 'sm' : undefined }, props))));
|
26
26
|
};
|
27
27
|
export default SendButton;
|
@@ -46,4 +46,8 @@ describe('Send button', () => {
|
|
46
46
|
yield userEvent.click(screen.getByRole('button', { name: 'Send button' }));
|
47
47
|
expect(screen.getByRole('tooltip', { name: 'Send' })).toHaveAttribute('id', 'test');
|
48
48
|
}));
|
49
|
+
it('should handle isCompact', () => {
|
50
|
+
renderSend({ 'data-testid': 'button', isCompact: true });
|
51
|
+
expect(screen.getByTestId('button')).toHaveClass('pf-m-compact');
|
52
|
+
});
|
49
53
|
});
|
@@ -9,6 +9,7 @@ export interface StopButtonProps extends ButtonProps {
|
|
9
9
|
tooltipProps?: Omit<TooltipProps, 'content'>;
|
10
10
|
/** English text "Stop" used in the tooltip */
|
11
11
|
tooltipContent?: string;
|
12
|
+
isCompact?: boolean;
|
12
13
|
}
|
13
14
|
export declare const StopButton: React.FunctionComponent<StopButtonProps>;
|
14
15
|
export default StopButton;
|
@@ -16,12 +16,12 @@ import React from 'react';
|
|
16
16
|
// Import PatternFly components
|
17
17
|
import { Button, Tooltip, Icon } from '@patternfly/react-core';
|
18
18
|
export const StopButton = (_a) => {
|
19
|
-
var { className, onClick, tooltipProps, tooltipContent = 'Stop' } = _a, props = __rest(_a, ["className", "onClick", "tooltipProps", "tooltipContent"]);
|
19
|
+
var { className, onClick, tooltipProps, tooltipContent = 'Stop', isCompact } = _a, props = __rest(_a, ["className", "onClick", "tooltipProps", "tooltipContent", "isCompact"]);
|
20
20
|
return (React.createElement(Tooltip, Object.assign({ id: "pf-chatbot__tooltip--stop", content: tooltipContent, position: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.position) || 'top', entryDelay: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.entryDelay) || 0, exitDelay: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.exitDelay) || 0, distance: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.distance) || 8, animationDuration: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.animationDuration) || 0,
|
21
21
|
// prevents VO announcements of both aria label and tooltip
|
22
22
|
aria: "none" }, tooltipProps),
|
23
|
-
React.createElement(Button, Object.assign({ className: `pf-chatbot__button--stop ${className !== null && className !== void 0 ? className : ''}`, variant: "link", "aria-label": props['aria-label'] || 'Stop button', onClick: onClick, icon: React.createElement(Icon, { iconSize:
|
23
|
+
React.createElement(Button, Object.assign({ className: `pf-chatbot__button--stop ${isCompact ? 'pf-m-compact' : ''} ${className !== null && className !== void 0 ? className : ''}`, variant: "link", "aria-label": props['aria-label'] || 'Stop button', onClick: onClick, icon: React.createElement(Icon, { iconSize: isCompact ? 'lg' : 'xl', isInline: true },
|
24
24
|
React.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
25
|
-
React.createElement("path", { d: "M0.5 3C0.5 1.62109 1.62109 0.5 3 0.5H13C14.3789 0.5 15.5 1.62109 15.5 3V13C15.5 14.3789 14.3789 15.5 13 15.5H3C1.62109 15.5 0.5 14.3789 0.5 13V3Z", fill: "currentColor" }))) }, props))));
|
25
|
+
React.createElement("path", { d: "M0.5 3C0.5 1.62109 1.62109 0.5 3 0.5H13C14.3789 0.5 15.5 1.62109 15.5 3V13C15.5 14.3789 14.3789 15.5 13 15.5H3C1.62109 15.5 0.5 14.3789 0.5 13V3Z", fill: "currentColor" }))), size: isCompact ? 'sm' : undefined }, props))));
|
26
26
|
};
|
27
27
|
export default StopButton;
|
@@ -46,4 +46,8 @@ describe('Stop button', () => {
|
|
46
46
|
yield userEvent.click(screen.getByRole('button', { name: 'Stop button' }));
|
47
47
|
expect(screen.getByRole('tooltip', { name: 'Stop' })).toHaveAttribute('id', 'test');
|
48
48
|
}));
|
49
|
+
it('should handle isCompact', () => {
|
50
|
+
renderStop({ 'data-testid': 'button', isCompact: true });
|
51
|
+
expect(screen.getByTestId('button')).toHaveClass('pf-m-compact');
|
52
|
+
});
|
49
53
|
});
|
@@ -12,6 +12,10 @@ export interface MessageBoxProps extends React.HTMLProps<HTMLDivElement> {
|
|
12
12
|
innerRef?: React.Ref<HTMLDivElement>;
|
13
13
|
/** Modifier that controls how content in MessageBox is positioned within the container */
|
14
14
|
position?: 'top' | 'bottom';
|
15
|
+
/** Click handler for additional logic for when scroll to top jump button is clicked */
|
16
|
+
onScrollToTopClick?: () => void;
|
17
|
+
/** Click handler for additional logic for when scroll to bottom jump button is clicked */
|
18
|
+
onScrollToBottomClick?: () => void;
|
15
19
|
}
|
16
20
|
export declare const MessageBox: React.ForwardRefExoticComponent<Omit<MessageBoxProps, "ref"> & React.RefAttributes<any>>;
|
17
21
|
export default MessageBox;
|
@@ -1,9 +1,21 @@
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
2
|
+
var t = {};
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
4
|
+
t[p] = s[p];
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
8
|
+
t[p[i]] = s[p[i]];
|
9
|
+
}
|
10
|
+
return t;
|
11
|
+
};
|
1
12
|
// ============================================================================
|
2
13
|
// Chatbot Main - Messages
|
3
14
|
// ============================================================================
|
4
15
|
import React from 'react';
|
5
16
|
import JumpButton from './JumpButton';
|
6
|
-
const MessageBoxBase = (
|
17
|
+
const MessageBoxBase = (_a) => {
|
18
|
+
var { announcement, ariaLabel = 'Scrollable message log', children, innerRef, className, position = 'top', onScrollToTopClick, onScrollToBottomClick } = _a, props = __rest(_a, ["announcement", "ariaLabel", "children", "innerRef", "className", "position", "onScrollToTopClick", "onScrollToBottomClick"]);
|
7
19
|
const [atTop, setAtTop] = React.useState(false);
|
8
20
|
const [atBottom, setAtBottom] = React.useState(true);
|
9
21
|
const [isOverflowing, setIsOverflowing] = React.useState(false);
|
@@ -23,26 +35,28 @@ const MessageBoxBase = ({ announcement, ariaLabel = 'Scrollable message log', ch
|
|
23
35
|
setAtTop(scrollTop === 0);
|
24
36
|
setAtBottom(Math.round(scrollTop) + Math.round(clientHeight) >= Math.round(scrollHeight) - 1); // rounding means it could be within a pixel of the bottom
|
25
37
|
}
|
26
|
-
}, []);
|
38
|
+
}, [messageBoxRef]);
|
27
39
|
const checkOverflow = React.useCallback(() => {
|
28
40
|
const element = messageBoxRef.current;
|
29
41
|
if (element) {
|
30
42
|
const { scrollHeight, clientHeight } = element;
|
31
43
|
setIsOverflowing(scrollHeight >= clientHeight);
|
32
44
|
}
|
33
|
-
}, []);
|
45
|
+
}, [messageBoxRef]);
|
34
46
|
const scrollToTop = React.useCallback(() => {
|
35
47
|
const element = messageBoxRef.current;
|
36
48
|
if (element) {
|
37
49
|
element.scrollTo({ top: 0, behavior: 'smooth' });
|
38
50
|
}
|
39
|
-
|
51
|
+
onScrollToTopClick && onScrollToTopClick();
|
52
|
+
}, [messageBoxRef]);
|
40
53
|
const scrollToBottom = React.useCallback(() => {
|
41
54
|
const element = messageBoxRef.current;
|
42
55
|
if (element) {
|
43
56
|
element.scrollTo({ top: element.scrollHeight, behavior: 'smooth' });
|
44
57
|
}
|
45
|
-
|
58
|
+
onScrollToBottomClick && onScrollToBottomClick();
|
59
|
+
}, [messageBoxRef]);
|
46
60
|
// Detect scroll position
|
47
61
|
React.useEffect(() => {
|
48
62
|
const element = messageBoxRef.current;
|
@@ -56,10 +70,10 @@ const MessageBoxBase = ({ announcement, ariaLabel = 'Scrollable message log', ch
|
|
56
70
|
element.removeEventListener('scroll', handleScroll);
|
57
71
|
};
|
58
72
|
}
|
59
|
-
}, [checkOverflow, handleScroll]);
|
73
|
+
}, [checkOverflow, handleScroll, messageBoxRef]);
|
60
74
|
return (React.createElement(React.Fragment, null,
|
61
75
|
React.createElement(JumpButton, { position: "top", isHidden: isOverflowing && atTop, onClick: scrollToTop }),
|
62
|
-
React.createElement("div", { role: "region", tabIndex: 0, "aria-label": ariaLabel, className: `pf-chatbot__messagebox ${position === 'bottom' && 'pf-chatbot__messagebox--bottom'} ${className !== null && className !== void 0 ? className : ''}`, ref: innerRef !== null && innerRef !== void 0 ? innerRef : messageBoxRef },
|
76
|
+
React.createElement("div", Object.assign({ role: "region", tabIndex: 0, "aria-label": ariaLabel, className: `pf-chatbot__messagebox ${position === 'bottom' && 'pf-chatbot__messagebox--bottom'} ${className !== null && className !== void 0 ? className : ''}`, ref: innerRef !== null && innerRef !== void 0 ? innerRef : messageBoxRef }, props),
|
63
77
|
children,
|
64
78
|
React.createElement("div", { className: "pf-chatbot__messagebox-announcement", "aria-live": "polite" }, announcement)),
|
65
79
|
React.createElement(JumpButton, { position: "bottom", isHidden: isOverflowing && atBottom, onClick: scrollToBottom })));
|
@@ -1,6 +1,16 @@
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
+
});
|
9
|
+
};
|
1
10
|
import React from 'react';
|
2
|
-
import { render, screen } from '@testing-library/react';
|
11
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
3
12
|
import { MessageBox } from './MessageBox';
|
13
|
+
import userEvent from '@testing-library/user-event';
|
4
14
|
describe('MessageBox', () => {
|
5
15
|
it('should render Message box', () => {
|
6
16
|
render(React.createElement(MessageBox, null,
|
@@ -14,4 +24,37 @@ describe('MessageBox', () => {
|
|
14
24
|
expect(ref.current).not.toBeNull();
|
15
25
|
expect(ref.current).toBeInstanceOf(HTMLDivElement);
|
16
26
|
});
|
27
|
+
it('should call onScrollToBottomClick when scroll to top button is clicked', () => __awaiter(void 0, void 0, void 0, function* () {
|
28
|
+
const spy = jest.fn();
|
29
|
+
render(React.createElement(MessageBox, { onScrollToBottomClick: spy },
|
30
|
+
React.createElement("div", null, "Test message content")));
|
31
|
+
// this forces button to show
|
32
|
+
const region = screen.getByRole('region');
|
33
|
+
Object.defineProperty(region, 'scrollHeight', { configurable: true, value: 1000 });
|
34
|
+
Object.defineProperty(region, 'clientHeight', { configurable: true, value: 500 });
|
35
|
+
Object.defineProperty(region, 'scrollTop', { configurable: true, value: 0 });
|
36
|
+
region.dispatchEvent(new Event('scroll'));
|
37
|
+
yield waitFor(() => {
|
38
|
+
userEvent.click(screen.getByRole('button', { name: /Jump bottom button/i }));
|
39
|
+
expect(spy).toHaveBeenCalled();
|
40
|
+
});
|
41
|
+
}));
|
42
|
+
it('should call onScrollToTopClick when scroll to top button is clicked', () => __awaiter(void 0, void 0, void 0, function* () {
|
43
|
+
const spy = jest.fn();
|
44
|
+
render(React.createElement(MessageBox, { onScrollToTopClick: spy },
|
45
|
+
React.createElement("div", null, "Test message content")));
|
46
|
+
// this forces button to show
|
47
|
+
const region = screen.getByRole('region');
|
48
|
+
Object.defineProperty(region, 'scrollHeight', { configurable: true, value: 1000 });
|
49
|
+
Object.defineProperty(region, 'clientHeight', { configurable: true, value: 500 });
|
50
|
+
Object.defineProperty(region, 'scrollTop', {
|
51
|
+
configurable: true,
|
52
|
+
value: 500
|
53
|
+
});
|
54
|
+
region.dispatchEvent(new Event('scroll'));
|
55
|
+
yield waitFor(() => {
|
56
|
+
userEvent.click(screen.getByRole('button', { name: /Jump top button/i }));
|
57
|
+
expect(spy).toHaveBeenCalled();
|
58
|
+
});
|
59
|
+
}));
|
17
60
|
});
|
@@ -17,6 +17,8 @@ export interface PreviewAttachmentProps {
|
|
17
17
|
title?: string;
|
18
18
|
/** Display mode for the Chatbot parent; this influences the styles applied */
|
19
19
|
displayMode?: ChatbotDisplayMode;
|
20
|
+
/** Sets modal to compact styling. */
|
21
|
+
isCompact?: boolean;
|
20
22
|
}
|
21
23
|
export declare const PreviewAttachment: React.FunctionComponent<PreviewAttachmentProps>;
|
22
24
|
export default PreviewAttachment;
|
@@ -4,7 +4,7 @@
|
|
4
4
|
import React from 'react';
|
5
5
|
import CodeModal from '../CodeModal';
|
6
6
|
import { ChatbotDisplayMode } from '../Chatbot';
|
7
|
-
export const PreviewAttachment = ({ fileName, code, handleModalToggle, isModalOpen, onDismiss = undefined, onEdit, title = 'Preview attachment', displayMode = ChatbotDisplayMode.default }) => {
|
7
|
+
export const PreviewAttachment = ({ fileName, code, handleModalToggle, isModalOpen, onDismiss = undefined, onEdit, title = 'Preview attachment', displayMode = ChatbotDisplayMode.default, isCompact }) => {
|
8
8
|
const handleEdit = (_event) => {
|
9
9
|
handleModalToggle(_event);
|
10
10
|
onEdit(_event);
|
@@ -13,6 +13,6 @@ export const PreviewAttachment = ({ fileName, code, handleModalToggle, isModalOp
|
|
13
13
|
handleModalToggle(_event);
|
14
14
|
onDismiss && onDismiss(_event);
|
15
15
|
};
|
16
|
-
return (React.createElement(CodeModal, { codeEditorControlClassName: "pf-chatbot__code-modal--controls", code: code, fileName: fileName, handleModalToggle: handleModalToggle, isCopyEnabled: true, isLineNumbersVisible: false, isModalOpen: isModalOpen, onPrimaryAction: handleEdit, onSecondaryAction: handleDismiss, primaryActionBtn: "Edit", secondaryActionBtn: "Dismiss", title: title, isReadOnly: true, displayMode: displayMode }));
|
16
|
+
return (React.createElement(CodeModal, { codeEditorControlClassName: "pf-chatbot__code-modal--controls", code: code, fileName: fileName, handleModalToggle: handleModalToggle, isCopyEnabled: true, isLineNumbersVisible: false, isModalOpen: isModalOpen, onPrimaryAction: handleEdit, onSecondaryAction: handleDismiss, primaryActionBtn: "Edit", secondaryActionBtn: "Dismiss", title: title, isReadOnly: true, displayMode: displayMode, isCompact: isCompact }));
|
17
17
|
};
|
18
18
|
export default PreviewAttachment;
|
@@ -8,6 +8,8 @@ export interface SettingsFormProps {
|
|
8
8
|
label: string;
|
9
9
|
field: React.ReactElement;
|
10
10
|
}[];
|
11
|
+
/** Sets form to compact styling. */
|
12
|
+
isCompact?: boolean;
|
11
13
|
}
|
12
14
|
export declare const SettingsForm: React.FunctionComponent<SettingsFormProps>;
|
13
15
|
export default SettingsForm;
|
@@ -11,8 +11,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
11
11
|
};
|
12
12
|
import React from 'react';
|
13
13
|
export const SettingsForm = (_a) => {
|
14
|
-
var { className, fields = [] } = _a, props = __rest(_a, ["className", "fields"]);
|
15
|
-
return (React.createElement("div", Object.assign({ className: `pf-chatbot__settings-form-container ${className}` }, props),
|
14
|
+
var { className, fields = [], isCompact } = _a, props = __rest(_a, ["className", "fields", "isCompact"]);
|
15
|
+
return (React.createElement("div", Object.assign({ className: `pf-chatbot__settings-form-container ${isCompact ? 'pf-m-compact' : ''} ${className ? ` ${className}` : ''}` }, props),
|
16
16
|
React.createElement("form", { className: "pf-chatbot__settings-form" }, fields.map((field) => (React.createElement("div", { className: "pf-chatbot__settings-form-row", key: field.label },
|
17
17
|
React.createElement("label", { className: "pf-chatbot__settings-label", htmlFor: field.id }, field.label),
|
18
18
|
field.field))))));
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
import '@testing-library/jest-dom';
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
2
2
|
import { Button } from '@patternfly/react-core';
|
3
3
|
import { render, screen } from '@testing-library/react';
|
4
4
|
import { SettingsForm } from './SettingsForm';
|
5
|
+
import '@testing-library/jest-dom';
|
5
6
|
describe('SettingsForm', () => {
|
6
7
|
it('should render settingsForm with custom classname', () => {
|
7
8
|
const { container } = render(React.createElement(SettingsForm, { className: "custom-settings" }));
|
@@ -18,4 +19,15 @@ describe('SettingsForm', () => {
|
|
18
19
|
render(React.createElement(SettingsForm, { fields: fields }));
|
19
20
|
expect(screen.getByRole('button', { name: 'Archive chat' })).toBeTruthy();
|
20
21
|
});
|
22
|
+
it('should render settingsForm with isCompact', () => {
|
23
|
+
const fields = [
|
24
|
+
{
|
25
|
+
id: 'archived-chat',
|
26
|
+
label: 'Archive chat',
|
27
|
+
field: (React.createElement(Button, { id: "archived-chat", variant: "secondary" }, "Archive chat"))
|
28
|
+
}
|
29
|
+
];
|
30
|
+
render(React.createElement(SettingsForm, { "data-testid": "settings-form", fields: fields, isCompact: true }));
|
31
|
+
expect(screen.getByTestId('settings-form')).toHaveClass('pf-m-compact');
|
32
|
+
});
|
21
33
|
});
|
@@ -5,7 +5,7 @@ export interface SourcesCardProps extends CardProps {
|
|
5
5
|
className?: string;
|
6
6
|
/** Flag indicating if the pagination is disabled. */
|
7
7
|
isDisabled?: boolean;
|
8
|
-
/** Label for the English word "of"
|
8
|
+
/** @deprecated ofWord has been deprecated. Label for the English word "of." */
|
9
9
|
ofWord?: string;
|
10
10
|
/** Accessible label for the pagination component. */
|
11
11
|
paginationAriaLabel?: string;
|
@@ -14,6 +14,8 @@ export interface SourcesCardProps extends CardProps {
|
|
14
14
|
title?: string;
|
15
15
|
link: string;
|
16
16
|
body?: React.ReactNode | string;
|
17
|
+
isExternal?: boolean;
|
18
|
+
hasShowMore?: boolean;
|
17
19
|
}[];
|
18
20
|
/** Label for the English word "source" */
|
19
21
|
sourceWord?: string;
|
@@ -29,6 +31,10 @@ export interface SourcesCardProps extends CardProps {
|
|
29
31
|
onPreviousClick?: (event: React.SyntheticEvent<HTMLButtonElement>, page: number) => void;
|
30
32
|
/** Function called when page is changed. */
|
31
33
|
onSetPage?: (event: React.MouseEvent | React.KeyboardEvent | MouseEvent, newPage: number) => void;
|
34
|
+
/** Label for English words "show more" */
|
35
|
+
showMoreWords?: string;
|
36
|
+
/** Label for English words "show less" */
|
37
|
+
showLessWords?: string;
|
32
38
|
}
|
33
39
|
declare const SourcesCard: React.FunctionComponent<SourcesCardProps>;
|
34
40
|
export default SourcesCard;
|
@@ -14,10 +14,15 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
14
14
|
// ============================================================================
|
15
15
|
import React from 'react';
|
16
16
|
// Import PatternFly components
|
17
|
-
import { Button, ButtonVariant, Card, CardBody, CardFooter, CardTitle, Icon, pluralize, Truncate } from '@patternfly/react-core';
|
17
|
+
import { Button, ButtonVariant, Card, CardBody, CardFooter, CardTitle, ExpandableSection, ExpandableSectionVariant, Icon, pluralize, Truncate } from '@patternfly/react-core';
|
18
|
+
import { ExternalLinkSquareAltIcon } from '@patternfly/react-icons';
|
18
19
|
const SourcesCard = (_a) => {
|
19
|
-
var { className, isDisabled,
|
20
|
+
var { className, isDisabled, paginationAriaLabel = 'Pagination', sources, sourceWord = 'source', sourceWordPlural = 'sources', toNextPageAriaLabel = 'Go to next page', toPreviousPageAriaLabel = 'Go to previous page', onNextClick, onPreviousClick, onSetPage, showMoreWords = 'show more', showLessWords = 'show less', isCompact } = _a, props = __rest(_a, ["className", "isDisabled", "paginationAriaLabel", "sources", "sourceWord", "sourceWordPlural", "toNextPageAriaLabel", "toPreviousPageAriaLabel", "onNextClick", "onPreviousClick", "onSetPage", "showMoreWords", "showLessWords", "isCompact"]);
|
20
21
|
const [page, setPage] = React.useState(1);
|
22
|
+
const [isExpanded, setIsExpanded] = React.useState(false);
|
23
|
+
const onToggle = (_event, isExpanded) => {
|
24
|
+
setIsExpanded(isExpanded);
|
25
|
+
};
|
21
26
|
const handleNewPage = (_evt, newPage) => {
|
22
27
|
setPage(newPage);
|
23
28
|
onSetPage && onSetPage(_evt, newPage);
|
@@ -30,10 +35,13 @@ const SourcesCard = (_a) => {
|
|
30
35
|
};
|
31
36
|
return (React.createElement("div", { className: "pf-chatbot__source" },
|
32
37
|
React.createElement("span", null, pluralize(sources.length, sourceWord, sourceWordPlural)),
|
33
|
-
React.createElement(Card, Object.assign({ className: "pf-chatbot__sources-card" }, props),
|
38
|
+
React.createElement(Card, Object.assign({ isCompact: isCompact, className: "pf-chatbot__sources-card" }, props),
|
34
39
|
React.createElement(CardTitle, { className: "pf-chatbot__sources-card-title" },
|
35
|
-
React.createElement("a",
|
36
|
-
sources[page - 1].body && (React.createElement(CardBody, { className: `pf-chatbot__sources-card-body
|
40
|
+
React.createElement(Button, { component: "a", variant: ButtonVariant.link, href: sources[page - 1].link, icon: sources[page - 1].isExternal ? React.createElement(ExternalLinkSquareAltIcon, null) : undefined, iconPosition: "end", isInline: true, rel: sources[page - 1].isExternal ? 'noreferrer' : undefined, target: sources[page - 1].isExternal ? '_blank' : undefined }, renderTitle(sources[page - 1].title))),
|
41
|
+
sources[page - 1].body && (React.createElement(CardBody, { className: `pf-chatbot__sources-card-body` }, sources[page - 1].hasShowMore ? (
|
42
|
+
// prevents extra VO announcements of button text - parent Message has aria-live
|
43
|
+
React.createElement("div", { "aria-live": "off" },
|
44
|
+
React.createElement(ExpandableSection, { variant: ExpandableSectionVariant.truncate, toggleText: isExpanded ? showLessWords : showMoreWords, onToggle: onToggle, isExpanded: isExpanded, truncateMaxLines: 2 }, sources[page - 1].body))) : (React.createElement("div", { className: "pf-chatbot__sources-card-body-text" }, sources[page - 1].body)))),
|
37
45
|
sources.length > 1 && (React.createElement(CardFooter, { className: "pf-chatbot__sources-card-footer-container" },
|
38
46
|
React.createElement("div", { className: "pf-chatbot__sources-card-footer" },
|
39
47
|
React.createElement("nav", { className: `pf-chatbot__sources-card-footer-buttons ${className}`, "aria-label": paginationAriaLabel },
|
@@ -45,6 +53,10 @@ const SourcesCard = (_a) => {
|
|
45
53
|
React.createElement(Icon, { iconSize: "lg" },
|
46
54
|
React.createElement("svg", { className: "pf-v6-svg", viewBox: "0 0 280 500", fill: "currentColor", "aria-hidden": "true", role: "img", width: "1em", height: "1em" },
|
47
55
|
React.createElement("path", { d: "M31.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L127.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L201.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34z" })))),
|
56
|
+
React.createElement("span", { "aria-hidden": "true" },
|
57
|
+
page,
|
58
|
+
"/",
|
59
|
+
sources.length),
|
48
60
|
React.createElement(Button, { variant: ButtonVariant.plain, isDisabled: isDisabled || page === sources.length, "aria-label": toNextPageAriaLabel, "data-action": "next", onClick: (event) => {
|
49
61
|
const newPage = page + 1 <= sources.length ? page + 1 : sources.length;
|
50
62
|
onNextClick && onNextClick(event, newPage);
|
@@ -52,12 +64,6 @@ const SourcesCard = (_a) => {
|
|
52
64
|
} },
|
53
65
|
React.createElement(Icon, { isInline: true, iconSize: "lg" },
|
54
66
|
React.createElement("svg", { className: "pf-v6-svg", viewBox: "0 0 180 500", fill: "currentColor", "aria-hidden": "true", role: "img", width: "1em", height: "1em" },
|
55
|
-
React.createElement("path", { d: "M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z" })))))
|
56
|
-
React.createElement("span", { "aria-hidden": "true" },
|
57
|
-
page,
|
58
|
-
" ",
|
59
|
-
ofWord,
|
60
|
-
" ",
|
61
|
-
sources.length)))))));
|
67
|
+
React.createElement("path", { d: "M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z" })))))))))));
|
62
68
|
};
|
63
69
|
export default SourcesCard;
|
@@ -13,17 +13,13 @@ import userEvent from '@testing-library/user-event';
|
|
13
13
|
import '@testing-library/jest-dom';
|
14
14
|
import SourcesCard from './SourcesCard';
|
15
15
|
describe('SourcesCard', () => {
|
16
|
-
it('should render card', () => {
|
17
|
-
const { container } = render(React.createElement(SourcesCard, { sources: [{ link: '' }] }));
|
18
|
-
expect(container).toMatchSnapshot();
|
19
|
-
});
|
20
16
|
it('should render card correctly if one source with only a link is passed in', () => {
|
21
17
|
render(React.createElement(SourcesCard, { sources: [{ link: '' }] }));
|
22
18
|
expect(screen.getByText('1 source')).toBeTruthy();
|
23
19
|
expect(screen.getByText('Source 1')).toBeTruthy();
|
24
20
|
// no buttons or navigation when there is only 1 source
|
25
21
|
expect(screen.queryByRole('button')).toBeFalsy();
|
26
|
-
expect(screen.queryByText('1
|
22
|
+
expect(screen.queryByText('1/1')).toBeFalsy();
|
27
23
|
});
|
28
24
|
it('should render card correctly if one source with a title is passed in', () => {
|
29
25
|
render(React.createElement(SourcesCard, { sources: [{ title: 'How to make an apple pie', link: '' }] }));
|
@@ -48,7 +44,7 @@ describe('SourcesCard', () => {
|
|
48
44
|
] }));
|
49
45
|
expect(screen.getByText('2 sources')).toBeTruthy();
|
50
46
|
expect(screen.getByText('How to make an apple pie')).toBeTruthy();
|
51
|
-
expect(screen.getByText('1
|
47
|
+
expect(screen.getByText('1/2')).toBeTruthy();
|
52
48
|
screen.getByRole('button', { name: /Go to previous page/i });
|
53
49
|
screen.getByRole('button', { name: /Go to next page/i });
|
54
50
|
});
|
@@ -58,12 +54,12 @@ describe('SourcesCard', () => {
|
|
58
54
|
{ title: 'How to make cookies', link: '' }
|
59
55
|
] }));
|
60
56
|
expect(screen.getByText('How to make an apple pie')).toBeTruthy();
|
61
|
-
expect(screen.getByText('1
|
57
|
+
expect(screen.getByText('1/2')).toBeTruthy();
|
62
58
|
expect(screen.getByRole('button', { name: /Go to previous page/i })).toBeDisabled();
|
63
59
|
yield userEvent.click(screen.getByRole('button', { name: /Go to next page/i }));
|
64
60
|
expect(screen.queryByText('How to make an apple pie')).toBeFalsy();
|
65
61
|
expect(screen.getByText('How to make cookies')).toBeTruthy();
|
66
|
-
expect(screen.getByText('2
|
62
|
+
expect(screen.getByText('2/2')).toBeTruthy();
|
67
63
|
expect(screen.getByRole('button', { name: /Go to previous page/i })).toBeEnabled();
|
68
64
|
expect(screen.getByRole('button', { name: /Go to next page/i })).toBeDisabled();
|
69
65
|
}));
|
@@ -83,13 +79,6 @@ describe('SourcesCard', () => {
|
|
83
79
|
expect(screen.getByRole('button', { name: /Go to previous page/i })).toBeDisabled();
|
84
80
|
expect(screen.getByRole('button', { name: /Go to next page/i })).toBeDisabled();
|
85
81
|
});
|
86
|
-
it('should change ofWord appropriately', () => {
|
87
|
-
render(React.createElement(SourcesCard, { sources: [
|
88
|
-
{ title: 'How to make an apple pie', link: '' },
|
89
|
-
{ title: 'How to make cookies', link: '' }
|
90
|
-
], ofWord: 'de' }));
|
91
|
-
expect(screen.getByText('1 de 2')).toBeTruthy();
|
92
|
-
});
|
93
82
|
it('should render navigation aria label appropriately', () => {
|
94
83
|
render(React.createElement(SourcesCard, { sources: [
|
95
84
|
{ title: 'How to make an apple pie', link: '' },
|
@@ -159,4 +148,25 @@ describe('SourcesCard', () => {
|
|
159
148
|
yield userEvent.click(screen.getByRole('button', { name: /Go to previous page/i }));
|
160
149
|
expect(spy).toHaveBeenCalledTimes(2);
|
161
150
|
}));
|
151
|
+
it('should handle showMore appropriately', () => __awaiter(void 0, void 0, void 0, function* () {
|
152
|
+
render(React.createElement(SourcesCard, { sources: [
|
153
|
+
{
|
154
|
+
title: 'Getting started with Red Hat OpenShift',
|
155
|
+
link: '#',
|
156
|
+
body: 'Red Hat OpenShift on IBM Cloud is a managed offering to create your own cluster of compute hosts where you can deploy and manage containerized apps on IBM Cloud ...',
|
157
|
+
hasShowMore: true
|
158
|
+
},
|
159
|
+
{
|
160
|
+
title: 'Azure Red Hat OpenShift documentation',
|
161
|
+
link: '#',
|
162
|
+
body: 'Microsoft Azure Red Hat OpenShift allows you to deploy a production ready Red Hat OpenShift cluster in Azure ...'
|
163
|
+
},
|
164
|
+
{
|
165
|
+
title: 'OKD Documentation: Home',
|
166
|
+
link: '#',
|
167
|
+
body: 'OKD is a distribution of Kubernetes optimized for continuous application development and multi-tenant deployment. OKD also serves as the upstream code base upon ...'
|
168
|
+
}
|
169
|
+
] }));
|
170
|
+
expect(screen.getByRole('region')).toHaveAttribute('class', 'pf-v6-c-expandable-section__content');
|
171
|
+
}));
|
162
172
|
});
|
@@ -28,6 +28,8 @@ export interface TermsOfUseProps extends ModalProps {
|
|
28
28
|
innerRef?: React.Ref<HTMLDivElement>;
|
29
29
|
/** OuiaID applied to modal */
|
30
30
|
ouiaId?: string;
|
31
|
+
/** Sets modal to compact styling. */
|
32
|
+
isCompact?: boolean;
|
31
33
|
}
|
32
34
|
export declare const TermsOfUseBase: React.FunctionComponent<TermsOfUseProps>;
|
33
35
|
declare const TermsOfUse: React.ForwardRefExoticComponent<Omit<TermsOfUseProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
@@ -17,7 +17,7 @@ import { Button, Content, ModalBody, ModalFooter, ModalHeader } from '@patternfl
|
|
17
17
|
import { ChatbotDisplayMode } from '../Chatbot';
|
18
18
|
import ChatbotModal from '../ChatbotModal/ChatbotModal';
|
19
19
|
export const TermsOfUseBase = (_a) => {
|
20
|
-
var { handleModalToggle, isModalOpen, onPrimaryAction, onSecondaryAction, primaryActionBtn = 'Accept', secondaryActionBtn = 'Decline', title = 'Terms of use', image, altText, displayMode = ChatbotDisplayMode.default, className, children, innerRef, ouiaId = 'TermsOfUse' } = _a, props = __rest(_a, ["handleModalToggle", "isModalOpen", "onPrimaryAction", "onSecondaryAction", "primaryActionBtn", "secondaryActionBtn", "title", "image", "altText", "displayMode", "className", "children", "innerRef", "ouiaId"]);
|
20
|
+
var { handleModalToggle, isModalOpen, onPrimaryAction, onSecondaryAction, primaryActionBtn = 'Accept', secondaryActionBtn = 'Decline', title = 'Terms of use', image, altText, displayMode = ChatbotDisplayMode.default, className, children, innerRef, ouiaId = 'TermsOfUse', isCompact } = _a, props = __rest(_a, ["handleModalToggle", "isModalOpen", "onPrimaryAction", "onSecondaryAction", "primaryActionBtn", "secondaryActionBtn", "title", "image", "altText", "displayMode", "className", "children", "innerRef", "ouiaId", "isCompact"]);
|
21
21
|
const handlePrimaryAction = (_event) => {
|
22
22
|
handleModalToggle(_event);
|
23
23
|
onPrimaryAction && onPrimaryAction(_event);
|
@@ -25,13 +25,13 @@ export const TermsOfUseBase = (_a) => {
|
|
25
25
|
const handleSecondaryAction = (_event) => {
|
26
26
|
onSecondaryAction(_event);
|
27
27
|
};
|
28
|
-
const modal = (React.createElement(ChatbotModal, Object.assign({ isOpen: isModalOpen, ouiaId: ouiaId, "aria-labelledby": "terms-of-use-title", "aria-describedby": "terms-of-use-modal", className: `pf-chatbot__terms-of-use-modal pf-chatbot__terms-of-use-modal--${displayMode} ${className ? className : ''}`, displayMode: displayMode }, props),
|
28
|
+
const modal = (React.createElement(ChatbotModal, Object.assign({ isOpen: isModalOpen, ouiaId: ouiaId, "aria-labelledby": "terms-of-use-title", "aria-describedby": "terms-of-use-modal", className: `pf-chatbot__terms-of-use-modal pf-chatbot__terms-of-use-modal--${displayMode} ${isCompact ? 'pf-m-compact' : ''} ${className ? className : ''}`, displayMode: displayMode }, props),
|
29
29
|
React.createElement("section", { className: `pf-chatbot__terms-of-use--section`, "aria-label": title, tabIndex: -1, ref: innerRef },
|
30
|
-
React.createElement(ModalHeader,
|
30
|
+
React.createElement(ModalHeader, { className: "pf-chatbot__terms-of-use--modal-header" },
|
31
31
|
React.createElement("div", { className: "pf-chatbot__terms-of-use--header" },
|
32
|
-
image && altText && React.createElement("img", { src: image, className: "pf-chatbot__terms-of-use--image", alt: altText }),
|
32
|
+
!isCompact && image && altText && (React.createElement("img", { src: image, className: "pf-chatbot__terms-of-use--image", alt: altText })),
|
33
33
|
React.createElement("h1", { className: "pf-chatbot__terms-of-use--title" }, title))),
|
34
|
-
React.createElement(ModalBody,
|
34
|
+
React.createElement(ModalBody, { className: "pf-chatbot__terms-of-use--modal-body" },
|
35
35
|
React.createElement(Content, null, children)),
|
36
36
|
React.createElement(ModalFooter, { className: "pf-chatbot__terms-of-use--footer" },
|
37
37
|
React.createElement(Button, { isBlock: true, key: "terms-of-use-modal-primary", variant: "primary", onClick: handlePrimaryAction, form: "terms-of-use-form", size: "lg" }, primaryActionBtn),
|
@@ -1,10 +1,9 @@
|
|
1
|
-
import { TrackingSpi } from './tracking_spi';
|
1
|
+
import { InitProps, TrackingSpi } from './tracking_spi';
|
2
2
|
import { TrackingApi, TrackingEventProperties } from './tracking_api';
|
3
3
|
export declare class ConsoleTrackingProvider implements TrackingSpi, TrackingApi {
|
4
|
+
private verbose;
|
4
5
|
trackPageView(url: string | undefined): void;
|
5
|
-
|
6
|
-
|
7
|
-
identify(userID: string): void;
|
6
|
+
initialize(props: InitProps): void;
|
7
|
+
identify(userID: string, userProperties?: TrackingEventProperties): void;
|
8
8
|
trackSingleItem(item: string, properties?: TrackingEventProperties): void;
|
9
|
-
getKey(): string;
|
10
9
|
}
|
@@ -1,23 +1,30 @@
|
|
1
1
|
export class ConsoleTrackingProvider {
|
2
|
+
constructor() {
|
3
|
+
this.verbose = false;
|
4
|
+
}
|
2
5
|
trackPageView(url) {
|
3
|
-
|
4
|
-
|
6
|
+
if (this.verbose) {
|
7
|
+
// eslint-disable-next-line no-console
|
8
|
+
console.log('ConsoleProvider pageView ', url);
|
9
|
+
}
|
5
10
|
}
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
+
initialize(props) {
|
12
|
+
this.verbose = props.verbose;
|
13
|
+
if (this.verbose) {
|
14
|
+
// eslint-disable-next-line no-console
|
15
|
+
console.log('ConsoleProvider initialize');
|
16
|
+
}
|
11
17
|
}
|
12
|
-
identify(userID) {
|
13
|
-
|
14
|
-
|
18
|
+
identify(userID, userProperties = {}) {
|
19
|
+
if (this.verbose) {
|
20
|
+
// eslint-disable-next-line no-console
|
21
|
+
console.log('ConsoleProvider identify ', userID, userProperties);
|
22
|
+
}
|
15
23
|
}
|
16
24
|
trackSingleItem(item, properties) {
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
return 'console';
|
25
|
+
if (this.verbose) {
|
26
|
+
// eslint-disable-next-line no-console
|
27
|
+
console.log('ConsoleProvider: ' + item, properties);
|
28
|
+
}
|
22
29
|
}
|
23
30
|
}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { TrackingApi, TrackingEventProperties } from './tracking_api';
|
2
2
|
import { InitProps, TrackingSpi } from './tracking_spi';
|
3
3
|
export declare class PosthogTrackingProvider implements TrackingSpi, TrackingApi {
|
4
|
-
|
4
|
+
private verbose;
|
5
5
|
initialize(props: InitProps): void;
|
6
|
-
identify(userID: string): void;
|
6
|
+
identify(userID: string, userProperties?: TrackingEventProperties): void;
|
7
7
|
trackPageView(url: string | undefined): void;
|
8
8
|
trackSingleItem(item: string, properties?: TrackingEventProperties): void;
|
9
9
|
}
|