@redocly/theme 0.57.0-next.3 → 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 +1 -4
- 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/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/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 +3 -3
- 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 +1 -4
- 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/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/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
|
@@ -3,12 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useThemeHooks = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const ThemeDataContext_1 = require("../contexts/ThemeDataContext");
|
|
6
|
+
const use_telemetry_fallback_1 = require("./use-telemetry-fallback");
|
|
6
7
|
const fallbacks = {
|
|
7
8
|
useTranslate: () => ({
|
|
8
9
|
translate: (value, options) => (typeof options === 'string' ? options : options === null || options === void 0 ? void 0 : options.defaultValue) || value || '',
|
|
9
10
|
}),
|
|
10
11
|
useSubmitFeedback: () => ({ submitFeedback: () => { } }),
|
|
11
|
-
useTelemetry:
|
|
12
|
+
useTelemetry: use_telemetry_fallback_1.useTelemetryFallback,
|
|
12
13
|
/**
|
|
13
14
|
* @deprecated use `useTelemetry` instead
|
|
14
15
|
**/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AsyncApiRealmUI } from '@redocly/realm-asyncapi-sdk';
|
|
1
2
|
import type { CatalogEntityConfig, PageData, PageProps, ResolvedNavItemWithLink, Version } from '@redocly/config';
|
|
2
3
|
import type { ShikiTransformer } from '@shikijs/types';
|
|
3
4
|
import type { Callback, TFunction as TFunc } from 'i18next';
|
|
@@ -7,7 +8,6 @@ import type { UseCatalogResponse, CatalogApiResults, CatalogApiParams, FilteredC
|
|
|
7
8
|
import type { UserMenuData } from './user-menu';
|
|
8
9
|
import type { ItemState } from './sidebar';
|
|
9
10
|
import type { SearchItemData, SearchFacet, SearchFilterItem, SearchFacetQuery, AiSearchConversationItem } from './search';
|
|
10
|
-
import type { EventType, SendEventParams } from './telemetry';
|
|
11
11
|
import type { SubmitFeedbackParams } from './feedback';
|
|
12
12
|
import type { TFunction } from './l10n';
|
|
13
13
|
import type { BreadcrumbItem } from './breadcrumb';
|
|
@@ -117,9 +117,7 @@ export type ThemeHooks = {
|
|
|
117
117
|
entityKey: string;
|
|
118
118
|
}, initialData?: BffCatalogRelatedEntityList) => CatalogApiResults<BffCatalogRelatedEntity, BffCatalogRelatedEntityList>;
|
|
119
119
|
useCatalogClassic: (config: CatalogConfig) => FilteredCatalog;
|
|
120
|
-
useTelemetry: () =>
|
|
121
|
-
send<TEventType extends EventType>(event: SendEventParams<TEventType>): void;
|
|
122
|
-
};
|
|
120
|
+
useTelemetry: () => Omit<AsyncApiRealmUI.Telemetry, 'init' | 'updateCloudEventData' | 'forceFlush' | 'startSpan' | 'constructCloudEvent' | 'sendToOtelService'>;
|
|
123
121
|
useUserTeams: () => string[];
|
|
124
122
|
usePageData: () => PageData | null;
|
|
125
123
|
usePageProps: <T extends Record<string, unknown>>() => PageProps & T;
|
package/lib/core/types/index.js
CHANGED
|
@@ -31,6 +31,5 @@ __exportStar(require("./common"), exports);
|
|
|
31
31
|
__exportStar(require("./open-api-server"), exports);
|
|
32
32
|
__exportStar(require("./marker"), exports);
|
|
33
33
|
__exportStar(require("./code-walkthrough"), exports);
|
|
34
|
-
__exportStar(require("./telemetry"), exports);
|
|
35
34
|
__exportStar(require("./page-actions"), exports);
|
|
36
35
|
//# sourceMappingURL=index.js.map
|
|
@@ -40,11 +40,11 @@ const FilterWrapper = styled_components_1.default.div `
|
|
|
40
40
|
flex-wrap: wrap;
|
|
41
41
|
position: sticky;
|
|
42
42
|
|
|
43
|
-
padding-top:
|
|
43
|
+
padding-top: var(--spacing-xl);
|
|
44
44
|
padding-right: var(--spacing-xl);
|
|
45
45
|
padding-left: var(--spacing-xl);
|
|
46
46
|
padding-bottom: var(--spacing-xs);
|
|
47
|
-
top:
|
|
47
|
+
top: var(--navbar-height);
|
|
48
48
|
background-color: var(--bg-color);
|
|
49
49
|
z-index: 1;
|
|
50
50
|
max-width: var(--md-content-max-width);
|
|
@@ -44,7 +44,7 @@ function CodeToggle(props) {
|
|
|
44
44
|
return (react_1.default.createElement(exports.ToggleWrapper, { "data-component-name": "Markdoc/CodeWalkthrough/CodeToggle" },
|
|
45
45
|
react_1.default.createElement(ToggleContentWrapper, null,
|
|
46
46
|
react_1.default.createElement(exports.ToggleSubtitle, null,
|
|
47
|
-
react_1.default.createElement(Switch_1.Switch, { value: checked, onChange: (newValue) => changeControlState(id, newValue) }),
|
|
47
|
+
react_1.default.createElement(Switch_1.Switch, { value: checked, onChange: (newValue) => changeControlState(id, newValue), stopPropagation: true }),
|
|
48
48
|
react_1.default.createElement("div", null, label)),
|
|
49
49
|
description ? (react_1.default.createElement("div", null, description.map((paragraph, idx) => (react_1.default.createElement(react_1.default.Fragment, { key: idx }, paragraph))))) : null),
|
|
50
50
|
checked ? children : null));
|
|
@@ -87,9 +87,14 @@ const DocsPanel = styled_components_1.default.div `
|
|
|
87
87
|
min-height: 0;
|
|
88
88
|
min-height: calc(100vh - var(--navbar-height));
|
|
89
89
|
|
|
90
|
+
padding-top: var(--spacing-xl);
|
|
90
91
|
padding-right: var(--spacing-xs);
|
|
91
92
|
padding-bottom: calc(var(--spacing-xs) + var(--spacing-xl));
|
|
92
93
|
gap: var(--spacing-xl);
|
|
94
|
+
|
|
95
|
+
&:has([data-component-name='Markdoc/CodeWalkthrough/CodeFilters']) {
|
|
96
|
+
padding-top: 0;
|
|
97
|
+
}
|
|
93
98
|
`;
|
|
94
99
|
const ContentWrapper = styled_components_1.default.div `
|
|
95
100
|
flex-grow: 1;
|
|
@@ -115,14 +120,8 @@ const ContentWrapper = styled_components_1.default.div `
|
|
|
115
120
|
-ms-overflow-style: none; /* IE and Edge */
|
|
116
121
|
scrollbar-width: none; /* Firefox */
|
|
117
122
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
&:not(:first-child) {
|
|
123
|
-
& > *:first-child {
|
|
124
|
-
margin-top: 0;
|
|
125
|
-
}
|
|
123
|
+
&& > *:first-child {
|
|
124
|
+
margin-top: 0;
|
|
126
125
|
}
|
|
127
126
|
`;
|
|
128
127
|
//# sourceMappingURL=CodeWalkthrough.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/theme",
|
|
3
|
-
"version": "0.57.0-next.
|
|
3
|
+
"version": "0.57.0-next.4",
|
|
4
4
|
"description": "Shared UI components lib",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"theme",
|
|
@@ -86,8 +86,8 @@
|
|
|
86
86
|
"nprogress": "0.2.0",
|
|
87
87
|
"react-calendar": "5.1.0",
|
|
88
88
|
"react-date-picker": "11.0.0",
|
|
89
|
-
"@redocly/
|
|
90
|
-
"@redocly/
|
|
89
|
+
"@redocly/config": "0.28.0",
|
|
90
|
+
"@redocly/realm-asyncapi-sdk": "0.3.0-next.1"
|
|
91
91
|
},
|
|
92
92
|
"scripts": {
|
|
93
93
|
"watch": "tsc -p tsconfig.build.json && (concurrently \"tsc -w -p tsconfig.build.json\" \"tsc-alias -w -p tsconfig.build.json\")",
|
|
@@ -31,13 +31,10 @@ export function Breadcrumbs(props: {
|
|
|
31
31
|
label={breadcrumb.label}
|
|
32
32
|
isActive={isLast}
|
|
33
33
|
onClick={() => {
|
|
34
|
-
telemetry.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
position: idx + 1,
|
|
39
|
-
totalBreadcrumbs: breadcrumbs.length,
|
|
40
|
-
},
|
|
34
|
+
telemetry.sendBreadcrumbClickedMessage({
|
|
35
|
+
link: breadcrumb.link,
|
|
36
|
+
position: idx + 1,
|
|
37
|
+
totalBreadcrumbs: breadcrumbs.length,
|
|
41
38
|
});
|
|
42
39
|
}}
|
|
43
40
|
/>
|
|
@@ -21,7 +21,7 @@ export function EditPageButton({ to }: EditPageButtonProps): JSX.Element {
|
|
|
21
21
|
data-component-name="Buttons/EditPageButton"
|
|
22
22
|
target="_blank"
|
|
23
23
|
to={to}
|
|
24
|
-
onClick={() => telemetry.
|
|
24
|
+
onClick={() => telemetry.sendEditPageLinkClickedMessage(undefined)}
|
|
25
25
|
>
|
|
26
26
|
<ButtonIcon />
|
|
27
27
|
<ButtonText data-translation-key="markdown.editPage.text">
|
|
@@ -30,7 +30,7 @@ export function CatalogCard({ entity, catalogConfig }: CatalogCardProps): JSX.El
|
|
|
30
30
|
window.location.assign(
|
|
31
31
|
`${pathPrefix}/catalogs/${catalogConfig.slug}/entities/${entity.key}`,
|
|
32
32
|
);
|
|
33
|
-
telemetry.
|
|
33
|
+
telemetry.sendCatalogItemClickedMessage(undefined);
|
|
34
34
|
}}
|
|
35
35
|
>
|
|
36
36
|
<CardContent>
|
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
|
|
4
|
-
import { Route, Routes
|
|
4
|
+
import { Route, Routes } from 'react-router-dom';
|
|
5
5
|
|
|
6
6
|
import type { BffCatalogEntity, BffCatalogRelatedEntityList } from '@redocly/theme/core/types';
|
|
7
7
|
|
|
8
8
|
import { breakpoints } from '@redocly/theme/core/utils';
|
|
9
|
-
import { ArrowLeftIcon } from '@redocly/theme/icons/ArrowLeftIcon/ArrowLeftIcon';
|
|
10
9
|
import { CatalogPageDescription } from '@redocly/theme/components/Catalog/CatalogPageDescription';
|
|
11
10
|
import { CatalogEntityProperties } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties';
|
|
12
11
|
import { CatalogEntityMetadata } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityMetadata';
|
|
13
12
|
import { CatalogEntityLinks } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityLinks';
|
|
14
13
|
import { Breadcrumbs } from '@redocly/theme/components/Breadcrumbs/Breadcrumbs';
|
|
15
|
-
import { Sidebar } from '@redocly/theme/components/Sidebar/Sidebar';
|
|
16
|
-
import { Menu } from '@redocly/theme/components/Menu/Menu';
|
|
17
|
-
import { Button } from '@redocly/theme/components/Button/Button';
|
|
18
14
|
import { CatalogEntityRelations } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations';
|
|
19
15
|
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
20
|
-
import { SidebarActions } from '@redocly/theme/components/SidebarActions/SidebarActions';
|
|
21
16
|
import { CatalogEntitySchema } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntitySchema';
|
|
22
17
|
import { CatalogEntityMethodAndPath } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath';
|
|
23
18
|
import { CatalogEntityRelationsGraph } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy';
|
|
@@ -48,64 +43,14 @@ export function CatalogEntity({
|
|
|
48
43
|
}: CatalogEntityProps) {
|
|
49
44
|
const { useTranslate, useCatalog } = useThemeHooks();
|
|
50
45
|
const { translate } = useTranslate();
|
|
46
|
+
|
|
51
47
|
const linkToMainCatalog = `catalogs/${catalogConfig.slug}`;
|
|
52
48
|
const linkToMainCatalogLabel = translate(catalogConfig.titleTranslationKey);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
collapsedSidebar,
|
|
56
|
-
onChangeViewClick,
|
|
57
|
-
onChangeCollapseSidebarClick,
|
|
58
|
-
searchQuery,
|
|
59
|
-
setSearchQuery,
|
|
60
|
-
} = useCatalog();
|
|
61
|
-
|
|
62
|
-
const { pathname } = useLocation();
|
|
63
|
-
const linkBase = `${linkToMainCatalog}/entities/${entity.key}`;
|
|
64
|
-
const menuItemDefs = [
|
|
65
|
-
{ label: 'Overview', path: linkBase, end: true },
|
|
66
|
-
{ label: 'Relations Graph', path: `${linkBase}/relations-graph`, end: true },
|
|
67
|
-
];
|
|
68
|
-
const sidebarMenuItems = menuItemDefs.map(({ label, path, end }) => ({
|
|
69
|
-
label,
|
|
70
|
-
link: path,
|
|
71
|
-
active: Boolean(matchPath({ path: `/${path}`, end }, pathname)),
|
|
72
|
-
items: [],
|
|
73
|
-
hasActiveSubItem: false,
|
|
74
|
-
}));
|
|
49
|
+
|
|
50
|
+
const { searchQuery, setSearchQuery } = useCatalog();
|
|
75
51
|
|
|
76
52
|
return (
|
|
77
53
|
<CatalogPageWrapper data-component-name="Catalog/CatalogEntity/CatalogEntity">
|
|
78
|
-
<CatalogSidebar
|
|
79
|
-
collapsed={collapsedSidebar}
|
|
80
|
-
header={
|
|
81
|
-
<BackLink
|
|
82
|
-
icon={<ArrowLeftIcon />}
|
|
83
|
-
iconPosition="left"
|
|
84
|
-
variant="ghost"
|
|
85
|
-
size="medium"
|
|
86
|
-
data-component-name="Sidebar/BackButton"
|
|
87
|
-
to={linkToMainCatalog}
|
|
88
|
-
>
|
|
89
|
-
{collapsedSidebar ? (
|
|
90
|
-
''
|
|
91
|
-
) : (
|
|
92
|
-
<div data-translation-key="sidebar.menu.backLabel">
|
|
93
|
-
{translate('sidebar.menu.backLabel')}
|
|
94
|
-
</div>
|
|
95
|
-
)}
|
|
96
|
-
</BackLink>
|
|
97
|
-
}
|
|
98
|
-
menu={<Menu items={sidebarMenuItems} />}
|
|
99
|
-
footer={
|
|
100
|
-
<SidebarActions
|
|
101
|
-
layout={layout}
|
|
102
|
-
collapsedSidebar={collapsedSidebar}
|
|
103
|
-
isApiDocs={false}
|
|
104
|
-
onChangeViewClick={onChangeViewClick}
|
|
105
|
-
onChangeCollapseSidebarClick={onChangeCollapseSidebarClick}
|
|
106
|
-
/>
|
|
107
|
-
}
|
|
108
|
-
/>
|
|
109
54
|
<CatalogPageContent>
|
|
110
55
|
<Breadcrumbs
|
|
111
56
|
additionalBreadcrumbs={[
|
|
@@ -196,15 +141,6 @@ const CatalogPageContent = styled.main`
|
|
|
196
141
|
}
|
|
197
142
|
`;
|
|
198
143
|
|
|
199
|
-
const CatalogSidebar = styled(Sidebar)`
|
|
200
|
-
display: none;
|
|
201
|
-
|
|
202
|
-
@media screen and (min-width: ${breakpoints.medium}) {
|
|
203
|
-
display: flex;
|
|
204
|
-
}
|
|
205
|
-
--menu-container-padding-top: 0;
|
|
206
|
-
`;
|
|
207
|
-
|
|
208
144
|
const CatalogEntityPageWrapper = styled.div`
|
|
209
145
|
display: flex;
|
|
210
146
|
flex-direction: column;
|
|
@@ -223,11 +159,3 @@ const CatalogTwoColumnsSection = styled.section`
|
|
|
223
159
|
gap: 24px;
|
|
224
160
|
align-items: start;
|
|
225
161
|
`;
|
|
226
|
-
|
|
227
|
-
const BackLink = styled(Button)`
|
|
228
|
-
padding: var(--spacing-unit) 0;
|
|
229
|
-
height: calc(var(--line-height-base) + var(--spacing-unit) * 2);
|
|
230
|
-
justify-content: flex-start;
|
|
231
|
-
width: 100%;
|
|
232
|
-
margin-bottom: 0px;
|
|
233
|
-
`;
|
|
@@ -42,7 +42,7 @@ export function CatalogClassicActions(props: CatalogClassicActionsProps): JSX.El
|
|
|
42
42
|
iconPosition="left"
|
|
43
43
|
onClick={() => {
|
|
44
44
|
onOpenFilter();
|
|
45
|
-
telemetry.
|
|
45
|
+
telemetry.sendCatalogActionsButtonClickedMessage(undefined);
|
|
46
46
|
}}
|
|
47
47
|
data-translation-key="catalog.filters.title"
|
|
48
48
|
>
|
|
@@ -38,7 +38,7 @@ export function CatalogClassicCard({ item }: CatalogClassicCardProps): JSX.Eleme
|
|
|
38
38
|
<Link key={item.docsLink || item.link} to={item.docsLink || item.link}>
|
|
39
39
|
<StyledCard
|
|
40
40
|
data-component-name="CatalogClassic/CatalogClassicCard"
|
|
41
|
-
onClick={() => telemetry.
|
|
41
|
+
onClick={() => telemetry.sendCatalogItemClickedMessage(undefined)}
|
|
42
42
|
>
|
|
43
43
|
<CardContent>
|
|
44
44
|
<CardTitleWrapper>
|
|
@@ -51,9 +51,7 @@ function ScorecardBadge(props: {
|
|
|
51
51
|
return (
|
|
52
52
|
<Link to={slug}>
|
|
53
53
|
<Tag
|
|
54
|
-
onClick={() =>
|
|
55
|
-
telemetry.send({ type: 'scorecard_link.clicked', payload: { action: 'click' } })
|
|
56
|
-
}
|
|
54
|
+
onClick={() => telemetry.sendScorecardLinkClickedMessage({ action: 'click' })}
|
|
57
55
|
withStatusDot
|
|
58
56
|
statusDotColor={`var(${colorVariable})`}
|
|
59
57
|
>
|
|
@@ -180,10 +180,7 @@ export function CodeBlockControls({
|
|
|
180
180
|
if (copy?.onClick) {
|
|
181
181
|
copy?.onClick?.();
|
|
182
182
|
} else {
|
|
183
|
-
telemetry.
|
|
184
|
-
type: 'openapi_docs.copy_code_snippet.clicked',
|
|
185
|
-
payload: { snippetType: 'copy' },
|
|
186
|
-
});
|
|
183
|
+
telemetry.sendCopyCodeSnippetClickedMessage({ snippetType: 'copy' });
|
|
187
184
|
}
|
|
188
185
|
}}
|
|
189
186
|
/>
|
|
@@ -58,7 +58,7 @@ export function Feedback(props: FeedbackProps & { path?: string }) {
|
|
|
58
58
|
settings={settings}
|
|
59
59
|
onSubmit={(values) => {
|
|
60
60
|
submitFeedback({ type, values, path });
|
|
61
|
-
telemetry.
|
|
61
|
+
telemetry.sendFeedbackMessage({ feedbackType: type });
|
|
62
62
|
}}
|
|
63
63
|
/>
|
|
64
64
|
</FeedbackWrapper>
|
|
@@ -44,7 +44,7 @@ export function FooterItem({ item, iconsOnly, className }: FooterItemProps): JSX
|
|
|
44
44
|
external={item.external}
|
|
45
45
|
target={item.target}
|
|
46
46
|
data-testid={item.label}
|
|
47
|
-
onClick={() => telemetry.
|
|
47
|
+
onClick={() => telemetry.sendFooterItemClickedMessage(undefined)}
|
|
48
48
|
data-translation-key={item.labelTranslationKey}
|
|
49
49
|
>
|
|
50
50
|
{hasIcon ? (
|
|
@@ -40,10 +40,7 @@ export function LanguagePicker(props: LanguagePickerProps): JSX.Element | null {
|
|
|
40
40
|
onAction: () => {
|
|
41
41
|
setLocale(locale.code);
|
|
42
42
|
props.onChangeLanguage(locale.code);
|
|
43
|
-
telemetry.
|
|
44
|
-
type: 'language_picker_locale.changed',
|
|
45
|
-
payload: { locale: locale.code },
|
|
46
|
-
});
|
|
43
|
+
telemetry.sendLanguagePickerLocaleChangedMessage({ locale: locale.code });
|
|
47
44
|
},
|
|
48
45
|
active: locale.code === currentLocale.code,
|
|
49
46
|
suffix: locale.code === currentLocale.code && <CheckmarkIcon />,
|
|
@@ -27,7 +27,7 @@ export function Logo({ config, className, ...otherProps }: LogoProps): JSX.Eleme
|
|
|
27
27
|
return (
|
|
28
28
|
<LogoWrapper data-component-name="Logo/Logo" className={className} {...otherProps}>
|
|
29
29
|
{config.link ? (
|
|
30
|
-
<Link to={config.link} onClick={() => telemetry.
|
|
30
|
+
<Link to={config.link} onClick={() => telemetry.sendLogoClickedMessage(undefined)}>
|
|
31
31
|
{image}
|
|
32
32
|
</Link>
|
|
33
33
|
) : (
|
|
@@ -37,12 +37,9 @@ export function MenuItem(props: React.PropsWithChildren<MenuItemProps>): JSX.Ele
|
|
|
37
37
|
const hasHttpTag = !!item.httpVerb || type === MenuItemType.Operation;
|
|
38
38
|
|
|
39
39
|
const handleOnClick = () => {
|
|
40
|
-
telemetry.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
label: item.label,
|
|
44
|
-
type: item.type === 'link' || item.type === 'group' ? item.type : undefined,
|
|
45
|
-
},
|
|
40
|
+
telemetry.sendSidebarItemClickedMessage({
|
|
41
|
+
label: item.label,
|
|
42
|
+
type: item.type === 'link' || item.type === 'group' ? item.type : undefined,
|
|
46
43
|
});
|
|
47
44
|
onClick?.();
|
|
48
45
|
if (isNested) {
|
|
@@ -58,11 +58,11 @@ export function Navbar({ className }: NavbarProps): JSX.Element | null {
|
|
|
58
58
|
isOpen
|
|
59
59
|
? () => {
|
|
60
60
|
closeMobileMenu();
|
|
61
|
-
telemetry.
|
|
61
|
+
telemetry.sendMobileMenuButtonCloseClickedMessage(undefined);
|
|
62
62
|
}
|
|
63
63
|
: () => {
|
|
64
64
|
openMobileMenu();
|
|
65
|
-
telemetry.
|
|
65
|
+
telemetry.sendMobileMenuButtonOpenClickedMessage(undefined);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
icon={isOpen ? <CloseIcon /> : <MenuIcon />}
|
|
@@ -46,9 +46,7 @@ export function NavbarItem({ navItem, className }: NavbarItemProps): JSX.Element
|
|
|
46
46
|
as={item.link ? Link : undefined}
|
|
47
47
|
active={isActive}
|
|
48
48
|
className={className}
|
|
49
|
-
onClick={() =>
|
|
50
|
-
telemetry.send({ type: 'navbar.menu_item_clicked', payload: { type: item.type } })
|
|
51
|
-
}
|
|
49
|
+
onClick={() => telemetry.sendNavbarMenuItemClickedMessage({ type: item.type })}
|
|
52
50
|
external={item.external}
|
|
53
51
|
target={item.target}
|
|
54
52
|
to={item.link}
|
|
@@ -139,15 +139,12 @@ export function SearchDialog({ onClose, className }: SearchDialogProps): JSX.Ele
|
|
|
139
139
|
innerRef={innerRef}
|
|
140
140
|
onClick={() => {
|
|
141
141
|
addSearchHistoryItem(query);
|
|
142
|
-
telemetry.
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
index: index.toString(),
|
|
149
|
-
searchEngine: mode,
|
|
150
|
-
},
|
|
142
|
+
telemetry.sendSearchResultClickedMessage({
|
|
143
|
+
query,
|
|
144
|
+
url: item.document.url,
|
|
145
|
+
totalResults: results.length.toString(),
|
|
146
|
+
index: index.toString(),
|
|
147
|
+
searchEngine: mode,
|
|
151
148
|
});
|
|
152
149
|
onClose();
|
|
153
150
|
}}
|
|
@@ -381,12 +378,9 @@ export function SearchDialog({ onClose, className }: SearchDialogProps): JSX.Ele
|
|
|
381
378
|
<>
|
|
382
379
|
<SearchRecent
|
|
383
380
|
onSelect={(query, index) => {
|
|
384
|
-
telemetry.
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
query,
|
|
388
|
-
index: index.toString(),
|
|
389
|
-
},
|
|
381
|
+
telemetry.sendSearchRecentClickedMessage({
|
|
382
|
+
query,
|
|
383
|
+
index: index.toString(),
|
|
390
384
|
});
|
|
391
385
|
setQuery(query);
|
|
392
386
|
focusSearchInput();
|
|
@@ -51,7 +51,7 @@ export function SearchInput({
|
|
|
51
51
|
const handleOnReset = () => {
|
|
52
52
|
onChange('');
|
|
53
53
|
addSearchHistoryItem(value);
|
|
54
|
-
telemetry.
|
|
54
|
+
telemetry.sendSearchInputResetButtonClickedMessage(undefined);
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
return (
|
|
@@ -25,7 +25,7 @@ export function SearchRecent({ onSelect, className }: SearchRecentProps): JSX.El
|
|
|
25
25
|
const handleOnRemove = (e: React.MouseEvent<SVGSVGElement, MouseEvent>, item: string) => {
|
|
26
26
|
e.stopPropagation();
|
|
27
27
|
removeSearchHistoryItem(item);
|
|
28
|
-
telemetry.
|
|
28
|
+
telemetry.sendSearchRecentRemoveButtonClickedMessage(undefined);
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>, item: string, index: number) => {
|
|
@@ -48,9 +48,9 @@ export const SidebarActions = ({
|
|
|
48
48
|
onClick={() => {
|
|
49
49
|
onChangeCollapseSidebarClick();
|
|
50
50
|
if (collapsedSidebar) {
|
|
51
|
-
telemetry.
|
|
51
|
+
telemetry.sendSidebarItemExpandedMessage(undefined);
|
|
52
52
|
} else {
|
|
53
|
-
telemetry.
|
|
53
|
+
telemetry.sendSidebarItemCollapsedMessage(undefined);
|
|
54
54
|
}
|
|
55
55
|
}}
|
|
56
56
|
title={
|
|
@@ -70,7 +70,7 @@ export const SidebarActions = ({
|
|
|
70
70
|
layout={layout}
|
|
71
71
|
onClick={() => {
|
|
72
72
|
onChangeViewClick();
|
|
73
|
-
telemetry.
|
|
73
|
+
telemetry.sendChangeLayoutButtonClickedMessage(undefined);
|
|
74
74
|
}}
|
|
75
75
|
/>
|
|
76
76
|
</ControlsWrapChangeLayoutButtons>
|
|
@@ -6,17 +6,48 @@ import type { JSX } from 'react';
|
|
|
6
6
|
export type SwitchProps = {
|
|
7
7
|
value: boolean;
|
|
8
8
|
onChange: (value: boolean) => void;
|
|
9
|
+
onFocus?: () => void;
|
|
9
10
|
disabled?: boolean;
|
|
11
|
+
stopPropagation?: boolean;
|
|
12
|
+
className?: string;
|
|
10
13
|
};
|
|
11
14
|
|
|
12
|
-
export function Switch({
|
|
13
|
-
|
|
15
|
+
export function Switch({
|
|
16
|
+
value = false,
|
|
17
|
+
disabled = false,
|
|
18
|
+
onChange,
|
|
19
|
+
onFocus,
|
|
20
|
+
stopPropagation = false,
|
|
21
|
+
className,
|
|
22
|
+
}: SwitchProps): JSX.Element {
|
|
23
|
+
const handleClick = (event: React.MouseEvent<HTMLDivElement>) => {
|
|
14
24
|
if (disabled) return;
|
|
25
|
+
if (stopPropagation) {
|
|
26
|
+
event.stopPropagation();
|
|
27
|
+
}
|
|
15
28
|
onChange(!value);
|
|
16
29
|
};
|
|
17
30
|
|
|
31
|
+
const handleFocus = (event: React.FocusEvent<HTMLDivElement>): void => {
|
|
32
|
+
if (stopPropagation) {
|
|
33
|
+
event.stopPropagation();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
onFocus?.();
|
|
37
|
+
};
|
|
38
|
+
|
|
18
39
|
return (
|
|
19
|
-
<SwitchWrapper
|
|
40
|
+
<SwitchWrapper
|
|
41
|
+
tabIndex={disabled ? -1 : 0}
|
|
42
|
+
onFocus={handleFocus}
|
|
43
|
+
onClick={handleClick}
|
|
44
|
+
role="switch"
|
|
45
|
+
aria-checked={value}
|
|
46
|
+
aria-disabled={disabled}
|
|
47
|
+
selected={value}
|
|
48
|
+
disabled={disabled}
|
|
49
|
+
className={className}
|
|
50
|
+
>
|
|
20
51
|
<Knob selected={value} disabled={disabled} />
|
|
21
52
|
</SwitchWrapper>
|
|
22
53
|
);
|
|
@@ -62,7 +62,7 @@ export function TableOfContent(props: TableOfContentProps): JSX.Element | null {
|
|
|
62
62
|
data-testid={`toc-${heading.value}`}
|
|
63
63
|
onClick={(e) => {
|
|
64
64
|
e.preventDefault();
|
|
65
|
-
telemetry.
|
|
65
|
+
telemetry.sendTocItemClickedMessage(undefined);
|
|
66
66
|
handleHeadingClick(heading.id);
|
|
67
67
|
}}
|
|
68
68
|
/>
|
|
@@ -20,7 +20,7 @@ export function LoginButton({ href, className }: LoginButtonProps): JSX.Element
|
|
|
20
20
|
<Button
|
|
21
21
|
data-translation-key="userMenu.login"
|
|
22
22
|
to={href}
|
|
23
|
-
onClick={() => telemetry.
|
|
23
|
+
onClick={() => telemetry.sendLoginButtonClickedMessage(undefined)}
|
|
24
24
|
data-testid="login-btn"
|
|
25
25
|
extraClass={className}
|
|
26
26
|
variant="primary"
|
|
@@ -18,7 +18,7 @@ export function LogoutMenuItem({ iconOnly, className }: LogoutMenuItemProps): JS
|
|
|
18
18
|
const { translate } = useTranslate();
|
|
19
19
|
|
|
20
20
|
const handleClick = () => {
|
|
21
|
-
telemetry.
|
|
21
|
+
telemetry.sendLogoutMenuItemClickedMessage(undefined);
|
|
22
22
|
handleLogout();
|
|
23
23
|
};
|
|
24
24
|
|