@redocly/theme 0.57.0-next.2 → 0.57.0-next.4
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/lib/components/Breadcrumbs/Breadcrumbs.js +4 -7
- package/lib/components/Buttons/EditPageButton.js +1 -1
- package/lib/components/Catalog/CatalogCardView/CatalogCard.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +1 -35
- package/lib/components/CatalogClassic/CatalogClassicActions.js +1 -1
- package/lib/components/CatalogClassic/CatalogClassicCard.js +1 -1
- package/lib/components/CatalogClassic/CatalogClassicInfoBlock.js +1 -1
- package/lib/components/CodeBlock/CodeBlockControls.js +7 -9
- package/lib/components/Feedback/Feedback.js +1 -1
- package/lib/components/Feedback/ReportDialog.js +1 -1
- package/lib/components/Filter/FilterCheckboxes.js +1 -1
- package/lib/components/Footer/FooterItem.js +1 -1
- package/lib/components/LanguagePicker/LanguagePicker.js +1 -4
- package/lib/components/Logo/Logo.js +1 -1
- package/lib/components/Menu/MenuItem.js +3 -6
- package/lib/components/Navbar/Navbar.js +2 -2
- package/lib/components/Navbar/NavbarItem.js +1 -1
- package/lib/components/Search/SearchDialog.js +9 -15
- package/lib/components/Search/SearchInput.js +1 -1
- package/lib/components/Search/SearchRecent.js +1 -1
- package/lib/components/SidebarActions/SidebarActions.js +3 -3
- package/lib/components/Switch/Switch.d.ts +4 -1
- package/lib/components/Switch/Switch.js +12 -3
- package/lib/components/TableOfContent/TableOfContent.js +1 -1
- package/lib/components/Tooltip/TooltipWrapper.d.ts +2 -2
- package/lib/components/Tooltip/TooltipWrapper.js +2 -4
- package/lib/components/UserMenu/LoginButton.js +1 -1
- package/lib/components/UserMenu/LogoutMenuItem.js +1 -1
- package/lib/core/hooks/__mocks__/use-theme-hooks.d.ts +1 -0
- package/lib/core/hooks/__mocks__/use-theme-hooks.js +1 -0
- package/lib/core/hooks/search/use-search-dialog.js +2 -2
- package/lib/core/hooks/use-color-switcher.js +1 -4
- package/lib/core/hooks/use-product-picker.js +1 -1
- package/lib/core/hooks/use-telemetry-fallback.d.ts +60 -0
- package/lib/core/hooks/use-telemetry-fallback.js +66 -0
- package/lib/core/hooks/use-theme-hooks.js +2 -1
- package/lib/core/types/hooks.d.ts +2 -4
- package/lib/core/types/index.d.ts +0 -1
- package/lib/core/types/index.js +0 -1
- package/lib/icons/PlayIcon/PlayIcon.d.ts +9 -0
- package/lib/icons/PlayIcon/PlayIcon.js +21 -0
- package/lib/icons/WorkflowHierarchyIcon/WorkflowHierarchyIcon.d.ts +9 -0
- package/lib/icons/WorkflowHierarchyIcon/WorkflowHierarchyIcon.js +23 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/layouts/ThreePanelLayout.js +1 -4
- package/lib/markdoc/components/CodeWalkthrough/CodeFilters.js +2 -2
- package/lib/markdoc/components/CodeWalkthrough/CodePanel.js +1 -0
- package/lib/markdoc/components/CodeWalkthrough/CodeToggle.js +1 -1
- package/lib/markdoc/components/CodeWalkthrough/CodeWalkthrough.js +7 -8
- package/package.json +2 -2
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +4 -7
- package/src/components/Buttons/EditPageButton.tsx +1 -1
- package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +4 -76
- package/src/components/CatalogClassic/CatalogClassicActions.tsx +1 -1
- package/src/components/CatalogClassic/CatalogClassicCard.tsx +1 -1
- package/src/components/CatalogClassic/CatalogClassicInfoBlock.tsx +1 -3
- package/src/components/CodeBlock/CodeBlockControls.tsx +19 -9
- package/src/components/Feedback/Feedback.tsx +1 -1
- package/src/components/Feedback/ReportDialog.tsx +1 -1
- package/src/components/Filter/FilterCheckboxes.tsx +1 -1
- package/src/components/Footer/FooterItem.tsx +1 -1
- package/src/components/LanguagePicker/LanguagePicker.tsx +1 -4
- package/src/components/Logo/Logo.tsx +1 -1
- package/src/components/Menu/MenuItem.tsx +3 -6
- package/src/components/Navbar/Navbar.tsx +2 -2
- package/src/components/Navbar/NavbarItem.tsx +1 -3
- package/src/components/Search/SearchDialog.tsx +9 -15
- package/src/components/Search/SearchInput.tsx +1 -1
- package/src/components/Search/SearchRecent.tsx +1 -1
- package/src/components/SidebarActions/SidebarActions.tsx +3 -3
- package/src/components/Switch/Switch.tsx +34 -3
- package/src/components/TableOfContent/TableOfContent.tsx +1 -1
- package/src/components/Tooltip/TooltipWrapper.tsx +4 -6
- package/src/components/UserMenu/LoginButton.tsx +1 -1
- package/src/components/UserMenu/LogoutMenuItem.tsx +1 -1
- package/src/core/hooks/__mocks__/use-theme-hooks.ts +1 -0
- package/src/core/hooks/search/use-search-dialog.ts +2 -2
- package/src/core/hooks/use-color-switcher.ts +1 -4
- package/src/core/hooks/use-product-picker.ts +1 -1
- package/src/core/hooks/use-telemetry-fallback.ts +61 -0
- package/src/core/hooks/use-theme-hooks.ts +2 -1
- package/src/core/types/hooks.ts +10 -4
- package/src/core/types/index.ts +0 -1
- package/src/icons/PlayIcon/PlayIcon.tsx +22 -0
- package/src/icons/WorkflowHierarchyIcon/WorkflowHierarchyIcon.tsx +32 -0
- package/src/index.ts +2 -0
- package/src/layouts/ThreePanelLayout.tsx +1 -4
- package/src/markdoc/components/CodeWalkthrough/CodeFilters.tsx +2 -2
- package/src/markdoc/components/CodeWalkthrough/CodePanel.tsx +1 -0
- package/src/markdoc/components/CodeWalkthrough/CodeToggle.tsx +5 -1
- package/src/markdoc/components/CodeWalkthrough/CodeWalkthrough.tsx +7 -8
- package/lib/core/types/telemetry.d.ts +0 -17
- package/lib/core/types/telemetry.js +0 -3
- package/src/core/types/telemetry.ts +0 -28
|
@@ -20,13 +20,10 @@ function Breadcrumbs(props) {
|
|
|
20
20
|
const isLast = idx === breadcrumbs.length - 1;
|
|
21
21
|
return (react_1.default.createElement(react_1.default.Fragment, { key: idx },
|
|
22
22
|
react_1.default.createElement(Breadcrumb_1.Breadcrumb, { link: breadcrumb.link, label: breadcrumb.label, isActive: isLast, onClick: () => {
|
|
23
|
-
telemetry.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
position: idx + 1,
|
|
28
|
-
totalBreadcrumbs: breadcrumbs.length,
|
|
29
|
-
},
|
|
23
|
+
telemetry.sendBreadcrumbClickedMessage({
|
|
24
|
+
link: breadcrumb.link,
|
|
25
|
+
position: idx + 1,
|
|
26
|
+
totalBreadcrumbs: breadcrumbs.length,
|
|
30
27
|
});
|
|
31
28
|
} }),
|
|
32
29
|
isLast ? null : react_1.default.createElement("span", null, "/")));
|
|
@@ -13,7 +13,7 @@ function EditPageButton({ to }) {
|
|
|
13
13
|
const { useTranslate, useTelemetry } = (0, hooks_1.useThemeHooks)();
|
|
14
14
|
const { translate } = useTranslate();
|
|
15
15
|
const telemetry = useTelemetry();
|
|
16
|
-
return (react_1.default.createElement(EditPageButtonWrapper, { "data-component-name": "Buttons/EditPageButton", target: "_blank", to: to, onClick: () => telemetry.
|
|
16
|
+
return (react_1.default.createElement(EditPageButtonWrapper, { "data-component-name": "Buttons/EditPageButton", target: "_blank", to: to, onClick: () => telemetry.sendEditPageLinkClickedMessage(undefined) },
|
|
17
17
|
react_1.default.createElement(ButtonIcon, null),
|
|
18
18
|
react_1.default.createElement(ButtonText, { "data-translation-key": "markdown.editPage.text" }, translate('markdown.editPage.text', 'Edit'))));
|
|
19
19
|
}
|
|
@@ -22,7 +22,7 @@ function CatalogCard({ entity, catalogConfig }) {
|
|
|
22
22
|
const pathPrefix = (0, utils_1.getPathPrefix)();
|
|
23
23
|
return (react_1.default.createElement(CatalogCardWrapper, { "data-component-name": "Catalog/CatalogCardView/CatalogCard", onClick: () => {
|
|
24
24
|
window.location.assign(`${pathPrefix}/catalogs/${catalogConfig.slug}/entities/${entity.key}`);
|
|
25
|
-
telemetry.
|
|
25
|
+
telemetry.sendCatalogItemClickedMessage(undefined);
|
|
26
26
|
} },
|
|
27
27
|
react_1.default.createElement(CardContent, null,
|
|
28
28
|
react_1.default.createElement(CardHeader, null,
|
|
@@ -8,18 +8,13 @@ const react_1 = __importDefault(require("react"));
|
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
9
|
const react_router_dom_1 = require("react-router-dom");
|
|
10
10
|
const utils_1 = require("../../../core/utils");
|
|
11
|
-
const ArrowLeftIcon_1 = require("../../../icons/ArrowLeftIcon/ArrowLeftIcon");
|
|
12
11
|
const CatalogPageDescription_1 = require("../../../components/Catalog/CatalogPageDescription");
|
|
13
12
|
const CatalogEntityProperties_1 = require("../../../components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties");
|
|
14
13
|
const CatalogEntityMetadata_1 = require("../../../components/Catalog/CatalogEntity/CatalogEntityMetadata");
|
|
15
14
|
const CatalogEntityLinks_1 = require("../../../components/Catalog/CatalogEntity/CatalogEntityLinks");
|
|
16
15
|
const Breadcrumbs_1 = require("../../../components/Breadcrumbs/Breadcrumbs");
|
|
17
|
-
const Sidebar_1 = require("../../../components/Sidebar/Sidebar");
|
|
18
|
-
const Menu_1 = require("../../../components/Menu/Menu");
|
|
19
|
-
const Button_1 = require("../../../components/Button/Button");
|
|
20
16
|
const CatalogEntityRelations_1 = require("../../../components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations");
|
|
21
17
|
const hooks_1 = require("../../../core/hooks");
|
|
22
|
-
const SidebarActions_1 = require("../../../components/SidebarActions/SidebarActions");
|
|
23
18
|
const CatalogEntitySchema_1 = require("../../../components/Catalog/CatalogEntity/CatalogEntitySchema");
|
|
24
19
|
const CatalogEntityMethodAndPath_1 = require("../../../components/Catalog/CatalogEntity/CatalogEntityMethodAndPath");
|
|
25
20
|
const CatalogEntityRelationsGraph_lazy_1 = require("../../../components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy");
|
|
@@ -39,22 +34,8 @@ function CatalogEntity({ entity, entitiesCatalogConfig, catalogConfig, initialRe
|
|
|
39
34
|
const { translate } = useTranslate();
|
|
40
35
|
const linkToMainCatalog = `catalogs/${catalogConfig.slug}`;
|
|
41
36
|
const linkToMainCatalogLabel = translate(catalogConfig.titleTranslationKey);
|
|
42
|
-
const {
|
|
43
|
-
const { pathname } = (0, react_router_dom_1.useLocation)();
|
|
44
|
-
const linkBase = `${linkToMainCatalog}/entities/${entity.key}`;
|
|
45
|
-
const menuItemDefs = [
|
|
46
|
-
{ label: 'Overview', path: linkBase, end: true },
|
|
47
|
-
{ label: 'Relations Graph', path: `${linkBase}/relations-graph`, end: true },
|
|
48
|
-
];
|
|
49
|
-
const sidebarMenuItems = menuItemDefs.map(({ label, path, end }) => ({
|
|
50
|
-
label,
|
|
51
|
-
link: path,
|
|
52
|
-
active: Boolean((0, react_router_dom_1.matchPath)({ path: `/${path}`, end }, pathname)),
|
|
53
|
-
items: [],
|
|
54
|
-
hasActiveSubItem: false,
|
|
55
|
-
}));
|
|
37
|
+
const { searchQuery, setSearchQuery } = useCatalog();
|
|
56
38
|
return (react_1.default.createElement(CatalogPageWrapper, { "data-component-name": "Catalog/CatalogEntity/CatalogEntity" },
|
|
57
|
-
react_1.default.createElement(CatalogSidebar, { collapsed: collapsedSidebar, header: react_1.default.createElement(BackLink, { icon: react_1.default.createElement(ArrowLeftIcon_1.ArrowLeftIcon, null), iconPosition: "left", variant: "ghost", size: "medium", "data-component-name": "Sidebar/BackButton", to: linkToMainCatalog }, collapsedSidebar ? ('') : (react_1.default.createElement("div", { "data-translation-key": "sidebar.menu.backLabel" }, translate('sidebar.menu.backLabel')))), menu: react_1.default.createElement(Menu_1.Menu, { items: sidebarMenuItems }), footer: react_1.default.createElement(SidebarActions_1.SidebarActions, { layout: layout, collapsedSidebar: collapsedSidebar, isApiDocs: false, onChangeViewClick: onChangeViewClick, onChangeCollapseSidebarClick: onChangeCollapseSidebarClick }) }),
|
|
58
39
|
react_1.default.createElement(CatalogPageContent, null,
|
|
59
40
|
react_1.default.createElement(Breadcrumbs_1.Breadcrumbs, { additionalBreadcrumbs: [
|
|
60
41
|
{ label: linkToMainCatalogLabel, link: linkToMainCatalog },
|
|
@@ -113,14 +94,6 @@ const CatalogPageContent = styled_components_1.default.main `
|
|
|
113
94
|
padding: var(--catalog-page-padding);
|
|
114
95
|
}
|
|
115
96
|
`;
|
|
116
|
-
const CatalogSidebar = (0, styled_components_1.default)(Sidebar_1.Sidebar) `
|
|
117
|
-
display: none;
|
|
118
|
-
|
|
119
|
-
@media screen and (min-width: ${utils_1.breakpoints.medium}) {
|
|
120
|
-
display: flex;
|
|
121
|
-
}
|
|
122
|
-
--menu-container-padding-top: 0;
|
|
123
|
-
`;
|
|
124
97
|
const CatalogEntityPageWrapper = styled_components_1.default.div `
|
|
125
98
|
display: flex;
|
|
126
99
|
flex-direction: column;
|
|
@@ -138,11 +111,4 @@ const CatalogTwoColumnsSection = styled_components_1.default.section `
|
|
|
138
111
|
gap: 24px;
|
|
139
112
|
align-items: start;
|
|
140
113
|
`;
|
|
141
|
-
const BackLink = (0, styled_components_1.default)(Button_1.Button) `
|
|
142
|
-
padding: var(--spacing-unit) 0;
|
|
143
|
-
height: calc(var(--line-height-base) + var(--spacing-unit) * 2);
|
|
144
|
-
justify-content: flex-start;
|
|
145
|
-
width: 100%;
|
|
146
|
-
margin-bottom: 0px;
|
|
147
|
-
`;
|
|
148
114
|
//# sourceMappingURL=CatalogEntity.js.map
|
|
@@ -51,7 +51,7 @@ function CatalogClassicActions(props) {
|
|
|
51
51
|
return (React.createElement(CatalogActionsWrapper, { "data-component-name": "CatalogClassic/CatalogClassicActions" },
|
|
52
52
|
React.createElement(Button_1.Button, { variant: "ghost", size: "small", icon: React.createElement(FilterIcon_1.FilterIcon, null), iconPosition: "left", onClick: () => {
|
|
53
53
|
onOpenFilter();
|
|
54
|
-
telemetry.
|
|
54
|
+
telemetry.sendCatalogActionsButtonClickedMessage(undefined);
|
|
55
55
|
}, "data-translation-key": "catalog.filters.title" }, translate('catalog.filters.title', 'Filters')),
|
|
56
56
|
activeFilters > 0 ? React.createElement(CounterTag_1.CounterTag, { borderless: true }, activeFilters) : null));
|
|
57
57
|
}
|
|
@@ -54,7 +54,7 @@ function CatalogClassicCard({ item }) {
|
|
|
54
54
|
const { useTelemetry } = (0, hooks_1.useThemeHooks)();
|
|
55
55
|
const telemetry = useTelemetry();
|
|
56
56
|
return (React.createElement(Link_1.Link, { key: item.docsLink || item.link, to: item.docsLink || item.link },
|
|
57
|
-
React.createElement(StyledCard, { "data-component-name": "CatalogClassic/CatalogClassicCard", onClick: () => telemetry.
|
|
57
|
+
React.createElement(StyledCard, { "data-component-name": "CatalogClassic/CatalogClassicCard", onClick: () => telemetry.sendCatalogItemClickedMessage(undefined) },
|
|
58
58
|
React.createElement(CardContent, null,
|
|
59
59
|
React.createElement(CardTitleWrapper, null,
|
|
60
60
|
React.createElement(CardTitle, null,
|
|
@@ -21,7 +21,7 @@ function ScorecardBadge(props) {
|
|
|
21
21
|
const { useTelemetry } = (0, hooks_1.useThemeHooks)();
|
|
22
22
|
const telemetry = useTelemetry();
|
|
23
23
|
return (react_1.default.createElement(Link_1.Link, { to: slug },
|
|
24
|
-
react_1.default.createElement(Tag_1.Tag, { onClick: () => telemetry.
|
|
24
|
+
react_1.default.createElement(Tag_1.Tag, { onClick: () => telemetry.sendScorecardLinkClickedMessage({ action: 'click' }), withStatusDot: true, statusDotColor: `var(${colorVariable})` }, level)));
|
|
25
25
|
}
|
|
26
26
|
const CatalogInfoBlockWrapper = styled_components_1.default.div `
|
|
27
27
|
position: relative;
|
|
@@ -20,7 +20,8 @@ const CodeBlockDropdown_1 = require("../../components/CodeBlock/CodeBlockDropdow
|
|
|
20
20
|
function CodeBlockControls({ children, className, title, controls, tabs, dropdown, }) {
|
|
21
21
|
var _a, _b, _c, _d, _e;
|
|
22
22
|
const { codeSnippet } = (0, hooks_1.useThemeConfig)();
|
|
23
|
-
const { useTelemetry } = (0, hooks_1.useThemeHooks)();
|
|
23
|
+
const { useTelemetry, useTranslate } = (0, hooks_1.useThemeHooks)();
|
|
24
|
+
const { translate } = useTranslate();
|
|
24
25
|
const telemetry = useTelemetry();
|
|
25
26
|
const controlsType = (codeSnippet === null || codeSnippet === void 0 ? void 0 : codeSnippet.elementFormat) || 'icon';
|
|
26
27
|
const { copy, expand, collapse, select, deselect, report } = controls || {
|
|
@@ -37,15 +38,15 @@ function CodeBlockControls({ children, className, title, controls, tabs, dropdow
|
|
|
37
38
|
tabs && react_1.default.createElement(CodeBlockTabs_1.CodeBlockTabs, { tabs: tabs }),
|
|
38
39
|
react_1.default.createElement(ControlsWrapper, null,
|
|
39
40
|
dropdown && react_1.default.createElement(CodeBlockDropdown_1.CodeBlockDropdown, Object.assign({}, dropdown)),
|
|
40
|
-
report && !((_a = report === null || report === void 0 ? void 0 : report.props) === null || _a === void 0 ? void 0 : _a.hide) ? (react_1.default.createElement(TooltipWrapper_1.TooltipWrapper, {
|
|
41
|
+
report && !((_a = report === null || report === void 0 ? void 0 : report.props) === null || _a === void 0 ? void 0 : _a.hide) ? (react_1.default.createElement(TooltipWrapper_1.TooltipWrapper, { tip: translate('codeSnippet.report.tooltipText', 'Report a problem'), placement: "top" },
|
|
41
42
|
react_1.default.createElement(ControlButton, Object.assign({ variant: "text", size: "small", "data-testid": "report-button", icon: controlsType === 'icon' ? react_1.default.createElement(WarningSquareIcon_1.WarningSquareIcon, { size: "18px" }) : undefined }, report.props), controlsType != 'icon' && (((_b = report.props) === null || _b === void 0 ? void 0 : _b.buttonText) || 'Report')))) : null,
|
|
42
|
-
expand && !((_c = codeSnippet === null || codeSnippet === void 0 ? void 0 : codeSnippet.expand) === null || _c === void 0 ? void 0 : _c.hide) ? (react_1.default.createElement(TooltipWrapper_1.TooltipWrapper, {
|
|
43
|
+
expand && !((_c = codeSnippet === null || codeSnippet === void 0 ? void 0 : codeSnippet.expand) === null || _c === void 0 ? void 0 : _c.hide) ? (react_1.default.createElement(TooltipWrapper_1.TooltipWrapper, { tip: translate('codeSnippet.expand.tooltipText', 'Expand all'), placement: "top" },
|
|
43
44
|
react_1.default.createElement(ControlButton, { variant: "text", size: "small", "data-testid": "expand-all", icon: controlsType === 'icon' ? react_1.default.createElement(MaximizeIcon_1.MaximizeIcon, null) : undefined, onClick: expand === null || expand === void 0 ? void 0 : expand.onClick }, controlsType !== 'icon' && ((expand === null || expand === void 0 ? void 0 : expand.label) || 'Expand all')))) : null,
|
|
44
|
-
collapse && !((_d = codeSnippet === null || codeSnippet === void 0 ? void 0 : codeSnippet.collapse) === null || _d === void 0 ? void 0 : _d.hide) ? (react_1.default.createElement(TooltipWrapper_1.TooltipWrapper, {
|
|
45
|
+
collapse && !((_d = codeSnippet === null || codeSnippet === void 0 ? void 0 : codeSnippet.collapse) === null || _d === void 0 ? void 0 : _d.hide) ? (react_1.default.createElement(TooltipWrapper_1.TooltipWrapper, { tip: translate('codeSnippet.collapse.tooltipText', 'Collapse all'), placement: "top" },
|
|
45
46
|
react_1.default.createElement(ControlButton, { variant: "text", size: "small", "data-testid": "collapse-all", icon: controlsType === 'icon' ? react_1.default.createElement(MinimizeIcon_1.MinimizeIcon, null) : undefined, onClick: collapse === null || collapse === void 0 ? void 0 : collapse.onClick }, controlsType !== 'icon' && ((expand === null || expand === void 0 ? void 0 : expand.label) || 'Collapse all')))) : null,
|
|
46
47
|
select ? (react_1.default.createElement(ControlButton, { variant: "text", size: "small", "data-testid": "select-all", icon: controlsType === 'icon' ? react_1.default.createElement(SelectIcon_1.SelectIcon, null) : undefined, onClick: select === null || select === void 0 ? void 0 : select.onClick }, controlsType !== 'icon' && (select === null || select === void 0 ? void 0 : select.label) ? select.label : 'Select all')) : null,
|
|
47
48
|
deselect ? (react_1.default.createElement(ControlButton, { variant: "text", size: "small", "data-testid": "clear-all", icon: controlsType === 'icon' ? react_1.default.createElement(DeselectIcon_1.DeselectIcon, null) : undefined, onClick: deselect === null || deselect === void 0 ? void 0 : deselect.onClick }, controlsType !== 'icon' && (deselect === null || deselect === void 0 ? void 0 : deselect.label) ? deselect.label : 'Clear all')) : null,
|
|
48
|
-
copy && !((_e = codeSnippet === null || codeSnippet === void 0 ? void 0 : codeSnippet.copy) === null || _e === void 0 ? void 0 : _e.hide) ? (react_1.default.createElement(TooltipWrapper_1.TooltipWrapper, {
|
|
49
|
+
copy && !((_e = codeSnippet === null || codeSnippet === void 0 ? void 0 : codeSnippet.copy) === null || _e === void 0 ? void 0 : _e.hide) ? (react_1.default.createElement(TooltipWrapper_1.TooltipWrapper, { tip: translate('codeSnippet.copy.tooltipText', 'Copy to clipboard'), placement: "top" },
|
|
49
50
|
react_1.default.createElement(StyledCopyButton, { data: copy.data, "data-source": copy.dataSource, "data-hash": copy.dataHash, type: controlsType, toasterPlacement: copy.toasterPlacement, toasterDuration: copy.toasterDuration, buttonText: copy.label, onCopyClick: () => {
|
|
50
51
|
var _a;
|
|
51
52
|
// If there already is a click handler, events should be handled there, cause they pass additional data
|
|
@@ -53,10 +54,7 @@ function CodeBlockControls({ children, className, title, controls, tabs, dropdow
|
|
|
53
54
|
(_a = copy === null || copy === void 0 ? void 0 : copy.onClick) === null || _a === void 0 ? void 0 : _a.call(copy);
|
|
54
55
|
}
|
|
55
56
|
else {
|
|
56
|
-
telemetry.
|
|
57
|
-
type: 'openapi_docs.copy_code_snippet.clicked',
|
|
58
|
-
payload: { snippetType: 'copy' },
|
|
59
|
-
});
|
|
57
|
+
telemetry.sendCopyCodeSnippetClickedMessage({ snippetType: 'copy' });
|
|
60
58
|
}
|
|
61
59
|
} }))) : null))) : null;
|
|
62
60
|
return children || controls ? (react_1.default.createElement(ContainerWrapper, { "data-component-name": "CodeBlock/CodeBlockControls", className: className, "$isEmptyTitle": isEmptyTitle }, children ? children : defaultControls)) : null;
|
|
@@ -64,7 +64,7 @@ function Feedback(props) {
|
|
|
64
64
|
return (React.createElement(FeedbackWrapper, { "data-component-name": "Feedback/Feedback" },
|
|
65
65
|
React.createElement(FeedbackComponent, { settings: settings, onSubmit: (values) => {
|
|
66
66
|
submitFeedback({ type, values, path });
|
|
67
|
-
telemetry.
|
|
67
|
+
telemetry.sendFeedbackMessage({ feedbackType: type });
|
|
68
68
|
} })));
|
|
69
69
|
};
|
|
70
70
|
return React.createElement(React.Fragment, { key: pathname }, renderFeedbackComponent());
|
|
@@ -34,7 +34,7 @@ function ReportDialog({ location, settings, onSubmit, onCancel, submitFeedback,
|
|
|
34
34
|
path: pathname,
|
|
35
35
|
lang,
|
|
36
36
|
});
|
|
37
|
-
telemetry.
|
|
37
|
+
telemetry.sendCodeSnippetReportedMessage(undefined);
|
|
38
38
|
onSubmit();
|
|
39
39
|
}), isDialog: true, onCancel: onCancel }))));
|
|
40
40
|
}
|
|
@@ -24,7 +24,7 @@ function FilterCheckboxes({ filter, filterValuesCasing, showCounter = true, }) {
|
|
|
24
24
|
const id = 'filter--' + filter.property + '--' + value;
|
|
25
25
|
return (react_1.default.createElement(FilterCheckboxOption, { key: id, role: "link", onClick: () => {
|
|
26
26
|
filter.toggleOption(value);
|
|
27
|
-
telemetry.
|
|
27
|
+
telemetry.sendFilterCheckboxToggledMessage({ id });
|
|
28
28
|
} },
|
|
29
29
|
react_1.default.createElement(CheckboxIcon_1.CheckboxIcon, { checked: filter.selectedOptions instanceof Set
|
|
30
30
|
? filter.selectedOptions.has(value) ||
|
|
@@ -20,7 +20,7 @@ function FooterItem({ item, iconsOnly, className }) {
|
|
|
20
20
|
}
|
|
21
21
|
const hasIcon = Boolean(item.icon || item.srcSet);
|
|
22
22
|
const iconWithoutLabel = Boolean(item.label === item.link && hasIcon);
|
|
23
|
-
return (react_1.default.createElement(FooterItemWrapper, { className: className, "data-component-name": "Footer/FooterItem", iconsOnly: iconsOnly, item: item }, item.type === 'separator' ? (react_1.default.createElement(FooterSeparator, { "data-translation-key": item.labelTranslationKey }, translate(item.labelTranslationKey, item.label))) : (react_1.default.createElement(FooterLink, { to: item.link, external: item.external, target: item.target, "data-testid": item.label, onClick: () => telemetry.
|
|
23
|
+
return (react_1.default.createElement(FooterItemWrapper, { className: className, "data-component-name": "Footer/FooterItem", iconsOnly: iconsOnly, item: item }, item.type === 'separator' ? (react_1.default.createElement(FooterSeparator, { "data-translation-key": item.labelTranslationKey }, translate(item.labelTranslationKey, item.label))) : (react_1.default.createElement(FooterLink, { to: item.link, external: item.external, target: item.target, "data-testid": item.label, onClick: () => telemetry.sendFooterItemClickedMessage(undefined), "data-translation-key": item.labelTranslationKey },
|
|
24
24
|
hasIcon ? (react_1.default.createElement(FooterLinkIcon, { iconsOnly: iconsOnly },
|
|
25
25
|
react_1.default.createElement(GenericIcon_1.GenericIcon, { icon: item.icon, srcSet: item.srcSet }))) : null,
|
|
26
26
|
!iconWithoutLabel ? translate(item.labelTranslationKey, item.label) : null,
|
|
@@ -26,10 +26,7 @@ function LanguagePicker(props) {
|
|
|
26
26
|
onAction: () => {
|
|
27
27
|
setLocale(locale.code);
|
|
28
28
|
props.onChangeLanguage(locale.code);
|
|
29
|
-
telemetry.
|
|
30
|
-
type: 'language_picker_locale.changed',
|
|
31
|
-
payload: { locale: locale.code },
|
|
32
|
-
});
|
|
29
|
+
telemetry.sendLanguagePickerLocaleChangedMessage({ locale: locale.code });
|
|
33
30
|
},
|
|
34
31
|
active: locale.code === currentLocale.code,
|
|
35
32
|
suffix: locale.code === currentLocale.code && react_1.default.createElement(CheckmarkIcon_1.CheckmarkIcon, null),
|
|
@@ -28,7 +28,7 @@ function Logo(_a) {
|
|
|
28
28
|
return null;
|
|
29
29
|
}
|
|
30
30
|
const image = (react_1.default.createElement(Image_1.Image, { className: className, src: config.image, srcSet: config.srcSet, alt: config.altText }));
|
|
31
|
-
return (react_1.default.createElement(LogoWrapper, Object.assign({ "data-component-name": "Logo/Logo", className: className }, otherProps), config.link ? (react_1.default.createElement(Link_1.Link, { to: config.link, onClick: () => telemetry.
|
|
31
|
+
return (react_1.default.createElement(LogoWrapper, Object.assign({ "data-component-name": "Logo/Logo", className: className }, otherProps), config.link ? (react_1.default.createElement(Link_1.Link, { to: config.link, onClick: () => telemetry.sendLogoClickedMessage(undefined) }, image)) : (image)));
|
|
32
32
|
}
|
|
33
33
|
const LogoWrapper = styled_components_1.default.div `
|
|
34
34
|
max-width: var(--logo-max-width);
|
|
@@ -55,12 +55,9 @@ function MenuItem(props) {
|
|
|
55
55
|
const hasChevron = isNested && !isDrilldown;
|
|
56
56
|
const hasHttpTag = !!item.httpVerb || type === constants_1.MenuItemType.Operation;
|
|
57
57
|
const handleOnClick = () => {
|
|
58
|
-
telemetry.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
label: item.label,
|
|
62
|
-
type: item.type === 'link' || item.type === 'group' ? item.type : undefined,
|
|
63
|
-
},
|
|
58
|
+
telemetry.sendSidebarItemClickedMessage({
|
|
59
|
+
label: item.label,
|
|
60
|
+
type: item.type === 'link' || item.type === 'group' ? item.type : undefined,
|
|
64
61
|
});
|
|
65
62
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
66
63
|
if (isNested) {
|
|
@@ -45,11 +45,11 @@ function Navbar({ className }) {
|
|
|
45
45
|
react_1.default.createElement(MobileMenuButton, { variant: "text", "data-testid": "mobile-menu-button", onClick: isOpen
|
|
46
46
|
? () => {
|
|
47
47
|
closeMobileMenu();
|
|
48
|
-
telemetry.
|
|
48
|
+
telemetry.sendMobileMenuButtonCloseClickedMessage(undefined);
|
|
49
49
|
}
|
|
50
50
|
: () => {
|
|
51
51
|
openMobileMenu();
|
|
52
|
-
telemetry.
|
|
52
|
+
telemetry.sendMobileMenuButtonOpenClickedMessage(undefined);
|
|
53
53
|
}, icon: isOpen ? react_1.default.createElement(CloseIcon_1.CloseIcon, null) : react_1.default.createElement(MenuIcon_1.MenuIcon, null), "aria-label": isOpen ? 'Close menu button' : 'Open menu button' }),
|
|
54
54
|
hideUserMenu ? null : react_1.default.createElement(UserMenu_1.UserMenu, null))));
|
|
55
55
|
}
|
|
@@ -27,7 +27,7 @@ function NavbarItem({ navItem, className }) {
|
|
|
27
27
|
const normalizedPath = (item.link && item.link !== '/' ? (0, utils_1.removeTrailingSlash)(item.link) : item.link) || '';
|
|
28
28
|
const isActive = pathname ===
|
|
29
29
|
(0, utils_1.withPathPrefix)((0, utils_1.getPathnameForLocale)(normalizedPath, defaultLocale, currentLocale, locales));
|
|
30
|
-
const itemContent = (react_1.default.createElement(NavbarMenuItem, { as: item.link ? Link_1.Link : undefined, active: isActive, className: className, onClick: () => telemetry.
|
|
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)),
|
|
33
33
|
item.external ? react_1.default.createElement(ExternalLinkIcon, { size: "10px" }) : null));
|
|
@@ -110,15 +110,12 @@ function SearchDialog({ onClose, className }) {
|
|
|
110
110
|
}
|
|
111
111
|
return (react_1.default.createElement(SearchItem_1.SearchItem, { key: `${index}-${item.document.id}`, item: item, product: itemProduct, innerRef: innerRef, onClick: () => {
|
|
112
112
|
addSearchHistoryItem(query);
|
|
113
|
-
telemetry.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
index: index.toString(),
|
|
120
|
-
searchEngine: mode,
|
|
121
|
-
},
|
|
113
|
+
telemetry.sendSearchResultClickedMessage({
|
|
114
|
+
query,
|
|
115
|
+
url: item.document.url,
|
|
116
|
+
totalResults: results.length.toString(),
|
|
117
|
+
index: index.toString(),
|
|
118
|
+
searchEngine: mode,
|
|
122
119
|
});
|
|
123
120
|
onClose();
|
|
124
121
|
} }));
|
|
@@ -223,12 +220,9 @@ function SearchDialog({ onClose, className }) {
|
|
|
223
220
|
translate('search.loading', 'Loading...'))) : (react_1.default.createElement(SearchMessage, { "data-translation-key": "search.noResults" },
|
|
224
221
|
react_1.default.createElement("b", null, translate('search.noResults.title', 'No results'))))) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
225
222
|
react_1.default.createElement(SearchRecent_1.SearchRecent, { onSelect: (query, index) => {
|
|
226
|
-
telemetry.
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
query,
|
|
230
|
-
index: index.toString(),
|
|
231
|
-
},
|
|
223
|
+
telemetry.sendSearchRecentClickedMessage({
|
|
224
|
+
query,
|
|
225
|
+
index: index.toString(),
|
|
232
226
|
});
|
|
233
227
|
setQuery(query);
|
|
234
228
|
focusSearchInput();
|
|
@@ -27,7 +27,7 @@ function SearchInput({ placeholder, value, onChange, isLoading, showReturnButton
|
|
|
27
27
|
const handleOnReset = () => {
|
|
28
28
|
onChange('');
|
|
29
29
|
addSearchHistoryItem(value);
|
|
30
|
-
telemetry.
|
|
30
|
+
telemetry.sendSearchInputResetButtonClickedMessage(undefined);
|
|
31
31
|
};
|
|
32
32
|
return (react_1.default.createElement(SearchInputWrapper, { "data-component-name": "Search/SearchInput", className: className },
|
|
33
33
|
showReturnButton ? (react_1.default.createElement(Button_1.Button, { icon: react_1.default.createElement(ChevronLeftIcon_1.ChevronLeftIcon, null), onClick: onReturn })) : value && isLoading ? (react_1.default.createElement(Spinner_1.Spinner, { size: "24px", color: "--search-input-icon-color" })) : (react_1.default.createElement(SearchIcon_1.SearchIcon, { size: "24px", color: "--search-input-icon-color" })),
|
|
@@ -44,7 +44,7 @@ function SearchRecent({ onSelect, className }) {
|
|
|
44
44
|
const handleOnRemove = (e, item) => {
|
|
45
45
|
e.stopPropagation();
|
|
46
46
|
removeSearchHistoryItem(item);
|
|
47
|
-
telemetry.
|
|
47
|
+
telemetry.sendSearchRecentRemoveButtonClickedMessage(undefined);
|
|
48
48
|
};
|
|
49
49
|
const handleKeyDown = (e, item, index) => {
|
|
50
50
|
if (e.key === 'Enter') {
|
|
@@ -21,10 +21,10 @@ const SidebarActions = ({ layout, hideCollapseSidebarButton = false, collapsedSi
|
|
|
21
21
|
!hideCollapseSidebarButton && (react_1.default.createElement(Button_1.Button, { onClick: () => {
|
|
22
22
|
onChangeCollapseSidebarClick();
|
|
23
23
|
if (collapsedSidebar) {
|
|
24
|
-
telemetry.
|
|
24
|
+
telemetry.sendSidebarItemExpandedMessage(undefined);
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
|
-
telemetry.
|
|
27
|
+
telemetry.sendSidebarItemCollapsedMessage(undefined);
|
|
28
28
|
}
|
|
29
29
|
}, title: collapsedSidebar
|
|
30
30
|
? translate('sidebar.actions.show', 'Show sidebar')
|
|
@@ -32,7 +32,7 @@ const SidebarActions = ({ layout, hideCollapseSidebarButton = false, collapsedSi
|
|
|
32
32
|
isApiDocs && (react_1.default.createElement(styled_1.ControlsWrapChangeLayoutButtons, { isCollapsed: collapsedSidebar },
|
|
33
33
|
react_1.default.createElement(ChangeViewButton_1.ChangeViewButton, { collapsedSidebar: collapsedSidebar, layout: layout, onClick: () => {
|
|
34
34
|
onChangeViewClick();
|
|
35
|
-
telemetry.
|
|
35
|
+
telemetry.sendChangeLayoutButtonClickedMessage(undefined);
|
|
36
36
|
} }))),
|
|
37
37
|
!collapsedSidebar && requestAccessButton));
|
|
38
38
|
};
|
|
@@ -2,6 +2,9 @@ import type { JSX } from 'react';
|
|
|
2
2
|
export type SwitchProps = {
|
|
3
3
|
value: boolean;
|
|
4
4
|
onChange: (value: boolean) => void;
|
|
5
|
+
onFocus?: () => void;
|
|
5
6
|
disabled?: boolean;
|
|
7
|
+
stopPropagation?: boolean;
|
|
8
|
+
className?: string;
|
|
6
9
|
};
|
|
7
|
-
export declare function Switch({ value, disabled, onChange }: SwitchProps): JSX.Element;
|
|
10
|
+
export declare function Switch({ value, disabled, onChange, onFocus, stopPropagation, className, }: SwitchProps): JSX.Element;
|
|
@@ -29,13 +29,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.Switch = Switch;
|
|
30
30
|
const react_1 = __importDefault(require("react"));
|
|
31
31
|
const styled_components_1 = __importStar(require("styled-components"));
|
|
32
|
-
function Switch({ value = false, disabled = false, onChange }) {
|
|
33
|
-
const handleClick = () => {
|
|
32
|
+
function Switch({ value = false, disabled = false, onChange, onFocus, stopPropagation = false, className, }) {
|
|
33
|
+
const handleClick = (event) => {
|
|
34
34
|
if (disabled)
|
|
35
35
|
return;
|
|
36
|
+
if (stopPropagation) {
|
|
37
|
+
event.stopPropagation();
|
|
38
|
+
}
|
|
36
39
|
onChange(!value);
|
|
37
40
|
};
|
|
38
|
-
|
|
41
|
+
const handleFocus = (event) => {
|
|
42
|
+
if (stopPropagation) {
|
|
43
|
+
event.stopPropagation();
|
|
44
|
+
}
|
|
45
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus();
|
|
46
|
+
};
|
|
47
|
+
return (react_1.default.createElement(SwitchWrapper, { tabIndex: disabled ? -1 : 0, onFocus: handleFocus, onClick: handleClick, role: "switch", "aria-checked": value, "aria-disabled": disabled, selected: value, disabled: disabled, className: className },
|
|
39
48
|
react_1.default.createElement(Knob, { selected: value, disabled: disabled })));
|
|
40
49
|
}
|
|
41
50
|
const SwitchWrapper = styled_components_1.default.div `
|
|
@@ -55,7 +55,7 @@ function TableOfContent(props) {
|
|
|
55
55
|
const href = '#' + heading.id;
|
|
56
56
|
return (React.createElement(TableOfContentMenuItem, { key: href + idx, href: href, depth: heading.depth - leastDepth + 1 || 0, className: activeHeading === heading.id ? 'active' : '', dangerouslySetInnerHTML: { __html: heading.value || '' }, "data-testid": `toc-${heading.value}`, onClick: (e) => {
|
|
57
57
|
e.preventDefault();
|
|
58
|
-
telemetry.
|
|
58
|
+
telemetry.sendTocItemClickedMessage(undefined);
|
|
59
59
|
handleHeadingClick(heading.id);
|
|
60
60
|
} }));
|
|
61
61
|
}))));
|
|
@@ -2,11 +2,11 @@ import type { JSX, ReactElement } from 'react';
|
|
|
2
2
|
import type { TooltipProps } from '../../components/Tooltip/Tooltip';
|
|
3
3
|
export type TooltipWrapperProps = {
|
|
4
4
|
children: ReactElement;
|
|
5
|
-
|
|
5
|
+
tip: string;
|
|
6
6
|
placement?: TooltipProps['placement'];
|
|
7
7
|
width?: string;
|
|
8
8
|
className?: string;
|
|
9
9
|
showOnHover?: boolean;
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
};
|
|
12
|
-
export declare function TooltipWrapper({ children,
|
|
12
|
+
export declare function TooltipWrapper({ children, tip, placement, width, className, showOnHover, disabled, }: TooltipWrapperProps): JSX.Element;
|
|
@@ -8,10 +8,8 @@ const styled_components_1 = __importDefault(require("styled-components"));
|
|
|
8
8
|
const react_1 = __importDefault(require("react"));
|
|
9
9
|
const hooks_1 = require("../../core/hooks");
|
|
10
10
|
const Tooltip_1 = require("../../components/Tooltip/Tooltip");
|
|
11
|
-
function TooltipWrapper({ children,
|
|
12
|
-
const { useTranslate } = (0, hooks_1.useThemeHooks)();
|
|
11
|
+
function TooltipWrapper({ children, tip, placement = 'top', width = 'max-content', className = '', showOnHover = true, disabled = false, }) {
|
|
13
12
|
const tooltip = (0, hooks_1.useControl)();
|
|
14
|
-
const { translate } = useTranslate();
|
|
15
13
|
const handleMouseEnter = () => {
|
|
16
14
|
if (showOnHover && !disabled) {
|
|
17
15
|
tooltip.handleOpen();
|
|
@@ -27,7 +25,7 @@ function TooltipWrapper({ children, tooltipTranslationKey, placement = 'top', wi
|
|
|
27
25
|
tooltip.handleClose();
|
|
28
26
|
}
|
|
29
27
|
};
|
|
30
|
-
return (react_1.default.createElement(Tooltip_1.Tooltip, { className: className, tip:
|
|
28
|
+
return (react_1.default.createElement(Tooltip_1.Tooltip, { className: className, tip: tip, isOpen: tooltip.isOpened, placement: placement, width: width },
|
|
31
29
|
react_1.default.createElement(TooltipEventWrapper, { onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onClick: handleClick }, children)));
|
|
32
30
|
}
|
|
33
31
|
const TooltipEventWrapper = styled_components_1.default.div `
|
|
@@ -12,6 +12,6 @@ function LoginButton({ href, className }) {
|
|
|
12
12
|
const { translate } = useTranslate();
|
|
13
13
|
const telemetry = useTelemetry();
|
|
14
14
|
return (react_1.default.createElement("div", { "data-component-name": "UserMenu/LoginButton", className: className },
|
|
15
|
-
react_1.default.createElement(Button_1.Button, { "data-translation-key": "userMenu.login", to: href, onClick: () => telemetry.
|
|
15
|
+
react_1.default.createElement(Button_1.Button, { "data-translation-key": "userMenu.login", to: href, onClick: () => telemetry.sendLoginButtonClickedMessage(undefined), "data-testid": "login-btn", extraClass: className, variant: "primary", size: "medium" }, translate('userMenu.login', 'Login'))));
|
|
16
16
|
}
|
|
17
17
|
//# sourceMappingURL=LoginButton.js.map
|
|
@@ -14,7 +14,7 @@ function LogoutMenuItem({ iconOnly, className }) {
|
|
|
14
14
|
const telemetry = useTelemetry();
|
|
15
15
|
const { translate } = useTranslate();
|
|
16
16
|
const handleClick = () => {
|
|
17
|
-
telemetry.
|
|
17
|
+
telemetry.sendLogoutMenuItemClickedMessage(undefined);
|
|
18
18
|
handleLogout();
|
|
19
19
|
};
|
|
20
20
|
return (react_1.default.createElement(DropdownMenuItem_1.DropdownMenuItem, { className: className, dangerous: true, "data-component-name": "UserMenu/LogoutMenuItem", onAction: handleClick, "data-translation-key": "userMenu.logout", prefix: react_1.default.createElement(LogoutIcon_1.LogoutIcon, null), style: { width: iconOnly ? 'fit-content' : '100%' } }, iconOnly ? null : translate('userMenu.logout', 'Log out')));
|
|
@@ -4,6 +4,7 @@ export declare const useThemeHooks: import("vitest").Mock<() => {
|
|
|
4
4
|
}>;
|
|
5
5
|
useTelemetry: import("vitest").Mock<() => {
|
|
6
6
|
send: import("vitest").Mock<(...args: any[]) => any>;
|
|
7
|
+
sendCodeSnippetReportedMessage: import("vitest").Mock<(...args: any[]) => any>;
|
|
7
8
|
}>;
|
|
8
9
|
useBreadcrumbs: import("vitest").Mock<(...args: any[]) => any>;
|
|
9
10
|
usePageSharedData: import("vitest").Mock<(...args: any[]) => any>;
|
|
@@ -12,6 +12,7 @@ exports.useThemeHooks = vitest_1.vi.fn(() => ({
|
|
|
12
12
|
})),
|
|
13
13
|
useTelemetry: vitest_1.vi.fn(() => ({
|
|
14
14
|
send: vitest_1.vi.fn(),
|
|
15
|
+
sendCodeSnippetReportedMessage: vitest_1.vi.fn(),
|
|
15
16
|
})),
|
|
16
17
|
useBreadcrumbs: vitest_1.vi.fn().mockReturnValue([]),
|
|
17
18
|
usePageSharedData: vitest_1.vi.fn().mockReturnValue({}),
|
|
@@ -22,7 +22,7 @@ function useSearchDialog() {
|
|
|
22
22
|
if (hotKeys) {
|
|
23
23
|
(0, hotkeys_js_1.default)(hotKeys, (ev) => {
|
|
24
24
|
setIsOpen(true);
|
|
25
|
-
telemetry.
|
|
25
|
+
telemetry.sendSearchOpenedMessage({ method: 'shortcut' });
|
|
26
26
|
ev.preventDefault();
|
|
27
27
|
});
|
|
28
28
|
return () => hotkeys_js_1.default.unbind(hotKeys);
|
|
@@ -30,7 +30,7 @@ function useSearchDialog() {
|
|
|
30
30
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
31
31
|
}, [hotKeys]);
|
|
32
32
|
const onOpen = (0, react_1.useCallback)(function () {
|
|
33
|
-
telemetry.
|
|
33
|
+
telemetry.sendSearchOpenedMessage({ method: 'click' });
|
|
34
34
|
setIsOpen(true);
|
|
35
35
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
36
36
|
}, []);
|
|
@@ -28,10 +28,7 @@ const useColorSwitcher = () => {
|
|
|
28
28
|
window.requestAnimationFrame(() => {
|
|
29
29
|
document.documentElement.classList.remove('notransition');
|
|
30
30
|
});
|
|
31
|
-
telemetry.
|
|
32
|
-
type: 'color_mode.switched',
|
|
33
|
-
payload: { from: activeColorMode, to: newMode },
|
|
34
|
-
});
|
|
31
|
+
telemetry.sendColorModeSwitchedMessage({ from: activeColorMode, to: newMode });
|
|
35
32
|
setActiveColorMode(newMode);
|
|
36
33
|
};
|
|
37
34
|
return {
|
|
@@ -13,7 +13,7 @@ function useProductPicker() {
|
|
|
13
13
|
function setProduct(product) {
|
|
14
14
|
if (!product)
|
|
15
15
|
return;
|
|
16
|
-
telemetry.
|
|
16
|
+
telemetry.sendProductPickedMessage({ product: product.slug });
|
|
17
17
|
loadAndNavigate({ navigate, to: product.link });
|
|
18
18
|
}
|
|
19
19
|
return {
|