@redocly/theme 0.62.0-next.6 → 0.62.0-next.8
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/Breadcrumb.js +1 -1
- package/lib/components/Breadcrumbs/BreadcrumbDropdown.js +1 -1
- package/lib/components/Catalog/CatalogTagsWithTooltip.js +1 -1
- package/lib/components/CodeBlock/CodeBlockControls.js +5 -5
- package/lib/components/Menu/variables.js +3 -3
- package/lib/components/Search/SearchAiDialog.d.ts +4 -2
- package/lib/components/Search/SearchAiDialog.js +23 -4
- package/lib/components/Search/SearchAiMessage.d.ts +4 -2
- package/lib/components/Search/SearchAiMessage.js +72 -16
- package/lib/components/Search/SearchDialog.js +1 -1
- package/lib/components/Tooltip/Tooltip.d.ts +2 -3
- package/lib/components/Tooltip/Tooltip.js +66 -113
- package/lib/components/Tooltip/variables.dark.js +4 -0
- package/lib/components/Tooltip/variables.js +3 -3
- package/lib/components/UserMenu/LoginButton.js +1 -1
- package/lib/core/constants/search.d.ts +5 -1
- package/lib/core/constants/search.js +24 -1
- package/lib/core/hooks/use-outside-click.d.ts +3 -1
- package/lib/core/hooks/use-outside-click.js +8 -4
- package/lib/core/types/hooks.d.ts +10 -1
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/search.d.ts +24 -0
- package/lib/core/types/search.js +9 -1
- package/lib/core/utils/content-segments.d.ts +2 -0
- package/lib/core/utils/content-segments.js +22 -0
- package/lib/core/utils/index.d.ts +1 -0
- package/lib/core/utils/index.js +1 -0
- package/package.json +7 -7
- package/src/components/Breadcrumbs/Breadcrumb.tsx +3 -3
- package/src/components/Breadcrumbs/BreadcrumbDropdown.tsx +3 -3
- package/src/components/Catalog/CatalogTagsWithTooltip.tsx +3 -3
- package/src/components/CodeBlock/CodeBlockControls.tsx +13 -9
- package/src/components/Menu/variables.ts +3 -3
- package/src/components/Search/SearchAiDialog.tsx +31 -2
- package/src/components/Search/SearchAiMessage.tsx +94 -10
- package/src/components/Search/SearchDialog.tsx +2 -0
- package/src/components/Tooltip/Tooltip.tsx +77 -120
- package/src/components/Tooltip/variables.dark.ts +4 -0
- package/src/components/Tooltip/variables.ts +3 -3
- package/src/components/UserMenu/LoginButton.tsx +2 -2
- package/src/core/constants/search.ts +27 -1
- package/src/core/hooks/__mocks__/use-theme-hooks.ts +9 -1
- package/src/core/hooks/use-outside-click.ts +16 -5
- package/src/core/types/hooks.ts +9 -0
- package/src/core/types/l10n.ts +3 -0
- package/src/core/types/search.ts +19 -0
- package/src/core/utils/content-segments.ts +27 -0
- package/src/core/utils/index.ts +1 -0
- package/lib/components/Tooltip/TooltipWrapper.d.ts +0 -12
- package/lib/components/Tooltip/TooltipWrapper.js +0 -34
- package/src/components/Tooltip/TooltipWrapper.tsx +0 -70
|
@@ -34,113 +34,58 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.Tooltip = void 0;
|
|
37
|
-
exports.TooltipComponent = TooltipComponent;
|
|
38
37
|
const react_1 = __importStar(require("react"));
|
|
39
38
|
const styled_components_1 = __importStar(require("styled-components"));
|
|
40
39
|
const hooks_1 = require("../../core/hooks");
|
|
41
40
|
const Portal_1 = require("../../components/Portal/Portal");
|
|
42
41
|
function TooltipComponent({ children, isOpen, tip, withArrow = true, placement = 'top', className = 'default', width, dataTestId, disabled = false, arrowPosition = 'center', }) {
|
|
43
|
-
const
|
|
42
|
+
const tooltipWrapperRef = (0, react_1.useRef)(null);
|
|
43
|
+
const tooltipBodyRef = (0, react_1.useRef)(null);
|
|
44
44
|
const { isOpened, handleOpen, handleClose } = (0, hooks_1.useControl)(isOpen);
|
|
45
|
-
const
|
|
46
|
-
(0, hooks_1.useOutsideClick)(
|
|
45
|
+
const anchorName = `--tooltip${(0, react_1.useId)().replace(/:/g, '')}`;
|
|
46
|
+
(0, hooks_1.useOutsideClick)(isOpened ? [tooltipWrapperRef, tooltipBodyRef] : tooltipWrapperRef, handleClose);
|
|
47
47
|
const isControlled = isOpen !== undefined;
|
|
48
|
-
const updateTooltipPosition = (0, react_1.useCallback)(() => {
|
|
49
|
-
if (isOpened && ref.current) {
|
|
50
|
-
const rect = ref.current.getBoundingClientRect();
|
|
51
|
-
let top = 0;
|
|
52
|
-
let left = 0;
|
|
53
|
-
switch (placement) {
|
|
54
|
-
case 'top':
|
|
55
|
-
top = rect.top;
|
|
56
|
-
if (arrowPosition === 'left') {
|
|
57
|
-
left = rect.left - 24;
|
|
58
|
-
}
|
|
59
|
-
else if (arrowPosition === 'right') {
|
|
60
|
-
left = rect.right + 24;
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
left = rect.left + rect.width / 2;
|
|
64
|
-
}
|
|
65
|
-
break;
|
|
66
|
-
case 'bottom':
|
|
67
|
-
top = rect.bottom;
|
|
68
|
-
if (arrowPosition === 'left') {
|
|
69
|
-
left = rect.left - 24;
|
|
70
|
-
}
|
|
71
|
-
else if (arrowPosition === 'right') {
|
|
72
|
-
left = rect.right + 24;
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
left = rect.left + rect.width / 2;
|
|
76
|
-
}
|
|
77
|
-
break;
|
|
78
|
-
case 'left':
|
|
79
|
-
top = rect.top + rect.height / 2;
|
|
80
|
-
left = rect.left;
|
|
81
|
-
break;
|
|
82
|
-
case 'right':
|
|
83
|
-
top = rect.top + rect.height / 2;
|
|
84
|
-
left = rect.right;
|
|
85
|
-
break;
|
|
86
|
-
}
|
|
87
|
-
setTooltipPosition({ top, left });
|
|
88
|
-
}
|
|
89
|
-
}, [isOpened, placement, arrowPosition]);
|
|
90
|
-
(0, react_1.useEffect)(() => {
|
|
91
|
-
if (isOpened && ref.current) {
|
|
92
|
-
updateTooltipPosition();
|
|
93
|
-
const handleScroll = () => updateTooltipPosition();
|
|
94
|
-
const handleResize = () => updateTooltipPosition();
|
|
95
|
-
window.addEventListener('scroll', handleScroll, true);
|
|
96
|
-
window.addEventListener('resize', handleResize);
|
|
97
|
-
return () => {
|
|
98
|
-
window.removeEventListener('scroll', handleScroll, true);
|
|
99
|
-
window.removeEventListener('resize', handleResize);
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
}, [isOpened, placement, updateTooltipPosition]);
|
|
103
48
|
(0, react_1.useEffect)(() => {
|
|
49
|
+
if (!isControlled)
|
|
50
|
+
return;
|
|
104
51
|
if (isOpen && !disabled) {
|
|
105
52
|
handleOpen();
|
|
106
53
|
}
|
|
107
54
|
else {
|
|
108
55
|
handleClose();
|
|
109
56
|
}
|
|
110
|
-
}, [isOpen, handleOpen, handleClose
|
|
111
|
-
const controllers = !isControlled &&
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
57
|
+
}, [isOpen, disabled, isControlled, handleOpen, handleClose]);
|
|
58
|
+
const controllers = !isControlled && !disabled
|
|
59
|
+
? {
|
|
60
|
+
onMouseEnter: handleOpen,
|
|
61
|
+
onMouseLeave: handleClose,
|
|
62
|
+
onClick: handleClose,
|
|
63
|
+
onFocus: handleOpen,
|
|
64
|
+
onBlur: handleClose,
|
|
65
|
+
}
|
|
66
|
+
: {};
|
|
67
|
+
return (react_1.default.createElement(TooltipWrapper, Object.assign({ ref: tooltipWrapperRef }, controllers, { className: `tooltip-${className}`, "data-component-name": "Tooltip/Tooltip", anchorName: anchorName }),
|
|
120
68
|
children,
|
|
121
69
|
isOpened && !disabled && (react_1.default.createElement(Portal_1.Portal, null,
|
|
122
|
-
react_1.default.createElement(TooltipBody, { "data-testid": dataTestId || (typeof tip === 'string' ? tip : ''), placement: placement, width: width, withArrow: withArrow, arrowPosition: arrowPosition,
|
|
123
|
-
position: 'fixed',
|
|
124
|
-
top: tooltipPosition.top,
|
|
125
|
-
left: tooltipPosition.left,
|
|
126
|
-
} }, tip)))));
|
|
70
|
+
react_1.default.createElement(TooltipBody, { ref: tooltipBodyRef, "data-testid": dataTestId || (typeof tip === 'string' ? tip : ''), placement: placement, width: width, withArrow: withArrow, arrowPosition: arrowPosition, anchorName: anchorName }, tip)))));
|
|
127
71
|
}
|
|
128
72
|
exports.Tooltip = (0, react_1.memo)(TooltipComponent);
|
|
129
73
|
const PLACEMENTS = {
|
|
130
74
|
top: (0, styled_components_1.css) `
|
|
75
|
+
bottom: anchor(top);
|
|
131
76
|
${({ withArrow, arrowPosition }) => withArrow && arrowPosition === 'left'
|
|
132
77
|
? (0, styled_components_1.css) `
|
|
133
|
-
transform: translate(
|
|
134
|
-
|
|
78
|
+
transform: translate(-32px, -6px);
|
|
79
|
+
left: anchor(center);
|
|
135
80
|
`
|
|
136
81
|
: arrowPosition === 'right'
|
|
137
82
|
? (0, styled_components_1.css) `
|
|
138
|
-
transform: translate(
|
|
139
|
-
|
|
83
|
+
transform: translate(32px, -6px);
|
|
84
|
+
right: anchor(center);
|
|
140
85
|
`
|
|
141
86
|
: (0, styled_components_1.css) `
|
|
142
|
-
transform: translate(-50%, -
|
|
143
|
-
|
|
87
|
+
transform: translate(-50%, -6px);
|
|
88
|
+
left: anchor(center);
|
|
144
89
|
`}
|
|
145
90
|
|
|
146
91
|
${({ withArrow, arrowPosition }) => withArrow &&
|
|
@@ -152,26 +97,27 @@ const PLACEMENTS = {
|
|
|
152
97
|
border-top-style: solid;
|
|
153
98
|
border-radius: 2px;
|
|
154
99
|
bottom: 0;
|
|
155
|
-
${arrowPosition === 'left' && 'left: 16px; transform: translateY(
|
|
156
|
-
${arrowPosition === 'center' && 'left: 50%; transform: translate(-50%,
|
|
157
|
-
${arrowPosition === 'right' && 'right: 16px; transform: translateY(
|
|
100
|
+
${arrowPosition === 'left' && 'left: 16px; transform: translateY(100%);'}
|
|
101
|
+
${arrowPosition === 'center' && 'left: 50%; transform: translate(-50%, 100%);'}
|
|
102
|
+
${arrowPosition === 'right' && 'right: 16px; transform: translateY(100%);'}
|
|
158
103
|
}
|
|
159
104
|
`}
|
|
160
105
|
`,
|
|
161
106
|
bottom: (0, styled_components_1.css) `
|
|
107
|
+
top: anchor(bottom);
|
|
162
108
|
${({ withArrow, arrowPosition }) => withArrow && arrowPosition === 'left'
|
|
163
109
|
? (0, styled_components_1.css) `
|
|
164
|
-
transform: translate(
|
|
165
|
-
|
|
110
|
+
transform: translate(-32px, 6px);
|
|
111
|
+
left: anchor(center);
|
|
166
112
|
`
|
|
167
113
|
: arrowPosition === 'right'
|
|
168
114
|
? (0, styled_components_1.css) `
|
|
169
|
-
transform: translate(
|
|
170
|
-
|
|
115
|
+
transform: translate(32px, 6px);
|
|
116
|
+
right: anchor(center);
|
|
171
117
|
`
|
|
172
118
|
: (0, styled_components_1.css) `
|
|
173
|
-
transform: translate(-50%,
|
|
174
|
-
|
|
119
|
+
transform: translate(-50%, 6px);
|
|
120
|
+
left: anchor(center);
|
|
175
121
|
`}
|
|
176
122
|
|
|
177
123
|
${({ withArrow, arrowPosition }) => withArrow &&
|
|
@@ -183,17 +129,19 @@ const PLACEMENTS = {
|
|
|
183
129
|
border-bottom-style: solid;
|
|
184
130
|
border-radius: 0 0 2px 2px;
|
|
185
131
|
top: 0;
|
|
186
|
-
${arrowPosition === 'left' && 'left: 16px; transform: translateY(-
|
|
187
|
-
${arrowPosition === 'center' && 'left: 50%; transform: translate(-50%, -
|
|
188
|
-
${arrowPosition === 'right' && 'right: 16px; transform: translateY(-
|
|
132
|
+
${arrowPosition === 'left' && 'left: 16px; transform: translateY(-100%);'}
|
|
133
|
+
${arrowPosition === 'center' && 'left: 50%; transform: translate(-50%, -100%);'}
|
|
134
|
+
${arrowPosition === 'right' && 'right: 16px; transform: translateY(-100%);'}
|
|
189
135
|
}
|
|
190
136
|
`}
|
|
191
137
|
`,
|
|
192
138
|
left: (0, styled_components_1.css) `
|
|
193
139
|
transform: translate(-100%, -50%);
|
|
194
|
-
margin-left: -
|
|
140
|
+
margin-left: -7px;
|
|
141
|
+
top: anchor(center);
|
|
142
|
+
left: anchor(left);
|
|
195
143
|
|
|
196
|
-
${({ withArrow
|
|
144
|
+
${({ withArrow }) => withArrow &&
|
|
197
145
|
(0, styled_components_1.css) `
|
|
198
146
|
&::after {
|
|
199
147
|
border-top: 14px solid transparent;
|
|
@@ -201,19 +149,19 @@ const PLACEMENTS = {
|
|
|
201
149
|
border-left-width: 8px;
|
|
202
150
|
border-left-style: solid;
|
|
203
151
|
border-radius: 2px 0 0 2px;
|
|
152
|
+
right: -9px;
|
|
204
153
|
top: 50%;
|
|
205
|
-
|
|
206
|
-
${arrowPosition === 'top' && 'top: 16px; transform: translateX(99%);'}
|
|
207
|
-
${arrowPosition === 'center' && 'top: 50%; transform: translate(99%, -50%);'}
|
|
208
|
-
${arrowPosition === 'bottom' && 'bottom: 16px; transform: translateX(99%);'}
|
|
154
|
+
transform: translateY(-50%);
|
|
209
155
|
}
|
|
210
156
|
`}
|
|
211
157
|
`,
|
|
212
158
|
right: (0, styled_components_1.css) `
|
|
213
159
|
transform: translate(0, -50%);
|
|
214
|
-
margin-left:
|
|
160
|
+
margin-left: 7px;
|
|
161
|
+
top: anchor(center);
|
|
162
|
+
left: anchor(right);
|
|
215
163
|
|
|
216
|
-
${({ withArrow
|
|
164
|
+
${({ withArrow }) => withArrow &&
|
|
217
165
|
(0, styled_components_1.css) `
|
|
218
166
|
&::after {
|
|
219
167
|
border-top: 14px solid transparent;
|
|
@@ -221,28 +169,33 @@ const PLACEMENTS = {
|
|
|
221
169
|
border-right-width: 8px;
|
|
222
170
|
border-right-style: solid;
|
|
223
171
|
border-radius: 0 2px 2px 0;
|
|
172
|
+
left: -9px;
|
|
224
173
|
top: 50%;
|
|
225
|
-
|
|
226
|
-
${arrowPosition === 'top' && 'top: 16px; transform: translateX(-99%);'}
|
|
227
|
-
${arrowPosition === 'center' && 'top: 50%; transform: translate(-99%, -50%);'}
|
|
228
|
-
${arrowPosition === 'bottom' && 'bottom: 16px; transform: translateX(-99%);'}
|
|
174
|
+
transform: translateY(-50%);
|
|
229
175
|
}
|
|
230
176
|
`}
|
|
231
177
|
`,
|
|
232
178
|
};
|
|
233
|
-
const TooltipWrapper = styled_components_1.default.div
|
|
234
|
-
|
|
179
|
+
const TooltipWrapper = styled_components_1.default.div.attrs(({ anchorName }) => ({
|
|
180
|
+
style: {
|
|
181
|
+
anchorName: anchorName,
|
|
182
|
+
},
|
|
183
|
+
})) `
|
|
235
184
|
display: flex;
|
|
236
185
|
`;
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
186
|
+
const TooltipBody = styled_components_1.default.span.attrs(({ anchorName }) => ({
|
|
187
|
+
style: {
|
|
188
|
+
positionAnchor: anchorName,
|
|
189
|
+
},
|
|
190
|
+
})) `
|
|
191
|
+
position: fixed;
|
|
192
|
+
min-width: 64px;
|
|
241
193
|
padding: var(--tooltip-padding);
|
|
242
|
-
max-width:
|
|
194
|
+
max-width: var(--tooltip-max-width);
|
|
243
195
|
white-space: normal;
|
|
244
196
|
word-break: normal;
|
|
245
197
|
overflow-wrap: break-word;
|
|
198
|
+
text-align: left;
|
|
246
199
|
|
|
247
200
|
border-radius: var(--border-radius-md);
|
|
248
201
|
transition: opacity 0.3s ease-out;
|
|
@@ -270,10 +223,10 @@ const TooltipBody = styled_components_1.default.span `
|
|
|
270
223
|
0px 8px 24px 8px #0000000a,
|
|
271
224
|
0px 4px 12px 0px #00000014;
|
|
272
225
|
|
|
273
|
-
width: ${({ width }) => width || '
|
|
226
|
+
width: ${({ width }) => width || 'max-content'};
|
|
227
|
+
|
|
274
228
|
${({ placement }) => (0, styled_components_1.css) `
|
|
275
229
|
${PLACEMENTS[placement]};
|
|
276
230
|
`}
|
|
277
231
|
`;
|
|
278
|
-
/* eslint-enable theme/no-raw-colors-in-styles */
|
|
279
232
|
//# sourceMappingURL=Tooltip.js.map
|
|
@@ -5,5 +5,9 @@ const styled_components_1 = require("styled-components");
|
|
|
5
5
|
exports.tooltipDarkMode = (0, styled_components_1.css) `
|
|
6
6
|
--tooltip-bg-color: var(--color-warm-grey-4);
|
|
7
7
|
--tooltip-border-color: var(--color-warm-grey-5);
|
|
8
|
+
|
|
9
|
+
.tooltip-copy-button {
|
|
10
|
+
--tooltip-bg-color: var(--color-warm-grey-4);
|
|
11
|
+
}
|
|
8
12
|
`;
|
|
9
13
|
//# sourceMappingURL=variables.dark.js.map
|
|
@@ -20,9 +20,9 @@ exports.tooltip = (0, styled_components_1.css) `
|
|
|
20
20
|
--tooltip-max-width: 400px;
|
|
21
21
|
|
|
22
22
|
.tooltip-copy-button {
|
|
23
|
-
--tooltip-text-color: var(--
|
|
24
|
-
--tooltip-bg-color: var(--
|
|
25
|
-
--tooltip-arrow-color: var(--tooltip-
|
|
23
|
+
--tooltip-text-color: var(--color-static-white);
|
|
24
|
+
--tooltip-bg-color: var(--color-warm-grey-10);
|
|
25
|
+
--tooltip-arrow-color: var(--tooltip-border-color);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
.tooltip-catalog {
|
|
@@ -12,7 +12,7 @@ function LoginButton({ href, className, variant = 'primary', size = 'medium', la
|
|
|
12
12
|
const { translate } = useTranslate();
|
|
13
13
|
const telemetry = useTelemetry();
|
|
14
14
|
const buttonLabel = label || translate(labelTranslationKey, 'Login');
|
|
15
|
-
return (react_1.default.createElement("
|
|
15
|
+
return (react_1.default.createElement("span", { "data-component-name": componentName, className: className },
|
|
16
16
|
react_1.default.createElement(Button_1.Button, { "data-translation-key": label ? undefined : labelTranslationKey, to: href, onClick: () => telemetry.sendLoginButtonClickedMessage(), "data-testid": "login-btn", extraClass: className, variant: variant, size: size }, buttonLabel)));
|
|
17
17
|
}
|
|
18
18
|
//# sourceMappingURL=LoginButton.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AiSearchErrorConfig, ToolCallName } from '../types/search';
|
|
2
2
|
export declare enum AiSearchError {
|
|
3
3
|
Unauthorized = "ai_search_unauthorized",
|
|
4
4
|
Forbidden = "ai_search_forbidden",
|
|
@@ -14,3 +14,7 @@ export type AiSearchConversationRole = (typeof AiSearchConversationRole)[keyof t
|
|
|
14
14
|
export declare const AI_SEARCH_ERROR_CONFIG: Record<AiSearchError, AiSearchErrorConfig>;
|
|
15
15
|
export declare const AI_SEARCH_MAX_MESSAGE_LENGTH = 45000;
|
|
16
16
|
export declare const SEARCH_DEBOUNCE_TIME_MS = 300;
|
|
17
|
+
export declare const TOOL_CALL_DISPLAY_TEXT: Record<ToolCallName, {
|
|
18
|
+
inProgressText: string;
|
|
19
|
+
completedText: string;
|
|
20
|
+
}>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SEARCH_DEBOUNCE_TIME_MS = exports.AI_SEARCH_MAX_MESSAGE_LENGTH = exports.AI_SEARCH_ERROR_CONFIG = exports.AiSearchConversationRole = exports.AiSearchError = void 0;
|
|
3
|
+
exports.TOOL_CALL_DISPLAY_TEXT = exports.SEARCH_DEBOUNCE_TIME_MS = exports.AI_SEARCH_MAX_MESSAGE_LENGTH = exports.AI_SEARCH_ERROR_CONFIG = exports.AiSearchConversationRole = exports.AiSearchError = void 0;
|
|
4
|
+
const search_1 = require("../types/search");
|
|
4
5
|
var AiSearchError;
|
|
5
6
|
(function (AiSearchError) {
|
|
6
7
|
AiSearchError["Unauthorized"] = "ai_search_unauthorized";
|
|
@@ -38,4 +39,26 @@ exports.AI_SEARCH_ERROR_CONFIG = {
|
|
|
38
39
|
};
|
|
39
40
|
exports.AI_SEARCH_MAX_MESSAGE_LENGTH = 45000;
|
|
40
41
|
exports.SEARCH_DEBOUNCE_TIME_MS = 300;
|
|
42
|
+
exports.TOOL_CALL_DISPLAY_TEXT = {
|
|
43
|
+
[search_1.ToolCallName.SearchDocumentation]: {
|
|
44
|
+
inProgressText: 'Searching documentation...',
|
|
45
|
+
completedText: 'Search completed',
|
|
46
|
+
},
|
|
47
|
+
[search_1.ToolCallName.ListApis]: {
|
|
48
|
+
inProgressText: 'Browsing APIs...',
|
|
49
|
+
completedText: 'Browsed APIs',
|
|
50
|
+
},
|
|
51
|
+
[search_1.ToolCallName.GetEndpoints]: {
|
|
52
|
+
inProgressText: 'Browsing endpoints for API...',
|
|
53
|
+
completedText: 'Browsed endpoints for API',
|
|
54
|
+
},
|
|
55
|
+
[search_1.ToolCallName.GetSecuritySchemes]: {
|
|
56
|
+
inProgressText: 'Browsing security schemes for API...',
|
|
57
|
+
completedText: 'Browsed security schemes for API',
|
|
58
|
+
},
|
|
59
|
+
[search_1.ToolCallName.GetFullApiDescription]: {
|
|
60
|
+
inProgressText: 'Reading API description...',
|
|
61
|
+
completedText: 'Read API description',
|
|
62
|
+
},
|
|
63
|
+
};
|
|
41
64
|
//# sourceMappingURL=search.js.map
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import type { RefObject } from 'react';
|
|
2
|
-
|
|
2
|
+
type OutsideClickRef = RefObject<HTMLElement | null>;
|
|
3
|
+
export declare function useOutsideClick(refs: OutsideClickRef | OutsideClickRef[], handler?: (event: MouseEvent | TouchEvent) => void): void;
|
|
4
|
+
export {};
|
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useOutsideClick = useOutsideClick;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
function useOutsideClick(
|
|
5
|
+
function useOutsideClick(refs, handler) {
|
|
6
6
|
(0, react_1.useEffect)(() => {
|
|
7
|
+
const refList = Array.isArray(refs) ? refs : [refs];
|
|
7
8
|
const listener = (event) => {
|
|
8
|
-
if (!handler
|
|
9
|
+
if (!handler)
|
|
9
10
|
return;
|
|
11
|
+
const target = event.target;
|
|
12
|
+
const isInside = refList.some((ref) => ref.current && ref.current.contains(target));
|
|
13
|
+
if (!isInside) {
|
|
14
|
+
handler(event);
|
|
10
15
|
}
|
|
11
|
-
handler(event);
|
|
12
16
|
};
|
|
13
17
|
document.addEventListener('mousedown', listener);
|
|
14
18
|
document.addEventListener('touchstart', listener);
|
|
@@ -16,6 +20,6 @@ function useOutsideClick(ref, handler) {
|
|
|
16
20
|
document.removeEventListener('mousedown', listener);
|
|
17
21
|
document.removeEventListener('touchstart', listener);
|
|
18
22
|
};
|
|
19
|
-
}, [
|
|
23
|
+
}, [refs, handler]);
|
|
20
24
|
}
|
|
21
25
|
//# sourceMappingURL=use-outside-click.js.map
|
|
@@ -8,7 +8,7 @@ import type { CatalogConfig, ProductUiConfig } from '../../config';
|
|
|
8
8
|
import type { UseCatalogResponse, FilteredCatalog, UseCatalogSortResponse, UseCatalogSearchResponse, UseCatalogProps, CatalogApiParams, CatalogApiResults } from './catalog';
|
|
9
9
|
import type { UserMenuData } from './user-menu';
|
|
10
10
|
import type { ItemState } from './sidebar';
|
|
11
|
-
import type { SearchItemData, SearchFacet, SearchFilterItem, SearchFacetQuery, AiSearchConversationItem } from './search';
|
|
11
|
+
import type { SearchItemData, SearchFacet, SearchFilterItem, SearchFacetQuery, AiSearchConversationItem, ToolCallName, ContentSegment } from './search';
|
|
12
12
|
import type { SubmitFeedbackParams } from './feedback';
|
|
13
13
|
import type { TFunction } from './l10n';
|
|
14
14
|
import type { BreadcrumbItem } from './breadcrumb';
|
|
@@ -96,6 +96,15 @@ export type ThemeHooks = {
|
|
|
96
96
|
error: null | AiSearchError;
|
|
97
97
|
conversation: AiSearchConversationItem[];
|
|
98
98
|
setConversation: React.Dispatch<React.SetStateAction<AiSearchConversationItem[]>>;
|
|
99
|
+
toolCalls: Array<{
|
|
100
|
+
name: ToolCallName;
|
|
101
|
+
args: unknown;
|
|
102
|
+
position: number;
|
|
103
|
+
result?: {
|
|
104
|
+
documentCount: number;
|
|
105
|
+
};
|
|
106
|
+
}>;
|
|
107
|
+
contentSegments: ContentSegment[];
|
|
99
108
|
};
|
|
100
109
|
useMarkdownText: (text: string) => React.ReactNode;
|
|
101
110
|
useFacetQuery: (field: string) => {
|
package/lib/core/types/l10n.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TOptions } from 'i18next';
|
|
2
|
-
export type TranslationKey = 'dev.newApp' | 'dev.newApp.text' | 'dev.sidebar.header' | 'dev.sidebar.footer.text' | 'dev.create.app.dialog.appName.placeholder' | 'dev.create.app.dialog.appName.error' | 'dev.create.app.dialog.selectAPIs' | 'dev.create.app.dialog.description' | 'dev.create.app.dialog.description.placeholder' | 'dev.create.app.dialog.create' | 'dev.create.app.dialog.cancel' | 'dev.main.tab.appKeys' | 'dev.main.tab.logs' | 'dev.app.description.title' | 'dev.edit.description.dialog.title' | 'dev.edit.description.dialog.save' | 'dev.edit.description.dialog.cancel' | 'dev.edit.apis.dialog.selectedAPIs' | 'dev.app.key.create' | 'dev.create.key.dialog.title' | 'dev.create.key.dialog.create' | 'dev.create.key.dialog.cancel' | 'dev.app.edit' | 'dev.app.delete' | 'dev.edit.app.dialog.title' | 'dev.edit.app.dialog.save' | 'dev.edit.app.dialog.cancel' | 'dev.delete.app.dialog.title' | 'dev.delete.app.dialog.confirmation' | 'dev.delete.app.dialog.delete' | 'dev.delete.app.dialog.cancel' | 'dev.app.key.roll' | 'dev.roll.key.dialog.title' | 'dev.roll.key.dialog.apiKey' | 'dev.roll.key.dialog.expires' | 'dev.roll.key.dialog.confirmation' | 'dev.roll.key.dialog.cancel' | 'dev.roll.key.dialog.roll' | 'dev.update.key.dialog.title' | 'dev.update.key.dialog.update' | 'dev.update.key.dialog.cancel' | 'dev.app.key.api.name' | 'dev.app.key.api.status' | 'dev.app.key.api.edit' | 'dev.edit.apis.dialog.title' | 'dev.edit.apis.dialog.apiKey' | 'dev.edit.apis.dialog.save' | 'dev.edit.apis.dialog.cancel' | 'dev.select.placeholder' | 'dev.app.overview.status.pending' | 'dev.app.overview.status.approved' | 'dev.app.overview.status.revoked' | 'dev.app.overview.status' | 'dev.app.overview.non-production' | 'dev.app.overview.production' | 'dev.app.overview.clientId' | 'dev.app.overview.apiKey' | 'dev.app.key.revoke' | 'dev.revoke.key.dialog.title' | 'dev.revoke.key.dialog.apiKey' | 'dev.revoke.key.dialog.expires' | 'dev.revoke.key.dialog.confirmation' | 'dev.revoke.key.dialog.revoke' | 'dev.revoke.key.dialog.cancel' | 'dev.app.overview.expires' | 'dev.app.overview.created' | 'dev.app.overview.visibilityToggle.hide' | 'dev.app.overview.visibilityToggle.show' | 'search.loading' | 'search.noResults.title' | 'search.keys.navigate' | 'search.keys.select' | 'search.keys.exit' | 'search.label' | 'search.cancel' | 'search.recent' | 'search.navbar.label' | 'search.suggested' | 'search.showMore' | 'search.filter.title' | 'search.filter.reset' | 'search.filter.field.reset' | 'search.ai.welcomeText' | 'search.ai.newConversation' | 'search.ai.backToSearch' | 'search.ai.back' | 'search.ai.assistant' | 'search.ai.placeholder' | 'search.ai.generatingResponse' | 'search.ai.followUpQuestion' | 'search.ai.suggestionsTitle' | 'search.ai.thinkingText' | 'search.ai.resourcesFound' | 'search.ai.resourcesFound.basedOn' | 'search.ai.resourcesFound.resources' | 'search.ai.feedback.title' | 'search.ai.feedback.detailsPlaceholder' | 'search.ai.feedback.thanks' | 'search.ai.button' | 'search.ai.label' | 'search.ai.disclaimer' | 'search.ai.error.description' | 'search.ai.error.description.forbidden' | 'search.ai.error.description.unauthorized' | 'search.ai.error.header' | 'search.ai.error.header.forbidden' | 'search.ai.error.header.unauthorized' | 'search.ai.feedback.more' | 'search.searchItem.deprecated' | 'search.groups.all' | 'search.filter.field.footer' | 'aiAssistant.trigger' | 'toc.header' | 'footer.copyrightText' | 'page.homeButton' | 'page.forbidden.title' | 'page.forbidden.description' | 'page.notFound.title' | 'page.notFound.description' | 'page.lastUpdated.timeago' | 'page.lastUpdated.on' | 'catalog.filters.placeholder' | 'catalog.filters.title' | 'catalog.filters.add' | 'catalog.filters.clearAll' | 'catalog.filters.select.addFilter' | 'catalog.filters.select.all' | 'catalog.filters.done' | 'catalog.catalogs.all.title' | 'catalog.catalogs.all.description' | 'catalog.catalogs.all.switcherLabel' | 'catalog.catalogs.service.title' | 'catalog.catalogs.service.description' | 'catalog.catalogs.service.switcherLabel' | 'catalog.catalogs.user.title' | 'catalog.catalogs.user.description' | 'catalog.catalogs.user.switcherLabel' | 'catalog.catalogs.team.title' | 'catalog.catalogs.team.description' | 'catalog.catalogs.team.switcherLabel' | 'catalog.catalogs.domain.title' | 'catalog.catalogs.domain.description' | 'catalog.catalogs.domain.switcherLabel' | 'catalog.catalogs.apiDescription.title' | 'catalog.catalogs.apiDescription.description' | 'catalog.catalogs.apiDescription.switcherLabel' | 'catalog.catalogs.dataSchema.title' | 'catalog.catalogs.dataSchema.description' | 'catalog.catalogs.dataSchema.switcherLabel' | 'catalog.catalogs.apiOperation.title' | 'catalog.catalogs.apiOperation.description' | 'catalog.catalogs.apiOperation.switcherLabel' | 'catalog.entity.metadata.title' | 'catalog.entity.schema.title' | 'catalog.entity.properties.apiDescription.title' | 'catalog.backToAllLabel' | 'catalog.tags.more' | 'catalog.tags.label' | 'catalog.sort' | 'catalog.catalogs.label' | 'catalog.owners.label' | 'catalog.repositories.label' | 'catalog.email.label' | 'catalog.format.label' | 'catalog.entityType.label' | 'catalog.domains.label' | 'catalog.contact.label' | 'catalog.methodAndPath.label' | 'catalog.links.label' | 'catalog.metadata.domains' | 'catalog.metadata.owners' | 'catalog.history.button.label' | 'catalog.history.sidebar.title' | 'catalog.history.sidebar.close' | 'catalog.history.version.label' | 'catalog.history.version.notSpecified' | 'catalog.history.version.default' | 'catalog.history.revisions.limitMessage' | 'catalog.history.revision.current' | 'catalog.history.revisions.showLess' | 'catalog.history.revisions.showMore' | 'sidebar.menu.backLabel' | 'sidebar.menu.backToLabel' | 'sidebar.actions.show' | 'sidebar.actions.hide' | 'sidebar.actions.changeToSingleColumn' | 'sidebar.actions.changeToTwoColumns' | 'sidebar.actions.singleColumn' | 'sidebar.actions.twoColumns' | 'versionPicker.label' | 'versionPicker.unversioned' | 'codeSnippet.copy.buttonText' | 'codeSnippet.copy.tooltipText' | 'codeSnippet.copy.toasterText' | 'markdown.editPage.text' | 'feedback.settings.comment.submitText' | 'feedback.settings.comment.label' | 'feedback.settings.comment.send' | 'feedback.settings.comment.cancel' | 'feedback.settings.comment.satisfiedLabel' | 'feedback.settings.comment.neutralLabel' | 'feedback.settings.comment.dissatisfiedLabel' | 'feedback.settings.submitText' | 'feedback.settings.label' | 'feedback.settings.reasons.label' | 'feedback.submit' | 'feedback.cancel' | 'feedback.settings.comment.likeLabel' | 'feedback.settings.comment.dislikeLabel' | 'feedback.sentiment.thumbUp' | 'feedback.sentiment.thumbDown' | 'feedback.settings.leftScaleLabel' | 'feedback.settings.rightScaleLabel' | 'feedback.settings.optionalEmail.placeholder' | 'feedback.settings.optionalEmail.label' | 'codeSnippet.report.buttonText' | 'codeSnippet.report.tooltipText' | 'codeSnippet.report.label' | 'codeSnippet.expand.tooltipText' | 'codeSnippet.collapse.tooltipText' | 'userMenu.login' | 'userMenu.logout' | 'userMenu.devOnboardingLabel' | 'mobileMenu.mainMenu' | 'mobileMenu.previous' | 'mobileMenu.products' | 'mobileMenu.version' | 'navbar.products' | 'page.nextButton' | 'page.previousButton' | 'page.actions.copyButtonText' | 'page.actions.copyTitle' | 'page.actions.copyDescription' | 'page.actions.viewAsMdTitle' | 'page.actions.viewAsMdButtonText' | 'page.actions.viewAsMdDescription' | 'page.actions.chatGptTitle' | 'page.actions.chatGptButtonText' | 'page.actions.chatGptDescription' | 'page.actions.claudeTitle' | 'page.actions.claudeButtonText' | 'page.actions.claudeDescription' | 'page.actions.cursorMcpButtonText' | 'page.actions.cursorMcpTitle' | 'page.actions.cursorMcpDescription' | 'page.actions.connectMcp' | 'page.actions.connectMcp.cursor' | 'page.actions.connectMcp.cursorDescription' | 'page.actions.connectMcp.vscode' | 'page.actions.connectMcp.vscodeDescription' | 'page.actions.connectMcp.copyConfig' | 'page.actions.connectMcp.copyConfigDescription' | 'openapi.download.description.title' | 'openapi.info.title' | 'openapi.info.contact.url' | 'openapi.info.contact.name' | 'openapi.info.license' | 'openapi.info.termsOfService' | 'openapi.info.metadata.title' | 'openapi.key' | 'openapi.value' | 'openapi.enum' | 'openapi.items' | 'openapi.default' | 'openapi.variable' | 'openapi.variables' | 'openapi.actions.show' | 'openapi.actions.hide' | 'openapi.actions.more' | 'openapi.languages.title' | 'openapi.servers.title' | 'openapi.operations' | 'openapi.webhooks' | 'openapi.description' | 'openapi.badges.deprecated' | 'openapi.badges.required' | 'openapi.badges.webhook' | 'openapi.request' | 'openapi.path' | 'openapi.query' | 'openapi.cookie' | 'openapi.header' | 'openapi.body' | 'openapi.responses' | 'openapi.response' | 'openapi.callbacks' | 'openapi.callbackRequest' | 'openapi.callbackResponse' | 'openapi.payload' | 'openapi.discriminator' | 'openapi.contentType' | 'openapi.tryIt' | 'openapi.loading' | 'openapi.example' | 'openapi.examples' | 'openapi.additionalProperties' | 'openapi.patternProperties' | 'openapi.required' | 'openapi.recursive' | 'openapi.complex' | 'openapi.hideExample' | 'openapi.showExample' | 'openapi.expandAll' | 'openapi.collapseAll' | 'openapi.viewSecurityDetails' | 'openapi.noResponseExample' | 'openapi.discriminator.searchPlaceholder' | 'openapi.discriminator.searchNoResults' | 'openapi.discriminator.defaultMapping' | 'openapi.discriminator.defaultMappingTooltip' | 'openapi.noResponseContent' | 'openapi.noRequestPayload' | 'openapi.hidePattern' | 'openapi.showPattern' | 'openapi.authorizationUrl' | 'openapi.tokenUrl' | 'openapi.refreshUrl' | 'openapi.showOptionalScopes' | 'openapi.hideOptionalScopes' | 'openapi.security' | 'openapi.httpAuthorizationScheme' | 'openapi.bearerFormat' | 'openapi.parameterName' | 'openapi.flowType' | 'openapi.connectUrl' | 'openapi.requiredScopes' | 'openapi.unsupportedLanguage' | 'openapi.failedToGenerateCodeSample' | 'openapi.schemaCatalogLink.title' | 'openapi.schemaCatalogLink.copyButtonTooltip' | 'openapi.schemaCatalogLink.copiedTooltip' | 'openapi.mcp.title' | 'openapi.mcp.endpoint' | 'openapi.mcp.tools' | 'openapi.mcp.protocolVersion' | 'openapi.mcp.capabilities' | 'openapi.mcp.experimentalCapabilities' | 'openapi.mcp.inputSchema' | 'openapi.mcp.inputExample' | 'openapi.mcp.outputSchema' | 'openapi.mcp.outputExample' | 'asyncapi.download.description.title' | 'asyncapi.info.title' | 'graphql.download.description.title' | 'graphql.info.title' | 'graphql.info.contact.url' | 'graphql.info.contact.name' | 'graphql.info.license' | 'graphql.info.termsOfService' | 'graphql.overview' | 'graphql.metadata' | 'graphql.key' | 'graphql.value' | 'graphql.queries' | 'graphql.mutations' | 'graphql.subscriptions' | 'graphql.directives' | 'graphql.objects' | 'graphql.interfaces' | 'graphql.unions' | 'graphql.enums' | 'graphql.inputs' | 'graphql.scalars' | 'graphql.arguments.label' | 'graphql.arguments.show' | 'graphql.arguments.hide' | 'graphql.arguments.here' | 'graphql.returnTypes.label' | 'graphql.returnTypes.show' | 'graphql.returnTypes.hide' | 'graphql.possibleTypes' | 'graphql.defaultValue' | 'graphql.deprecationReason' | 'graphql.requiredScopes' | 'graphql.viewSecurityDetails' | 'graphql.objectScopes' | 'graphql.fieldScopes' | 'graphql.implementedInterfaces' | 'graphql.nonNull' | 'graphql.required' | 'graphql.deprecated' | 'graphql.variables' | 'graphql.querySample' | 'graphql.mutationSample' | 'graphql.subscriptionSample' | 'graphql.responseSample' | 'graphql.locations' | 'graphql.sample' | 'graphql.referenced' | 'graphql.content.fragment' | 'codeWalkthrough.download' | 'codeWalkthrough.preview' | 'time.justNow' | 'time.past.second' | 'time.past.seconds' | 'time.past.minute' | 'time.past.minutes' | 'time.past.hour' | 'time.past.hours' | 'time.past.day' | 'time.past.days' | 'time.past.week' | 'time.past.weeks' | 'time.past.month' | 'time.past.months' | 'time.past.year' | 'time.past.years' | 'page.internalServerError.title' | 'page.internalServerError.description' | 'page.skipToContent.label' | 'select.noResults' | 'loaders.loading' | 'filter.dateRange.from' | 'filter.dateRange.to' | 'mermaid.openFullscreen' | 'mermaid.zoomIn' | 'mermaid.zoomOut' | 'mermaid.reset' | 'mermaid.close' | 'mermaid.viewer';
|
|
2
|
+
export type TranslationKey = 'dev.newApp' | 'dev.newApp.text' | 'dev.sidebar.header' | 'dev.sidebar.footer.text' | 'dev.create.app.dialog.appName.placeholder' | 'dev.create.app.dialog.appName.error' | 'dev.create.app.dialog.selectAPIs' | 'dev.create.app.dialog.description' | 'dev.create.app.dialog.description.placeholder' | 'dev.create.app.dialog.create' | 'dev.create.app.dialog.cancel' | 'dev.main.tab.appKeys' | 'dev.main.tab.logs' | 'dev.app.description.title' | 'dev.edit.description.dialog.title' | 'dev.edit.description.dialog.save' | 'dev.edit.description.dialog.cancel' | 'dev.edit.apis.dialog.selectedAPIs' | 'dev.app.key.create' | 'dev.create.key.dialog.title' | 'dev.create.key.dialog.create' | 'dev.create.key.dialog.cancel' | 'dev.app.edit' | 'dev.app.delete' | 'dev.edit.app.dialog.title' | 'dev.edit.app.dialog.save' | 'dev.edit.app.dialog.cancel' | 'dev.delete.app.dialog.title' | 'dev.delete.app.dialog.confirmation' | 'dev.delete.app.dialog.delete' | 'dev.delete.app.dialog.cancel' | 'dev.app.key.roll' | 'dev.roll.key.dialog.title' | 'dev.roll.key.dialog.apiKey' | 'dev.roll.key.dialog.expires' | 'dev.roll.key.dialog.confirmation' | 'dev.roll.key.dialog.cancel' | 'dev.roll.key.dialog.roll' | 'dev.update.key.dialog.title' | 'dev.update.key.dialog.update' | 'dev.update.key.dialog.cancel' | 'dev.app.key.api.name' | 'dev.app.key.api.status' | 'dev.app.key.api.edit' | 'dev.edit.apis.dialog.title' | 'dev.edit.apis.dialog.apiKey' | 'dev.edit.apis.dialog.save' | 'dev.edit.apis.dialog.cancel' | 'dev.select.placeholder' | 'dev.app.overview.status.pending' | 'dev.app.overview.status.approved' | 'dev.app.overview.status.revoked' | 'dev.app.overview.status' | 'dev.app.overview.non-production' | 'dev.app.overview.production' | 'dev.app.overview.clientId' | 'dev.app.overview.apiKey' | 'dev.app.key.revoke' | 'dev.revoke.key.dialog.title' | 'dev.revoke.key.dialog.apiKey' | 'dev.revoke.key.dialog.expires' | 'dev.revoke.key.dialog.confirmation' | 'dev.revoke.key.dialog.revoke' | 'dev.revoke.key.dialog.cancel' | 'dev.app.overview.expires' | 'dev.app.overview.created' | 'dev.app.overview.visibilityToggle.hide' | 'dev.app.overview.visibilityToggle.show' | 'search.loading' | 'search.noResults.title' | 'search.keys.navigate' | 'search.keys.select' | 'search.keys.exit' | 'search.label' | 'search.cancel' | 'search.recent' | 'search.navbar.label' | 'search.suggested' | 'search.showMore' | 'search.filter.title' | 'search.filter.reset' | 'search.filter.field.reset' | 'search.ai.welcomeText' | 'search.ai.newConversation' | 'search.ai.backToSearch' | 'search.ai.back' | 'search.ai.assistant' | 'search.ai.placeholder' | 'search.ai.generatingResponse' | 'search.ai.followUpQuestion' | 'search.ai.suggestionsTitle' | 'search.ai.thinkingText' | 'search.ai.resourcesFound' | 'search.ai.resourcesFound.basedOn' | 'search.ai.resourcesFound.resources' | 'search.ai.feedback.title' | 'search.ai.feedback.detailsPlaceholder' | 'search.ai.feedback.thanks' | 'search.ai.toolResult.found' | 'search.ai.toolResult.found.documents' | 'search.ai.toolCall.searching' | 'search.ai.button' | 'search.ai.label' | 'search.ai.disclaimer' | 'search.ai.error.description' | 'search.ai.error.description.forbidden' | 'search.ai.error.description.unauthorized' | 'search.ai.error.header' | 'search.ai.error.header.forbidden' | 'search.ai.error.header.unauthorized' | 'search.ai.feedback.more' | 'search.searchItem.deprecated' | 'search.groups.all' | 'search.filter.field.footer' | 'aiAssistant.trigger' | 'toc.header' | 'footer.copyrightText' | 'page.homeButton' | 'page.forbidden.title' | 'page.forbidden.description' | 'page.notFound.title' | 'page.notFound.description' | 'page.lastUpdated.timeago' | 'page.lastUpdated.on' | 'catalog.filters.placeholder' | 'catalog.filters.title' | 'catalog.filters.add' | 'catalog.filters.clearAll' | 'catalog.filters.select.addFilter' | 'catalog.filters.select.all' | 'catalog.filters.done' | 'catalog.catalogs.all.title' | 'catalog.catalogs.all.description' | 'catalog.catalogs.all.switcherLabel' | 'catalog.catalogs.service.title' | 'catalog.catalogs.service.description' | 'catalog.catalogs.service.switcherLabel' | 'catalog.catalogs.user.title' | 'catalog.catalogs.user.description' | 'catalog.catalogs.user.switcherLabel' | 'catalog.catalogs.team.title' | 'catalog.catalogs.team.description' | 'catalog.catalogs.team.switcherLabel' | 'catalog.catalogs.domain.title' | 'catalog.catalogs.domain.description' | 'catalog.catalogs.domain.switcherLabel' | 'catalog.catalogs.apiDescription.title' | 'catalog.catalogs.apiDescription.description' | 'catalog.catalogs.apiDescription.switcherLabel' | 'catalog.catalogs.dataSchema.title' | 'catalog.catalogs.dataSchema.description' | 'catalog.catalogs.dataSchema.switcherLabel' | 'catalog.catalogs.apiOperation.title' | 'catalog.catalogs.apiOperation.description' | 'catalog.catalogs.apiOperation.switcherLabel' | 'catalog.entity.metadata.title' | 'catalog.entity.schema.title' | 'catalog.entity.properties.apiDescription.title' | 'catalog.backToAllLabel' | 'catalog.tags.more' | 'catalog.tags.label' | 'catalog.sort' | 'catalog.catalogs.label' | 'catalog.owners.label' | 'catalog.repositories.label' | 'catalog.email.label' | 'catalog.format.label' | 'catalog.entityType.label' | 'catalog.domains.label' | 'catalog.contact.label' | 'catalog.methodAndPath.label' | 'catalog.links.label' | 'catalog.metadata.domains' | 'catalog.metadata.owners' | 'catalog.history.button.label' | 'catalog.history.sidebar.title' | 'catalog.history.sidebar.close' | 'catalog.history.version.label' | 'catalog.history.version.notSpecified' | 'catalog.history.version.default' | 'catalog.history.revisions.limitMessage' | 'catalog.history.revision.current' | 'catalog.history.revisions.showLess' | 'catalog.history.revisions.showMore' | 'sidebar.menu.backLabel' | 'sidebar.menu.backToLabel' | 'sidebar.actions.show' | 'sidebar.actions.hide' | 'sidebar.actions.changeToSingleColumn' | 'sidebar.actions.changeToTwoColumns' | 'sidebar.actions.singleColumn' | 'sidebar.actions.twoColumns' | 'versionPicker.label' | 'versionPicker.unversioned' | 'codeSnippet.copy.buttonText' | 'codeSnippet.copy.tooltipText' | 'codeSnippet.copy.toasterText' | 'markdown.editPage.text' | 'feedback.settings.comment.submitText' | 'feedback.settings.comment.label' | 'feedback.settings.comment.send' | 'feedback.settings.comment.cancel' | 'feedback.settings.comment.satisfiedLabel' | 'feedback.settings.comment.neutralLabel' | 'feedback.settings.comment.dissatisfiedLabel' | 'feedback.settings.submitText' | 'feedback.settings.label' | 'feedback.settings.reasons.label' | 'feedback.submit' | 'feedback.cancel' | 'feedback.settings.comment.likeLabel' | 'feedback.settings.comment.dislikeLabel' | 'feedback.sentiment.thumbUp' | 'feedback.sentiment.thumbDown' | 'feedback.settings.leftScaleLabel' | 'feedback.settings.rightScaleLabel' | 'feedback.settings.optionalEmail.placeholder' | 'feedback.settings.optionalEmail.label' | 'codeSnippet.report.buttonText' | 'codeSnippet.report.tooltipText' | 'codeSnippet.report.label' | 'codeSnippet.expand.tooltipText' | 'codeSnippet.collapse.tooltipText' | 'userMenu.login' | 'userMenu.logout' | 'userMenu.devOnboardingLabel' | 'mobileMenu.mainMenu' | 'mobileMenu.previous' | 'mobileMenu.products' | 'mobileMenu.version' | 'navbar.products' | 'page.nextButton' | 'page.previousButton' | 'page.actions.copyButtonText' | 'page.actions.copyTitle' | 'page.actions.copyDescription' | 'page.actions.viewAsMdTitle' | 'page.actions.viewAsMdButtonText' | 'page.actions.viewAsMdDescription' | 'page.actions.chatGptTitle' | 'page.actions.chatGptButtonText' | 'page.actions.chatGptDescription' | 'page.actions.claudeTitle' | 'page.actions.claudeButtonText' | 'page.actions.claudeDescription' | 'page.actions.cursorMcpButtonText' | 'page.actions.cursorMcpTitle' | 'page.actions.cursorMcpDescription' | 'page.actions.connectMcp' | 'page.actions.connectMcp.cursor' | 'page.actions.connectMcp.cursorDescription' | 'page.actions.connectMcp.vscode' | 'page.actions.connectMcp.vscodeDescription' | 'page.actions.connectMcp.copyConfig' | 'page.actions.connectMcp.copyConfigDescription' | 'openapi.download.description.title' | 'openapi.info.title' | 'openapi.info.contact.url' | 'openapi.info.contact.name' | 'openapi.info.license' | 'openapi.info.termsOfService' | 'openapi.info.metadata.title' | 'openapi.key' | 'openapi.value' | 'openapi.enum' | 'openapi.items' | 'openapi.default' | 'openapi.variable' | 'openapi.variables' | 'openapi.actions.show' | 'openapi.actions.hide' | 'openapi.actions.more' | 'openapi.languages.title' | 'openapi.servers.title' | 'openapi.operations' | 'openapi.webhooks' | 'openapi.description' | 'openapi.badges.deprecated' | 'openapi.badges.required' | 'openapi.badges.webhook' | 'openapi.request' | 'openapi.path' | 'openapi.query' | 'openapi.cookie' | 'openapi.header' | 'openapi.body' | 'openapi.responses' | 'openapi.response' | 'openapi.callbacks' | 'openapi.callbackRequest' | 'openapi.callbackResponse' | 'openapi.payload' | 'openapi.discriminator' | 'openapi.contentType' | 'openapi.tryIt' | 'openapi.loading' | 'openapi.example' | 'openapi.examples' | 'openapi.additionalProperties' | 'openapi.patternProperties' | 'openapi.required' | 'openapi.recursive' | 'openapi.complex' | 'openapi.hideExample' | 'openapi.showExample' | 'openapi.expandAll' | 'openapi.collapseAll' | 'openapi.viewSecurityDetails' | 'openapi.noResponseExample' | 'openapi.discriminator.searchPlaceholder' | 'openapi.discriminator.searchNoResults' | 'openapi.discriminator.defaultMapping' | 'openapi.discriminator.defaultMappingTooltip' | 'openapi.noResponseContent' | 'openapi.noRequestPayload' | 'openapi.hidePattern' | 'openapi.showPattern' | 'openapi.authorizationUrl' | 'openapi.tokenUrl' | 'openapi.refreshUrl' | 'openapi.showOptionalScopes' | 'openapi.hideOptionalScopes' | 'openapi.security' | 'openapi.httpAuthorizationScheme' | 'openapi.bearerFormat' | 'openapi.parameterName' | 'openapi.flowType' | 'openapi.connectUrl' | 'openapi.requiredScopes' | 'openapi.unsupportedLanguage' | 'openapi.failedToGenerateCodeSample' | 'openapi.schemaCatalogLink.title' | 'openapi.schemaCatalogLink.copyButtonTooltip' | 'openapi.schemaCatalogLink.copiedTooltip' | 'openapi.mcp.title' | 'openapi.mcp.endpoint' | 'openapi.mcp.tools' | 'openapi.mcp.protocolVersion' | 'openapi.mcp.capabilities' | 'openapi.mcp.experimentalCapabilities' | 'openapi.mcp.inputSchema' | 'openapi.mcp.inputExample' | 'openapi.mcp.outputSchema' | 'openapi.mcp.outputExample' | 'asyncapi.download.description.title' | 'asyncapi.info.title' | 'graphql.download.description.title' | 'graphql.info.title' | 'graphql.info.contact.url' | 'graphql.info.contact.name' | 'graphql.info.license' | 'graphql.info.termsOfService' | 'graphql.overview' | 'graphql.metadata' | 'graphql.key' | 'graphql.value' | 'graphql.queries' | 'graphql.mutations' | 'graphql.subscriptions' | 'graphql.directives' | 'graphql.objects' | 'graphql.interfaces' | 'graphql.unions' | 'graphql.enums' | 'graphql.inputs' | 'graphql.scalars' | 'graphql.arguments.label' | 'graphql.arguments.show' | 'graphql.arguments.hide' | 'graphql.arguments.here' | 'graphql.returnTypes.label' | 'graphql.returnTypes.show' | 'graphql.returnTypes.hide' | 'graphql.possibleTypes' | 'graphql.defaultValue' | 'graphql.deprecationReason' | 'graphql.requiredScopes' | 'graphql.viewSecurityDetails' | 'graphql.objectScopes' | 'graphql.fieldScopes' | 'graphql.implementedInterfaces' | 'graphql.nonNull' | 'graphql.required' | 'graphql.deprecated' | 'graphql.variables' | 'graphql.querySample' | 'graphql.mutationSample' | 'graphql.subscriptionSample' | 'graphql.responseSample' | 'graphql.locations' | 'graphql.sample' | 'graphql.referenced' | 'graphql.content.fragment' | 'codeWalkthrough.download' | 'codeWalkthrough.preview' | 'time.justNow' | 'time.past.second' | 'time.past.seconds' | 'time.past.minute' | 'time.past.minutes' | 'time.past.hour' | 'time.past.hours' | 'time.past.day' | 'time.past.days' | 'time.past.week' | 'time.past.weeks' | 'time.past.month' | 'time.past.months' | 'time.past.year' | 'time.past.years' | 'page.internalServerError.title' | 'page.internalServerError.description' | 'page.skipToContent.label' | 'select.noResults' | 'loaders.loading' | 'filter.dateRange.from' | 'filter.dateRange.to' | 'mermaid.openFullscreen' | 'mermaid.zoomIn' | 'mermaid.zoomOut' | 'mermaid.reset' | 'mermaid.close' | 'mermaid.viewer';
|
|
3
3
|
export type Locale = {
|
|
4
4
|
code: string;
|
|
5
5
|
name: string;
|
|
@@ -91,10 +91,34 @@ export type SearchAiMessageResource = {
|
|
|
91
91
|
url: string;
|
|
92
92
|
title: string;
|
|
93
93
|
};
|
|
94
|
+
export type ToolCall = {
|
|
95
|
+
name: ToolCallName;
|
|
96
|
+
args: unknown;
|
|
97
|
+
position: number;
|
|
98
|
+
result?: {
|
|
99
|
+
documentCount: number;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
export type ContentSegment = {
|
|
103
|
+
type: 'text';
|
|
104
|
+
text: string;
|
|
105
|
+
} | {
|
|
106
|
+
type: 'tool';
|
|
107
|
+
toolCall: ToolCall;
|
|
108
|
+
};
|
|
94
109
|
export type AiSearchConversationItem = {
|
|
95
110
|
role: AiSearchConversationRole;
|
|
96
111
|
content: string;
|
|
97
112
|
resources?: SearchAiMessageResource[];
|
|
98
113
|
messageId?: string;
|
|
99
114
|
feedback?: FeedbackType;
|
|
115
|
+
toolCalls?: ToolCall[];
|
|
116
|
+
contentSegments?: ContentSegment[];
|
|
100
117
|
};
|
|
118
|
+
export declare enum ToolCallName {
|
|
119
|
+
SearchDocumentation = "search_documentation",
|
|
120
|
+
ListApis = "list-apis",
|
|
121
|
+
GetEndpoints = "get-endpoints",
|
|
122
|
+
GetSecuritySchemes = "get-security-schemes",
|
|
123
|
+
GetFullApiDescription = "get-full-api-description"
|
|
124
|
+
}
|
package/lib/core/types/search.js
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FeedbackType = void 0;
|
|
3
|
+
exports.ToolCallName = exports.FeedbackType = void 0;
|
|
4
4
|
var FeedbackType;
|
|
5
5
|
(function (FeedbackType) {
|
|
6
6
|
FeedbackType["Like"] = "like";
|
|
7
7
|
FeedbackType["Dislike"] = "dislike";
|
|
8
8
|
})(FeedbackType || (exports.FeedbackType = FeedbackType = {}));
|
|
9
|
+
var ToolCallName;
|
|
10
|
+
(function (ToolCallName) {
|
|
11
|
+
ToolCallName["SearchDocumentation"] = "search_documentation";
|
|
12
|
+
ToolCallName["ListApis"] = "list-apis";
|
|
13
|
+
ToolCallName["GetEndpoints"] = "get-endpoints";
|
|
14
|
+
ToolCallName["GetSecuritySchemes"] = "get-security-schemes";
|
|
15
|
+
ToolCallName["GetFullApiDescription"] = "get-full-api-description";
|
|
16
|
+
})(ToolCallName || (exports.ToolCallName = ToolCallName = {}));
|
|
9
17
|
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.splitContentByToolCalls = splitContentByToolCalls;
|
|
4
|
+
function splitContentByToolCalls(content, toolCalls) {
|
|
5
|
+
if (!toolCalls || toolCalls.length === 0) {
|
|
6
|
+
return [{ type: 'text', text: content || '' }];
|
|
7
|
+
}
|
|
8
|
+
const segments = [];
|
|
9
|
+
let lastPos = 0;
|
|
10
|
+
for (const toolCall of toolCalls) {
|
|
11
|
+
if (content && toolCall.position > lastPos) {
|
|
12
|
+
segments.push({ type: 'text', text: content.substring(lastPos, toolCall.position) });
|
|
13
|
+
}
|
|
14
|
+
segments.push({ type: 'tool', toolCall });
|
|
15
|
+
lastPos = toolCall.position;
|
|
16
|
+
}
|
|
17
|
+
if (content && lastPos < content.length) {
|
|
18
|
+
segments.push({ type: 'text', text: content.substring(lastPos) });
|
|
19
|
+
}
|
|
20
|
+
return segments;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=content-segments.js.map
|
package/lib/core/utils/index.js
CHANGED
|
@@ -59,4 +59,5 @@ __exportStar(require("./get-operation-color"), exports);
|
|
|
59
59
|
__exportStar(require("./frontmatter-translate"), exports);
|
|
60
60
|
__exportStar(require("./transform-revisions-to-version-history"), exports);
|
|
61
61
|
__exportStar(require("./build-revision-url"), exports);
|
|
62
|
+
__exportStar(require("./content-segments"), exports);
|
|
62
63
|
//# sourceMappingURL=index.js.map
|