@patternfly/chatbot 2.2.0-prerelease.30 → 2.2.0-prerelease.31
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/Message/ErrorMessage/ErrorMessage.d.ts +4 -0
- package/dist/cjs/Message/ErrorMessage/ErrorMessage.js +26 -0
- package/dist/cjs/Message/Message.d.ts +3 -1
- package/dist/cjs/Message/Message.js +4 -3
- package/dist/cjs/Message/Message.test.js +25 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +4 -1
- package/dist/cjs/tracking/console_tracking_provider.d.ts +10 -0
- package/dist/cjs/tracking/console_tracking_provider.js +27 -0
- package/dist/cjs/tracking/index.d.ts +2 -0
- package/dist/cjs/tracking/index.js +23 -0
- package/dist/cjs/tracking/posthog_tracking_provider.d.ts +9 -0
- package/dist/cjs/tracking/posthog_tracking_provider.js +37 -0
- package/dist/cjs/tracking/segment_tracking_provider.d.ts +10 -0
- package/dist/cjs/tracking/segment_tracking_provider.js +50 -0
- package/dist/cjs/tracking/trackingProviderProxy.d.ts +9 -0
- package/dist/cjs/tracking/trackingProviderProxy.js +24 -0
- package/dist/cjs/tracking/tracking_api.d.ts +8 -0
- package/dist/cjs/tracking/tracking_api.js +2 -0
- package/dist/cjs/tracking/tracking_registry.d.ts +4 -0
- package/dist/cjs/tracking/tracking_registry.js +33 -0
- package/dist/cjs/tracking/tracking_spi.d.ts +9 -0
- package/dist/cjs/tracking/tracking_spi.js +2 -0
- package/dist/cjs/tracking/umami_tracking_provider.d.ts +14 -0
- package/dist/cjs/tracking/umami_tracking_provider.js +44 -0
- package/dist/dynamic/tracking/package.json +1 -0
- package/dist/esm/Message/ErrorMessage/ErrorMessage.d.ts +4 -0
- package/dist/esm/Message/ErrorMessage/ErrorMessage.js +21 -0
- package/dist/esm/Message/Message.d.ts +3 -1
- package/dist/esm/Message/Message.js +4 -3
- package/dist/esm/Message/Message.test.js +25 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/tracking/console_tracking_provider.d.ts +10 -0
- package/dist/esm/tracking/console_tracking_provider.js +23 -0
- package/dist/esm/tracking/index.d.ts +2 -0
- package/dist/esm/tracking/index.js +2 -0
- package/dist/esm/tracking/posthog_tracking_provider.d.ts +9 -0
- package/dist/esm/tracking/posthog_tracking_provider.js +33 -0
- package/dist/esm/tracking/segment_tracking_provider.d.ts +10 -0
- package/dist/esm/tracking/segment_tracking_provider.js +46 -0
- package/dist/esm/tracking/trackingProviderProxy.d.ts +9 -0
- package/dist/esm/tracking/trackingProviderProxy.js +22 -0
- package/dist/esm/tracking/tracking_api.d.ts +8 -0
- package/dist/esm/tracking/tracking_api.js +1 -0
- package/dist/esm/tracking/tracking_registry.d.ts +4 -0
- package/dist/esm/tracking/tracking_registry.js +26 -0
- package/dist/esm/tracking/tracking_spi.d.ts +9 -0
- package/dist/esm/tracking/tracking_spi.js +1 -0
- package/dist/esm/tracking/umami_tracking_provider.d.ts +14 -0
- package/dist/esm/tracking/umami_tracking_provider.js +40 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/patternfly-docs/content/extensions/chatbot/about-chatbot.md +3 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Analytics/Analytics.md +214 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/BotMessage.tsx +24 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessage.tsx +24 -1
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.md +2 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.tsx +37 -24
- package/patternfly-docs/content/extensions/chatbot/img/analytics-example.svg +118 -0
- package/patternfly-docs/content/extensions/chatbot/img/chatbot-analytics.svg +51 -0
- package/patternfly-docs/content/extensions/chatbot/img/posthog.svg +30 -0
- package/patternfly-docs/content/extensions/chatbot/img/segment.svg +36 -0
- package/patternfly-docs/content/extensions/chatbot/img/umami.svg +30 -0
- package/src/Message/ErrorMessage/ErrorMessage.tsx +14 -0
- package/src/Message/Message.test.tsx +32 -0
- package/src/Message/Message.tsx +50 -41
- package/src/index.ts +3 -0
- package/src/tracking/console_tracking_provider.ts +30 -0
- package/src/tracking/index.ts +3 -0
- package/src/tracking/posthog_tracking_provider.ts +42 -0
- package/src/tracking/segment_tracking_provider.ts +62 -0
- package/src/tracking/trackingProviderProxy.ts +28 -0
- package/src/tracking/tracking_api.ts +11 -0
- package/src/tracking/tracking_registry.ts +33 -0
- package/src/tracking/tracking_spi.ts +14 -0
- package/src/tracking/umami_tracking_provider.ts +54 -0
package/dist/esm/index.d.ts
CHANGED
package/dist/esm/index.js
CHANGED
@@ -0,0 +1,10 @@
|
|
1
|
+
import { TrackingSpi } from './tracking_spi';
|
2
|
+
import { TrackingApi, TrackingEventProperties } from './tracking_api';
|
3
|
+
export declare class ConsoleTrackingProvider implements TrackingSpi, TrackingApi {
|
4
|
+
trackPageView(url: string | undefined): void;
|
5
|
+
registerProvider(): void;
|
6
|
+
initialize(): void;
|
7
|
+
identify(userID: string): void;
|
8
|
+
trackSingleItem(item: string, properties?: TrackingEventProperties): void;
|
9
|
+
getKey(): string;
|
10
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
export class ConsoleTrackingProvider {
|
2
|
+
trackPageView(url) {
|
3
|
+
// eslint-disable-next-line no-console
|
4
|
+
console.log('ConsoleProvider pageView', url);
|
5
|
+
}
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
7
|
+
registerProvider() { }
|
8
|
+
initialize() {
|
9
|
+
// eslint-disable-next-line no-console
|
10
|
+
console.log('ConsoleProvider initialize');
|
11
|
+
}
|
12
|
+
identify(userID) {
|
13
|
+
// eslint-disable-next-line no-console
|
14
|
+
console.log('ConsoleProvider identify', userID);
|
15
|
+
}
|
16
|
+
trackSingleItem(item, properties) {
|
17
|
+
// eslint-disable-next-line no-console
|
18
|
+
console.log('ConsoleProvider: ' + item, properties);
|
19
|
+
}
|
20
|
+
getKey() {
|
21
|
+
return 'console';
|
22
|
+
}
|
23
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { TrackingApi, TrackingEventProperties } from './tracking_api';
|
2
|
+
import { InitProps, TrackingSpi } from './tracking_spi';
|
3
|
+
export declare class PosthogTrackingProvider implements TrackingSpi, TrackingApi {
|
4
|
+
getKey(): string;
|
5
|
+
initialize(props: InitProps): void;
|
6
|
+
identify(userID: string): void;
|
7
|
+
trackPageView(url: string | undefined): void;
|
8
|
+
trackSingleItem(item: string, properties?: TrackingEventProperties): void;
|
9
|
+
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import { posthog } from 'posthog-js';
|
2
|
+
export class PosthogTrackingProvider {
|
3
|
+
getKey() {
|
4
|
+
return 'posthogKey';
|
5
|
+
}
|
6
|
+
initialize(props) {
|
7
|
+
// eslint-disable-next-line no-console
|
8
|
+
console.log('PosthogProvider initialize');
|
9
|
+
const posthogKey = props.posthogKey;
|
10
|
+
posthog.init(posthogKey, {
|
11
|
+
// eslint-disable-next-line camelcase
|
12
|
+
api_host: 'https://us.i.posthog.com',
|
13
|
+
// eslint-disable-next-line camelcase
|
14
|
+
person_profiles: 'identified_only' // or 'always' to create profiles for anonymous users as well
|
15
|
+
});
|
16
|
+
}
|
17
|
+
identify(userID) {
|
18
|
+
// eslint-disable-next-line no-console
|
19
|
+
console.log('PosthogProvider userID: ' + userID);
|
20
|
+
posthog.identify(userID);
|
21
|
+
}
|
22
|
+
trackPageView(url) {
|
23
|
+
// eslint-disable-next-line no-console
|
24
|
+
console.log('PostHogProvider url', url);
|
25
|
+
// TODO posthog seems to record that automatically.
|
26
|
+
// How to not clash with this here? Just leave as no-op?
|
27
|
+
}
|
28
|
+
trackSingleItem(item, properties) {
|
29
|
+
// eslint-disable-next-line no-console
|
30
|
+
console.log('PosthogProvider: trackSingleItem' + item, properties);
|
31
|
+
posthog.capture(item, { properties });
|
32
|
+
}
|
33
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { TrackingApi, TrackingEventProperties } from './tracking_api';
|
2
|
+
import { InitProps, TrackingSpi } from './tracking_spi';
|
3
|
+
export declare class SegmentTrackingProvider implements TrackingSpi, TrackingApi {
|
4
|
+
private analytics;
|
5
|
+
getKey(): string;
|
6
|
+
initialize(props: InitProps): void;
|
7
|
+
identify(userID: string): void;
|
8
|
+
trackPageView(url: string | undefined): void;
|
9
|
+
trackSingleItem(item: string, properties?: TrackingEventProperties): void;
|
10
|
+
}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import { AnalyticsBrowser } from '@segment/analytics-next';
|
2
|
+
export class SegmentTrackingProvider {
|
3
|
+
getKey() {
|
4
|
+
return 'segmentKey';
|
5
|
+
}
|
6
|
+
initialize(props) {
|
7
|
+
// eslint-disable-next-line no-console
|
8
|
+
console.log('SegmentProvider initialize');
|
9
|
+
const segmentKey = props.segmentKey;
|
10
|
+
// We need to create an object here, as ts lint is unhappy otherwise
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
12
|
+
const integrations = props.segmentIntegrations;
|
13
|
+
this.analytics = AnalyticsBrowser.load({
|
14
|
+
writeKey: segmentKey,
|
15
|
+
cdnURL: props.segmentCdn
|
16
|
+
}, {
|
17
|
+
integrations: Object.assign({}, integrations)
|
18
|
+
});
|
19
|
+
}
|
20
|
+
identify(userID) {
|
21
|
+
// eslint-disable-next-line no-console
|
22
|
+
console.log('SegmentProvider userID: ' + userID);
|
23
|
+
if (this.analytics) {
|
24
|
+
this.analytics.identify(userID);
|
25
|
+
}
|
26
|
+
}
|
27
|
+
trackPageView(url) {
|
28
|
+
// eslint-disable-next-line no-console
|
29
|
+
console.log('SegmentProvider url', url);
|
30
|
+
if (this.analytics) {
|
31
|
+
if (url) {
|
32
|
+
this.analytics.page(url);
|
33
|
+
}
|
34
|
+
else {
|
35
|
+
this.analytics.page(); // Uses window.url
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
trackSingleItem(item, properties) {
|
40
|
+
// eslint-disable-next-line no-console
|
41
|
+
console.log('SegmentProvider: trackSingleItem' + item, properties);
|
42
|
+
if (this.analytics) {
|
43
|
+
this.analytics.track(item, { properties });
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { TrackingApi, TrackingEventProperties } from './tracking_api';
|
2
|
+
declare class TrackingProviderProxy implements TrackingApi {
|
3
|
+
providers: TrackingApi[];
|
4
|
+
constructor(providers: TrackingApi[]);
|
5
|
+
identify(userID: string): void;
|
6
|
+
trackSingleItem(eventName: string, properties?: TrackingEventProperties): void;
|
7
|
+
trackPageView(url: string | undefined): void;
|
8
|
+
}
|
9
|
+
export default TrackingProviderProxy;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class TrackingProviderProxy {
|
2
|
+
constructor(providers) {
|
3
|
+
this.providers = [];
|
4
|
+
this.providers = providers;
|
5
|
+
}
|
6
|
+
identify(userID) {
|
7
|
+
for (const provider of this.providers) {
|
8
|
+
provider.identify(userID);
|
9
|
+
}
|
10
|
+
}
|
11
|
+
trackSingleItem(eventName, properties) {
|
12
|
+
for (const provider of this.providers) {
|
13
|
+
provider.trackSingleItem(eventName, properties);
|
14
|
+
}
|
15
|
+
}
|
16
|
+
trackPageView(url) {
|
17
|
+
for (const provider of this.providers) {
|
18
|
+
provider.trackPageView(url);
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
export default TrackingProviderProxy;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export interface TrackingEventProperties {
|
2
|
+
[key: string]: string | number | boolean | undefined;
|
3
|
+
}
|
4
|
+
export interface TrackingApi {
|
5
|
+
identify: (userID: string) => void;
|
6
|
+
trackPageView: (url: string | undefined) => void;
|
7
|
+
trackSingleItem: (eventName: string, properties: TrackingEventProperties | undefined) => void;
|
8
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import TrackingProviderProxy from './trackingProviderProxy';
|
2
|
+
import { ConsoleTrackingProvider } from './console_tracking_provider';
|
3
|
+
import { SegmentTrackingProvider } from './segment_tracking_provider';
|
4
|
+
import { PosthogTrackingProvider } from './posthog_tracking_provider';
|
5
|
+
import { UmamiTrackingProvider } from './umami_tracking_provider';
|
6
|
+
export const getTrackingProviders = (initProps) => {
|
7
|
+
const providers = [];
|
8
|
+
providers.push(new SegmentTrackingProvider());
|
9
|
+
providers.push(new PosthogTrackingProvider());
|
10
|
+
providers.push(new UmamiTrackingProvider());
|
11
|
+
// TODO dynamically find and register providers
|
12
|
+
// Initialize them
|
13
|
+
const enabledProviders = [];
|
14
|
+
for (const provider of providers) {
|
15
|
+
const key = provider.getKey();
|
16
|
+
if (Object.keys(initProps).indexOf(key) > -1) {
|
17
|
+
provider.initialize(initProps);
|
18
|
+
enabledProviders.push(provider);
|
19
|
+
}
|
20
|
+
}
|
21
|
+
// Add the console provider
|
22
|
+
const consoleTrackingProvider = new ConsoleTrackingProvider();
|
23
|
+
enabledProviders.push(consoleTrackingProvider); // TODO noop- provider?
|
24
|
+
return new TrackingProviderProxy(enabledProviders);
|
25
|
+
};
|
26
|
+
export default getTrackingProviders;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { TrackingApi, TrackingEventProperties } from './tracking_api';
|
2
|
+
export interface InitProps {
|
3
|
+
[key: string]: string | number | boolean;
|
4
|
+
}
|
5
|
+
export interface TrackingSpi extends TrackingApi {
|
6
|
+
getKey: () => string;
|
7
|
+
initialize: (props: InitProps) => void;
|
8
|
+
trackSingleItem: (item: string, properties?: TrackingEventProperties) => void;
|
9
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { InitProps, TrackingSpi } from './tracking_spi';
|
2
|
+
import { TrackingApi, TrackingEventProperties } from './tracking_api';
|
3
|
+
declare global {
|
4
|
+
interface Window {
|
5
|
+
umami: any;
|
6
|
+
}
|
7
|
+
}
|
8
|
+
export declare class UmamiTrackingProvider implements TrackingSpi, TrackingApi {
|
9
|
+
getKey(): string;
|
10
|
+
initialize(props: InitProps): void;
|
11
|
+
identify(userID: string): void;
|
12
|
+
trackPageView(url: string | undefined): void;
|
13
|
+
trackSingleItem(item: string, properties?: TrackingEventProperties): void;
|
14
|
+
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
export class UmamiTrackingProvider {
|
2
|
+
getKey() {
|
3
|
+
return 'umamiKey';
|
4
|
+
}
|
5
|
+
initialize(props) {
|
6
|
+
// eslint-disable-next-line no-console
|
7
|
+
console.log('UmamiProvider initialize');
|
8
|
+
const umamiKey = props.umamiKey;
|
9
|
+
const hostUrl = props.umamiHostUrl;
|
10
|
+
const script = document.createElement('script');
|
11
|
+
script.src = hostUrl + '/script.js';
|
12
|
+
script.async = true;
|
13
|
+
script.defer = true;
|
14
|
+
// Configure Umami properties
|
15
|
+
script.setAttribute('data-website-id', umamiKey);
|
16
|
+
script.setAttribute('data-domains', 'localhost'); // TODO ?
|
17
|
+
script.setAttribute('data-auto-track', 'false');
|
18
|
+
script.setAttribute('data-host-url', hostUrl); // TODO ?
|
19
|
+
script.setAttribute('data-exclude-search', 'false'); // TODO ?
|
20
|
+
document.body.appendChild(script);
|
21
|
+
}
|
22
|
+
identify(userID) {
|
23
|
+
var _a;
|
24
|
+
// eslint-disable-next-line no-console
|
25
|
+
console.log('UmamiProvider userID: ' + userID);
|
26
|
+
(_a = window.umami) === null || _a === void 0 ? void 0 : _a.identify({ userID });
|
27
|
+
}
|
28
|
+
trackPageView(url) {
|
29
|
+
var _a;
|
30
|
+
// eslint-disable-next-line no-console
|
31
|
+
console.log('UmamiProvider url', url);
|
32
|
+
(_a = window.umami) === null || _a === void 0 ? void 0 : _a.track({ url });
|
33
|
+
}
|
34
|
+
trackSingleItem(item, properties) {
|
35
|
+
var _a;
|
36
|
+
// eslint-disable-next-line no-console
|
37
|
+
console.log('UmamiProvider: trackSingleItem' + item, properties);
|
38
|
+
(_a = window.umami) === null || _a === void 0 ? void 0 : _a.track(item, properties);
|
39
|
+
}
|
40
|
+
}
|
@@ -1 +1 @@
|
|
1
|
-
{"root":["../src/index.ts","../src/AttachMenu/AttachMenu.tsx","../src/AttachMenu/index.ts","../src/AttachmentEdit/AttachmentEdit.test.tsx","../src/AttachmentEdit/AttachmentEdit.tsx","../src/AttachmentEdit/index.ts","../src/Chatbot/Chatbot.test.tsx","../src/Chatbot/Chatbot.tsx","../src/Chatbot/index.ts","../src/ChatbotAlert/ChatbotAlert.test.tsx","../src/ChatbotAlert/ChatbotAlert.tsx","../src/ChatbotAlert/index.ts","../src/ChatbotContent/ChatbotContent.test.tsx","../src/ChatbotContent/ChatbotContent.tsx","../src/ChatbotContent/index.ts","../src/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.tsx","../src/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.tsx","../src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx","../src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx","../src/ChatbotConversationHistoryNav/EmptyState.tsx","../src/ChatbotConversationHistoryNav/LoadingState.tsx","../src/ChatbotConversationHistoryNav/index.ts","../src/ChatbotFooter/ChatbotFooter.test.tsx","../src/ChatbotFooter/ChatbotFooter.tsx","../src/ChatbotFooter/ChatbotFooternote.test.tsx","../src/ChatbotFooter/ChatbotFootnote.tsx","../src/ChatbotFooter/index.ts","../src/ChatbotHeader/ChatbotHeader.test.tsx","../src/ChatbotHeader/ChatbotHeader.tsx","../src/ChatbotHeader/ChatbotHeaderActions.test.tsx","../src/ChatbotHeader/ChatbotHeaderActions.tsx","../src/ChatbotHeader/ChatbotHeaderCloseButton.test.tsx","../src/ChatbotHeader/ChatbotHeaderCloseButton.tsx","../src/ChatbotHeader/ChatbotHeaderMain.test.tsx","../src/ChatbotHeader/ChatbotHeaderMain.tsx","../src/ChatbotHeader/ChatbotHeaderMenu.test.tsx","../src/ChatbotHeader/ChatbotHeaderMenu.tsx","../src/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.tsx","../src/ChatbotHeader/ChatbotHeaderOptionsDropdown.tsx","../src/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.tsx","../src/ChatbotHeader/ChatbotHeaderSelectorDropdown.tsx","../src/ChatbotHeader/ChatbotHeaderTitle.test.tsx","../src/ChatbotHeader/ChatbotHeaderTitle.tsx","../src/ChatbotHeader/index.ts","../src/ChatbotModal/ChatbotModal.tsx","../src/ChatbotModal/index.ts","../src/ChatbotPopover/ChatbotPopover.tsx","../src/ChatbotPopover/index.ts","../src/ChatbotToggle/ChatbotToggle.test.tsx","../src/ChatbotToggle/ChatbotToggle.tsx","../src/ChatbotToggle/index.ts","../src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.tsx","../src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.tsx","../src/ChatbotWelcomePrompt/index.ts","../src/CodeModal/CodeModal.tsx","../src/CodeModal/index.ts","../src/Compare/Compare.test.tsx","../src/Compare/Compare.tsx","../src/Compare/index.ts","../src/FileDetails/FileDetails.test.tsx","../src/FileDetails/FileDetails.tsx","../src/FileDetails/index.ts","../src/FileDetailsLabel/FileDetailsLabel.test.tsx","../src/FileDetailsLabel/FileDetailsLabel.tsx","../src/FileDetailsLabel/index.ts","../src/FileDropZone/FileDropZone.test.tsx","../src/FileDropZone/FileDropZone.tsx","../src/FileDropZone/index.ts","../src/LoadingMessage/LoadingMessage.test.tsx","../src/LoadingMessage/LoadingMessage.tsx","../src/LoadingMessage/index.ts","../src/Message/Message.test.tsx","../src/Message/Message.tsx","../src/Message/MessageLoading.tsx","../src/Message/index.ts","../src/Message/CodeBlockMessage/CodeBlockMessage.tsx","../src/Message/ImageMessage/ImageMessage.tsx","../src/Message/LinkMessage/LinkMessage.tsx","../src/Message/ListMessage/ListItemMessage.tsx","../src/Message/ListMessage/OrderedListMessage.tsx","../src/Message/ListMessage/UnorderedListMessage.tsx","../src/Message/QuickResponse/QuickResponse.tsx","../src/Message/QuickStarts/FallbackImg.tsx","../src/Message/QuickStarts/QuickStartTile.tsx","../src/Message/QuickStarts/QuickStartTileDescription.test.tsx","../src/Message/QuickStarts/QuickStartTileDescription.tsx","../src/Message/QuickStarts/QuickStartTileHeader.tsx","../src/Message/QuickStarts/monitor-sampleapp-quickstart-with-image.ts","../src/Message/QuickStarts/monitor-sampleapp-quickstart.ts","../src/Message/QuickStarts/types.ts","../src/Message/TableMessage/TableMessage.tsx","../src/Message/TableMessage/TbodyMessage.tsx","../src/Message/TableMessage/TdMessage.tsx","../src/Message/TableMessage/ThMessage.tsx","../src/Message/TableMessage/TheadMessage.tsx","../src/Message/TableMessage/TrMessage.tsx","../src/Message/TextMessage/TextMessage.tsx","../src/Message/UserFeedback/CloseButton.tsx","../src/Message/UserFeedback/UserFeedback.test.tsx","../src/Message/UserFeedback/UserFeedback.tsx","../src/Message/UserFeedback/UserFeedbackComplete.test.tsx","../src/Message/UserFeedback/UserFeedbackComplete.tsx","../src/MessageBar/AttachButton.test.tsx","../src/MessageBar/AttachButton.tsx","../src/MessageBar/MessageBar.test.tsx","../src/MessageBar/MessageBar.tsx","../src/MessageBar/MicrophoneButton.tsx","../src/MessageBar/SendButton.test.tsx","../src/MessageBar/SendButton.tsx","../src/MessageBar/StopButton.test.tsx","../src/MessageBar/StopButton.tsx","../src/MessageBar/index.ts","../src/MessageBox/JumpButton.test.tsx","../src/MessageBox/JumpButton.tsx","../src/MessageBox/MessageBox.test.tsx","../src/MessageBox/MessageBox.tsx","../src/MessageBox/index.ts","../src/PreviewAttachment/PreviewAttachment.test.tsx","../src/PreviewAttachment/PreviewAttachment.tsx","../src/PreviewAttachment/index.ts","../src/ResponseActions/ResponseActionButton.test.tsx","../src/ResponseActions/ResponseActionButton.tsx","../src/ResponseActions/ResponseActions.test.tsx","../src/ResponseActions/ResponseActions.tsx","../src/ResponseActions/index.ts","../src/Settings/SettingsForm.test.tsx","../src/Settings/SettingsForm.tsx","../src/Settings/index.ts","../src/SourceDetailsMenuItem/SourceDetailsMenuItem.tsx","../src/SourceDetailsMenuItem/index.ts","../src/SourcesCard/SourcesCard.test.tsx","../src/SourcesCard/SourcesCard.tsx","../src/SourcesCard/index.ts","../src/TermsOfUse/TermsOfUse.test.tsx","../src/TermsOfUse/TermsOfUse.tsx","../src/TermsOfUse/index.ts","../src/__mocks__/rehype-external-links.ts","../src/__mocks__/rehype-sanitize.ts","../src/__mocks__/rehype-unwrap-images.tsx"],"version":"5.6.3"}
|
1
|
+
{"root":["../src/index.ts","../src/AttachMenu/AttachMenu.tsx","../src/AttachMenu/index.ts","../src/AttachmentEdit/AttachmentEdit.test.tsx","../src/AttachmentEdit/AttachmentEdit.tsx","../src/AttachmentEdit/index.ts","../src/Chatbot/Chatbot.test.tsx","../src/Chatbot/Chatbot.tsx","../src/Chatbot/index.ts","../src/ChatbotAlert/ChatbotAlert.test.tsx","../src/ChatbotAlert/ChatbotAlert.tsx","../src/ChatbotAlert/index.ts","../src/ChatbotContent/ChatbotContent.test.tsx","../src/ChatbotContent/ChatbotContent.tsx","../src/ChatbotContent/index.ts","../src/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.tsx","../src/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.tsx","../src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx","../src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx","../src/ChatbotConversationHistoryNav/EmptyState.tsx","../src/ChatbotConversationHistoryNav/LoadingState.tsx","../src/ChatbotConversationHistoryNav/index.ts","../src/ChatbotFooter/ChatbotFooter.test.tsx","../src/ChatbotFooter/ChatbotFooter.tsx","../src/ChatbotFooter/ChatbotFooternote.test.tsx","../src/ChatbotFooter/ChatbotFootnote.tsx","../src/ChatbotFooter/index.ts","../src/ChatbotHeader/ChatbotHeader.test.tsx","../src/ChatbotHeader/ChatbotHeader.tsx","../src/ChatbotHeader/ChatbotHeaderActions.test.tsx","../src/ChatbotHeader/ChatbotHeaderActions.tsx","../src/ChatbotHeader/ChatbotHeaderCloseButton.test.tsx","../src/ChatbotHeader/ChatbotHeaderCloseButton.tsx","../src/ChatbotHeader/ChatbotHeaderMain.test.tsx","../src/ChatbotHeader/ChatbotHeaderMain.tsx","../src/ChatbotHeader/ChatbotHeaderMenu.test.tsx","../src/ChatbotHeader/ChatbotHeaderMenu.tsx","../src/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.tsx","../src/ChatbotHeader/ChatbotHeaderOptionsDropdown.tsx","../src/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.tsx","../src/ChatbotHeader/ChatbotHeaderSelectorDropdown.tsx","../src/ChatbotHeader/ChatbotHeaderTitle.test.tsx","../src/ChatbotHeader/ChatbotHeaderTitle.tsx","../src/ChatbotHeader/index.ts","../src/ChatbotModal/ChatbotModal.tsx","../src/ChatbotModal/index.ts","../src/ChatbotPopover/ChatbotPopover.tsx","../src/ChatbotPopover/index.ts","../src/ChatbotToggle/ChatbotToggle.test.tsx","../src/ChatbotToggle/ChatbotToggle.tsx","../src/ChatbotToggle/index.ts","../src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.tsx","../src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.tsx","../src/ChatbotWelcomePrompt/index.ts","../src/CodeModal/CodeModal.tsx","../src/CodeModal/index.ts","../src/Compare/Compare.test.tsx","../src/Compare/Compare.tsx","../src/Compare/index.ts","../src/FileDetails/FileDetails.test.tsx","../src/FileDetails/FileDetails.tsx","../src/FileDetails/index.ts","../src/FileDetailsLabel/FileDetailsLabel.test.tsx","../src/FileDetailsLabel/FileDetailsLabel.tsx","../src/FileDetailsLabel/index.ts","../src/FileDropZone/FileDropZone.test.tsx","../src/FileDropZone/FileDropZone.tsx","../src/FileDropZone/index.ts","../src/LoadingMessage/LoadingMessage.test.tsx","../src/LoadingMessage/LoadingMessage.tsx","../src/LoadingMessage/index.ts","../src/Message/Message.test.tsx","../src/Message/Message.tsx","../src/Message/MessageLoading.tsx","../src/Message/index.ts","../src/Message/CodeBlockMessage/CodeBlockMessage.tsx","../src/Message/ErrorMessage/ErrorMessage.tsx","../src/Message/ImageMessage/ImageMessage.tsx","../src/Message/LinkMessage/LinkMessage.tsx","../src/Message/ListMessage/ListItemMessage.tsx","../src/Message/ListMessage/OrderedListMessage.tsx","../src/Message/ListMessage/UnorderedListMessage.tsx","../src/Message/QuickResponse/QuickResponse.tsx","../src/Message/QuickStarts/FallbackImg.tsx","../src/Message/QuickStarts/QuickStartTile.tsx","../src/Message/QuickStarts/QuickStartTileDescription.test.tsx","../src/Message/QuickStarts/QuickStartTileDescription.tsx","../src/Message/QuickStarts/QuickStartTileHeader.tsx","../src/Message/QuickStarts/monitor-sampleapp-quickstart-with-image.ts","../src/Message/QuickStarts/monitor-sampleapp-quickstart.ts","../src/Message/QuickStarts/types.ts","../src/Message/TableMessage/TableMessage.tsx","../src/Message/TableMessage/TbodyMessage.tsx","../src/Message/TableMessage/TdMessage.tsx","../src/Message/TableMessage/ThMessage.tsx","../src/Message/TableMessage/TheadMessage.tsx","../src/Message/TableMessage/TrMessage.tsx","../src/Message/TextMessage/TextMessage.tsx","../src/Message/UserFeedback/CloseButton.tsx","../src/Message/UserFeedback/UserFeedback.test.tsx","../src/Message/UserFeedback/UserFeedback.tsx","../src/Message/UserFeedback/UserFeedbackComplete.test.tsx","../src/Message/UserFeedback/UserFeedbackComplete.tsx","../src/MessageBar/AttachButton.test.tsx","../src/MessageBar/AttachButton.tsx","../src/MessageBar/MessageBar.test.tsx","../src/MessageBar/MessageBar.tsx","../src/MessageBar/MicrophoneButton.tsx","../src/MessageBar/SendButton.test.tsx","../src/MessageBar/SendButton.tsx","../src/MessageBar/StopButton.test.tsx","../src/MessageBar/StopButton.tsx","../src/MessageBar/index.ts","../src/MessageBox/JumpButton.test.tsx","../src/MessageBox/JumpButton.tsx","../src/MessageBox/MessageBox.test.tsx","../src/MessageBox/MessageBox.tsx","../src/MessageBox/index.ts","../src/PreviewAttachment/PreviewAttachment.test.tsx","../src/PreviewAttachment/PreviewAttachment.tsx","../src/PreviewAttachment/index.ts","../src/ResponseActions/ResponseActionButton.test.tsx","../src/ResponseActions/ResponseActionButton.tsx","../src/ResponseActions/ResponseActions.test.tsx","../src/ResponseActions/ResponseActions.tsx","../src/ResponseActions/index.ts","../src/Settings/SettingsForm.test.tsx","../src/Settings/SettingsForm.tsx","../src/Settings/index.ts","../src/SourceDetailsMenuItem/SourceDetailsMenuItem.tsx","../src/SourceDetailsMenuItem/index.ts","../src/SourcesCard/SourcesCard.test.tsx","../src/SourcesCard/SourcesCard.tsx","../src/SourcesCard/index.ts","../src/TermsOfUse/TermsOfUse.test.tsx","../src/TermsOfUse/TermsOfUse.tsx","../src/TermsOfUse/index.ts","../src/__mocks__/rehype-external-links.ts","../src/__mocks__/rehype-sanitize.ts","../src/__mocks__/rehype-unwrap-images.tsx","../src/tracking/console_tracking_provider.ts","../src/tracking/index.ts","../src/tracking/posthog_tracking_provider.ts","../src/tracking/segment_tracking_provider.ts","../src/tracking/trackingProviderProxy.ts","../src/tracking/tracking_api.ts","../src/tracking/tracking_registry.ts","../src/tracking/tracking_spi.ts","../src/tracking/umami_tracking_provider.ts"],"version":"5.6.3"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@patternfly/chatbot",
|
3
|
-
"version": "2.2.0-prerelease.
|
3
|
+
"version": "2.2.0-prerelease.31",
|
4
4
|
"description": "This library provides React components based on PatternFly 6 that can be used to build chatbots.",
|
5
5
|
"main": "dist/cjs/index.js",
|
6
6
|
"module": "dist/esm/index.js",
|
@@ -49,7 +49,7 @@
|
|
49
49
|
"react-dom": "^17 || ^18"
|
50
50
|
},
|
51
51
|
"devDependencies": {
|
52
|
-
"@patternfly/documentation-framework": "^6.5.
|
52
|
+
"@patternfly/documentation-framework": "^6.5.13",
|
53
53
|
"@patternfly/patternfly": "^6.1.0",
|
54
54
|
"@patternfly/patternfly-a11y": "^5.0.0",
|
55
55
|
"@patternfly/react-table": "^6.1.0",
|
@@ -37,5 +37,8 @@ Explore our documentation, which covers both ChatBot UI components and message-r
|
|
37
37
|
- Messages
|
38
38
|
- [Bot and user messages](/patternfly-ai/chatbot/messages)
|
39
39
|
- [File attachments](/patternfly-ai/chatbot/messages#attachments)
|
40
|
+
- Analytics support
|
41
|
+
- [Overview](/patternfly-ai/chatbot/analytics)
|
42
|
+
|
40
43
|
|
41
44
|
We will continue to grow and evolve our ChatBot. If you notice a bug or have any suggestions, feel free to file an issue in our [GitHub repository!](https://github.com/patternfly/chatbot/issues) Make sure to check if there is already a pre-existing issue before creating a new one.
|
@@ -0,0 +1,214 @@
|
|
1
|
+
---
|
2
|
+
# Sidenav top-level section
|
3
|
+
# should be the same for all markdown files
|
4
|
+
section: PatternFly-AI
|
5
|
+
subsection: ChatBot
|
6
|
+
# Sidenav secondary level section
|
7
|
+
# should be the same for all markdown files
|
8
|
+
id: Analytics
|
9
|
+
source: Analytics
|
10
|
+
# Tab (react | react-demos | html | html-demos | design-guidelines | accessibility)
|
11
|
+
# If you use typescript, the name of the interface to display props for
|
12
|
+
# These are found through the sourceProps function provided in patternfly-docs.source.js
|
13
|
+
sortValue: 4
|
14
|
+
---
|
15
|
+
import "../../images.css"
|
16
|
+
|
17
|
+
To gain more insight into the ways that your users interact with your ChatBot, you can add support for **analytics**. To add analytics tracking, you can refer to this guide and configure tracking for the interactions you care about most.
|
18
|
+
|
19
|
+
## Elements
|
20
|
+
|
21
|
+
This following diagram shows the main components of ChatBot analytics tracking code, as well as the flow of information between components:
|
22
|
+
|
23
|
+
<div class="ws-docs-content-img">
|
24
|
+

|
25
|
+
</div>
|
26
|
+
|
27
|
+
The user code (1) first calls the static `getTrackingProviders()` method (3) which initializes the tracking providers (4). This returns an instance of the `trackingAPI` (2), which can then subsequently be used to emit analytics events.
|
28
|
+
|
29
|
+
Note that user code only interacts with:
|
30
|
+
- `trackingAPI` (including `identify`, `trackPageview`, `trackSingleItem`)
|
31
|
+
- `TrackingRegistry` (including `getTrackingProviders`)
|
32
|
+
|
33
|
+
## Usage
|
34
|
+
|
35
|
+
### Setup
|
36
|
+
|
37
|
+
1. Before you can use the `trackingAPI`, you must first supply the API keys of the respective providers.
|
38
|
+
|
39
|
+
```nolive
|
40
|
+
const initProps: InitProps = {
|
41
|
+
segmentKey: 'TODO-key', // TODO add your key here
|
42
|
+
// segmentCdn: 'https://my.org/cdn', // Set up segment cdn (optional)
|
43
|
+
// segmentIntegrations: { // Provide Segment integrations (optional)
|
44
|
+
// 'Segment.io': {
|
45
|
+
// apiHost: 'my.api.host/api/v1',
|
46
|
+
// protocol: 'https'
|
47
|
+
// }
|
48
|
+
},
|
49
|
+
|
50
|
+
posthogKey: 'TODO-key',
|
51
|
+
umamiKey: 'TODO-key',
|
52
|
+
umamiHostUrl: 'http://localhost:3000', // TODO where is your JS provider?
|
53
|
+
something: 'test',
|
54
|
+
console: 'true' // Console provider
|
55
|
+
};
|
56
|
+
```
|
57
|
+
|
58
|
+
1. Once this is done, you can create an instance of the `trackingAPI` and start sending events.
|
59
|
+
|
60
|
+
```nolive
|
61
|
+
const trackingAPI = getTrackingProviders(initProps);
|
62
|
+
```
|
63
|
+
|
64
|
+
1. One of your first events should identify the user in some way, such as a UUID that stays consistent for the same user.
|
65
|
+
|
66
|
+
```nolive
|
67
|
+
const trackingAPI = getTrackingProviders(initProps);
|
68
|
+
trackingAPI.identify('user-123'); // TODO get real user id
|
69
|
+
// Track the page that is currently visited. Best put into a react effect (see below)
|
70
|
+
trackingAPI.trackPageView();
|
71
|
+
// Track a single Event
|
72
|
+
trackingAPI.trackSingleItem("MyEvent", { response: 'Good response' })
|
73
|
+
```
|
74
|
+
|
75
|
+
#### Tracking providers
|
76
|
+
|
77
|
+
Only providers with a matching key in the `InitProps` will be started and used.
|
78
|
+
|
79
|
+
```nolive
|
80
|
+
const initProps: InitProps = {
|
81
|
+
segmentKey: 'TODO-key', // TODO add your key here
|
82
|
+
posthogKey: 'TODO-key',
|
83
|
+
umamiKey: 'TODO-key',
|
84
|
+
umamiHostUrl: 'http://localhost:3000', // TODO where is your JS provider?
|
85
|
+
console: true
|
86
|
+
```
|
87
|
+
|
88
|
+
##### Modifying providers
|
89
|
+
|
90
|
+
If you know upfront that you only want to use 1 of the supported providers, you can modify `getTrackingProviders()` and remove all other providers in the providers array.
|
91
|
+
|
92
|
+
When using the providers you need to add additional dependencies to your package.json file:
|
93
|
+
|
94
|
+
```nolive
|
95
|
+
"dependencies": {
|
96
|
+
"@segment/analytics-next": "^1.76.0",
|
97
|
+
"posthog-js": "^1.194.4"
|
98
|
+
```
|
99
|
+
|
100
|
+
##### Adding providers
|
101
|
+
|
102
|
+
To add another analytics provider, you need to implement 2 interfaces, `TrackingSpi` and `trackingApi`.
|
103
|
+
1. It is easiest to start by copying the `ConsoleTrackingProvider`
|
104
|
+
1. The first thing you should do is to provide a correct value in `getKey()`
|
105
|
+
1. Once you are happy enough with the implementation, add it to the array of providers in `getTrackingProviders()`
|
106
|
+
|
107
|
+
### Page flow tracking
|
108
|
+
|
109
|
+
To understand how users move through their ChatBot journey, you can track their page flow.
|
110
|
+
|
111
|
+
To add tracking to each page view, use the `trackPageView()` method.
|
112
|
+
|
113
|
+
```nolive
|
114
|
+
import React from 'react';
|
115
|
+
import { useLocation } from 'react-router-dom';
|
116
|
+
|
117
|
+
export const useTrackPageFlow = (): void => {
|
118
|
+
const { pathname } = useLocation();
|
119
|
+
|
120
|
+
// notify url change events
|
121
|
+
React.useEffect(() => {
|
122
|
+
trackingAPI.trackPageView();
|
123
|
+
}, [pathname]);
|
124
|
+
};
|
125
|
+
```
|
126
|
+
|
127
|
+
### Event tracking
|
128
|
+
|
129
|
+
To get more specific insight into how users are interacting with the UI, you can track single events, including button clicks, form submissions, and so on.
|
130
|
+
|
131
|
+
To add tracking to an interaction of your choice, use the `trackSingleItem` method.
|
132
|
+
|
133
|
+
```nolive
|
134
|
+
trackingAPI.trackSingleItem(eventName, propertyDict)
|
135
|
+
```
|
136
|
+
|
137
|
+
This method takes 2 parameters:
|
138
|
+
- `eventName`: The unique name of the event. To differentiate different events that use the same name, you'll need to add an additional property.
|
139
|
+
- `propertyDict`: A dict with key-value pairs that represent important properties of the event. If there are none, this value can be empty.
|
140
|
+
|
141
|
+
#### Form submissions
|
142
|
+
|
143
|
+
Only add tracking to the form itself, not the button that opens the form. You should track both successful and failed form submissions, as well as cancelled forms
|
144
|
+
|
145
|
+
```nolive
|
146
|
+
trackingAPI.trackSingleItem(Event_Name, {
|
147
|
+
outcome: << submit , cancel >>,
|
148
|
+
success? : boolean,
|
149
|
+
error? : string,
|
150
|
+
<properties>, string/number/boolean } )
|
151
|
+
```
|
152
|
+
|
153
|
+
Parameters to pass with the `trackSingleItem` method can include:
|
154
|
+
- `outcome`: Communicates if the form was submitted or cancelled.
|
155
|
+
- `success`: Used for a "submit" outcome to communicate if the submission was successful for not in the backend.
|
156
|
+
- `error`: Used for a "submit" outcome to communicate the error message associated with a failed submission. Try to remove extraneous parts of the message, like part of a container-name.
|
157
|
+
- `properties`: Any additional properties from the form, to be tracked for analytics.
|
158
|
+
- Use your judgement to determine what will be useful for your analytics.
|
159
|
+
- Highly specific data, like names provided by the user or description text input, should not be tracked.
|
160
|
+
- Less personal data, like deployment replica count or memory server size, is more likely to help you understand your users.
|
161
|
+
|
162
|
+
## Examples
|
163
|
+
|
164
|
+
To better understand the analytics tracking process, here are 3 examples of what you could see in an analytics tool.
|
165
|
+
|
166
|
+
For all 3 tools, consider the following example, where the users has started a ChatBot and taken actions 1-5 in order:
|
167
|
+
|
168
|
+
<div class="ws-docs-content-img" style="width:60%">
|
169
|
+

|
170
|
+
</div>
|
171
|
+
|
172
|
+
1. Selected a model
|
173
|
+
2. Sent a question
|
174
|
+
3. Received a response from the model
|
175
|
+
4. Clicked the "thumbs up" button
|
176
|
+
5. Closed the ChatBot window
|
177
|
+
|
178
|
+
This pattern of actions will be applied to the following 3 analytics tools.
|
179
|
+
|
180
|
+
1. Segment
|
181
|
+
|
182
|
+
- [Segment](https://segment.com/) shows all user events in its source debugger:
|
183
|
+
|
184
|
+
<div class="ws-docs-content-img" style="width:70%">
|
185
|
+

|
186
|
+
</div>
|
187
|
+
|
188
|
+
- 1-5: User actions with the newest event at the top.
|
189
|
+
- 6-7: You can also see the results of `identify` (6) and `trackPageView` (7).
|
190
|
+
- If you clicked on an event, you would also see the properties.
|
191
|
+
|
192
|
+
- **Note**: When using the Segment provider, you may also want to set the `segmentCdn` and `segmentIntegrations` initialization properties.
|
193
|
+
|
194
|
+
1. Umami
|
195
|
+
|
196
|
+
- In [Umami](https://umami.is/), events are visible within **Website** / **Events**.
|
197
|
+
- The list is similar to Segment, with different formatting:
|
198
|
+
|
199
|
+
<div class="ws-docs-content-img">
|
200
|
+

|
201
|
+
</div>
|
202
|
+
|
203
|
+
- 1-5: User actions with the newest event at the top.
|
204
|
+
|
205
|
+
3. PostHog
|
206
|
+
|
207
|
+
- In [PostHog](https://posthog.com/), events are located in the **Activity** section.
|
208
|
+
- PostHog integrates deeper in the provided code, so there are more default events tracked:
|
209
|
+
|
210
|
+
<div class="ws-docs-content-img">
|
211
|
+

|
212
|
+
</div>
|
213
|
+
|
214
|
+
- 1-5: User actions with the newest event at the top.
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
2
2
|
import Message from '@patternfly/chatbot/dist/dynamic/Message';
|
3
3
|
import patternflyAvatar from './patternfly_avatar.jpg';
|
4
4
|
import squareImg from './PF-social-color-square.svg';
|
5
|
-
import { Form, FormGroup, Radio } from '@patternfly/react-core';
|
5
|
+
import { AlertActionLink, Form, FormGroup, Radio } from '@patternfly/react-core';
|
6
6
|
|
7
7
|
export const BotMessageExample: React.FunctionComponent = () => {
|
8
8
|
const [variant, setVariant] = React.useState('code');
|
@@ -140,6 +140,21 @@ _Italic text, formatted with single underscores_
|
|
140
140
|
|
141
141
|
const image = ``;
|
142
142
|
|
143
|
+
const error = {
|
144
|
+
title: 'Could not load chat',
|
145
|
+
children: 'Wait a few minutes and check your network settings. If the issue persists: ',
|
146
|
+
actionLinks: (
|
147
|
+
<React.Fragment>
|
148
|
+
<AlertActionLink component="a" href="#">
|
149
|
+
Start a new chat
|
150
|
+
</AlertActionLink>
|
151
|
+
<AlertActionLink component="a" href="#">
|
152
|
+
Contact support
|
153
|
+
</AlertActionLink>
|
154
|
+
</React.Fragment>
|
155
|
+
)
|
156
|
+
};
|
157
|
+
|
143
158
|
return (
|
144
159
|
<>
|
145
160
|
<Message
|
@@ -258,6 +273,13 @@ _Italic text, formatted with single underscores_
|
|
258
273
|
label="Image"
|
259
274
|
id="image"
|
260
275
|
/>
|
276
|
+
<Radio
|
277
|
+
isChecked={variant === 'error'}
|
278
|
+
onChange={() => setVariant('error')}
|
279
|
+
name="bot-message-error"
|
280
|
+
label="Error"
|
281
|
+
id="error"
|
282
|
+
/>
|
261
283
|
</FormGroup>
|
262
284
|
</Form>
|
263
285
|
<Message
|
@@ -268,6 +290,7 @@ _Italic text, formatted with single underscores_
|
|
268
290
|
tableProps={
|
269
291
|
variant === 'table' ? { 'aria-label': 'App information and user roles for bot messages' } : undefined
|
270
292
|
}
|
293
|
+
error={variant === 'error' ? error : undefined}
|
271
294
|
/>
|
272
295
|
</>
|
273
296
|
);
|