* configured base paths + added development banner * fix typelist site url * added navbar and sidebar badges * configure algolia filters * remove AI assistant * remove unused imports * change navbar text and badge * lint fixes * fix build error * add to api reference rewrites * fix build error * fix build errors in user-guide * fix feedback component * add parent title to pagination * added breadcrumbs component * remove user-guide links * resolve todos * fix details about authentication * change documentation title * lint content
86 lines
2.3 KiB
TypeScript
86 lines
2.3 KiB
TypeScript
"use client"
|
|
|
|
import {
|
|
usePageLoading,
|
|
SearchProvider as UiSearchProvider,
|
|
AiAssistantCommandIcon,
|
|
AiAssistantProvider,
|
|
searchFiltersV1,
|
|
} from "docs-ui"
|
|
import { config } from "../config"
|
|
|
|
type SearchProviderProps = {
|
|
children: React.ReactNode
|
|
}
|
|
|
|
const SearchProvider = ({ children }: SearchProviderProps) => {
|
|
const { isLoading } = usePageLoading()
|
|
return (
|
|
<UiSearchProvider
|
|
algolia={{
|
|
appId: process.env.NEXT_PUBLIC_ALGOLIA_APP_ID || "temp",
|
|
apiKey: process.env.NEXT_PUBLIC_ALGOLIA_API_KEY || "temp",
|
|
mainIndexName: process.env.NEXT_PUBLIC_API_ALGOLIA_INDEX_NAME || "temp",
|
|
indices: [
|
|
process.env.NEXT_PUBLIC_API_ALGOLIA_INDEX_NAME || "temp",
|
|
process.env.NEXT_PUBLIC_DOCS_ALGOLIA_INDEX_NAME || "temp",
|
|
],
|
|
}}
|
|
searchProps={{
|
|
isLoading,
|
|
suggestions: [
|
|
{
|
|
title: "Getting started? Try one of the following terms.",
|
|
items: [
|
|
"Install Medusa with create-medusa-app",
|
|
"Next.js quickstart",
|
|
"Admin dashboard quickstart",
|
|
"Commerce modules",
|
|
"Medusa architecture",
|
|
],
|
|
},
|
|
{
|
|
title: "Developing with Medusa",
|
|
items: [
|
|
"Recipes",
|
|
"How to create API routes",
|
|
"How to create an entity",
|
|
"How to create a plugin",
|
|
"How to create an admin widget",
|
|
],
|
|
},
|
|
],
|
|
checkInternalPattern: new RegExp(
|
|
`^${config.baseUrl}/api/(admin|store)`
|
|
),
|
|
filterOptions: searchFiltersV1,
|
|
}}
|
|
commands={[
|
|
{
|
|
name: "ai-assistant",
|
|
icon: <AiAssistantCommandIcon />,
|
|
component: (
|
|
<AiAssistantProvider
|
|
apiUrl={process.env.NEXT_PUBLIC_AI_ASSISTANT_URL || "temp"}
|
|
websiteId={process.env.NEXT_PUBLIC_AI_WEBSITE_ID || "temp"}
|
|
recaptchaSiteKey={
|
|
process.env.NEXT_PUBLIC_AI_API_ASSISTANT_RECAPTCHA_SITE_KEY ||
|
|
"temp"
|
|
}
|
|
/>
|
|
),
|
|
title: "AI Assistant",
|
|
badge: {
|
|
variant: "purple",
|
|
children: "Beta",
|
|
},
|
|
},
|
|
]}
|
|
>
|
|
{children}
|
|
</UiSearchProvider>
|
|
)
|
|
}
|
|
|
|
export default SearchProvider
|