docs: show hooks in when condition in workflows reference (#12552)
This commit is contained in:
+56
@@ -176,6 +176,62 @@ Handlers consuming this hook accept the following input.
|
||||
|
||||
<TypeList types={[{"name":"input","type":"[input](../../../core_flows.Cart.Workflows_Cart/page.mdx#__type-3)","description":"The input data for the hook.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"input","type":"[CompleteCartWorkflowInput](../../../../types/core_flows.CompleteCartWorkflowInput/page.mdx)","description":"The data to complete a cart and place an order.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"id","type":"`string`","description":"The ID of the cart to complete.","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"cart","type":"`any`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" openedLevel={1} sectionTitle="validate"/>
|
||||
|
||||
### beforePaymentAuthorization
|
||||
|
||||
This step is a hook that you can inject custom functionality into.
|
||||
|
||||
:::note
|
||||
|
||||
This hook is nested within a [when](https://docs.medusajs.com/learn/fundamentals/workflows/conditions) condition, so it may not be executed if the when condition isn't satisfied.
|
||||
|
||||
:::
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
import { completeCartWorkflow } from "@medusajs/medusa/core-flows"
|
||||
|
||||
completeCartWorkflow.hooks.beforePaymentAuthorization(
|
||||
(async ({}, { container }) => {
|
||||
//TODO
|
||||
})
|
||||
)
|
||||
```
|
||||
|
||||
#### Input
|
||||
|
||||
Handlers consuming this hook accept the following input.
|
||||
|
||||
<TypeList types={[{"name":"input","type":"[input](../../../core_flows.Cart.Workflows_Cart/page.mdx#__type-3)","description":"The input data for the hook.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"input","type":"[CompleteCartWorkflowInput](../../../../types/core_flows.CompleteCartWorkflowInput/page.mdx)","description":"The data to complete a cart and place an order.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"id","type":"`string`","description":"The ID of the cart to complete.","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"cart","type":"`any`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" openedLevel={1} sectionTitle="beforePaymentAuthorization"/>
|
||||
|
||||
### orderCreated
|
||||
|
||||
This step is a hook that you can inject custom functionality into.
|
||||
|
||||
:::note
|
||||
|
||||
This hook is nested within a [when](https://docs.medusajs.com/learn/fundamentals/workflows/conditions) condition, so it may not be executed if the when condition isn't satisfied.
|
||||
|
||||
:::
|
||||
|
||||
#### Example
|
||||
|
||||
```ts
|
||||
import { completeCartWorkflow } from "@medusajs/medusa/core-flows"
|
||||
|
||||
completeCartWorkflow.hooks.orderCreated(
|
||||
(async ({}, { container }) => {
|
||||
//TODO
|
||||
})
|
||||
)
|
||||
```
|
||||
|
||||
#### Input
|
||||
|
||||
Handlers consuming this hook accept the following input.
|
||||
|
||||
<TypeList types={[{"name":"input","type":"[input](../../../core_flows.Cart.Workflows_Cart/page.mdx#__type-3)","description":"The input data for the hook.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"input","type":"[CompleteCartWorkflowInput](../../../../types/core_flows.CompleteCartWorkflowInput/page.mdx)","description":"The data to complete a cart and place an order.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"id","type":"`string`","description":"The ID of the cart to complete.","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"cart","type":"`any`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" openedLevel={1} sectionTitle="orderCreated"/>
|
||||
|
||||
## Emitted Events
|
||||
|
||||
This section lists the events that are either triggered by the `emitEventStep` in the workflow, or by another workflow executed within this workflow.
|
||||
|
||||
Reference in New Issue
Block a user