docs: add routing page (#9550)

- Add a new homepage to `book` project for the routing page
- Move all main doc pages to be under `/v2/learn` (and added redirects + fixed links across docs)
- Other: add admin components to resources dropdown + fixes to search on mobile.

Closes DX-955

Preview: https://docs-v2-git-docs-router-page-medusajs.vercel.app/v2
This commit is contained in:
Shahed Nasser authored and GitHub committed 2024-10-18 08:24:34 +00:00
1 parent 7a47f5211d
commit 0a37675f0e
223 files changed
+2549 -696

No files matched your search

@@ -175,7 +175,7 @@ You create the `CreateForm` component. For now, it uses `useForm` from `react-ho
You also define a `handleSubmit` function to perform an action when the form is submitted.
You can replace the content of the function with sending a request to Medusa's routes. Refer to [this guide](!docs!/advanced-development/admin/tips#send-requests-to-api-routes) for more details on how to do that.
You can replace the content of the function with sending a request to Medusa's routes. Refer to [this guide](!docs!/learn/advanced-development/admin/tips#send-requests-to-api-routes) for more details on how to do that.
### Render Components
@@ -454,7 +454,7 @@ You create the `EditForm` component. For now, it uses `useForm` from `react-hook
You also define a `handleSubmit` function to perform an action when the form is submitted.
You can replace the content of the function with sending a request to Medusa's routes. Refer to [this guide](!docs!/advanced-development/admin/tips#send-requests-to-api-routes) for more details on how to do that.
You can replace the content of the function with sending a request to Medusa's routes. Refer to [this guide](!docs!/learn/advanced-development/admin/tips#send-requests-to-api-routes) for more details on how to do that.
### Render Components
@@ -12,7 +12,7 @@ Before creating an actor type, you must have a module with a data model represen
<Note title="Tip">
Learn how to create a module in [this guide](!docs!/basics/modules).
Learn how to create a module in [this guide](!docs!/learn/basics/modules).
</Note>
@@ -22,7 +22,7 @@ Consider you have a Hello Module defined in the `/src/modules/hello` directory.
<Note title="Tip">
If you don't have a module, follow [this guide](!docs!/basics/modules) to create one.
If you don't have a module, follow [this guide](!docs!/learn/basics/modules) to create one.
</Note>
@@ -43,7 +43,7 @@ This creates a `Custom` data model that has the `id` and `custom_name` propertie
<Note title="Tip">
Learn more about data models in [this guide](!docs!/data-models).
Learn more about data models in [this guide](!docs!/learn/data-models).
</Note>
@@ -55,7 +55,7 @@ Next, you'll define a module link between the `Custom` and `Cart` data model. A
<Note title="Tip">
Learn more about module links in [this guide](!docs!/module-links).
Learn more about module links in [this guide](!docs!/learn/module-links).
</Note>
@@ -82,7 +82,7 @@ This defines a link between the `Cart` and `Custom` data models. Using this link
items={[
{
text: "Module must be registered in medusa-config.ts",
link: "!docs!/basics/modules#4-add-module-to-configurations"
link: "!docs!/learn/basics/modules#4-add-module-to-configurations"
}
]}
/>
@@ -115,7 +115,7 @@ To do that, you'll consume the [cartCreated](/references/medusa-workflows/create
<Note title="Tip">
Learn more about workflow hooks in [this guide](!docs!/advanced-development/workflows/workflow-hooks).
Learn more about workflow hooks in [this guide](!docs!/learn/advanced-development/workflows/workflow-hooks).
</Note>
@@ -150,7 +150,7 @@ In the snippet above, you add a validation rule indicating that `custom_name` is
<Note title="Tip">
Learn more about additional data validation in [this guide](!docs!/advanced-development/api-routes/additional-data).
Learn more about additional data validation in [this guide](!docs!/learn/advanced-development/api-routes/additional-data).
</Note>
@@ -202,7 +202,7 @@ In the compensation function that undoes the step's actions in case of an error,
<Note title="Tip">
Learn more about compensation functions in [this guide](!docs!/advanced-development/workflows/compensation-function).
Learn more about compensation functions in [this guide](!docs!/learn/advanced-development/workflows/compensation-function).
</Note>
@@ -260,9 +260,9 @@ The workflow accepts as an input the created cart and the `additional_data` para
In the workflow, you:
1. Use the `transform` utility to get the value of `custom_name` based on whether it's set in `additional_data`. Learn more about why you can't use conditional operators in a workflow without using `transform` in [this guide](!docs!/advanced-development/workflows/conditions#why-if-conditions-arent-allowed-in-workflows).
1. Use the `transform` utility to get the value of `custom_name` based on whether it's set in `additional_data`. Learn more about why you can't use conditional operators in a workflow without using `transform` in [this guide](!docs!/learn/advanced-development/workflows/conditions#why-if-conditions-arent-allowed-in-workflows).
2. Create the `Custom` record using the `createCustomStep`.
3. Use the `when-then` utility to link the cart to the `Custom` record if it was created. Learn more about why you can't use if-then conditions in a workflow without using `when-then` in [this guide](!docs!/advanced-development/workflows/conditions#why-if-conditions-arent-allowed-in-workflows).
3. Use the `when-then` utility to link the cart to the `Custom` record if it was created. Learn more about why you can't use if-then conditions in a workflow without using `when-then` in [this guide](!docs!/learn/advanced-development/workflows/conditions#why-if-conditions-arent-allowed-in-workflows).
You'll next call the workflow in the hook handler.
@@ -355,7 +355,7 @@ Among the returned `cart` object, you'll find a `custom` property which holds th
### Retrieve using Query
You can also retrieve the `Custom` record linked to a cart in your code using [Query](!docs!/advanced-development/module-links/query).
You can also retrieve the `Custom` record linked to a cart in your code using [Query](!docs!/learn/advanced-development/module-links/query).
For example:
@@ -369,7 +369,7 @@ const { data: [cart] } = await query.graph({
})
```
Learn more about how to use Query in [this guide](!docs!/advanced-development/module-links/query).
Learn more about how to use Query in [this guide](!docs!/learn/advanced-development/module-links/query).
---
@@ -28,7 +28,7 @@ Consider you have a Hello Module defined in the `/src/modules/hello` directory.
<Note title="Tip">
If you don't have a module, follow [this guide](!docs!/basics/modules) to create one.
If you don't have a module, follow [this guide](!docs!/learn/basics/modules) to create one.
</Note>
@@ -49,7 +49,7 @@ This creates a `Custom` data model that has the `id` and `custom_name` propertie
<Note title="Tip">
Learn more about data models in [this guide](!docs!/data-models).
Learn more about data models in [this guide](!docs!/learn/data-models).
</Note>
@@ -61,7 +61,7 @@ Next, you'll define a module link between the `Custom` and `Customer` data model
<Note title="Tip">
Learn more about module links in [this guide](!docs!/module-links).
Learn more about module links in [this guide](!docs!/learn/module-links).
</Note>
@@ -88,7 +88,7 @@ This defines a link between the `Customer` and `Custom` data models. Using this
items={[
{
text: "Module must be registered in medusa-config.ts",
link: "!docs!/basics/modules#4-add-module-to-configurations"
link: "!docs!/learn/basics/modules#4-add-module-to-configurations"
}
]}
/>
@@ -121,7 +121,7 @@ To do that, you'll consume the [customersCreated](/resources/references/medusa-w
<Note title="Tip">
Learn more about workflow hooks in [this guide](!docs!/advanced-development/workflows/workflow-hooks).
Learn more about workflow hooks in [this guide](!docs!/learn/advanced-development/workflows/workflow-hooks).
</Note>
@@ -156,7 +156,7 @@ In the snippet above, you add a validation rule indicating that `custom_name` is
<Note title="Tip">
Learn more about additional data validation in [this guide](!docs!/advanced-development/api-routes/additional-data).
Learn more about additional data validation in [this guide](!docs!/learn/advanced-development/api-routes/additional-data).
</Note>
@@ -208,7 +208,7 @@ In the compensation function that undoes the step's actions in case of an error,
<Note title="Tip">
Learn more about compensation functions in [this guide](!docs!/advanced-development/workflows/compensation-function).
Learn more about compensation functions in [this guide](!docs!/learn/advanced-development/workflows/compensation-function).
</Note>
@@ -266,9 +266,9 @@ The workflow accepts as an input the created customer and the `additional_data`
In the workflow, you:
1. Use the `transform` utility to get the value of `custom_name` based on whether it's set in `additional_data`. Learn more about why you can't use conditional operators in a workflow without using `transform` in [this guide](!docs!/advanced-development/workflows/conditions#why-if-conditions-arent-allowed-in-workflows).
1. Use the `transform` utility to get the value of `custom_name` based on whether it's set in `additional_data`. Learn more about why you can't use conditional operators in a workflow without using `transform` in [this guide](!docs!/learn/advanced-development/workflows/conditions#why-if-conditions-arent-allowed-in-workflows).
2. Create the `Custom` record using the `createCustomStep`.
3. Use the `when-then` utility to link the customer to the `Custom` record if it was created. Learn more about why you can't use if-then conditions in a workflow without using `when-then` in [this guide](!docs!/advanced-development/workflows/conditions#why-if-conditions-arent-allowed-in-workflows).
3. Use the `when-then` utility to link the customer to the `Custom` record if it was created. Learn more about why you can't use if-then conditions in a workflow without using `when-then` in [this guide](!docs!/learn/advanced-development/workflows/conditions#why-if-conditions-arent-allowed-in-workflows).
You'll next execute the workflow in the hook handler.
@@ -367,7 +367,7 @@ Among the returned `customer` object, you'll find a `custom` property which hold
### Retrieve using Query
You can also retrieve the `Custom` record linked to a customer in your code using [Query](!docs!/advanced-development/module-links/query).
You can also retrieve the `Custom` record linked to a customer in your code using [Query](!docs!/learn/advanced-development/module-links/query).
For example:
@@ -381,7 +381,7 @@ const { data: [customer] } = await query.graph({
})
```
Learn more about how to use Query in [this guide](!docs!/advanced-development/module-links/query).
Learn more about how to use Query in [this guide](!docs!/learn/advanced-development/module-links/query).
---
@@ -8,7 +8,7 @@ export const metadata = {
# {metadata.title}
In this document, you'll learn how to retrieve product variant prices in the Medusa application using [Query](!docs!/advanced-development/module-links/query).
In this document, you'll learn how to retrieve product variant prices in the Medusa application using [Query](!docs!/learn/advanced-development/module-links/query).
<Note title="Why use Query?">
+8 -1
View File
@@ -5,11 +5,17 @@
@layer base {
html {
-webkit-font-smoothing: antialiased;
--webkit-font-smoothing: antialiased;
overscroll-behavior-y: none;
}
body {
@apply overflow-x-hidden;
overscroll-behavior-y: none;
}
#main {
overscroll-behavior-y: contain;
}
*::selection {
@@ -22,6 +28,7 @@
aside * {
scrollbar-color: var(--docs-border-base) var(--docs-bg-subtle);
overscroll-behavior-y: contain;
}
body[data-modal="opened"] {
+13 -12
View File
@@ -2,7 +2,7 @@ import type { Metadata } from "next"
import { Inter, Roboto_Mono } from "next/font/google"
import Providers from "@/providers"
import "./globals.css"
import { TightLayout } from "docs-ui"
import { BareboneLayout, TightLayout } from "docs-ui"
import { config } from "@/config"
import clsx from "clsx"
import { Feedback } from "@/components/Feedback"
@@ -37,16 +37,17 @@ export default function RootLayout({
children: React.ReactNode
}) {
return (
<TightLayout
ProvidersComponent={Providers}
sidebarProps={{
expandItems: true,
}}
bodyClassName={clsx(inter.variable, robotoMono.variable)}
feedbackComponent={<Feedback className="my-2" />}
editComponent={<EditButton />}
>
{children}
</TightLayout>
<BareboneLayout htmlClassName={clsx(inter.variable, robotoMono.variable)}>
<TightLayout
sidebarProps={{
expandItems: true,
}}
feedbackComponent={<Feedback className="my-2" />}
editComponent={<EditButton />}
ProvidersComponent={Providers}
>
{children}
</TightLayout>
</BareboneLayout>
)
}
@@ -11,7 +11,7 @@ export const metadata = {
# {metadata.title}
Run a custom CLI script. Learn more about it in [this guide](!docs!/advanced-development/custom-cli-scripts).
Run a custom CLI script. Learn more about it in [this guide](!docs!/learn/advanced-development/custom-cli-scripts).
```bash
npx medusa exec [file] [args...]
+8 -8
View File
@@ -173,13 +173,13 @@ You can create a B2B module that adds necessary data models to represent a B2B c
<CardList items={[
{
href: "!docs!/basics/modules",
href: "!docs!/learn/basics/modules",
title: "Create Module",
text: "Learn how to create a module in Medusa.",
icon: AcademicCapSolid,
},
{
href: "!docs!/basics/modules#1-create-data-model",
href: "!docs!/learn/basics/modules#1-create-data-model",
title: "Create Data Models",
text: "Learn how to create data models.",
icon: AcademicCapSolid,
@@ -187,7 +187,7 @@ You can create a B2B module that adds necessary data models to represent a B2B c
]} />
{/* <Card
href="!docs!/advanced-development/modules/module-relationships"
href="!docs!/learn/advanced-development/modules/module-relationships"
title="Create Module Relationships"
text="Learn how to create a relationship between modules."
icon={AcademicCapSolid}
@@ -573,7 +573,7 @@ To implement a more advanced B2B sales flow, add custom data models such as `Com
This provides more granular control of your B2B sales and allows you to build features like privileges, limits, and more.
<Card
href="!docs!/basics/modules#1-create-data-model"
href="!docs!/learn/basics/modules#1-create-data-model"
title="Create a Data Model"
text="Learn how to create a custom data model in a module."
icon={AcademicCapSolid}
@@ -588,7 +588,7 @@ On the frontend clients communicating with your store, such as the storefront, y
The API route can check if the customer has any group with an associated company.
<Card
href="!docs!/basics/api-routes"
href="!docs!/learn/basics/api-routes"
title="Create an API Route"
text="Learn how to create an API Route in Medusa."
icon={AcademicCapSolid}
@@ -724,19 +724,19 @@ The Medusa Admin plugin can be extended to add widgets, new pages, and setting p
<CardList items={[
{
href: "!docs!/advanced-development/admin/widgets",
href: "!docs!/learn/advanced-development/admin/widgets",
title: "Create Admin Widget",
text: "Learn how to add widgets into existing admin pages.",
icon: AcademicCapSolid,
},
{
href: "!docs!/advanced-development/admin/ui-routes",
href: "!docs!/learn/advanced-development/admin/ui-routes",
title: "Create Admin UI Routes",
text: "Learn how to add new pages to your Medusa Admin.",
icon: AcademicCapSolid,
},
{
href: "!docs!/advanced-development/admin/setting-pages",
href: "!docs!/learn/advanced-development/admin/setting-pages",
title: "Create Admin Setting Page",
text: "Learn how to add new page to the Medusa Admin settings.",
icon: AcademicCapSolid,
@@ -36,13 +36,13 @@ The `inventory-item.updated` event is currently not emitted.
<CardList items={[
{
href: "!docs!/basics/modules",
href: "!docs!/learn/basics/modules",
title: "Create a Module",
text: "Learn how to create a module in Medusa.",
icon: AcademicCapSolid,
},
{
href: "!docs!/basics/modules#1-create-data-model",
href: "!docs!/learn/basics/modules#1-create-data-model",
title: "Create a Data Model",
text: "Learn how to create a data model.",
icon: AcademicCapSolid,
@@ -51,13 +51,13 @@ The `inventory-item.updated` event is currently not emitted.
<CardList items={[
{
href: "!docs!/basics/api-routes",
href: "!docs!/learn/basics/api-routes",
title: "Create an API Route",
text: "Learn how to create an API route in Medusa.",
icon: AcademicCapSolid,
},
{
href: "!docs!/basics/events-and-subscribers",
href: "!docs!/learn/basics/events-and-subscribers",
title: "Create a Subscriber",
text: "Learn how to create a subscriber in Medusa.",
icon: AcademicCapSolid,
@@ -409,7 +409,7 @@ Medusa also provides Notification Module Providers that integrate with third-par
icon: AcademicCapSolid,
},
{
href: "!docs!/basics/events-and-subscribers",
href: "!docs!/learn/basics/events-and-subscribers",
title: "Create Subscriber",
text: "Learn how to create a subscriber to handle events.",
icon: AcademicCapSolid,
@@ -428,7 +428,7 @@ To implement that:
- Create a scheduled job that executes the workflow automatically at the specified time pattern.
<Card
href="!docs!/basics/scheduled-jobs"
href="!docs!/learn/basics/scheduled-jobs"
title="Create a Scheduled Job"
text="Learn how to create a scheduled job in Medusa."
icon={AcademicCapSolid}
@@ -654,7 +654,7 @@ The `order.placed` event is currently not emitted.
</Note>
<Card
href="!docs!/basics/events-and-subscribers"
href="!docs!/learn/basics/events-and-subscribers"
title="Create a Subscriber"
text="Learn how to create a subscriber in Medusa."
icon={AcademicCapSolid}
@@ -662,7 +662,7 @@ The `order.placed` event is currently not emitted.
{/* <CardList items={[
{
href: "!docs!/basics/events-and-subscribers",
href: "!docs!/learn/basics/events-and-subscribers",
title: "Create a Subscriber",
text: "Learn how to create a subscriber in Medusa.",
icon: AcademicCapSolid,
@@ -695,7 +695,7 @@ Medusa's commerce features are geared towards automating RMA flows and ensuring
icon: AcademicCapSolid,
},
{
href: "!docs!/basics/events-and-subscribers",
href: "!docs!/learn/basics/events-and-subscribers",
title: "Create a Subscriber",
text: "Learn how to create a subscriber in Medusa.",
icon: AcademicCapSolid,
@@ -738,7 +738,7 @@ The `order.placed` event is currently not emitted.
icon: AcademicCapSolid,
},
{
href: "!docs!/basics/events-and-subscribers",
href: "!docs!/learn/basics/events-and-subscribers",
title: "Create a Subscriber",
text: "Learn how to create a subscriber in Medusa.",
icon: AcademicCapSolid,
@@ -840,13 +840,13 @@ You can also create a scheduled job that checks whether the number of new produc
<CardList items={[
{
href: "!docs!/basics/events-and-subscribers",
href: "!docs!/learn/basics/events-and-subscribers",
title: "Create a Subscriber",
text: "Learn how to create a subscriber in Medusa.",
icon: AcademicCapSolid,
},
{
href: "!docs!/basics/scheduled-jobs",
href: "!docs!/learn/basics/scheduled-jobs",
title: "Scheduled Jobs",
text: "Learn how to create a scheduled job in Medusa.",
icon: AcademicCapSolid,
@@ -170,7 +170,7 @@ class DigitalProductModuleService extends MedusaService({
export default DigitalProductModuleService
```
The service extends the [service factory](!docs!/advanced-development/modules/service-factory), which provides basic data-management features.
The service extends the [service factory](!docs!/learn/advanced-development/modules/service-factory), which provides basic data-management features.
### Create Module Definition
@@ -204,8 +204,8 @@ module.exports = defineConfig({
### Further Reads
- [How to Create a Module](!docs!/basics/modules)
- [How to Create a Data Model](!docs!/basics/modules#1-create-data-model)
- [How to Create a Module](!docs!/learn/basics/modules)
- [How to Create a Data Model](!docs!/learn/basics/modules#1-create-data-model)
---
@@ -255,7 +255,7 @@ This defines a link between `DigitalProductOrder` and the Order Module’s `Orde
### Further Read
- [How to Define Module Links](!docs!/advanced-development/module-links)
- [How to Define Module Links](!docs!/learn/advanced-development/module-links)
---
@@ -361,8 +361,8 @@ Make sure to replace `{token}` with the JWT token you retrieved.
### Further Reads
- [How to Create an API Route](!docs!/basics/api-routes)
- [Learn more about Query](!docs!/advanced-development/module-links/query)
- [How to Create an API Route](!docs!/learn/basics/api-routes)
- [Learn more about Query](!docs!/learn/advanced-development/module-links/query)
---
@@ -609,9 +609,9 @@ You’ll test out the workflow in the next section.
### Further Reads
- [How to Create a Workflow](!docs!/basics/workflows)
- [What is the Compensation Function](!docs!/advanced-development/workflows/compensation-function)
- [Learn more about the remote link function](!docs!/advanced-development/module-links/remote-link)
- [How to Create a Workflow](!docs!/learn/basics/workflows)
- [What is the Compensation Function](!docs!/learn/advanced-development/workflows/compensation-function)
- [Learn more about the remote link function](!docs!/learn/advanced-development/module-links/remote-link)
---
@@ -710,7 +710,7 @@ This adds a validation middleware to ensure that the body of `POST` requests sen
### Further Read
- [How to Create a Middleware](!docs!/advanced-development/api-routes/middlewares)
- [How to Create a Middleware](!docs!/learn/advanced-development/api-routes/middlewares)
---
@@ -1043,8 +1043,8 @@ Once you log in, you’ll find a new sidebar item, “Digital Products.” If yo
### Further Reads
- [How to Create UI Routes](!docs!/advanced-development/admin/ui-routes)
- [How to Create Admin Widgets](!docs!/advanced-development/admin/widgets)
- [How to Create UI Routes](!docs!/learn/advanced-development/admin/ui-routes)
- [How to Create Admin Widgets](!docs!/learn/advanced-development/admin/widgets)
---
@@ -1813,7 +1813,7 @@ In a later step, you’ll add an API route to allow customers to view and downlo
### Further Read
- [Conditions in Workflows with When-Then](!docs!/advanced-development/workflows/conditions)
- [Conditions in Workflows with When-Then](!docs!/learn/advanced-development/workflows/conditions)
---
@@ -2295,7 +2295,7 @@ You’ll test out these API routes in the next step.
### Further Reads
- [What are protected API routes](!docs!/advanced-development/api-routes/protected-routes)
- [What are protected API routes](!docs!/learn/advanced-development/api-routes/protected-routes)
---
@@ -2722,4 +2722,4 @@ Aside from customizing the Next.js Starter storefront, you can also create a cus
### Admin Development
In this recipe, you learned how to customize the admin with UI routes. You can also do further customization using widgets. Learn more in [this documentation](!docs!/advanced-development/admin).
In this recipe, you learned how to customize the admin with UI routes. You can also do further customization using widgets. Learn more in [this documentation](!docs!/learn/advanced-development/admin).
@@ -49,7 +49,7 @@ Your custom features and functionalities are implemented inside modules. The mod
The module will hold your custom data models and the service implementing digital-product-related features.
<Card
href="!docs!/basics/modules"
href="!docs!/learn/basics/modules"
title="How to Create a Module"
text="Learn how to create a module."
icon={AcademicCapSolid}
@@ -63,13 +63,13 @@ Then, you can link your custom data model to data models from other modules. For
<CardList itemsPerRow={2} items={[
{
href: "!docs!/basics/modules#1-create-data-model",
href: "!docs!/learn/basics/modules#1-create-data-model",
title: "How to Create a Data Model",
text: "Learn how to create a data model.",
icon: AcademicCapSolid,
},
{
href: "!docs!/advanced-development/module-links",
href: "!docs!/learn/advanced-development/module-links",
title: "Module Links",
text: "Learn how to link data models of different modules.",
icon: AcademicCapSolid,
@@ -83,7 +83,7 @@ Your module’s main service holds data-management and other related features. T
Medusa facilitates implementing data-management features using the service factory. Your module's main service can extend this service factory, and it generates data-management methods for your data models.
<Card
href="!docs!/advanced-development/modules/service-factory"
href="!docs!/learn/advanced-development/modules/service-factory"
title="Service Factory"
text="Learn about the service factory and how to use it."
icon={AcademicCapSolid}
@@ -98,7 +98,7 @@ API routes expose your features to external applications, such as the admin dash
You can create custom API routes that allow merchants to list and create digital products. In these API routes, you resolve the Digital Product Module’s main service to use its data-management features.
<Card
href="!docs!/basics/api-routes"
href="!docs!/learn/basics/api-routes"
title="API Routes"
text="Learn how to create an API route."
icon={AcademicCapSolid}
@@ -113,7 +113,7 @@ Your use case most likely has flows, such as creating digital products, that req
Create workflows to implement these flows, then utilize these workflows in other resources, such as an API route.
<Card
href="!docs!/basics/workflows"
href="!docs!/learn/basics/workflows"
title="Workflows"
text="Learn how to create a workflow."
icon={AcademicCapSolid}
@@ -129,13 +129,13 @@ Use the remote link to create a link between two records, and use Query to fetch
<CardList itemsPerRow={2} items={[
{
href: "!docs!/advanced-development/module-links/remote-link",
href: "!docs!/learn/advanced-development/module-links/remote-link",
title: "How to Use the Remote Link",
text: "Learn how to link data models of different modules.",
icon: AcademicCapSolid,
},
{
href: "!docs!/advanced-development/module-links/query",
href: "!docs!/learn/advanced-development/module-links/query",
title: "How to Use Query",
text: "Learn how to fetch data across modules with Medusa's Query.",
icon: AcademicCapSolid,
@@ -152,13 +152,13 @@ In your customizations, you send requests to the API routes you created to creat
<CardList items={[
{
href: "!docs!/advanced-development/admin/widgets",
href: "!docs!/learn/advanced-development/admin/widgets",
title: "Create a Widget",
text: "Learn how to create a widget in the Medusa Admin.",
icon: AcademicCapSolid,
},
{
href: "!docs!/advanced-development/admin/ui-routes",
href: "!docs!/learn/advanced-development/admin/ui-routes",
title: "Create UI Route",
text: "Learn how to create a UI route in the Medusa Admin.",
icon: AcademicCapSolid,
@@ -28,7 +28,7 @@ To integrate an external system, such as an ERP, into your Medusa application, c
Then, resolve the module's main service in other resources, such as API routes or workflows, to perform actions in the external system.
<Card
href="!docs!/basics/modules"
href="!docs!/learn/basics/modules"
title="Create a Module"
text="Learn how to create a module in Medusa."
icon={AcademicCapSolid}
@@ -101,7 +101,7 @@ export const serviceHighlights = [
<Note title="Tip">
You can store the product's ID in the external system using the `metadata` property of the `Product` data model in the Product Module. Alternatively, you can create a [data model](!docs!/basics/modules#1-create-data-model) in your module to store data related to the external system.
You can store the product's ID in the external system using the `metadata` property of the `Product` data model in the Product Module. Alternatively, you can create a [data model](!docs!/learn/basics/modules#1-create-data-model) in your module to store data related to the external system.
</Note>
@@ -150,7 +150,7 @@ Workflows can be executed from anywhere. So, taking the workflow described above
Workflows guarantee data consistency through their compensation feature. You can provide a compensation function to steps that roll back the actions of that step. Then, if an error occurs in any step, the actions of previous steps are rolled back using their compensation function.
<Card
href="!docs!/basics/workflows"
href="!docs!/learn/basics/workflows"
title="Workflows"
text="Learn more about Workflows and how to create them."
icon={AcademicCapSolid}
@@ -295,7 +295,7 @@ You can provide webhook listeners that your external systems call when their dat
For example, suppose an administrator changes the product data in the ERP system. The system then sends a request to the webhook you define in your Medusa application, which updates the product data in the application.
<Card
href="!docs!/basics/api-routes"
href="!docs!/learn/basics/api-routes"
title="Create an API Route"
text="Learn how to create an API Route in Medusa."
icon={AcademicCapSolid}
@@ -136,7 +136,7 @@ class RestaurantModuleService extends MedusaService({
export default RestaurantModuleService
```
The service extends the [service factory](!docs!/advanced-development/modules/service-factory), which provides basic data-management features.
The service extends the [service factory](!docs!/learn/advanced-development/modules/service-factory), which provides basic data-management features.
### Create Restaurant Module Definition
@@ -170,8 +170,8 @@ module.exports = defineConfig({
### Further Reads
- [How to Create a Module](!docs!/basics/modules)
- [How to Create a Data Model](!docs!/basics/modules#1-create-data-model)
- [How to Create a Module](!docs!/learn/basics/modules)
- [How to Create a Data Model](!docs!/learn/basics/modules#1-create-data-model)
---
@@ -280,7 +280,7 @@ class DeliveryModuleService extends MedusaService({
export default DeliveryModuleService
```
The service extends the [service factory](!docs!/advanced-development/modules/service-factory), which provides basic data-management features.
The service extends the [service factory](!docs!/learn/advanced-development/modules/service-factory), which provides basic data-management features.
### Create Delivery Module Definition
@@ -400,7 +400,7 @@ This defines a link between the Delivery Module’s `delivery` data model and th
### Further Reads
- [How to Define Links](!docs!/advanced-development/module-links)
- [How to Define Links](!docs!/learn/advanced-development/module-links)
---
@@ -608,15 +608,15 @@ The API route creates a restaurant and returns it.
<Note>
If you’re calling this API route from a frontend client, make sure to set the [CORS middleware](!docs!/advanced-development/api-routes/cors) on it since it’s not under the `/store` or `/admin` route prefixes.
If you’re calling this API route from a frontend client, make sure to set the [CORS middleware](!docs!/learn/advanced-development/api-routes/cors) on it since it’s not under the `/store` or `/admin` route prefixes.
</Note>
### Further Reads
- [How to Create a Workflow](!docs!/basics/workflows)
- [What is a Compensation Function](!docs!/advanced-development/workflows/compensation-function)
- [How to Create an API route](!docs!/basics/api-routes)
- [How to Create a Workflow](!docs!/learn/basics/workflows)
- [What is a Compensation Function](!docs!/learn/advanced-development/workflows/compensation-function)
- [How to Create an API route](!docs!/learn/basics/api-routes)
---
@@ -687,7 +687,7 @@ This returns the list of restaurants in the response.
### Further Reads
- [What is and how to use it](!docs!/advanced-development/module-links/query)
- [What is and how to use it](!docs!/learn/advanced-development/module-links/query)
- [How to Retrieve Prices for Product Variants](../../../../commerce-modules/product/guides/price/page.mdx)
---
@@ -1542,7 +1542,7 @@ In this step, you’ll create the workflow that handles the different stages of
For example, when a restaurant finishes preparing the order’s items, this workflow creates a fulfillment for the order.
This workflow will be a [long-running workflow](!docs!/advanced-development/workflows/long-running-workflow) that runs asynchronously in the background. Its async steps only succeed once an outside action sets its status, allowing the workflow to move to the next step.
This workflow will be a [long-running workflow](!docs!/learn/advanced-development/workflows/long-running-workflow) that runs asynchronously in the background. Its async steps only succeed once an outside action sets its status, allowing the workflow to move to the next step.
API routes that perform actions related to the delivery, which you’ll create later, will trigger the workflow to move to the next step.
@@ -2063,7 +2063,7 @@ In the next steps, you’ll execute the workflow and see it in action as you add
### Further Reads
- [Long-Running Workflows](!docs!/advanced-development/workflows/long-running-workflow)
- [Long-Running Workflows](!docs!/learn/advanced-development/workflows/long-running-workflow)
---
@@ -3459,7 +3459,7 @@ The next steps of this example depend on your use case. This section provides so
### Admin Development
The Medusa Admin is extendable, allowing you to add widgets to existing pages or create new pages. Learn more about it in [this documentation](!docs!/advanced-development/admin).
The Medusa Admin is extendable, allowing you to add widgets to existing pages or create new pages. Learn more about it in [this documentation](!docs!/learn/advanced-development/admin).
### Storefront Development
@@ -116,7 +116,7 @@ class MarketplaceModuleService extends MedusaService({
export default MarketplaceModuleService
```
The service extends the [service factory](!docs!/advanced-development/modules/service-factory), which provides basic data-management features.
The service extends the [service factory](!docs!/learn/advanced-development/modules/service-factory), which provides basic data-management features.
### Create Module Definition
@@ -150,8 +150,8 @@ module.exports = defineConfig({
### Further Reads
- [How to Create a Module](!docs!/basics/modules)
- [How to Create Data Models](!docs!/basics/modules#1-create-data-model)
- [How to Create a Module](!docs!/learn/basics/modules)
- [How to Create Data Models](!docs!/learn/basics/modules#1-create-data-model)
---
@@ -203,7 +203,7 @@ This adds a list link between the `Vendor` and `Order` data models, indicating t
### Further Read
- [How to Define Module Links](!docs!/advanced-development/module-links)
- [How to Define Module Links](!docs!/learn/advanced-development/module-links)
---
@@ -338,10 +338,10 @@ You return the created vendor admin.
### Further Read
- [How to Create a Workflow](!docs!/basics/workflows)
- [How to Create a Workflow](!docs!/learn/basics/workflows)
- [What is an Actor Type](../../../../commerce-modules/auth/auth-identity-and-actor-types/page.mdx)
- [How to Create an Actor Type](../../../../commerce-modules/auth/create-actor-type/page.mdx)
- [What is a Compensation Function](!docs!/advanced-development/workflows/compensation-function)
- [What is a Compensation Function](!docs!/learn/advanced-development/workflows/compensation-function)
---
@@ -513,7 +513,7 @@ This route is available because you created the `vendor` actor type previously.
<Note>
Don't include a trailing slash at the end of the URL. Learn more [here](!docs!/advanced-development/api-routes/middlewares).
Don't include a trailing slash at the end of the URL. Learn more [here](!docs!/learn/advanced-development/api-routes/middlewares).
</Note>
@@ -549,8 +549,8 @@ Use this token in the header of later requests that require authentication.
### Further Reads
- [How to Create an API route](!docs!/basics/api-routes)
- [How to Create a Middleware](!docs!/advanced-development/api-routes/middlewares)
- [How to Create an API route](!docs!/learn/basics/api-routes)
- [How to Create a Middleware](!docs!/learn/advanced-development/api-routes/middlewares)
- [Learn more about the /auth route](../../../../commerce-modules/auth/authentication-route/page.mdx)
---
@@ -778,8 +778,8 @@ curl 'http://localhost:9000/vendors/products' \
### Further Reads
- [How to use Query](!docs!/advanced-development/module-links/query)
- [How to use the Remote Link](!docs!/advanced-development/module-links/remote-link)
- [How to use Query](!docs!/learn/advanced-development/module-links/query)
- [How to use the Remote Link](!docs!/learn/advanced-development/module-links/remote-link)
---
@@ -1361,7 +1361,7 @@ For example, you can link sales channels to vendors or other settings.
<Note>
[Learn more about module links](!docs!/advanced-development/module-links).
[Learn more about module links](!docs!/learn/advanced-development/module-links).
</Note>
@@ -1373,6 +1373,6 @@ You can also create a custom storefront. Check out the [Storefront Development](
### Admin Development
The Medusa Admin is extendable, allowing you to add widgets to existing pages or create new pages. Learn more about it in [this documentation](!docs!/advanced-development/admin).
The Medusa Admin is extendable, allowing you to add widgets to existing pages or create new pages. Learn more about it in [this documentation](!docs!/learn/advanced-development/admin).
If your use case requires bigger customizations to the admin, such as showing different products and orders based on the logged-in vendor, use the [admin API routes](!api!/admin) to build a custom admin.
@@ -35,13 +35,13 @@ You can create a marketplace module that implements data models for vendors, the
<CardList items={[
{
href: "!docs!/basics/modules",
href: "!docs!/learn/basics/modules",
title: "Create a Module",
text: "Learn how to create a module.",
icon: AcademicCapSolid,
},
{
href: "!docs!/basics/modules#1-create-data-model",
href: "!docs!/learn/basics/modules#1-create-data-model",
title: "Create Data Models",
text: "Create data models in the module.",
icon: AcademicCapSolid,
@@ -57,7 +57,7 @@ Since a vendor has products, orders, and other models based on your use case, de
For example, if you defined a vendor data model in a marketplace module, you can define a module link between the vendor and the Product Module's product data model.
<Card
href="!docs!/advanced-development/module-links"
href="!docs!/learn/advanced-development/module-links"
title="Define a Module Link"
text="Learn how to define a module link."
icon={AcademicCapSolid}
@@ -86,13 +86,13 @@ If you provide vendor or sellers with custom features, or a different way of man
<CardList items={[
{
href: "!docs!/basics/api-routes",
href: "!docs!/learn/basics/api-routes",
title: "Create API Routes",
text: "Learn how to create an API Route in Medusa.",
icon: AcademicCapSolid,
},
{
href: "!docs!/advanced-development/api-routes/protected-routes",
href: "!docs!/learn/advanced-development/api-routes/protected-routes",
title: "Protect Routes",
text: "Learn how to guard routes to allow authenticated users only.",
icon: AcademicCapSolid,
@@ -103,12 +103,12 @@ If you provide vendor or sellers with custom features, or a different way of man
## Split Orders Based on Vendors
If your use case allows a customer's orders to have items from different vendors, you can override the [Complete Cart API route](https://docs.medusajs.com/v2/api/store#carts_postcartsidcomplete) to change how the order should be created.
If your use case allows a customer's orders to have items from different vendors, you can override the [Complete Cart API route](!api!/store#carts_postcartsidcomplete) to change how the order should be created.
If your flow requires different steps, such as creating a parent order then creating a child order, create a workflow and execute it from the API route.
<Card
href="!docs!/basics/workflows"
href="!docs!/learn/basics/workflows"
title="Create a Workflow"
text="Learn how to create a workflow in Medusa."
icon={AcademicCapSolid}
@@ -157,7 +157,7 @@ By integrating a third-party Content Management Systems (CMS), you benefit from
To integrate a third-party system, create a custom module whose main service connects to that third-party service.
<Card
href="!docs!/basics/modules"
href="!docs!/learn/basics/modules"
title="Create a Module"
text="Learn how to create a module in Medusa."
icon={AcademicCapSolid}
@@ -52,7 +52,7 @@ Another channel that attracts customer sales is social media. You can create a c
icon: AcademicCapSolid,
},
{
href: "!docs!/basics/modules",
href: "!docs!/learn/basics/modules",
title: "Create a Module",
text: "Learn how to create a module.",
icon: AcademicCapSolid,
@@ -73,13 +73,13 @@ Medusa’s architecture also makes it easier to integrate any third-party servic
<CardList itemsPerRow={2} items={[
{
href: "!docs!/basics/modules",
href: "!docs!/learn/basics/modules",
title: "Create a Module",
text: "Learn how to create a module.",
icon: AcademicCapSolid,
},
{
href: "!docs!/basics/api-routes",
href: "!docs!/learn/basics/api-routes",
title: "Create an API Route",
text: "Learn how to create an API route.",
icon: AcademicCapSolid,
+5 -5
View File
@@ -43,13 +43,13 @@ For example, you can support importing orders into Medusa through a custom API R
icon: AcademicCapSolid,
},
{
href: "!docs!/basics/api-routes",
href: "!docs!/learn/basics/api-routes",
title: "Create API Route",
text: "Learn how to create a custom API Route.",
icon: AcademicCapSolid,
},
{
href: "!docs!/basics/scheduled-jobs",
href: "!docs!/learn/basics/scheduled-jobs",
title: "Create Scheduled Jobs",
text: "Learn how to create a scheduled job.",
icon: AcademicCapSolid,
@@ -82,7 +82,7 @@ Emitting of event `order.fulfillment_created` isn't implemented yet.
icon: AcademicCapSolid,
},
{
href: "!docs!/basics/events-and-subscribers",
href: "!docs!/learn/basics/events-and-subscribers",
title: "Create a Subscriber",
text: "Learn about create a subscriber",
icon: AcademicCapSolid,
@@ -111,7 +111,7 @@ Emitting of event `order.payment_captured` isn't implemented yet.
icon: AcademicCapSolid,
},
{
href: "!docs!/basics/events-and-subscribers",
href: "!docs!/learn/basics/events-and-subscribers",
title: "Create a Subscriber",
text: "Learn about create a subscriber",
icon: AcademicCapSolid,
@@ -179,7 +179,7 @@ Emitting of event `order.return_requested` isn't implemented yet.
icon: AcademicCapSolid,
},
{
href: "!docs!/basics/events-and-subscribers",
href: "!docs!/learn/basics/events-and-subscribers",
title: "Create a Subscriber",
text: "Learn about create a subscriber",
icon: AcademicCapSolid,
@@ -48,13 +48,13 @@ In more complex cases, you can create a custom module that stores and manages th
<CardList items={[
{
href: "!docs!/basics/modules",
href: "!docs!/learn/basics/modules",
title: "Create a Module",
text: "Learn how to create a module.",
icon: AcademicCapSolid,
},
{
href: "!docs!/basics/modules#1-create-data-model",
href: "!docs!/learn/basics/modules#1-create-data-model",
title: "Create a Data Model",
text: "Learn how to create a data model.",
icon: AcademicCapSolid,
@@ -98,13 +98,13 @@ If you store the personalized data using a custom module:
<CardList items={[
{
href: "!docs!/basics/api-routes",
href: "!docs!/learn/basics/api-routes",
title: "Create API Route",
text: "Learn how to create an API route.",
icon: AcademicCapSolid,
},
{
href: "!docs!/basics/events-and-subscribers",
href: "!docs!/learn/basics/events-and-subscribers",
title: "Create a Subscriber",
text: "Learn how to create a subscriber.",
icon: AcademicCapSolid,
+2 -2
View File
@@ -60,7 +60,7 @@ To search through product variants by their barcode, create a custom API Route a
icon: AcademicCapSolid,
},
{
href: "!docs!/basics/api-routes",
href: "!docs!/learn/basics/api-routes",
title: "Create API Route",
text: "Learn how to create an API Route.",
icon: AcademicCapSolid,
@@ -167,7 +167,7 @@ You can also create custom modules to provide features for a better customer exp
icon: AcademicCapSolid,
},
{
href: "!docs!/basics/modules",
href: "!docs!/learn/basics/modules",
title: "Create a Module",
text: "Learn how to create a module.",
icon: AcademicCapSolid,
@@ -168,9 +168,9 @@ module.exports = defineConfig({
### Further Read
- [How to Create a Module](!docs!/basics/modules)
- [How to Create a Data Model](!docs!/basics/modules#1-create-data-model)
- [Learn more about the service factory](!docs!/advanced-development/modules/service-factory).
- [How to Create a Module](!docs!/learn/basics/modules)
- [How to Create a Data Model](!docs!/learn/basics/modules#1-create-data-model)
- [Learn more about the service factory](!docs!/learn/advanced-development/modules/service-factory).
---
@@ -243,7 +243,7 @@ This defines a list link to the `Order` data model since a subscription has mult
### Further Reads
- [How to Define a Link](!docs!/advanced-development/module-links)
- [How to Define a Link](!docs!/learn/advanced-development/module-links)
---
@@ -640,9 +640,9 @@ The workflow returns the created subscription and order.
### Further Reads
- [How to Create a Workflow](!docs!/basics/workflows)
- [Learn more about the compensation function](!docs!/advanced-development/workflows/compensation-function)
- [How to use the Remote Link](!docs!/advanced-development/module-links/remote-link)
- [How to Create a Workflow](!docs!/learn/basics/workflows)
- [Learn more about the compensation function](!docs!/learn/advanced-development/workflows/compensation-function)
- [How to use the Remote Link](!docs!/learn/advanced-development/module-links/remote-link)
---
@@ -954,7 +954,7 @@ npm run dev
### Further Reads
- [How to Create an API Route](!docs!/basics/api-routes)
- [How to Create an API Route](!docs!/learn/basics/api-routes)
---
@@ -1431,7 +1431,7 @@ To view a subscription’s details, click on its ID, which opens the subscriptio
### Further Reads
- [How to Create UI Routes](!docs!/advanced-development/admin/ui-routes)
- [How to Create UI Routes](!docs!/learn/advanced-development/admin/ui-routes)
---
@@ -1983,7 +1983,7 @@ This loops over the returned subscriptions and executes the `createSubscriptionO
### Further Reads
- [How to Create a Scheduled Job](!docs!/basics/scheeduled-jobs)
- [How to Create a Scheduled Job](!docs!/learn/basics/scheeduled-jobs)
---
@@ -33,13 +33,13 @@ You can link the subscription data model to models of other modules, such as the
<CardList items={[
{
href: "!docs!/basics/modules",
href: "!docs!/learn/basics/modules",
title: "Create a Module",
text: "Learn how to create a module.",
icon: AcademicCapSolid,
},
{
href: "!docs!/basics/modules#1-create-data-model",
href: "!docs!/learn/basics/modules#1-create-data-model",
title: "Create a Data Model",
text: "Learn how to create a data model.",
icon: AcademicCapSolid,
@@ -57,7 +57,7 @@ For example, you can link the subscription data model to the Order Module's `Ord
If you want to create subscriptions on the product level, you can link the subscription data model to the Product Module's `Product` data model.
<Card
href="!docs!/advanced-development/module-links"
href="!docs!/learn/advanced-development/module-links"
title="Define a Module Link"
text="Learn how to define a module link."
icon={AcademicCapSolid}
@@ -81,13 +81,13 @@ Implementing the logic depends on your use case, but you'll mainly implement the
<CardList itemsPerRow={2} items={[
{
href: "!docs!/basics/api-routes",
href: "!docs!/learn/basics/api-routes",
title: "Create an API Route",
text: "Learn how to create an API route.",
icon: AcademicCapSolid,
},
{
href: "!docs!/basics/scheduled-jobs",
href: "!docs!/learn/basics/scheduled-jobs",
title: "Create a Scheduled Job",
text: "Learn how to create a scheduled job.",
icon: AcademicCapSolid,
@@ -119,13 +119,13 @@ Extend the Medusa Admin to add widgets to existing pages or add new pages.
<CardList items={[
{
href: "!docs!/advanced-development/admin/widget",
href: "!docs!/learn/advanced-development/admin/widget",
title: "Create Admin Widget",
text: "Learn how to add widgets into existing admin pages.",
icon: AcademicCapSolid,
},
{
href: "!docs!/advanced-development/admin/ui-routes",
href: "!docs!/learn/advanced-development/admin/ui-routes",
title: "Create Admin UI Routes",
text: "Learn how to add new pages to your Medusa Admin.",
icon: AcademicCapSolid,
@@ -48,7 +48,7 @@ The method returns an array of the first `15` records matching the filters.
<Note>
This applies to relations between data models of the same module. To retrieve linked records of different modules, use [Query](!docs!/advanced-development/module-links/query).
This applies to relations between data models of the same module. To retrieve linked records of different modules, use [Query](!docs!/learn/advanced-development/module-links/query).
</Note>
@@ -54,7 +54,7 @@ The method returns an array with two items:
<Note>
This applies to relations between data models of the same module. To retrieve linked records of different modules, use [Query](!docs!/advanced-development/module-links/query).
This applies to relations between data models of the same module. To retrieve linked records of different modules, use [Query](!docs!/learn/advanced-development/module-links/query).
</Note>
@@ -30,7 +30,7 @@ The method returns the record as an object.
<Note>
This applies to relations between data models of the same module. To retrieve linked records of different modules, use [Query](!docs!/advanced-development/module-links/query).
This applies to relations between data models of the same module. To retrieve linked records of different modules, use [Query](!docs!/learn/advanced-development/module-links/query).
</Note>
@@ -10,7 +10,7 @@ This section of the documentation provides a reference of the methods generated
<Note title="Tip">
Learn more about the service factory in [this documentation](!docs!/advanced-development/modules/service-factory).
Learn more about the service factory in [this documentation](!docs!/learn/advanced-development/modules/service-factory).
</Note>
@@ -41,7 +41,7 @@ fetch(`http://localhost:9000/store/products/${id}?${queryParams.toString()}`, {
})
```
You pass the selected region's ID and the code of its first country as query parameters to the [Get Product API route](https://docs.medusajs.com/v2/api/store#products_getproductsid).
You pass the selected region's ID and the code of its first country as query parameters to the [Get Product API route](!api!/store#products_getproductsid).
<Note title="Tip">
@@ -248,6 +248,6 @@ export default function Product({ params: { id } }: Params) {
In this example, you:
- Pass the selected region's ID and the code of its first country as query parameters to the [Get Product API route](https://docs.medusajs.com/v2/api/store#products_getproductsid).
- Pass the selected region's ID and the code of its first country as query parameters to the [Get Product API route](!api!/store#products_getproductsid).
- You can instead allow the customer to choose their country.
- Display the selected variant's price by formatting its price's `calculated_amount_with_tax` property.
@@ -18,7 +18,7 @@ Refer to the [Admin Widget Injection Zones list](../../../admin-widget-injection
Widget and UI routes must be defined as arrow functions. Any other type of declaration isn't accepted.
Refer to the [Admin Development Constraints](!docs!/advanced-development/admin/constraints) documentation for more details.
Refer to the [Admin Development Constraints](!docs!/learn/advanced-development/admin/constraints) documentation for more details.
---
@@ -34,7 +34,7 @@ export const config = defineWidgetConfig({
Any other usage leads to the widget not being shown.
Refer to the [Admin Development Constraints](!docs!/advanced-development/admin/constraints) documentation for more details.
Refer to the [Admin Development Constraints](!docs!/learn/advanced-development/admin/constraints) documentation for more details.
---