Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion www/apps/api-reference/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ NEXT_PUBLIC_DOCS_ALGOLIA_INDEX_NAME=
NEXT_PUBLIC_API_ALGOLIA_INDEX_NAME=
NEXT_PUBLIC_ALGOLIA_API_KEY=
NEXT_PUBLIC_ALGOLIA_APP_ID=
NEXT_PUBLIC_ENV=
NEXT_PUBLIC_ENV=development # change to production when running npm start
NEXT_PUBLIC_BASE_URL=
NEXT_PUBLIC_DOCS_URL=
NEXT_PUBLIC_UI_URL=
Expand Down
2 changes: 1 addition & 1 deletion www/apps/api-reference/app/_mdx/admin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ If you click on the workflow, you'll view a reference of that workflow, includin

This is useful if you want to extend an API route and pass additional data or perform custom actions.

Refer to [this guide](https://docs.medusajs.com/v2/customization/extend-models/extend-create-product) to find an example of extending an API route.
Refer to [this guide](https://docs.medusajs.com/customization/extend-models/extend-create-product) to find an example of extending an API route.

<Feedback
event="survey_api-ref"
Expand Down
4 changes: 2 additions & 2 deletions www/apps/api-reference/app/_mdx/client-libraries.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import DownloadFull from "@/components/DownloadFull"

<H3 className="!mt-0">Just Getting Started?</H3>

Check out the [Medusa v2 Documentation](https://docs.medusajs.com/v2).
Check out the [Medusa v2 Documentation](https://docs.medusajs.com).

<Space bottom={8} />

Expand All @@ -16,7 +16,7 @@ To use Medusa's JS SDK library, install the following packages in your project (
npm install @medusajs/js-sdk@latest @medusajs/types@latest
```

Learn more about the JS SDK in [this documentation](https://docs.medusajs.com/v2/resources/js-sdk).
Learn more about the JS SDK in [this documentation](https://docs.medusajs.com/resources/js-sdk).

### Download Full Reference

Expand Down
4 changes: 2 additions & 2 deletions www/apps/api-reference/app/_mdx/store.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ and associate placed orders with the specified sales channel.

{/* TODO add v2 links */}

Create a publishable API key either using the [admin REST APIs](https://docs.medusajs.com/v2/api/admin#api-keys_postapikeys), or using the Medusa Admin.
Create a publishable API key either using the [admin REST APIs](https://docs.medusajs.com/api/admin#api-keys_postapikeys), or using the Medusa Admin.

### How to Use a Publishable API Key

Expand Down Expand Up @@ -839,7 +839,7 @@ If you click on the workflow, you'll view a reference of that workflow, includin

This is useful if you want to extend an API route and pass additional data or perform custom actions.

Refer to [this guide](https://docs.medusajs.com/v2/customization/extend-models/extend-create-product) to find an example of extending an API route.
Refer to [this guide](https://docs.medusajs.com/customization/extend-models/extend-create-product) to find an example of extending an API route.

<Feedback
event="survey_api-ref"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import OpenAPIParser from "@readme/openapi-parser"
import algoliasearch from "algoliasearch"
import type { ExpandedDocument, Operation } from "../../../types/openapi"
import type { ExpandedDocument, Operation } from "../../types/openapi"
import path from "path"
import getSectionId from "../../../utils/get-section-id"
import getSectionId from "../../utils/get-section-id"
import { NextResponse } from "next/server"
import { JSDOM } from "jsdom"
import getUrl from "../../../utils/get-url"
import getUrl from "../../utils/get-url"
import { capitalize } from "docs-ui"

export async function GET() {
Expand Down
Binary file modified www/apps/api-reference/app/opengraph-image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NextResponse } from "next/server"
import path from "path"
import { existsSync } from "fs"
import getSchemaContent from "../../../utils/get-schema-content"
import getSchemaContent from "../../utils/get-schema-content"

export async function GET(request: Request) {
const { searchParams } = new URL(request.url)
Expand Down
Binary file modified www/apps/api-reference/app/twitter-image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion www/apps/api-reference/components/DownloadFull/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const DownloadFull = () => {

return (
<Button variant="secondary">
<Link href={`/api/download/${area}`} download target="_blank">
<Link href={`/download/${area}`} download target="_blank">
Download OpenApi Specs Collection
</Link>
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const TagsOperationDescriptionSectionWorkflowBadge = ({
<p className="my-1">
Workflow{" "}
<Link
href={`${config.baseUrl}/v2/resources/references/medusa-workflows/${workflow}`}
href={`${config.baseUrl}/resources/references/medusa-workflows/${workflow}`}
className="align-middle"
target="_blank"
rel="noreferrer"
Expand Down
6 changes: 2 additions & 4 deletions www/apps/api-reference/components/Tags/Section/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const TagSectionComponent = ({ tag }: TagSectionProps) => {
}>(
loadData && tag["x-associatedSchema"]
? basePathUrl(
`/api/schema?name=${tag["x-associatedSchema"].$ref}&area=${area}`
`/schema?name=${tag["x-associatedSchema"].$ref}&area=${area}`
)
: null,
swrFetcher,
Expand All @@ -81,9 +81,7 @@ const TagSectionComponent = ({ tag }: TagSectionProps) => {
const { data: pathsData } = useSWR<{
paths: PathsObject
}>(
loadData
? basePathUrl(`/api/tag?tagName=${slugTagName}&area=${area}`)
: null,
loadData ? basePathUrl(`/tag?tagName=${slugTagName}&area=${area}`) : null,
swrFetcher,
{
errorRetryInterval: 2000,
Expand Down
2 changes: 1 addition & 1 deletion www/apps/api-reference/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const URL = `${process.env.NEXT_PUBLIC_BASE_URL}${process.env.NEXT_PUBLIC_BASE_P

export async function getBaseSpecs(area: Area) {
try {
const res = await fetch(`${URL}/api/base-specs?area=${area}`, {
const res = await fetch(`${URL}/base-specs?area=${area}`, {
next: {
revalidate: 3000,
tags: [area],
Expand Down
11 changes: 10 additions & 1 deletion www/apps/api-reference/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,22 @@ import rehypeSlug from "rehype-slug"

/** @type {import('next').NextConfig} */
const nextConfig = {
basePath: process.env.NEXT_PUBLIC_BASE_PATH || "/v2/api",
basePath: process.env.NEXT_PUBLIC_BASE_PATH || "/api",
webpack: (config) => {
config.ignoreWarnings = [{ module: /node_modules\/keyv\/src\/index\.js/ }]

return config
},
transpilePackages: ["docs-ui"],
async redirects() {
return [
{
source: "/api/download/:path",
destination: "/download/:path",
permanent: true,
},
]
},
}

const withMDX = mdx({
Expand Down
2 changes: 1 addition & 1 deletion www/apps/api-reference/vercel.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"crons": [{
"path": "/v2/api/api/algolia",
"path": "/api/algolia",
"schedule": "0 0 * * 4"
}],
"framework": "nextjs",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,4 @@ export default MyCustom

## Properties Reference

Refer to the [Data Model API reference](https://docs.medusajs.com/v2/resources/references/data-model) for a full reference of the properties.
Refer to the [Data Model API reference](!resources!/references/data-model) for a full reference of the properties.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This chapter covers how to extend the Create Product API route to link a product

## Additional Data in API Routes

Some API routes, including the [Create Product API route](https://docs.medusajs.com/v2/api/admin#products_postproducts), accept an `additional_data` request body parameter.
Some API routes, including the [Create Product API route](!api!/admin#products_postproducts), accept an `additional_data` request body parameter.

It's useful when you want to pass custom data, such as the brand ID, then perform an action based on this data, such as link the brand to the product.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ In this chapter, you’ll learn how to install and use the Next.js Starter store
},
]} />

1. Clone the `v2` branch of the [Next.js Starter](https://github.com/medusajs/nextjs-starter-medusa/tree/v2):
1. Clone the `v2` branch of the [Next.js Starter](https://github.com/medusajs/nextjs-starter-medusa):

```bash
git clone https://github.com/medusajs/nextjs-starter-medusa -b v2 my-medusa-storefront
git clone https://github.com/medusajs/nextjs-starter-medusa my-medusa-storefront
```

2. Change to the `my-medusa-storefront` directory, install the dependencies, and rename the template environment variable:
Expand Down
Binary file modified www/apps/book/app/opengraph-image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified www/apps/book/app/twitter-image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions www/apps/book/components/Homepage/LinksSection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const HomepageLinksSection = () => {
text: "Build a Module",
},
{
href: "https://docs.medusajs.com/v2/resources/integrations",
href: "https://docs.medusajs.com/resources/integrations",
text: "Browse third-party integrations",
},
],
Expand All @@ -41,11 +41,11 @@ const HomepageLinksSection = () => {
title: "Storefront Development",
links: [
{
href: "https://docs.medusajs.com/v2/resources/nextjs-starter",
href: "https://docs.medusajs.com/resources/nextjs-starter",
text: "Explore our storefront starter",
},
{
href: "https://docs.medusajs.com/v2/resources/storefront-development",
href: "https://docs.medusajs.com/resources/storefront-development",
text: "Build a custom storefront",
},
{
Expand Down
10 changes: 5 additions & 5 deletions www/apps/book/components/Homepage/RecipesSection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,28 @@ const HomepageRecipesSection = () => {
type: "large",
title: "Marketplace",
text: "Build a marketplace with multiple vendors",
href: "https://docs.medusajs.com/v2/resources/recipes/marketplace/examples/vendors",
href: "https://docs.medusajs.com/resources/recipes/marketplace/examples/vendors",
icon: ShopIcon,
},
{
type: "large",
title: "Subscriptions",
text: "Implement a subscription-based commerce store.",
href: "https://docs.medusajs.com/v2/resources/recipes/subscriptions/examples/standard",
href: "https://docs.medusajs.com/resources/recipes/subscriptions/examples/standard",
icon: CalendarRefreshIcon,
},
{
type: "large",
title: "Restaurant-Delivery",
text: "Build a restaurant marketplace inspired by UberEats, with real-time delivery handling",
href: "https://docs.medusajs.com/v2/resources/recipes/marketplace/examples/restaurant-delivery",
href: "https://docs.medusajs.com/resources/recipes/marketplace/examples/restaurant-delivery",
icon: ChefHatIcon,
},
{
type: "large",
title: "Digital Products",
text: "Sell digital products with custom fulfillment.",
href: "https://docs.medusajs.com/v2/resources/recipes/digital-products/examples/standard",
href: "https://docs.medusajs.com/resources/recipes/digital-products/examples/standard",
icon: ImageBinaryIcon,
},
]
Expand All @@ -63,7 +63,7 @@ const HomepageRecipesSection = () => {
</span>
</div>
<Link
href={"https://docs.medusajs.com/v2/resources/recipes"}
href={"https://docs.medusajs.com/resources/recipes"}
className="flex gap-0.25 items-center text-compact-small-plus"
withIcon
>
Expand Down
84 changes: 32 additions & 52 deletions www/apps/book/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ const withMDX = mdx({
projectUrls: {
resources: {
url: process.env.NEXT_PUBLIC_RESOURCES_URL,
path: "v2/resources",
path: "resources",
},
"user-guide": {
url: process.env.NEXT_PUBLIC_RESOURCES_URL,
path: "v2/user-guide",
path: "user-guide",
},
ui: {
url: process.env.NEXT_PUBLIC_RESOURCES_URL,
path: "ui",
},
api: {
url: process.env.NEXT_PUBLIC_RESOURCES_URL,
path: "v2/api",
path: "api",
},
},
useBaseUrl:
Expand Down Expand Up @@ -81,29 +81,49 @@ const nextConfig = {
pageExtensions: ["js", "jsx", "mdx", "ts", "tsx"],

transpilePackages: ["docs-ui"],
basePath: process.env.NEXT_PUBLIC_BASE_PATH || "/v2",
async rewrites() {
return {
fallback: [
{
source: "/v2/resources",
source: "/resources",
destination: `${
process.env.NEXT_PUBLIC_RESOURCES_URL || "https://localhost:3001"
}/v2/resources`,
}/resources`,
basePath: false,
},
{
source: "/v2/resources/:path*",
source: "/resources/:path*",
destination: `${
process.env.NEXT_PUBLIC_RESOURCES_URL || "https://localhost:3001"
}/v2/resources/:path*`,
}/resources/:path*`,
basePath: false,
},
{
source: "/v2/api/:path*",
source: "/api",
destination: `${
process.env.NEXT_PUBLIC_API_URL || "https://localhost:3001"
}/v2/api/:path*`,
}/api`,
basePath: false,
},
{
source: "/api/:path*",
destination: `${
process.env.NEXT_PUBLIC_API_URL || "https://localhost:3001"
}/api/:path*`,
basePath: false,
},
{
source: "/v1",
destination: `${
process.env.NEXT_PUBLIC_DOCS_V1_URL || "https://localhost:3001"
}/v1`,
basePath: false,
},
{
source: "/v1/:path*",
destination: `${
process.env.NEXT_PUBLIC_DOCS_V1_URL || "https://localhost:3001"
}/v1/:path*`,
basePath: false,
},
// TODO comment out once we have the user guide published
Expand All @@ -123,48 +143,8 @@ const nextConfig = {
async redirects() {
return [
{
source: "/advanced-development/:path*",
destination: "/learn/advanced-development/:path*",
permanent: true,
},
{
source: "/basics/:path*",
destination: "/learn/basics/:path*",
permanent: true,
},
{
source: "/customization/:path*",
destination: "/learn/customization/:path*",
permanent: true,
},
{
source: "/debugging-and-testing/:path*",
destination: "/learn/debugging-and-testing/:path*",
permanent: true,
},
{
source: "/deployment/:path*",
destination: "/learn/deployment/:path*",
permanent: true,
},
{
source: "/first-customizations/:path*",
destination: "/learn/first-customizations/:path*",
permanent: true,
},
{
source: "/more-resources/:path*",
destination: "/learn/more-resources/:path*",
permanent: true,
},
{
source: "/storefront-development/:path*",
destination: "/learn/storefront-development/:path*",
permanent: true,
},
{
source: "/more-resources/examples",
destination: "/resources/examples",
source: "/v2/:path*",
destination: "/:path*",
permanent: true,
},
]
Expand Down
2 changes: 1 addition & 1 deletion www/apps/book/providers/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const SearchProvider = ({ children }: SearchProviderProps) => {
},
],
checkInternalPattern: new RegExp(
`^${config.baseUrl}/v2/([^(resources)])*`
`^${config.baseUrl}/([^(resources)])*`
),
filterOptions: searchFilters,
}}
Expand Down
Loading
Loading