@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
|
@@ -1,11 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
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
|
+
})();
|
|
2
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
37
|
};
|
|
5
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.SearchAiMessage =
|
|
7
|
-
const react_1 =
|
|
39
|
+
exports.SearchAiMessage = void 0;
|
|
40
|
+
const react_1 = __importStar(require("react"));
|
|
8
41
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
42
|
+
const types_1 = require("../../core/types");
|
|
9
43
|
const Link_1 = require("../../components/Link/Link");
|
|
10
44
|
const Tag_1 = require("../../components/Tag/Tag");
|
|
11
45
|
const constants_1 = require("../../core/constants");
|
|
@@ -13,29 +47,91 @@ const hooks_1 = require("../../core/hooks");
|
|
|
13
47
|
const Markdown_1 = require("../../components/Markdown/Markdown");
|
|
14
48
|
const DocumentIcon_1 = require("../../icons/DocumentIcon/DocumentIcon");
|
|
15
49
|
const AiStarsIcon_1 = require("../../icons/AiStarsIcon/AiStarsIcon");
|
|
16
|
-
|
|
17
|
-
|
|
50
|
+
const CheckmarkOutlineIcon_1 = require("../../icons/CheckmarkOutlineIcon/CheckmarkOutlineIcon");
|
|
51
|
+
const SearchAiActionButtons_1 = require("./SearchAiActionButtons");
|
|
52
|
+
const SearchAiNegativeFeedbackForm_1 = require("./SearchAiNegativeFeedbackForm");
|
|
53
|
+
function SearchAiMessageComponent({ role, content, isThinking, resources, className, messageId, feedback, onFeedbackChange, }) {
|
|
54
|
+
var _a;
|
|
55
|
+
const { useMarkdownText, useTranslate, useTelemetry } = (0, hooks_1.useThemeHooks)();
|
|
18
56
|
const markDownContent = useMarkdownText(content || '');
|
|
19
57
|
const { translate } = useTranslate();
|
|
58
|
+
const telemetry = useTelemetry();
|
|
59
|
+
const [feedbackSent, setFeedbackSent] = (0, react_1.useState)(false);
|
|
60
|
+
const hasResources = !isThinking && resources && resources.length > 0;
|
|
61
|
+
const resourcesCount = (_a = resources === null || resources === void 0 ? void 0 : resources.length) !== null && _a !== void 0 ? _a : 0;
|
|
62
|
+
const showSuccessMessage = feedbackSent && feedback;
|
|
63
|
+
const sendFeedbackTelemetry = (feedbackValue, dislikeReason) => {
|
|
64
|
+
if (!messageId)
|
|
65
|
+
return;
|
|
66
|
+
try {
|
|
67
|
+
telemetry.sendSearchAIFeedbackMessage({
|
|
68
|
+
feedback: feedbackValue,
|
|
69
|
+
messageId,
|
|
70
|
+
reason: dislikeReason,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
console.error('Error sending feedback', error);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const handleFeedbackClick = (feedbackValue, reason) => {
|
|
78
|
+
if (!messageId) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (!reason) {
|
|
82
|
+
onFeedbackChange(messageId, feedbackValue);
|
|
83
|
+
}
|
|
84
|
+
sendFeedbackTelemetry(feedbackValue, reason);
|
|
85
|
+
if (feedbackValue === types_1.FeedbackType.Like || reason) {
|
|
86
|
+
setFeedbackSent(true);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
20
89
|
return (react_1.default.createElement(SearchAiMessageWrapper, { "data-component-name": "Search/SearchAiMessage", role: role, className: className, "data-testid": "search-ai-message" },
|
|
21
90
|
role === constants_1.AiSearchConversationRole.ASSISTANT && (react_1.default.createElement(AiStarsIcon_1.AiStarsIcon, { size: "32px", background: "var(--search-ai-icon-bg-color)", borderRadius: "var(--border-radius-lg)", color: "var(--search-ai-icon-color)", margin: "0 var(--spacing-xs) 0 0" })),
|
|
22
|
-
react_1.default.createElement(
|
|
23
|
-
|
|
24
|
-
react_1.default.createElement(
|
|
25
|
-
|
|
26
|
-
react_1.default.createElement(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
91
|
+
react_1.default.createElement(MessageContentWrapper, null,
|
|
92
|
+
react_1.default.createElement(MessageWrapper, { role: role },
|
|
93
|
+
role === constants_1.AiSearchConversationRole.ASSISTANT ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
94
|
+
react_1.default.createElement(ResponseText, { as: "div", children: markDownContent, "data-testid": "response-text" }),
|
|
95
|
+
hasResources && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
96
|
+
react_1.default.createElement(ResourcesWrapper, { "data-testid": "resources-wrapper" },
|
|
97
|
+
react_1.default.createElement(ResourcesTitle, { "data-translation-key": "search.ai.resourcesFound" },
|
|
98
|
+
translate('search.ai.resourcesFound.basedOn', 'Based on'),
|
|
99
|
+
" ",
|
|
100
|
+
resourcesCount,
|
|
101
|
+
' ',
|
|
102
|
+
translate('search.ai.resourcesFound.resources', 'resources')),
|
|
103
|
+
react_1.default.createElement(ResourceTagsWrapper, null, resources === null || resources === void 0 ? void 0 : resources.map((resource, idx) => (react_1.default.createElement(Link_1.Link, { key: `${resource.url}-${idx}`, to: resource.url, target: "_blank" },
|
|
104
|
+
react_1.default.createElement(ResourceTag, { borderless: true, icon: react_1.default.createElement(DocumentIcon_1.DocumentIcon, { color: "--search-ai-resource-tag-icon-color" }) }, resource.title)))))),
|
|
105
|
+
react_1.default.createElement(FeedbackWrapper, null,
|
|
106
|
+
react_1.default.createElement(SearchAiActionButtons_1.SearchAiActionButtons, { content: content, feedback: feedback, onFeedback: handleFeedbackClick, disabled: feedbackSent })))))) : (content),
|
|
107
|
+
isThinking && content.length === 0 && (react_1.default.createElement(ThinkingDotsWrapper, { "data-testid": "thinking-dots-wrapper" },
|
|
108
|
+
react_1.default.createElement(ThinkingDot, null),
|
|
109
|
+
react_1.default.createElement(ThinkingDot, null),
|
|
110
|
+
react_1.default.createElement(ThinkingDot, null)))),
|
|
111
|
+
messageId && feedback === types_1.FeedbackType.Dislike && !showSuccessMessage && (react_1.default.createElement(SearchAiNegativeFeedbackForm_1.SearchAiNegativeFeedbackForm, { messageId: messageId, onClose: onFeedbackChange, onSubmit: (reason) => handleFeedbackClick(types_1.FeedbackType.Dislike, reason) })),
|
|
112
|
+
showSuccessMessage && (react_1.default.createElement(SuccessMessageWrapper, { "data-component-name": "Search/SearchAiMessage/Success" },
|
|
113
|
+
react_1.default.createElement(CheckmarkOutlineIcon_1.CheckmarkOutlineIcon, { size: "20px", color: "var(--color-success-base)" }),
|
|
114
|
+
react_1.default.createElement(SuccessMessageText, null, translate('search.ai.feedback.thanks', 'Thank you for your feedback!')))))));
|
|
115
|
+
}
|
|
116
|
+
function areResourcesEqual(prev, next) {
|
|
117
|
+
if (prev === next)
|
|
118
|
+
return true;
|
|
119
|
+
if (!prev || !next || prev.length !== next.length)
|
|
120
|
+
return false;
|
|
121
|
+
return prev.every((resource, index) => {
|
|
122
|
+
const nextResource = next[index];
|
|
123
|
+
return resource.url === nextResource.url && resource.title === nextResource.title;
|
|
124
|
+
});
|
|
38
125
|
}
|
|
126
|
+
exports.SearchAiMessage = (0, react_1.memo)(SearchAiMessageComponent, (prevProps, nextProps) => {
|
|
127
|
+
return (prevProps.role === nextProps.role &&
|
|
128
|
+
prevProps.content === nextProps.content &&
|
|
129
|
+
prevProps.isThinking === nextProps.isThinking &&
|
|
130
|
+
prevProps.messageId === nextProps.messageId &&
|
|
131
|
+
prevProps.feedback === nextProps.feedback &&
|
|
132
|
+
prevProps.onFeedbackChange === nextProps.onFeedbackChange &&
|
|
133
|
+
areResourcesEqual(prevProps.resources, nextProps.resources));
|
|
134
|
+
});
|
|
39
135
|
const SearchAiMessageWrapper = styled_components_1.default.div `
|
|
40
136
|
display: flex;
|
|
41
137
|
flex-direction: row;
|
|
@@ -43,6 +139,13 @@ const SearchAiMessageWrapper = styled_components_1.default.div `
|
|
|
43
139
|
width: 100%;
|
|
44
140
|
justify-content: ${({ role }) => role === constants_1.AiSearchConversationRole.USER ? 'flex-end' : 'flex-start'};
|
|
45
141
|
`;
|
|
142
|
+
const MessageContentWrapper = styled_components_1.default.div `
|
|
143
|
+
display: flex;
|
|
144
|
+
flex-direction: column;
|
|
145
|
+
gap: var(--spacing-sm);
|
|
146
|
+
max-width: 80%;
|
|
147
|
+
min-width: 0;
|
|
148
|
+
`;
|
|
46
149
|
const ResponseText = (0, styled_components_1.default)(Markdown_1.Markdown) `
|
|
47
150
|
color: var(--search-ai-text-color);
|
|
48
151
|
font-size: var(--search-ai-text-font-size);
|
|
@@ -63,7 +166,8 @@ const MessageWrapper = styled_components_1.default.div `
|
|
|
63
166
|
padding: ${({ role }) => role === constants_1.AiSearchConversationRole.USER ? 'var(--spacing-sm)' : 'var(--spacing-xs)'}
|
|
64
167
|
var(--spacing-sm);
|
|
65
168
|
border-radius: var(--border-radius-lg);
|
|
66
|
-
|
|
169
|
+
width: fit-content;
|
|
170
|
+
max-width: 100%;
|
|
67
171
|
word-wrap: break-word;
|
|
68
172
|
white-space: pre-wrap;
|
|
69
173
|
background-color: ${({ role }) => role === constants_1.AiSearchConversationRole.USER
|
|
@@ -78,7 +182,13 @@ const ResourcesWrapper = styled_components_1.default.div `
|
|
|
78
182
|
gap: var(--search-ai-resources-gap);
|
|
79
183
|
display: flex;
|
|
80
184
|
flex-direction: column;
|
|
81
|
-
margin:
|
|
185
|
+
margin: 0;
|
|
186
|
+
`;
|
|
187
|
+
const FeedbackWrapper = styled_components_1.default.div `
|
|
188
|
+
display: flex;
|
|
189
|
+
flex-direction: row;
|
|
190
|
+
gap: var(--search-ai-feedback-gap);
|
|
191
|
+
margin-top: var(--spacing-sm);
|
|
82
192
|
`;
|
|
83
193
|
const ResourcesTitle = styled_components_1.default.div `
|
|
84
194
|
font-weight: var(--search-ai-resources-title-font-weight);
|
|
@@ -144,4 +254,18 @@ const ThinkingDot = styled_components_1.default.div `
|
|
|
144
254
|
}
|
|
145
255
|
}
|
|
146
256
|
`;
|
|
257
|
+
const SuccessMessageWrapper = styled_components_1.default.div `
|
|
258
|
+
max-width: fit-content;
|
|
259
|
+
display: flex;
|
|
260
|
+
align-items: center;
|
|
261
|
+
gap: var(--spacing-sm);
|
|
262
|
+
padding: var(--spacing-sm);
|
|
263
|
+
background: var(--color-success-bg);
|
|
264
|
+
border: 1px solid var(--color-success-border);
|
|
265
|
+
border-radius: var(--border-radius-lg);
|
|
266
|
+
`;
|
|
267
|
+
const SuccessMessageText = styled_components_1.default.div `
|
|
268
|
+
font-size: var(--font-size-base);
|
|
269
|
+
color: var(--color-success-darker);
|
|
270
|
+
`;
|
|
147
271
|
//# sourceMappingURL=SearchAiMessage.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { FeedbackType } from '../../core/types';
|
|
3
|
+
export type SearchAiNegativeFeedbackFormProps = {
|
|
4
|
+
messageId: string;
|
|
5
|
+
onClose: (messageId: string, feedback: FeedbackType | undefined) => void;
|
|
6
|
+
onSubmit: (reason: string) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare function SearchAiNegativeFeedbackForm({ messageId, onClose, onSubmit, }: SearchAiNegativeFeedbackFormProps): JSX.Element;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
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
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.SearchAiNegativeFeedbackForm = SearchAiNegativeFeedbackForm;
|
|
40
|
+
const react_1 = __importStar(require("react"));
|
|
41
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
42
|
+
const Button_1 = require("../../components/Button/Button");
|
|
43
|
+
const CloseIcon_1 = require("../../icons/CloseIcon/CloseIcon");
|
|
44
|
+
const ArrowLeftIcon_1 = require("../../icons/ArrowLeftIcon/ArrowLeftIcon");
|
|
45
|
+
const SendIcon_1 = require("../../icons/SendIcon/SendIcon");
|
|
46
|
+
const hooks_1 = require("../../core/hooks");
|
|
47
|
+
const NEGATIVE_FEEDBACK_DEFAULT_REASONS = [
|
|
48
|
+
"Didn't answer my question",
|
|
49
|
+
"Couldn't find what I was looking for",
|
|
50
|
+
'Wrong topic',
|
|
51
|
+
'Partially helpful, but missing details',
|
|
52
|
+
];
|
|
53
|
+
function SearchAiNegativeFeedbackForm({ messageId, onClose, onSubmit, }) {
|
|
54
|
+
const { useTranslate } = (0, hooks_1.useThemeHooks)();
|
|
55
|
+
const { translate } = useTranslate();
|
|
56
|
+
const [showMoreInput, setShowMoreInput] = (0, react_1.useState)(false);
|
|
57
|
+
const [detailedFeedback, setDetailedFeedback] = (0, react_1.useState)('');
|
|
58
|
+
const textAreaRef = react_1.default.useRef(null);
|
|
59
|
+
const adjustTextAreaHeight = () => {
|
|
60
|
+
const textArea = textAreaRef.current;
|
|
61
|
+
if (textArea) {
|
|
62
|
+
textArea.style.height = 'auto';
|
|
63
|
+
textArea.style.height = `${textArea.scrollHeight}px`;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const handleTextChange = (e) => {
|
|
67
|
+
setDetailedFeedback(e.target.value);
|
|
68
|
+
adjustTextAreaHeight();
|
|
69
|
+
};
|
|
70
|
+
(0, react_1.useEffect)(() => {
|
|
71
|
+
if (showMoreInput) {
|
|
72
|
+
adjustTextAreaHeight();
|
|
73
|
+
}
|
|
74
|
+
}, [showMoreInput]);
|
|
75
|
+
return (react_1.default.createElement(FeedbackFormWrapper, { "data-component-name": "Search/SearchAiNegativeFeedbackForm" },
|
|
76
|
+
react_1.default.createElement(FeedbackHeader, null,
|
|
77
|
+
showMoreInput ? (react_1.default.createElement(BackButton, { variant: "text", size: "small", icon: react_1.default.createElement(ArrowLeftIcon_1.ArrowLeftIcon, null), onClick: () => setShowMoreInput(false), "aria-label": "Back to feedback reasons" })) : null,
|
|
78
|
+
react_1.default.createElement(FeedbackTitle, { "data-translation-key": "search.ai.feedback.title" }, translate('search.ai.feedback.title', "What didn't you like about this response?")),
|
|
79
|
+
react_1.default.createElement(CloseButton, { variant: "text", size: "small", icon: react_1.default.createElement(CloseIcon_1.CloseIcon, null), onClick: () => onClose(messageId, undefined), "aria-label": "Close feedback form" })),
|
|
80
|
+
!showMoreInput ? (react_1.default.createElement(FeedbackReasonsWrapper, null,
|
|
81
|
+
NEGATIVE_FEEDBACK_DEFAULT_REASONS.map((reason) => (react_1.default.createElement(Button_1.Button, { key: reason, variant: "outlined", size: "small", onClick: () => onSubmit(reason) }, reason))),
|
|
82
|
+
react_1.default.createElement(Button_1.Button, { variant: "outlined", size: "small", onClick: () => setShowMoreInput(true) }, "More..."))) : (react_1.default.createElement(FeedbackInputWrapper, null,
|
|
83
|
+
react_1.default.createElement(FeedbackTextArea, { ref: textAreaRef, placeholder: translate('search.ai.feedback.detailsPlaceholder', 'Add specific details'), value: detailedFeedback, onChange: handleTextChange, rows: 1, autoFocus: true }),
|
|
84
|
+
react_1.default.createElement(SendButton, { size: "small", icon: react_1.default.createElement(SendIcon_1.SendIcon, { color: !detailedFeedback.trim()
|
|
85
|
+
? '--button-content-color-disabled'
|
|
86
|
+
: 'var(--search-ai-conversation-input-send-button-icon-color)' }), onClick: () => onSubmit(detailedFeedback), disabled: !detailedFeedback.trim(), "aria-label": "Send feedback" })))));
|
|
87
|
+
}
|
|
88
|
+
const FeedbackFormWrapper = styled_components_1.default.div `
|
|
89
|
+
display: flex;
|
|
90
|
+
flex-direction: column;
|
|
91
|
+
gap: var(--spacing-sm);
|
|
92
|
+
padding: var(--spacing-xs);
|
|
93
|
+
background: var(--search-ai-feedback-form-bg-color);
|
|
94
|
+
border: 1px solid var(--search-ai-feedback-form-border-color);
|
|
95
|
+
border-radius: var(--border-radius-lg);
|
|
96
|
+
`;
|
|
97
|
+
const FeedbackHeader = styled_components_1.default.div `
|
|
98
|
+
display: flex;
|
|
99
|
+
justify-content: space-between;
|
|
100
|
+
align-items: center;
|
|
101
|
+
gap: var(--spacing-sm);
|
|
102
|
+
`;
|
|
103
|
+
const FeedbackTitle = styled_components_1.default.div `
|
|
104
|
+
font-size: var(--font-size-base);
|
|
105
|
+
color: var(--text-color);
|
|
106
|
+
flex: 1;
|
|
107
|
+
`;
|
|
108
|
+
const BackButton = (0, styled_components_1.default)(Button_1.Button) `
|
|
109
|
+
flex-shrink: 0;
|
|
110
|
+
`;
|
|
111
|
+
const CloseButton = (0, styled_components_1.default)(Button_1.Button) `
|
|
112
|
+
flex-shrink: 0;
|
|
113
|
+
`;
|
|
114
|
+
const FeedbackReasonsWrapper = styled_components_1.default.div `
|
|
115
|
+
display: flex;
|
|
116
|
+
flex-wrap: wrap;
|
|
117
|
+
gap: var(--spacing-xs);
|
|
118
|
+
`;
|
|
119
|
+
const FeedbackInputWrapper = styled_components_1.default.div `
|
|
120
|
+
position: relative;
|
|
121
|
+
width: 100%;
|
|
122
|
+
`;
|
|
123
|
+
const FeedbackTextArea = styled_components_1.default.textarea `
|
|
124
|
+
width: 100%;
|
|
125
|
+
min-height: 5rem;
|
|
126
|
+
max-height: 12.5rem;
|
|
127
|
+
padding: var(--spacing-xs);
|
|
128
|
+
padding-right: 3rem;
|
|
129
|
+
border: 1px solid var(--border-color-primary);
|
|
130
|
+
border-radius: var(--border-radius-md);
|
|
131
|
+
font-family: inherit;
|
|
132
|
+
font-size: var(--font-size-base);
|
|
133
|
+
line-height: var(--line-height-base);
|
|
134
|
+
background: var(--background-color);
|
|
135
|
+
color: var(--text-color);
|
|
136
|
+
resize: none;
|
|
137
|
+
overflow-y: auto;
|
|
138
|
+
|
|
139
|
+
&:focus {
|
|
140
|
+
outline: 1px solid var(--button-border-color-focused);
|
|
141
|
+
border-color: var(--button-border-color-focused);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
&::placeholder {
|
|
145
|
+
color: var(--text-color-helper);
|
|
146
|
+
}
|
|
147
|
+
`;
|
|
148
|
+
const SendButton = (0, styled_components_1.default)(Button_1.Button) `
|
|
149
|
+
position: absolute;
|
|
150
|
+
right: var(--search-ai-conversation-input-send-button-right);
|
|
151
|
+
bottom: var(--spacing-sm);
|
|
152
|
+
transition: background-color 0.2s ease;
|
|
153
|
+
background-color: var(--search-ai-conversation-input-send-button-bg-color);
|
|
154
|
+
display: flex;
|
|
155
|
+
align-items: center;
|
|
156
|
+
justify-content: center;
|
|
157
|
+
border-radius: var(--search-ai-conversation-input-send-button-border-radius);
|
|
158
|
+
padding: var(--search-ai-conversation-input-send-button-padding);
|
|
159
|
+
|
|
160
|
+
&:hover {
|
|
161
|
+
background-color: var(--search-ai-conversation-input-send-button-bg-color-hover);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&:disabled {
|
|
165
|
+
background-color: var(--search-ai-conversation-input-send-button-bg-color-disabled);
|
|
166
|
+
border: var(--search-ai-conversation-input-send-button-border-disabled);
|
|
167
|
+
}
|
|
168
|
+
`;
|
|
169
|
+
//# sourceMappingURL=SearchAiNegativeFeedbackForm.js.map
|
|
@@ -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
|
};
|
|
@@ -56,14 +66,25 @@ function SearchDialog({ onClose, className, initialMode = 'search', }) {
|
|
|
56
66
|
const products = useProducts();
|
|
57
67
|
const currentProduct = useCurrentProduct();
|
|
58
68
|
const [product, setProduct] = (0, react_1.useState)(currentProduct);
|
|
69
|
+
const searchSessionId = `search-${Date.now()}-${Math.random().toString(36).substring(2, 8)}`;
|
|
59
70
|
const [mode, setMode] = (0, react_1.useState)(initialMode);
|
|
60
71
|
const autoSearchDisabled = mode !== 'search';
|
|
61
|
-
const { query, setQuery, filter, setFilter, items, isSearchLoading, facets, setLoadMore, advancedSearch, askAi, groupField, } = useSearch(product === null || product === void 0 ? void 0 : product.name, autoSearchDisabled);
|
|
72
|
+
const { query, setQuery, filter, setFilter, items, isSearchLoading, facets, setLoadMore, advancedSearch, askAi, groupField, } = useSearch(product === null || product === void 0 ? void 0 : product.name, autoSearchDisabled, searchSessionId);
|
|
62
73
|
const { isFilterOpen, onFilterToggle, onFilterChange, onFilterReset, onFacetReset, onQuickFilterReset, } = (0, hooks_1.useSearchFilter)(filter, setFilter);
|
|
63
74
|
const { addSearchHistoryItem } = (0, hooks_1.useRecentSearches)();
|
|
64
|
-
const aiSearch = useAiSearch({ filter });
|
|
75
|
+
const aiSearch = useAiSearch({ filter }, searchSessionId);
|
|
65
76
|
const searchInputRef = (0, react_1.useRef)(null);
|
|
66
77
|
const modalRef = (0, react_1.useRef)(null);
|
|
78
|
+
const [isMobile, setIsMobile] = (0, react_1.useState)(false);
|
|
79
|
+
(0, react_1.useEffect)(() => {
|
|
80
|
+
const mediaQuery = window.matchMedia(`(max-width: ${utils_1.breakpoints.small})`);
|
|
81
|
+
setIsMobile(mediaQuery.matches);
|
|
82
|
+
const handleChange = (e) => {
|
|
83
|
+
setIsMobile(e.matches);
|
|
84
|
+
};
|
|
85
|
+
mediaQuery.addEventListener('change', handleChange);
|
|
86
|
+
return () => mediaQuery.removeEventListener('change', handleChange);
|
|
87
|
+
}, []);
|
|
67
88
|
const aiQueryRef = (0, react_1.useRef)(null);
|
|
68
89
|
const firstSearchResultRef = (0, react_1.useRef)(null);
|
|
69
90
|
const searchKeysWithResults = items ? Object.keys(items).filter((key) => { var _a; return (_a = items[key]) === null || _a === void 0 ? void 0 : _a.length; }) : [];
|
|
@@ -116,10 +137,11 @@ function SearchDialog({ onClose, className, initialMode = 'search', }) {
|
|
|
116
137
|
totalResults: results.length.toString(),
|
|
117
138
|
index: index.toString(),
|
|
118
139
|
searchEngine: mode,
|
|
140
|
+
searchSessionId,
|
|
119
141
|
});
|
|
120
142
|
onClose();
|
|
121
143
|
} }));
|
|
122
|
-
}, [onClose, product, products, addSearchHistoryItem, query, telemetry, mode]);
|
|
144
|
+
}, [onClose, product, products, addSearchHistoryItem, query, telemetry, mode, searchSessionId]);
|
|
123
145
|
const showLoadMore = (0, react_1.useCallback)((groupKey, currentCount = 0) => {
|
|
124
146
|
const groupFacet = facets.find((facet) => facet.field === groupField);
|
|
125
147
|
let needLoadMore = false;
|
|
@@ -164,14 +186,21 @@ function SearchDialog({ onClose, className, initialMode = 'search', }) {
|
|
|
164
186
|
if (query.trim()) {
|
|
165
187
|
aiSearch.askQuestion(query);
|
|
166
188
|
}
|
|
189
|
+
telemetry.sendSearchAiOpenedMessage({
|
|
190
|
+
method: 'ai_search_button',
|
|
191
|
+
});
|
|
167
192
|
} }, translate('search.ai.button', 'Search with AI'))) : null,
|
|
168
193
|
showSearchFilterButton && (react_1.default.createElement(SearchFilterToggleButton, { icon: react_1.default.createElement(SettingsIcon_1.SettingsIcon, null), onClick: onFilterToggle })))))) : (react_1.default.createElement(AiDialogHeaderWrapper, null,
|
|
169
194
|
react_1.default.createElement(Button_1.Button, { variant: "secondary", onClick: () => {
|
|
170
195
|
setMode('search');
|
|
171
196
|
aiSearch.clearConversation();
|
|
172
197
|
focusSearchInput();
|
|
173
|
-
}, tabIndex: 0, icon: react_1.default.createElement(ChevronLeftIcon_1.ChevronLeftIcon, null) },
|
|
174
|
-
|
|
198
|
+
}, tabIndex: 0, icon: react_1.default.createElement(ChevronLeftIcon_1.ChevronLeftIcon, null) }, isMobile
|
|
199
|
+
? translate('search.ai.back', 'Back')
|
|
200
|
+
: translate('search.ai.backToSearch', 'Back to search')),
|
|
201
|
+
react_1.default.createElement(AiDialogHeaderActionsWrapper, null,
|
|
202
|
+
react_1.default.createElement(Button_1.Button, { variant: "secondary", disabled: !aiSearch.conversation.length, onClick: () => aiSearch.clearConversation(), tabIndex: 0, icon: react_1.default.createElement(EditIcon_1.EditIcon, null) }, translate('search.ai.newConversation', 'New conversation')),
|
|
203
|
+
isMobile && react_1.default.createElement(Button_1.Button, { variant: "text", icon: react_1.default.createElement(CloseIcon_1.CloseIcon, null), onClick: handleClose }))))),
|
|
175
204
|
react_1.default.createElement(SearchDialogBody, null, mode === 'search' ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
176
205
|
advancedSearch && isFilterOpen && (react_1.default.createElement(SearchDialogBodyFilterView, null,
|
|
177
206
|
react_1.default.createElement(SearchFilter_1.SearchFilter, { facets: facets, filter: filter, query: query, quickFilterFields: [groupField], onFilterChange: onFilterChange, onFilterReset: onFilterReset, onFacetReset: onFacetReset }))),
|
|
@@ -182,12 +211,18 @@ function SearchDialog({ onClose, className, initialMode = 'search', }) {
|
|
|
182
211
|
if (query.trim()) {
|
|
183
212
|
aiSearch.askQuestion(query);
|
|
184
213
|
}
|
|
214
|
+
telemetry.sendSearchAiOpenedMessage({
|
|
215
|
+
method: 'ai_search_input',
|
|
216
|
+
});
|
|
185
217
|
}, onKeyDown: (e) => {
|
|
186
218
|
if (e.key === 'Enter') {
|
|
187
219
|
setMode('ai-dialog');
|
|
188
220
|
if (query.trim()) {
|
|
189
221
|
aiSearch.askQuestion(query);
|
|
190
222
|
}
|
|
223
|
+
telemetry.sendSearchAiOpenedMessage({
|
|
224
|
+
method: 'ai_search_input',
|
|
225
|
+
});
|
|
191
226
|
}
|
|
192
227
|
}, ref: aiQueryRef, tabIndex: 0, role: "option", "aria-selected": "true" },
|
|
193
228
|
react_1.default.createElement(AiStarsIcon_1.AiStarsIcon, { style: { flexShrink: 0 }, color: "var(--search-ai-icon-color)", size: "36px", background: "var(--search-ai-icon-bg-color)", margin: "0 var(--spacing-md) 0 0", borderRadius: "var(--border-radius-lg)" }),
|
|
@@ -224,6 +259,7 @@ function SearchDialog({ onClose, className, initialMode = 'search', }) {
|
|
|
224
259
|
telemetry.sendSearchRecentClickedMessage({
|
|
225
260
|
query,
|
|
226
261
|
index: index.toString(),
|
|
262
|
+
searchSessionId,
|
|
227
263
|
});
|
|
228
264
|
setQuery(query);
|
|
229
265
|
focusSearchInput();
|
|
@@ -299,6 +335,10 @@ const AiDialogHeaderWrapper = styled_components_1.default.div `
|
|
|
299
335
|
align-items: center;
|
|
300
336
|
width: 100%;
|
|
301
337
|
`;
|
|
338
|
+
const AiDialogHeaderActionsWrapper = styled_components_1.default.div `
|
|
339
|
+
display: flex;
|
|
340
|
+
gap: var(--spacing-xxs);
|
|
341
|
+
`;
|
|
302
342
|
const SearchDialogBody = styled_components_1.default.div `
|
|
303
343
|
display: flex;
|
|
304
344
|
flex-direction: row-reverse;
|
|
@@ -400,6 +440,7 @@ const AiDisclaimer = styled_components_1.default.div `
|
|
|
400
440
|
line-height: var(--search-ai-disclaimer-line-height);
|
|
401
441
|
color: var(--search-ai-disclaimer-text-color);
|
|
402
442
|
margin: 0 auto;
|
|
443
|
+
text-align: center;
|
|
403
444
|
`;
|
|
404
445
|
const SearchWithAI = styled_components_1.default.div `
|
|
405
446
|
display: flex;
|
|
@@ -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
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -39,14 +49,14 @@ function SearchGroups({ facets, searchFilter, groupField, onFilterChange, onQuic
|
|
|
39
49
|
onFilterChange(fieldId, values, true);
|
|
40
50
|
};
|
|
41
51
|
return (React.createElement(SearchGroupsWrapper, null,
|
|
42
|
-
React.createElement(GroupTag, { borderless: true, active: !searchFilter.some((item) => item.isQuickFilter), onClick: () => searchFilter.some((item) => item.isQuickFilter) && onQuickFilterReset() }, "All"),
|
|
52
|
+
React.createElement(GroupTag, { borderless: true, active: !searchFilter.some((item) => item.isQuickFilter), onClick: () => searchFilter.some((item) => item.isQuickFilter) && onQuickFilterReset(), selectable: true }, "All"),
|
|
43
53
|
React.createElement(Divider, null),
|
|
44
54
|
groupFacets.flatMap((facet) => facet.values.map((facetCount, index) => {
|
|
45
55
|
var _a;
|
|
46
56
|
const { value, count, isCounterVisible } = facetCount;
|
|
47
57
|
const currentValues = ((_a = searchFilter.find((item) => item.field === facet.field)) === null || _a === void 0 ? void 0 : _a.values) || [];
|
|
48
58
|
const active = currentValues === null || currentValues === void 0 ? void 0 : currentValues.includes(value);
|
|
49
|
-
return (React.createElement(GroupTag, { key: `${facet.field}-${index}`, onClick: () => handleGroupTagClick(value, facet.field, active, currentValues), active: active, borderless: true },
|
|
59
|
+
return (React.createElement(GroupTag, { key: `${facet.field}-${index}`, onClick: () => handleGroupTagClick(value, facet.field, active, currentValues), active: active, borderless: true, selectable: true },
|
|
50
60
|
value,
|
|
51
61
|
" ",
|
|
52
62
|
isCounterVisible && React.createElement("span", null, count)));
|
|
@@ -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
|
};
|