@redocly/theme 0.59.0-next.1 → 0.59.0-next.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +7 -1
- package/lib/components/Accordion/Accordion.js +17 -7
- package/lib/components/Accordion/AccordionBody.js +17 -7
- package/lib/components/Admonition/Admonition.js +17 -7
- package/lib/components/Badge/Badge.js +17 -7
- package/lib/components/Breadcrumbs/Breadcrumb.js +17 -7
- package/lib/components/Breadcrumbs/BreadcrumbDropdown.js +17 -7
- package/lib/components/Button/Button.js +17 -7
- package/lib/components/Buttons/AIAssistantButton.js +23 -9
- package/lib/components/Buttons/CopyButton.js +17 -7
- package/lib/components/Buttons/variables.js +1 -1
- package/lib/components/Catalog/Catalog.d.ts +6 -0
- package/lib/components/Catalog/Catalog.js +7 -6
- package/lib/components/Catalog/CatalogEntities.js +17 -7
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.js +17 -7
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy.js +17 -7
- package/lib/components/Catalog/CatalogEntity/CatalogEntityInfoBar.js +1 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +17 -7
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +17 -7
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +17 -7
- package/lib/components/Catalog/CatalogEntityIcon.js +2 -1
- package/lib/components/Catalog/CatalogFilter/CatalogFilter.js +4 -0
- package/lib/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.js +17 -7
- package/lib/components/Catalog/CatalogFilter/CatalogFilterContent.js +17 -7
- package/lib/components/Catalog/CatalogFilter/CatalogFilterDateRange.js +17 -7
- package/lib/components/Catalog/CatalogFilter/CatalogFilterSelect.js +17 -7
- package/lib/components/Catalog/CatalogSortButton.js +17 -7
- package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.js +17 -7
- package/lib/components/Catalog/CatalogViewModeToggle.js +17 -7
- package/lib/components/Catalog/variables.js +1 -1
- package/lib/components/CatalogClassic/CatalogClassicActions.js +17 -7
- package/lib/components/CatalogClassic/CatalogClassicCard.js +17 -7
- package/lib/components/CatalogClassic/CatalogClassicHighlight.js +17 -7
- package/lib/components/CatalogClassic/CatalogClassicVirtualizedGroups.js +17 -7
- package/lib/components/CodeBlock/CodeBlock.js +17 -7
- package/lib/components/CodeBlock/CodeBlockContainer.js +17 -7
- package/lib/components/CodeBlock/CodeBlockTabs.js +17 -7
- package/lib/components/Dropdown/Dropdown.d.ts +16 -2
- package/lib/components/Dropdown/Dropdown.js +22 -12
- package/lib/components/Dropdown/DropdownMenuItem.js +17 -7
- package/lib/components/Feedback/Comment.js +17 -7
- package/lib/components/Feedback/Feedback.js +17 -7
- package/lib/components/Feedback/Mood.js +17 -7
- package/lib/components/Feedback/Rating.js +17 -7
- package/lib/components/Feedback/Reasons.js +17 -7
- package/lib/components/Feedback/Scale.js +17 -7
- package/lib/components/Feedback/Sentiment.js +17 -7
- package/lib/components/Feedback/Stars.js +17 -7
- package/lib/components/Filter/FilterContent.js +17 -7
- package/lib/components/Filter/FilterInput.js +17 -7
- package/lib/components/Image/Image.js +17 -7
- package/lib/components/JsonViewer/JsonViewer.js +17 -7
- package/lib/components/JsonViewer/helpers.js +17 -7
- package/lib/components/LastUpdated/LastUpdated.js +17 -7
- package/lib/components/Link/Link.js +17 -7
- package/lib/components/Markdown/Markdown.js +17 -7
- package/lib/components/Marker/Marker.js +17 -7
- package/lib/components/Menu/MenuContainer.js +17 -7
- package/lib/components/Menu/MenuItem.js +18 -8
- package/lib/components/Menu/MenuMobile.js +17 -7
- package/lib/components/Navbar/NavbarItem.js +3 -3
- package/lib/components/PageActions/PageActions.js +17 -7
- package/lib/components/PageNavigation/NextButton.js +17 -7
- package/lib/components/Panel/Panel.js +17 -7
- package/lib/components/Panel/PanelBody.js +17 -7
- package/lib/components/Search/FilterFields/SearchFilterFieldSelect.js +17 -7
- package/lib/components/Search/FilterFields/SearchFilterFieldTags.js +1 -2
- package/lib/components/Search/SearchAiActionButtons.d.ts +10 -0
- package/lib/components/Search/SearchAiActionButtons.js +43 -0
- package/lib/components/Search/SearchAiConversationInput.d.ts +3 -1
- package/lib/components/Search/SearchAiConversationInput.js +56 -14
- package/lib/components/Search/SearchAiDialog.d.ts +3 -6
- package/lib/components/Search/SearchAiDialog.js +37 -16
- package/lib/components/Search/SearchAiMessage.d.ts +9 -5
- package/lib/components/Search/SearchAiMessage.js +146 -22
- package/lib/components/Search/SearchAiNegativeFeedbackForm.d.ts +8 -0
- package/lib/components/Search/SearchAiNegativeFeedbackForm.js +169 -0
- package/lib/components/Search/SearchDialog.js +53 -12
- package/lib/components/Search/SearchFilter.js +17 -7
- package/lib/components/Search/SearchGroups.js +19 -9
- package/lib/components/Search/SearchHighlight.js +17 -7
- package/lib/components/Search/SearchItem.js +17 -7
- package/lib/components/Search/SearchRecent.js +17 -7
- package/lib/components/Search/SearchShortcut.js +17 -7
- package/lib/components/Search/SearchSuggestedPages.js +17 -7
- package/lib/components/Search/SearchTrigger.js +17 -7
- package/lib/components/Search/variables.js +36 -64
- package/lib/components/Segmented/Segmented.js +17 -7
- package/lib/components/Select/Select.js +17 -7
- package/lib/components/Select/SelectInput.js +18 -8
- package/lib/components/Sidebar/Sidebar.js +17 -7
- package/lib/components/SidebarActions/styled.js +17 -7
- package/lib/components/SkipContent/SkipContent.js +17 -7
- package/lib/components/Switch/Switch.js +17 -7
- package/lib/components/TableOfContent/TableOfContent.js +17 -7
- package/lib/components/Tag/Tag.d.ts +2 -1
- package/lib/components/Tag/Tag.js +67 -18
- package/lib/components/Tag/variables.dark.js +135 -36
- package/lib/components/Tag/variables.js +78 -61
- package/lib/components/Tooltip/Tooltip.js +17 -7
- package/lib/components/VersionPicker/VersionPicker.js +17 -7
- package/lib/core/constants/search.d.ts +5 -4
- package/lib/core/constants/search.js +4 -5
- package/lib/core/contexts/CodeSnippetContext.js +17 -7
- package/lib/core/hooks/index.d.ts +1 -0
- package/lib/core/hooks/index.js +1 -0
- package/lib/core/hooks/menu/use-nested-menu.js +1 -1
- package/lib/core/hooks/search/use-feedback-tooltip.d.ts +6 -0
- package/lib/core/hooks/search/use-feedback-tooltip.js +26 -0
- package/lib/core/hooks/use-product-picker.js +2 -1
- package/lib/core/hooks/use-tabs.d.ts +3 -2
- package/lib/core/hooks/use-tabs.js +115 -57
- package/lib/core/hooks/use-telemetry-fallback.d.ts +10 -8
- package/lib/core/hooks/use-telemetry-fallback.js +10 -8
- package/lib/core/styles/dark.js +4 -0
- package/lib/core/styles/global.js +4 -0
- package/lib/core/templates/Markdown.js +17 -7
- package/lib/core/types/hooks.d.ts +6 -3
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/search.d.ts +11 -4
- package/lib/core/types/search.js +6 -0
- package/lib/core/utils/download-code-walkthrough.js +17 -7
- package/lib/core/utils/frontmatter-translate.d.ts +6 -0
- package/lib/core/utils/frontmatter-translate.js +14 -0
- package/lib/core/utils/get-file-icon.js +17 -7
- package/lib/core/utils/index.d.ts +1 -0
- package/lib/core/utils/index.js +1 -0
- package/lib/icons/AiStarsGradientIcon/AiStarsGradientIcon.js +44 -4
- package/lib/icons/AiStarsIcon/AiStarsIcon.js +11 -2
- package/lib/icons/CubeIcon/CubeIcon.d.ts +9 -0
- package/lib/icons/CubeIcon/CubeIcon.js +17 -0
- package/lib/icons/GenericIcon/GenericIcon.js +17 -7
- package/lib/icons/HashtagIcon/HashtagIcon.d.ts +9 -0
- package/lib/icons/HashtagIcon/HashtagIcon.js +22 -0
- package/lib/icons/RedoclyIcon/RedoclyIcon.js +4 -7
- package/lib/icons/Spinner/Spinner.js +17 -7
- package/lib/icons/ThumbDownFilledIcon/ThumbDownFilledIcon.d.ts +9 -0
- package/lib/icons/ThumbDownFilledIcon/ThumbDownFilledIcon.js +34 -0
- package/lib/icons/ThumbUpFilledIcon/ThumbUpFilledIcon.d.ts +9 -0
- package/lib/icons/ThumbUpFilledIcon/ThumbUpFilledIcon.js +34 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +18 -7
- package/lib/layouts/OIDCForbidden.js +17 -7
- package/lib/layouts/ThreePanelLayout.js +17 -7
- package/lib/markdoc/components/Cards/Card.js +1 -28
- package/lib/markdoc/components/Cards/Cards.js +17 -7
- package/lib/markdoc/components/CodeGroup/CodeGroup.js +17 -7
- package/lib/markdoc/components/CodeWalkthrough/CodeContainer.js +17 -7
- package/lib/markdoc/components/CodeWalkthrough/CodePanel.js +17 -7
- package/lib/markdoc/components/CodeWalkthrough/CodePanelHeader.js +17 -7
- package/lib/markdoc/components/CodeWalkthrough/CodePanelPreview.js +17 -7
- package/lib/markdoc/components/CodeWalkthrough/CodePanelToolbar.js +17 -7
- package/lib/markdoc/components/CodeWalkthrough/CodeStep.js +17 -7
- package/lib/markdoc/components/CodeWalkthrough/CodeToggle.js +17 -7
- package/lib/markdoc/components/CodeWalkthrough/CodeWalkthrough.js +17 -7
- package/lib/markdoc/components/CodeWalkthrough/Input.js +17 -7
- package/lib/markdoc/components/Heading/Heading.js +17 -7
- package/lib/markdoc/components/HtmlBlock/HtmlBlock.js +17 -7
- package/lib/markdoc/components/InlineSvg/InlineSvg.js +17 -7
- package/lib/markdoc/components/MarkdocExample/MarkdocExample.js +17 -7
- package/lib/markdoc/components/Tabs/TabList.d.ts +3 -1
- package/lib/markdoc/components/Tabs/TabList.js +214 -54
- package/lib/markdoc/components/Tabs/Tabs.d.ts +2 -1
- package/lib/markdoc/components/Tabs/Tabs.js +74 -19
- package/lib/markdoc/default.d.ts +104 -1
- package/lib/markdoc/default.js +17 -7
- package/lib/markdoc/tags/card.js +0 -1
- package/package.json +8 -8
- package/src/components/Buttons/AIAssistantButton.tsx +6 -2
- package/src/components/Buttons/variables.ts +1 -1
- package/src/components/Catalog/Catalog.tsx +15 -4
- package/src/components/Catalog/CatalogEntity/CatalogEntityInfoBar.tsx +1 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +1 -1
- package/src/components/Catalog/CatalogEntityIcon.tsx +2 -1
- package/src/components/Catalog/CatalogFilter/CatalogFilter.tsx +5 -0
- package/src/components/Catalog/variables.ts +1 -1
- package/src/components/Dropdown/Dropdown.tsx +84 -79
- package/src/components/Menu/MenuItem.tsx +1 -0
- package/src/components/Navbar/NavbarItem.tsx +6 -5
- package/src/components/Search/FilterFields/SearchFilterFieldTags.tsx +3 -3
- package/src/components/Search/SearchAiActionButtons.tsx +76 -0
- package/src/components/Search/SearchAiConversationInput.tsx +61 -18
- package/src/components/Search/SearchAiDialog.tsx +52 -23
- package/src/components/Search/SearchAiMessage.tsx +172 -43
- package/src/components/Search/SearchAiNegativeFeedbackForm.tsx +210 -0
- package/src/components/Search/SearchDialog.tsx +49 -13
- package/src/components/Search/SearchGroups.tsx +2 -0
- package/src/components/Search/variables.ts +36 -64
- package/src/components/Select/SelectInput.tsx +1 -0
- package/src/components/Tag/Tag.tsx +36 -20
- package/src/components/Tag/variables.dark.ts +135 -36
- package/src/components/Tag/variables.ts +78 -61
- package/src/core/constants/search.ts +8 -4
- package/src/core/hooks/index.ts +1 -0
- package/src/core/hooks/menu/use-nested-menu.ts +2 -2
- package/src/core/hooks/search/use-feedback-tooltip.ts +32 -0
- package/src/core/hooks/use-product-picker.ts +2 -1
- package/src/core/hooks/use-tabs.ts +168 -86
- package/src/core/hooks/use-telemetry-fallback.ts +10 -8
- package/src/core/styles/dark.ts +4 -0
- package/src/core/styles/global.ts +4 -0
- package/src/core/types/hooks.ts +6 -1
- package/src/core/types/l10n.ts +5 -0
- package/src/core/types/search.ts +13 -4
- package/src/core/utils/frontmatter-translate.ts +9 -0
- package/src/core/utils/index.ts +1 -0
- package/src/icons/AiStarsGradientIcon/AiStarsGradientIcon.tsx +13 -4
- package/src/icons/AiStarsIcon/AiStarsIcon.tsx +11 -2
- package/src/icons/CubeIcon/CubeIcon.tsx +27 -0
- package/src/icons/HashtagIcon/HashtagIcon.tsx +23 -0
- package/src/icons/RedoclyIcon/RedoclyIcon.tsx +4 -22
- package/src/icons/ThumbDownFilledIcon/ThumbDownFilledIcon.tsx +38 -0
- package/src/icons/ThumbUpFilledIcon/ThumbUpFilledIcon.tsx +35 -0
- package/src/index.ts +1 -0
- package/src/markdoc/components/Cards/Card.tsx +1 -28
- package/src/markdoc/components/Tabs/TabList.tsx +312 -105
- package/src/markdoc/components/Tabs/Tabs.tsx +136 -11
- package/src/markdoc/tags/card.ts +0 -1
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -24,9 +24,9 @@ function NavbarItem({ navItem, className }) {
|
|
|
24
24
|
if (navItem.type !== 'link' && !navItem.items)
|
|
25
25
|
return null;
|
|
26
26
|
const item = navItem;
|
|
27
|
-
const normalizedPath = (item.link
|
|
28
|
-
const
|
|
29
|
-
|
|
27
|
+
const normalizedPath = (item.link ? (0, utils_1.removeTrailingSlash)(item.link) : item.link) || '';
|
|
28
|
+
const pathWithPathPrefix = (0, utils_1.withPathPrefix)((0, utils_1.getPathnameForLocale)(normalizedPath, defaultLocale, currentLocale, locales));
|
|
29
|
+
const isActive = (0, utils_1.removeTrailingSlash)(pathname) === (0, utils_1.removeTrailingSlash)(pathWithPathPrefix);
|
|
30
30
|
const itemContent = (react_1.default.createElement(NavbarMenuItem, { as: item.link ? Link_1.Link : undefined, active: isActive, className: className, onClick: () => telemetry.sendNavbarMenuItemClickedMessage({ type: item.type }), external: item.external, target: item.target, to: item.link },
|
|
31
31
|
react_1.default.createElement(NavbarIcon, { icon: item.icon, srcSet: item.srcSet }),
|
|
32
32
|
react_1.default.createElement(NavbarLabel, { "data-translation-key": item.labelTranslationKey }, translate(item.labelTranslationKey, item.label)),
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.NextButton = NextButton;
|
|
27
37
|
const React = __importStar(require("react"));
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.PanelBody = void 0;
|
|
27
37
|
const styled_components_1 = __importStar(require("styled-components"));
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -23,7 +23,7 @@ function SearchFilterFieldTags({ className, facet, selectedValues, onChange, })
|
|
|
23
23
|
if (e.key === 'Enter') {
|
|
24
24
|
updateSelectedValues();
|
|
25
25
|
}
|
|
26
|
-
}, active: active, borderless: true },
|
|
26
|
+
}, active: active, borderless: true, selectable: true },
|
|
27
27
|
value,
|
|
28
28
|
" ",
|
|
29
29
|
isCounterVisible && react_1.default.createElement("span", null, count)));
|
|
@@ -37,7 +37,6 @@ const FilterTagsWrapper = styled_components_1.default.div `
|
|
|
37
37
|
const FilterTagWrapper = (0, styled_components_1.default)(Tag_1.Tag) `
|
|
38
38
|
text-transform: uppercase;
|
|
39
39
|
cursor: pointer;
|
|
40
|
-
${({ color }) => color && `background-color: var(--tag-operation-bg-color-${color});`}
|
|
41
40
|
margin: var(--search-filter-field-tags-tag-margin);
|
|
42
41
|
`;
|
|
43
42
|
//# sourceMappingURL=SearchFilterFieldTags.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import { FeedbackType } from '../../core/types';
|
|
3
|
+
export type SearchAiActionButtonsProps = {
|
|
4
|
+
content: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
feedback?: FeedbackType;
|
|
7
|
+
onFeedback: (feedback: FeedbackType) => void;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare function SearchAiActionButtons({ content, className, feedback, onFeedback, disabled, }: SearchAiActionButtonsProps): JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SearchAiActionButtons = SearchAiActionButtons;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const types_1 = require("../../core/types");
|
|
10
|
+
const Button_1 = require("../../components/Button/Button");
|
|
11
|
+
const ThumbUpIcon_1 = require("../../icons/ThumbUpIcon/ThumbUpIcon");
|
|
12
|
+
const ThumbUpFilledIcon_1 = require("../../icons/ThumbUpFilledIcon/ThumbUpFilledIcon");
|
|
13
|
+
const ThumbDownIcon_1 = require("../../icons/ThumbDownIcon/ThumbDownIcon");
|
|
14
|
+
const ThumbDownFilledIcon_1 = require("../../icons/ThumbDownFilledIcon/ThumbDownFilledIcon");
|
|
15
|
+
const CopyButton_1 = require("../../components/Buttons/CopyButton");
|
|
16
|
+
function SearchAiActionButtons({ content, className, feedback, onFeedback, disabled, }) {
|
|
17
|
+
return (react_1.default.createElement(ActionButtonsWrapper, { className: className, "data-component-name": "Search/SearchAiActionButtons" },
|
|
18
|
+
react_1.default.createElement(CopyButton_1.CopyButton, { data: content }),
|
|
19
|
+
react_1.default.createElement(FeedbackButton, { variant: "text", size: "small", icon: feedback === types_1.FeedbackType.Like ? react_1.default.createElement(ThumbUpFilledIcon_1.ThumbUpFilledIcon, null) : react_1.default.createElement(ThumbUpIcon_1.ThumbUpIcon, null), onClick: () => !disabled && onFeedback(types_1.FeedbackType.Like), extraClass: feedback === types_1.FeedbackType.Like ? 'active' : '', "aria-label": "Like this response", disabled: disabled }),
|
|
20
|
+
react_1.default.createElement(FeedbackButton, { variant: "text", size: "small", icon: feedback === types_1.FeedbackType.Dislike ? react_1.default.createElement(ThumbDownFilledIcon_1.ThumbDownFilledIcon, null) : react_1.default.createElement(ThumbDownIcon_1.ThumbDownIcon, null), onClick: () => !disabled && onFeedback(types_1.FeedbackType.Dislike), extraClass: feedback === types_1.FeedbackType.Dislike ? 'active' : '', "aria-label": "Dislike this response", disabled: disabled })));
|
|
21
|
+
}
|
|
22
|
+
const ActionButtonsWrapper = styled_components_1.default.div `
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
gap: var(--search-ai-feedback-gap);
|
|
26
|
+
`;
|
|
27
|
+
const FeedbackButton = (0, styled_components_1.default)(Button_1.Button) `
|
|
28
|
+
&:disabled {
|
|
29
|
+
pointer-events: none;
|
|
30
|
+
cursor: default;
|
|
31
|
+
opacity: 1;
|
|
32
|
+
background-color: var(--button-bg-color);
|
|
33
|
+
color: var(--button-color);
|
|
34
|
+
border-color: var(--button-border-color);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&:disabled.active {
|
|
38
|
+
background-color: var(--button-bg-color-active);
|
|
39
|
+
border-color: var(--button-border-color-active);
|
|
40
|
+
color: var(--button-color-active);
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
//# sourceMappingURL=SearchAiActionButtons.js.map
|
|
@@ -4,6 +4,8 @@ type SearchAiConversationInputProps = {
|
|
|
4
4
|
isGeneratingResponse: boolean;
|
|
5
5
|
placeholder?: string;
|
|
6
6
|
className?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
multiline?: boolean;
|
|
7
9
|
};
|
|
8
|
-
export declare function SearchAiConversationInput({ isGeneratingResponse, onMessageSent, className, placeholder, }: SearchAiConversationInputProps): JSX.Element;
|
|
10
|
+
export declare function SearchAiConversationInput({ isGeneratingResponse, onMessageSent, className, placeholder, disabled, multiline, }: SearchAiConversationInputProps): JSX.Element;
|
|
9
11
|
export {};
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -33,7 +43,7 @@ const constants_1 = require("../../core/constants");
|
|
|
33
43
|
const Button_1 = require("../../components/Button/Button");
|
|
34
44
|
const SendIcon_1 = require("../../icons/SendIcon/SendIcon");
|
|
35
45
|
const hooks_1 = require("../../core/hooks");
|
|
36
|
-
function SearchAiConversationInput({ isGeneratingResponse, onMessageSent, className, placeholder, }) {
|
|
46
|
+
function SearchAiConversationInput({ isGeneratingResponse, onMessageSent, className, placeholder, disabled, multiline = false, }) {
|
|
37
47
|
const { useTranslate } = (0, hooks_1.useThemeHooks)();
|
|
38
48
|
const { translate } = useTranslate();
|
|
39
49
|
const inputRef = (0, react_1.useRef)(null);
|
|
@@ -47,17 +57,31 @@ function SearchAiConversationInput({ isGeneratingResponse, onMessageSent, classN
|
|
|
47
57
|
}
|
|
48
58
|
}, [isGeneratingResponse]);
|
|
49
59
|
const handleSendMessage = () => {
|
|
60
|
+
if (disabled)
|
|
61
|
+
return;
|
|
50
62
|
setQuery('');
|
|
51
63
|
onMessageSent(query);
|
|
52
64
|
};
|
|
53
|
-
const
|
|
65
|
+
const handleOnKeyDown = (e) => {
|
|
54
66
|
if (e.key === 'Enter' && !isGeneratingResponse) {
|
|
67
|
+
if (multiline && e.shiftKey) {
|
|
68
|
+
return; // Allow new line in textarea
|
|
69
|
+
}
|
|
70
|
+
e.preventDefault();
|
|
55
71
|
handleSendMessage();
|
|
56
72
|
}
|
|
57
73
|
};
|
|
58
|
-
const isDisabled = isGeneratingResponse || query.trim().length === 0;
|
|
74
|
+
const isDisabled = disabled || isGeneratingResponse || query.trim().length === 0;
|
|
75
|
+
const commonProps = {
|
|
76
|
+
placeholder: placeholder || translate('search.ai.followUpQuestion', 'Ask a follow up question?'),
|
|
77
|
+
onChange: (e) => setQuery(e.target.value),
|
|
78
|
+
onKeyDown: handleOnKeyDown,
|
|
79
|
+
value: query,
|
|
80
|
+
disabled: disabled || isGeneratingResponse,
|
|
81
|
+
maxLength: constants_1.AI_SEARCH_MAX_MESSAGE_LENGTH,
|
|
82
|
+
};
|
|
59
83
|
return (react_1.default.createElement(SearchAiConversationInputWrapper, { "data-component-name": "Search/SearchAiConversationInput", className: className },
|
|
60
|
-
react_1.default.createElement(
|
|
84
|
+
multiline ? (react_1.default.createElement(ConversationTextarea, Object.assign({ ref: inputRef }, commonProps))) : (react_1.default.createElement(ConversationInput, Object.assign({ ref: inputRef, type: "text" }, commonProps))),
|
|
61
85
|
react_1.default.createElement(SendButton, { disabled: isDisabled, size: "small", icon: react_1.default.createElement(SendIcon_1.SendIcon, { color: isDisabled
|
|
62
86
|
? '--button-content-color-disabled'
|
|
63
87
|
: 'var(--search-ai-conversation-input-send-button-icon-color)' }), onClick: handleSendMessage })));
|
|
@@ -70,9 +94,10 @@ const SearchAiConversationInputWrapper = styled_components_1.default.div `
|
|
|
70
94
|
background-color: var(--search-ai-conversation-input-bg-color);
|
|
71
95
|
position: relative;
|
|
72
96
|
`;
|
|
73
|
-
const
|
|
97
|
+
const inputStyles = `
|
|
74
98
|
width: 100%;
|
|
75
99
|
padding: var(--search-ai-conversation-input-padding);
|
|
100
|
+
padding-right: var(--search-ai-conversation-input-padding-right, 52px);
|
|
76
101
|
border: var(--search-ai-conversation-input-border);
|
|
77
102
|
border-radius: var(--search-ai-conversation-input-border-radius);
|
|
78
103
|
background-color: var(--search-ai-conversation-input-bg-color);
|
|
@@ -88,20 +113,37 @@ const ConversationInput = styled_components_1.default.input `
|
|
|
88
113
|
border-color: var(--search-ai-conversation-input-border-color-focus);
|
|
89
114
|
}
|
|
90
115
|
|
|
116
|
+
&:disabled {
|
|
117
|
+
background-color: var(--search-ai-conversation-input-bg-color-disabled);
|
|
118
|
+
}
|
|
119
|
+
|
|
91
120
|
&:focus:disabled {
|
|
92
121
|
border-color: var(--search-ai-conversation-input-border-color-disabled);
|
|
93
122
|
}
|
|
94
123
|
`;
|
|
124
|
+
const ConversationInput = styled_components_1.default.input `
|
|
125
|
+
${inputStyles}
|
|
126
|
+
height: var(--search-ai-conversation-input-min-height);
|
|
127
|
+
`;
|
|
128
|
+
const ConversationTextarea = styled_components_1.default.textarea `
|
|
129
|
+
${inputStyles}
|
|
130
|
+
min-height: var(--search-ai-conversation-input-min-height);
|
|
131
|
+
max-height: var(--search-ai-conversation-input-max-height);
|
|
132
|
+
resize: none;
|
|
133
|
+
field-sizing: content;
|
|
134
|
+
`;
|
|
95
135
|
const SendButton = (0, styled_components_1.default)(Button_1.Button) `
|
|
96
136
|
position: absolute;
|
|
97
137
|
right: var(--search-ai-conversation-input-send-button-right);
|
|
98
|
-
|
|
99
|
-
transform: translateY(
|
|
138
|
+
bottom: var(--search-ai-conversation-input-send-button-bottom);
|
|
139
|
+
transform: translateY(50%);
|
|
100
140
|
transition: background-color 0.2s ease;
|
|
101
141
|
background-color: var(--search-ai-conversation-input-send-button-bg-color);
|
|
102
142
|
display: flex;
|
|
103
143
|
align-items: center;
|
|
104
144
|
justify-content: center;
|
|
145
|
+
border-radius: var(--search-ai-conversation-input-send-button-border-radius);
|
|
146
|
+
padding: var(--search-ai-conversation-input-send-button-padding);
|
|
105
147
|
|
|
106
148
|
&:hover {
|
|
107
149
|
background-color: var(--search-ai-conversation-input-send-button-bg-color-hover);
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { JSX } from 'react';
|
|
3
|
+
import type { AiSearchConversationItem, SearchAiMessageResource } from '../../core/types';
|
|
3
4
|
import { AiSearchError } from '../../core/constants';
|
|
4
|
-
import { AiSearchConversationItem } from '../../core/types';
|
|
5
5
|
export type SearchAiDialogProps = {
|
|
6
6
|
response: string | undefined;
|
|
7
7
|
isGeneratingResponse: boolean;
|
|
8
8
|
error: AiSearchError | null;
|
|
9
|
-
resources:
|
|
10
|
-
url: string;
|
|
11
|
-
title: string;
|
|
12
|
-
}[];
|
|
9
|
+
resources: SearchAiMessageResource[];
|
|
13
10
|
initialMessage?: string;
|
|
14
11
|
className?: string;
|
|
15
12
|
conversation: AiSearchConversationItem[];
|
|
16
13
|
setConversation: React.Dispatch<React.SetStateAction<AiSearchConversationItem[]>>;
|
|
17
|
-
onMessageSent: (message: string, history?: AiSearchConversationItem[]) => void;
|
|
14
|
+
onMessageSent: (message: string, history?: AiSearchConversationItem[], messageId?: string) => void;
|
|
18
15
|
};
|
|
19
16
|
export declare function SearchAiDialog({ isGeneratingResponse, response, initialMessage, error, resources, onMessageSent, className, conversation, setConversation, }: SearchAiDialogProps): JSX.Element;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -47,11 +57,11 @@ function SearchAiDialog({ isGeneratingResponse, response, initialMessage, error,
|
|
|
47
57
|
: conversation.length > 0
|
|
48
58
|
? translate('search.ai.followUpQuestion', 'Ask a follow up question?')
|
|
49
59
|
: translate('search.ai.placeholder', 'Ask a question...');
|
|
50
|
-
const scrollToBottom = () => {
|
|
60
|
+
const scrollToBottom = (0, react_1.useCallback)(() => {
|
|
51
61
|
var _a;
|
|
52
62
|
(_a = conversationEndRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ block: 'end' });
|
|
53
|
-
};
|
|
54
|
-
const handleOnMessageSent = (message) => {
|
|
63
|
+
}, []);
|
|
64
|
+
const handleOnMessageSent = (0, react_1.useCallback)((message) => {
|
|
55
65
|
if (!message.trim()) {
|
|
56
66
|
return;
|
|
57
67
|
}
|
|
@@ -60,8 +70,11 @@ function SearchAiDialog({ isGeneratingResponse, response, initialMessage, error,
|
|
|
60
70
|
content,
|
|
61
71
|
}));
|
|
62
72
|
onMessageSent(message, mappedHistory);
|
|
63
|
-
setConversation((prev) => [
|
|
64
|
-
|
|
73
|
+
setConversation((prev) => [
|
|
74
|
+
...prev,
|
|
75
|
+
{ role: constants_1.AiSearchConversationRole.USER, content: message },
|
|
76
|
+
]);
|
|
77
|
+
}, [conversation, onMessageSent, setConversation]);
|
|
65
78
|
(0, react_1.useEffect)(() => {
|
|
66
79
|
if (!(initialMessage === null || initialMessage === void 0 ? void 0 : initialMessage.trim().length)) {
|
|
67
80
|
return;
|
|
@@ -81,10 +94,15 @@ function SearchAiDialog({ isGeneratingResponse, response, initialMessage, error,
|
|
|
81
94
|
if (lastMessage && lastMessage.role === constants_1.AiSearchConversationRole.ASSISTANT) {
|
|
82
95
|
return [
|
|
83
96
|
...prev.slice(0, -1),
|
|
84
|
-
{
|
|
97
|
+
{
|
|
98
|
+
role: constants_1.AiSearchConversationRole.ASSISTANT,
|
|
99
|
+
content,
|
|
100
|
+
resources,
|
|
101
|
+
messageId: lastMessage.messageId,
|
|
102
|
+
},
|
|
85
103
|
];
|
|
86
104
|
}
|
|
87
|
-
return [...prev, { role: constants_1.AiSearchConversationRole.ASSISTANT, content }];
|
|
105
|
+
return [...prev, { role: constants_1.AiSearchConversationRole.ASSISTANT, content, resources }];
|
|
88
106
|
});
|
|
89
107
|
}, [response, conversation.length, error, resources, setConversation]);
|
|
90
108
|
(0, react_1.useEffect)(() => {
|
|
@@ -94,7 +112,10 @@ function SearchAiDialog({ isGeneratingResponse, response, initialMessage, error,
|
|
|
94
112
|
}, [error, setConversation]);
|
|
95
113
|
(0, react_1.useEffect)(() => {
|
|
96
114
|
scrollToBottom();
|
|
97
|
-
}, [conversation, isGeneratingResponse]);
|
|
115
|
+
}, [conversation, isGeneratingResponse, scrollToBottom]);
|
|
116
|
+
const handleFeedbackChange = (0, react_1.useCallback)((messageId, feedback) => {
|
|
117
|
+
setConversation((prev) => prev.map((item) => (item.messageId === messageId ? Object.assign(Object.assign({}, item), { feedback }) : item)));
|
|
118
|
+
}, [setConversation]);
|
|
98
119
|
return (react_1.default.createElement(SearchAiDialogWrapper, { "data-component-name": "Search/SearchAiDialog", className: className },
|
|
99
120
|
!conversation.length && (react_1.default.createElement(WelcomeWrapper, null,
|
|
100
121
|
react_1.default.createElement(AiStarsIcon_1.AiStarsIcon, { color: "var(--search-ai-icon-color)", size: "32px", background: "var(--search-ai-icon-bg-color)", borderRadius: "var(--border-radius-lg)", margin: "0 var(--spacing-xs) 0 0" }),
|
|
@@ -102,7 +123,7 @@ function SearchAiDialog({ isGeneratingResponse, response, initialMessage, error,
|
|
|
102
123
|
react_1.default.createElement(ConversationWrapper, null,
|
|
103
124
|
conversation.map((item, index) => (react_1.default.createElement(SearchAiMessage_1.SearchAiMessage, { key: `search-ai-message-${index}`, role: item.role, content: item.content, isThinking: item.role === constants_1.AiSearchConversationRole.ASSISTANT &&
|
|
104
125
|
isGeneratingResponse &&
|
|
105
|
-
index === conversation.length - 1, resources: item.resources }))),
|
|
126
|
+
index === conversation.length - 1, resources: item.resources, messageId: item.messageId, feedback: item.feedback, onFeedbackChange: handleFeedbackChange }))),
|
|
106
127
|
error && (react_1.default.createElement(Admonition_1.Admonition, { type: "danger", name: translate(constants_1.AI_SEARCH_ERROR_CONFIG[error].headerKey, constants_1.AI_SEARCH_ERROR_CONFIG[error].headerDefault) }, translate(constants_1.AI_SEARCH_ERROR_CONFIG[error].messageKey, constants_1.AI_SEARCH_ERROR_CONFIG[error].messageDefault))),
|
|
107
128
|
!conversation.length && !error && (react_1.default.createElement(SuggestionsWrapper, null, suggestions === null || suggestions === void 0 ? void 0 : suggestions.map((suggestion) => (react_1.default.createElement(Button_1.Button, { key: suggestion, variant: "outlined", onClick: () => handleOnMessageSent(suggestion) }, suggestion))))),
|
|
108
129
|
react_1.default.createElement("div", { ref: conversationEndRef })),
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import type { JSX } from 'react';
|
|
3
|
+
import { FeedbackType, type SearchAiMessageResource } from '../../core/types';
|
|
2
4
|
import { AiSearchConversationRole } from '../../core/constants';
|
|
3
5
|
export type SearchAiMessageProps = {
|
|
4
6
|
role: AiSearchConversationRole;
|
|
5
7
|
content: string;
|
|
6
8
|
isThinking?: boolean;
|
|
7
|
-
resources?:
|
|
8
|
-
url: string;
|
|
9
|
-
title: string;
|
|
10
|
-
}[];
|
|
9
|
+
resources?: SearchAiMessageResource[];
|
|
11
10
|
className?: string;
|
|
11
|
+
messageId?: string;
|
|
12
|
+
feedback?: FeedbackType;
|
|
13
|
+
onFeedbackChange: (messageId: string, feedback: FeedbackType | undefined) => void;
|
|
12
14
|
};
|
|
13
|
-
|
|
15
|
+
declare function SearchAiMessageComponent({ role, content, isThinking, resources, className, messageId, feedback, onFeedbackChange, }: SearchAiMessageProps): JSX.Element;
|
|
16
|
+
export declare const SearchAiMessage: React.MemoExoticComponent<typeof SearchAiMessageComponent>;
|
|
17
|
+
export {};
|