@apify/docs-theme 1.0.0 → 1.0.2

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.
Files changed (33) hide show
  1. package/{src/img → img}/footer-apify-logo.svg +0 -0
  2. package/{src/img → img}/footer-open-source.svg +0 -0
  3. package/index.d.ts +9 -0
  4. package/{src/index.ts → index.js} +4 -1
  5. package/package.json +2 -2
  6. package/theme/ColorModeToggle/index.d.ts +8 -0
  7. package/theme/ColorModeToggle/index.js +38 -0
  8. package/{src/theme → theme}/ColorModeToggle/styles.module.css +0 -0
  9. package/theme/Footer/index.d.ts +4 -0
  10. package/theme/Footer/index.js +49 -0
  11. package/{src/theme → theme}/Footer/index.module.css +0 -0
  12. package/theme/Icon/DarkMode/index.d.ts +4 -0
  13. package/theme/Icon/DarkMode/index.js +11 -0
  14. package/theme/Icon/LightMode/index.d.ts +4 -0
  15. package/theme/Icon/LightMode/index.js +23 -0
  16. package/theme/Navbar/Content/index.d.ts +1 -0
  17. package/theme/Navbar/Content/index.js +60 -0
  18. package/{src/theme → theme}/Navbar/Content/styles.module.css +0 -0
  19. package/theme/NavbarItem/ComponentTypes.d.ts +20 -0
  20. package/theme/NavbarItem/ComponentTypes.js +64 -0
  21. package/theme/NavbarItem/NavbarNavLink.d.ts +11 -0
  22. package/theme/NavbarItem/NavbarNavLink.js +42 -0
  23. package/theme/NotFound.d.ts +1 -0
  24. package/theme/NotFound.js +69 -0
  25. package/src/theme/ColorModeToggle/index.jsx +0 -64
  26. package/src/theme/Footer/index.jsx +0 -72
  27. package/src/theme/Icon/DarkMode/index.jsx +0 -11
  28. package/src/theme/Icon/LightMode/index.jsx +0 -28
  29. package/src/theme/Navbar/Content/index.jsx +0 -95
  30. package/src/theme/NavbarItem/ComponentTypes.jsx +0 -101
  31. package/src/theme/NavbarItem/NavbarNavLink.jsx +0 -69
  32. package/src/theme/NotFound.jsx +0 -77
  33. package/tsconfig.json +0 -9
File without changes
File without changes
package/index.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ export default function theme(context: any, opts: any): {
2
+ name: string;
3
+ getThemePath(): string;
4
+ getTypeScriptThemePath(): string;
5
+ contentLoaded({ content, actions }: {
6
+ content: any;
7
+ actions: any;
8
+ }): Promise<void>;
9
+ };
@@ -1,4 +1,6 @@
1
- export default function theme(context, opts) {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function theme(context, opts) {
2
4
  return {
3
5
  name: "@apify/docs-theme",
4
6
  getThemePath() {
@@ -15,3 +17,4 @@ export default function theme(context, opts) {
15
17
  },
16
18
  };
17
19
  }
20
+ exports.default = theme;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@apify/docs-theme",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "",
5
- "main": "./dist/index.js",
5
+ "main": "./index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1",
8
8
  "build": "rimraf ./dist && tsc && npm run copyStyles && npm run copyImages",
@@ -0,0 +1,8 @@
1
+ declare const _default: React.MemoExoticComponent<typeof ColorModeToggle>;
2
+ export default _default;
3
+ declare function ColorModeToggle({ className, value, onChange }: {
4
+ className: any;
5
+ value: any;
6
+ onChange: any;
7
+ }): JSX.Element;
8
+ import React from "react";
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ const clsx_1 = __importDefault(require("clsx"));
8
+ const useIsBrowser_1 = __importDefault(require("@docusaurus/useIsBrowser"));
9
+ const Translate_1 = require("@docusaurus/Translate");
10
+ const LightMode_1 = __importDefault(require("../Icon/LightMode"));
11
+ const DarkMode_1 = __importDefault(require("../Icon/DarkMode"));
12
+ const styles_module_css_1 = __importDefault(require("./styles.module.css"));
13
+ function ColorModeToggle({ className, value, onChange }) {
14
+ const isBrowser = (0, useIsBrowser_1.default)();
15
+ const title = (0, Translate_1.translate)({
16
+ message: 'Switch between dark and light mode (currently {mode})',
17
+ id: 'theme.colorToggle.ariaLabel',
18
+ description: 'The ARIA label for the navbar color mode toggle',
19
+ }, {
20
+ mode: value === 'dark'
21
+ ? (0, Translate_1.translate)({
22
+ message: 'dark mode',
23
+ id: 'theme.colorToggle.ariaLabel.mode.dark',
24
+ description: 'The name for the dark color mode',
25
+ })
26
+ : (0, Translate_1.translate)({
27
+ message: 'light mode',
28
+ id: 'theme.colorToggle.ariaLabel.mode.light',
29
+ description: 'The name for the light color mode',
30
+ }),
31
+ });
32
+ return (react_1.default.createElement("div", { className: (0, clsx_1.default)(styles_module_css_1.default.toggle, className) },
33
+ react_1.default.createElement("button", { className: (0, clsx_1.default)('clean-btn', styles_module_css_1.default.toggleButton, !isBrowser && styles_module_css_1.default.toggleButtonDisabled), type: "button", onClick: () => onChange(value === 'dark' ? 'light' : 'dark'), disabled: !isBrowser, title: title, "aria-label": title },
34
+ react_1.default.createElement("span", null,
35
+ react_1.default.createElement(LightMode_1.default, { className: (0, clsx_1.default)(styles_module_css_1.default.toggleIcon, styles_module_css_1.default.lightToggleIcon), width: 14, height: 14 }),
36
+ react_1.default.createElement(DarkMode_1.default, { className: (0, clsx_1.default)(styles_module_css_1.default.toggleIcon, styles_module_css_1.default.darkToggleIcon), width: 14, height: 14 })))));
37
+ }
38
+ exports.default = react_1.default.memo(ColorModeToggle);
@@ -0,0 +1,4 @@
1
+ declare const _default: React.MemoExoticComponent<typeof Footer>;
2
+ export default _default;
3
+ declare function Footer(): JSX.Element;
4
+ import React from "react";
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ const clsx_1 = __importDefault(require("clsx"));
8
+ // eslint-disable-next-line import/no-extraneous-dependencies
9
+ const theme_common_1 = require("@docusaurus/theme-common");
10
+ const LinkItem_1 = __importDefault(require("@theme/Footer/LinkItem"));
11
+ const index_module_css_1 = __importDefault(require("./index.module.css"));
12
+ function FooterLinksColumn({ column }) {
13
+ return (react_1.default.createElement(react_1.default.Fragment, null,
14
+ react_1.default.createElement("div", { className: index_module_css_1.default.footerTitle }, column.title),
15
+ react_1.default.createElement("ul", { className: (0, clsx_1.default)(index_module_css_1.default.footerItem, 'clean-list') }, column.items.map((item, i) => (react_1.default.createElement("li", { key: i, className: "footer__item" },
16
+ react_1.default.createElement(LinkItem_1.default, { item: item })))))));
17
+ }
18
+ function Footer() {
19
+ const { footer } = (0, theme_common_1.useThemeConfig)();
20
+ if (!footer) {
21
+ return null;
22
+ }
23
+ const { links, style } = footer;
24
+ const OpenSourceIcon = require('../../img/footer-open-source.svg').default;
25
+ const ApifyLogo = require('../../img/footer-apify-logo.svg').default;
26
+ return (react_1.default.createElement("footer", { className: (0, clsx_1.default)(index_module_css_1.default.footer, style) },
27
+ react_1.default.createElement("div", { className: "container padding-horiz--lg" },
28
+ react_1.default.createElement("div", { className: "row" },
29
+ react_1.default.createElement("div", { className: "col col--5" },
30
+ react_1.default.createElement("div", { className: "row" },
31
+ react_1.default.createElement("div", { className: "col col--6" },
32
+ react_1.default.createElement(FooterLinksColumn, { column: links[0] })),
33
+ react_1.default.createElement("div", { className: "col col--6" },
34
+ react_1.default.createElement(FooterLinksColumn, { column: links[1] })))),
35
+ react_1.default.createElement("div", { className: "col col--7" },
36
+ react_1.default.createElement("div", { className: "row" },
37
+ react_1.default.createElement("div", { className: "col col--3 col--offset-9" },
38
+ react_1.default.createElement(FooterLinksColumn, { column: links[2] }))))),
39
+ react_1.default.createElement("div", { className: "row padding-vert--md padding-top--lg" },
40
+ react_1.default.createElement("div", { className: "col padding-vert--md col--6" },
41
+ react_1.default.createElement("div", { className: index_module_css_1.default.freeAndOpenSource },
42
+ react_1.default.createElement(OpenSourceIcon, { className: index_module_css_1.default.alignMiddle }),
43
+ react_1.default.createElement("span", { className: index_module_css_1.default.alignMiddle }, "Blablabla, bla bla bla. This component is from the common theme!"))),
44
+ react_1.default.createElement("div", { className: "col padding-vert--md col--6 text--right" },
45
+ react_1.default.createElement("span", { className: index_module_css_1.default.builtBy },
46
+ react_1.default.createElement("span", { className: index_module_css_1.default.alignMiddle }, "Built by"),
47
+ react_1.default.createElement(ApifyLogo, { className: index_module_css_1.default.alignMiddle })))))));
48
+ }
49
+ exports.default = react_1.default.memo(Footer);
File without changes
@@ -0,0 +1,4 @@
1
+ declare const _default: React.MemoExoticComponent<typeof IconDarkMode>;
2
+ export default _default;
3
+ declare function IconDarkMode(props: any): JSX.Element;
4
+ import React from "react";
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ function IconDarkMode(props) {
8
+ return (react_1.default.createElement("svg", { viewBox: "0 0 13 12", width: 14, height: 14, ...props },
9
+ react_1.default.createElement("path", { d: "M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z", stroke: "currentColor", fill: "transparent", strokeLinecap: "round", strokeLinejoin: "round" })));
10
+ }
11
+ exports.default = react_1.default.memo(IconDarkMode);
@@ -0,0 +1,4 @@
1
+ declare const _default: React.MemoExoticComponent<typeof IconLightMode>;
2
+ export default _default;
3
+ declare function IconLightMode(props: any): JSX.Element;
4
+ import React from "react";
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ function IconLightMode(props) {
8
+ return (react_1.default.createElement("svg", { viewBox: "0 0 13 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", width: 14, height: 14, ...props },
9
+ react_1.default.createElement("g", { clipPath: "url(#clip0_833_8168)" },
10
+ react_1.default.createElement("path", { d: "M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
11
+ react_1.default.createElement("path", { d: "M6.59985 0.5V1.5", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
12
+ react_1.default.createElement("path", { d: "M6.59985 10.5V11.5", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
13
+ react_1.default.createElement("path", { d: "M2.7099 2.11L3.4199 2.82", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
14
+ react_1.default.createElement("path", { d: "M9.77991 9.17999L10.4899 9.88999", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
15
+ react_1.default.createElement("path", { d: "M1.09998 6H2.09998", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
16
+ react_1.default.createElement("path", { d: "M11.0999 6H12.0999", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
17
+ react_1.default.createElement("path", { d: "M2.7099 9.88999L3.4199 9.17999", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
18
+ react_1.default.createElement("path", { d: "M9.77991 2.82L10.4899 2.11", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" })),
19
+ react_1.default.createElement("defs", null,
20
+ react_1.default.createElement("clipPath", { id: "clip0_833_8168" },
21
+ react_1.default.createElement("rect", { width: "12", height: "12", fill: "white", transform: "translate(0.599976)" })))));
22
+ }
23
+ exports.default = react_1.default.memo(IconLightMode);
@@ -0,0 +1 @@
1
+ export default function NavbarContent(): JSX.Element;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ const theme_common_1 = require("@docusaurus/theme-common");
8
+ const useGlobalData_1 = require("@docusaurus/useGlobalData");
9
+ const useDocusaurusContext_1 = __importDefault(require("@docusaurus/useDocusaurusContext"));
10
+ const internal_1 = require("@docusaurus/theme-common/internal");
11
+ const styles_module_css_1 = __importDefault(require("./styles.module.css"));
12
+ const Logo_1 = __importDefault(require("@theme/Navbar/Logo"));
13
+ const NavbarItem_1 = __importDefault(require("@theme/NavbarItem"));
14
+ const ColorModeToggle_1 = __importDefault(require("@theme/Navbar/ColorModeToggle"));
15
+ const Search_1 = __importDefault(require("@theme/Navbar/Search"));
16
+ const SearchBar_1 = __importDefault(require("@theme/SearchBar"));
17
+ const Toggle_1 = __importDefault(require("@theme/Navbar/MobileSidebar/Toggle"));
18
+ function NavbarItems({ items }) {
19
+ return (react_1.default.createElement(react_1.default.Fragment, null, items.map((item, i) => (react_1.default.createElement(NavbarItem_1.default, { ...item, key: i })))));
20
+ }
21
+ function NavbarContentLayout({ left, right }) {
22
+ return (react_1.default.createElement("div", { className: "navbar__inner" },
23
+ react_1.default.createElement("div", { className: "navbar__items" }, left),
24
+ react_1.default.createElement("div", { className: "navbar__items navbar__items--right" }, right)));
25
+ }
26
+ function SubNavbar() {
27
+ const { subNavbar } = (0, useGlobalData_1.usePluginData)('@apify/docs-theme').opts;
28
+ const pageTitle = (0, useDocusaurusContext_1.default)().siteConfig.title;
29
+ return (subNavbar ? (react_1.default.createElement("div", { className: "navbar__inner" },
30
+ react_1.default.createElement("div", { className: "navbar__items" },
31
+ react_1.default.createElement(NavbarItems, { items: [
32
+ {
33
+ label: pageTitle,
34
+ to: '/',
35
+ },
36
+ ...subNavbar,
37
+ ] })))) : null);
38
+ }
39
+ function NavbarContent() {
40
+ const items = (0, theme_common_1.useThemeConfig)().navbar.items;
41
+ const [leftItems, rightItems] = (0, internal_1.splitNavbarItems)(items);
42
+ const searchBarItem = items.find((item) => item.type === 'search');
43
+ return (react_1.default.createElement("div", { style: {
44
+ width: "100%",
45
+ height: "100%",
46
+ alignItems: "center",
47
+ display: "flex",
48
+ flexDirection: "column",
49
+ } },
50
+ react_1.default.createElement(NavbarContentLayout, { left: react_1.default.createElement(react_1.default.Fragment, null,
51
+ react_1.default.createElement(Toggle_1.default, null),
52
+ react_1.default.createElement(Logo_1.default, null),
53
+ react_1.default.createElement(NavbarItems, { items: leftItems })), right: react_1.default.createElement(react_1.default.Fragment, null,
54
+ react_1.default.createElement(ColorModeToggle_1.default, { className: styles_module_css_1.default.colorModeToggle }),
55
+ react_1.default.createElement(NavbarItems, { items: rightItems }),
56
+ !searchBarItem && (react_1.default.createElement(Search_1.default, null,
57
+ react_1.default.createElement(SearchBar_1.default, null)))) }),
58
+ react_1.default.createElement(SubNavbar, null)));
59
+ }
60
+ exports.default = NavbarContent;
@@ -0,0 +1,20 @@
1
+ export default ComponentTypes;
2
+ declare const ComponentTypes: {
3
+ default: any;
4
+ localeDropdown: any;
5
+ search: any;
6
+ dropdown: any;
7
+ html: any;
8
+ 'custom-api': typeof ApiNavbarItem;
9
+ doc: typeof DocNavbarItem;
10
+ docSidebar: any;
11
+ docsVersion: any;
12
+ docsVersionDropdown: any;
13
+ };
14
+ declare function ApiNavbarItem(ctx: any): JSX.Element;
15
+ declare function DocNavbarItem({ docId, label: staticLabel, docsPluginId, ...props }: {
16
+ [x: string]: any;
17
+ docId: any;
18
+ label: any;
19
+ docsPluginId: any;
20
+ }): JSX.Element;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const DefaultNavbarItem_1 = __importDefault(require("@theme/NavbarItem/DefaultNavbarItem"));
7
+ const DropdownNavbarItem_1 = __importDefault(require("@theme/NavbarItem/DropdownNavbarItem"));
8
+ const LocaleDropdownNavbarItem_1 = __importDefault(require("@theme/NavbarItem/LocaleDropdownNavbarItem"));
9
+ const SearchNavbarItem_1 = __importDefault(require("@theme/NavbarItem/SearchNavbarItem"));
10
+ const HtmlNavbarItem_1 = __importDefault(require("@theme/NavbarItem/HtmlNavbarItem"));
11
+ const DocSidebarNavbarItem_1 = __importDefault(require("@theme/NavbarItem/DocSidebarNavbarItem"));
12
+ const DocsVersionNavbarItem_1 = __importDefault(require("@theme/NavbarItem/DocsVersionNavbarItem"));
13
+ const DocsVersionDropdownNavbarItem_1 = __importDefault(require("@theme/NavbarItem/DocsVersionDropdownNavbarItem"));
14
+ const internal_1 = require("@docusaurus/theme-common/internal");
15
+ const useDocusaurusContext_1 = __importDefault(require("@docusaurus/useDocusaurusContext"));
16
+ const react_1 = __importDefault(require("react"));
17
+ // const versions = require('../../../versions.json');
18
+ //
19
+ // const stable = versions[0];
20
+ const stable = '1';
21
+ function DocNavbarItem({ docId, label: staticLabel, docsPluginId, ...props }) {
22
+ const doc = (0, internal_1.useLayoutDoc)(docId, docsPluginId);
23
+ // Draft items are not displayed in the navbar.
24
+ if (doc === null) {
25
+ return null;
26
+ }
27
+ return (react_1.default.createElement(DefaultNavbarItem_1.default, { exact: true, ...props, label: staticLabel ?? doc.id, to: doc.path }));
28
+ }
29
+ function ApiNavbarItem(ctx) {
30
+ let version = {};
31
+ try {
32
+ // eslint-disable-next-line react-hooks/rules-of-hooks
33
+ version = (0, internal_1.useDocsVersion)();
34
+ }
35
+ catch {
36
+ version.version = stable;
37
+ }
38
+ const { siteConfig } = (0, useDocusaurusContext_1.default)();
39
+ if (siteConfig.presets[0][1].docs.disableVersioning || version.version === stable) {
40
+ return (react_1.default.createElement(DefaultNavbarItem_1.default, { exact: true, ...ctx, label: ctx.label, to: `api/${ctx.to}` }));
41
+ }
42
+ // skip changelog button for older versions
43
+ if (+version.version < 3 && ctx.className === 'changelog') {
44
+ return null;
45
+ }
46
+ // link directly to the old API docs under /docs/x.x/api
47
+ if (+version.version < 3) {
48
+ return (react_1.default.createElement(DefaultNavbarItem_1.default, { exact: true, ...ctx, label: ctx.label, to: `docs/${version.version === 'current' ? 'next' : version.version}/api/${ctx.to}` }));
49
+ }
50
+ return (react_1.default.createElement(DefaultNavbarItem_1.default, { exact: true, ...ctx, label: ctx.label, to: `api/${version.version === 'current' ? 'next' : version.version}/${ctx.to}` }));
51
+ }
52
+ const ComponentTypes = {
53
+ 'default': DefaultNavbarItem_1.default,
54
+ 'localeDropdown': LocaleDropdownNavbarItem_1.default,
55
+ 'search': SearchNavbarItem_1.default,
56
+ 'dropdown': DropdownNavbarItem_1.default,
57
+ 'html': HtmlNavbarItem_1.default,
58
+ 'custom-api': ApiNavbarItem,
59
+ 'doc': DocNavbarItem,
60
+ 'docSidebar': DocSidebarNavbarItem_1.default,
61
+ 'docsVersion': DocsVersionNavbarItem_1.default,
62
+ 'docsVersionDropdown': DocsVersionDropdownNavbarItem_1.default,
63
+ };
64
+ exports.default = ComponentTypes;
@@ -0,0 +1,11 @@
1
+ export default function NavbarNavLink({ activeBasePath, activeBaseRegex, to, href, label, html, isDropdownLink, prependBaseUrlToHref, ...props }: {
2
+ [x: string]: any;
3
+ activeBasePath: any;
4
+ activeBaseRegex: any;
5
+ to: any;
6
+ href: any;
7
+ label: any;
8
+ html: any;
9
+ isDropdownLink: any;
10
+ prependBaseUrlToHref: any;
11
+ }): JSX.Element;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ const Link_1 = __importDefault(require("@docusaurus/Link"));
8
+ const useBaseUrl_1 = __importDefault(require("@docusaurus/useBaseUrl"));
9
+ const isInternalUrl_1 = __importDefault(require("@docusaurus/isInternalUrl"));
10
+ const router_1 = require("@docusaurus/router");
11
+ const theme_common_1 = require("@docusaurus/theme-common");
12
+ function NavbarNavLink({ activeBasePath, activeBaseRegex, to, href, label, html, isDropdownLink, prependBaseUrlToHref, ...props }) {
13
+ const location = (0, router_1.useLocation)();
14
+ // TODO all this seems hacky
15
+ // {to: 'version'} should probably be forbidden, in favor of {to: '/version'}
16
+ const toUrl = (0, useBaseUrl_1.default)(to);
17
+ const activeBaseUrl = (0, useBaseUrl_1.default)(activeBasePath);
18
+ const normalizedHref = (0, useBaseUrl_1.default)(href, { forcePrependBaseUrl: true });
19
+ // const isExternalLink = label && href && !isInternalUrl(href);
20
+ const isExternalLink = false;
21
+ // Link content is set through html XOR label
22
+ const linkContentProps = html
23
+ ? { dangerouslySetInnerHTML: { __html: html } }
24
+ : {
25
+ children: (react_1.default.createElement(react_1.default.Fragment, null,
26
+ label,
27
+ isExternalLink && (react_1.default.createElement(IconExternalLink, { ...(isDropdownLink && { width: 12, height: 12 }) })))),
28
+ };
29
+ if (href) {
30
+ return (react_1.default.createElement(Link_1.default, { href: prependBaseUrlToHref ? normalizedHref : href, ...props, ...(activeBaseUrl && {
31
+ className: location.pathname.startsWith(`/${activeBasePath}`)
32
+ ? 'navbar__item navbar__link navbar__link--active'
33
+ : 'navbar__item navbar__link',
34
+ }), ...linkContentProps }));
35
+ }
36
+ return (react_1.default.createElement(Link_1.default, { to: toUrl, isNavLink: true, ...((activeBasePath || activeBaseRegex) && {
37
+ isActive: (_match, location) => (activeBaseRegex
38
+ ? (0, theme_common_1.isRegexpStringMatch)(activeBaseRegex, location.pathname)
39
+ : location.pathname.startsWith(activeBaseUrl)),
40
+ }), ...props, ...linkContentProps }));
41
+ }
42
+ exports.default = NavbarNavLink;
@@ -0,0 +1 @@
1
+ export default function NotFound(): JSX.Element;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ const useBaseUrl_1 = __importDefault(require("@docusaurus/useBaseUrl"));
8
+ const useIsBrowser_1 = __importDefault(require("@docusaurus/useIsBrowser"));
9
+ const theme_common_1 = require("@docusaurus/theme-common");
10
+ const Link_1 = __importDefault(require("@docusaurus/Link"));
11
+ const Layout_1 = __importDefault(require("@theme/Layout"));
12
+ function NotFound() {
13
+ const redirectedV2Url = (0, useBaseUrl_1.default)('/docs/api');
14
+ const redirectedV1Url = (0, useBaseUrl_1.default)('/docs/1.3.1/api');
15
+ const baseUrlForV2Redirect = (0, useBaseUrl_1.default)(`/docs/2.3/api/`);
16
+ const baseUrlForV1Redirect = (0, useBaseUrl_1.default)(`/docs/1.3/api/`);
17
+ const isBrowser = (0, useIsBrowser_1.default)();
18
+ if (isBrowser) {
19
+ const path = window.location.pathname;
20
+ let href = '';
21
+ let redirect = false;
22
+ if (path.startsWith(redirectedV2Url)) {
23
+ href = baseUrlForV2Redirect + path.substring(redirectedV2Url.length + 1);
24
+ redirect = true;
25
+ }
26
+ if (path.match(/\/docs\/2\.\d+\.\d+\/api/)) {
27
+ href = baseUrlForV2Redirect + path.substring(redirectedV1Url.length + 1);
28
+ redirect = true;
29
+ }
30
+ if (path.match(/\/api\/[12]\.\d+\/\w+/)) {
31
+ const [, v, id] = path.match(/\/api\/([12])\.\d+\/(.*)/);
32
+ href = (v === '1' ? baseUrlForV1Redirect : baseUrlForV2Redirect) + id;
33
+ redirect = true;
34
+ }
35
+ if (path.match(/\/docs\/[01]\.\d+\.\d+\/api\/(.*)/)) {
36
+ const id = path.match(/\/docs\/[01]\.\d+\.\d+\/api\/(.*)/)[1];
37
+ href = baseUrlForV1Redirect + id;
38
+ redirect = true;
39
+ }
40
+ if (redirect && window.location.href !== href) {
41
+ window.location.href = href;
42
+ }
43
+ }
44
+ return (react_1.default.createElement(react_1.default.Fragment, null,
45
+ react_1.default.createElement(theme_common_1.PageMetadata, { title: 'Page Not Found' }),
46
+ react_1.default.createElement(Layout_1.default, null,
47
+ react_1.default.createElement("main", { className: "container margin-vert--xl" },
48
+ react_1.default.createElement("div", { className: "row" },
49
+ react_1.default.createElement("div", { className: "col col--6 col--offset-3" },
50
+ react_1.default.createElement("h1", { className: "hero__title" }, "Page Not Found"),
51
+ react_1.default.createElement("p", null, "We could not find what you were looking for \uD83D\uDE22"),
52
+ react_1.default.createElement("p", null,
53
+ "Recently we ",
54
+ react_1.default.createElement("b", null, "released Apify SDK v3 "),
55
+ "and we significantly upgraded the documentation."),
56
+ react_1.default.createElement("p", null,
57
+ "If you're looking for documentation of ",
58
+ react_1.default.createElement("b", null, "Apify SDK v2"),
59
+ ",",
60
+ react_1.default.createElement(Link_1.default, { to: '/docs/2.3/guides/apify-platform' }, " you can find it here"),
61
+ "."),
62
+ react_1.default.createElement("p", null,
63
+ "For ",
64
+ react_1.default.createElement("b", null, "Apify SDK v3 docs"),
65
+ ", go to the ",
66
+ react_1.default.createElement(Link_1.default, { to: '/' }, "homepage"),
67
+ ".")))))));
68
+ }
69
+ exports.default = NotFound;
@@ -1,64 +0,0 @@
1
- import React from 'react';
2
- import clsx from 'clsx';
3
- import useIsBrowser from '@docusaurus/useIsBrowser';
4
- import { translate } from '@docusaurus/Translate';
5
- import IconLightMode from '../Icon/LightMode';
6
- import IconDarkMode from '../Icon/DarkMode';
7
- import styles from './styles.module.css';
8
-
9
- function ColorModeToggle({
10
- className,
11
- value,
12
- onChange
13
- }) {
14
- const isBrowser = useIsBrowser();
15
- const title = translate(
16
- {
17
- message: 'Switch between dark and light mode (currently {mode})',
18
- id: 'theme.colorToggle.ariaLabel',
19
- description: 'The ARIA label for the navbar color mode toggle',
20
- },
21
- {
22
- mode:
23
- value === 'dark'
24
- ? translate({
25
- message: 'dark mode',
26
- id: 'theme.colorToggle.ariaLabel.mode.dark',
27
- description: 'The name for the dark color mode',
28
- })
29
- : translate({
30
- message: 'light mode',
31
- id: 'theme.colorToggle.ariaLabel.mode.light',
32
- description: 'The name for the light color mode',
33
- }),
34
- },
35
- );
36
- return (
37
- <div className={clsx(styles.toggle, className)}>
38
- <button
39
- className={clsx(
40
- 'clean-btn',
41
- styles.toggleButton,
42
- !isBrowser && styles.toggleButtonDisabled,
43
- )}
44
- type="button"
45
- onClick={() => onChange(value === 'dark' ? 'light' : 'dark')}
46
- disabled={!isBrowser}
47
- title={title}
48
- aria-label={title}>
49
- <span>
50
- <IconLightMode
51
- className={clsx(styles.toggleIcon, styles.lightToggleIcon)}
52
- width={14} height={14}
53
- />
54
- <IconDarkMode
55
- className={clsx(styles.toggleIcon, styles.darkToggleIcon)}
56
- width={14} height={14}
57
- />
58
- </span>
59
- </button>
60
- </div>
61
- );
62
- }
63
-
64
- export default React.memo(ColorModeToggle);
@@ -1,72 +0,0 @@
1
- import React from 'react';
2
- import clsx from 'clsx';
3
- // eslint-disable-next-line import/no-extraneous-dependencies
4
- import { useThemeConfig } from '@docusaurus/theme-common';
5
- import LinkItem from '@theme/Footer/LinkItem';
6
- import styles from './index.module.css';
7
-
8
- function FooterLinksColumn({ column }) {
9
- return (
10
- <>
11
- <div className={styles.footerTitle}>{column.title}</div>
12
- <ul className={clsx(styles.footerItem, 'clean-list')}>
13
- {column.items.map((item, i) => (
14
- <li key={i} className="footer__item">
15
- <LinkItem item={item} />
16
- </li>
17
- ))}
18
- </ul>
19
- </>
20
- );
21
- }
22
-
23
- function Footer() {
24
- const { footer } = useThemeConfig();
25
- if (!footer) {
26
- return null;
27
- }
28
- const { links, style } = footer;
29
- const OpenSourceIcon = require('../../img/footer-open-source.svg').default;
30
- const ApifyLogo = require('../../img/footer-apify-logo.svg').default;
31
- return (
32
- <footer className={clsx(styles.footer, style)}>
33
- <div className="container padding-horiz--lg">
34
- <div className="row">
35
- <div className="col col--5">
36
- <div className="row">
37
- <div className="col col--6">
38
- <FooterLinksColumn column={links[0]} />
39
- </div>
40
- <div className="col col--6">
41
- <FooterLinksColumn column={links[1]} />
42
- </div>
43
- </div>
44
- </div>
45
- <div className="col col--7">
46
- <div className="row">
47
- <div className="col col--3 col--offset-9">
48
- <FooterLinksColumn column={links[2]} />
49
- </div>
50
- </div>
51
- </div>
52
- </div>
53
- <div className="row padding-vert--md padding-top--lg">
54
- <div className="col padding-vert--md col--6">
55
- <div className={styles.freeAndOpenSource}>
56
- <OpenSourceIcon className={styles.alignMiddle} />
57
- <span className={styles.alignMiddle}>Blablabla, bla bla bla. This component is from the common theme!</span>
58
- </div>
59
- </div>
60
- <div className="col padding-vert--md col--6 text--right">
61
- <span className={styles.builtBy}>
62
- <span className={styles.alignMiddle}>Built by</span>
63
- <ApifyLogo className={styles.alignMiddle} />
64
- </span>
65
- </div>
66
- </div>
67
- </div>
68
- </footer>
69
- );
70
- }
71
-
72
- export default React.memo(Footer);
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
-
3
- function IconDarkMode(props) {
4
- return (
5
- <svg viewBox="0 0 13 12" width={14} height={14} {...props}>
6
- <path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" strokeLinecap="round" strokeLinejoin="round"/>
7
- </svg>
8
- );
9
- }
10
-
11
- export default React.memo(IconDarkMode);
@@ -1,28 +0,0 @@
1
- import React from 'react';
2
-
3
- function IconLightMode(props) {
4
- return (
5
- <svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width={14} height={14} {...props}>
6
- <g clipPath="url(#clip0_833_8168)">
7
- <path
8
- d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z"
9
- stroke="currentColor" strokeLinecap="round" strokeLinejoin="round"/>
10
- <path d="M6.59985 0.5V1.5" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round"/>
11
- <path d="M6.59985 10.5V11.5" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round"/>
12
- <path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round"/>
13
- <path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round"/>
14
- <path d="M1.09998 6H2.09998" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round"/>
15
- <path d="M11.0999 6H12.0999" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round"/>
16
- <path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round"/>
17
- <path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round"/>
18
- </g>
19
- <defs>
20
- <clipPath id="clip0_833_8168">
21
- <rect width="12" height="12" fill="white" transform="translate(0.599976)"/>
22
- </clipPath>
23
- </defs>
24
- </svg>
25
- );
26
- }
27
-
28
- export default React.memo(IconLightMode);
@@ -1,95 +0,0 @@
1
- import React from 'react';
2
- import { useThemeConfig } from '@docusaurus/theme-common';
3
- import { usePluginData } from '@docusaurus/useGlobalData';
4
- import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
5
- import {
6
- splitNavbarItems,
7
- } from '@docusaurus/theme-common/internal';
8
- import styles from './styles.module.css';
9
- import NavbarLogo from '@theme/Navbar/Logo';
10
- import NavbarItem from '@theme/NavbarItem';
11
- import NavbarColorModeToggle from '@theme/Navbar/ColorModeToggle';
12
- import NavbarSearch from '@theme/Navbar/Search';
13
- import SearchBar from '@theme/SearchBar';
14
- import NavbarMobileSidebarToggle from '@theme/Navbar/MobileSidebar/Toggle';
15
-
16
- function NavbarItems({ items }) {
17
- return (
18
- <>
19
- {items.map((item, i) => (
20
- <NavbarItem {...item} key={i}/>
21
- ))}
22
- </>
23
- );
24
- }
25
-
26
- function NavbarContentLayout({
27
- left,
28
- right
29
- }) {
30
- return (
31
- <div className="navbar__inner">
32
- <div className="navbar__items">{left}</div>
33
- <div className="navbar__items navbar__items--right">{right}</div>
34
- </div>
35
- );
36
- }
37
-
38
- function SubNavbar() {
39
- const { subNavbar } = usePluginData('@apify/docs-theme').opts;
40
- const pageTitle = useDocusaurusContext().siteConfig.title;
41
- return (
42
- subNavbar ? (
43
- <div className="navbar__inner">
44
- <div className="navbar__items">
45
- <NavbarItems items={[
46
- {
47
- label: pageTitle,
48
- to: '/',
49
- },
50
- ...subNavbar,
51
- ]}/>
52
- </div>
53
- </div>
54
- ): null
55
- )
56
- }
57
-
58
- export default function NavbarContent() {
59
- const items = useThemeConfig().navbar.items;
60
- const [leftItems, rightItems] = splitNavbarItems(items);
61
- const searchBarItem = items.find((item) => item.type === 'search');
62
- return (
63
- <div
64
- style={{
65
- width: "100%",
66
- height: "100%",
67
- alignItems: "center",
68
- display: "flex",
69
- flexDirection: "column",
70
- }}
71
- >
72
- <NavbarContentLayout
73
- left={
74
- <>
75
- <NavbarMobileSidebarToggle/>
76
- <NavbarLogo/>
77
- <NavbarItems items={leftItems}/>
78
- </>
79
- }
80
- right={
81
- <>
82
- <NavbarColorModeToggle className={styles.colorModeToggle}/>
83
- <NavbarItems items={rightItems}/>
84
- {!searchBarItem && (
85
- <NavbarSearch>
86
- <SearchBar/>
87
- </NavbarSearch>
88
- )}
89
- </>
90
- }
91
- />
92
- <SubNavbar/>
93
- </div>
94
- );
95
- }
@@ -1,101 +0,0 @@
1
- import DefaultNavbarItem from '@theme/NavbarItem/DefaultNavbarItem';
2
- import DropdownNavbarItem from '@theme/NavbarItem/DropdownNavbarItem';
3
- import LocaleDropdownNavbarItem from '@theme/NavbarItem/LocaleDropdownNavbarItem';
4
- import SearchNavbarItem from '@theme/NavbarItem/SearchNavbarItem';
5
- import HtmlNavbarItem from '@theme/NavbarItem/HtmlNavbarItem';
6
- import DocSidebarNavbarItem from '@theme/NavbarItem/DocSidebarNavbarItem';
7
- import DocsVersionNavbarItem from '@theme/NavbarItem/DocsVersionNavbarItem';
8
- import DocsVersionDropdownNavbarItem from '@theme/NavbarItem/DocsVersionDropdownNavbarItem';
9
- import { useDocsVersion, useLayoutDoc } from '@docusaurus/theme-common/internal';
10
- import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
11
- import React from 'react';
12
-
13
- // const versions = require('../../../versions.json');
14
- //
15
- // const stable = versions[0];
16
- const stable = '1';
17
-
18
- function DocNavbarItem({
19
- docId,
20
- label: staticLabel,
21
- docsPluginId,
22
- ...props
23
- }) {
24
- const doc = useLayoutDoc(docId, docsPluginId);
25
- // Draft items are not displayed in the navbar.
26
- if (doc === null) {
27
- return null;
28
- }
29
- return (
30
- <DefaultNavbarItem
31
- exact
32
- {...props}
33
- label={staticLabel ?? doc.id}
34
- to={doc.path}
35
- />
36
- );
37
- }
38
-
39
- function ApiNavbarItem(ctx) {
40
- let version = {};
41
-
42
- try {
43
- // eslint-disable-next-line react-hooks/rules-of-hooks
44
- version = useDocsVersion();
45
- } catch {
46
- version.version = stable;
47
- }
48
-
49
- const { siteConfig } = useDocusaurusContext();
50
-
51
- if (siteConfig.presets[0][1].docs.disableVersioning || version.version === stable) {
52
- return (
53
- <DefaultNavbarItem
54
- exact
55
- {...ctx}
56
- label={ctx.label}
57
- to={`api/${ctx.to}`}
58
- />
59
- );
60
- }
61
-
62
- // skip changelog button for older versions
63
- if (+version.version < 3 && ctx.className === 'changelog') {
64
- return null;
65
- }
66
-
67
- // link directly to the old API docs under /docs/x.x/api
68
- if (+version.version < 3) {
69
- return (
70
- <DefaultNavbarItem
71
- exact
72
- {...ctx}
73
- label={ctx.label}
74
- to={`docs/${version.version === 'current' ? 'next' : version.version}/api/${ctx.to}`}
75
- />
76
- );
77
- }
78
-
79
- return (
80
- <DefaultNavbarItem
81
- exact
82
- {...ctx}
83
- label={ctx.label}
84
- to={`api/${version.version === 'current' ? 'next' : version.version}/${ctx.to}`}
85
- />
86
- );
87
- }
88
-
89
- const ComponentTypes = {
90
- 'default': DefaultNavbarItem,
91
- 'localeDropdown': LocaleDropdownNavbarItem,
92
- 'search': SearchNavbarItem,
93
- 'dropdown': DropdownNavbarItem,
94
- 'html': HtmlNavbarItem,
95
- 'custom-api': ApiNavbarItem,
96
- 'doc': DocNavbarItem,
97
- 'docSidebar': DocSidebarNavbarItem,
98
- 'docsVersion': DocsVersionNavbarItem,
99
- 'docsVersionDropdown': DocsVersionDropdownNavbarItem,
100
- };
101
- export default ComponentTypes;
@@ -1,69 +0,0 @@
1
- import React from 'react';
2
- import Link from '@docusaurus/Link';
3
- import useBaseUrl from '@docusaurus/useBaseUrl';
4
- import isInternalUrl from '@docusaurus/isInternalUrl';
5
- import { useLocation } from '@docusaurus/router';
6
- import { isRegexpStringMatch } from '@docusaurus/theme-common';
7
-
8
- export default function NavbarNavLink({
9
- activeBasePath,
10
- activeBaseRegex,
11
- to,
12
- href,
13
- label,
14
- html,
15
- isDropdownLink,
16
- prependBaseUrlToHref,
17
- ...props
18
- }) {
19
- const location = useLocation();
20
- // TODO all this seems hacky
21
- // {to: 'version'} should probably be forbidden, in favor of {to: '/version'}
22
- const toUrl = useBaseUrl(to);
23
- const activeBaseUrl = useBaseUrl(activeBasePath);
24
- const normalizedHref = useBaseUrl(href, { forcePrependBaseUrl: true });
25
- // const isExternalLink = label && href && !isInternalUrl(href);
26
- const isExternalLink = false;
27
- // Link content is set through html XOR label
28
- const linkContentProps = html
29
- ? { dangerouslySetInnerHTML: { __html: html } }
30
- : {
31
- children: (
32
- <>
33
- {label}
34
- {isExternalLink && (
35
- <IconExternalLink
36
- {...(isDropdownLink && { width: 12, height: 12 })}
37
- />
38
- )}
39
- </>
40
- ),
41
- };
42
- if (href) {
43
- return (
44
- <Link
45
- href={prependBaseUrlToHref ? normalizedHref : href}
46
- {...props}
47
- {...(activeBaseUrl && {
48
- className: location.pathname.startsWith(`/${activeBasePath}`)
49
- ? 'navbar__item navbar__link navbar__link--active'
50
- : 'navbar__item navbar__link',
51
- })}
52
- {...linkContentProps}
53
- />
54
- );
55
- }
56
- return (
57
- <Link
58
- to={toUrl}
59
- isNavLink
60
- {...((activeBasePath || activeBaseRegex) && {
61
- isActive: (_match, location) => (activeBaseRegex
62
- ? isRegexpStringMatch(activeBaseRegex, location.pathname)
63
- : location.pathname.startsWith(activeBaseUrl)),
64
- })}
65
- {...props}
66
- {...linkContentProps}
67
- />
68
- );
69
- }
@@ -1,77 +0,0 @@
1
- import React from 'react';
2
- import useBaseUrl from '@docusaurus/useBaseUrl';
3
- import useIsBrowser from '@docusaurus/useIsBrowser';
4
- import { PageMetadata } from '@docusaurus/theme-common';
5
- import Link from '@docusaurus/Link';
6
- import Layout from '@theme/Layout';
7
-
8
- export default function NotFound() {
9
- const redirectedV2Url = useBaseUrl('/docs/api');
10
- const redirectedV1Url = useBaseUrl('/docs/1.3.1/api');
11
- const baseUrlForV2Redirect = useBaseUrl(`/docs/2.3/api/`);
12
- const baseUrlForV1Redirect = useBaseUrl(`/docs/1.3/api/`);
13
- const isBrowser = useIsBrowser();
14
-
15
- if (isBrowser) {
16
- const path = window.location.pathname;
17
- let href = '';
18
- let redirect = false;
19
-
20
- if (path.startsWith(redirectedV2Url)) {
21
- href = baseUrlForV2Redirect + path.substring(redirectedV2Url.length + 1);
22
- redirect = true;
23
- }
24
-
25
- if (path.match(/\/docs\/2\.\d+\.\d+\/api/)) {
26
- href = baseUrlForV2Redirect + path.substring(redirectedV1Url.length + 1);
27
- redirect = true;
28
- }
29
-
30
- if (path.match(/\/api\/[12]\.\d+\/\w+/)) {
31
- const [, v, id] = path.match(/\/api\/([12])\.\d+\/(.*)/);
32
- href = (v === '1' ? baseUrlForV1Redirect : baseUrlForV2Redirect) + id;
33
- redirect = true;
34
- }
35
-
36
- if (path.match(/\/docs\/[01]\.\d+\.\d+\/api\/(.*)/)) {
37
- const id = path.match(/\/docs\/[01]\.\d+\.\d+\/api\/(.*)/)[1];
38
- href = baseUrlForV1Redirect + id;
39
- redirect = true;
40
- }
41
-
42
- if (redirect && window.location.href !== href) {
43
- window.location.href = href;
44
- }
45
- }
46
-
47
- return (
48
- <>
49
- <PageMetadata title={'Page Not Found'} />
50
- <Layout>
51
- <main className="container margin-vert--xl">
52
- <div className="row">
53
- <div className="col col--6 col--offset-3">
54
- <h1 className="hero__title">
55
- Page Not Found
56
- </h1>
57
- <p>
58
- We could not find what you were looking for 😢
59
- </p>
60
- <p>
61
- Recently we <b>released Apify SDK v3 </b>
62
- and we significantly upgraded the documentation.
63
- </p>
64
- <p>
65
- If you're looking for documentation of <b>Apify SDK v2</b>,
66
- <Link to={'/docs/2.3/guides/apify-platform'}> you can find it here</Link>.
67
- </p>
68
- <p>
69
- For <b>Apify SDK v3 docs</b>, go to the <Link to={'/'}>homepage</Link>.
70
- </p>
71
- </div>
72
- </div>
73
- </main>
74
- </Layout>
75
- </>
76
- );
77
- }
package/tsconfig.json DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "./dist",
5
- "allowJs": true,
6
- "jsx": "react",
7
- },
8
- "include": ["./src/*", "./src/**/*"],
9
- }