mintlify 1.0.9 → 1.1.1
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/README.md +60 -31
- package/bin/index.js +6 -6
- package/bin/index.js.map +1 -1
- package/bin/local-preview/helper-commands/cleanCommand.js +8 -0
- package/bin/local-preview/helper-commands/cleanCommand.js.map +1 -0
- package/bin/local-preview/helper-commands/clearCommand.js +26 -0
- package/bin/local-preview/helper-commands/clearCommand.js.map +1 -0
- package/bin/local-preview/helper-commands/installDepsCommand.js +12 -0
- package/bin/local-preview/helper-commands/installDepsCommand.js.map +1 -0
- package/bin/local-preview/index.js +20 -34
- package/bin/local-preview/index.js.map +1 -1
- package/bin/local-preview/utils/categorizeFiles.js +56 -0
- package/bin/local-preview/utils/categorizeFiles.js.map +1 -0
- package/bin/{dev → local-preview/utils}/getOpenApiContext.js +0 -0
- package/bin/local-preview/utils/getOpenApiContext.js.map +1 -0
- package/bin/local-preview/utils/injectFavicons.js +72 -0
- package/bin/local-preview/utils/injectFavicons.js.map +1 -0
- package/bin/local-preview/utils/listener.js +112 -0
- package/bin/local-preview/utils/listener.js.map +1 -0
- package/bin/{dev/injectNav.js → local-preview/utils/metadata.js} +33 -9
- package/bin/local-preview/utils/metadata.js.map +1 -0
- package/bin/local-preview/utils/mintConfigFile.js +43 -0
- package/bin/local-preview/utils/mintConfigFile.js.map +1 -0
- package/bin/local-preview/utils/openApiCheck.js +16 -0
- package/bin/local-preview/utils/openApiCheck.js.map +1 -0
- package/bin/{dev → local-preview/utils}/slugToTitle.js +0 -0
- package/bin/local-preview/utils/slugToTitle.js.map +1 -0
- package/bin/util.js +12 -0
- package/bin/util.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +8 -13
- package/src/local-preview/helper-commands/clearCommand.ts +26 -0
- package/src/local-preview/helper-commands/installDepsCommand.ts +13 -0
- package/src/local-preview/index.ts +20 -39
- package/src/local-preview/{categorizeFiles.ts → utils/categorizeFiles.ts} +2 -2
- package/src/local-preview/{getOpenApiContext.ts → utils/getOpenApiContext.ts} +0 -0
- package/src/local-preview/{injectFavicons.ts → utils/injectFavicons.ts} +1 -1
- package/src/local-preview/{listener.ts → utils/listener.ts} +2 -2
- package/src/local-preview/{metadata.ts → utils/metadata.ts} +1 -1
- package/src/local-preview/{mintConfigFile.ts → utils/mintConfigFile.ts} +1 -1
- package/src/local-preview/{openApiCheck.ts → utils/openApiCheck.ts} +0 -0
- package/src/local-preview/{slugToTitle.ts → utils/slugToTitle.ts} +0 -0
- package/src/util.ts +13 -0
- package/bin/dev/getOpenApiContext.js.map +0 -1
- package/bin/dev/index.js +0 -164
- package/bin/dev/index.js.map +0 -1
- package/bin/dev/injectNav.js.map +0 -1
- package/bin/dev/slugToTitle.js.map +0 -1
- package/bin/mint/client/.babel-plugin-macrosrc.json +0 -5
- package/bin/mint/client/.babelrc +0 -4
- package/bin/mint/client/.editorconfig +0 -12
- package/bin/mint/client/.eslintrc.json +0 -7
- package/bin/mint/client/.prettierignore +0 -4
- package/bin/mint/client/.prettierrc +0 -14
- package/bin/mint/client/.vscode/launch.json +0 -28
- package/bin/mint/client/README.md +0 -46
- package/bin/mint/client/jest.config.ts +0 -195
- package/bin/mint/client/next-env.d.ts +0 -4
- package/bin/mint/client/next.config.js +0 -152
- package/bin/mint/client/package.json +0 -140
- package/bin/mint/client/postcss.config.cjs +0 -9
- package/bin/mint/client/prebuild/faviconConfig.js +0 -35
- package/bin/mint/client/prebuild/getOpenApiContext.js +0 -53
- package/bin/mint/client/prebuild/index.js +0 -117
- package/bin/mint/client/prebuild/injectNav.js +0 -115
- package/bin/mint/client/prebuild/slugToTitle.js +0 -7
- package/bin/mint/client/rehype/withApiComponents.js +0 -60
- package/bin/mint/client/rehype/withCodeBlocks.js +0 -54
- package/bin/mint/client/rehype/withLayouts.js +0 -113
- package/bin/mint/client/rehype/withLinkRoles.js +0 -13
- package/bin/mint/client/rehype/withRawComponents.js +0 -13
- package/bin/mint/client/rehype/withStaticProps.js +0 -25
- package/bin/mint/client/rehype/withSyntaxHighlighting.js +0 -60
- package/bin/mint/client/remark/utils.js +0 -369
- package/bin/mint/client/remark/withFrames.js +0 -55
- package/bin/mint/client/remark/withImportsInjected.js +0 -36
- package/bin/mint/client/remark/withNextLinks.js +0 -37
- package/bin/mint/client/remark/withTableOfContents.js +0 -71
- package/bin/mint/client/scripts/local-to-docs.js +0 -72
- package/bin/mint/client/scripts/local.js +0 -177
- package/bin/mint/client/sentry.client.config.js +0 -15
- package/bin/mint/client/sentry.properties +0 -4
- package/bin/mint/client/sentry.server.config.js +0 -15
- package/bin/mint/client/src/analytics/AbstractAnalyticsImplementation.ts +0 -50
- package/bin/mint/client/src/analytics/AnalyticsContext.ts +0 -5
- package/bin/mint/client/src/analytics/AnalyticsMediator.ts +0 -101
- package/bin/mint/client/src/analytics/FakeAnalyticsMediator.ts +0 -9
- package/bin/mint/client/src/analytics/GA4Script.tsx +0 -33
- package/bin/mint/client/src/analytics/implementations/amplitude.ts +0 -26
- package/bin/mint/client/src/analytics/implementations/fathom.ts +0 -38
- package/bin/mint/client/src/analytics/implementations/ga4.ts +0 -33
- package/bin/mint/client/src/analytics/implementations/hotjar.ts +0 -53
- package/bin/mint/client/src/analytics/implementations/mixpanel-browser.d.ts +0 -1
- package/bin/mint/client/src/analytics/implementations/mixpanel.ts +0 -52
- package/bin/mint/client/src/analytics/implementations/posthog.ts +0 -37
- package/bin/mint/client/src/components/Accordion/Accordion.tsx +0 -43
- package/bin/mint/client/src/components/Accordion/index.ts +0 -4
- package/bin/mint/client/src/components/ApiExample.tsx +0 -9
- package/bin/mint/client/src/components/Card.tsx +0 -51
- package/bin/mint/client/src/components/CodeGroup.tsx +0 -132
- package/bin/mint/client/src/components/Editor.tsx +0 -12
- package/bin/mint/client/src/components/Expandable.tsx +0 -40
- package/bin/mint/client/src/components/Heading.tsx +0 -84
- package/bin/mint/client/src/components/Param.tsx +0 -56
- package/bin/mint/client/src/components/Request.tsx +0 -19
- package/bin/mint/client/src/components/ResponseField.tsx +0 -33
- package/bin/mint/client/src/components/TabBar.tsx +0 -61
- package/bin/mint/client/src/config.ts +0 -115
- package/bin/mint/client/src/css/bar-of-progress.css +0 -10
- package/bin/mint/client/src/css/base.css +0 -29
- package/bin/mint/client/src/css/font-awesome.css +0 -7
- package/bin/mint/client/src/css/fonts.css +0 -44
- package/bin/mint/client/src/css/main.css +0 -11
- package/bin/mint/client/src/css/prism.css +0 -270
- package/bin/mint/client/src/css/utilities.css +0 -43
- package/bin/mint/client/src/enums/components.ts +0 -8
- package/bin/mint/client/src/fonts/FiraCode-VF.woff +0 -0
- package/bin/mint/client/src/fonts/FiraCode-VF.woff2 +0 -0
- package/bin/mint/client/src/fonts/IBMPlexMono-Regular.ttf +0 -0
- package/bin/mint/client/src/fonts/IBMPlexMono-SemiBold.ttf +0 -0
- package/bin/mint/client/src/fonts/Inter-italic-latin.var.woff2 +0 -0
- package/bin/mint/client/src/fonts/Inter-roman-latin.var.woff2 +0 -0
- package/bin/mint/client/src/fonts/Pally-Variable.ttf +0 -0
- package/bin/mint/client/src/fonts/SourceSansPro-Regular.otf +0 -0
- package/bin/mint/client/src/fonts/SourceSerifPro-Regular.ttf +0 -0
- package/bin/mint/client/src/fonts/Synonym-Variable.ttf +0 -0
- package/bin/mint/client/src/fonts/Ubuntu-Mono-bold.woff2 +0 -0
- package/bin/mint/client/src/fonts/generated/IBMPlexMono-Regular-subset.woff2 +0 -0
- package/bin/mint/client/src/fonts/generated/IBMPlexMono-Regular-subset.zopfli.woff +0 -0
- package/bin/mint/client/src/fonts/generated/IBMPlexMono-Regular.module.css +0 -11
- package/bin/mint/client/src/fonts/generated/IBMPlexMono-SemiBold-subset.woff2 +0 -0
- package/bin/mint/client/src/fonts/generated/IBMPlexMono-SemiBold-subset.zopfli.woff +0 -0
- package/bin/mint/client/src/fonts/generated/IBMPlexMono-SemiBold.module.css +0 -11
- package/bin/mint/client/src/fonts/generated/Pally-Variable-subset.woff2 +0 -0
- package/bin/mint/client/src/fonts/generated/Pally-Variable-subset.zopfli.woff +0 -0
- package/bin/mint/client/src/fonts/generated/Pally-Variable.module.css +0 -11
- package/bin/mint/client/src/fonts/generated/SourceSerifPro-Regular-subset.woff2 +0 -0
- package/bin/mint/client/src/fonts/generated/SourceSerifPro-Regular-subset.zopfli.woff +0 -0
- package/bin/mint/client/src/fonts/generated/SourceSerifPro-Regular.module.css +0 -11
- package/bin/mint/client/src/fonts/generated/Synonym-Variable-subset.woff2 +0 -0
- package/bin/mint/client/src/fonts/generated/Synonym-Variable-subset.zopfli.woff +0 -0
- package/bin/mint/client/src/fonts/generated/Synonym-Variable.module.css +0 -11
- package/bin/mint/client/src/fonts/generated/TenorSans-Regular-subset.woff2 +0 -0
- package/bin/mint/client/src/fonts/generated/TenorSans-Regular-subset.zopfli.woff +0 -0
- package/bin/mint/client/src/fonts/generated/TenorSans-Regular.module.css +0 -11
- package/bin/mint/client/src/hooks/useActionKey.ts +0 -20
- package/bin/mint/client/src/hooks/useIsomorphicLayoutEffect.ts +0 -3
- package/bin/mint/client/src/hooks/useMedia.ts +0 -27
- package/bin/mint/client/src/hooks/usePrevNext.ts +0 -34
- package/bin/mint/client/src/hooks/useTop.ts +0 -15
- package/bin/mint/client/src/icons/CopyToClipboard.tsx +0 -33
- package/bin/mint/client/src/index.d.ts +0 -1
- package/bin/mint/client/src/layouts/ApiSupplemental.tsx +0 -173
- package/bin/mint/client/src/layouts/ContentsLayout.tsx +0 -256
- package/bin/mint/client/src/layouts/DocumentationLayout.tsx +0 -44
- package/bin/mint/client/src/layouts/OpenApiContent.tsx +0 -301
- package/bin/mint/client/src/layouts/SidebarLayout.tsx +0 -412
- package/bin/mint/client/src/layouts/UserFeedback.tsx +0 -73
- package/bin/mint/client/src/layouts/getGroupsInDivision.ts +0 -25
- package/bin/mint/client/src/layouts/isPathInGroupPages.ts +0 -10
- package/bin/mint/client/src/metadata.ts +0 -58
- package/bin/mint/client/src/openapi.ts +0 -3
- package/bin/mint/client/src/pages/404.tsx +0 -73
- package/bin/mint/client/src/pages/_app.tsx +0 -138
- package/bin/mint/client/src/pages/_document.tsx +0 -57
- package/bin/mint/client/src/pages/api/issue.ts +0 -10
- package/bin/mint/client/src/pages/api/name.ts +0 -8
- package/bin/mint/client/src/pages/api/request.ts +0 -31
- package/bin/mint/client/src/pages/api/suggest.ts +0 -10
- package/bin/mint/client/src/pages/api/syntax-highlighted-json.ts +0 -13
- package/bin/mint/client/src/pages/api/utils.ts +0 -6
- package/bin/mint/client/src/pages/index.tsx +0 -31
- package/bin/mint/client/src/ui/Api.tsx +0 -359
- package/bin/mint/client/src/ui/Footer.tsx +0 -124
- package/bin/mint/client/src/ui/Header.tsx +0 -370
- package/bin/mint/client/src/ui/Logo.tsx +0 -55
- package/bin/mint/client/src/ui/PageHeader.tsx +0 -51
- package/bin/mint/client/src/ui/Search.tsx +0 -386
- package/bin/mint/client/src/ui/ThemeToggle.tsx +0 -285
- package/bin/mint/client/src/ui/Title.tsx +0 -22
- package/bin/mint/client/src/ui/TopLevelLink.tsx +0 -122
- package/bin/mint/client/src/utils/api.ts +0 -252
- package/bin/mint/client/src/utils/brands.ts +0 -217
- package/bin/mint/client/src/utils/castArray.ts +0 -3
- package/bin/mint/client/src/utils/childrenArray.ts +0 -3
- package/bin/mint/client/src/utils/fit.ts +0 -27
- package/bin/mint/client/src/utils/fontAwesome.ts +0 -577
- package/bin/mint/client/src/utils/getAnalyticsConfig.ts +0 -14
- package/bin/mint/client/src/utils/getLogoHref.ts +0 -9
- package/bin/mint/client/src/utils/getOpenApiContext.ts +0 -26
- package/bin/mint/client/src/utils/importAll.ts +0 -6
- package/bin/mint/client/src/utils/isObject.ts +0 -3
- package/bin/mint/client/src/utils/kebabToTitleCase.ts +0 -3
- package/bin/mint/client/src/utils/loadImage.ts +0 -8
- package/bin/mint/client/src/utils/slugToTitle.ts +0 -7
- package/bin/mint/client/src/utils/wait.ts +0 -5
- package/bin/mint/client/tailwind.config.cjs +0 -323
- package/bin/mint/client/test/test.test.ts +0 -5
- package/bin/mint/client/tsconfig.json +0 -36
- package/bin/mint/client/yarn.lock +0 -9702
- package/bin/templates.js +0 -41
- package/bin/templates.js.map +0 -1
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import Link from 'next/link';
|
|
2
|
-
import { useRouter } from 'next/router';
|
|
3
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
4
|
-
import { solid, regular } from '@fortawesome/fontawesome-svg-core/import.macro';
|
|
5
|
-
|
|
6
|
-
const FeedbackTooltip = ({ message }: { message: string }) => {
|
|
7
|
-
return (
|
|
8
|
-
<div className="absolute hidden group-hover:block bottom-full left-1/2 mb-3.5 pb-1 -translate-x-1/2">
|
|
9
|
-
<div
|
|
10
|
-
className="relative w-24 flex justify-center bg-primary-dark text-white text-xs font-medium py-0.5 px-1.5 rounded-lg"
|
|
11
|
-
data-reach-alert="true"
|
|
12
|
-
>
|
|
13
|
-
{message}
|
|
14
|
-
<svg
|
|
15
|
-
aria-hidden="true"
|
|
16
|
-
width="16"
|
|
17
|
-
height="6"
|
|
18
|
-
viewBox="0 0 16 6"
|
|
19
|
-
className="text-primary-dark absolute top-full left-1/2 -mt-px -ml-2"
|
|
20
|
-
>
|
|
21
|
-
<path
|
|
22
|
-
fillRule="evenodd"
|
|
23
|
-
clipRule="evenodd"
|
|
24
|
-
d="M15 0H1V1.00366V1.00366V1.00371H1.01672C2.72058 1.0147 4.24225 2.74704 5.42685 4.72928C6.42941 6.40691 9.57154 6.4069 10.5741 4.72926C11.7587 2.74703 13.2803 1.0147 14.9841 1.00371H15V0Z"
|
|
25
|
-
fill="currentColor"
|
|
26
|
-
></path>
|
|
27
|
-
</svg>
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
|
-
);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export function UserFeedback({ title }: { title: string }) {
|
|
34
|
-
const router = useRouter();
|
|
35
|
-
return (
|
|
36
|
-
<div className="flex items-center space-x-2">
|
|
37
|
-
<Link href={`/api/suggest?path=${router.pathname}`}>
|
|
38
|
-
<a
|
|
39
|
-
className="relative w-fit flex items-center p-1.5 group fill-slate-500 dark:fill-slate-400 hover:fill-slate-700 dark:hover:fill-slate-200 dark:hover:text-slate-300"
|
|
40
|
-
target="_blank"
|
|
41
|
-
rel="noopener noreferrer"
|
|
42
|
-
>
|
|
43
|
-
<FontAwesomeIcon
|
|
44
|
-
icon={regular('pencil')}
|
|
45
|
-
className="h-3.5 w-3.5 block group-hover:hidden"
|
|
46
|
-
/>
|
|
47
|
-
<FontAwesomeIcon
|
|
48
|
-
icon={solid('pencil')}
|
|
49
|
-
className="h-3.5 w-3.5 hidden group-hover:block"
|
|
50
|
-
/>
|
|
51
|
-
<FeedbackTooltip message="Edit this page" />
|
|
52
|
-
</a>
|
|
53
|
-
</Link>
|
|
54
|
-
<Link href={`/api/issue?path=${router.pathname}&title=${title}`}>
|
|
55
|
-
<a
|
|
56
|
-
className="relative w-fit flex items-center p-1.5 group fill-slate-500 dark:fill-slate-400 hover:fill-slate-700 dark:hover:fill-slate-200 dark:hover:text-slate-300"
|
|
57
|
-
target="_blank"
|
|
58
|
-
rel="noopener noreferrer"
|
|
59
|
-
>
|
|
60
|
-
<FontAwesomeIcon
|
|
61
|
-
icon={regular('triangle-exclamation')}
|
|
62
|
-
className="h-3.5 w-3.5 block group-hover:hidden"
|
|
63
|
-
/>
|
|
64
|
-
<FontAwesomeIcon
|
|
65
|
-
icon={solid('triangle-exclamation')}
|
|
66
|
-
className="h-3.5 w-3.5 hidden group-hover:block"
|
|
67
|
-
/>
|
|
68
|
-
<FeedbackTooltip message="Raise an issue" />
|
|
69
|
-
</a>
|
|
70
|
-
</Link>
|
|
71
|
-
</div>
|
|
72
|
-
);
|
|
73
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Group, Groups, GroupPage, isGroup } from '@/metadata';
|
|
2
|
-
|
|
3
|
-
export function getGroupsInDivision(nav: Groups, divisionUrls: string[]) {
|
|
4
|
-
return nav.filter((group: Group) => isGroupInDivision(group, divisionUrls));
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export function getGroupsNotInDivision(nav: Groups, divisionUrls: string[]) {
|
|
8
|
-
return nav.filter((group: Group) => !isGroupInDivision(group, divisionUrls));
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function isGroupInDivision(group: Group, divisionUrls: string[]) {
|
|
12
|
-
return group.pages.some((page) => divisionUrls.some((url) => isGroupPageInDivision(page, url)));
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function isGroupPageInDivision(page: GroupPage, divisionUrl: string): boolean {
|
|
16
|
-
if (isGroup(page)) {
|
|
17
|
-
return isGroupInDivision(page, [divisionUrl]);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (page?.href == null) {
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return page.href.startsWith(`/${divisionUrl}/`);
|
|
25
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { GroupPage, isGroup } from '@/metadata';
|
|
2
|
-
|
|
3
|
-
export default function isPathInGroupPages(pathname: string, groupPages: GroupPage[]): boolean {
|
|
4
|
-
return groupPages.some((groupPage) => {
|
|
5
|
-
if (isGroup(groupPage)) {
|
|
6
|
-
return isPathInGroupPages(pathname, groupPage.pages);
|
|
7
|
-
}
|
|
8
|
-
return groupPage.href === pathname;
|
|
9
|
-
});
|
|
10
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import metadataJson from './metadata.json';
|
|
2
|
-
|
|
3
|
-
export const documentationNav: Groups = metadataJson;
|
|
4
|
-
export const nonMetaTags = ['api', 'openapi', 'sidebarTitle'];
|
|
5
|
-
|
|
6
|
-
export type PageContext = {
|
|
7
|
-
title?: string;
|
|
8
|
-
sidebarTitle?: string;
|
|
9
|
-
description?: string;
|
|
10
|
-
api?: string;
|
|
11
|
-
openapi?: string;
|
|
12
|
-
href?: string;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export type Groups = Group[];
|
|
16
|
-
|
|
17
|
-
export type Group = {
|
|
18
|
-
group: string;
|
|
19
|
-
pages: GroupPage[];
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export type GroupPage = PageContext | Group;
|
|
23
|
-
|
|
24
|
-
export const isGroup = (group: GroupPage): group is Group => {
|
|
25
|
-
// Used in if-statements to case GroupPage into either PageContext or Group
|
|
26
|
-
// The return type "group is Group" is the cast
|
|
27
|
-
return group && group.hasOwnProperty('group') && group.hasOwnProperty('pages');
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const findPageInGroup = (
|
|
31
|
-
group: Group,
|
|
32
|
-
targetHref: string
|
|
33
|
-
): { group: string; page: PageContext } | undefined => {
|
|
34
|
-
const { pages } = group;
|
|
35
|
-
let target = undefined;
|
|
36
|
-
pages.forEach((page) => {
|
|
37
|
-
const actualPage = page as PageContext;
|
|
38
|
-
const subGroup = page as Group;
|
|
39
|
-
if (actualPage?.href === targetHref) {
|
|
40
|
-
target = { group: group.group, page: actualPage };
|
|
41
|
-
} else if (isGroup(subGroup)) {
|
|
42
|
-
const resultInSubGroup = findPageInGroup(subGroup, targetHref);
|
|
43
|
-
if (resultInSubGroup != null) {
|
|
44
|
-
target = resultInSubGroup;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
return target;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export const flattenGroupPages = (groupPages: GroupPage[]): PageContext[] => {
|
|
52
|
-
return groupPages.flatMap((groupPage) => {
|
|
53
|
-
if (isGroup(groupPage)) {
|
|
54
|
-
return flattenGroupPages(groupPage.pages);
|
|
55
|
-
}
|
|
56
|
-
return groupPage;
|
|
57
|
-
});
|
|
58
|
-
};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { ChevronRightIcon } from '@heroicons/react/solid';
|
|
2
|
-
import Link from 'next/link';
|
|
3
|
-
|
|
4
|
-
import { documentationNav, isGroup } from '@/metadata';
|
|
5
|
-
|
|
6
|
-
export default function Error() {
|
|
7
|
-
return (
|
|
8
|
-
<div>
|
|
9
|
-
<main className="max-w-6xl w-full mx-auto px-4 sm:px-6 lg:px-8">
|
|
10
|
-
<div className="max-w-md mx-auto py-12 sm:py-20">
|
|
11
|
-
<div className="text-center">
|
|
12
|
-
<p className="text-xl font-semibold text-primary dark:text-primary-light">404</p>
|
|
13
|
-
<h1 className="mt-2 text-xl font-bold text-slate-800 dark:text-slate-100 tracking-tight sm:text-4xl sm:tracking-tight">
|
|
14
|
-
Page not found
|
|
15
|
-
</h1>
|
|
16
|
-
<p className="mt-2 text-lg text-slate-500 dark:text-slate-400">
|
|
17
|
-
But here are some other popular destinations
|
|
18
|
-
</p>
|
|
19
|
-
</div>
|
|
20
|
-
<div className="mt-8">
|
|
21
|
-
<ul className="mt-4 border-l border-slate-100 dark:border-slate-800">
|
|
22
|
-
{documentationNav.slice(0, 3).map((nav) => {
|
|
23
|
-
if (nav?.pages == null || nav.pages[0] == null || isGroup(nav.pages[0])) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<Link href={nav.pages[0].href || '/'}>
|
|
29
|
-
<li
|
|
30
|
-
key={nav.group}
|
|
31
|
-
className="group -ml-px relative my-3 py-2 px-6 flex items-start border-l border-transparent hover:border-primary dark:hover:border-primary-light space-x-4 cursor-pointer"
|
|
32
|
-
>
|
|
33
|
-
<div className="min-w-0 flex-1">
|
|
34
|
-
<h3 className="text-sm font-semibold text-primary dark:text-primary-light">
|
|
35
|
-
{nav.group}
|
|
36
|
-
</h3>
|
|
37
|
-
<h1 className="text-base font-medium text-slate-600 dark:text-slate-300 group-hover:text-slate-900 dark:group-hover:text-slate-100">
|
|
38
|
-
{nav.pages[0].title}
|
|
39
|
-
</h1>
|
|
40
|
-
<p className="text-base text-slate-500 dark:text-slate-400">
|
|
41
|
-
{nav.pages[0].description}
|
|
42
|
-
</p>
|
|
43
|
-
</div>
|
|
44
|
-
<div className="flex-shrink-0 self-center">
|
|
45
|
-
<ChevronRightIcon
|
|
46
|
-
className="h-5 w-5 text-slate-400 dark:text-slate-400 group-hover:text-slate-700 dark:group-hover:text-slate-200"
|
|
47
|
-
aria-hidden="true"
|
|
48
|
-
/>
|
|
49
|
-
</div>
|
|
50
|
-
</li>
|
|
51
|
-
</Link>
|
|
52
|
-
);
|
|
53
|
-
})}
|
|
54
|
-
</ul>
|
|
55
|
-
<div className="mt-12">
|
|
56
|
-
<Link href="/">
|
|
57
|
-
<a className="text-sm font-medium text-primary hover:text-primary-dark dark:text-primary-light dark:hover:text-primary">
|
|
58
|
-
Back to main page<span aria-hidden="true"> →</span>
|
|
59
|
-
</a>
|
|
60
|
-
</Link>
|
|
61
|
-
</div>
|
|
62
|
-
</div>
|
|
63
|
-
</div>
|
|
64
|
-
</main>
|
|
65
|
-
</div>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
Error.layoutProps = {
|
|
70
|
-
meta: {
|
|
71
|
-
title: '404',
|
|
72
|
-
},
|
|
73
|
-
};
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import ProgressBar from '@badrap/bar-of-progress';
|
|
2
|
-
import { ResizeObserver } from '@juggle/resize-observer';
|
|
3
|
-
import 'focus-visible';
|
|
4
|
-
import 'intersection-observer';
|
|
5
|
-
import Head from 'next/head';
|
|
6
|
-
import Router from 'next/router';
|
|
7
|
-
import { useState, useEffect } from 'react';
|
|
8
|
-
|
|
9
|
-
import { AnalyticsMediatorInterface } from '@/analytics/AbstractAnalyticsImplementation';
|
|
10
|
-
import AnalyticsContext from '@/analytics/AnalyticsContext';
|
|
11
|
-
import AnalyticsMediator from '@/analytics/AnalyticsMediator';
|
|
12
|
-
import FakeAnalyticsMediator from '@/analytics/FakeAnalyticsMediator';
|
|
13
|
-
import GA4Script from '@/analytics/GA4Script';
|
|
14
|
-
import { config } from '@/config';
|
|
15
|
-
import { Meta } from '@/layouts/ContentsLayout';
|
|
16
|
-
import { DocumentationLayout } from '@/layouts/DocumentationLayout';
|
|
17
|
-
import { documentationNav, findPageInGroup, PageContext, nonMetaTags } from '@/metadata';
|
|
18
|
-
import { Header } from '@/ui/Header';
|
|
19
|
-
import { SearchProvider } from '@/ui/Search';
|
|
20
|
-
import { Title } from '@/ui/Title';
|
|
21
|
-
import '@/utils/fontAwesome';
|
|
22
|
-
import getAnalyticsConfig from '@/utils/getAnalyticsConfig';
|
|
23
|
-
|
|
24
|
-
import '../css/fonts.css';
|
|
25
|
-
import '../css/main.css';
|
|
26
|
-
|
|
27
|
-
if (typeof window !== 'undefined' && !('ResizeObserver' in window)) {
|
|
28
|
-
window.ResizeObserver = ResizeObserver;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const progress = new ProgressBar({
|
|
32
|
-
size: 2,
|
|
33
|
-
color: config?.colors?.primary ?? '#0C8C5E',
|
|
34
|
-
className: 'bar-of-progress',
|
|
35
|
-
delay: 100,
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
// this fixes safari jumping to the bottom of the page
|
|
39
|
-
// when closing the search modal using the `esc` key
|
|
40
|
-
if (typeof window !== 'undefined') {
|
|
41
|
-
progress.start();
|
|
42
|
-
progress.finish();
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
Router.events.on('routeChangeStart', () => progress.start());
|
|
46
|
-
Router.events.on('routeChangeComplete', () => progress.finish());
|
|
47
|
-
Router.events.on('routeChangeError', () => progress.finish());
|
|
48
|
-
|
|
49
|
-
export default function App(props: any) {
|
|
50
|
-
const { Component, pageProps, router } = props;
|
|
51
|
-
const [initializedAnalyticsMediator, setInitializedAnalyticsMediator] = useState(false);
|
|
52
|
-
const [analyticsMediator, setAnalyticsMediator] = useState<AnalyticsMediatorInterface>(
|
|
53
|
-
new FakeAnalyticsMediator()
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
const analytics = getAnalyticsConfig(config);
|
|
57
|
-
|
|
58
|
-
// AnalyticsMediator can only run in the browser
|
|
59
|
-
// We use useEffect because it only runs on render
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
if (!initializedAnalyticsMediator) {
|
|
62
|
-
const newMediator = new AnalyticsMediator(analytics);
|
|
63
|
-
setAnalyticsMediator(newMediator);
|
|
64
|
-
setInitializedAnalyticsMediator(true);
|
|
65
|
-
}
|
|
66
|
-
}, [initializedAnalyticsMediator, analytics]);
|
|
67
|
-
|
|
68
|
-
let [navIsOpen, setNavIsOpen] = useState(false);
|
|
69
|
-
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
Router.events.on('routeChangeComplete', (url: string, routeProps: any) => {
|
|
72
|
-
analyticsMediator.onRouteChange(url, routeProps);
|
|
73
|
-
});
|
|
74
|
-
}, [analyticsMediator]);
|
|
75
|
-
|
|
76
|
-
useEffect(() => {
|
|
77
|
-
if (!navIsOpen) return;
|
|
78
|
-
function handleRouteChange() {
|
|
79
|
-
setNavIsOpen(false);
|
|
80
|
-
}
|
|
81
|
-
Router.events.on('routeChangeComplete', handleRouteChange);
|
|
82
|
-
return () => {
|
|
83
|
-
Router.events.off('routeChangeComplete', handleRouteChange);
|
|
84
|
-
};
|
|
85
|
-
}, [navIsOpen]);
|
|
86
|
-
|
|
87
|
-
let section = undefined;
|
|
88
|
-
let meta: Meta = {};
|
|
89
|
-
documentationNav.forEach((group) => {
|
|
90
|
-
const foundPage = findPageInGroup(group, router.pathname);
|
|
91
|
-
if (foundPage) {
|
|
92
|
-
section = foundPage.group;
|
|
93
|
-
meta = foundPage.page;
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
return true;
|
|
97
|
-
});
|
|
98
|
-
const metaTags: PageContext = {};
|
|
99
|
-
Object.entries(meta).forEach(([key, value]) => {
|
|
100
|
-
if (nonMetaTags.includes(key)) return;
|
|
101
|
-
metaTags[key as keyof PageContext] = value;
|
|
102
|
-
});
|
|
103
|
-
return (
|
|
104
|
-
<AnalyticsContext.Provider value={analyticsMediator}>
|
|
105
|
-
<Title suffix={config.name}>{meta.sidebarTitle || meta.title}</Title>
|
|
106
|
-
<Head>
|
|
107
|
-
{config?.metadata &&
|
|
108
|
-
Object.entries(config?.metadata).map(([key, value]) => {
|
|
109
|
-
if (!value) {
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
|
-
return <meta key={key} name={key} content={value as any} />;
|
|
113
|
-
})}
|
|
114
|
-
{Object.entries(metaTags).map(([key, value]) => (
|
|
115
|
-
<meta key={key} name={key} content={value} />
|
|
116
|
-
))}
|
|
117
|
-
</Head>
|
|
118
|
-
<GA4Script ga4={analytics.ga4} />
|
|
119
|
-
<SearchProvider>
|
|
120
|
-
<Header
|
|
121
|
-
hasNav={Boolean(config.navigation?.length)}
|
|
122
|
-
navIsOpen={navIsOpen}
|
|
123
|
-
onNavToggle={(isOpen: boolean) => setNavIsOpen(isOpen)}
|
|
124
|
-
title={meta?.title}
|
|
125
|
-
section={section}
|
|
126
|
-
/>
|
|
127
|
-
<DocumentationLayout
|
|
128
|
-
isMdx={pageProps?.isMdx}
|
|
129
|
-
navIsOpen={navIsOpen}
|
|
130
|
-
setNavIsOpen={setNavIsOpen}
|
|
131
|
-
meta={meta}
|
|
132
|
-
>
|
|
133
|
-
<Component section={section} meta={meta} />
|
|
134
|
-
</DocumentationLayout>
|
|
135
|
-
</SearchProvider>
|
|
136
|
-
</AnalyticsContext.Provider>
|
|
137
|
-
);
|
|
138
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import NextDocument, { Html, Head, Main, NextScript, DocumentContext } from 'next/document';
|
|
2
|
-
|
|
3
|
-
import { config } from '@/config';
|
|
4
|
-
|
|
5
|
-
const FAVICON_VERSION = 3;
|
|
6
|
-
|
|
7
|
-
function v(href: string) {
|
|
8
|
-
return `${href}?v=${FAVICON_VERSION}`;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export default class Document extends NextDocument {
|
|
12
|
-
static async getInitialProps(ctx: DocumentContext) {
|
|
13
|
-
const initialProps = await NextDocument.getInitialProps(ctx);
|
|
14
|
-
return { ...initialProps };
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
render() {
|
|
18
|
-
return (
|
|
19
|
-
<Html lang="en" className="dark [--scroll-mt:9.875rem] lg:[--scroll-mt:6.3125rem]">
|
|
20
|
-
<Head>
|
|
21
|
-
<link rel="apple-touch-icon" sizes="180x180" href={v('/favicons/apple-touch-icon.png')} />
|
|
22
|
-
<link rel="icon" type="image/png" sizes="32x32" href={v('/favicons/favicon-32x32.png')} />
|
|
23
|
-
<link rel="icon" type="image/png" sizes="16x16" href={v('/favicons/favicon-16x16.png')} />
|
|
24
|
-
<link rel="shortcut icon" href={v('/favicons/favicon.ico')} />
|
|
25
|
-
<meta name="apple-mobile-web-app-title" content={config.name} />
|
|
26
|
-
<meta name="application-name" content={config.name} />
|
|
27
|
-
<meta name="theme-color" content="#ffffff" />
|
|
28
|
-
<meta name="msapplication-TileColor" content={config.colors?.primary} />
|
|
29
|
-
<meta name="msapplication-config" content={v('/favicons/browserconfig.xml')} />
|
|
30
|
-
<script
|
|
31
|
-
dangerouslySetInnerHTML={{
|
|
32
|
-
__html: `
|
|
33
|
-
try {
|
|
34
|
-
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
|
|
35
|
-
document.documentElement.classList.add('dark')
|
|
36
|
-
} else {
|
|
37
|
-
document.documentElement.classList.remove('dark')
|
|
38
|
-
}
|
|
39
|
-
} catch (_) {}
|
|
40
|
-
`,
|
|
41
|
-
}}
|
|
42
|
-
/>
|
|
43
|
-
</Head>
|
|
44
|
-
<body
|
|
45
|
-
className="antialiased bg-background-light dark:bg-background-dark text-slate-500 dark:text-slate-400"
|
|
46
|
-
// Add background image
|
|
47
|
-
{...(config.backgroundImage && {
|
|
48
|
-
style: { background: `url('${config.backgroundImage}') no-repeat fixed top right` },
|
|
49
|
-
})}
|
|
50
|
-
>
|
|
51
|
-
<Main />
|
|
52
|
-
<NextScript />
|
|
53
|
-
</body>
|
|
54
|
-
</Html>
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { NextApiRequest, NextApiResponse } from 'next';
|
|
2
|
-
|
|
3
|
-
function handler(req: NextApiRequest, res: NextApiResponse) {
|
|
4
|
-
const { path, title } = req.query;
|
|
5
|
-
return res.redirect(
|
|
6
|
-
`https://docs.mintlify.com/api/v1/app/issue/${process.env.NAME}?path=${path}.mdx&title=${title}`
|
|
7
|
-
);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export default handler;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { withSentry } from '@sentry/nextjs';
|
|
2
|
-
import axios from 'axios';
|
|
3
|
-
import { NextApiRequest, NextApiResponse } from 'next';
|
|
4
|
-
|
|
5
|
-
import { jsonSyntaxHighlight } from './utils';
|
|
6
|
-
|
|
7
|
-
async function handler(req: NextApiRequest, res: NextApiResponse) {
|
|
8
|
-
const { url, method, body, params, headers } = req.body;
|
|
9
|
-
try {
|
|
10
|
-
const response = await axios({
|
|
11
|
-
url,
|
|
12
|
-
method,
|
|
13
|
-
params,
|
|
14
|
-
data: body,
|
|
15
|
-
headers,
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
res.send({
|
|
19
|
-
response: response.data,
|
|
20
|
-
highlightedJson: jsonSyntaxHighlight(response.data),
|
|
21
|
-
});
|
|
22
|
-
} catch (error: any) {
|
|
23
|
-
const response = error.response;
|
|
24
|
-
res.send({
|
|
25
|
-
response: response?.data,
|
|
26
|
-
highlightedJson: jsonSyntaxHighlight(response?.data),
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export default withSentry(handler);
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { NextApiRequest, NextApiResponse } from 'next';
|
|
2
|
-
|
|
3
|
-
function handler(req: NextApiRequest, res: NextApiResponse) {
|
|
4
|
-
const { path } = req.query;
|
|
5
|
-
return res.redirect(
|
|
6
|
-
`https://docs.mintlify.com/api/v1/app/suggest/${process.env.NAME}?path=${path}.mdx`
|
|
7
|
-
);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export default handler;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { withSentry } from '@sentry/nextjs';
|
|
2
|
-
import { NextApiRequest, NextApiResponse } from 'next';
|
|
3
|
-
import { jsonSyntaxHighlight } from './utils';
|
|
4
|
-
|
|
5
|
-
async function handler(req: NextApiRequest, res: NextApiResponse) {
|
|
6
|
-
const { json } = req.body;
|
|
7
|
-
const highlightedJson = jsonSyntaxHighlight(json);
|
|
8
|
-
return res.send({
|
|
9
|
-
highlightedJson,
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default withSentry(handler);
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { config, Navigation } from '@/config';
|
|
2
|
-
import { DocumentationLayout } from '@/layouts/DocumentationLayout';
|
|
3
|
-
|
|
4
|
-
const getFirstPage = (nav: Navigation | string): string | void => {
|
|
5
|
-
if (typeof nav === 'string') {
|
|
6
|
-
return nav;
|
|
7
|
-
} else if (typeof nav !== 'string' && nav.group && nav.pages) {
|
|
8
|
-
return getFirstPage(nav.pages[0]);
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export default function Index() {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export async function getServerSideProps() {
|
|
17
|
-
return {
|
|
18
|
-
redirect: {
|
|
19
|
-
destination: `/${(config?.navigation && getFirstPage(config.navigation[0])) || ''}`,
|
|
20
|
-
permanent: false,
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
Index.layoutProps = {
|
|
26
|
-
meta: {
|
|
27
|
-
title: 'Introduction',
|
|
28
|
-
},
|
|
29
|
-
Layout: DocumentationLayout,
|
|
30
|
-
allowOverflow: false,
|
|
31
|
-
};
|