docs-util: add events to workflows reference (#12376)
This commit is contained in:
@@ -8,6 +8,8 @@ import {
|
||||
CodeTabs,
|
||||
CodeTab,
|
||||
Table,
|
||||
Badge,
|
||||
Tooltip,
|
||||
} from "docs-ui"
|
||||
import { CommerceModuleSections } from "../CommerceModuleSections"
|
||||
|
||||
@@ -21,6 +23,8 @@ const MDXComponents: MDXComponentsType = {
|
||||
CodeTabs,
|
||||
CodeTab,
|
||||
Table,
|
||||
Badge,
|
||||
Tooltip,
|
||||
}
|
||||
|
||||
export default MDXComponents
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"name": "cart.created",
|
||||
"parentName": "CartWorkflowEvents",
|
||||
"propertyName": "CREATED",
|
||||
"payload": "{\n id, // The ID of the cart\n}",
|
||||
"payload": "```ts\n{\n id, // The ID of the cart\n}\n```",
|
||||
"description": "Emitted when a cart is created.",
|
||||
"workflows": [
|
||||
"createCartWorkflow"
|
||||
@@ -14,7 +14,7 @@
|
||||
"name": "cart.updated",
|
||||
"parentName": "CartWorkflowEvents",
|
||||
"propertyName": "UPDATED",
|
||||
"payload": "{\n id, // The ID of the cart\n}",
|
||||
"payload": "```ts\n{\n id, // The ID of the cart\n}\n```",
|
||||
"description": "Emitted when a cart's details are updated.",
|
||||
"workflows": [
|
||||
"updateLineItemInCartWorkflow",
|
||||
@@ -28,7 +28,7 @@
|
||||
"name": "cart.customer_updated",
|
||||
"parentName": "CartWorkflowEvents",
|
||||
"propertyName": "CUSTOMER_UPDATED",
|
||||
"payload": "{\n id, // The ID of the cart\n}",
|
||||
"payload": "```ts\n{\n id, // The ID of the cart\n}\n```",
|
||||
"description": "Emitted when the customer in the cart is updated.",
|
||||
"workflows": [
|
||||
"updateCartWorkflow"
|
||||
@@ -39,7 +39,8 @@
|
||||
"name": "cart.region_updated",
|
||||
"parentName": "CartWorkflowEvents",
|
||||
"propertyName": "REGION_UPDATED",
|
||||
"payload": "{\n id, // The ID of the cart\n}",
|
||||
"payload": "```ts\n{\n id, // The ID of the cart\n}\n```",
|
||||
"description": "Emitted when the cart's region is updated. This\nevent is emitted alongside the `cart.updated` event.",
|
||||
"workflows": [
|
||||
"updateCartWorkflow"
|
||||
],
|
||||
@@ -49,7 +50,7 @@
|
||||
"name": "customer.created",
|
||||
"parentName": "CustomerWorkflowEvents",
|
||||
"propertyName": "CREATED",
|
||||
"payload": "[{\n id, // The ID of the customer\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the customer\n}]\n```",
|
||||
"description": "Emitted when a customer is created.",
|
||||
"workflows": [
|
||||
"createCustomersWorkflow",
|
||||
@@ -61,7 +62,7 @@
|
||||
"name": "customer.updated",
|
||||
"parentName": "CustomerWorkflowEvents",
|
||||
"propertyName": "UPDATED",
|
||||
"payload": "[{\n id, // The ID of the customer\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the customer\n}]\n```",
|
||||
"description": "Emitted when a customer is updated.",
|
||||
"workflows": [
|
||||
"updateCustomersWorkflow"
|
||||
@@ -72,7 +73,7 @@
|
||||
"name": "customer.deleted",
|
||||
"parentName": "CustomerWorkflowEvents",
|
||||
"propertyName": "DELETED",
|
||||
"payload": "[{\n id, // The ID of the customer\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the customer\n}]\n```",
|
||||
"description": "Emitted when a customer is deleted.",
|
||||
"workflows": [
|
||||
"deleteCustomersWorkflow",
|
||||
@@ -84,7 +85,7 @@
|
||||
"name": "order.updated",
|
||||
"parentName": "OrderWorkflowEvents",
|
||||
"propertyName": "UPDATED",
|
||||
"payload": "{\n id, // The ID of the order\n}",
|
||||
"payload": "```ts\n{\n id, // The ID of the order\n}\n```",
|
||||
"description": "Emitted when the details of an order or draft order is updated. This\ndoesn't include updates made by an edit.",
|
||||
"workflows": [
|
||||
"updateOrderWorkflow",
|
||||
@@ -96,7 +97,7 @@
|
||||
"name": "order.placed",
|
||||
"parentName": "OrderWorkflowEvents",
|
||||
"propertyName": "PLACED",
|
||||
"payload": "{\n id, // The ID of the order\n}",
|
||||
"payload": "```ts\n{\n id, // The ID of the order\n}\n```",
|
||||
"description": "Emitted when an order is placed, or when a draft order is converted to an\norder.",
|
||||
"workflows": [
|
||||
"completeCartWorkflow",
|
||||
@@ -109,7 +110,7 @@
|
||||
"name": "order.canceled",
|
||||
"parentName": "OrderWorkflowEvents",
|
||||
"propertyName": "CANCELED",
|
||||
"payload": "{\n id, // The ID of the order\n}",
|
||||
"payload": "```ts\n{\n id, // The ID of the order\n}\n```",
|
||||
"description": "Emitted when an order is canceld.",
|
||||
"workflows": [
|
||||
"cancelOrderWorkflow"
|
||||
@@ -120,7 +121,7 @@
|
||||
"name": "order.completed",
|
||||
"parentName": "OrderWorkflowEvents",
|
||||
"propertyName": "COMPLETED",
|
||||
"payload": "[{\n id, // The ID of the order\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the order\n}]\n```",
|
||||
"description": "Emitted when orders are completed.",
|
||||
"workflows": [
|
||||
"completeOrderWorkflow"
|
||||
@@ -131,7 +132,7 @@
|
||||
"name": "order.archived",
|
||||
"parentName": "OrderWorkflowEvents",
|
||||
"propertyName": "ARCHIVED",
|
||||
"payload": "[{\n id, // The ID of the order\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the order\n}]\n```",
|
||||
"description": "Emitted when an order is archived.",
|
||||
"workflows": [
|
||||
"archiveOrderWorkflow"
|
||||
@@ -142,7 +143,7 @@
|
||||
"name": "order.fulfillment_created",
|
||||
"parentName": "OrderWorkflowEvents",
|
||||
"propertyName": "FULFILLMENT_CREATED",
|
||||
"payload": "{\n order_id, // The ID of the order\n fulfillment_id, // The ID of the fulfillment\n no_notification, // Whether to notify the customer\n}",
|
||||
"payload": "```ts\n{\n order_id, // The ID of the order\n fulfillment_id, // The ID of the fulfillment\n no_notification, // Whether to notify the customer\n}\n```",
|
||||
"description": "Emitted when a fulfillment is created for an order.",
|
||||
"workflows": [
|
||||
"createOrderFulfillmentWorkflow"
|
||||
@@ -153,7 +154,7 @@
|
||||
"name": "order.fulfillment_canceled",
|
||||
"parentName": "OrderWorkflowEvents",
|
||||
"propertyName": "FULFILLMENT_CANCELED",
|
||||
"payload": "{\n order_id, // The ID of the order\n fulfillment_id, // The ID of the fulfillment\n no_notification, // Whether to notify the customer\n}",
|
||||
"payload": "```ts\n{\n order_id, // The ID of the order\n fulfillment_id, // The ID of the fulfillment\n no_notification, // Whether to notify the customer\n}\n```",
|
||||
"description": "Emitted when an order's fulfillment is canceled.",
|
||||
"workflows": [
|
||||
"cancelOrderFulfillmentWorkflow"
|
||||
@@ -164,7 +165,7 @@
|
||||
"name": "order.return_requested",
|
||||
"parentName": "OrderWorkflowEvents",
|
||||
"propertyName": "RETURN_REQUESTED",
|
||||
"payload": "{\n order_id, // The ID of the order\n return_id, // The ID of the return\n}",
|
||||
"payload": "```ts\n{\n order_id, // The ID of the order\n return_id, // The ID of the return\n}\n```",
|
||||
"description": "Emitted when a return request is confirmed.",
|
||||
"workflows": [
|
||||
"createAndCompleteReturnOrderWorkflow",
|
||||
@@ -176,7 +177,7 @@
|
||||
"name": "order.return_received",
|
||||
"parentName": "OrderWorkflowEvents",
|
||||
"propertyName": "RETURN_RECEIVED",
|
||||
"payload": "{\n order_id, // The ID of the order\n return_id, // The ID of the return\n}",
|
||||
"payload": "```ts\n{\n order_id, // The ID of the order\n return_id, // The ID of the return\n}\n```",
|
||||
"description": "Emitted when a return is marked as received.",
|
||||
"workflows": [
|
||||
"createAndCompleteReturnOrderWorkflow",
|
||||
@@ -188,7 +189,7 @@
|
||||
"name": "order.claim_created",
|
||||
"parentName": "OrderWorkflowEvents",
|
||||
"propertyName": "CLAIM_CREATED",
|
||||
"payload": "{\n order_id, // The ID of the order\n claim_id, // The ID of the claim\n}",
|
||||
"payload": "```ts\n{\n order_id, // The ID of the order\n claim_id, // The ID of the claim\n}\n```",
|
||||
"description": "Emitted when a claim is created for an order.",
|
||||
"workflows": [
|
||||
"confirmClaimRequestWorkflow"
|
||||
@@ -199,7 +200,7 @@
|
||||
"name": "order.exchange_created",
|
||||
"parentName": "OrderWorkflowEvents",
|
||||
"propertyName": "EXCHANGE_CREATED",
|
||||
"payload": "{\n order_id, // The ID of the order\n exchange_id, // The ID of the exchange\n}",
|
||||
"payload": "```ts\n{\n order_id, // The ID of the order\n exchange_id, // The ID of the exchange\n}\n```",
|
||||
"description": "Emitted when an exchange is created for an order.",
|
||||
"workflows": [
|
||||
"confirmExchangeRequestWorkflow"
|
||||
@@ -210,7 +211,7 @@
|
||||
"name": "order.transfer_requested",
|
||||
"parentName": "OrderWorkflowEvents",
|
||||
"propertyName": "TRANSFER_REQUESTED",
|
||||
"payload": "{\n id, // The ID of the order\n order_change_id, // The ID of the order change created for the transfer\n}",
|
||||
"payload": "```ts\n{\n id, // The ID of the order\n order_change_id, // The ID of the order change created for the transfer\n}\n```",
|
||||
"description": "Emitted when an order is requested to be transferred to\nanother customer.",
|
||||
"workflows": [
|
||||
"requestOrderTransferWorkflow"
|
||||
@@ -221,7 +222,7 @@
|
||||
"name": "order-edit.requested",
|
||||
"parentName": "OrderEditWorkflowEvents",
|
||||
"propertyName": "REQUESTED",
|
||||
"payload": "{\n order_id, // The ID of the order\n actions, // The actions to edit the order\n}",
|
||||
"payload": "```ts\n{\n order_id, // The ID of the order\n actions, // The actions to edit the order\n}\n```",
|
||||
"description": "Emitted when an order edit is requested.",
|
||||
"workflows": [
|
||||
"requestOrderEditRequestWorkflow"
|
||||
@@ -232,7 +233,7 @@
|
||||
"name": "order-edit.confirmed",
|
||||
"parentName": "OrderEditWorkflowEvents",
|
||||
"propertyName": "CONFIRMED",
|
||||
"payload": "{\n order_id, // The ID of the order\n actions, // The actions to edit the order\n}",
|
||||
"payload": "```ts\n{\n order_id, // The ID of the order\n actions, // The actions to edit the order\n}\n```",
|
||||
"description": "Emitted when an order edit request is confirmed.",
|
||||
"workflows": [
|
||||
"confirmOrderEditRequestWorkflow"
|
||||
@@ -243,7 +244,7 @@
|
||||
"name": "order-edit.canceled",
|
||||
"parentName": "OrderEditWorkflowEvents",
|
||||
"propertyName": "CANCELED",
|
||||
"payload": "{\n order_id, // The ID of the order\n actions, // The actions to edit the order\n}",
|
||||
"payload": "```ts\n{\n order_id, // The ID of the order\n actions, // The actions to edit the order\n}\n```",
|
||||
"description": "Emitted when an order edit request is canceled.",
|
||||
"workflows": [
|
||||
"cancelBeginOrderEditWorkflow"
|
||||
@@ -254,7 +255,7 @@
|
||||
"name": "user.created",
|
||||
"parentName": "UserWorkflowEvents",
|
||||
"propertyName": "CREATED",
|
||||
"payload": "[{\n id, // The ID of the user\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the user\n}]\n```",
|
||||
"description": "Emitted when users are created.",
|
||||
"workflows": [
|
||||
"createUsersWorkflow",
|
||||
@@ -267,7 +268,7 @@
|
||||
"name": "user.updated",
|
||||
"parentName": "UserWorkflowEvents",
|
||||
"propertyName": "UPDATED",
|
||||
"payload": "[{\n id, // The ID of the user\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the user\n}]\n```",
|
||||
"description": "Emitted when users are updated.",
|
||||
"workflows": [
|
||||
"updateUsersWorkflow"
|
||||
@@ -278,7 +279,7 @@
|
||||
"name": "user.deleted",
|
||||
"parentName": "UserWorkflowEvents",
|
||||
"propertyName": "DELETED",
|
||||
"payload": "[{\n id, // The ID of the user\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the user\n}]\n```",
|
||||
"description": "Emitted when users are deleted.",
|
||||
"workflows": [
|
||||
"deleteUsersWorkflow",
|
||||
@@ -290,7 +291,7 @@
|
||||
"name": "auth.password_reset",
|
||||
"parentName": "AuthWorkflowEvents",
|
||||
"propertyName": "PASSWORD_RESET",
|
||||
"payload": "{\n entity_id, // The identifier of the user or customer. For example, an email address.\n actor_type, // The type of actor. For example, \"customer\", \"user\", or custom.\n token, // The generated token.\n}",
|
||||
"payload": "```ts\n{\n entity_id, // The identifier of the user or customer. For example, an email address.\n actor_type, // The type of actor. For example, \"customer\", \"user\", or custom.\n token, // The generated token.\n}\n```",
|
||||
"description": "Emitted when a reset password token is generated. You can listen to this event\nto send a reset password email to the user or customer, for example.",
|
||||
"workflows": [
|
||||
"generateResetPasswordTokenWorkflow"
|
||||
@@ -301,7 +302,7 @@
|
||||
"name": "sales-channel.created",
|
||||
"parentName": "SalesChannelWorkflowEvents",
|
||||
"propertyName": "CREATED",
|
||||
"payload": "[{\n id, // The ID of the sales channel\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the sales channel\n}]\n```",
|
||||
"description": "Emitted when sales channels are created.",
|
||||
"workflows": [
|
||||
"createSalesChannelsWorkflow"
|
||||
@@ -312,7 +313,7 @@
|
||||
"name": "sales-channel.updated",
|
||||
"parentName": "SalesChannelWorkflowEvents",
|
||||
"propertyName": "UPDATED",
|
||||
"payload": "[{\n id, // The ID of the sales channel\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the sales channel\n}]\n```",
|
||||
"description": "Emitted when sales channels are updated.",
|
||||
"workflows": [
|
||||
"updateSalesChannelsWorkflow"
|
||||
@@ -323,7 +324,7 @@
|
||||
"name": "sales-channel.deleted",
|
||||
"parentName": "SalesChannelWorkflowEvents",
|
||||
"propertyName": "DELETED",
|
||||
"payload": "[{\n id, // The ID of the sales channel\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the sales channel\n}]\n```",
|
||||
"description": "Emitted when sales channels are deleted.",
|
||||
"workflows": [
|
||||
"deleteSalesChannelsWorkflow"
|
||||
@@ -334,7 +335,7 @@
|
||||
"name": "product-category.created",
|
||||
"parentName": "ProductCategoryWorkflowEvents",
|
||||
"propertyName": "CREATED",
|
||||
"payload": "[{\n id, // The ID of the product category\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the product category\n}]\n```",
|
||||
"description": "Emitted when product categories are created.",
|
||||
"workflows": [
|
||||
"createProductCategoriesWorkflow"
|
||||
@@ -345,7 +346,7 @@
|
||||
"name": "product-category.updated",
|
||||
"parentName": "ProductCategoryWorkflowEvents",
|
||||
"propertyName": "UPDATED",
|
||||
"payload": "[{\n id, // The ID of the product category\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the product category\n}]\n```",
|
||||
"description": "Emitted when product categories are updated.",
|
||||
"workflows": [
|
||||
"updateProductCategoriesWorkflow"
|
||||
@@ -356,7 +357,7 @@
|
||||
"name": "product-category.deleted",
|
||||
"parentName": "ProductCategoryWorkflowEvents",
|
||||
"propertyName": "DELETED",
|
||||
"payload": "[{\n id, // The ID of the product category\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the product category\n}]\n```",
|
||||
"description": "Emitted when product categories are deleted.",
|
||||
"workflows": [
|
||||
"deleteProductCategoriesWorkflow"
|
||||
@@ -367,7 +368,7 @@
|
||||
"name": "product-collection.created",
|
||||
"parentName": "ProductCollectionWorkflowEvents",
|
||||
"propertyName": "CREATED",
|
||||
"payload": "[{\n id, // The ID of the product collection\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the product collection\n}]\n```",
|
||||
"description": "Emitted when product collections are created.",
|
||||
"workflows": [
|
||||
"createCollectionsWorkflow"
|
||||
@@ -378,7 +379,7 @@
|
||||
"name": "product-collection.updated",
|
||||
"parentName": "ProductCollectionWorkflowEvents",
|
||||
"propertyName": "UPDATED",
|
||||
"payload": "[{\n id, // The ID of the product collection\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the product collection\n}]\n```",
|
||||
"description": "Emitted when product collections are updated.",
|
||||
"workflows": [
|
||||
"updateCollectionsWorkflow"
|
||||
@@ -389,7 +390,7 @@
|
||||
"name": "product-collection.deleted",
|
||||
"parentName": "ProductCollectionWorkflowEvents",
|
||||
"propertyName": "DELETED",
|
||||
"payload": "[{\n id, // The ID of the product collection\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the product collection\n}]\n```",
|
||||
"description": "Emitted when product collections are deleted.",
|
||||
"workflows": [
|
||||
"deleteCollectionsWorkflow"
|
||||
@@ -400,7 +401,7 @@
|
||||
"name": "product-variant.updated",
|
||||
"parentName": "ProductVariantWorkflowEvents",
|
||||
"propertyName": "UPDATED",
|
||||
"payload": "[{\n id, // The ID of the product variant\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the product variant\n}]\n```",
|
||||
"description": "Emitted when product variants are updated.",
|
||||
"workflows": [
|
||||
"updateProductVariantsWorkflow",
|
||||
@@ -412,7 +413,7 @@
|
||||
"name": "product-variant.created",
|
||||
"parentName": "ProductVariantWorkflowEvents",
|
||||
"propertyName": "CREATED",
|
||||
"payload": "[{\n id, // The ID of the product variant\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the product variant\n}]\n```",
|
||||
"description": "Emitted when product variants are created.",
|
||||
"workflows": [
|
||||
"createProductVariantsWorkflow",
|
||||
@@ -427,7 +428,7 @@
|
||||
"name": "product-variant.deleted",
|
||||
"parentName": "ProductVariantWorkflowEvents",
|
||||
"propertyName": "DELETED",
|
||||
"payload": "[{\n id, // The ID of the product variant\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the product variant\n}]\n```",
|
||||
"description": "Emitted when product variants are deleted.",
|
||||
"workflows": [
|
||||
"deleteProductVariantsWorkflow",
|
||||
@@ -439,7 +440,7 @@
|
||||
"name": "product.updated",
|
||||
"parentName": "ProductWorkflowEvents",
|
||||
"propertyName": "UPDATED",
|
||||
"payload": "[{\n id, // The ID of the product\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the product\n}]\n```",
|
||||
"description": "Emitted when products are updated.",
|
||||
"workflows": [
|
||||
"updateProductsWorkflow",
|
||||
@@ -452,7 +453,7 @@
|
||||
"name": "product.created",
|
||||
"parentName": "ProductWorkflowEvents",
|
||||
"propertyName": "CREATED",
|
||||
"payload": "[{\n id, // The ID of the product\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the product\n}]\n```",
|
||||
"description": "Emitted when products are created.",
|
||||
"workflows": [
|
||||
"createProductsWorkflow",
|
||||
@@ -465,7 +466,7 @@
|
||||
"name": "product.deleted",
|
||||
"parentName": "ProductWorkflowEvents",
|
||||
"propertyName": "DELETED",
|
||||
"payload": "[{\n id, // The ID of the product\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the product\n}]\n```",
|
||||
"description": "Emitted when products are deleted.",
|
||||
"workflows": [
|
||||
"deleteProductsWorkflow",
|
||||
@@ -478,7 +479,7 @@
|
||||
"name": "product-type.updated",
|
||||
"parentName": "ProductTypeWorkflowEvents",
|
||||
"propertyName": "UPDATED",
|
||||
"payload": "[{\n id, // The ID of the product type\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the product type\n}]\n```",
|
||||
"description": "Emitted when product types are updated.",
|
||||
"workflows": [
|
||||
"updateProductTypesWorkflow"
|
||||
@@ -489,7 +490,7 @@
|
||||
"name": "product-type.created",
|
||||
"parentName": "ProductTypeWorkflowEvents",
|
||||
"propertyName": "CREATED",
|
||||
"payload": "[{\n id, // The ID of the product type\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the product type\n}]\n```",
|
||||
"description": "Emitted when product types are created.",
|
||||
"workflows": [
|
||||
"createProductTypesWorkflow"
|
||||
@@ -500,7 +501,7 @@
|
||||
"name": "product-type.deleted",
|
||||
"parentName": "ProductTypeWorkflowEvents",
|
||||
"propertyName": "DELETED",
|
||||
"payload": "[{\n id, // The ID of the product type\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the product type\n}]\n```",
|
||||
"description": "Emitted when product types are deleted.",
|
||||
"workflows": [
|
||||
"deleteProductTypesWorkflow"
|
||||
@@ -511,7 +512,7 @@
|
||||
"name": "product-tag.updated",
|
||||
"parentName": "ProductTagWorkflowEvents",
|
||||
"propertyName": "UPDATED",
|
||||
"payload": "[{\n id, // The ID of the product tag\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the product tag\n}]\n```",
|
||||
"description": "Emitted when product tags are updated.",
|
||||
"workflows": [
|
||||
"updateProductTagsWorkflow"
|
||||
@@ -522,7 +523,7 @@
|
||||
"name": "product-tag.created",
|
||||
"parentName": "ProductTagWorkflowEvents",
|
||||
"propertyName": "CREATED",
|
||||
"payload": "[{\n id, // The ID of the product tag\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the product tag\n}]\n```",
|
||||
"description": "Emitted when product tags are created.",
|
||||
"workflows": [
|
||||
"createProductTagsWorkflow"
|
||||
@@ -533,7 +534,7 @@
|
||||
"name": "product-tag.deleted",
|
||||
"parentName": "ProductTagWorkflowEvents",
|
||||
"propertyName": "DELETED",
|
||||
"payload": "[{\n id, // The ID of the product tag\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the product tag\n}]\n```",
|
||||
"description": "Emitted when product tags are deleted.",
|
||||
"workflows": [
|
||||
"deleteProductTagsWorkflow"
|
||||
@@ -544,7 +545,7 @@
|
||||
"name": "product-option.updated",
|
||||
"parentName": "ProductOptionWorkflowEvents",
|
||||
"propertyName": "UPDATED",
|
||||
"payload": "[{\n id, // The ID of the product option\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the product option\n}]\n```",
|
||||
"description": "Emitted when product options are updated.",
|
||||
"workflows": [
|
||||
"updateProductOptionsWorkflow"
|
||||
@@ -555,7 +556,7 @@
|
||||
"name": "product-option.created",
|
||||
"parentName": "ProductOptionWorkflowEvents",
|
||||
"propertyName": "CREATED",
|
||||
"payload": "[{\n id, // The ID of the product option\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the product option\n}]\n```",
|
||||
"description": "Emitted when product options are created.",
|
||||
"workflows": [
|
||||
"createProductOptionsWorkflow"
|
||||
@@ -566,7 +567,7 @@
|
||||
"name": "product-option.deleted",
|
||||
"parentName": "ProductOptionWorkflowEvents",
|
||||
"propertyName": "DELETED",
|
||||
"payload": "[{\n id, // The ID of the product option\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the product option\n}]\n```",
|
||||
"description": "Emitted when product options are deleted.",
|
||||
"workflows": [
|
||||
"deleteProductOptionsWorkflow"
|
||||
@@ -577,7 +578,7 @@
|
||||
"name": "invite.accepted",
|
||||
"parentName": "InviteWorkflowEvents",
|
||||
"propertyName": "ACCEPTED",
|
||||
"payload": "{\n id, // The ID of the invite\n}",
|
||||
"payload": "```ts\n{\n id, // The ID of the invite\n}\n```",
|
||||
"description": "Emitted when an invite is accepted.",
|
||||
"workflows": [
|
||||
"acceptInviteWorkflow"
|
||||
@@ -588,7 +589,7 @@
|
||||
"name": "invite.created",
|
||||
"parentName": "InviteWorkflowEvents",
|
||||
"propertyName": "CREATED",
|
||||
"payload": "[{\n id, // The ID of the invite\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the invite\n}]\n```",
|
||||
"description": "Emitted when invites are created. You can listen to this event\nto send an email to the invited users, for example.",
|
||||
"workflows": [
|
||||
"createInvitesWorkflow"
|
||||
@@ -599,7 +600,7 @@
|
||||
"name": "invite.deleted",
|
||||
"parentName": "InviteWorkflowEvents",
|
||||
"propertyName": "DELETED",
|
||||
"payload": "[{\n id, // The ID of the invite\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the invite\n}]\n```",
|
||||
"description": "Emitted when invites are deleted.",
|
||||
"workflows": [
|
||||
"deleteInvitesWorkflow"
|
||||
@@ -610,7 +611,7 @@
|
||||
"name": "invite.resent",
|
||||
"parentName": "InviteWorkflowEvents",
|
||||
"propertyName": "RESENT",
|
||||
"payload": "[{\n id, // The ID of the invite\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the invite\n}]\n```",
|
||||
"description": "Emitted when invites should be resent because their token was\nrefreshed. You can listen to this event to send an email to the invited users,\nfor example.",
|
||||
"workflows": [
|
||||
"refreshInviteTokensWorkflow"
|
||||
@@ -621,7 +622,7 @@
|
||||
"name": "region.updated",
|
||||
"parentName": "RegionWorkflowEvents",
|
||||
"propertyName": "UPDATED",
|
||||
"payload": "[{\n id, // The ID of the region\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the region\n}]\n```",
|
||||
"description": "Emitted when regions are updated.",
|
||||
"workflows": [
|
||||
"updateRegionsWorkflow"
|
||||
@@ -632,7 +633,7 @@
|
||||
"name": "region.created",
|
||||
"parentName": "RegionWorkflowEvents",
|
||||
"propertyName": "CREATED",
|
||||
"payload": "[{\n id, // The ID of the region\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the region\n}]\n```",
|
||||
"description": "Emitted when regions are created.",
|
||||
"workflows": [
|
||||
"createRegionsWorkflow"
|
||||
@@ -643,7 +644,7 @@
|
||||
"name": "region.deleted",
|
||||
"parentName": "RegionWorkflowEvents",
|
||||
"propertyName": "DELETED",
|
||||
"payload": "[{\n id, // The ID of the region\n}]",
|
||||
"payload": "```ts\n[{\n id, // The ID of the region\n}]\n```",
|
||||
"description": "Emitted when regions are deleted.",
|
||||
"workflows": [
|
||||
"deleteRegionsWorkflow"
|
||||
@@ -654,7 +655,7 @@
|
||||
"name": "shipment.created",
|
||||
"parentName": "FulfillmentWorkflowEvents",
|
||||
"propertyName": "SHIPMENT_CREATED",
|
||||
"payload": "{\n id, // the ID of the shipment\n no_notification, // whether to notify the customer\n}",
|
||||
"payload": "```ts\n{\n id, // the ID of the shipment\n no_notification, // whether to notify the customer\n}\n```",
|
||||
"description": "Emitted when a shipment is created for an order.",
|
||||
"workflows": [
|
||||
"createOrderShipmentWorkflow"
|
||||
@@ -665,7 +666,7 @@
|
||||
"name": "delivery.created",
|
||||
"parentName": "FulfillmentWorkflowEvents",
|
||||
"propertyName": "DELIVERY_CREATED",
|
||||
"payload": "{\n id, // the ID of the fulfillment\n}",
|
||||
"payload": "```ts\n{\n id, // the ID of the fulfillment\n}\n```",
|
||||
"description": "Emitted when a fulfillment is marked as delivered.",
|
||||
"workflows": [
|
||||
"markOrderFulfillmentAsDeliveredWorkflow"
|
||||
|
||||
@@ -69,6 +69,10 @@
|
||||
{
|
||||
"tagName": "@eventPayload",
|
||||
"syntaxKind": "block"
|
||||
},
|
||||
{
|
||||
"tagName": "@workflowEvent",
|
||||
"syntaxKind": "block"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -82,6 +82,7 @@ import workflowExamplesHelper from "./resources/helpers/workflow-examples.js"
|
||||
import stepExamplesHelper from "./resources/helpers/step-examples.js"
|
||||
import ifEventsReferenceHelper from "./resources/helpers/if-events-reference.js"
|
||||
import eventsListingHelper from "./resources/helpers/events-listing.js"
|
||||
import workflowEventsHelper from "./resources/helpers/workflow-events.js"
|
||||
import { MarkdownTheme } from "./theme.js"
|
||||
import { getDirname } from "utils"
|
||||
|
||||
@@ -195,4 +196,5 @@ export function registerHelpers(theme: MarkdownTheme) {
|
||||
stepExamplesHelper()
|
||||
ifEventsReferenceHelper(theme)
|
||||
eventsListingHelper()
|
||||
workflowEventsHelper()
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ const EXCLUDED_TAGS = [
|
||||
"@version",
|
||||
"@tags",
|
||||
"@summary",
|
||||
"@workflowEvent",
|
||||
]
|
||||
|
||||
export default function () {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Handlebars from "handlebars"
|
||||
import pkg from "slugify"
|
||||
import { DeclarationReflection } from "typedoc"
|
||||
import { DeclarationReflection, ReflectionKind } from "typedoc"
|
||||
import { pascalToWords } from "utils"
|
||||
|
||||
const slugify = pkg.default
|
||||
@@ -14,19 +14,34 @@ export default function () {
|
||||
const subtitleLevel = (this.children?.length ?? 0) > 1 ? 3 : 2
|
||||
const showHeader = (this.children?.length ?? 0) > 1
|
||||
|
||||
this.children?.forEach((child, index) => {
|
||||
content.push(
|
||||
formatEventsType(child as DeclarationReflection, {
|
||||
subtitleLevel,
|
||||
showHeader,
|
||||
})
|
||||
)
|
||||
if (index < this.children!.length - 1) {
|
||||
content.push("")
|
||||
content.push("---")
|
||||
content.push("")
|
||||
}
|
||||
})
|
||||
function parseChildren(children: DeclarationReflection[]) {
|
||||
children?.forEach((child, index) => {
|
||||
content.push(
|
||||
formatEventsType(child as DeclarationReflection, {
|
||||
subtitleLevel,
|
||||
showHeader,
|
||||
})
|
||||
)
|
||||
if (index < children!.length - 1) {
|
||||
content.push("")
|
||||
content.push("---")
|
||||
content.push("")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (this.kind === ReflectionKind.Module) {
|
||||
this.children?.forEach((child, index) => {
|
||||
parseChildren(child.children || [])
|
||||
if (index < this.children!.length - 1) {
|
||||
content.push("")
|
||||
content.push("---")
|
||||
content.push("")
|
||||
}
|
||||
})
|
||||
} else {
|
||||
parseChildren(this.children || [])
|
||||
}
|
||||
|
||||
return content.join("\n")
|
||||
}
|
||||
@@ -73,24 +88,38 @@ function formatEventsType(
|
||||
// table body start
|
||||
content.push(` <Table.Body>`)
|
||||
eventProperties.forEach((event) => {
|
||||
const eventName =
|
||||
let eventName =
|
||||
event.comment?.blockTags
|
||||
.find((tag) => tag.tag === "@eventName")
|
||||
?.content.map((content) => content.text)
|
||||
.join("") || ""
|
||||
eventName = `[${eventName}](#${slugify(eventName.replace(".", ""), {
|
||||
lower: true,
|
||||
})})`
|
||||
const eventDescription = event.comment?.summary
|
||||
.map((content) => content.text)
|
||||
.join("")
|
||||
const deprecationTag = event.comment?.blockTags.find(
|
||||
(tag) => tag.tag === "@deprecated"
|
||||
)
|
||||
|
||||
if (deprecationTag) {
|
||||
eventName += `\n`
|
||||
const deprecationText = deprecationTag.content
|
||||
.map((content) => content.text)
|
||||
.join("")
|
||||
.trim()
|
||||
if (deprecationText.length) {
|
||||
eventName += `<Tooltip text="${deprecationText}">`
|
||||
}
|
||||
eventName += `<Badge variant="orange">Deprecated</Badge>`
|
||||
if (deprecationText.length) {
|
||||
eventName += `</Tooltip>`
|
||||
}
|
||||
}
|
||||
|
||||
content.push(` <Table.Row>`)
|
||||
content.push(
|
||||
` <Table.Cell>\n[${eventName}](#${slugify(
|
||||
eventName.replace(".", ""),
|
||||
{
|
||||
lower: true,
|
||||
}
|
||||
)})\n</Table.Cell>`
|
||||
)
|
||||
content.push(` <Table.Cell>\n${eventName}\n</Table.Cell>`)
|
||||
content.push(` <Table.Cell>\n${eventDescription}\n</Table.Cell>`)
|
||||
content.push(` </Table.Row>`)
|
||||
})
|
||||
@@ -117,9 +146,28 @@ function formatEventsType(
|
||||
?.content.map((content) => content.text)
|
||||
.join("")
|
||||
.split(", ")
|
||||
const deprecatedTag = event.comment?.blockTags.find(
|
||||
(tag) => tag.tag === "@deprecated"
|
||||
)
|
||||
|
||||
content.push(`${subHeaderPrefix} \`${eventName}\``)
|
||||
content.push("")
|
||||
if (deprecatedTag) {
|
||||
const deprecationText = deprecatedTag.content
|
||||
.map((content) => content.text)
|
||||
.join("")
|
||||
.trim()
|
||||
if (deprecationText.length) {
|
||||
content.push(`<Tooltip text="${deprecationText}">`)
|
||||
}
|
||||
|
||||
content.push(`<Badge variant="orange">Deprecated</Badge>`)
|
||||
|
||||
if (deprecationText.length) {
|
||||
content.push(`</Tooltip>`)
|
||||
}
|
||||
content.push("")
|
||||
}
|
||||
content.push(eventDescription || "")
|
||||
content.push("")
|
||||
content.push(`${subHeaderPrefix}# Payload`)
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
import Handlebars from "handlebars"
|
||||
import { SignatureReflection } from "typedoc"
|
||||
|
||||
export default function () {
|
||||
Handlebars.registerHelper(
|
||||
"workflowEvents",
|
||||
function (this: SignatureReflection): string {
|
||||
if (!this.parent) {
|
||||
return ""
|
||||
}
|
||||
|
||||
const workflowEventComments = this.parent.comment?.blockTags.filter(
|
||||
(tag) => tag.tag === "@workflowEvent"
|
||||
)
|
||||
|
||||
if (!workflowEventComments?.length) {
|
||||
return ""
|
||||
}
|
||||
|
||||
let str = `${Handlebars.helpers.titleLevel()} Emitted Events\n\nThis section lists the events that are either triggered by the \`emitEventStep\` in the workflow, or by another workflow executed within this workflow.\n\nYou can listen to these events in a subscriber, as explained in the [Subscribers](https://docs.medusajs.com/learn/fundamentals/events-and-subscribers) documentation.\n\n`
|
||||
|
||||
str += `<Table>\n`
|
||||
str += ` <Table.Header>\n`
|
||||
str += ` <Table.Row>\n`
|
||||
str += ` <Table.HeaderCell>\nEvent\n</Table.HeaderCell>\n`
|
||||
str += ` <Table.HeaderCell>\nDescription\n</Table.HeaderCell>\n`
|
||||
str += ` <Table.HeaderCell>\nPayload\n</Table.HeaderCell>\n`
|
||||
str += ` </Table.Row>\n`
|
||||
str += ` </Table.Header>\n`
|
||||
str += ` <Table.Body>\n`
|
||||
workflowEventComments.forEach((comment) => {
|
||||
const commentContent = comment.content
|
||||
.map((c) => c.text)
|
||||
.join(" ")
|
||||
.split("--")
|
||||
let eventName = `\`${commentContent[0].trim()}\``
|
||||
const eventDescription = commentContent[1]?.trim() || ""
|
||||
const eventPayload = (commentContent[2]?.trim() || "")
|
||||
.replace("```ts\n", "")
|
||||
.replace("\n```", "")
|
||||
const isDeprecated = commentContent.length >= 4
|
||||
|
||||
if (isDeprecated) {
|
||||
const deprecatedText = commentContent[4]?.trim()
|
||||
eventName += `\n`
|
||||
if (deprecatedText) {
|
||||
eventName += `<Tooltip text="${deprecatedText}">`
|
||||
}
|
||||
eventName += `<Badge variant="orange">Deprecated</Badge>`
|
||||
if (deprecatedText) {
|
||||
eventName += `</Tooltip>`
|
||||
}
|
||||
}
|
||||
|
||||
str += ` <Table.Row>\n`
|
||||
str += ` <Table.Cell>\n${eventName}\n</Table.Cell>\n`
|
||||
str += ` <Table.Cell>\n${eventDescription}\n</Table.Cell>\n`
|
||||
str += ` <Table.Cell>\n\`\`\`ts blockStyle="inline"\n${eventPayload}\n\`\`\`\n</Table.Cell>\n`
|
||||
str += ` </Table.Row>\n`
|
||||
})
|
||||
str += ` </Table.Body>\n`
|
||||
str += `</Table>\n\n`
|
||||
|
||||
return str
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -22,4 +22,6 @@
|
||||
|
||||
{{{workflowOutput sectionTitle=name}}}
|
||||
|
||||
{{{workflowHooks}}}
|
||||
{{{workflowHooks}}}
|
||||
|
||||
{{{workflowEvents}}}
|
||||
@@ -25,6 +25,9 @@ import {
|
||||
} from "utils"
|
||||
import { StepType } from "./types.js"
|
||||
import Examples from "./utils/examples.js"
|
||||
import { MedusaEvent } from "types"
|
||||
import path from "path"
|
||||
import { readFileSync } from "fs"
|
||||
|
||||
type ParsedStep = {
|
||||
stepReflection: DeclarationReflection
|
||||
@@ -47,6 +50,7 @@ class WorkflowsPlugin {
|
||||
workflowIds: string[]
|
||||
}
|
||||
}
|
||||
protected events: MedusaEvent[] = []
|
||||
|
||||
constructor(app: Application) {
|
||||
this.app = app
|
||||
@@ -92,6 +96,7 @@ class WorkflowsPlugin {
|
||||
if (!isEnabled) {
|
||||
return
|
||||
}
|
||||
this.readEventsJson()
|
||||
for (const reflection of context.project.getReflectionsByKind(
|
||||
ReflectionKind.All
|
||||
)) {
|
||||
@@ -235,6 +240,7 @@ class WorkflowsPlugin {
|
||||
])
|
||||
|
||||
this.updateWorkflowsTagsMap(workflowId, uniqueResources)
|
||||
this.attachEvents(parentReflection)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -855,6 +861,61 @@ class WorkflowsPlugin {
|
||||
argument.getText()
|
||||
)
|
||||
}
|
||||
|
||||
readEventsJson() {
|
||||
if (this.events.length) {
|
||||
return
|
||||
}
|
||||
|
||||
const eventsPath = path.resolve(
|
||||
"..",
|
||||
"..",
|
||||
"generated",
|
||||
"events-output.json"
|
||||
)
|
||||
|
||||
this.events = JSON.parse(readFileSync(eventsPath, "utf-8"))
|
||||
}
|
||||
|
||||
attachEvents(workflowReflection: DeclarationReflection) {
|
||||
if (!workflowReflection.comment) {
|
||||
workflowReflection.comment = new Comment()
|
||||
}
|
||||
|
||||
const eventsTag = workflowReflection.comment.blockTags.find(
|
||||
(tag) => tag.tag === "@workflowEvent"
|
||||
)
|
||||
|
||||
if (eventsTag) {
|
||||
return
|
||||
}
|
||||
|
||||
const workflowEvents = this.events.filter((event) =>
|
||||
event.workflows.includes(workflowReflection.name)
|
||||
)
|
||||
|
||||
if (!workflowEvents) {
|
||||
return
|
||||
}
|
||||
|
||||
workflowReflection.comment.blockTags.push(
|
||||
...workflowEvents.map((event) => {
|
||||
let commentText = `${event.name} -- ${event.description} -- ${event.payload}`
|
||||
if (event.deprecated) {
|
||||
commentText += " -- deprecated"
|
||||
if (event.deprecated_message) {
|
||||
commentText += ` -- ${event.deprecated_message}`
|
||||
}
|
||||
}
|
||||
return new CommentTag(`@workflowEvent`, [
|
||||
{
|
||||
kind: "text",
|
||||
text: commentText,
|
||||
},
|
||||
])
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default WorkflowsPlugin
|
||||
|
||||
@@ -33,10 +33,9 @@ export default class Helper {
|
||||
? dotPos
|
||||
: Math.min(dotPos, parenPos)
|
||||
|
||||
return nameWithoutQuotes.substring(
|
||||
0,
|
||||
endIndex === -1 ? nameWithoutQuotes.length : endIndex
|
||||
)
|
||||
return nameWithoutQuotes
|
||||
.substring(0, endIndex === -1 ? nameWithoutQuotes.length : endIndex)
|
||||
.trim()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user