From 731309e87a27461ea9b248eb64ad4ad258ca8c0a Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Tue, 22 Oct 2024 18:20:21 +0300 Subject: [PATCH] docs: fixes following QA testing (#9690) --- .../app/learn/advanced-development/admin/page.mdx | 2 +- .../advanced-development/admin/ui-routes/page.mdx | 2 +- .../api-routes/additional-data/page.mdx | 4 ++-- .../api-routes/protected-routes/page.mdx | 2 +- .../advanced-development/custom-cli-scripts/page.mdx | 2 +- .../data-models/manage-relationships/page.mdx | 2 +- .../data-models/relationships/page.mdx | 2 +- .../module-links/custom-columns/page.mdx | 2 +- .../advanced-development/modules/container/page.mdx | 2 +- .../modules/db-operations/page.mdx | 6 +++--- .../modules/service-constraints/page.mdx | 2 +- .../book/app/learn/advanced-development/page.mdx | 2 +- .../workflows/execute-another-workflow/page.mdx | 2 +- .../workflows/variable-manipulation/page.mdx | 4 ++-- .../app/learn/basics/admin-customizations/page.mdx | 2 +- .../app/learn/basics/events-and-subscribers/page.mdx | 2 +- www/apps/book/app/learn/basics/loaders/page.mdx | 2 +- www/apps/book/app/learn/basics/modules/page.mdx | 8 ++++---- www/apps/book/app/learn/basics/page.mdx | 6 +++--- www/apps/book/app/learn/basics/workflows/page.mdx | 2 +- .../customization/customize-admin/route/page.mdx | 2 +- .../extend-models/extend-create-product/page.mdx | 4 ++-- .../integrate-systems/handle-event/page.mdx | 2 +- .../book/app/learn/customization/next-steps/page.mdx | 4 ++-- .../debugging-and-testing/instrumentation/page.mdx | 2 +- www/apps/book/app/learn/deployment/page.mdx | 2 +- .../components/Homepage/RecipesSection/index.tsx | 1 - www/apps/book/sidebar.mjs | 7 +------ .../notification/sendgrid/page.mdx | 2 +- .../app/commerce-modules/cart/extend/page.mdx | 6 +++--- .../resources/app/commerce-modules/cart/page.mdx | 2 +- .../customer/customer-accounts/page.mdx | 2 +- .../app/commerce-modules/customer/extend/page.mdx | 4 ++-- .../inventory/inventory-in-flows/page.mdx | 2 +- .../commerce-modules/payment/webhook-events/page.mdx | 12 ++++++++---- .../app/commerce-modules/product/extend/page.mdx | 4 ++-- .../app/commerce-modules/promotion/extend/page.mdx | 4 ++-- .../resources/app/recipes/subscriptions/page.mdx | 2 +- .../page.mdx | 2 +- .../src/utils/component-link-fixer.ts | 12 +++++++++--- 40 files changed, 70 insertions(+), 66 deletions(-) diff --git a/www/apps/book/app/learn/advanced-development/admin/page.mdx b/www/apps/book/app/learn/advanced-development/admin/page.mdx index 876a765ecd..2149f1ed47 100644 --- a/www/apps/book/app/learn/advanced-development/admin/page.mdx +++ b/www/apps/book/app/learn/advanced-development/admin/page.mdx @@ -23,4 +23,4 @@ Refer to the [Medusa UI documentation](https://docs.medusajs.com/ui) to learn ho ## Admin Components List -To build admin customizations that match the Medusa Admin's designs and layouts, refer to [this guide](!resources!/admin-component) to find common components. +To build admin customizations that match the Medusa Admin's designs and layouts, refer to [this guide](!resources!/admin-components) to find common components. diff --git a/www/apps/book/app/learn/advanced-development/admin/ui-routes/page.mdx b/www/apps/book/app/learn/advanced-development/admin/ui-routes/page.mdx index 3190b14d30..a16b7a4971 100644 --- a/www/apps/book/app/learn/advanced-development/admin/ui-routes/page.mdx +++ b/www/apps/book/app/learn/advanced-development/admin/ui-routes/page.mdx @@ -165,4 +165,4 @@ If you run the Medusa application and go to `localhost:9000/app/custom/123`, you ## Admin Components List -To build admin customizations that match the Medusa Admin's designs and layouts, refer to [this guide](!resources!/admin-component) to find common components. +To build admin customizations that match the Medusa Admin's designs and layouts, refer to [this guide](!resources!/admin-components) to find common components. diff --git a/www/apps/book/app/learn/advanced-development/api-routes/additional-data/page.mdx b/www/apps/book/app/learn/advanced-development/api-routes/additional-data/page.mdx index b20b7f6319..e275fe20ae 100644 --- a/www/apps/book/app/learn/advanced-development/api-routes/additional-data/page.mdx +++ b/www/apps/book/app/learn/advanced-development/api-routes/additional-data/page.mdx @@ -147,7 +147,7 @@ import { Modules } from "@medusajs/framework/utils" createProductsWorkflow.hooks.productsCreated( async ({ products, additional_data }, { container }) => { - if (!additional_data.brand) { + if (!additional_data?.brand) { return } @@ -204,4 +204,4 @@ createProductsWorkflow.hooks.productsCreated( ) ``` -This updates the product to their original state before adding the brand to their `metadata` property. +This updates the products to their original state before adding the brand to their `metadata` property. diff --git a/www/apps/book/app/learn/advanced-development/api-routes/protected-routes/page.mdx b/www/apps/book/app/learn/advanced-development/api-routes/protected-routes/page.mdx index 180ba9a372..d3c27188e6 100644 --- a/www/apps/book/app/learn/advanced-development/api-routes/protected-routes/page.mdx +++ b/www/apps/book/app/learn/advanced-development/api-routes/protected-routes/page.mdx @@ -68,7 +68,7 @@ export default defineMiddlewares({ The `authenticate` middleware function accepts three parameters: 1. The type of user authenticating. Use `user` for authenticating admin users, and `customer` for authenticating customers. You can also pass `*` to allow all types of users. -2. An array of the types of authentication methods allowed. Both `user` and `customer` scopes support `session` and `bearer`. The `admin` scope also supports the `api-key` authentication method. +2. An array of types of authentication methods allowed. Both `user` and `customer` scopes support `session` and `bearer`. The `admin` scope also supports the `api-key` authentication method. 3. An optional object of configurations accepting the following property: - `allowUnauthenticated`: (default: `false`) A boolean indicating whether authentication is required. For example, you may have an API route where you want to access the logged-in customer if available, but guest customers can still access it too. diff --git a/www/apps/book/app/learn/advanced-development/custom-cli-scripts/page.mdx b/www/apps/book/app/learn/advanced-development/custom-cli-scripts/page.mdx index 847045051d..ed3973ba79 100644 --- a/www/apps/book/app/learn/advanced-development/custom-cli-scripts/page.mdx +++ b/www/apps/book/app/learn/advanced-development/custom-cli-scripts/page.mdx @@ -4,7 +4,7 @@ export const metadata = { # {metadata.title} -In this chapter, you'll learn how create and execute custom scripts from Medusa's CLI tool. +In this chapter, you'll learn how to create and execute custom scripts from Medusa's CLI tool. ## What is a Custom CLI Script? diff --git a/www/apps/book/app/learn/advanced-development/data-models/manage-relationships/page.mdx b/www/apps/book/app/learn/advanced-development/data-models/manage-relationships/page.mdx index f8693d327d..a978de4154 100644 --- a/www/apps/book/app/learn/advanced-development/data-models/manage-relationships/page.mdx +++ b/www/apps/book/app/learn/advanced-development/data-models/manage-relationships/page.mdx @@ -42,7 +42,7 @@ In the example above, you pass the `user` property when creating or updating an When you create a record of a data model that has one of another, pass the ID of the other data model's record in the relation property. -For example, assuming you have the [User and Email data models from the previous chapter](../relationships/page.mdx#one-to-one-relationship), set an user's email ID as follows: +For example, assuming you have the [User and Email data models from the previous chapter](../relationships/page.mdx#one-to-one-relationship), set a user's email ID as follows: export const hasOneHighlights = [ ["4", "email", "The ID of the email that the user has."], diff --git a/www/apps/book/app/learn/advanced-development/data-models/relationships/page.mdx b/www/apps/book/app/learn/advanced-development/data-models/relationships/page.mdx index 47078fa213..92457b419c 100644 --- a/www/apps/book/app/learn/advanced-development/data-models/relationships/page.mdx +++ b/www/apps/book/app/learn/advanced-development/data-models/relationships/page.mdx @@ -34,7 +34,7 @@ A one-to-one relationship indicates that one record of a data model belongs to o To define a one-to-one relationship, create relationship properties in the data models using the following methods: -1. `hasOne`: indicates that the model has one record of the specified model. +1. `hasOne`: indicates that the model has one records of the specified model. 2. `belongsTo`: indicates that the model belongs to one record of the specified model. For example: diff --git a/www/apps/book/app/learn/advanced-development/module-links/custom-columns/page.mdx b/www/apps/book/app/learn/advanced-development/module-links/custom-columns/page.mdx index fd9a12f5f7..cf5b9d063f 100644 --- a/www/apps/book/app/learn/advanced-development/module-links/custom-columns/page.mdx +++ b/www/apps/book/app/learn/advanced-development/module-links/custom-columns/page.mdx @@ -8,7 +8,7 @@ In this chapter, you'll learn how to add custom columns to a link definition and ## How to Add Custom Columns to a Link's Table? -The `defineLink` function used to define a link accepts a third paramter, which is an object of options. +The `defineLink` function used to define a link accepts a third parameter, which is an object of options. To add custom columns to a link's table, pass in the third parameter of `defineLink` a `database` property: diff --git a/www/apps/book/app/learn/advanced-development/modules/container/page.mdx b/www/apps/book/app/learn/advanced-development/modules/container/page.mdx index fd38ddf95f..18cd48805b 100644 --- a/www/apps/book/app/learn/advanced-development/modules/container/page.mdx +++ b/www/apps/book/app/learn/advanced-development/modules/container/page.mdx @@ -14,7 +14,7 @@ So, resources in the module, such as services or loaders, can only resolve other ### List of Registered Resources -Find a list of resources or dependencies registered in a module's container in [this Learning Resources reference](!resoures!/medusa-container-resources). +Find a list of resources or dependencies registered in a module's container in [this Development Resources reference](!resources!/medusa-container-resources). --- diff --git a/www/apps/book/app/learn/advanced-development/modules/db-operations/page.mdx b/www/apps/book/app/learn/advanced-development/modules/db-operations/page.mdx index fbad86416d..481ee8f993 100644 --- a/www/apps/book/app/learn/advanced-development/modules/db-operations/page.mdx +++ b/www/apps/book/app/learn/advanced-development/modules/db-operations/page.mdx @@ -161,9 +161,9 @@ Refer to [MikroORM's reference](https://mikro-orm.io/api/5.9/knex/class/EntityMa ### Why Wrap a Transactional Method -The variables in the transactional method (for example, `update_`) hold values that are uncomitted to the database. They're only committed once the method finishes execution. +The variables in the transactional method (for example, `update_`) hold values that are uncommitted to the database. They're only committed once the method finishes execution. -So, if in your method you perform database operations, then use their result to perform other actions, such as connect to a third-party service, you'll be working with uncommitted data. +So, if in your method you perform database operations, then use their result to perform other actions, such as connecting to a third-party service, you'll be working with uncommitted data. By placing only the database operations in a method that has the `InjectTransactionManager` and using it in a wrapper method, the wrapper method receives the committed result of the transactional method. @@ -201,7 +201,7 @@ In this case, only the `update_` method is wrapped in a transaction. The returne ### Using Methods in Transactional Methods -If your transactional method uses other methods that accept a Medusa context, pass the shared context to those method. +If your transactional method uses other methods that accept a Medusa context, pass the shared context to those methods. For example: diff --git a/www/apps/book/app/learn/advanced-development/modules/service-constraints/page.mdx b/www/apps/book/app/learn/advanced-development/modules/service-constraints/page.mdx index 4bc4fb72f0..30e6ad83ee 100644 --- a/www/apps/book/app/learn/advanced-development/modules/service-constraints/page.mdx +++ b/www/apps/book/app/learn/advanced-development/modules/service-constraints/page.mdx @@ -8,7 +8,7 @@ This chapter lists constraints to keep in mind when creating a service. ## Use Async Methods -Medusa wraps service method executions to inject useful context or transactions. However, since Medusa can't detect whether the method is asynchronus, it always executes methods in the wrapper with the `await` keyword. +Medusa wraps service method executions to inject useful context or transactions. However, since Medusa can't detect whether the method is asynchronous, it always executes methods in the wrapper with the `await` keyword. For example, if you have a synchronous `getMessage` method, and you use it other resources like workflows, Medusa executes it as an async method: diff --git a/www/apps/book/app/learn/advanced-development/page.mdx b/www/apps/book/app/learn/advanced-development/page.mdx index 14c9a99784..581d4161d0 100644 --- a/www/apps/book/app/learn/advanced-development/page.mdx +++ b/www/apps/book/app/learn/advanced-development/page.mdx @@ -6,7 +6,7 @@ export const metadata = { In the previous chapters, you got a brief introduction to Medusa’s basic concepts. However, to build a custom commerce application, you need a deeper understanding of how you utilize these concepts for your business use case. -The next chapters dive deeper into each concept, and explores Medusa's architecture. By the end of these chapters, you’ll be able to: +The next chapters dive deeper into each concept, and explore Medusa's architecture. By the end of these chapters, you’ll be able to: - Expose API routes with control over authentication. - Build sophisticated business logic in modules and manage links between them. diff --git a/www/apps/book/app/learn/advanced-development/workflows/execute-another-workflow/page.mdx b/www/apps/book/app/learn/advanced-development/workflows/execute-another-workflow/page.mdx index f9acd8896a..2b8d8fad8a 100644 --- a/www/apps/book/app/learn/advanced-development/workflows/execute-another-workflow/page.mdx +++ b/www/apps/book/app/learn/advanced-development/workflows/execute-another-workflow/page.mdx @@ -41,7 +41,7 @@ const workflow = createWorkflow( ) ``` -Instead of invoking the workflow, passing it the container, you use its `runAsStep` method and pass it an object as a parameter. +Instead of invoking the workflow and passing it the container, you use its `runAsStep` method and pass it an object as a parameter. The object has an `input` property to pass input to the workflow. diff --git a/www/apps/book/app/learn/advanced-development/workflows/variable-manipulation/page.mdx b/www/apps/book/app/learn/advanced-development/workflows/variable-manipulation/page.mdx index edb7acfbdb..165c8e37da 100644 --- a/www/apps/book/app/learn/advanced-development/workflows/variable-manipulation/page.mdx +++ b/www/apps/book/app/learn/advanced-development/workflows/variable-manipulation/page.mdx @@ -6,7 +6,7 @@ export const metadata = { In this chapter, you'll learn how to manipulate variables in a workflow using the transform utility. -## Why Variable Manipulation isn't Allowed in Worflows? +## Why Variable Manipulation isn't Allowed in Workflows? Medusa creates an internal representation of the workflow definition you pass to `createWorkflow` to track and store its steps. @@ -29,7 +29,7 @@ const str1 = step1() const str2 = step2() ``` -To concatinate the strings, you create a new variable `str3` using the `transform` function: +To concatenate the strings, you create a new variable `str3` using the `transform` function: export const highlights = [ ["14", "str3", "Holds the result returned by `transform`'s second parameter function."], diff --git a/www/apps/book/app/learn/basics/admin-customizations/page.mdx b/www/apps/book/app/learn/basics/admin-customizations/page.mdx index e54b575b03..aa604422d9 100644 --- a/www/apps/book/app/learn/basics/admin-customizations/page.mdx +++ b/www/apps/book/app/learn/basics/admin-customizations/page.mdx @@ -61,4 +61,4 @@ Then, open a product’s details page in the Medusa Admin. You’ll find your cu ## Admin Components List -To build admin customizations that match the Medusa Admin's designs and layouts, refer to [this guide](!resources!/admin-component) to find common components. +To build admin customizations that match the Medusa Admin's designs and layouts, refer to [this guide](!resources!/admin-components) to find common components. diff --git a/www/apps/book/app/learn/basics/events-and-subscribers/page.mdx b/www/apps/book/app/learn/basics/events-and-subscribers/page.mdx index 0e36d7cfc7..27e6778c3d 100644 --- a/www/apps/book/app/learn/basics/events-and-subscribers/page.mdx +++ b/www/apps/book/app/learn/basics/events-and-subscribers/page.mdx @@ -40,7 +40,7 @@ export const config: SubscriberConfig = { A subscriber file must export: -- A subscriber function that is an asynchronous function executed whenever the associated event is triggered. +- An asynchronous subscriber function that's executed whenever the associated event is triggered. - A configuration object defining the event this subscriber is listening to. The above subscriber listens to the `product.created` event. Whenever the event is emitted, it logs in the terminal `A product is created`. diff --git a/www/apps/book/app/learn/basics/loaders/page.mdx b/www/apps/book/app/learn/basics/loaders/page.mdx index 0be653a04b..a0f525e0d6 100644 --- a/www/apps/book/app/learn/basics/loaders/page.mdx +++ b/www/apps/book/app/learn/basics/loaders/page.mdx @@ -10,7 +10,7 @@ In this chapter, you’ll learn about loaders and how to use them. A loader is a function executed when the Medusa application starts. You define and export it in a module. -Loaders are useful to perform a task at the application start-up, such as to sync data between Medusa and a third-pary service. +Loaders are useful to perform a task at the application start-up, such as to sync data between Medusa and a third-party service. --- diff --git a/www/apps/book/app/learn/basics/modules/page.mdx b/www/apps/book/app/learn/basics/modules/page.mdx index 7dd305bf3a..4f92a9864f 100644 --- a/www/apps/book/app/learn/basics/modules/page.mdx +++ b/www/apps/book/app/learn/basics/modules/page.mdx @@ -58,7 +58,7 @@ Data models automatically have the date properties `created_at`, `updated_at`, a ### 2. Create Service -A module must define a service that implements its functionalities, such as manage the records of your custom data models in the database. +A module must define a service that implements its functionalities, such as managing the records of your custom data models in the database. A service is a TypeScript or JavaScript class defined in the `service.ts` file at the root of your module's directory. @@ -140,11 +140,11 @@ module.exports = defineConfig({ }) ``` -Its value is an array of objects, each having a `resolve` property, whose value is either a path to module's directory, or an `npm` package’s name. +Its value is an array of objects, each having a `resolve` property, whose value is either a path to the module's directory, or an `npm` package’s name. ### 5. Generate Migrations -A migration is a TypeScript or JavaScript file that defines database changes made by your module, such as create the `my_custom` table for the `MyCustom` data model. +A migration is a TypeScript or JavaScript file that defines database changes made by your module, such as creating the `my_custom` table for the `MyCustom` data model. To generate a migration for the data models in your module, run the following command: @@ -160,7 +160,7 @@ The module name `helloModuleService` is the key used when registering the module -The above command creates a migration file at the directory `src/modules/hello/migrations` similar to the following: +The above command creates a migration file in the directory `src/modules/hello/migrations` similar to the following: ```ts import { Migration } from "@mikro-orm/migrations" diff --git a/www/apps/book/app/learn/basics/page.mdx b/www/apps/book/app/learn/basics/page.mdx index 0be88bc387..39f031737d 100644 --- a/www/apps/book/app/learn/basics/page.mdx +++ b/www/apps/book/app/learn/basics/page.mdx @@ -4,15 +4,15 @@ export const metadata = { # {metadata.title} -In the next chapters, you’ll learn about the basic concepts of Medusa that are central in your development. +In the next chapters, you’ll learn about the basic concepts of Medusa that are central to your development. -By the end of these chapter, you’ll be able to: +By the end of these chapters, you’ll be able to: - Expose your custom functionalities through endpoints. - Create custom modules that define custom business logic. - Create custom tables in the database through data models. - Execute scripts when the Medusa application starts. -- Perform asynchronus actions when an event occurs. +- Perform asynchronous actions when an event occurs. - Run tasks at a specified time or pattern during the Medusa application's runtime. - Create custom flows as a series of steps involving multiple services. - Customize the admin dashboard to inject components on existing pages or add new pages. diff --git a/www/apps/book/app/learn/basics/workflows/page.mdx b/www/apps/book/app/learn/basics/workflows/page.mdx index f8cbe566da..f988a50ac0 100644 --- a/www/apps/book/app/learn/basics/workflows/page.mdx +++ b/www/apps/book/app/learn/basics/workflows/page.mdx @@ -267,4 +267,4 @@ const myWorkflow = createWorkflow( export default myWorkflow ``` -In the step, you resolve the Product Module's main service and use it to retrieve the product count. +In `step1`, you resolve the Product Module's main service and use it to retrieve the product count. diff --git a/www/apps/book/app/learn/customization/customize-admin/route/page.mdx b/www/apps/book/app/learn/customization/customize-admin/route/page.mdx index f54975d61c..01ddb07221 100644 --- a/www/apps/book/app/learn/customization/customize-admin/route/page.mdx +++ b/www/apps/book/app/learn/customization/customize-admin/route/page.mdx @@ -76,7 +76,7 @@ This method accepts as a first parameter filters to apply on the retrieved data, -Learn more about the `listAndCount` method and its parameters in [this reference](!resources!service-factory-reference/methods/listAndCount). +Learn more about the `listAndCount` method and its parameters in [this reference](!resources!/service-factory-reference/methods/listAndCount). diff --git a/www/apps/book/app/learn/customization/extend-models/extend-create-product/page.mdx b/www/apps/book/app/learn/customization/extend-models/extend-create-product/page.mdx index 3b6b7eb875..98b30092b8 100644 --- a/www/apps/book/app/learn/customization/extend-models/extend-create-product/page.mdx +++ b/www/apps/book/app/learn/customization/extend-models/extend-create-product/page.mdx @@ -94,7 +94,7 @@ import BrandModuleService from "../../modules/brand/service" createProductsWorkflow.hooks.productsCreated( (async ({ products, additional_data }, { container }) => { - if (!additional_data.brand_id) { + if (!additional_data?.brand_id) { return new StepResponse([], []) } @@ -215,7 +215,7 @@ In the Medusa application's logs, you'll find the message `Linked brand to produ --- -## Worflows and API Routes References +## Workflows and API Routes References Medusa exposes hooks in many of its workflows that you can consume to add custom logic. diff --git a/www/apps/book/app/learn/customization/integrate-systems/handle-event/page.mdx b/www/apps/book/app/learn/customization/integrate-systems/handle-event/page.mdx index 46bd7ff391..3d72c3e258 100644 --- a/www/apps/book/app/learn/customization/integrate-systems/handle-event/page.mdx +++ b/www/apps/book/app/learn/customization/integrate-systems/handle-event/page.mdx @@ -140,7 +140,7 @@ In the compensation function, you undo the step's action using the `deleteBrand` ### Add Step to Workflow -Finally, add the step to the `syncBrandToSystemWorkflow` in `src/workflows/sync-brand-to-system/index.ts`: +Finally, add this step to the `syncBrandToSystemWorkflow` in `src/workflows/sync-brand-to-system/index.ts`: ```ts title="src/workflows/sync-brand-to-system/index.ts" // other imports... diff --git a/www/apps/book/app/learn/customization/next-steps/page.mdx b/www/apps/book/app/learn/customization/next-steps/page.mdx index e8a366f424..4dc5e06854 100644 --- a/www/apps/book/app/learn/customization/next-steps/page.mdx +++ b/www/apps/book/app/learn/customization/next-steps/page.mdx @@ -6,7 +6,7 @@ export const metadata = { The previous examples under the Customization chapter explained more about customizing Medusa for a realistic use case. -Your learning journey doesn't end here, and this only presents some of Medusa's powerful feature. +Your learning journey doesn't end here, and this only presents some of Medusa's powerful features. This chapter guides you into how to continue your learning journey, and what resources will be helpful for you during your development. @@ -33,6 +33,6 @@ Some of these guides and references are: ## More Examples in Recipes -In the Development Resources documentation, you'll also find step-by-step guides of different use cases, such as building a marketplace, digital products, and more. +In the Development Resources documentation, you'll also find step-by-step guides for different use cases, such as building a marketplace, digital products, and more. Refer to the [Recipes](!resources!/recipes) documentation to learn more. diff --git a/www/apps/book/app/learn/debugging-and-testing/instrumentation/page.mdx b/www/apps/book/app/learn/debugging-and-testing/instrumentation/page.mdx index e853f0fcd4..26975caf3b 100644 --- a/www/apps/book/app/learn/debugging-and-testing/instrumentation/page.mdx +++ b/www/apps/book/app/learn/debugging-and-testing/instrumentation/page.mdx @@ -148,7 +148,7 @@ If you check traces in your exporter, you'll find new traces reported. Trace span names start with the following keywords based on what it's reporting: - `{methodName} {URL}` when reporting HTTP requests, where `{methodName}` is the HTTP method, and `{URL}` is the URL the request is sent to. -- `route:` when reporting route handlers running on an HTTP requests. +- `route:` when reporting route handlers running on an HTTP request. - `middleware:` when reporting a middleware running on an HTTP request. - `workflow:` when reporting a workflow execution. - `step:` when reporting a step in a workflow execution. diff --git a/www/apps/book/app/learn/deployment/page.mdx b/www/apps/book/app/learn/deployment/page.mdx index 467c7adc97..d3cfbd190c 100644 --- a/www/apps/book/app/learn/deployment/page.mdx +++ b/www/apps/book/app/learn/deployment/page.mdx @@ -4,7 +4,7 @@ export const metadata = { # {metadata.title} -In this chapter, you’ll learn about the approach to deploy your Medusa application. +In this chapter, you’ll learn the general approach to deploying the Medusa application. diff --git a/www/apps/book/components/Homepage/RecipesSection/index.tsx b/www/apps/book/components/Homepage/RecipesSection/index.tsx index 3e1be4509a..a9d834576d 100644 --- a/www/apps/book/components/Homepage/RecipesSection/index.tsx +++ b/www/apps/book/components/Homepage/RecipesSection/index.tsx @@ -1,4 +1,3 @@ -import { TriangleRightMini } from "@medusajs/icons" import clsx from "clsx" import { CalendarRefreshIcon, diff --git a/www/apps/book/sidebar.mjs b/www/apps/book/sidebar.mjs index eabd10db4e..d59f705bc3 100644 --- a/www/apps/book/sidebar.mjs +++ b/www/apps/book/sidebar.mjs @@ -475,7 +475,7 @@ export const sidebar = numberSidebarItems( children: [ { type: "link", - path: "/advanced-development/custom-cli-scripts/seed-data", + path: "/learn/advanced-development/custom-cli-scripts/seed-data", title: "Seed Data", }, ], @@ -589,11 +589,6 @@ export const sidebar = numberSidebarItems( path: "/learn/more-resources/cheatsheet", title: "Cheat Sheet", }, - { - type: "link", - path: "/learn/more-resources/examples", - title: "Examples", - }, ], }, ]) diff --git a/www/apps/resources/app/architectural-modules/notification/sendgrid/page.mdx b/www/apps/resources/app/architectural-modules/notification/sendgrid/page.mdx index d01cf7532d..fcfe94883b 100644 --- a/www/apps/resources/app/architectural-modules/notification/sendgrid/page.mdx +++ b/www/apps/resources/app/architectural-modules/notification/sendgrid/page.mdx @@ -183,4 +183,4 @@ npm run dev {/* TODO add links */} -And create a product either using the [API route](!api!/api/admin#products_postproducts) or the Medusa Admin. This runs the subscriber and sends an email using SendGrid. +And create a product either using the [API route](!api!/admin#products_postproducts) or the Medusa Admin. This runs the subscriber and sends an email using SendGrid. diff --git a/www/apps/resources/app/commerce-modules/cart/extend/page.mdx b/www/apps/resources/app/commerce-modules/cart/extend/page.mdx index 7d671ff0dd..61875693c9 100644 --- a/www/apps/resources/app/commerce-modules/cart/extend/page.mdx +++ b/www/apps/resources/app/commerce-modules/cart/extend/page.mdx @@ -309,7 +309,7 @@ curl -X POST 'localhost:9000/store/carts' \ Make sure to replace `{publishable_api_key}` with your publishable API key, which you can retrieve from the Medusa Admin. Also, replace the value of `region_id` with an ID of a region in your application. -The request will return the cart's details. You'll learn how to retrive the `custom_name` property with the cart's details in the next section. +The request will return the cart's details. You'll learn how to retrieve the `custom_name` property with the cart's details in the next section. --- @@ -401,7 +401,7 @@ export default defineMiddlewares({ }) ``` -The validation schema is the similar to that of the Create Cart API route, except you can pass a `null` value for `custom_name` to remove or unset the `custom_name`'s value. +The validation schema is similar to that of the Create Cart API route, except you can pass a `null` value for `custom_name` to remove or unset the `custom_name`'s value. ### Create Workflow to Update Custom Record @@ -617,7 +617,7 @@ return new WorkflowResponse({ }) ``` -Using the `when-then` utility, you check if the cart has a linked `Custom` record and `custom_name` is passed in the `additional_data`. If so, you update the linked `Custom` recod. +Using the `when-then` utility, you check if the cart has a linked `Custom` record and `custom_name` is passed in the `additional_data`. If so, you update the linked `Custom` record. You return in the workflow response the created, updated, and deleted `Custom` record. diff --git a/www/apps/resources/app/commerce-modules/cart/page.mdx b/www/apps/resources/app/commerce-modules/cart/page.mdx index 9effeea023..e8879e5317 100644 --- a/www/apps/resources/app/commerce-modules/cart/page.mdx +++ b/www/apps/resources/app/commerce-modules/cart/page.mdx @@ -118,7 +118,7 @@ const shippingAdjustments = A cart is scoped to a sales channel, region, and a customer. -The Medusa application links the Cart Module to each of their respective modules, providing with features like: +The Medusa application links the Cart Module to each of their respective modules, providing features like: - Checking product availability in a sales channel. - Retrieving pricing per region. diff --git a/www/apps/resources/app/commerce-modules/customer/customer-accounts/page.mdx b/www/apps/resources/app/commerce-modules/customer/customer-accounts/page.mdx index c4b5806bf4..48c218a261 100644 --- a/www/apps/resources/app/commerce-modules/customer/customer-accounts/page.mdx +++ b/www/apps/resources/app/commerce-modules/customer/customer-accounts/page.mdx @@ -8,7 +8,7 @@ In this document, you’ll learn how registered and unregistered accounts are di ## `has_account` Property -The [Customer data model](/references/customer/models/Customer) has a `has_account` property, which is a boolean that indicates whether a customer is registerd. +The [Customer data model](/references/customer/models/Customer) has a `has_account` property, which is a boolean that indicates whether a customer is registered. When a guest customer places an order, a new `Customer` record is created with `has_account` set to `false`. diff --git a/www/apps/resources/app/commerce-modules/customer/extend/page.mdx b/www/apps/resources/app/commerce-modules/customer/extend/page.mdx index b3914e75dd..a89437efa7 100644 --- a/www/apps/resources/app/commerce-modules/customer/extend/page.mdx +++ b/www/apps/resources/app/commerce-modules/customer/extend/page.mdx @@ -321,7 +321,7 @@ curl -X POST 'localhost:9000/admin/customers' \ Make sure to replace `{token}` with an admin user's JWT token. Learn how to retrieve it in the [API reference](!api!/admin#1-bearer-authorization-with-jwt-tokens). -The request will return the customer's details. You'll learn how to retrive the `custom_name` property with the customer's details in the next section. +The request will return the customer's details. You'll learn how to retrieve the `custom_name` property with the customer's details in the next section. --- @@ -629,7 +629,7 @@ return new WorkflowResponse({ }) ``` -Using the `when-then` utility, you check if the customer has a linked `Custom` record and `custom_name` is passed in the `additional_data`. If so, you update the linked `Custom` recod. +Using the `when-then` utility, you check if the customer has a linked `Custom` record and `custom_name` is passed in the `additional_data`. If so, you update the linked `Custom` record. You return in the workflow response the created, updated, and deleted `Custom` record. diff --git a/www/apps/resources/app/commerce-modules/inventory/inventory-in-flows/page.mdx b/www/apps/resources/app/commerce-modules/inventory/inventory-in-flows/page.mdx index 6a5abd7ac1..a146eb652a 100644 --- a/www/apps/resources/app/commerce-modules/inventory/inventory-in-flows/page.mdx +++ b/www/apps/resources/app/commerce-modules/inventory/inventory-in-flows/page.mdx @@ -50,4 +50,4 @@ When an item in an order is returned and the associated variant has its `manage_ ### Dismissed Returned Items -If a returned item is considered damanged or its dismissed, its quantity doesn't increment the `stocked_quantity` of the inventory item's level. \ No newline at end of file +If a returned item is considered damaged or is dismissed, its quantity doesn't increment the `stocked_quantity` of the inventory item's level. \ No newline at end of file diff --git a/www/apps/resources/app/commerce-modules/payment/webhook-events/page.mdx b/www/apps/resources/app/commerce-modules/payment/webhook-events/page.mdx index cc5671d7ad..3fa1c7f9ff 100644 --- a/www/apps/resources/app/commerce-modules/payment/webhook-events/page.mdx +++ b/www/apps/resources/app/commerce-modules/payment/webhook-events/page.mdx @@ -14,14 +14,18 @@ This is useful in many cases such as when a payment is being processed asynchron --- -## processEvent Method +## getWebhookActionAndData Method -The Payment Module’s main service has a [processEvent method](/references/payment/processEvent) used to handle incoming webhook events from third-party payment services. The method delegates the handling to the associated payment provider, which returns the event's details. +The Payment Module’s main service has a [getWebhookActionAndData method](/references/payment/getWebhookActionAndData) used to handle incoming webhook events from third-party payment services. The method delegates the handling to the associated payment provider, which returns the event's details. Medusa implements a webhook listener route at the `/hooks/payment/[provider]` API route, where `[provider]` is the ID of the provider (for example, `stripe`). Use that webhook listener in your third-party payment provider's configurations. -![A diagram showcasing the steps of how the processEvent method words](https://res.cloudinary.com/dza7lstvk/image/upload/v1711567415/Medusa%20Resources/payment-webhook_seaocg.jpg) +![A diagram showcasing the steps of how the getWebhookActionAndData method words](https://res.cloudinary.com/dza7lstvk/image/upload/v1711567415/Medusa%20Resources/payment-webhook_seaocg.jpg) If the event's details indicate that the payment should be authorized, then the [authorizePaymentSession method of the main service](/references/payment/authorizePaymentSession) is executed on the specified payment session. -If the event's details indicate that the payment should be captured, then the [capturePayment method of the main service](/references/payment/capturePayment) is executed on the payment of the specified payment session. \ No newline at end of file +If the event's details indicate that the payment should be captured, then the [capturePayment method of the main service](/references/payment/capturePayment) is executed on the payment of the specified payment session. + +### Actions After Webhook Payment Processing + +After the payment webhook actions are processed and the payment is authorized or captured, the Medusa application completes the cart associated with the payment's collection if it's not completed yet. diff --git a/www/apps/resources/app/commerce-modules/product/extend/page.mdx b/www/apps/resources/app/commerce-modules/product/extend/page.mdx index e1c433edeb..53da450d2f 100644 --- a/www/apps/resources/app/commerce-modules/product/extend/page.mdx +++ b/www/apps/resources/app/commerce-modules/product/extend/page.mdx @@ -327,7 +327,7 @@ curl -X POST 'localhost:9000/admin/products' \ Make sure to replace `{token}` with an admin user's JWT token. Learn how to retrieve it in the [API reference](!api!/admin#1-bearer-authorization-with-jwt-tokens). -The request will return the product's details. You'll learn how to retrive the `custom_name` property with the product's details in the next section. +The request will return the product's details. You'll learn how to retreive the `custom_name` property with the product's details in the next section. --- @@ -635,7 +635,7 @@ return new WorkflowResponse({ }) ``` -Using the `when-then` utility, you check if the product has a linked `Custom` record and `custom_name` is passed in the `additional_data`. If so, you update the linked `Custom` recod. +Using the `when-then` utility, you check if the product has a linked `Custom` record and `custom_name` is passed in the `additional_data`. If so, you update the linked `Custom` record. You return in the workflow response the created, updated, and deleted `Custom` record. diff --git a/www/apps/resources/app/commerce-modules/promotion/extend/page.mdx b/www/apps/resources/app/commerce-modules/promotion/extend/page.mdx index 1d701d1b5b..85a81136e3 100644 --- a/www/apps/resources/app/commerce-modules/promotion/extend/page.mdx +++ b/www/apps/resources/app/commerce-modules/promotion/extend/page.mdx @@ -333,7 +333,7 @@ curl --location 'localhost:9000/admin/promotions' \ Make sure to replace `{token}` with an admin user's JWT token. Learn how to retrieve it in the [API reference](!api!/admin#1-bearer-authorization-with-jwt-tokens). -The request will return the promotion's details. You'll learn how to retrive the `custom_name` property with the promotion's details in the next section. +The request will return the promotion's details. You'll learn how to retrieve the `custom_name` property with the promotion's details in the next section. --- @@ -641,7 +641,7 @@ return new WorkflowResponse({ }) ``` -Using the `when-then` utility, you check if the promotion has a linked `Custom` record and `custom_name` is passed in the `additional_data`. If so, you update the linked `Custom` recod. +Using the `when-then` utility, you check if the promotion has a linked `Custom` record and `custom_name` is passed in the `additional_data`. If so, you update the linked `Custom` record. You return in the workflow response the created, updated, and deleted `Custom` record. diff --git a/www/apps/resources/app/recipes/subscriptions/page.mdx b/www/apps/resources/app/recipes/subscriptions/page.mdx index ba230fbb70..3f6048fb1f 100644 --- a/www/apps/resources/app/recipes/subscriptions/page.mdx +++ b/www/apps/resources/app/recipes/subscriptions/page.mdx @@ -119,7 +119,7 @@ Extend the Medusa Admin to add widgets to existing pages or add new pages. `","description":"The data that gets passed over to the provider for rendering the notification.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"content","type":"`null` \\| [NotificationContent](../../../types/NotificationTypes/interfaces/types.NotificationTypes.NotificationContent/page.mdx)","description":"The content that gets passed to the provider.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"subject","type":"`string`","description":"the subject of the notification","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"text","type":"`string`","description":"the text content of the notification","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"html","type":"`string`","description":"the html content of the notification","optional":true,"defaultValue":"","expandable":false,"children":[]}]}]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="send"/> +`","description":"The data that gets passed over to the provider for rendering the notification.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"content","type":"`null` \\| `NotificationContent`","description":"The content that gets passed to the provider.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"subject","type":"`string`","description":"the subject of the notification","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"text","type":"`string`","description":"the text content of the notification","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"html","type":"`string`","description":"the html content of the notification","optional":true,"defaultValue":"","expandable":false,"children":[]}]}]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="send"/> #### Returns diff --git a/www/packages/remark-rehype-plugins/src/utils/component-link-fixer.ts b/www/packages/remark-rehype-plugins/src/utils/component-link-fixer.ts index 2aeae9d963..fff48ec155 100644 --- a/www/packages/remark-rehype-plugins/src/utils/component-link-fixer.ts +++ b/www/packages/remark-rehype-plugins/src/utils/component-link-fixer.ts @@ -15,7 +15,7 @@ import { } from "../utils/expression-is-utils.js" import { ComponentLinkFixerOptions } from "../types/index.js" -const MD_LINK_REGEX = /\[(.*?)\]\((?.*?)\)/gm +const MD_LINK_REGEX = /\[(.*?)\]\((?(![a-z]+!|\.).*?)\)/gm const VALUE_LINK_REGEX = /^(![a-z]+!|\.)/gm function matchMdLinks( @@ -23,8 +23,10 @@ function matchMdLinks( linkOptions: Omit ) { let linkMatches + // reset regex + MD_LINK_REGEX.lastIndex = 0 while ((linkMatches = MD_LINK_REGEX.exec(str)) !== null) { - if (!linkMatches.groups?.link || linkMatches.groups?.link.startsWith("http")) { + if (!linkMatches.groups?.link) { return } @@ -34,6 +36,8 @@ function matchMdLinks( }) str = str.replace(linkMatches.groups.link, newUrl) + // reset regex + MD_LINK_REGEX.lastIndex = 0 } return str @@ -43,7 +47,9 @@ function matchValueLink( str: string, linkOptions: Omit ) { - if (!VALUE_LINK_REGEX.exec(str) || str.startsWith("http")) { + // reset index + VALUE_LINK_REGEX.lastIndex = 0 + if (!VALUE_LINK_REGEX.exec(str)) { return str }