@patternfly/chatbot 2.2.0-prerelease.29 → 2.2.0-prerelease.30
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/LinkMessage/LinkMessage.d.ts +4 -0
- package/dist/cjs/Message/LinkMessage/LinkMessage.js +30 -0
- package/dist/cjs/Message/Message.d.ts +2 -0
- package/dist/cjs/Message/Message.js +13 -3
- package/dist/cjs/Message/Message.test.js +14 -0
- package/dist/cjs/__mocks__/rehype-external-links.d.ts +2 -0
- package/dist/cjs/__mocks__/rehype-external-links.js +4 -0
- package/dist/cjs/__mocks__/rehype-sanitize.d.ts +2 -0
- package/dist/cjs/__mocks__/rehype-sanitize.js +4 -0
- package/dist/cjs/__mocks__/rehype-unwrap-images.d.ts +2 -2
- package/dist/cjs/__mocks__/rehype-unwrap-images.js +2 -2
- package/dist/css/main.css +16 -5
- package/dist/css/main.css.map +1 -1
- package/dist/esm/Message/LinkMessage/LinkMessage.d.ts +4 -0
- package/dist/esm/Message/LinkMessage/LinkMessage.js +25 -0
- package/dist/esm/Message/Message.d.ts +2 -0
- package/dist/esm/Message/Message.js +13 -3
- package/dist/esm/Message/Message.test.js +14 -0
- package/dist/esm/__mocks__/rehype-external-links.d.ts +2 -0
- package/dist/esm/__mocks__/rehype-external-links.js +2 -0
- package/dist/esm/__mocks__/rehype-sanitize.d.ts +2 -0
- package/dist/esm/__mocks__/rehype-sanitize.js +2 -0
- package/dist/esm/__mocks__/rehype-unwrap-images.d.ts +2 -2
- package/dist/esm/__mocks__/rehype-unwrap-images.js +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -1
- package/src/Chatbot/Chatbot.scss +1 -1
- package/src/Message/LinkMessage/LinkMessage.tsx +34 -0
- package/src/Message/ListMessage/ListMessage.scss +1 -1
- package/src/Message/Message.test.tsx +22 -0
- package/src/Message/Message.tsx +19 -4
- package/src/Message/TextMessage/TextMessage.scss +8 -1
- package/src/__mocks__/rehype-external-links.ts +3 -0
- package/src/__mocks__/rehype-sanitize.ts +3 -0
- package/src/__mocks__/rehype-unwrap-images.tsx +2 -2
- package/src/main.scss +0 -2
@@ -0,0 +1,30 @@
|
|
1
|
+
"use strict";
|
2
|
+
// ============================================================================
|
3
|
+
// Chatbot Main - Message - Content - Link
|
4
|
+
// ============================================================================
|
5
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
6
|
+
var t = {};
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
8
|
+
t[p] = s[p];
|
9
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
10
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
11
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
12
|
+
t[p[i]] = s[p[i]];
|
13
|
+
}
|
14
|
+
return t;
|
15
|
+
};
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
18
|
+
};
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
20
|
+
const react_1 = __importDefault(require("react"));
|
21
|
+
const react_core_1 = require("@patternfly/react-core");
|
22
|
+
const react_icons_1 = require("@patternfly/react-icons");
|
23
|
+
const LinkMessage = (_a) => {
|
24
|
+
var { children, target, href } = _a, props = __rest(_a, ["children", "target", "href"]);
|
25
|
+
if (target === '_blank') {
|
26
|
+
return (react_1.default.createElement(react_core_1.Button, Object.assign({ component: "a", variant: "link", href: href, icon: react_1.default.createElement(react_icons_1.ExternalLinkSquareAltIcon, null), iconPosition: "end", isInline: true, target: target }, props), children));
|
27
|
+
}
|
28
|
+
return (react_1.default.createElement(react_core_1.Button, Object.assign({ isInline: true, component: "a", href: href, variant: "link" }, props), children));
|
29
|
+
};
|
30
|
+
exports.default = LinkMessage;
|
@@ -100,6 +100,8 @@ export interface MessageProps extends Omit<React.HTMLProps<HTMLDivElement>, 'rol
|
|
100
100
|
tableProps?: Required<Pick<TableProps, 'aria-label'>> & TableProps;
|
101
101
|
/** Additional rehype plugins passed from the consumer */
|
102
102
|
additionalRehypePlugins?: PluggableList;
|
103
|
+
/** Whether to open links in message in new tab. */
|
104
|
+
openLinkInNewTab?: boolean;
|
103
105
|
}
|
104
106
|
export declare const MessageBase: React.FunctionComponent<MessageProps>;
|
105
107
|
declare const Message: React.ForwardRefExoticComponent<Omit<MessageProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
@@ -43,9 +43,19 @@ const TheadMessage_1 = __importDefault(require("./TableMessage/TheadMessage"));
|
|
43
43
|
const ThMessage_1 = __importDefault(require("./TableMessage/ThMessage"));
|
44
44
|
const ImageMessage_1 = __importDefault(require("./ImageMessage/ImageMessage"));
|
45
45
|
const rehype_unwrap_images_1 = __importDefault(require("rehype-unwrap-images"));
|
46
|
+
const rehype_external_links_1 = __importDefault(require("rehype-external-links"));
|
47
|
+
const rehype_sanitize_1 = __importDefault(require("rehype-sanitize"));
|
48
|
+
const LinkMessage_1 = __importDefault(require("./LinkMessage/LinkMessage"));
|
46
49
|
const MessageBase = (_a) => {
|
47
|
-
var { role, content, extraContent, name, avatar, timestamp, isLoading, actions, sources, botWord = 'AI', loadingWord = 'Loading message', codeBlockProps, quickResponses, quickResponseContainerProps = { numLabels: 5 }, attachments, hasRoundAvatar = true, avatarProps, quickStarts, userFeedbackForm, userFeedbackComplete, isLiveRegion = true, innerRef, tableProps, additionalRehypePlugins = [] } = _a, props = __rest(_a, ["role", "content", "extraContent", "name", "avatar", "timestamp", "isLoading", "actions", "sources", "botWord", "loadingWord", "codeBlockProps", "quickResponses", "quickResponseContainerProps", "attachments", "hasRoundAvatar", "avatarProps", "quickStarts", "userFeedbackForm", "userFeedbackComplete", "isLiveRegion", "innerRef", "tableProps", "additionalRehypePlugins"]);
|
50
|
+
var { role, content, extraContent, name, avatar, timestamp, isLoading, actions, sources, botWord = 'AI', loadingWord = 'Loading message', codeBlockProps, quickResponses, quickResponseContainerProps = { numLabels: 5 }, attachments, hasRoundAvatar = true, avatarProps, quickStarts, userFeedbackForm, userFeedbackComplete, isLiveRegion = true, innerRef, tableProps, openLinkInNewTab = true, additionalRehypePlugins = [] } = _a, props = __rest(_a, ["role", "content", "extraContent", "name", "avatar", "timestamp", "isLoading", "actions", "sources", "botWord", "loadingWord", "codeBlockProps", "quickResponses", "quickResponseContainerProps", "attachments", "hasRoundAvatar", "avatarProps", "quickStarts", "userFeedbackForm", "userFeedbackComplete", "isLiveRegion", "innerRef", "tableProps", "openLinkInNewTab", "additionalRehypePlugins"]);
|
48
51
|
const { beforeMainContent, afterMainContent, endContent } = extraContent || {};
|
52
|
+
let rehypePlugins = [rehype_unwrap_images_1.default];
|
53
|
+
if (openLinkInNewTab) {
|
54
|
+
rehypePlugins = rehypePlugins.concat([[rehype_external_links_1.default, { target: '_blank' }, rehype_sanitize_1.default]]);
|
55
|
+
}
|
56
|
+
if (additionalRehypePlugins) {
|
57
|
+
rehypePlugins.push(...additionalRehypePlugins);
|
58
|
+
}
|
49
59
|
let avatarClassName;
|
50
60
|
if (avatarProps && 'className' in avatarProps) {
|
51
61
|
const { className } = avatarProps, rest = __rest(avatarProps, ["className"]);
|
@@ -55,7 +65,6 @@ const MessageBase = (_a) => {
|
|
55
65
|
// Keep timestamps consistent between Timestamp component and aria-label
|
56
66
|
const date = new Date();
|
57
67
|
const dateString = timestamp !== null && timestamp !== void 0 ? timestamp : `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
|
58
|
-
const rehypePlugins = [rehype_unwrap_images_1.default, ...(additionalRehypePlugins !== null && additionalRehypePlugins !== void 0 ? additionalRehypePlugins : [])];
|
59
68
|
return (react_1.default.createElement("section", Object.assign({ "aria-label": `Message from ${role} - ${dateString}`, className: `pf-chatbot__message pf-chatbot__message--${role}`, "aria-live": isLiveRegion ? 'polite' : undefined, "aria-atomic": isLiveRegion ? false : undefined, ref: innerRef }, props),
|
60
69
|
react_1.default.createElement(react_core_1.Avatar, Object.assign({ className: `pf-chatbot__message-avatar ${hasRoundAvatar ? 'pf-chatbot__message-avatar--round' : ''} ${avatarClassName ? avatarClassName : ''}`, src: avatar, alt: "" }, avatarProps)),
|
61
70
|
react_1.default.createElement("div", { className: "pf-chatbot__message-contents" },
|
@@ -95,7 +104,8 @@ const MessageBase = (_a) => {
|
|
95
104
|
return react_1.default.createElement(TdMessage_1.default, Object.assign({}, rest));
|
96
105
|
},
|
97
106
|
th: (props) => react_1.default.createElement(ThMessage_1.default, Object.assign({}, props)),
|
98
|
-
img: (props) => react_1.default.createElement(ImageMessage_1.default, Object.assign({}, props))
|
107
|
+
img: (props) => react_1.default.createElement(ImageMessage_1.default, Object.assign({}, props)),
|
108
|
+
a: (props) => (react_1.default.createElement(LinkMessage_1.default, { href: props.href, rel: props.rel, target: props.target }, props.children))
|
99
109
|
}, remarkPlugins: [remark_gfm_1.default], rehypePlugins: rehypePlugins }, content),
|
100
110
|
afterMainContent && react_1.default.createElement(react_1.default.Fragment, null, afterMainContent))),
|
101
111
|
!isLoading && sources && react_1.default.createElement(SourcesCard_1.default, Object.assign({}, sources)),
|
@@ -19,6 +19,7 @@ const Message_1 = __importDefault(require("./Message"));
|
|
19
19
|
const user_event_1 = __importDefault(require("@testing-library/user-event"));
|
20
20
|
const monitor_sampleapp_quickstart_1 = require("./QuickStarts/monitor-sampleapp-quickstart");
|
21
21
|
const monitor_sampleapp_quickstart_with_image_1 = require("./QuickStarts/monitor-sampleapp-quickstart-with-image");
|
22
|
+
const rehype_external_links_1 = __importDefault(require("../__mocks__/rehype-external-links"));
|
22
23
|
const ALL_ACTIONS = [
|
23
24
|
{ label: /Good response/i },
|
24
25
|
{ label: /Bad response/i },
|
@@ -147,6 +148,9 @@ const checkListItemsRendered = () => {
|
|
147
148
|
});
|
148
149
|
};
|
149
150
|
describe('Message', () => {
|
151
|
+
beforeEach(() => {
|
152
|
+
jest.clearAllMocks();
|
153
|
+
});
|
150
154
|
it('should render user messages correctly', () => {
|
151
155
|
(0, react_2.render)(react_1.default.createElement(Message_1.default, { avatar: "./img", role: "user", name: "User", content: "Hi" }));
|
152
156
|
expect(react_2.screen.getByText('User')).toBeTruthy();
|
@@ -580,4 +584,14 @@ describe('Message', () => {
|
|
580
584
|
(0, react_2.render)(react_1.default.createElement(Message_1.default, { avatar: "./img", role: "user", name: "User", content: IMAGE }));
|
581
585
|
expect(react_2.screen.getByRole('img', { name: /Multi-colored wavy lines on a black background/i })).toBeTruthy();
|
582
586
|
});
|
587
|
+
it('should handle external links correctly', () => {
|
588
|
+
(0, react_2.render)(react_1.default.createElement(Message_1.default, { avatar: "./img", role: "user", name: "User", content: `[PatternFly](https://www.patternfly.org/)` }));
|
589
|
+
// we are mocking rehype libraries, so we can't test target _blank addition on links directly with RTL
|
590
|
+
expect(rehype_external_links_1.default).toHaveBeenCalledTimes(1);
|
591
|
+
});
|
592
|
+
it('should handle external links correctly', () => {
|
593
|
+
(0, react_2.render)(react_1.default.createElement(Message_1.default, { avatar: "./img", role: "user", name: "User", content: `[PatternFly](https://www.patternfly.org/)`, openLinkInNewTab: false }));
|
594
|
+
// we are mocking rehype libraries, so we can't test target _blank addition on links directly with RTL
|
595
|
+
expect(rehype_external_links_1.default).not.toHaveBeenCalled();
|
596
|
+
});
|
583
597
|
});
|
@@ -1,2 +1,2 @@
|
|
1
|
-
declare const
|
2
|
-
export default
|
1
|
+
declare const rehypeUnwrapImages: jest.Mock<null, [], any>;
|
2
|
+
export default rehypeUnwrapImages;
|
package/dist/css/main.css
CHANGED
@@ -64,7 +64,7 @@
|
|
64
64
|
background-color: var(--pf-t--chatbot--background);
|
65
65
|
border-radius: var(--pf-t--global--border--radius--medium);
|
66
66
|
box-shadow: var(--pf-t--global--box-shadow--lg);
|
67
|
-
font-size: var(--pf-t--
|
67
|
+
font-size: var(--pf-t--global--font--size--md);
|
68
68
|
z-index: var(--pf-t--global--z-index--md);
|
69
69
|
-webkit-font-smoothing: antialiased;
|
70
70
|
-moz-osx-font-smoothing: grayscale;
|
@@ -1114,12 +1114,15 @@
|
|
1114
1114
|
padding: var(--pf-t--global--spacer--sm) 0 var(--pf-t--global--spacer--sm) 0;
|
1115
1115
|
border-radius: var(--pf-t--global--border--radius--small);
|
1116
1116
|
}
|
1117
|
+
.pf-chatbot__message-text .pf-v6-c-button.pf-m-link {
|
1118
|
+
font-size: var(--pf-t--global--font--size--md);
|
1119
|
+
}
|
1117
1120
|
.pf-chatbot__message-text .pf-v6-c-content,
|
1118
1121
|
.pf-chatbot__message-text .pf-v6-c-content--small,
|
1119
1122
|
.pf-chatbot__message-text .pf-v6-c-content--blockquote,
|
1120
1123
|
.pf-chatbot__message-text p,
|
1121
1124
|
.pf-chatbot__message-text a {
|
1122
|
-
--pf-v6-c-content--FontSize: var(--pf-t--
|
1125
|
+
--pf-v6-c-content--FontSize: var(--pf-t--global--font--size--md);
|
1123
1126
|
}
|
1124
1127
|
.pf-chatbot__message-text code {
|
1125
1128
|
background-color: var(--pf-t--global--background--color--tertiary--default);
|
@@ -1132,6 +1135,9 @@
|
|
1132
1135
|
--pf-v6-c-content--Color: var(--pf-t--global--text--color--on-brand--default);
|
1133
1136
|
padding: var(--pf-t--global--spacer--sm);
|
1134
1137
|
}
|
1138
|
+
.pf-chatbot__message--user .pf-chatbot__message-text .pf-v6-c-button__icon {
|
1139
|
+
--pf-v6-c-button__icon--Color: var(--pf-t--global--text--color--on-brand--default);
|
1140
|
+
}
|
1135
1141
|
.pf-chatbot__message--user .pf-chatbot__message-text .pf-v6-c-content,
|
1136
1142
|
.pf-chatbot__message--user .pf-chatbot__message-text .pf-v6-c-content--small,
|
1137
1143
|
.pf-chatbot__message--user .pf-chatbot__message-text .pf-v6-c-content--blockquote,
|
@@ -1227,12 +1233,15 @@
|
|
1227
1233
|
padding: var(--pf-t--global--spacer--sm) 0 var(--pf-t--global--spacer--sm) 0;
|
1228
1234
|
border-radius: var(--pf-t--global--border--radius--small);
|
1229
1235
|
}
|
1236
|
+
.pf-chatbot__message-text .pf-v6-c-button.pf-m-link {
|
1237
|
+
font-size: var(--pf-t--global--font--size--md);
|
1238
|
+
}
|
1230
1239
|
.pf-chatbot__message-text .pf-v6-c-content,
|
1231
1240
|
.pf-chatbot__message-text .pf-v6-c-content--small,
|
1232
1241
|
.pf-chatbot__message-text .pf-v6-c-content--blockquote,
|
1233
1242
|
.pf-chatbot__message-text p,
|
1234
1243
|
.pf-chatbot__message-text a {
|
1235
|
-
--pf-v6-c-content--FontSize: var(--pf-t--
|
1244
|
+
--pf-v6-c-content--FontSize: var(--pf-t--global--font--size--md);
|
1236
1245
|
}
|
1237
1246
|
.pf-chatbot__message-text code {
|
1238
1247
|
background-color: var(--pf-t--global--background--color--tertiary--default);
|
@@ -1245,6 +1254,9 @@
|
|
1245
1254
|
--pf-v6-c-content--Color: var(--pf-t--global--text--color--on-brand--default);
|
1246
1255
|
padding: var(--pf-t--global--spacer--sm);
|
1247
1256
|
}
|
1257
|
+
.pf-chatbot__message--user .pf-chatbot__message-text .pf-v6-c-button__icon {
|
1258
|
+
--pf-v6-c-button__icon--Color: var(--pf-t--global--text--color--on-brand--default);
|
1259
|
+
}
|
1248
1260
|
.pf-chatbot__message--user .pf-chatbot__message-text .pf-v6-c-content,
|
1249
1261
|
.pf-chatbot__message--user .pf-chatbot__message-text .pf-v6-c-content--small,
|
1250
1262
|
.pf-chatbot__message--user .pf-chatbot__message-text .pf-v6-c-content--blockquote,
|
@@ -1265,7 +1277,7 @@
|
|
1265
1277
|
.pf-chatbot__message-unordered-list .pf-v6-c-list,
|
1266
1278
|
.pf-chatbot__message-unordered-list ul,
|
1267
1279
|
.pf-chatbot__message-unordered-list li {
|
1268
|
-
font-size: var(--pf-t--
|
1280
|
+
font-size: var(--pf-t--global--font--size--md);
|
1269
1281
|
}
|
1270
1282
|
|
1271
1283
|
.pf-chatbot__message--user .pf-chatbot__message-ordered-list,
|
@@ -1993,7 +2005,6 @@
|
|
1993
2005
|
);
|
1994
2006
|
--pf-t--chatbot--blue-icon--fill--hover: var(--pf-t--global--color--brand--hover);
|
1995
2007
|
--pf-t--chatbot-toggle--color: var(--pf-t--global--icon--color--inverse);
|
1996
|
-
--pf-t--chatbot--font-size: var(--pf-t--global--font--size--md);
|
1997
2008
|
--pf-t--chatbot--background: var(--pf-t--global--background--color--secondary--default);
|
1998
2009
|
--pf-t--chatbot--border: var(--pf-t--global--border--color--default);
|
1999
2010
|
--pf-t--chatbot--icon--fill--active: var(--pf-t--global--text--color--regular);
|
package/dist/css/main.css.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["../../src/AttachMenu/AttachMenu.scss","../../src/Chatbot/Chatbot.scss","../../src/ChatbotAlert/ChatbotAlert.scss","../../src/ChatbotContent/ChatbotContent.scss","../../src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.scss","../../src/ChatbotFooter/ChatbotFootnote.scss","../../src/ChatbotFooter/ChatbotFooter.scss","../../src/ChatbotHeader/ChatbotHeader.scss","../../src/ChatbotModal/ChatbotModal.scss","../../src/ChatbotPopover/ChatbotPopover.scss","../../src/ChatbotToggle/ChatbotToggle.scss","../../src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.scss","../../src/CodeModal/CodeModal.scss","../../src/Compare/Compare.scss","../../src/FileDetails/FileDetails.scss","../../src/FileDetailsLabel/FileDetailsLabel.scss","../../src/FileDropZone/FileDropZone.scss","../../src/Message/Message.scss","../../src/Message/MessageLoading.scss","../../src/Message/CodeBlockMessage/CodeBlockMessage.scss","../../src/Message/TextMessage/TextMessage.scss","../../src/Message/ImageMessage/ImageMessage.scss","../../src/Message/ListMessage/ListMessage.scss","../../src/Message/TableMessage/TableMessage.scss","../../src/Message/QuickStarts/QuickStartTile.scss","../../src/Message/QuickResponse/QuickResponse.scss","../../src/Message/UserFeedback/UserFeedback.scss","../../src/MessageBar/AttachButton.scss","../../src/MessageBar/MicrophoneButton.scss","../../src/MessageBar/SendButton.scss","../../src/MessageBar/StopButton.scss","../../src/MessageBar/MessageBar.scss","../../src/MessageBox/JumpButton.scss","../../src/MessageBox/MessageBox.scss","../../src/ResponseActions/ResponseActions.scss","../../src/Settings/Settings.scss","../../src/SourcesCard/SourcesCard.scss","../../src/SourceDetailsMenuItem/SourceDetailsMenuItem.scss","../../src/TermsOfUse/TermsOfUse.scss","../../src/main.scss"],"names":[],"mappings":"AAAA;EACE;EACA;;;AAGF;AACE;AAsBA;AASA;;AA9BA;EACE;EACA;EACA;EACA;;AAEF;EACE;;AAGF;AACE;;AACA;EACE;EACA;EACA;EACA;EACA;;AAKJ;EACE;;AAGF;EACE;;AAIF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EACE;;AAGF;EACE;;;ACxDJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGA;EACE;;AAKF;EAvBF;IAwBI;IACA;;;AAIF;EA7BF;IA8BI;;;;AAOJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAIA;EAXF;IAYI;;;;AAOJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAMF;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;AAGA;EACE;;AAIF;EAdF;IAeI;;;;AAIJ;EACE;;;AAGF;AAAA;AAAA;EAGE;;;AC1GF;EACE;EACA;EACA;;;ACAF;EACE;EACA;EACA;EACA;EACA;;AAGA;EARF;IASI;;;;AAOJ;EAGI;AAAA;IACE;IACA;;;ACpBJ;EACE;EACA;;AAIF;EACE;EACA;;AAKF;EACE;EACA;EACA;EACA;;AAEF;EACE;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAEF;EACE;;AAGF;EACE;;AAGF;EACE;;;AAMJ;EACE;EACA;EACA;;AAGA;EACE;EACA;EACA;EACA;EACA;EACA;;AAIF;EACE;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;;AAIF;EACE;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAKA;EACE;EACA;EACA;EACA;EACA;EACA;;AAKJ;EACE;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;;AAKA;EACE;;;AASJ;EACE;;;AAQF;EACE;;AACA;EACE;;;AASJ;EACE;;AACA;EACE;EACA;;AAEF;EACE;;;AASF;AAAA;AAAA;EACE;;;AAKN;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;;;ACvMF;EACE;;AAEA;EACE;EACA;;;ACHJ;EACE;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;EACA;EACA;;;AAMF;EAGI;AAAA;IACE;;EACA;AAAA;IACE;;EAGJ;AAAA;IACE;IACA;IACA;;;AASJ;EACE;;;AC5CJ;EACE;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAEA;EACE;;AAKJ;EACE;EACA;EACA;;AAEA;EACE;;AAGF;EACE;EACA;;AAIJ;EACE;;AAGF;EACE;EACA;EACA;EACA;EACA;;AACA;EACE;;;AAQN;EAGI;AAAA;IACE;;EAEF;AAAA;IACE;;;AASJ;EACE;;;AAOJ;AAAA;EAEE;EACA;EACA;EACA;EACA;;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;EAGE;;AAGF;AAAA;AAAA;AAAA;EAEE;EACA;EACA;;AAMA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAGE;;;AAOJ;EACE;;;AAOJ;AAAA;EAEE;;;AAGF;EACE;;;AAGF;EACE;;;ACvIF;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAEF;AAAA;EAEE;;AAEF;EACE;EACA;;AAEF;EACE;;;AAOJ;EACE;AAAA;IAEE;IACA;IACA;IACA;IACA;IACA;IACA;;;AAGJ;EACE;AAAA;IAEE;IACA;IACA;IACA;IACA;IACA;IACA;;;AAOJ;EACE;;;AAMF;EACE;EACA;EACA;EACA;EACA;EACA;;;AAQE;EACE;;;AAQN;EACE;;;ACvFA;EAA0B;;AAMxB;EAAM;;AACN;EAAuB;;AACvB;EACE;;AAIF;EACE;EACA;;AAEF;EACE;;;ACnBN;EACE;EACA;EACA;EACA;EACA;EACA;;AAEA;EAEE;;AAGF;EACE;;AAIF;EACE;EACA;;;AAIJ;EACE;EACA;EACA;;;AC3BF;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE;EACA;EACA;;AAGF;EACE;;;AAOJ;EAIM;AAAA;IACE;IACA;;;AC1CN;EACE;EACA;EACA;EACA;;AAEF;EACE;AACA;EACA;EACA;;AAEF;EACE;;AAEF;EACE;EACA;;AAEF;EACE;;AAEF;EACE;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;;AAEF;EACE;EACA;EACA;;AAEF;EACE;;AAEF;EACE;EACA;;AAEF;EACE;;AAEF;EACE;;;AASA;EACE;EACA;;;AAKN;EACE;;;AAGF;EACE;;;AClFF;EACE;EACA;EACA;EACA;;;AAEF;EACE;;AAEA;EACE;EACA;EACA;;;AAGJ;EACE;EACA;EACA;;AAEA;EALF;IAMI;;;AAGF;EACE;;AAEA;EAHF;IAII;;;;AAKN;EACE;;AAEA;EACE;;AAGF;EACE;;AAIA;EADF;IAEI;;;;AAIN;EACE;;AAEA;EAHF;IAII;;;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;;AAEA;EARF;IASI;IACA;IACA;;;;ACrEJ;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;;;AAIF;EACE;EACA;EACA;EACA;EACA;;;ACvBF;EACE;EACA;EACA;EACA;;;AAGF;EACE;EAEA;EACA;EACA;;AACA;EACE;;AAGF;AAAA;EAEE;EACA;;;AAIJ;EACE;EACA;EACA;;AAEA;EACE;;;AAKF;EACE;;AAGF;EACE;;;AAIJ;AAAA;EAEE;EACA;;AAEA;AAAA;EACE;;;AAKF;EACE;;;AAMF;AAAA;EACE;;;AC/DJ;EACE;EACA;;;AAGF;EACE;EACA;EACA;;AAGA;EANF;IAOI;;;;AAIJ;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAIJ;AACA;EACE;EACA;EACA;EACA;;;AAME;EADF;IAEI;IACA;IACA;;EAEA;IACE;;;;AChDR;EACE;EACA;EACA;EACA;;AAIA;EACE;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;;AAKF;EACE;EACA;;AAKF;EACE;EACA;EACA;EACA;;AAKF;EACE;EACA;EACA;;AAGA;EACE;EACA;EACA;;AAIF;EACE;EACA;EACA;;AAEA;EACE;;AAKJ;EACE;;AAEF;EACE;;AAMJ;EACE;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;;;AAMJ;EACE;EACA;EACA;;;AC7FF;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEF;EAEE;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;IACE;;EAEF;IAEE;;;;AC9CN;EACE;EACA;EACA;EACA;;AAGA;EACE;EACA;;AAIF;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAEA;EAEE;;AAMN;EACE;EACA;EACA;EACA;EACA;;AAEA;AAAA;EAEE;EACA;EACA;;AAEF;EACE;EACA;EACA;;AAGF;EACE;EACA;;;AAKN;EACE;EACA;;;AC1EE;EACE;;;AAMN;EACE;;;AAIF;EACE;EACA;EACA;;AAEA;AAAA;AAAA;AAAA;AAAA;EAKE;;AAGF;EACE;EACA;;;AAKF;EACE;EACA;EACA;EACA;;
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../../src/AttachMenu/AttachMenu.scss","../../src/Chatbot/Chatbot.scss","../../src/ChatbotAlert/ChatbotAlert.scss","../../src/ChatbotContent/ChatbotContent.scss","../../src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.scss","../../src/ChatbotFooter/ChatbotFootnote.scss","../../src/ChatbotFooter/ChatbotFooter.scss","../../src/ChatbotHeader/ChatbotHeader.scss","../../src/ChatbotModal/ChatbotModal.scss","../../src/ChatbotPopover/ChatbotPopover.scss","../../src/ChatbotToggle/ChatbotToggle.scss","../../src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.scss","../../src/CodeModal/CodeModal.scss","../../src/Compare/Compare.scss","../../src/FileDetails/FileDetails.scss","../../src/FileDetailsLabel/FileDetailsLabel.scss","../../src/FileDropZone/FileDropZone.scss","../../src/Message/Message.scss","../../src/Message/MessageLoading.scss","../../src/Message/CodeBlockMessage/CodeBlockMessage.scss","../../src/Message/TextMessage/TextMessage.scss","../../src/Message/ImageMessage/ImageMessage.scss","../../src/Message/ListMessage/ListMessage.scss","../../src/Message/TableMessage/TableMessage.scss","../../src/Message/QuickStarts/QuickStartTile.scss","../../src/Message/QuickResponse/QuickResponse.scss","../../src/Message/UserFeedback/UserFeedback.scss","../../src/MessageBar/AttachButton.scss","../../src/MessageBar/MicrophoneButton.scss","../../src/MessageBar/SendButton.scss","../../src/MessageBar/StopButton.scss","../../src/MessageBar/MessageBar.scss","../../src/MessageBox/JumpButton.scss","../../src/MessageBox/MessageBox.scss","../../src/ResponseActions/ResponseActions.scss","../../src/Settings/Settings.scss","../../src/SourcesCard/SourcesCard.scss","../../src/SourceDetailsMenuItem/SourceDetailsMenuItem.scss","../../src/TermsOfUse/TermsOfUse.scss","../../src/main.scss"],"names":[],"mappings":"AAAA;EACE;EACA;;;AAGF;AACE;AAsBA;AASA;;AA9BA;EACE;EACA;EACA;EACA;;AAEF;EACE;;AAGF;AACE;;AACA;EACE;EACA;EACA;EACA;EACA;;AAKJ;EACE;;AAGF;EACE;;AAIF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EACE;;AAGF;EACE;;;ACxDJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGA;EACE;;AAKF;EAvBF;IAwBI;IACA;;;AAIF;EA7BF;IA8BI;;;;AAOJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAIA;EAXF;IAYI;;;;AAOJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAMF;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;AAGA;EACE;;AAIF;EAdF;IAeI;;;;AAIJ;EACE;;;AAGF;AAAA;AAAA;EAGE;;;AC1GF;EACE;EACA;EACA;;;ACAF;EACE;EACA;EACA;EACA;EACA;;AAGA;EARF;IASI;;;;AAOJ;EAGI;AAAA;IACE;IACA;;;ACpBJ;EACE;EACA;;AAIF;EACE;EACA;;AAKF;EACE;EACA;EACA;EACA;;AAEF;EACE;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAEF;EACE;;AAGF;EACE;;AAGF;EACE;;;AAMJ;EACE;EACA;EACA;;AAGA;EACE;EACA;EACA;EACA;EACA;EACA;;AAIF;EACE;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;;AAIF;EACE;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAKA;EACE;EACA;EACA;EACA;EACA;EACA;;AAKJ;EACE;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;;AAKA;EACE;;;AASJ;EACE;;;AAQF;EACE;;AACA;EACE;;;AASJ;EACE;;AACA;EACE;EACA;;AAEF;EACE;;;AASF;AAAA;AAAA;EACE;;;AAKN;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;;;ACvMF;EACE;;AAEA;EACE;EACA;;;ACHJ;EACE;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;EACA;EACA;;;AAMF;EAGI;AAAA;IACE;;EACA;AAAA;IACE;;EAGJ;AAAA;IACE;IACA;IACA;;;AASJ;EACE;;;AC5CJ;EACE;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAEA;EACE;;AAKJ;EACE;EACA;EACA;;AAEA;EACE;;AAGF;EACE;EACA;;AAIJ;EACE;;AAGF;EACE;EACA;EACA;EACA;EACA;;AACA;EACE;;;AAQN;EAGI;AAAA;IACE;;EAEF;AAAA;IACE;;;AASJ;EACE;;;AAOJ;AAAA;EAEE;EACA;EACA;EACA;EACA;;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;EAGE;;AAGF;AAAA;AAAA;AAAA;EAEE;EACA;EACA;;AAMA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAGE;;;AAOJ;EACE;;;AAOJ;AAAA;EAEE;;;AAGF;EACE;;;AAGF;EACE;;;ACvIF;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAEF;AAAA;EAEE;;AAEF;EACE;EACA;;AAEF;EACE;;;AAOJ;EACE;AAAA;IAEE;IACA;IACA;IACA;IACA;IACA;IACA;;;AAGJ;EACE;AAAA;IAEE;IACA;IACA;IACA;IACA;IACA;IACA;;;AAOJ;EACE;;;AAMF;EACE;EACA;EACA;EACA;EACA;EACA;;;AAQE;EACE;;;AAQN;EACE;;;ACvFA;EAA0B;;AAMxB;EAAM;;AACN;EAAuB;;AACvB;EACE;;AAIF;EACE;EACA;;AAEF;EACE;;;ACnBN;EACE;EACA;EACA;EACA;EACA;EACA;;AAEA;EAEE;;AAGF;EACE;;AAIF;EACE;EACA;;;AAIJ;EACE;EACA;EACA;;;AC3BF;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE;EACA;EACA;;AAGF;EACE;;;AAOJ;EAIM;AAAA;IACE;IACA;;;AC1CN;EACE;EACA;EACA;EACA;;AAEF;EACE;AACA;EACA;EACA;;AAEF;EACE;;AAEF;EACE;EACA;;AAEF;EACE;;AAEF;EACE;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;;AAEF;EACE;EACA;EACA;;AAEF;EACE;;AAEF;EACE;EACA;;AAEF;EACE;;AAEF;EACE;;;AASA;EACE;EACA;;;AAKN;EACE;;;AAGF;EACE;;;AClFF;EACE;EACA;EACA;EACA;;;AAEF;EACE;;AAEA;EACE;EACA;EACA;;;AAGJ;EACE;EACA;EACA;;AAEA;EALF;IAMI;;;AAGF;EACE;;AAEA;EAHF;IAII;;;;AAKN;EACE;;AAEA;EACE;;AAGF;EACE;;AAIA;EADF;IAEI;;;;AAIN;EACE;;AAEA;EAHF;IAII;;;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;;AAEA;EARF;IASI;IACA;IACA;;;;ACrEJ;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;;;AAIF;EACE;EACA;EACA;EACA;EACA;;;ACvBF;EACE;EACA;EACA;EACA;;;AAGF;EACE;EAEA;EACA;EACA;;AACA;EACE;;AAGF;AAAA;EAEE;EACA;;;AAIJ;EACE;EACA;EACA;;AAEA;EACE;;;AAKF;EACE;;AAGF;EACE;;;AAIJ;AAAA;EAEE;EACA;;AAEA;AAAA;EACE;;;AAKF;EACE;;;AAMF;AAAA;EACE;;;AC/DJ;EACE;EACA;;;AAGF;EACE;EACA;EACA;;AAGA;EANF;IAOI;;;;AAIJ;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAIJ;AACA;EACE;EACA;EACA;EACA;;;AAME;EADF;IAEI;IACA;IACA;;EAEA;IACE;;;;AChDR;EACE;EACA;EACA;EACA;;AAIA;EACE;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;;AAKF;EACE;EACA;;AAKF;EACE;EACA;EACA;EACA;;AAKF;EACE;EACA;EACA;;AAGA;EACE;EACA;EACA;;AAIF;EACE;EACA;EACA;;AAEA;EACE;;AAKJ;EACE;;AAEF;EACE;;AAMJ;EACE;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;;;AAMJ;EACE;EACA;EACA;;;AC7FF;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEF;EAEE;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;IACE;;EAEF;IAEE;;;;AC9CN;EACE;EACA;EACA;EACA;;AAGA;EACE;EACA;;AAIF;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAEA;EAEE;;AAMN;EACE;EACA;EACA;EACA;EACA;;AAEA;AAAA;EAEE;EACA;EACA;;AAEF;EACE;EACA;EACA;;AAGF;EACE;EACA;;;AAKN;EACE;EACA;;;AC1EE;EACE;;;AAMN;EACE;;;AAIF;EACE;EACA;EACA;;AAEA;EACE;;AAGF;AAAA;AAAA;AAAA;AAAA;EAKE;;AAGF;EACE;EACA;;;AAKF;EACE;EACA;EACA;EACA;;AACA;EACE;;AAGF;AAAA;AAAA;AAAA;AAAA;EAKE;;;ADrDN;EACE;EACA;EACA;EACA;;AAGA;EACE;EACA;;AAIF;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAEA;EAEE;;AAMN;EACE;EACA;EACA;EACA;EACA;;AAEA;AAAA;EAEE;EACA;EACA;;AAEF;EACE;EACA;EACA;;AAGF;EACE;EACA;;;AAKN;EACE;EACA;;;AEhFF;EACE;EACA;EACA;EACA;EAGA;;;ADDE;EACE;;;AAMN;EACE;;;AAIF;EACE;EACA;EACA;;AAEA;EACE;;AAGF;AAAA;AAAA;AAAA;AAAA;EAKE;;AAGF;EACE;EACA;;;AAKF;EACE;EACA;EACA;EACA;;AACA;EACE;;AAGF;AAAA;AAAA;AAAA;AAAA;EAKE;;;AEpDN;AAAA;EAEE;EACA;EACA;;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;EAGE;;;AAKF;AAAA;EAEE;EACA;EACA;;;ACtBJ;EACE;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;;AAGF;EACE;EACA;;AAGF;EACE;;;ALjBJ;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEF;EAEE;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;IACE;;EAEF;IAEE;;;;AMjDN;EACE;EACA;;AAEA;EAJF;IAKI;IACA;;;AAKA;EACE;;;AAOF;EACE;;;ACnBJ;EACE;;AAEA;EAHF;IAII;;;AAGF;EAPF;IAQI;;;AAKF;EACE;EACA;;AAIJ;AAAA;EAEE;EACA;;AAIF;EACE;EACA;EACA;;;AC7BJ;EACE;EACA;EACA;;;AAIF;EACE;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;EACA;EACA;;;AAIF;EACE;EACA;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;;;AChDF;EACE;EACA;EACA;EACA;;AAEA;EACE;;AAKA;EACE;;AAIJ;EAEE;;AAEA;EACE;;AAKA;EACE;;;AC5BR;EACE;EACA;EACA;EACA;;AAEA;EACE;;AAMA;EACE;;AAKJ;EACE;EACA;;AAGA;EACE;;AAKA;EACE;;;AAMR;EACE;IACE;;EAEF;IACE;;;AC1CJ;EACE;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EAEE;EACA;;AAEA;EACE;;;AAMJ;EACE;;AACA;EACE;;AAIJ;EACE;EACA;;AAGF;AAAA;EAEE;;;AAIJ;EACE;IACE;IACA;;EAEF;IACE;IACA;;;AC/CJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;;AAGF;EACE;;AAEA;EACE;;AAKA;EACE;;;ACrBR;EACE;EACA;EAEA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EAGA;;AAEA;EACE;;AAGF;EACE;;AAGF;EACE;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAEF;EACE;EACA;EACA;EACA;;AAEF;EACE;;;AAIJ;EACE;IACE;IACA;;;AAKF;EACE;IACE;IACA;;;;ACxFN;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YACE;EAIF;;AAEA;EACE;;AAGF;EAEE;EACA;EACA;;AAGF;EACE;;AAGF;EACE;;AAIF;EA3CF;IA4CI;;;;AC9CJ;EACE;EACA;EACA;EACA;EACA;EACA;;AAIA;EAVF;IAWI;;;AAGF;EAdF;IAeI;;;;AAIJ;EACE;;;AAKF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EAGI;AAAA;IACE;IACA;;;ADtCN;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YACE;EAIF;;AAEA;EACE;;AAGF;EAEE;EACA;EACA;;AAGF;EACE;;AAGF;EACE;;AAIF;EA3CF;IA4CI;;;;AEhDJ;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAEF;EACE;EACA;;;AAKN;EACE;EACA;;;AC1BF;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;EACA;;;AChCF;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;EACA;;AAEA;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAIA;AAAA;EACE;;AAGJ;EACE;EACA;;AAKA;AAAA;EACE;;AAGJ;EACE;;;ACrER;EACE;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;;;AAIF;EACE;EACA;;;AAGA;EACE;;;AAIJ;EACE;;;AAGF;EACE;;;AC9BA;EACE;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAEF;EACE;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EACE;;AAGF;EACE;EACA;EACA;EACA;;AAIF;EACE;IACE;IACA;;;;AAKN;AAAA;EAGE;;AAGE;AAAA;EACE;;AAIJ;AAAA;EACE;;;AC5BJ;EAKE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EASA;EACA;EAEA;EAEA;AAAA;AAAA;AAAA;AAAA;AAAA;EAMA;EAKA;EACA;EACA;EAEA;EAEA;;;AAMF;EACE;EACA;EAEA;EAEA;EACA;;;AAGF;EACE;EACA","file":"main.css"}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
// ============================================================================
|
2
|
+
// Chatbot Main - Message - Content - Link
|
3
|
+
// ============================================================================
|
4
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
5
|
+
var t = {};
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
7
|
+
t[p] = s[p];
|
8
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
9
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
10
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
11
|
+
t[p[i]] = s[p[i]];
|
12
|
+
}
|
13
|
+
return t;
|
14
|
+
};
|
15
|
+
import React from 'react';
|
16
|
+
import { Button } from '@patternfly/react-core';
|
17
|
+
import { ExternalLinkSquareAltIcon } from '@patternfly/react-icons';
|
18
|
+
const LinkMessage = (_a) => {
|
19
|
+
var { children, target, href } = _a, props = __rest(_a, ["children", "target", "href"]);
|
20
|
+
if (target === '_blank') {
|
21
|
+
return (React.createElement(Button, Object.assign({ component: "a", variant: "link", href: href, icon: React.createElement(ExternalLinkSquareAltIcon, null), iconPosition: "end", isInline: true, target: target }, props), children));
|
22
|
+
}
|
23
|
+
return (React.createElement(Button, Object.assign({ isInline: true, component: "a", href: href, variant: "link" }, props), children));
|
24
|
+
};
|
25
|
+
export default LinkMessage;
|
@@ -100,6 +100,8 @@ export interface MessageProps extends Omit<React.HTMLProps<HTMLDivElement>, 'rol
|
|
100
100
|
tableProps?: Required<Pick<TableProps, 'aria-label'>> & TableProps;
|
101
101
|
/** Additional rehype plugins passed from the consumer */
|
102
102
|
additionalRehypePlugins?: PluggableList;
|
103
|
+
/** Whether to open links in message in new tab. */
|
104
|
+
openLinkInNewTab?: boolean;
|
103
105
|
}
|
104
106
|
export declare const MessageBase: React.FunctionComponent<MessageProps>;
|
105
107
|
declare const Message: React.ForwardRefExoticComponent<Omit<MessageProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
@@ -37,9 +37,19 @@ import TheadMessage from './TableMessage/TheadMessage';
|
|
37
37
|
import ThMessage from './TableMessage/ThMessage';
|
38
38
|
import ImageMessage from './ImageMessage/ImageMessage';
|
39
39
|
import rehypeUnwrapImages from 'rehype-unwrap-images';
|
40
|
+
import rehypeExternalLinks from 'rehype-external-links';
|
41
|
+
import rehypeSanitize from 'rehype-sanitize';
|
42
|
+
import LinkMessage from './LinkMessage/LinkMessage';
|
40
43
|
export const MessageBase = (_a) => {
|
41
|
-
var { role, content, extraContent, name, avatar, timestamp, isLoading, actions, sources, botWord = 'AI', loadingWord = 'Loading message', codeBlockProps, quickResponses, quickResponseContainerProps = { numLabels: 5 }, attachments, hasRoundAvatar = true, avatarProps, quickStarts, userFeedbackForm, userFeedbackComplete, isLiveRegion = true, innerRef, tableProps, additionalRehypePlugins = [] } = _a, props = __rest(_a, ["role", "content", "extraContent", "name", "avatar", "timestamp", "isLoading", "actions", "sources", "botWord", "loadingWord", "codeBlockProps", "quickResponses", "quickResponseContainerProps", "attachments", "hasRoundAvatar", "avatarProps", "quickStarts", "userFeedbackForm", "userFeedbackComplete", "isLiveRegion", "innerRef", "tableProps", "additionalRehypePlugins"]);
|
44
|
+
var { role, content, extraContent, name, avatar, timestamp, isLoading, actions, sources, botWord = 'AI', loadingWord = 'Loading message', codeBlockProps, quickResponses, quickResponseContainerProps = { numLabels: 5 }, attachments, hasRoundAvatar = true, avatarProps, quickStarts, userFeedbackForm, userFeedbackComplete, isLiveRegion = true, innerRef, tableProps, openLinkInNewTab = true, additionalRehypePlugins = [] } = _a, props = __rest(_a, ["role", "content", "extraContent", "name", "avatar", "timestamp", "isLoading", "actions", "sources", "botWord", "loadingWord", "codeBlockProps", "quickResponses", "quickResponseContainerProps", "attachments", "hasRoundAvatar", "avatarProps", "quickStarts", "userFeedbackForm", "userFeedbackComplete", "isLiveRegion", "innerRef", "tableProps", "openLinkInNewTab", "additionalRehypePlugins"]);
|
42
45
|
const { beforeMainContent, afterMainContent, endContent } = extraContent || {};
|
46
|
+
let rehypePlugins = [rehypeUnwrapImages];
|
47
|
+
if (openLinkInNewTab) {
|
48
|
+
rehypePlugins = rehypePlugins.concat([[rehypeExternalLinks, { target: '_blank' }, rehypeSanitize]]);
|
49
|
+
}
|
50
|
+
if (additionalRehypePlugins) {
|
51
|
+
rehypePlugins.push(...additionalRehypePlugins);
|
52
|
+
}
|
43
53
|
let avatarClassName;
|
44
54
|
if (avatarProps && 'className' in avatarProps) {
|
45
55
|
const { className } = avatarProps, rest = __rest(avatarProps, ["className"]);
|
@@ -49,7 +59,6 @@ export const MessageBase = (_a) => {
|
|
49
59
|
// Keep timestamps consistent between Timestamp component and aria-label
|
50
60
|
const date = new Date();
|
51
61
|
const dateString = timestamp !== null && timestamp !== void 0 ? timestamp : `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
|
52
|
-
const rehypePlugins = [rehypeUnwrapImages, ...(additionalRehypePlugins !== null && additionalRehypePlugins !== void 0 ? additionalRehypePlugins : [])];
|
53
62
|
return (React.createElement("section", Object.assign({ "aria-label": `Message from ${role} - ${dateString}`, className: `pf-chatbot__message pf-chatbot__message--${role}`, "aria-live": isLiveRegion ? 'polite' : undefined, "aria-atomic": isLiveRegion ? false : undefined, ref: innerRef }, props),
|
54
63
|
React.createElement(Avatar, Object.assign({ className: `pf-chatbot__message-avatar ${hasRoundAvatar ? 'pf-chatbot__message-avatar--round' : ''} ${avatarClassName ? avatarClassName : ''}`, src: avatar, alt: "" }, avatarProps)),
|
55
64
|
React.createElement("div", { className: "pf-chatbot__message-contents" },
|
@@ -89,7 +98,8 @@ export const MessageBase = (_a) => {
|
|
89
98
|
return React.createElement(TdMessage, Object.assign({}, rest));
|
90
99
|
},
|
91
100
|
th: (props) => React.createElement(ThMessage, Object.assign({}, props)),
|
92
|
-
img: (props) => React.createElement(ImageMessage, Object.assign({}, props))
|
101
|
+
img: (props) => React.createElement(ImageMessage, Object.assign({}, props)),
|
102
|
+
a: (props) => (React.createElement(LinkMessage, { href: props.href, rel: props.rel, target: props.target }, props.children))
|
93
103
|
}, remarkPlugins: [remarkGfm], rehypePlugins: rehypePlugins }, content),
|
94
104
|
afterMainContent && React.createElement(React.Fragment, null, afterMainContent))),
|
95
105
|
!isLoading && sources && React.createElement(SourcesCard, Object.assign({}, sources)),
|
@@ -14,6 +14,7 @@ import Message from './Message';
|
|
14
14
|
import userEvent from '@testing-library/user-event';
|
15
15
|
import { monitorSampleAppQuickStart } from './QuickStarts/monitor-sampleapp-quickstart';
|
16
16
|
import { monitorSampleAppQuickStartWithImage } from './QuickStarts/monitor-sampleapp-quickstart-with-image';
|
17
|
+
import rehypeExternalLinks from '../__mocks__/rehype-external-links';
|
17
18
|
const ALL_ACTIONS = [
|
18
19
|
{ label: /Good response/i },
|
19
20
|
{ label: /Bad response/i },
|
@@ -142,6 +143,9 @@ const checkListItemsRendered = () => {
|
|
142
143
|
});
|
143
144
|
};
|
144
145
|
describe('Message', () => {
|
146
|
+
beforeEach(() => {
|
147
|
+
jest.clearAllMocks();
|
148
|
+
});
|
145
149
|
it('should render user messages correctly', () => {
|
146
150
|
render(React.createElement(Message, { avatar: "./img", role: "user", name: "User", content: "Hi" }));
|
147
151
|
expect(screen.getByText('User')).toBeTruthy();
|
@@ -575,4 +579,14 @@ describe('Message', () => {
|
|
575
579
|
render(React.createElement(Message, { avatar: "./img", role: "user", name: "User", content: IMAGE }));
|
576
580
|
expect(screen.getByRole('img', { name: /Multi-colored wavy lines on a black background/i })).toBeTruthy();
|
577
581
|
});
|
582
|
+
it('should handle external links correctly', () => {
|
583
|
+
render(React.createElement(Message, { avatar: "./img", role: "user", name: "User", content: `[PatternFly](https://www.patternfly.org/)` }));
|
584
|
+
// we are mocking rehype libraries, so we can't test target _blank addition on links directly with RTL
|
585
|
+
expect(rehypeExternalLinks).toHaveBeenCalledTimes(1);
|
586
|
+
});
|
587
|
+
it('should handle external links correctly', () => {
|
588
|
+
render(React.createElement(Message, { avatar: "./img", role: "user", name: "User", content: `[PatternFly](https://www.patternfly.org/)`, openLinkInNewTab: false }));
|
589
|
+
// we are mocking rehype libraries, so we can't test target _blank addition on links directly with RTL
|
590
|
+
expect(rehypeExternalLinks).not.toHaveBeenCalled();
|
591
|
+
});
|
578
592
|
});
|
@@ -1,2 +1,2 @@
|
|
1
|
-
declare const
|
2
|
-
export default
|
1
|
+
declare const rehypeUnwrapImages: jest.Mock<null, [], any>;
|
2
|
+
export default rehypeUnwrapImages;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
const
|
2
|
-
export default
|
1
|
+
const rehypeUnwrapImages = jest.fn(() => null);
|
2
|
+
export default rehypeUnwrapImages;
|
@@ -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/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-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/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"}
|
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.30",
|
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",
|
@@ -40,6 +40,8 @@
|
|
40
40
|
"react-syntax-highlighter": "^15.5.0",
|
41
41
|
"remark-gfm": "^4.0.0",
|
42
42
|
"rehype-unwrap-images": "^1.0.0",
|
43
|
+
"rehype-external-links": "^3.0.0",
|
44
|
+
"rehype-sanitize": "^6.0.0",
|
43
45
|
"path-browserify": "^1.0.1"
|
44
46
|
},
|
45
47
|
"peerDependencies": {
|
package/src/Chatbot/Chatbot.scss
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
background-color: var(--pf-t--chatbot--background);
|
13
13
|
border-radius: var(--pf-t--global--border--radius--medium);
|
14
14
|
box-shadow: var(--pf-t--global--box-shadow--lg);
|
15
|
-
font-size: var(--pf-t--
|
15
|
+
font-size: var(--pf-t--global--font--size--md);
|
16
16
|
z-index: var(--pf-t--global--z-index--md);
|
17
17
|
-webkit-font-smoothing: antialiased;
|
18
18
|
-moz-osx-font-smoothing: grayscale;
|
@@ -0,0 +1,34 @@
|
|
1
|
+
// ============================================================================
|
2
|
+
// Chatbot Main - Message - Content - Link
|
3
|
+
// ============================================================================
|
4
|
+
|
5
|
+
import React from 'react';
|
6
|
+
import { Button, ButtonProps } from '@patternfly/react-core';
|
7
|
+
import { ExternalLinkSquareAltIcon } from '@patternfly/react-icons';
|
8
|
+
|
9
|
+
const LinkMessage = ({ children, target, href, ...props }: ButtonProps) => {
|
10
|
+
if (target === '_blank') {
|
11
|
+
return (
|
12
|
+
<Button
|
13
|
+
component="a"
|
14
|
+
variant="link"
|
15
|
+
href={href}
|
16
|
+
icon={<ExternalLinkSquareAltIcon />}
|
17
|
+
iconPosition="end"
|
18
|
+
isInline
|
19
|
+
target={target}
|
20
|
+
{...props}
|
21
|
+
>
|
22
|
+
{children}
|
23
|
+
</Button>
|
24
|
+
);
|
25
|
+
}
|
26
|
+
|
27
|
+
return (
|
28
|
+
<Button isInline component="a" href={href} variant="link" {...props}>
|
29
|
+
{children}
|
30
|
+
</Button>
|
31
|
+
);
|
32
|
+
};
|
33
|
+
|
34
|
+
export default LinkMessage;
|
@@ -5,6 +5,7 @@ import Message from './Message';
|
|
5
5
|
import userEvent from '@testing-library/user-event';
|
6
6
|
import { monitorSampleAppQuickStart } from './QuickStarts/monitor-sampleapp-quickstart';
|
7
7
|
import { monitorSampleAppQuickStartWithImage } from './QuickStarts/monitor-sampleapp-quickstart-with-image';
|
8
|
+
import rehypeExternalLinks from '../__mocks__/rehype-external-links';
|
8
9
|
|
9
10
|
const ALL_ACTIONS = [
|
10
11
|
{ label: /Good response/i },
|
@@ -150,6 +151,9 @@ const checkListItemsRendered = () => {
|
|
150
151
|
};
|
151
152
|
|
152
153
|
describe('Message', () => {
|
154
|
+
beforeEach(() => {
|
155
|
+
jest.clearAllMocks();
|
156
|
+
});
|
153
157
|
it('should render user messages correctly', () => {
|
154
158
|
render(<Message avatar="./img" role="user" name="User" content="Hi" />);
|
155
159
|
expect(screen.getByText('User')).toBeTruthy();
|
@@ -747,4 +751,22 @@ describe('Message', () => {
|
|
747
751
|
render(<Message avatar="./img" role="user" name="User" content={IMAGE} />);
|
748
752
|
expect(screen.getByRole('img', { name: /Multi-colored wavy lines on a black background/i })).toBeTruthy();
|
749
753
|
});
|
754
|
+
it('should handle external links correctly', () => {
|
755
|
+
render(<Message avatar="./img" role="user" name="User" content={`[PatternFly](https://www.patternfly.org/)`} />);
|
756
|
+
// we are mocking rehype libraries, so we can't test target _blank addition on links directly with RTL
|
757
|
+
expect(rehypeExternalLinks).toHaveBeenCalledTimes(1);
|
758
|
+
});
|
759
|
+
it('should handle external links correctly', () => {
|
760
|
+
render(
|
761
|
+
<Message
|
762
|
+
avatar="./img"
|
763
|
+
role="user"
|
764
|
+
name="User"
|
765
|
+
content={`[PatternFly](https://www.patternfly.org/)`}
|
766
|
+
openLinkInNewTab={false}
|
767
|
+
/>
|
768
|
+
);
|
769
|
+
// we are mocking rehype libraries, so we can't test target _blank addition on links directly with RTL
|
770
|
+
expect(rehypeExternalLinks).not.toHaveBeenCalled();
|
771
|
+
});
|
750
772
|
});
|
package/src/Message/Message.tsx
CHANGED
@@ -38,7 +38,10 @@ import ThMessage from './TableMessage/ThMessage';
|
|
38
38
|
import { TableProps } from '@patternfly/react-table';
|
39
39
|
import ImageMessage from './ImageMessage/ImageMessage';
|
40
40
|
import rehypeUnwrapImages from 'rehype-unwrap-images';
|
41
|
+
import rehypeExternalLinks from 'rehype-external-links';
|
42
|
+
import rehypeSanitize from 'rehype-sanitize';
|
41
43
|
import { PluggableList } from 'react-markdown/lib';
|
44
|
+
import LinkMessage from './LinkMessage/LinkMessage';
|
42
45
|
|
43
46
|
export interface MessageAttachment {
|
44
47
|
/** Name of file attached to the message */
|
@@ -136,6 +139,8 @@ export interface MessageProps extends Omit<React.HTMLProps<HTMLDivElement>, 'rol
|
|
136
139
|
tableProps?: Required<Pick<TableProps, 'aria-label'>> & TableProps;
|
137
140
|
/** Additional rehype plugins passed from the consumer */
|
138
141
|
additionalRehypePlugins?: PluggableList;
|
142
|
+
/** Whether to open links in message in new tab. */
|
143
|
+
openLinkInNewTab?: boolean;
|
139
144
|
}
|
140
145
|
|
141
146
|
export const MessageBase: React.FunctionComponent<MessageProps> = ({
|
@@ -162,10 +167,18 @@ export const MessageBase: React.FunctionComponent<MessageProps> = ({
|
|
162
167
|
isLiveRegion = true,
|
163
168
|
innerRef,
|
164
169
|
tableProps,
|
170
|
+
openLinkInNewTab = true,
|
165
171
|
additionalRehypePlugins = [],
|
166
172
|
...props
|
167
173
|
}: MessageProps) => {
|
168
174
|
const { beforeMainContent, afterMainContent, endContent } = extraContent || {};
|
175
|
+
let rehypePlugins: PluggableList = [rehypeUnwrapImages];
|
176
|
+
if (openLinkInNewTab) {
|
177
|
+
rehypePlugins = rehypePlugins.concat([[rehypeExternalLinks, { target: '_blank' }, rehypeSanitize]]);
|
178
|
+
}
|
179
|
+
if (additionalRehypePlugins) {
|
180
|
+
rehypePlugins.push(...additionalRehypePlugins);
|
181
|
+
}
|
169
182
|
let avatarClassName;
|
170
183
|
if (avatarProps && 'className' in avatarProps) {
|
171
184
|
const { className, ...rest } = avatarProps;
|
@@ -175,9 +188,6 @@ export const MessageBase: React.FunctionComponent<MessageProps> = ({
|
|
175
188
|
// Keep timestamps consistent between Timestamp component and aria-label
|
176
189
|
const date = new Date();
|
177
190
|
const dateString = timestamp ?? `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
|
178
|
-
|
179
|
-
const rehypePlugins = [rehypeUnwrapImages, ...(additionalRehypePlugins ?? [])];
|
180
|
-
|
181
191
|
return (
|
182
192
|
<section
|
183
193
|
aria-label={`Message from ${role} - ${dateString}`}
|
@@ -244,7 +254,12 @@ export const MessageBase: React.FunctionComponent<MessageProps> = ({
|
|
244
254
|
return <TdMessage {...rest} />;
|
245
255
|
},
|
246
256
|
th: (props) => <ThMessage {...props} />,
|
247
|
-
img: (props) => <ImageMessage {...props}
|
257
|
+
img: (props) => <ImageMessage {...props} />,
|
258
|
+
a: (props) => (
|
259
|
+
<LinkMessage href={props.href} rel={props.rel} target={props.target}>
|
260
|
+
{props.children}
|
261
|
+
</LinkMessage>
|
262
|
+
)
|
248
263
|
}}
|
249
264
|
remarkPlugins={[remarkGfm]}
|
250
265
|
rehypePlugins={rehypePlugins}
|
@@ -21,12 +21,16 @@
|
|
21
21
|
padding: var(--pf-t--global--spacer--sm) 0 var(--pf-t--global--spacer--sm) 0;
|
22
22
|
border-radius: var(--pf-t--global--border--radius--small);
|
23
23
|
|
24
|
+
.pf-v6-c-button.pf-m-link {
|
25
|
+
font-size: var(--pf-t--global--font--size--md);
|
26
|
+
}
|
27
|
+
|
24
28
|
.pf-v6-c-content,
|
25
29
|
.pf-v6-c-content--small,
|
26
30
|
.pf-v6-c-content--blockquote,
|
27
31
|
p,
|
28
32
|
a {
|
29
|
-
--pf-v6-c-content--FontSize: var(--pf-t--
|
33
|
+
--pf-v6-c-content--FontSize: var(--pf-t--global--font--size--md);
|
30
34
|
}
|
31
35
|
|
32
36
|
code {
|
@@ -41,6 +45,9 @@
|
|
41
45
|
color: var(--pf-t--global--text--color--on-brand--default);
|
42
46
|
--pf-v6-c-content--Color: var(--pf-t--global--text--color--on-brand--default);
|
43
47
|
padding: var(--pf-t--global--spacer--sm);
|
48
|
+
.pf-v6-c-button__icon {
|
49
|
+
--pf-v6-c-button__icon--Color: var(--pf-t--global--text--color--on-brand--default);
|
50
|
+
}
|
44
51
|
|
45
52
|
.pf-v6-c-content,
|
46
53
|
.pf-v6-c-content--small,
|
@@ -1,3 +1,3 @@
|
|
1
|
-
const
|
1
|
+
const rehypeUnwrapImages = jest.fn(() => null);
|
2
2
|
|
3
|
-
export default
|
3
|
+
export default rehypeUnwrapImages;
|
package/src/main.scss
CHANGED
@@ -64,8 +64,6 @@
|
|
64
64
|
// Chatbot Default tokens using PF semantic tokens
|
65
65
|
// ============================================================================
|
66
66
|
--pf-t--chatbot-toggle--color: var(--pf-t--global--icon--color--inverse);
|
67
|
-
|
68
|
-
--pf-t--chatbot--font-size: var(--pf-t--global--font--size--md);
|
69
67
|
--pf-t--chatbot--background: var(--pf-t--global--background--color--secondary--default);
|
70
68
|
--pf-t--chatbot--border: var(--pf-t--global--border--color--default);
|
71
69
|
|