docs: support version in events reference (#12422)

* docs: support version in events reference

* remove changes in events output

* remove events emitted in comments

* remove customer updated event

* check for emitEventStep usage

* fixes
This commit is contained in:
Shahed Nasser authored and GitHub committed 2025-05-09 14:34:15 +03:00
1 parent 091041f2da
commit e09b2a4db5
24 files changed
+91 -636

No files matched your search

@@ -22139,17 +22139,6 @@ paths:
'500': '500':
$ref: '#/components/responses/500_error' $ref: '#/components/responses/500_error'
x-workflow: cancelBeginOrderEditWorkflow x-workflow: cancelBeginOrderEditWorkflow
x-events:
- name: order-edit.canceled
payload: |-
```ts
{
order_id, // The ID of the order
actions, // (array) The [actions](https://docs.medusajs.com/resources/references/fulfillment/interfaces/fulfillment.OrderChangeActionDTO) to edit the order
}
```
description: Emitted when an order edit request is canceled.
deprecated: false
/admin/order-edits/{id}/confirm: /admin/order-edits/{id}/confirm:
post: post:
operationId: PostOrderEditsIdConfirm operationId: PostOrderEditsIdConfirm
@@ -22212,16 +22201,6 @@ paths:
'500': '500':
$ref: '#/components/responses/500_error' $ref: '#/components/responses/500_error'
x-workflow: confirmOrderEditRequestWorkflow x-workflow: confirmOrderEditRequestWorkflow
x-events:
- name: order-edit.confirmed
payload: |-
```ts
{
order_id, // The ID of the order
actions, // (array) The [actions](https://docs.medusajs.com/resources/references/fulfillment/interfaces/fulfillment.OrderChangeActionDTO) to edit the order
```
description: Emitted when an order edit request is confirmed.
deprecated: false
/admin/order-edits/{id}/items: /admin/order-edits/{id}/items:
post: post:
operationId: PostOrderEditsIdItems operationId: PostOrderEditsIdItems
@@ -22604,17 +22583,6 @@ paths:
'500': '500':
$ref: '#/components/responses/500_error' $ref: '#/components/responses/500_error'
x-workflow: requestOrderEditRequestWorkflow x-workflow: requestOrderEditRequestWorkflow
x-events:
- name: order-edit.requested
payload: |-
```ts
{
order_id, // The ID of the order
actions, // (array) The [actions](https://docs.medusajs.com/resources/references/fulfillment/interfaces/fulfillment.OrderChangeActionDTO) to edit the order
}
```
description: Emitted when an order edit is requested.
deprecated: false
/admin/order-edits/{id}/shipping-method: /admin/order-edits/{id}/shipping-method:
post: post:
operationId: PostOrderEditsIdShippingMethod operationId: PostOrderEditsIdShippingMethod
@@ -64,14 +64,3 @@ delete:
'500': '500':
$ref: ../components/responses/500_error.yaml $ref: ../components/responses/500_error.yaml
x-workflow: cancelBeginOrderEditWorkflow x-workflow: cancelBeginOrderEditWorkflow
x-events:
- name: order-edit.canceled
payload: |-
```ts
{
order_id, // The ID of the order
actions, // (array) The [actions](https://docs.medusajs.com/resources/references/fulfillment/interfaces/fulfillment.OrderChangeActionDTO) to edit the order
}
```
description: Emitted when an order edit request is canceled.
deprecated: false
@@ -45,13 +45,3 @@ post:
'500': '500':
$ref: ../components/responses/500_error.yaml $ref: ../components/responses/500_error.yaml
x-workflow: confirmOrderEditRequestWorkflow x-workflow: confirmOrderEditRequestWorkflow
x-events:
- name: order-edit.confirmed
payload: |-
```ts
{
order_id, // The ID of the order
actions, // (array) The [actions](https://docs.medusajs.com/resources/references/fulfillment/interfaces/fulfillment.OrderChangeActionDTO) to edit the order
```
description: Emitted when an order edit request is confirmed.
deprecated: false
@@ -45,14 +45,3 @@ post:
'500': '500':
$ref: ../components/responses/500_error.yaml $ref: ../components/responses/500_error.yaml
x-workflow: requestOrderEditRequestWorkflow x-workflow: requestOrderEditRequestWorkflow
x-events:
- name: order-edit.requested
payload: |-
```ts
{
order_id, // The ID of the order
actions, // (array) The [actions](https://docs.medusajs.com/resources/references/fulfillment/interfaces/fulfillment.OrderChangeActionDTO) to edit the order
}
```
description: Emitted when an order edit is requested.
deprecated: false
@@ -1,2 +1,6 @@
curl -X POST '{backend_url}/store/carts' \ curl -X POST '{backend_url}/store/carts' \
-H 'x-publishable-api-key: {your_publishable_api_key}' -H 'Content-Type: application/json' \
-H 'x-publishable-api-key: {your_publishable_api_key}' \
--data-raw '{
"region_id": "reg_123"
}'
@@ -857,7 +857,11 @@ paths:
label: cURL label: cURL
source: |- source: |-
curl -X POST '{backend_url}/store/carts' \ curl -X POST '{backend_url}/store/carts' \
-H 'x-publishable-api-key: {your_publishable_api_key}' -H 'Content-Type: application/json' \
-H 'x-publishable-api-key: {your_publishable_api_key}' \
--data-raw '{
"region_id": "reg_123"
}'
tags: tags:
- Carts - Carts
responses: responses:
@@ -1079,15 +1083,6 @@ paths:
``` ```
description: Emitted when a cart's details are updated. description: Emitted when a cart's details are updated.
deprecated: false deprecated: false
- name: cart.customer_updated
payload: |-
```ts
{
id, // The ID of the cart
}
```
description: Emitted when the customer in the cart is updated.
deprecated: false
- name: cart.region_updated - name: cart.region_updated
payload: |- payload: |-
```ts ```ts
@@ -175,15 +175,6 @@ post:
``` ```
description: Emitted when a cart's details are updated. description: Emitted when a cart's details are updated.
deprecated: false deprecated: false
- name: cart.customer_updated
payload: |-
```ts
{
id, // The ID of the cart
}
```
description: Emitted when the customer in the cart is updated.
deprecated: false
- name: cart.region_updated - name: cart.region_updated
payload: |- payload: |-
```ts ```ts
@@ -46,7 +46,7 @@ export const EventHeader = ({
return ( return (
<div className="flex items-center justify-between flex-wrap"> <div className="flex items-center justify-between flex-wrap">
<Header {...headerProps}>{eventName}</Header> <Header {...headerProps}>{headerProps.children ?? eventName}</Header>
<DropdownMenu <DropdownMenu
dropdownButtonContent={ dropdownButtonContent={
<> <>
@@ -301,31 +301,6 @@ Emitted when a cart's details are updated.
{ {
id, // The ID of the cart id, // The ID of the cart
} }
\`\`\``
}}/>
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`cart.customer_updated`
</Table.Cell>
<Table.Cell>
Emitted when the customer in the cart is updated.
</Table.Cell>
<Table.Cell>
```ts blockStyle="inline"
{
id, // The ID of the cart
}
```
</Table.Cell>
<Table.Cell>
<CopyGeneratedSnippetButton tooltipText="Copy subscriber for event" type="subscriber" options={{
event: "cart.customer_updated",
payload: `\`\`\`ts
{
id, // The ID of the cart
}
\`\`\`` \`\`\``
}}/> }}/>
</Table.Cell> </Table.Cell>
@@ -130,62 +130,8 @@ const myWorkflow = createWorkflow(
## Steps ## Steps
<WorkflowDiagram workflow={{"name":"cancelBeginOrderEditWorkflow","steps":[{"type":"step","name":"useRemoteQueryStep","description":"This step fetches data across modules using the remote query.\n\nLearn more in the [Remote Query documentation](https://docs.medusajs.com/learn/fundamentals/module-links/query).\n\n:::note\n\nThis step is deprecated. Use [useQueryGraphStep](../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.useQueryGraphStep/page.mdx) instead.\n\n:::","link":"../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.useRemoteQueryStep/page.mdx","depth":1},{"type":"step","name":"useRemoteQueryStep","description":"This step fetches data across modules using the remote query.\n\nLearn more in the [Remote Query documentation](https://docs.medusajs.com/learn/fundamentals/module-links/query).\n\n:::note\n\nThis step is deprecated. Use [useQueryGraphStep](../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.useQueryGraphStep/page.mdx) instead.\n\n:::","link":"../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.useRemoteQueryStep/page.mdx","depth":2},{"type":"step","name":"cancelBeginOrderEditValidationStep","description":"This step validates that a requested order edit can be canceled.\nIf the order is canceled or the order change is not active, the step will throw an error.\n\n:::note\n\nYou can retrieve an order and order change details using [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query),\nor [useQueryGraphStep](https://docs.medusajs.com/resources/references/medusa-workflows/steps/useQueryGraphStep).\n\n:::","link":"../core_flows.Order.Workflows_Order.cancelBeginOrderEditValidationStep/page.mdx","depth":3},{"type":"step","name":"deleteOrderChangesStep","description":"This step deletes order changes.","link":"../../../Steps_Order/functions/core_flows.Order.Steps_Order.deleteOrderChangesStep/page.mdx","depth":4},{"type":"step","name":"deleteOrderShippingMethods","description":"This step deletes order shipping methods.","link":"../../../Steps_Order/functions/core_flows.Order.Steps_Order.deleteOrderShippingMethods/page.mdx","depth":4},{"type":"step","name":"emitEventStep","description":"Emit an event.","link":"../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.emitEventStep/page.mdx","depth":4}]}} /> <WorkflowDiagram workflow={{"name":"cancelBeginOrderEditWorkflow","steps":[{"type":"step","name":"useRemoteQueryStep","description":"This step fetches data across modules using the remote query.\n\nLearn more in the [Remote Query documentation](https://docs.medusajs.com/learn/fundamentals/module-links/query).\n\n:::note\n\nThis step is deprecated. Use [useQueryGraphStep](../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.useQueryGraphStep/page.mdx) instead.\n\n:::","link":"../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.useRemoteQueryStep/page.mdx","depth":1},{"type":"step","name":"useRemoteQueryStep","description":"This step fetches data across modules using the remote query.\n\nLearn more in the [Remote Query documentation](https://docs.medusajs.com/learn/fundamentals/module-links/query).\n\n:::note\n\nThis step is deprecated. Use [useQueryGraphStep](../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.useQueryGraphStep/page.mdx) instead.\n\n:::","link":"../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.useRemoteQueryStep/page.mdx","depth":2},{"type":"step","name":"cancelBeginOrderEditValidationStep","description":"This step validates that a requested order edit can be canceled.\nIf the order is canceled or the order change is not active, the step will throw an error.\n\n:::note\n\nYou can retrieve an order and order change details using [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query),\nor [useQueryGraphStep](https://docs.medusajs.com/resources/references/medusa-workflows/steps/useQueryGraphStep).\n\n:::","link":"../core_flows.Order.Workflows_Order.cancelBeginOrderEditValidationStep/page.mdx","depth":3},{"type":"step","name":"deleteOrderChangesStep","description":"This step deletes order changes.","link":"../../../Steps_Order/functions/core_flows.Order.Steps_Order.deleteOrderChangesStep/page.mdx","depth":4},{"type":"step","name":"deleteOrderShippingMethods","description":"This step deletes order shipping methods.","link":"../../../Steps_Order/functions/core_flows.Order.Steps_Order.deleteOrderShippingMethods/page.mdx","depth":4}]}} />
## Input ## Input
<TypeList types={[{"name":"CancelBeginOrderEditWorkflowInput","type":"[CancelBeginOrderEditWorkflowInput](../../../../types/core_flows.CancelBeginOrderEditWorkflowInput/page.mdx)","optional":false,"defaultValue":"","description":"The data to cancel a requested order edit.","expandable":false,"children":[{"name":"order_id","type":"`string`","description":"The ID of the order to cancel the edit for.","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" openedLevel={1} sectionTitle="cancelBeginOrderEditWorkflow"/> <TypeList types={[{"name":"CancelBeginOrderEditWorkflowInput","type":"[CancelBeginOrderEditWorkflowInput](../../../../types/core_flows.CancelBeginOrderEditWorkflowInput/page.mdx)","optional":false,"defaultValue":"","description":"The data to cancel a requested order edit.","expandable":false,"children":[{"name":"order_id","type":"`string`","description":"The ID of the order to cancel the edit for.","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" openedLevel={1} sectionTitle="cancelBeginOrderEditWorkflow"/>
## 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.
You can listen to these events in a subscriber, as explained in the [Subscribers](https://docs.medusajs.com/learn/fundamentals/events-and-subscribers) documentation.
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>
Event
</Table.HeaderCell>
<Table.HeaderCell>
Description
</Table.HeaderCell>
<Table.HeaderCell>
Payload
</Table.HeaderCell>
<Table.HeaderCell>
Action
</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`order-edit.canceled`
</Table.Cell>
<Table.Cell>
Emitted when an order edit request is canceled.
</Table.Cell>
<Table.Cell>
```ts blockStyle="inline"
{
order_id, // The ID of the order
actions, // (array) The [actions](https://docs.medusajs.com/resources/references/fulfillment/interfaces/fulfillment.OrderChangeActionDTO) to edit the order
}
```
</Table.Cell>
<Table.Cell>
<CopyGeneratedSnippetButton tooltipText="Copy subscriber for event" type="subscriber" options={{
event: "order-edit.canceled",
payload: `\`\`\`ts
{
order_id, // The ID of the order
actions, // (array) The [actions](https://docs.medusajs.com/resources/references/fulfillment/interfaces/fulfillment.OrderChangeActionDTO) to edit the order
}
\`\`\``
}}/>
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
@@ -134,7 +134,7 @@ const myWorkflow = createWorkflow(
## Steps ## Steps
<WorkflowDiagram workflow={{"name":"confirmOrderEditRequestWorkflow","steps":[{"type":"step","name":"useRemoteQueryStep","description":"This step fetches data across modules using the remote query.\n\nLearn more in the [Remote Query documentation](https://docs.medusajs.com/learn/fundamentals/module-links/query).\n\n:::note\n\nThis step is deprecated. Use [useQueryGraphStep](../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.useQueryGraphStep/page.mdx) instead.\n\n:::","link":"../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.useRemoteQueryStep/page.mdx","depth":1},{"type":"step","name":"useRemoteQueryStep","description":"This step fetches data across modules using the remote query.\n\nLearn more in the [Remote Query documentation](https://docs.medusajs.com/learn/fundamentals/module-links/query).\n\n:::note\n\nThis step is deprecated. Use [useQueryGraphStep](../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.useQueryGraphStep/page.mdx) instead.\n\n:::","link":"../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.useRemoteQueryStep/page.mdx","depth":2},{"type":"step","name":"confirmOrderEditRequestValidationStep","description":"This step validates that a requested order edit can be confirmed.\nIf the order is canceled or the order change is not active, the step will throw an error.\n\n:::note\n\nYou can retrieve an order and order change details using [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query),\nor [useQueryGraphStep](https://docs.medusajs.com/resources/references/medusa-workflows/steps/useQueryGraphStep).\n\n:::","link":"../core_flows.Order.Workflows_Order.confirmOrderEditRequestValidationStep/page.mdx","depth":3},{"type":"step","name":"previewOrderChangeStep","description":"This step retrieves a preview of an order change.","link":"../../../Steps_Order/functions/core_flows.Order.Steps_Order.previewOrderChangeStep/page.mdx","depth":4},{"type":"step","name":"useRemoteQueryStep","description":"This step fetches data across modules using the remote query.\n\nLearn more in the [Remote Query documentation](https://docs.medusajs.com/learn/fundamentals/module-links/query).\n\n:::note\n\nThis step is deprecated. Use [useQueryGraphStep](../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.useQueryGraphStep/page.mdx) instead.\n\n:::","link":"../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.useRemoteQueryStep/page.mdx","depth":5},{"type":"step","name":"deleteReservationsByLineItemsStep","description":"This step deletes reservations by their associated line items.","link":"../../../../Reservation/Steps_Reservation/functions/core_flows.Reservation.Steps_Reservation.deleteReservationsByLineItemsStep/page.mdx","depth":6},{"type":"step","name":"reserveInventoryStep","description":"This step reserves the quantity of line items from the associated\nvariant's inventory.","link":"../../../../Cart/Steps_Cart/functions/core_flows.Cart.Steps_Cart.reserveInventoryStep/page.mdx","depth":7},{"type":"workflow","name":"createOrUpdateOrderPaymentCollectionWorkflow","description":"Create or update payment collection for an order.","link":"../core_flows.Order.Workflows_Order.createOrUpdateOrderPaymentCollectionWorkflow/page.mdx","depth":8},{"type":"step","name":"emitEventStep","description":"Emit an event.","link":"../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.emitEventStep/page.mdx","depth":9}]}} /> <WorkflowDiagram workflow={{"name":"confirmOrderEditRequestWorkflow","steps":[{"type":"step","name":"useRemoteQueryStep","description":"This step fetches data across modules using the remote query.\n\nLearn more in the [Remote Query documentation](https://docs.medusajs.com/learn/fundamentals/module-links/query).\n\n:::note\n\nThis step is deprecated. Use [useQueryGraphStep](../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.useQueryGraphStep/page.mdx) instead.\n\n:::","link":"../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.useRemoteQueryStep/page.mdx","depth":1},{"type":"step","name":"useRemoteQueryStep","description":"This step fetches data across modules using the remote query.\n\nLearn more in the [Remote Query documentation](https://docs.medusajs.com/learn/fundamentals/module-links/query).\n\n:::note\n\nThis step is deprecated. Use [useQueryGraphStep](../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.useQueryGraphStep/page.mdx) instead.\n\n:::","link":"../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.useRemoteQueryStep/page.mdx","depth":2},{"type":"step","name":"confirmOrderEditRequestValidationStep","description":"This step validates that a requested order edit can be confirmed.\nIf the order is canceled or the order change is not active, the step will throw an error.\n\n:::note\n\nYou can retrieve an order and order change details using [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query),\nor [useQueryGraphStep](https://docs.medusajs.com/resources/references/medusa-workflows/steps/useQueryGraphStep).\n\n:::","link":"../core_flows.Order.Workflows_Order.confirmOrderEditRequestValidationStep/page.mdx","depth":3},{"type":"step","name":"previewOrderChangeStep","description":"This step retrieves a preview of an order change.","link":"../../../Steps_Order/functions/core_flows.Order.Steps_Order.previewOrderChangeStep/page.mdx","depth":4},{"type":"step","name":"useRemoteQueryStep","description":"This step fetches data across modules using the remote query.\n\nLearn more in the [Remote Query documentation](https://docs.medusajs.com/learn/fundamentals/module-links/query).\n\n:::note\n\nThis step is deprecated. Use [useQueryGraphStep](../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.useQueryGraphStep/page.mdx) instead.\n\n:::","link":"../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.useRemoteQueryStep/page.mdx","depth":5},{"type":"step","name":"deleteReservationsByLineItemsStep","description":"This step deletes reservations by their associated line items.","link":"../../../../Reservation/Steps_Reservation/functions/core_flows.Reservation.Steps_Reservation.deleteReservationsByLineItemsStep/page.mdx","depth":6},{"type":"step","name":"reserveInventoryStep","description":"This step reserves the quantity of line items from the associated\nvariant's inventory.","link":"../../../../Cart/Steps_Cart/functions/core_flows.Cart.Steps_Cart.reserveInventoryStep/page.mdx","depth":7},{"type":"workflow","name":"createOrUpdateOrderPaymentCollectionWorkflow","description":"Create or update payment collection for an order.","link":"../core_flows.Order.Workflows_Order.createOrUpdateOrderPaymentCollectionWorkflow/page.mdx","depth":8}]}} />
## Input ## Input
@@ -143,57 +143,3 @@ const myWorkflow = createWorkflow(
## Output ## Output
<TypeList types={[{"name":"OrderPreviewDTO","type":"[OrderPreviewDTO](../../../../../order/interfaces/order.OrderPreviewDTO/page.mdx)","optional":false,"defaultValue":"","description":"The details of an order after a change is applied on it.","expandable":false,"children":[{"name":"id","type":"`string`","description":"The ID of the order.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"version","type":"`number`","description":"The version of the order.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"display_id","type":"`number`","description":"The order's display ID.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"status","type":"[OrderStatus](../../../../../order/types/order.OrderStatus/page.mdx)","description":"The status of the order.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"currency_code","type":"`string`","description":"The currency of the order","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"created_at","type":"`string` \\| `Date`","description":"When the order was created.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"updated_at","type":"`string` \\| `Date`","description":"When the order was updated.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"original_item_total","type":"[BigNumberValue](../../../../../order/types/order.BigNumberValue/page.mdx)","description":"The original item total of the order.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"numeric","type":"`number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"raw","type":"[BigNumberRawValue](../../../../../order/types/order.BigNumberRawValue/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"value","type":"`string` \\| `number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"bigNumber","type":"`BigNumber`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"original_item_subtotal","type":"[BigNumberValue](../../../../../order/types/order.BigNumberValue/page.mdx)","description":"The original item subtotal of the order.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"numeric","type":"`number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"raw","type":"[BigNumberRawValue](../../../../../order/types/order.BigNumberRawValue/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"value","type":"`string` \\| `number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"bigNumber","type":"`BigNumber`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"original_item_tax_total","type":"[BigNumberValue](../../../../../order/types/order.BigNumberValue/page.mdx)","description":"The original item tax total of the order.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"numeric","type":"`number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"raw","type":"[BigNumberRawValue](../../../../../order/types/order.BigNumberRawValue/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"value","type":"`string` \\| `number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"bigNumber","type":"`BigNumber`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"item_total","type":"[BigNumberValue](../../../../../order/types/order.BigNumberValue/page.mdx)","description":"The item total of the order.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"numeric","type":"`number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"raw","type":"[BigNumberRawValue](../../../../../order/types/order.BigNumberRawValue/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"value","type":"`string` \\| `number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"bigNumber","type":"`BigNumber`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"item_subtotal","type":"[BigNumberValue](../../../../../order/types/order.BigNumberValue/page.mdx)","description":"The item subtotal of the order.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"numeric","type":"`number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"raw","type":"[BigNumberRawValue](../../.Line truncated <TypeList types={[{"name":"OrderPreviewDTO","type":"[OrderPreviewDTO](../../../../../order/interfaces/order.OrderPreviewDTO/page.mdx)","optional":false,"defaultValue":"","description":"The details of an order after a change is applied on it.","expandable":false,"children":[{"name":"id","type":"`string`","description":"The ID of the order.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"version","type":"`number`","description":"The version of the order.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"display_id","type":"`number`","description":"The order's display ID.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"status","type":"[OrderStatus](../../../../../order/types/order.OrderStatus/page.mdx)","description":"The status of the order.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"currency_code","type":"`string`","description":"The currency of the order","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"created_at","type":"`string` \\| `Date`","description":"When the order was created.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"updated_at","type":"`string` \\| `Date`","description":"When the order was updated.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"original_item_total","type":"[BigNumberValue](../../../../../order/types/order.BigNumberValue/page.mdx)","description":"The original item total of the order.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"numeric","type":"`number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"raw","type":"[BigNumberRawValue](../../../../../order/types/order.BigNumberRawValue/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"value","type":"`string` \\| `number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"bigNumber","type":"`BigNumber`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"original_item_subtotal","type":"[BigNumberValue](../../../../../order/types/order.BigNumberValue/page.mdx)","description":"The original item subtotal of the order.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"numeric","type":"`number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"raw","type":"[BigNumberRawValue](../../../../../order/types/order.BigNumberRawValue/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"value","type":"`string` \\| `number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"bigNumber","type":"`BigNumber`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"original_item_tax_total","type":"[BigNumberValue](../../../../../order/types/order.BigNumberValue/page.mdx)","description":"The original item tax total of the order.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"numeric","type":"`number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"raw","type":"[BigNumberRawValue](../../../../../order/types/order.BigNumberRawValue/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"value","type":"`string` \\| `number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"bigNumber","type":"`BigNumber`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"item_total","type":"[BigNumberValue](../../../../../order/types/order.BigNumberValue/page.mdx)","description":"The item total of the order.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"numeric","type":"`number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"raw","type":"[BigNumberRawValue](../../../../../order/types/order.BigNumberRawValue/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"value","type":"`string` \\| `number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"bigNumber","type":"`BigNumber`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"item_subtotal","type":"[BigNumberValue](../../../../../order/types/order.BigNumberValue/page.mdx)","description":"The item subtotal of the order.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"numeric","type":"`number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"raw","type":"[BigNumberRawValue](../../.Line truncated
## 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.
You can listen to these events in a subscriber, as explained in the [Subscribers](https://docs.medusajs.com/learn/fundamentals/events-and-subscribers) documentation.
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>
Event
</Table.HeaderCell>
<Table.HeaderCell>
Description
</Table.HeaderCell>
<Table.HeaderCell>
Payload
</Table.HeaderCell>
<Table.HeaderCell>
Action
</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`order-edit.confirmed`
</Table.Cell>
<Table.Cell>
Emitted when an order edit request is confirmed.
</Table.Cell>
<Table.Cell>
```ts blockStyle="inline"
{
order_id, // The ID of the order
actions, // (array) The [actions](https://docs.medusajs.com/resources/references/fulfillment/interfaces/fulfillment.OrderChangeActionDTO) to edit the order
}
```
</Table.Cell>
<Table.Cell>
<CopyGeneratedSnippetButton tooltipText="Copy subscriber for event" type="subscriber" options={{
event: "order-edit.confirmed",
payload: `\`\`\`ts
{
order_id, // The ID of the order
actions, // (array) The [actions](https://docs.medusajs.com/resources/references/fulfillment/interfaces/fulfillment.OrderChangeActionDTO) to edit the order
}
\`\`\``
}}/>
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
@@ -130,7 +130,7 @@ const myWorkflow = createWorkflow(
## Steps ## Steps
<WorkflowDiagram workflow={{"name":"requestOrderEditRequestWorkflow","steps":[{"type":"step","name":"useRemoteQueryStep","description":"This step fetches data across modules using the remote query.\n\nLearn more in the [Remote Query documentation](https://docs.medusajs.com/learn/fundamentals/module-links/query).\n\n:::note\n\nThis step is deprecated. Use [useQueryGraphStep](../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.useQueryGraphStep/page.mdx) instead.\n\n:::","link":"../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.useRemoteQueryStep/page.mdx","depth":1},{"type":"step","name":"useRemoteQueryStep","description":"This step fetches data across modules using the remote query.\n\nLearn more in the [Remote Query documentation](https://docs.medusajs.com/learn/fundamentals/module-links/query).\n\n:::note\n\nThis step is deprecated. Use [useQueryGraphStep](../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.useQueryGraphStep/page.mdx) instead.\n\n:::","link":"../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.useRemoteQueryStep/page.mdx","depth":2},{"type":"step","name":"requestOrderEditRequestValidationStep","description":"This step validates that a order edit can be requested.\nIf the order is canceled or the order change is not active, the step will throw an error.\n\n:::note\n\nYou can retrieve an order and order change details using [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query),\nor [useQueryGraphStep](https://docs.medusajs.com/resources/references/medusa-workflows/steps/useQueryGraphStep).\n\n:::","link":"../core_flows.Order.Workflows_Order.requestOrderEditRequestValidationStep/page.mdx","depth":3},{"type":"step","name":"updateOrderChangesStep","description":"This step updates order change.","link":"../../../Steps_Order/functions/core_flows.Order.Steps_Order.updateOrderChangesStep/page.mdx","depth":4},{"type":"step","name":"emitEventStep","description":"Emit an event.","link":"../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.emitEventStep/page.mdx","depth":5},{"type":"step","name":"previewOrderChangeStep","description":"This step retrieves a preview of an order change.","link":"../../../Steps_Order/functions/core_flows.Order.Steps_Order.previewOrderChangeStep/page.mdx","depth":6}]}} /> <WorkflowDiagram workflow={{"name":"requestOrderEditRequestWorkflow","steps":[{"type":"step","name":"useRemoteQueryStep","description":"This step fetches data across modules using the remote query.\n\nLearn more in the [Remote Query documentation](https://docs.medusajs.com/learn/fundamentals/module-links/query).\n\n:::note\n\nThis step is deprecated. Use [useQueryGraphStep](../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.useQueryGraphStep/page.mdx) instead.\n\n:::","link":"../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.useRemoteQueryStep/page.mdx","depth":1},{"type":"step","name":"useRemoteQueryStep","description":"This step fetches data across modules using the remote query.\n\nLearn more in the [Remote Query documentation](https://docs.medusajs.com/learn/fundamentals/module-links/query).\n\n:::note\n\nThis step is deprecated. Use [useQueryGraphStep](../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.useQueryGraphStep/page.mdx) instead.\n\n:::","link":"../../../../Common/Steps_Common/functions/core_flows.Common.Steps_Common.useRemoteQueryStep/page.mdx","depth":2},{"type":"step","name":"requestOrderEditRequestValidationStep","description":"This step validates that a order edit can be requested.\nIf the order is canceled or the order change is not active, the step will throw an error.\n\n:::note\n\nYou can retrieve an order and order change details using [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query),\nor [useQueryGraphStep](https://docs.medusajs.com/resources/references/medusa-workflows/steps/useQueryGraphStep).\n\n:::","link":"../core_flows.Order.Workflows_Order.requestOrderEditRequestValidationStep/page.mdx","depth":3},{"type":"step","name":"updateOrderChangesStep","description":"This step updates order change.","link":"../../../Steps_Order/functions/core_flows.Order.Steps_Order.updateOrderChangesStep/page.mdx","depth":4},{"type":"step","name":"previewOrderChangeStep","description":"This step retrieves a preview of an order change.","link":"../../../Steps_Order/functions/core_flows.Order.Steps_Order.previewOrderChangeStep/page.mdx","depth":5}]}} />
## Input ## Input
@@ -139,57 +139,3 @@ const myWorkflow = createWorkflow(
## Output ## Output
<TypeList types={[{"name":"OrderPreviewDTO","type":"[OrderPreviewDTO](../../../../../order/interfaces/order.OrderPreviewDTO/page.mdx)","optional":false,"defaultValue":"","description":"The details of an order after a change is applied on it.","expandable":false,"children":[{"name":"id","type":"`string`","description":"The ID of the order.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"version","type":"`number`","description":"The version of the order.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"display_id","type":"`number`","description":"The order's display ID.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"status","type":"[OrderStatus](../../../../../order/types/order.OrderStatus/page.mdx)","description":"The status of the order.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"currency_code","type":"`string`","description":"The currency of the order","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"created_at","type":"`string` \\| `Date`","description":"When the order was created.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"updated_at","type":"`string` \\| `Date`","description":"When the order was updated.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"original_item_total","type":"[BigNumberValue](../../../../../order/types/order.BigNumberValue/page.mdx)","description":"The original item total of the order.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"numeric","type":"`number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"raw","type":"[BigNumberRawValue](../../../../../order/types/order.BigNumberRawValue/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"value","type":"`string` \\| `number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"bigNumber","type":"`BigNumber`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"original_item_subtotal","type":"[BigNumberValue](../../../../../order/types/order.BigNumberValue/page.mdx)","description":"The original item subtotal of the order.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"numeric","type":"`number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"raw","type":"[BigNumberRawValue](../../../../../order/types/order.BigNumberRawValue/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"value","type":"`string` \\| `number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"bigNumber","type":"`BigNumber`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"original_item_tax_total","type":"[BigNumberValue](../../../../../order/types/order.BigNumberValue/page.mdx)","description":"The original item tax total of the order.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"numeric","type":"`number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"raw","type":"[BigNumberRawValue](../../../../../order/types/order.BigNumberRawValue/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"value","type":"`string` \\| `number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"bigNumber","type":"`BigNumber`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"item_total","type":"[BigNumberValue](../../../../../order/types/order.BigNumberValue/page.mdx)","description":"The item total of the order.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"numeric","type":"`number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"raw","type":"[BigNumberRawValue](../../../../../order/types/order.BigNumberRawValue/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"value","type":"`string` \\| `number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"bigNumber","type":"`BigNumber`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"item_subtotal","type":"[BigNumberValue](../../../../../order/types/order.BigNumberValue/page.mdx)","description":"The item subtotal of the order.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"numeric","type":"`number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"raw","type":"[BigNumberRawValue](../../.Line truncated <TypeList types={[{"name":"OrderPreviewDTO","type":"[OrderPreviewDTO](../../../../../order/interfaces/order.OrderPreviewDTO/page.mdx)","optional":false,"defaultValue":"","description":"The details of an order after a change is applied on it.","expandable":false,"children":[{"name":"id","type":"`string`","description":"The ID of the order.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"version","type":"`number`","description":"The version of the order.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"display_id","type":"`number`","description":"The order's display ID.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"status","type":"[OrderStatus](../../../../../order/types/order.OrderStatus/page.mdx)","description":"The status of the order.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"currency_code","type":"`string`","description":"The currency of the order","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"created_at","type":"`string` \\| `Date`","description":"When the order was created.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"updated_at","type":"`string` \\| `Date`","description":"When the order was updated.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"original_item_total","type":"[BigNumberValue](../../../../../order/types/order.BigNumberValue/page.mdx)","description":"The original item total of the order.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"numeric","type":"`number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"raw","type":"[BigNumberRawValue](../../../../../order/types/order.BigNumberRawValue/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"value","type":"`string` \\| `number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"bigNumber","type":"`BigNumber`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"original_item_subtotal","type":"[BigNumberValue](../../../../../order/types/order.BigNumberValue/page.mdx)","description":"The original item subtotal of the order.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"numeric","type":"`number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"raw","type":"[BigNumberRawValue](../../../../../order/types/order.BigNumberRawValue/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"value","type":"`string` \\| `number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"bigNumber","type":"`BigNumber`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"original_item_tax_total","type":"[BigNumberValue](../../../../../order/types/order.BigNumberValue/page.mdx)","description":"The original item tax total of the order.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"numeric","type":"`number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"raw","type":"[BigNumberRawValue](../../../../../order/types/order.BigNumberRawValue/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"value","type":"`string` \\| `number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"bigNumber","type":"`BigNumber`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"item_total","type":"[BigNumberValue](../../../../../order/types/order.BigNumberValue/page.mdx)","description":"The item total of the order.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"numeric","type":"`number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"raw","type":"[BigNumberRawValue](../../../../../order/types/order.BigNumberRawValue/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"value","type":"`string` \\| `number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"bigNumber","type":"`BigNumber`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"item_subtotal","type":"[BigNumberValue](../../../../../order/types/order.BigNumberValue/page.mdx)","description":"The item subtotal of the order.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"numeric","type":"`number`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"raw","type":"[BigNumberRawValue](../../.Line truncated
## 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.
You can listen to these events in a subscriber, as explained in the [Subscribers](https://docs.medusajs.com/learn/fundamentals/events-and-subscribers) documentation.
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>
Event
</Table.HeaderCell>
<Table.HeaderCell>
Description
</Table.HeaderCell>
<Table.HeaderCell>
Payload
</Table.HeaderCell>
<Table.HeaderCell>
Action
</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`order-edit.requested`
</Table.Cell>
<Table.Cell>
Emitted when an order edit is requested.
</Table.Cell>
<Table.Cell>
```ts blockStyle="inline"
{
order_id, // The ID of the order
actions, // (array) The [actions](https://docs.medusajs.com/resources/references/fulfillment/interfaces/fulfillment.OrderChangeActionDTO) to edit the order
}
```
</Table.Cell>
<Table.Cell>
<CopyGeneratedSnippetButton tooltipText="Copy subscriber for event" type="subscriber" options={{
event: "order-edit.requested",
payload: `\`\`\`ts
{
order_id, // The ID of the order
actions, // (array) The [actions](https://docs.medusajs.com/resources/references/fulfillment/interfaces/fulfillment.OrderChangeActionDTO) to edit the order
}
\`\`\``
}}/>
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
@@ -37,14 +37,6 @@ Emitted when a cart is created.
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Emitted when a cart's details are updated. Emitted when a cart's details are updated.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[cart.customer_updated](#cartcustomer_updated)
</Table.Cell>
<Table.Cell>
Emitted when the customer in the cart is updated.
</Table.Cell> </Table.Cell>
</Table.Row> </Table.Row>
<Table.Row> <Table.Row>
@@ -110,30 +102,6 @@ The following workflows emit this event when they're executed. These workflows a
--- ---
<EventHeader headerLvl="2" headerProps={{ id: "cartcustomer_updated", children: (<>cart.customer_updated</>), className: "flex flex-wrap justify-center gap-docs_0.25" }} eventName="cart.customer_updated" payload={`\`\`\`ts
{
id, // The ID of the cart
}
\`\`\``} />
Emitted when the customer in the cart is updated.
### Payload
```ts
{
id, // The ID of the cart
}
```
### Workflows Emitting this Event
The following workflows emit this event when they're executed. These workflows are executed by Medusa's API routes. You can also view the events emitted by API routes in the [Store](https://docs.medusajs.com/api/store) and [Admin](https://docs.medusajs.com/api/admin) API references.
- [updateCartWorkflow](/references/medusa-workflows/updateCartWorkflow)
---
<EventHeader headerLvl="2" headerProps={{ id: "cartregion_updated", children: (<>cart.region_updated</>), className: "flex flex-wrap justify-center gap-docs_0.25" }} eventName="cart.region_updated" payload={`\`\`\`ts <EventHeader headerLvl="2" headerProps={{ id: "cartregion_updated", children: (<>cart.region_updated</>), className: "flex flex-wrap justify-center gap-docs_0.25" }} eventName="cart.region_updated" payload={`\`\`\`ts
{ {
id, // The ID of the cart id, // The ID of the cart
@@ -438,124 +438,3 @@ another customer.
The following workflows emit this event when they're executed. These workflows are executed by Medusa's API routes. You can also view the events emitted by API routes in the [Store](https://docs.medusajs.com/api/store) and [Admin](https://docs.medusajs.com/api/admin) API references. The following workflows emit this event when they're executed. These workflows are executed by Medusa's API routes. You can also view the events emitted by API routes in the [Store](https://docs.medusajs.com/api/store) and [Admin](https://docs.medusajs.com/api/admin) API references.
- [requestOrderTransferWorkflow](/references/medusa-workflows/requestOrderTransferWorkflow) - [requestOrderTransferWorkflow](/references/medusa-workflows/requestOrderTransferWorkflow)
---
## Order Edit Events
### Summary
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>
Event
</Table.HeaderCell>
<Table.HeaderCell>
Description
</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
[order-edit.requested](#order-editrequested)
</Table.Cell>
<Table.Cell>
Emitted when an order edit is requested.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[order-edit.confirmed](#order-editconfirmed)
</Table.Cell>
<Table.Cell>
Emitted when an order edit request is confirmed.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[order-edit.canceled](#order-editcanceled)
</Table.Cell>
<Table.Cell>
Emitted when an order edit request is canceled.
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
<EventHeader headerLvl="3" headerProps={{ id: "order-editrequested", children: (<>order-edit.requested</>), className: "flex flex-wrap justify-center gap-docs_0.25" }} eventName="order-edit.requested" payload={`\`\`\`ts
{
order_id, // The ID of the order
actions, // (array) The [actions](https://docs.medusajs.com/resources/references/fulfillment/interfaces/fulfillment.OrderChangeActionDTO) to edit the order
}
\`\`\``} />
Emitted when an order edit is requested.
#### Payload
```ts
{
order_id, // The ID of the order
actions, // (array) The [actions](https://docs.medusajs.com/resources/references/fulfillment/interfaces/fulfillment.OrderChangeActionDTO) to edit the order
}
```
#### Workflows Emitting this Event
The following workflows emit this event when they're executed. These workflows are executed by Medusa's API routes. You can also view the events emitted by API routes in the [Store](https://docs.medusajs.com/api/store) and [Admin](https://docs.medusajs.com/api/admin) API references.
- [requestOrderEditRequestWorkflow](/references/medusa-workflows/requestOrderEditRequestWorkflow)
---
<EventHeader headerLvl="3" headerProps={{ id: "order-editconfirmed", children: (<>order-edit.confirmed</>), className: "flex flex-wrap justify-center gap-docs_0.25" }} eventName="order-edit.confirmed" payload={`\`\`\`ts
{
order_id, // The ID of the order
actions, // (array) The [actions](https://docs.medusajs.com/resources/references/fulfillment/interfaces/fulfillment.OrderChangeActionDTO) to edit the order
}
\`\`\``} />
Emitted when an order edit request is confirmed.
#### Payload
```ts
{
order_id, // The ID of the order
actions, // (array) The [actions](https://docs.medusajs.com/resources/references/fulfillment/interfaces/fulfillment.OrderChangeActionDTO) to edit the order
}
```
#### Workflows Emitting this Event
The following workflows emit this event when they're executed. These workflows are executed by Medusa's API routes. You can also view the events emitted by API routes in the [Store](https://docs.medusajs.com/api/store) and [Admin](https://docs.medusajs.com/api/admin) API references.
- [confirmOrderEditRequestWorkflow](/references/medusa-workflows/confirmOrderEditRequestWorkflow)
---
<EventHeader headerLvl="3" headerProps={{ id: "order-editcanceled", children: (<>order-edit.canceled</>), className: "flex flex-wrap justify-center gap-docs_0.25" }} eventName="order-edit.canceled" payload={`\`\`\`ts
{
order_id, // The ID of the order
actions, // (array) The [actions](https://docs.medusajs.com/resources/references/fulfillment/interfaces/fulfillment.OrderChangeActionDTO) to edit the order
}
\`\`\``} />
Emitted when an order edit request is canceled.
#### Payload
```ts
{
order_id, // The ID of the order
actions, // (array) The [actions](https://docs.medusajs.com/resources/references/fulfillment/interfaces/fulfillment.OrderChangeActionDTO) to edit the order
}
```
#### Workflows Emitting this Event
The following workflows emit this event when they're executed. These workflows are executed by Medusa's API routes. You can also view the events emitted by API routes in the [Store](https://docs.medusajs.com/api/store) and [Admin](https://docs.medusajs.com/api/admin) API references.
- [cancelBeginOrderEditWorkflow](/references/medusa-workflows/cancelBeginOrderEditWorkflow)
@@ -39,14 +39,6 @@ Emitted when a cart is created.
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
Emitted when a cart's details are updated. Emitted when a cart's details are updated.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[cart.customer_updated](#cartcustomer_updated)
</Table.Cell>
<Table.Cell>
Emitted when the customer in the cart is updated.
</Table.Cell> </Table.Cell>
</Table.Row> </Table.Row>
<Table.Row> <Table.Row>
@@ -112,30 +104,6 @@ The following workflows emit this event when they're executed. These workflows a
--- ---
<EventHeader headerLvl="3" headerProps={{ id: "cartcustomer_updated", children: (<>cart.customer_updated</>), className: "flex flex-wrap justify-center gap-docs_0.25" }} eventName="cart.customer_updated" payload={`\`\`\`ts
{
id, // The ID of the cart
}
\`\`\``} />
Emitted when the customer in the cart is updated.
#### Payload
```ts
{
id, // The ID of the cart
}
```
#### Workflows Emitting this Event
The following workflows emit this event when they're executed. These workflows are executed by Medusa's API routes. You can also view the events emitted by API routes in the [Store](https://docs.medusajs.com/api/store) and [Admin](https://docs.medusajs.com/api/admin) API references.
- [updateCartWorkflow](/references/medusa-workflows/updateCartWorkflow)
---
<EventHeader headerLvl="3" headerProps={{ id: "cartregion_updated", children: (<>cart.region_updated</>), className: "flex flex-wrap justify-center gap-docs_0.25" }} eventName="cart.region_updated" payload={`\`\`\`ts <EventHeader headerLvl="3" headerProps={{ id: "cartregion_updated", children: (<>cart.region_updated</>), className: "flex flex-wrap justify-center gap-docs_0.25" }} eventName="cart.region_updated" payload={`\`\`\`ts
{ {
id, // The ID of the cart id, // The ID of the cart
@@ -710,125 +678,6 @@ The following workflows emit this event when they're executed. These workflows a
--- ---
## Order Edit Events
### Summary
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>
Event
</Table.HeaderCell>
<Table.HeaderCell>
Description
</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
[order-edit.requested](#order-editrequested)
</Table.Cell>
<Table.Cell>
Emitted when an order edit is requested.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[order-edit.confirmed](#order-editconfirmed)
</Table.Cell>
<Table.Cell>
Emitted when an order edit request is confirmed.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[order-edit.canceled](#order-editcanceled)
</Table.Cell>
<Table.Cell>
Emitted when an order edit request is canceled.
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
<EventHeader headerLvl="3" headerProps={{ id: "order-editrequested", children: (<>order-edit.requested</>), className: "flex flex-wrap justify-center gap-docs_0.25" }} eventName="order-edit.requested" payload={`\`\`\`ts
{
order_id, // The ID of the order
actions, // (array) The [actions](https://docs.medusajs.com/resources/references/fulfillment/interfaces/fulfillment.OrderChangeActionDTO) to edit the order
}
\`\`\``} />
Emitted when an order edit is requested.
#### Payload
```ts
{
order_id, // The ID of the order
actions, // (array) The [actions](https://docs.medusajs.com/resources/references/fulfillment/interfaces/fulfillment.OrderChangeActionDTO) to edit the order
}
```
#### Workflows Emitting this Event
The following workflows emit this event when they're executed. These workflows are executed by Medusa's API routes. You can also view the events emitted by API routes in the [Store](https://docs.medusajs.com/api/store) and [Admin](https://docs.medusajs.com/api/admin) API references.
- [requestOrderEditRequestWorkflow](/references/medusa-workflows/requestOrderEditRequestWorkflow)
---
<EventHeader headerLvl="3" headerProps={{ id: "order-editconfirmed", children: (<>order-edit.confirmed</>), className: "flex flex-wrap justify-center gap-docs_0.25" }} eventName="order-edit.confirmed" payload={`\`\`\`ts
{
order_id, // The ID of the order
actions, // (array) The [actions](https://docs.medusajs.com/resources/references/fulfillment/interfaces/fulfillment.OrderChangeActionDTO) to edit the order
\`\`\``} />
Emitted when an order edit request is confirmed.
#### Payload
```ts
{
order_id, // The ID of the order
actions, // (array) The [actions](https://docs.medusajs.com/resources/references/fulfillment/interfaces/fulfillment.OrderChangeActionDTO) to edit the order
```
#### Workflows Emitting this Event
The following workflows emit this event when they're executed. These workflows are executed by Medusa's API routes. You can also view the events emitted by API routes in the [Store](https://docs.medusajs.com/api/store) and [Admin](https://docs.medusajs.com/api/admin) API references.
- [confirmOrderEditRequestWorkflow](/references/medusa-workflows/confirmOrderEditRequestWorkflow)
---
<EventHeader headerLvl="3" headerProps={{ id: "order-editcanceled", children: (<>order-edit.canceled</>), className: "flex flex-wrap justify-center gap-docs_0.25" }} eventName="order-edit.canceled" payload={`\`\`\`ts
{
order_id, // The ID of the order
actions, // (array) The [actions](https://docs.medusajs.com/resources/references/fulfillment/interfaces/fulfillment.OrderChangeActionDTO) to edit the order
}
\`\`\``} />
Emitted when an order edit request is canceled.
#### Payload
```ts
{
order_id, // The ID of the order
actions, // (array) The [actions](https://docs.medusajs.com/resources/references/fulfillment/interfaces/fulfillment.OrderChangeActionDTO) to edit the order
}
```
#### Workflows Emitting this Event
The following workflows emit this event when they're executed. These workflows are executed by Medusa's API routes. You can also view the events emitted by API routes in the [Store](https://docs.medusajs.com/api/store) and [Admin](https://docs.medusajs.com/api/admin) API references.
- [cancelBeginOrderEditWorkflow](/references/medusa-workflows/cancelBeginOrderEditWorkflow)
---
## User Events ## User Events
### Summary ### Summary
+1 -12
View File
@@ -24,17 +24,6 @@
], ],
"deprecated": false "deprecated": false
}, },
{
"name": "cart.customer_updated",
"parentName": "CartWorkflowEvents",
"propertyName": "CUSTOMER_UPDATED",
"payload": "```ts\n{\n id, // The ID of the cart\n}\n```",
"description": "Emitted when the customer in the cart is updated.",
"workflows": [
"updateCartWorkflow"
],
"deprecated": false
},
{ {
"name": "cart.region_updated", "name": "cart.region_updated",
"parentName": "CartWorkflowEvents", "parentName": "CartWorkflowEvents",
@@ -233,7 +222,7 @@
"name": "order-edit.confirmed", "name": "order-edit.confirmed",
"parentName": "OrderEditWorkflowEvents", "parentName": "OrderEditWorkflowEvents",
"propertyName": "CONFIRMED", "propertyName": "CONFIRMED",
"payload": "```ts\n{\n order_id, // The ID of the order\n actions, // (array) The [actions](https://docs.medusajs.com/resources/references/fulfillment/interfaces/fulfillment.OrderChangeActionDTO) to edit the order\n}\n```", "payload": "```ts\n{\n order_id, // The ID of the order\n actions, // (array) The [actions](https://docs.medusajs.com/resources/references/fulfillment/interfaces/fulfillment.OrderChangeActionDTO) to edit the order\n```",
"description": "Emitted when an order edit request is confirmed.", "description": "Emitted when an order edit request is confirmed.",
"workflows": [ "workflows": [
"confirmOrderEditRequestWorkflow" "confirmOrderEditRequestWorkflow"
@@ -79,17 +79,6 @@
* "500": * "500":
* $ref: "#/components/responses/500_error" * $ref: "#/components/responses/500_error"
* x-workflow: cancelBeginOrderEditWorkflow * x-workflow: cancelBeginOrderEditWorkflow
* x-events:
* - name: order-edit.canceled
* payload: |-
* ```ts
* {
* order_id, // The ID of the order
* actions, // (array) The [actions](https://docs.medusajs.com/resources/references/fulfillment/interfaces/fulfillment.OrderChangeActionDTO) to edit the order
* }
* ```
* description: Emitted when an order edit request is canceled.
* deprecated: false
* *
*/ */
@@ -60,16 +60,6 @@
* "500": * "500":
* $ref: "#/components/responses/500_error" * $ref: "#/components/responses/500_error"
* x-workflow: confirmOrderEditRequestWorkflow * x-workflow: confirmOrderEditRequestWorkflow
* x-events:
* - name: order-edit.confirmed
* payload: |-
* ```ts
* {
* order_id, // The ID of the order
* actions, // (array) The [actions](https://docs.medusajs.com/resources/references/fulfillment/interfaces/fulfillment.OrderChangeActionDTO) to edit the order
* ```
* description: Emitted when an order edit request is confirmed.
* deprecated: false
* *
*/ */
@@ -60,17 +60,6 @@
* "500": * "500":
* $ref: "#/components/responses/500_error" * $ref: "#/components/responses/500_error"
* x-workflow: requestOrderEditRequestWorkflow * x-workflow: requestOrderEditRequestWorkflow
* x-events:
* - name: order-edit.requested
* payload: |-
* ```ts
* {
* order_id, // The ID of the order
* actions, // (array) The [actions](https://docs.medusajs.com/resources/references/fulfillment/interfaces/fulfillment.OrderChangeActionDTO) to edit the order
* }
* ```
* description: Emitted when an order edit is requested.
* deprecated: false
* *
*/ */
@@ -113,15 +113,6 @@
* ``` * ```
* description: Emitted when a cart's details are updated. * description: Emitted when a cart's details are updated.
* deprecated: false * deprecated: false
* - name: cart.customer_updated
* payload: |-
* ```ts
* {
* id, // The ID of the cart
* }
* ```
* description: Emitted when the customer in the cart is updated.
* deprecated: false
* - name: cart.region_updated * - name: cart.region_updated
* payload: |- * payload: |-
* ```ts * ```ts
@@ -124,8 +124,18 @@ class EventsKindGenerator extends DefaultKindGenerator<ts.VariableDeclaration> {
} }
this.workflows[workflowName] = workflowFile this.workflows[workflowName] = workflowFile
if (workflowFile.includes("emitEventStep")) { // remove comments in case the emitEventStep is commented out
this.workflowsEmittingEvents[workflowName] = workflowFile const workflowWithoutComments = workflowFile.replace(
/\/\*[\s\S]*?\*\/|\/\/.*/g,
""
)
// the emitEventStep should be mentioned at least twice in the workflow
// including the import statement
const emitEventStepCount = (
workflowWithoutComments.match(/emitEventStep/g) || []
).length
if (emitEventStepCount >= 2) {
this.workflowsEmittingEvents[workflowName] = workflowWithoutComments
} }
} }
} }
@@ -116,6 +116,21 @@ function formatEventsType(
} }
} }
const versionTag = event.comment?.blockTags.find(
(tag) => tag.tag === "@version"
)
if (versionTag) {
eventName += `\n`
const versionText = versionTag.content
.map((content) => content.text)
.join("")
.trim()
eventName += `<Tooltip text="This event was added in version v${versionText}">`
eventName += `<Badge variant="blue">v${versionText}</Badge>`
eventName += `</Tooltip>`
}
content.push(` <Table.Row>`) content.push(` <Table.Row>`)
content.push(` <Table.Cell>\n${eventName}\n</Table.Cell>`) content.push(` <Table.Cell>\n${eventName}\n</Table.Cell>`)
content.push(` <Table.Cell>\n${eventDescription}\n</Table.Cell>`) content.push(` <Table.Cell>\n${eventDescription}\n</Table.Cell>`)
@@ -152,6 +167,10 @@ function formatEventsType(
.join("") .join("")
.trim() .trim()
const versionTag = event.comment?.blockTags.find(
(tag) => tag.tag === "@version"
)
content.push( content.push(
getEventHeading({ getEventHeading({
titleLevel: subtitleLevel, titleLevel: subtitleLevel,
@@ -159,6 +178,12 @@ function formatEventsType(
payload: eventPayload || "", payload: eventPayload || "",
deprecated: !!deprecatedTag, deprecated: !!deprecatedTag,
deprecatedMessage, deprecatedMessage,
version: versionTag
? versionTag.content
.map((content) => content.text)
.join("")
.trim()
: undefined,
}) })
) )
content.push("") content.push("")
@@ -191,12 +216,14 @@ function getEventHeading({
payload, payload,
deprecated = false, deprecated = false,
deprecatedMessage, deprecatedMessage,
version,
}: { }: {
titleLevel: number titleLevel: number
eventName: string eventName: string
payload: string payload: string
deprecated?: boolean deprecated?: boolean
deprecatedMessage?: string deprecatedMessage?: string
version?: string
}) { }) {
const heading = [eventName] const heading = [eventName]
if (deprecated) { if (deprecated) {
@@ -210,6 +237,14 @@ function getEventHeading({
heading.push(`</Tooltip>`) heading.push(`</Tooltip>`)
} }
} }
if (version) {
if (deprecated) {
heading.push(`\n`)
}
heading.push(`<Tooltip text="This event was added in version v${version}">`)
heading.push(`<Badge variant="blue">v${version}</Badge>`)
heading.push(`</Tooltip>`)
}
return `<EventHeader headerLvl="${titleLevel}" headerProps={{ id: "${getEventNameSlug( return `<EventHeader headerLvl="${titleLevel}" headerProps={{ id: "${getEventNameSlug(
eventName eventName
)}", children: (<>${heading.join( )}", children: (<>${heading.join(
@@ -41,10 +41,24 @@ export default function () {
const eventPayloadFormatted = eventPayload const eventPayloadFormatted = eventPayload
.replace("```ts\n", "") .replace("```ts\n", "")
.replace("\n```", "") .replace("\n```", "")
const isDeprecated = commentContent.length >= 4 const isDeprecatedOrHasVersion = commentContent.length >= 4
const deprecatedIndex = isDeprecatedOrHasVersion
? commentContent.slice(3).findIndex((c) => c.trim() === "deprecated")
: -1
const isDeprecated = deprecatedIndex !== -1
const deprecatedText = (
isDeprecated ? commentContent[3 + deprecatedIndex] || "" : ""
).trim()
const version = isDeprecatedOrHasVersion
? commentContent
.slice(3)
.find((c) => c.trim().startsWith("version: "))
: undefined
const versionText = (
version ? version.replace("version: ", "") : ""
).trim()
if (isDeprecated) { if (isDeprecated) {
const deprecatedText = commentContent[4]?.trim()
eventNameFormatted += `\n` eventNameFormatted += `\n`
if (deprecatedText) { if (deprecatedText) {
eventNameFormatted += `<Tooltip text="${deprecatedText}">` eventNameFormatted += `<Tooltip text="${deprecatedText}">`
@@ -55,6 +69,13 @@ export default function () {
} }
} }
if (versionText) {
eventNameFormatted += `\n\n`
eventNameFormatted += `<Tooltip text="This event was added in version v${versionText}">`
eventNameFormatted += `<Badge variant="blue">v${versionText}</Badge>`
eventNameFormatted += `</Tooltip>\n`
}
str += ` <Table.Row>\n` str += ` <Table.Row>\n`
str += ` <Table.Cell>\n${eventNameFormatted}\n</Table.Cell>\n` str += ` <Table.Cell>\n${eventNameFormatted}\n</Table.Cell>\n`
str += ` <Table.Cell>\n${eventDescription}\n</Table.Cell>\n` str += ` <Table.Cell>\n${eventDescription}\n</Table.Cell>\n`
@@ -915,6 +915,12 @@ class WorkflowsPlugin {
commentText += ` -- ${event.deprecated_message}` commentText += ` -- ${event.deprecated_message}`
} }
} }
if (event.version) {
commentText += ` -- version: ${event.version}`
}
if (event.name === "order-edit.canceled") {
console.log(event, commentText)
}
return new CommentTag(`@workflowEvent`, [ return new CommentTag(`@workflowEvent`, [
{ {
kind: "text", kind: "text",