docs: prepare configuration (#7877)

* update configuration

* resolve todos + remove events guides

* disable v2 docs in v1 navbar

* remove v2 from v1 mobile sidebar

* resolve build errors

* fix build errors

* fix lint errors

* fix lint
This commit is contained in:
Shahed Nasser
2024-07-03 19:27:13 +03:00
committed by GitHub
parent 012a624ee4
commit 6713d76db3
57 changed files with 2626 additions and 2906 deletions
@@ -41,6 +41,7 @@ const Navbar = () => {
}}
additionalActionsBefore={<VersionSwitcher />}
additionalActionsAfter={<FeedbackModal />}
showSearchOpener
isLoading={isLoading}
/>
)
+1
View File
@@ -12,6 +12,7 @@ const nextConfig = {
destination: `${
process.env.NEXT_PUBLIC_DOCS_URL || "https://localhost:3001"
}/:path*`,
basePath: false,
},
],
}
@@ -53,7 +53,7 @@ import { model } from "@medusajs/utils"
const MyCustom = model.define("my_custom", {
id: model.id().primaryKey(),
name: model.text(),
age: model.number()
age: model.number(),
}).indexes([
{
on: ["name", "age"],
@@ -82,13 +82,13 @@ import { model } from "@medusajs/utils"
const MyCustom = model.define("my_custom", {
id: model.id().primaryKey(),
name: model.text(),
age: model.number()
age: model.number(),
}).indexes([
{
on: ["name", "age"],
where: {
age: 30
}
age: 30,
},
},
])
@@ -111,15 +111,15 @@ import { model } from "@medusajs/utils"
const MyCustom = model.define("my_custom", {
id: model.id().primaryKey(),
name: model.text(),
age: model.number().nullable()
age: model.number().nullable(),
}).indexes([
{
on: ["name", "age"],
where: {
age: {
$ne: null
}
}
$ne: null,
},
},
},
])
@@ -146,11 +146,11 @@ import { model } from "@medusajs/utils"
const MyCustom = model.define("my_custom", {
id: model.id().primaryKey(),
name: model.text(),
age: model.number()
age: model.number(),
}).indexes([
{
on: ["name", "age"],
unique: true
unique: true,
},
])
@@ -41,25 +41,6 @@ A subscriber file must export:
The above subscriber listens to the `product.created` event. Whenever the event is emitted, it logs in the terminal `A product is created`.
{/* TODO add when we have the admin dashboard to use with V2 for easy testing. */}
{/\* ### Test Subscriber
To test the subscriber, start the Medusa application:
```bash npm2yarn
npm run dev
```
Then, create a product using the Medusa Admin dashboard. Afterward, youll see the following messages logged in the terminal:
```bash
info: Processing product.created which has 1 subscribers
A product is created
```
The first message indicates that the `product.created` event was emitted, and the second one is the message logged from the subscriber. \*/}
---
## When to Use Subscribers
@@ -31,6 +31,7 @@ const Navbar = () => {
mobileSidebarOpen,
}}
isLoading={false}
showSearchOpener
/>
)
}
+8 -1
View File
@@ -108,6 +108,13 @@ const nextConfig = {
}/v2/resources/:path*`,
basePath: false,
},
{
source: "/v2/api/:path*",
destination: `${
process.env.NEXT_PUBLIC_API_URL || "https://localhost:3001"
}/v2/api/:path*`,
basePath: false,
},
// TODO comment out once we have the user guide published
// {
// source: "/user-guide",
@@ -122,7 +129,7 @@ const nextConfig = {
{
source: "/:path*",
destination: `${
process.env.NEXT_PUBLIC_DOCS_V1_URL || "https://localhost:3000"
process.env.NEXT_PUBLIC_API_V1_URL || "https://localhost:3001"
}/:path*`,
basePath: false,
},
@@ -91,6 +91,4 @@ The `create` method accepts an object or an array of objects having the followin
sectionTitle="Use the Create Method"
/>
{/* TODO add once reference for type once generated */}
{/* For a full list of properties accepted, refer to [this guide](/references/notification-provider-module#create). */}
For a full list of properties accepted, refer to [this guide](/references/notification-provider-module#create).
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -37,11 +37,11 @@ Then, resolve the module's main service in other resources, such as API routes o
<Details summaryContent="Example: Create a module integrating an ERP system">
This example showcases how to create a module that integrates to a dummy ERP system.
This example showcases how to create a module that integrates to a dummy ERP system.
Start by creating the directory `src/modules/erp` for your module.
Start by creating the directory `src/modules/erp` for your module.
Then, create the file `src/modules/erp/service.ts` with the following content:
Then, create the file `src/modules/erp/service.ts` with the following content:
export const serviceHighlights = [
["4", "ErpModuleOptions", "The module's expected options."],
@@ -56,12 +56,12 @@ export const serviceHighlights = [
import axios, { AxiosInstance } from "axios"
import { ProductDTO } from "@medusajs/types"
type ErpModuleOptions = {
apiKey: string
}
type ErpModuleOptions = {
apiKey: string
}
class ErpModuleService {
private client\_: AxiosInstance
class ErpModuleService {
private client_: AxiosInstance
constructor({}, { apiKey }: ErpModuleOptions) {
this.client_ = axios.create({
@@ -87,52 +87,51 @@ private client\_: AxiosInstance
async deleteProduct(id: string) {
await this.client_.delete(`/product/${id}`)
}
}
}
export default ErpModuleService
export default ErpModuleService
```
````
This creates the module's main service. Few things to note:
This creates the module's main service. Few things to note:
- The module accepts an `apiKey` option, used to authenticate to the dummy ERP system. The module's main service accesses this option in the second parameter of the constructor.
- The module uses axios to create a client in the constructor. The client is used in the service's methods when connecting to the ERP system. If the system you're integrating has an SDK, you can initialize it in the constructor, instead.
- The `getProductData` method retrieves a product's details from the ERP system by sending a `GET` request using the client.
- The `createProduct` method creates a product in the ERP system by sending a `POST` request using the client.
- The `deleteProduct` method deletes a product in the ERP system by sending a `DELETE` request using the client.
- The module accepts an `apiKey` option, used to authenticate to the dummy ERP system. The module's main service accesses this option in the second parameter of the constructor.
- The module uses axios to create a client in the constructor. The client is used in the service's methods when connecting to the ERP system. If the system you're integrating has an SDK, you can initialize it in the constructor, instead.
- The `getProductData` method retrieves a product's details from the ERP system by sending a `GET` request using the client.
- The `createProduct` method creates a product in the ERP system by sending a `POST` request using the client.
- The `deleteProduct` method deletes a product in the ERP system by sending a `DELETE` request using the client.
<Note title="Tip">
<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/data-models) 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!/basics/data-models) in your module to store data related to the external system.
</Note>
</Note>
Then, create the module's definition file at `src/modules/erp/index.ts` with the following content:
Then, create the module's definition file at `src/modules/erp/index.ts` with the following content:
```ts title="src/modules/erp/index.ts"
import ErpModuleService from "./service"
```ts title="src/modules/erp/index.ts"
import ErpModuleService from "./service"
export default {
service: ErpModuleService,
}
````
export default {
service: ErpModuleService,
}
````
Finally, add the module to the `modules` object in `medusa-config.js`:
Finally, add the module to the `modules` object in `medusa-config.js`:
```js title="medusa-config.js" highlights={[["7", "ERP_API_KEY", "The environment variable holding the API key of the ERP system."]]}
module.exports = defineConfig({
// ...
modules: {
erpModuleService: {
resolve: "./modules/erp",
options: {
apiKey: process.env.ERP_API_KEY,
```js title="medusa-config.js" highlights={[["7", "ERP_API_KEY", "The environment variable holding the API key of the ERP system."]]}
module.exports = defineConfig({
// ...
modules: {
erpModuleService: {
resolve: "./modules/erp",
options: {
apiKey: process.env.ERP_API_KEY,
},
},
},
},
})
```
})
```
</Details>
File diff suppressed because it is too large Load Diff
@@ -30,6 +30,7 @@ const Navbar = () => {
mobileSidebarOpen,
}}
isLoading={false}
showSearchOpener
/>
)
}
+116 -116
View File
@@ -1,4 +1,8 @@
export const filesMap = [
{
"filePath": "/www/apps/resources/app/_events-reference/page.mdx",
"pathname": "/_events-reference"
},
{
"filePath": "/www/apps/resources/app/admin-widget-injection-zones/page.mdx",
"pathname": "/admin-widget-injection-zones"
@@ -79,18 +83,18 @@ export const filesMap = [
"filePath": "/www/apps/resources/app/architectural-modules/workflow-engine/redis/page.mdx",
"pathname": "/architectural-modules/workflow-engine/redis"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/api-key/_events/_events-table/page.mdx",
"pathname": "/commerce-modules/api-key/_events/_events-table"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/api-key/_events/page.mdx",
"pathname": "/commerce-modules/api-key/_events"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/api-key/concepts/page.mdx",
"pathname": "/commerce-modules/api-key/concepts"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/api-key/events/_events-table/page.mdx",
"pathname": "/commerce-modules/api-key/events/_events-table"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/api-key/events/page.mdx",
"pathname": "/commerce-modules/api-key/events"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/api-key/examples/page.mdx",
"pathname": "/commerce-modules/api-key/examples"
@@ -103,6 +107,14 @@ export const filesMap = [
"filePath": "/www/apps/resources/app/commerce-modules/api-key/relations-to-other-modules/page.mdx",
"pathname": "/commerce-modules/api-key/relations-to-other-modules"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/auth/_events/_events-table/page.mdx",
"pathname": "/commerce-modules/auth/_events/_events-table"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/auth/_events/page.mdx",
"pathname": "/commerce-modules/auth/_events"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/auth/auth-flows/page.mdx",
"pathname": "/commerce-modules/auth/auth-flows"
@@ -131,14 +143,6 @@ export const filesMap = [
"filePath": "/www/apps/resources/app/commerce-modules/auth/create-actor-type/page.mdx",
"pathname": "/commerce-modules/auth/create-actor-type"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/auth/events/_events-table/page.mdx",
"pathname": "/commerce-modules/auth/events/_events-table"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/auth/events/page.mdx",
"pathname": "/commerce-modules/auth/events"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/auth/examples/page.mdx",
"pathname": "/commerce-modules/auth/examples"
@@ -151,18 +155,18 @@ export const filesMap = [
"filePath": "/www/apps/resources/app/commerce-modules/auth/page.mdx",
"pathname": "/commerce-modules/auth"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/cart/_events/_events-table/page.mdx",
"pathname": "/commerce-modules/cart/_events/_events-table"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/cart/_events/page.mdx",
"pathname": "/commerce-modules/cart/_events"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/cart/concepts/page.mdx",
"pathname": "/commerce-modules/cart/concepts"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/cart/events/_events-table/page.mdx",
"pathname": "/commerce-modules/cart/events/_events-table"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/cart/events/page.mdx",
"pathname": "/commerce-modules/cart/events"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/cart/examples/page.mdx",
"pathname": "/commerce-modules/cart/examples"
@@ -184,12 +188,12 @@ export const filesMap = [
"pathname": "/commerce-modules/cart/tax-lines"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/currency/events/_events-table/page.mdx",
"pathname": "/commerce-modules/currency/events/_events-table"
"filePath": "/www/apps/resources/app/commerce-modules/currency/_events/_events-table/page.mdx",
"pathname": "/commerce-modules/currency/_events/_events-table"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/currency/events/page.mdx",
"pathname": "/commerce-modules/currency/events"
"filePath": "/www/apps/resources/app/commerce-modules/currency/_events/page.mdx",
"pathname": "/commerce-modules/currency/_events"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/currency/examples/page.mdx",
@@ -203,18 +207,18 @@ export const filesMap = [
"filePath": "/www/apps/resources/app/commerce-modules/currency/relations-to-other-modules/page.mdx",
"pathname": "/commerce-modules/currency/relations-to-other-modules"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/customer/_events/_events-table/page.mdx",
"pathname": "/commerce-modules/customer/_events/_events-table"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/customer/_events/page.mdx",
"pathname": "/commerce-modules/customer/_events"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/customer/customer-accounts/page.mdx",
"pathname": "/commerce-modules/customer/customer-accounts"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/customer/events/_events-table/page.mdx",
"pathname": "/commerce-modules/customer/events/_events-table"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/customer/events/page.mdx",
"pathname": "/commerce-modules/customer/events"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/customer/examples/page.mdx",
"pathname": "/commerce-modules/customer/examples"
@@ -227,18 +231,18 @@ export const filesMap = [
"filePath": "/www/apps/resources/app/commerce-modules/customer/relations-to-other-modules/page.mdx",
"pathname": "/commerce-modules/customer/relations-to-other-modules"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/fulfillment/_events/_events-table/page.mdx",
"pathname": "/commerce-modules/fulfillment/_events/_events-table"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/fulfillment/_events/page.mdx",
"pathname": "/commerce-modules/fulfillment/_events"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/fulfillment/concepts/page.mdx",
"pathname": "/commerce-modules/fulfillment/concepts"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/fulfillment/events/_events-table/page.mdx",
"pathname": "/commerce-modules/fulfillment/events/_events-table"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/fulfillment/events/page.mdx",
"pathname": "/commerce-modules/fulfillment/events"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/fulfillment/fulfillment-provider/page.mdx",
"pathname": "/commerce-modules/fulfillment/fulfillment-provider"
@@ -263,18 +267,18 @@ export const filesMap = [
"filePath": "/www/apps/resources/app/commerce-modules/fulfillment/shipping-option/page.mdx",
"pathname": "/commerce-modules/fulfillment/shipping-option"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/inventory/_events/_events-table/page.mdx",
"pathname": "/commerce-modules/inventory/_events/_events-table"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/inventory/_events/page.mdx",
"pathname": "/commerce-modules/inventory/_events"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/inventory/concepts/page.mdx",
"pathname": "/commerce-modules/inventory/concepts"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/inventory/events/_events-table/page.mdx",
"pathname": "/commerce-modules/inventory/events/_events-table"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/inventory/events/page.mdx",
"pathname": "/commerce-modules/inventory/events"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/inventory/examples/page.mdx",
"pathname": "/commerce-modules/inventory/examples"
@@ -291,18 +295,18 @@ export const filesMap = [
"filePath": "/www/apps/resources/app/commerce-modules/inventory/relations-to-other-modules/page.mdx",
"pathname": "/commerce-modules/inventory/relations-to-other-modules"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/order/_events/_events-table/page.mdx",
"pathname": "/commerce-modules/order/_events/_events-table"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/order/_events/page.mdx",
"pathname": "/commerce-modules/order/_events"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/order/concepts/page.mdx",
"pathname": "/commerce-modules/order/concepts"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/order/events/_events-table/page.mdx",
"pathname": "/commerce-modules/order/events/_events-table"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/order/events/page.mdx",
"pathname": "/commerce-modules/order/events"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/order/order-change/page.mdx",
"pathname": "/commerce-modules/order/order-change"
@@ -336,12 +340,12 @@ export const filesMap = [
"pathname": "/commerce-modules"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/payment/events/_events-table/page.mdx",
"pathname": "/commerce-modules/payment/events/_events-table"
"filePath": "/www/apps/resources/app/commerce-modules/payment/_events/_events-table/page.mdx",
"pathname": "/commerce-modules/payment/_events/_events-table"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/payment/events/page.mdx",
"pathname": "/commerce-modules/payment/events"
"filePath": "/www/apps/resources/app/commerce-modules/payment/_events/page.mdx",
"pathname": "/commerce-modules/payment/_events"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/payment/examples/page.mdx",
@@ -387,18 +391,18 @@ export const filesMap = [
"filePath": "/www/apps/resources/app/commerce-modules/payment/webhook-events/page.mdx",
"pathname": "/commerce-modules/payment/webhook-events"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/pricing/_events/_events-table/page.mdx",
"pathname": "/commerce-modules/pricing/_events/_events-table"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/pricing/_events/page.mdx",
"pathname": "/commerce-modules/pricing/_events"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/pricing/concepts/page.mdx",
"pathname": "/commerce-modules/pricing/concepts"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/pricing/events/_events-table/page.mdx",
"pathname": "/commerce-modules/pricing/events/_events-table"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/pricing/events/page.mdx",
"pathname": "/commerce-modules/pricing/events"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/pricing/examples/page.mdx",
"pathname": "/commerce-modules/pricing/examples"
@@ -420,12 +424,12 @@ export const filesMap = [
"pathname": "/commerce-modules/pricing/relations-to-other-modules"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/product/events/_events-table/page.mdx",
"pathname": "/commerce-modules/product/events/_events-table"
"filePath": "/www/apps/resources/app/commerce-modules/product/_events/_events-table/page.mdx",
"pathname": "/commerce-modules/product/_events/_events-table"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/product/events/page.mdx",
"pathname": "/commerce-modules/product/events"
"filePath": "/www/apps/resources/app/commerce-modules/product/_events/page.mdx",
"pathname": "/commerce-modules/product/_events"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/product/examples/page.mdx",
@@ -439,6 +443,14 @@ export const filesMap = [
"filePath": "/www/apps/resources/app/commerce-modules/product/relations-to-other-modules/page.mdx",
"pathname": "/commerce-modules/product/relations-to-other-modules"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/promotion/_events/_events-table/page.mdx",
"pathname": "/commerce-modules/promotion/_events/_events-table"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/promotion/_events/page.mdx",
"pathname": "/commerce-modules/promotion/_events"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/promotion/actions/page.mdx",
"pathname": "/commerce-modules/promotion/actions"
@@ -455,14 +467,6 @@ export const filesMap = [
"filePath": "/www/apps/resources/app/commerce-modules/promotion/concepts/page.mdx",
"pathname": "/commerce-modules/promotion/concepts"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/promotion/events/_events-table/page.mdx",
"pathname": "/commerce-modules/promotion/events/_events-table"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/promotion/events/page.mdx",
"pathname": "/commerce-modules/promotion/events"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/promotion/examples/page.mdx",
"pathname": "/commerce-modules/promotion/examples"
@@ -476,12 +480,12 @@ export const filesMap = [
"pathname": "/commerce-modules/promotion/relations-to-other-modules"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/region/events/_events-table/page.mdx",
"pathname": "/commerce-modules/region/events/_events-table"
"filePath": "/www/apps/resources/app/commerce-modules/region/_events/_events-table/page.mdx",
"pathname": "/commerce-modules/region/_events/_events-table"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/region/events/page.mdx",
"pathname": "/commerce-modules/region/events"
"filePath": "/www/apps/resources/app/commerce-modules/region/_events/page.mdx",
"pathname": "/commerce-modules/region/_events"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/region/examples/page.mdx",
@@ -496,12 +500,12 @@ export const filesMap = [
"pathname": "/commerce-modules/region/relations-to-other-modules"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/sales-channel/events/_events-table/page.mdx",
"pathname": "/commerce-modules/sales-channel/events/_events-table"
"filePath": "/www/apps/resources/app/commerce-modules/sales-channel/_events/_events-table/page.mdx",
"pathname": "/commerce-modules/sales-channel/_events/_events-table"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/sales-channel/events/page.mdx",
"pathname": "/commerce-modules/sales-channel/events"
"filePath": "/www/apps/resources/app/commerce-modules/sales-channel/_events/page.mdx",
"pathname": "/commerce-modules/sales-channel/_events"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/sales-channel/examples/page.mdx",
@@ -519,18 +523,18 @@ export const filesMap = [
"filePath": "/www/apps/resources/app/commerce-modules/sales-channel/relations-to-other-modules/page.mdx",
"pathname": "/commerce-modules/sales-channel/relations-to-other-modules"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/stock-location/_events/_events-table/page.mdx",
"pathname": "/commerce-modules/stock-location/_events/_events-table"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/stock-location/_events/page.mdx",
"pathname": "/commerce-modules/stock-location/_events"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/stock-location/concepts/page.mdx",
"pathname": "/commerce-modules/stock-location/concepts"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/stock-location/events/_events-table/page.mdx",
"pathname": "/commerce-modules/stock-location/events/_events-table"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/stock-location/events/page.mdx",
"pathname": "/commerce-modules/stock-location/events"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/stock-location/examples/page.mdx",
"pathname": "/commerce-modules/stock-location/examples"
@@ -544,12 +548,12 @@ export const filesMap = [
"pathname": "/commerce-modules/stock-location/relations-to-other-modules"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/store/events/_events-table/page.mdx",
"pathname": "/commerce-modules/store/events/_events-table"
"filePath": "/www/apps/resources/app/commerce-modules/store/_events/_events-table/page.mdx",
"pathname": "/commerce-modules/store/_events/_events-table"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/store/events/page.mdx",
"pathname": "/commerce-modules/store/events"
"filePath": "/www/apps/resources/app/commerce-modules/store/_events/page.mdx",
"pathname": "/commerce-modules/store/_events"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/store/examples/page.mdx",
@@ -564,12 +568,12 @@ export const filesMap = [
"pathname": "/commerce-modules/store/relations-to-other-modules"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/tax/events/_events-table/page.mdx",
"pathname": "/commerce-modules/tax/events/_events-table"
"filePath": "/www/apps/resources/app/commerce-modules/tax/_events/_events-table/page.mdx",
"pathname": "/commerce-modules/tax/_events/_events-table"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/tax/events/page.mdx",
"pathname": "/commerce-modules/tax/events"
"filePath": "/www/apps/resources/app/commerce-modules/tax/_events/page.mdx",
"pathname": "/commerce-modules/tax/_events"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/tax/examples/page.mdx",
@@ -596,12 +600,12 @@ export const filesMap = [
"pathname": "/commerce-modules/tax/tax-region"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/user/events/_events-table/page.mdx",
"pathname": "/commerce-modules/user/events/_events-table"
"filePath": "/www/apps/resources/app/commerce-modules/user/_events/_events-table/page.mdx",
"pathname": "/commerce-modules/user/_events/_events-table"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/user/events/page.mdx",
"pathname": "/commerce-modules/user/events"
"filePath": "/www/apps/resources/app/commerce-modules/user/_events/page.mdx",
"pathname": "/commerce-modules/user/_events"
},
{
"filePath": "/www/apps/resources/app/commerce-modules/user/examples/page.mdx",
@@ -671,10 +675,6 @@ export const filesMap = [
"filePath": "/www/apps/resources/app/deployment/storefront/vercel/page.mdx",
"pathname": "/deployment/storefront/vercel"
},
{
"filePath": "/www/apps/resources/app/events-reference/page.mdx",
"pathname": "/events-reference"
},
{
"filePath": "/www/apps/resources/app/favicon.ico",
"pathname": "/"
-133
View File
@@ -162,13 +162,6 @@ export const generatedSidebar = [
]
}
]
},
{
"loaded": true,
"isPathHref": true,
"path": "/commerce-modules/api-key/events",
"title": "Events Reference",
"children": []
}
]
}
@@ -371,13 +364,6 @@ export const generatedSidebar = [
]
}
]
},
{
"loaded": true,
"isPathHref": true,
"path": "/commerce-modules/auth/events",
"title": "Events Reference",
"children": []
}
]
}
@@ -880,13 +866,6 @@ export const generatedSidebar = [
]
}
]
},
{
"loaded": true,
"isPathHref": true,
"path": "/commerce-modules/cart/events",
"title": "Events Reference",
"children": []
}
]
}
@@ -990,13 +969,6 @@ export const generatedSidebar = [
]
}
]
},
{
"loaded": true,
"isPathHref": true,
"path": "/commerce-modules/currency/events",
"title": "Events Reference",
"children": []
}
]
}
@@ -1275,13 +1247,6 @@ export const generatedSidebar = [
]
}
]
},
{
"loaded": true,
"isPathHref": true,
"path": "/commerce-modules/customer/events",
"title": "Events Reference",
"children": []
}
]
}
@@ -1931,13 +1896,6 @@ export const generatedSidebar = [
]
}
]
},
{
"loaded": true,
"isPathHref": true,
"path": "/commerce-modules/fulfillment/events",
"title": "Events Reference",
"children": []
}
]
}
@@ -2293,13 +2251,6 @@ export const generatedSidebar = [
]
}
]
},
{
"loaded": true,
"isPathHref": true,
"path": "/commerce-modules/inventory/events",
"title": "Events Reference",
"children": []
}
]
}
@@ -3187,13 +3138,6 @@ export const generatedSidebar = [
]
}
]
},
{
"loaded": true,
"isPathHref": true,
"path": "/commerce-modules/order/events",
"title": "Events Reference",
"children": []
}
]
}
@@ -3557,13 +3501,6 @@ export const generatedSidebar = [
]
}
]
},
{
"loaded": true,
"isPathHref": true,
"path": "/commerce-modules/payment/events",
"title": "Events Reference",
"children": []
}
]
}
@@ -3947,13 +3884,6 @@ export const generatedSidebar = [
]
}
]
},
{
"loaded": true,
"isPathHref": true,
"path": "/commerce-modules/pricing/events",
"title": "Events Reference",
"children": []
}
]
}
@@ -4533,13 +4463,6 @@ export const generatedSidebar = [
]
}
]
},
{
"loaded": true,
"isPathHref": true,
"path": "/commerce-modules/product/events",
"title": "Events Reference",
"children": []
}
]
}
@@ -4881,13 +4804,6 @@ export const generatedSidebar = [
]
}
]
},
{
"loaded": true,
"isPathHref": true,
"path": "/commerce-modules/promotion/events",
"title": "Events Reference",
"children": []
}
]
}
@@ -5061,13 +4977,6 @@ export const generatedSidebar = [
]
}
]
},
{
"loaded": true,
"isPathHref": true,
"path": "/commerce-modules/region/events",
"title": "Events Reference",
"children": []
}
]
}
@@ -5220,13 +5129,6 @@ export const generatedSidebar = [
]
}
]
},
{
"loaded": true,
"isPathHref": true,
"path": "/commerce-modules/sales-channel/events",
"title": "Events Reference",
"children": []
}
]
}
@@ -5386,13 +5288,6 @@ export const generatedSidebar = [
]
}
]
},
{
"loaded": true,
"isPathHref": true,
"path": "/commerce-modules/stock-location/events",
"title": "Events Reference",
"children": []
}
]
}
@@ -5545,13 +5440,6 @@ export const generatedSidebar = [
]
}
]
},
{
"loaded": true,
"isPathHref": true,
"path": "/commerce-modules/store/events",
"title": "Events Reference",
"children": []
}
]
}
@@ -5823,13 +5711,6 @@ export const generatedSidebar = [
]
}
]
},
{
"loaded": true,
"isPathHref": true,
"path": "/commerce-modules/tax/events",
"title": "Events Reference",
"children": []
}
]
}
@@ -6052,13 +5933,6 @@ export const generatedSidebar = [
]
}
]
},
{
"loaded": true,
"isPathHref": true,
"path": "/commerce-modules/user/events",
"title": "Events Reference",
"children": []
}
]
}
@@ -7917,13 +7791,6 @@ export const generatedSidebar = [
"title": "Medusa Container Resources",
"children": []
},
{
"loaded": true,
"isPathHref": true,
"path": "/events-reference",
"title": "Events",
"children": []
},
{
"loaded": true,
"isPathHref": true,
+76 -76
View File
@@ -65,10 +65,10 @@ export const sidebar = sidebarAttachHrefCommonOptions([
},
],
},
{
path: "/commerce-modules/api-key/events",
title: "Events Reference",
},
// {
// path: "/commerce-modules/api-key/events",
// title: "Events Reference",
// },
],
},
],
@@ -156,10 +156,10 @@ export const sidebar = sidebarAttachHrefCommonOptions([
},
],
},
{
path: "/commerce-modules/auth/events",
title: "Events Reference",
},
// {
// path: "/commerce-modules/auth/events",
// title: "Events Reference",
// },
],
},
],
@@ -224,10 +224,10 @@ export const sidebar = sidebarAttachHrefCommonOptions([
},
],
},
{
path: "/commerce-modules/cart/events",
title: "Events Reference",
},
// {
// path: "/commerce-modules/cart/events",
// title: "Events Reference",
// },
],
},
],
@@ -280,10 +280,10 @@ export const sidebar = sidebarAttachHrefCommonOptions([
},
],
},
{
path: "/commerce-modules/currency/events",
title: "Events Reference",
},
// {
// path: "/commerce-modules/currency/events",
// title: "Events Reference",
// },
],
},
],
@@ -340,10 +340,10 @@ export const sidebar = sidebarAttachHrefCommonOptions([
},
],
},
{
path: "/commerce-modules/customer/events",
title: "Events Reference",
},
// {
// path: "/commerce-modules/customer/events",
// title: "Events Reference",
// },
],
},
],
@@ -417,10 +417,10 @@ export const sidebar = sidebarAttachHrefCommonOptions([
},
],
},
{
path: "/commerce-modules/fulfillment/events",
title: "Events Reference",
},
// {
// path: "/commerce-modules/fulfillment/events",
// title: "Events Reference",
// },
],
},
],
@@ -482,10 +482,10 @@ export const sidebar = sidebarAttachHrefCommonOptions([
},
],
},
{
path: "/commerce-modules/inventory/events",
title: "Events Reference",
},
// {
// path: "/commerce-modules/inventory/events",
// title: "Events Reference",
// },
],
},
],
@@ -558,10 +558,10 @@ export const sidebar = sidebarAttachHrefCommonOptions([
},
],
},
{
path: "/commerce-modules/order/events",
title: "Events Reference",
},
// {
// path: "/commerce-modules/order/events",
// title: "Events Reference",
// },
],
},
],
@@ -657,10 +657,10 @@ export const sidebar = sidebarAttachHrefCommonOptions([
},
],
},
{
path: "/commerce-modules/payment/events",
title: "Events Reference",
},
// {
// path: "/commerce-modules/payment/events",
// title: "Events Reference",
// },
],
},
],
@@ -725,10 +725,10 @@ export const sidebar = sidebarAttachHrefCommonOptions([
},
],
},
{
path: "/commerce-modules/pricing/events",
title: "Events Reference",
},
// {
// path: "/commerce-modules/pricing/events",
// title: "Events Reference",
// },
],
},
],
@@ -781,10 +781,10 @@ export const sidebar = sidebarAttachHrefCommonOptions([
},
],
},
{
path: "/commerce-modules/product/events",
title: "Events Reference",
},
// {
// path: "/commerce-modules/product/events",
// title: "Events Reference",
// },
],
},
],
@@ -853,10 +853,10 @@ export const sidebar = sidebarAttachHrefCommonOptions([
},
],
},
{
path: "/commerce-modules/promotion/events",
title: "Events Reference",
},
// {
// path: "/commerce-modules/promotion/events",
// title: "Events Reference",
// },
],
},
],
@@ -909,10 +909,10 @@ export const sidebar = sidebarAttachHrefCommonOptions([
},
],
},
{
path: "/commerce-modules/region/events",
title: "Events Reference",
},
// {
// path: "/commerce-modules/region/events",
// title: "Events Reference",
// },
],
},
],
@@ -971,10 +971,10 @@ export const sidebar = sidebarAttachHrefCommonOptions([
},
],
},
{
path: "/commerce-modules/sales-channel/events",
title: "Events Reference",
},
// {
// path: "/commerce-modules/sales-channel/events",
// title: "Events Reference",
// },
],
},
],
@@ -1034,10 +1034,10 @@ export const sidebar = sidebarAttachHrefCommonOptions([
},
],
},
{
path: "/commerce-modules/stock-location/events",
title: "Events Reference",
},
// {
// path: "/commerce-modules/stock-location/events",
// title: "Events Reference",
// },
],
},
],
@@ -1090,10 +1090,10 @@ export const sidebar = sidebarAttachHrefCommonOptions([
},
],
},
{
path: "/commerce-modules/store/events",
title: "Events Reference",
},
// {
// path: "/commerce-modules/store/events",
// title: "Events Reference",
// },
],
},
],
@@ -1162,10 +1162,10 @@ export const sidebar = sidebarAttachHrefCommonOptions([
},
],
},
{
path: "/commerce-modules/tax/events",
title: "Events Reference",
},
// {
// path: "/commerce-modules/tax/events",
// title: "Events Reference",
// },
],
},
],
@@ -1222,10 +1222,10 @@ export const sidebar = sidebarAttachHrefCommonOptions([
},
],
},
{
path: "/commerce-modules/user/events",
title: "Events Reference",
},
// {
// path: "/commerce-modules/user/events",
// title: "Events Reference",
// },
],
},
],
@@ -2104,10 +2104,10 @@ export const sidebar = sidebarAttachHrefCommonOptions([
path: "/medusa-container-resources",
title: "Medusa Container Resources",
},
{
path: "/events-reference",
title: "Events",
},
// {
// path: "/events-reference",
// title: "Events",
// },
{
path: "/admin-widget-injection-zones",
title: "Admin Widget Injection Zones",
+1 -2
View File
@@ -8,5 +8,4 @@ NEXT_PUBLIC_ALGOLIA_APP_ID=
NEXT_PUBLIC_SEGMENT_API_KEY=
NEXT_PUBLIC_AI_ASSISTANT_URL=
NEXT_PUBLIC_AI_WEBSITE_ID=
NEXT_PUBLIC_AI_API_ASSISTANT_RECAPTCHA_SITE_KEY=
NEXT_PUBLIC_SHOW_V2=
NEXT_PUBLIC_AI_API_ASSISTANT_RECAPTCHA_SITE_KEY=
+3 -10
View File
@@ -1,10 +1,5 @@
import { ArrowUpRightOnBox } from "@medusajs/icons"
import {
NavbarItem,
getNavbarItems,
legacyMobileSidebarItems,
mobileSidebarItemsV1,
} from "docs-ui"
import { NavbarItem, getNavbarItems, mobileSidebarItemsV1 } from "docs-ui"
import { SidebarSectionItemsType } from "types"
import { siteConfig } from "./site"
@@ -17,7 +12,7 @@ export const docsConfig: DocsConfig = {
mainNav: getNavbarItems({
basePath: siteConfig.baseUrl,
activePath: process.env.NEXT_PUBLIC_BASE_PATH || "/ui",
version: process.env.NEXT_PUBLIC_SHOW_V2 ? "v1" : "legacy",
version: "v1",
}),
sidebar: {
top: [
@@ -285,8 +280,6 @@ export const docsConfig: DocsConfig = {
],
},
],
mobile: process.env.NEXT_PUBLIC_SHOW_V2
? mobileSidebarItemsV1
: legacyMobileSidebarItems,
mobile: mobileSidebarItemsV1,
},
}
+29 -123
View File
@@ -52,22 +52,23 @@ export const navbarItemsV1: NavbarItem[] = [
href: `/ui`,
},
},
{
type: "divider",
},
{
type: "link",
props: {
label: "Learn Medusa v2",
target: "_blank",
rel: "noreferrer",
href: `/v2`,
badge: {
variant: "blue",
children: "New",
},
},
},
// TODO enable them later
// {
// type: "divider",
// },
// {
// type: "link",
// props: {
// label: "Learn Medusa v2",
// target: "_blank",
// rel: "noreferrer",
// href: `/v2`,
// badge: {
// variant: "blue",
// children: "New",
// },
// },
// },
]
export const navbarItemsV2: NavbarItem[] = [
@@ -122,71 +123,10 @@ export const navbarItemsV2: NavbarItem[] = [
{
type: "link",
props: {
label: "Medusa V1",
label: "Medusa v1",
target: "_blank",
rel: "noreferrer",
href: `/`,
badge: {
variant: "neutral",
children: "v1",
},
},
},
]
export const legacyNavbarItems: NavbarItem[] = [
{
type: "link",
props: {
label: "Docs",
target: "_blank",
rel: "noreferrer",
href: `/`,
},
},
{
type: "link",
props: {
label: "Resources",
target: "_blank",
rel: "noreferrer",
href: `/resources`,
},
},
{
type: "link",
props: {
label: "User Guide",
target: "_blank",
rel: "noreferrer",
href: `/user-guide`,
},
},
{
type: "link",
props: {
label: "Store API",
target: "_blank",
rel: "noreferrer",
href: `/api/store`,
},
},
{
type: "link",
props: {
label: "Admin API",
target: "_blank",
rel: "noreferrer",
href: `/api/admin`,
},
},
{
type: "link",
props: {
label: "UI",
target: "_blank",
rel: "noreferrer",
href: `/ui`,
},
},
]
@@ -222,13 +162,13 @@ export const mobileSidebarItemsV1: SidebarItemType[] = [
loaded: true,
isPathHref: true,
},
{
title: "Learn Medusa V2",
path: `/v2`,
loaded: true,
isPathHref: true,
additionalElms: <Badge variant="blue">v2</Badge>,
},
// {
// title: "Learn Medusa V2",
// path: `/v2`,
// loaded: true,
// isPathHref: true,
// additionalElms: <Badge variant="blue">v2</Badge>,
// },
]
export const mobileSidebarItemsV2: SidebarItemType[] = [
@@ -263,51 +203,17 @@ export const mobileSidebarItemsV2: SidebarItemType[] = [
isPathHref: true,
},
{
title: "Docs",
title: "Medusa v1",
path: `/`,
loaded: true,
isPathHref: true,
additionalElms: <Badge variant="neutral">v1</Badge>,
},
]
export const legacyMobileSidebarItems: SidebarItemType[] = [
{
title: "Docs",
path: `/`,
loaded: true,
isPathHref: true,
},
{
title: "User Guide",
path: `/user-guide`,
loaded: true,
isPathHref: true,
},
{
title: "Store API",
path: `/api/store`,
loaded: true,
isPathHref: true,
},
{
title: "Admin API",
path: `/api/admin`,
loaded: true,
isPathHref: true,
},
{
title: "UI",
path: `/ui`,
loaded: true,
isPathHref: true,
},
]
export const searchFiltersV2: OptionType[] = [
{
value: "book",
label: "Docs V2",
label: "Docs v2",
},
{
value: "resources",
@@ -315,11 +221,11 @@ export const searchFiltersV2: OptionType[] = [
},
{
value: "admin-v2",
label: "Admin API",
label: "Admin API (v2)",
},
{
value: "store-v2",
label: "Store API",
label: "Store API (v2)",
},
// TODO add more filters
]
@@ -1,22 +1,17 @@
import { NavbarItem, legacyNavbarItems, navbarItemsV1, navbarItemsV2 } from ".."
import { NavbarItem, navbarItemsV1, navbarItemsV2 } from ".."
type Options = {
basePath: string
activePath: string
version?: "v1" | "v2" | "legacy"
version?: "v1" | "v2"
}
export function getNavbarItems({
basePath,
activePath,
version = "legacy",
version = "v1",
}: Options): NavbarItem[] {
const navbarItems =
version === "v2"
? navbarItemsV2
: version === "v1"
? navbarItemsV1
: legacyNavbarItems
const navbarItems = version === "v2" ? navbarItemsV2 : navbarItemsV1
return navbarItems.map((item) => {
if (item.type === "divider") {
return item