@apify/docs-theme 1.0.214 → 1.0.216
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/package.json +3 -3
- package/src/config.js +15 -32
- package/src/theme/LLMButtons/index.jsx +0 -32
- package/src/theme/SearchBar/index.js +38 -167
- package/src/theme/SearchBar/styles.css +37 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apify/docs-theme",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.216",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"access": "public"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@apify/docs-search-modal": "^1.
|
|
23
|
-
"@apify/ui-library": "^1.97.2",
|
|
22
|
+
"@apify/docs-search-modal": "^1.3.3",
|
|
24
23
|
"@apify/ui-icons": "^1.19.0",
|
|
24
|
+
"@apify/ui-library": "^1.97.2",
|
|
25
25
|
"@docusaurus/theme-common": "^3.7.0",
|
|
26
26
|
"@stackql/docusaurus-plugin-hubspot": "^1.1.0",
|
|
27
27
|
"algoliasearch": "^5.19.0",
|
package/src/config.js
CHANGED
|
@@ -315,44 +315,27 @@ const plugins = [
|
|
|
315
315
|
];
|
|
316
316
|
|
|
317
317
|
const scripts = [
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
// 'data-font-size-md': '1.6rem',
|
|
334
|
-
// 'data-font-size-lg': '1.8rem',
|
|
335
|
-
// 'data-font-size-xl': '2.0rem',
|
|
336
|
-
// async: true,
|
|
337
|
-
// },
|
|
338
|
-
// {
|
|
339
|
-
// src: 'https://cdn.jsdelivr.net/npm/@inkeep/cxkit-js@0.5/dist/embed.js',
|
|
340
|
-
// type: 'module',
|
|
341
|
-
// async: true,
|
|
342
|
-
// },
|
|
318
|
+
{
|
|
319
|
+
src: 'https://widget.kapa.ai/kapa-widget.bundle.js',
|
|
320
|
+
'data-website-id': 'a9937f98-9c9d-44d9-a433-fec4cb1c114d',
|
|
321
|
+
'data-project-name': 'Apify',
|
|
322
|
+
'data-modal-title': 'Apify AI Assistant',
|
|
323
|
+
'data-project-color': '#666666',
|
|
324
|
+
'data-button-hide': 'true',
|
|
325
|
+
'data-project-logo': 'https://apify.com/img/apify-logo/logomark-32x32.svg',
|
|
326
|
+
'data-modal-example-questions': 'How to run an Actor?,Create a version of an Actor?',
|
|
327
|
+
'data-modal-override-open-id': 'ask-ai-input',
|
|
328
|
+
'data-modal-override-open-class': 'search-input',
|
|
329
|
+
'data-scale-factor': '1.6',
|
|
330
|
+
'data-modal-size': '800px',
|
|
331
|
+
async: true,
|
|
332
|
+
},
|
|
343
333
|
];
|
|
344
334
|
|
|
345
|
-
const customFields = {
|
|
346
|
-
// inkeepApiKey: process.env.LOCALHOST || process.env.DEV
|
|
347
|
-
// ? 'bbbb9f1001a9b66f282431a80bb743a24e2bdefb85d4f1e4' // development, works with localhost
|
|
348
|
-
// : '8af30e40009f26622237f75aab8256064c26a3063717c48a', // production, only works on apify.com (any subdomain)
|
|
349
|
-
};
|
|
350
|
-
|
|
351
335
|
module.exports = {
|
|
352
336
|
themeConfig,
|
|
353
337
|
plugins,
|
|
354
338
|
absoluteUrl,
|
|
355
339
|
noIndex,
|
|
356
340
|
scripts,
|
|
357
|
-
customFields,
|
|
358
341
|
};
|
|
@@ -2,7 +2,6 @@ import clsx from 'clsx';
|
|
|
2
2
|
import React, { useCallback, useState } from 'react';
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
-
AnthropicIcon,
|
|
6
5
|
ChatGptIcon,
|
|
7
6
|
CheckIcon,
|
|
8
7
|
ChevronDownIcon,
|
|
@@ -38,13 +37,6 @@ const DROPDOWN_OPTIONS = [
|
|
|
38
37
|
Icon: ChatGptIcon,
|
|
39
38
|
value: 'openInChatGPT',
|
|
40
39
|
},
|
|
41
|
-
{
|
|
42
|
-
label: 'Open in Claude',
|
|
43
|
-
description: 'Ask questions about this page',
|
|
44
|
-
showExternalIcon: true,
|
|
45
|
-
Icon: AnthropicIcon,
|
|
46
|
-
value: 'openInClaude',
|
|
47
|
-
},
|
|
48
40
|
{
|
|
49
41
|
label: 'Open in Perplexity',
|
|
50
42
|
description: 'Ask questions about this page',
|
|
@@ -78,27 +70,6 @@ const onOpenInChatGPTClick = () => {
|
|
|
78
70
|
}
|
|
79
71
|
};
|
|
80
72
|
|
|
81
|
-
const onOpenInClaudeClick = () => {
|
|
82
|
-
if (window.analytics) {
|
|
83
|
-
window.analytics.track('Clicked', {
|
|
84
|
-
app: 'docs',
|
|
85
|
-
button_text: 'Open in Claude',
|
|
86
|
-
element: 'llm-buttons.openInClaude',
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const prompt = getPrompt(window.location.href);
|
|
91
|
-
|
|
92
|
-
try {
|
|
93
|
-
window.open(
|
|
94
|
-
`https://claude.ai/new?q=${encodeURIComponent(prompt)}`,
|
|
95
|
-
'_blank',
|
|
96
|
-
);
|
|
97
|
-
} catch (error) {
|
|
98
|
-
console.error('Error opening Claude:', error);
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
|
|
102
73
|
const onOpenInPerplexityClick = () => {
|
|
103
74
|
if (window.analytics) {
|
|
104
75
|
window.analytics.track('Clicked', {
|
|
@@ -256,9 +227,6 @@ export default function LLMButtons({ isApiReferencePage = false }) {
|
|
|
256
227
|
case 'openInChatGPT':
|
|
257
228
|
onOpenInChatGPTClick();
|
|
258
229
|
break;
|
|
259
|
-
case 'openInClaude':
|
|
260
|
-
onOpenInClaudeClick();
|
|
261
|
-
break;
|
|
262
230
|
case 'openInPerplexity':
|
|
263
231
|
onOpenInPerplexityClick();
|
|
264
232
|
break;
|
|
@@ -3,13 +3,9 @@ import BrowserOnly from '@docusaurus/BrowserOnly';
|
|
|
3
3
|
import RouterLink from '@docusaurus/Link';
|
|
4
4
|
import { useHistory, useLocation } from '@docusaurus/router';
|
|
5
5
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
6
|
-
|
|
7
|
-
// import React, { useEffect, useState } from 'react';
|
|
8
|
-
import React, { useCallback } from 'react';
|
|
9
|
-
// import { useHotkeys } from 'react-hotkeys-hook';
|
|
6
|
+
import { useState, useCallback } from 'react';
|
|
10
7
|
|
|
11
8
|
import { ApifySearch } from '@apify/docs-search-modal';
|
|
12
|
-
// import { ControlKeyIcon, SearchIcon } from '@apify/docs-search-modal/dist/utils/icons';
|
|
13
9
|
|
|
14
10
|
// needs to be imported as the last thing, so that it can override the default styles
|
|
15
11
|
// TODO: update simple-import-sort to allow importing css as last.
|
|
@@ -67,7 +63,9 @@ export default function SearchBar({ onClick }) {
|
|
|
67
63
|
return (
|
|
68
64
|
<BrowserOnly>
|
|
69
65
|
{() => (
|
|
70
|
-
<div
|
|
66
|
+
<div className="SearchButton-Container">
|
|
67
|
+
|
|
68
|
+
<div onClick={onClick} className="AlgoliaContainer" style={{ marginRight: '12px' }}>
|
|
71
69
|
<ApifySearch
|
|
72
70
|
algoliaAppId={siteConfig.themeConfig.algolia.appId}
|
|
73
71
|
algoliaIndexName='apify_sdk_v2'
|
|
@@ -76,169 +74,42 @@ export default function SearchBar({ onClick }) {
|
|
|
76
74
|
navigate={navigate}
|
|
77
75
|
/>
|
|
78
76
|
</div>
|
|
77
|
+
<KapaAIButton />
|
|
78
|
+
</div>
|
|
79
79
|
)}
|
|
80
80
|
</BrowserOnly>
|
|
81
81
|
);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
// console.error('Kapa.ai widget is not available.');
|
|
117
|
-
// }
|
|
118
|
-
// return;
|
|
119
|
-
// }
|
|
120
|
-
//
|
|
121
|
-
// if (variant !== 'inkeep') {
|
|
122
|
-
// console.warn('Unknown search variant:', variant);
|
|
123
|
-
// return;
|
|
124
|
-
// }
|
|
125
|
-
//
|
|
126
|
-
// if (window.Inkeep) {
|
|
127
|
-
// const config = {
|
|
128
|
-
// baseSettings: {
|
|
129
|
-
// apiKey: inkeepApiKey,
|
|
130
|
-
// organizationDisplayName: 'Apify',
|
|
131
|
-
// primaryBrandColor: '#FF9013',
|
|
132
|
-
// transformSource: (source) => {
|
|
133
|
-
// function getTabForSource(src) {
|
|
134
|
-
// if (src.url.includes('help.apify.com')) {
|
|
135
|
-
// return 'Help';
|
|
136
|
-
// }
|
|
137
|
-
// return 'Docs';
|
|
138
|
-
// }
|
|
139
|
-
//
|
|
140
|
-
// if (source.contentType === 'documentation') {
|
|
141
|
-
// return {
|
|
142
|
-
// ...source,
|
|
143
|
-
// tabs: [...(source.tabs || []), getTabForSource(source)],
|
|
144
|
-
// };
|
|
145
|
-
// }
|
|
146
|
-
// return source;
|
|
147
|
-
// },
|
|
148
|
-
// trigger: {
|
|
149
|
-
// disableDefaultTrigger: true,
|
|
150
|
-
// },
|
|
151
|
-
// theme: {
|
|
152
|
-
// styles: [
|
|
153
|
-
// {
|
|
154
|
-
// key: 'main',
|
|
155
|
-
// type: 'link',
|
|
156
|
-
// value: '/inkeep-overrides.css',
|
|
157
|
-
// },
|
|
158
|
-
// ],
|
|
159
|
-
// },
|
|
160
|
-
// },
|
|
161
|
-
// modalSettings: {
|
|
162
|
-
// onOpenChange: handleOpenChange,
|
|
163
|
-
// },
|
|
164
|
-
// searchSettings: {
|
|
165
|
-
// tabs: [
|
|
166
|
-
// ['Docs', { isAlwaysVisible: true }],
|
|
167
|
-
// 'GitHub',
|
|
168
|
-
// 'All',
|
|
169
|
-
// ],
|
|
170
|
-
// },
|
|
171
|
-
// aiChatSettings: {
|
|
172
|
-
// aiAssistantAvatar: 'https://intercom.help/apify/assets/favicon',
|
|
173
|
-
// chatSubjectName: 'Apify',
|
|
174
|
-
// exampleQuestions: [
|
|
175
|
-
// 'What is an Actor?',
|
|
176
|
-
// 'How to use my own proxies?',
|
|
177
|
-
// 'How to integrate Apify Actors with GitHub?',
|
|
178
|
-
// 'How to share key-value stores between runs?',
|
|
179
|
-
// ],
|
|
180
|
-
// getHelpOptions: [
|
|
181
|
-
// {
|
|
182
|
-
// action: {
|
|
183
|
-
// type: 'open_link',
|
|
184
|
-
// url: 'https://apify.com/contact',
|
|
185
|
-
// },
|
|
186
|
-
// icon: {
|
|
187
|
-
// builtIn: 'IoChatbubblesOutline',
|
|
188
|
-
// },
|
|
189
|
-
// name: 'Contact Us',
|
|
190
|
-
// },
|
|
191
|
-
// ],
|
|
192
|
-
// },
|
|
193
|
-
// defaultView: 'chat',
|
|
194
|
-
// };
|
|
195
|
-
// const modal = window.Inkeep.ModalSearchAndChat(config);
|
|
196
|
-
//
|
|
197
|
-
// function handleOpenChange(newOpen) {
|
|
198
|
-
// modal.update({ modalSettings: { isOpen: newOpen } });
|
|
199
|
-
// setOpened(newOpen);
|
|
200
|
-
// }
|
|
201
|
-
//
|
|
202
|
-
// modal.update({ modalSettings: { isOpen: true } });
|
|
203
|
-
// } else {
|
|
204
|
-
// console.error('Inkeep widget is not available.');
|
|
205
|
-
// }
|
|
206
|
-
// };
|
|
207
|
-
//
|
|
208
|
-
// const [key, setKey] = useState(null);
|
|
209
|
-
//
|
|
210
|
-
// useEffect(() => {
|
|
211
|
-
// if (typeof navigator !== 'undefined') {
|
|
212
|
-
// const isMac = /Mac|iPod|iPhone|iPad/.test(navigator.platform);
|
|
213
|
-
// setKey(isMac ? '⌘' : 'ctrl');
|
|
214
|
-
// }
|
|
215
|
-
// }, []);
|
|
216
|
-
//
|
|
217
|
-
// useHotkeys('mod+k, /', () => {
|
|
218
|
-
// onClick();
|
|
219
|
-
// }, { preventDefault: true });
|
|
220
|
-
//
|
|
221
|
-
// return (
|
|
222
|
-
// <BrowserOnly>
|
|
223
|
-
// {() => (
|
|
224
|
-
// <div onClick={onClick}>
|
|
225
|
-
// <button type="button" className="DocSearch DocSearch-Button" aria-label="Search">
|
|
226
|
-
// <span className="DocSearch-Button-Container">
|
|
227
|
-
// <SearchIcon/>
|
|
228
|
-
// <span className="DocSearch-Button-Placeholder">Search</span>
|
|
229
|
-
// </span>
|
|
230
|
-
// <span className="DocSearch-Button-Keys">
|
|
231
|
-
// {key !== null && (<>
|
|
232
|
-
// <kbd className={clsx(key === 'ctrl' ? 'ctrl' : 'cmd', 'DocSearch-Button-Key')}>
|
|
233
|
-
// {key === 'ctrl' ? <ControlKeyIcon/> : key}
|
|
234
|
-
// </kbd>
|
|
235
|
-
// <kbd className="DocSearch-Button-Key">K</kbd>
|
|
236
|
-
// </>)}
|
|
237
|
-
// </span>
|
|
238
|
-
//
|
|
239
|
-
// </button>
|
|
240
|
-
// </div>
|
|
241
|
-
// )}
|
|
242
|
-
// </BrowserOnly>
|
|
243
|
-
// );
|
|
244
|
-
// }
|
|
84
|
+
function KapaAIButton({ onClick }) {
|
|
85
|
+
const [opened, setOpened] = useState(false);
|
|
86
|
+
|
|
87
|
+
onClick = () => {
|
|
88
|
+
if (opened) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
setOpened(true);
|
|
93
|
+
|
|
94
|
+
if (window.Kapa && typeof window.Kapa.open === 'function') {
|
|
95
|
+
window.Kapa.open();
|
|
96
|
+
window.Kapa('onModalClose', () => {
|
|
97
|
+
setOpened(false);
|
|
98
|
+
});
|
|
99
|
+
} else {
|
|
100
|
+
console.error('Kapa.ai widget is not available.');
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<BrowserOnly>
|
|
106
|
+
{() => (
|
|
107
|
+
<div onClick={onClick}>
|
|
108
|
+
<button type="button" className="AskAI-Button" aria-label="Ask AI">
|
|
109
|
+
Ask AI
|
|
110
|
+
</button>
|
|
111
|
+
</div>
|
|
112
|
+
)}
|
|
113
|
+
</BrowserOnly>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
@@ -22,20 +22,54 @@
|
|
|
22
22
|
color var(--ifm-transition-fast) var(--ifm-transition-timing-default);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
.
|
|
25
|
+
.AskAI-Button {
|
|
26
|
+
height: 4rem;
|
|
27
|
+
padding: 0.8rem 1.6rem !important;
|
|
28
|
+
background-color: var(--ifm-color-primary);
|
|
29
|
+
border-radius: 8px;
|
|
30
|
+
color: var(--color-neutral-text-on-primary);
|
|
31
|
+
font-size: 1.6rem;
|
|
32
|
+
font-weight: 500;
|
|
33
|
+
line-height: 2.4rem;
|
|
34
|
+
border: none;
|
|
35
|
+
box-shadow: none;
|
|
36
|
+
outline: none;
|
|
37
|
+
box-sizing: border-box;
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
display: block;
|
|
40
|
+
position: relative;
|
|
41
|
+
text-align: center;
|
|
42
|
+
transition: all var(--ifm-transition-fast) var(--ifm-transition-timing-default);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.SearchButton-Container {
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.navbar-sidebar .SearchButton-Container {
|
|
26
51
|
display: none;
|
|
27
52
|
}
|
|
28
53
|
|
|
29
54
|
@media (max-width: 768px) {
|
|
55
|
+
.SearchButton-Container {
|
|
56
|
+
width: 100%;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.AlgoliaContainer {
|
|
60
|
+
flex: 1;
|
|
61
|
+
}
|
|
62
|
+
|
|
30
63
|
.DocSearch-Button {
|
|
31
64
|
width: 100%;
|
|
65
|
+
justify-content: space-between;
|
|
32
66
|
}
|
|
33
67
|
|
|
34
|
-
.navbar__inner .
|
|
68
|
+
.navbar__inner .SearchButton-Container {
|
|
35
69
|
display: none;
|
|
36
70
|
}
|
|
37
71
|
|
|
38
|
-
.navbar-sidebar .
|
|
72
|
+
.navbar-sidebar .SearchButton-Container {
|
|
39
73
|
display: flex;
|
|
40
74
|
}
|
|
41
75
|
|