feat(core-flows): Emit cart trasnferred customer (#12425)
**What** When a cart is transferred emit an event notifying of the action with the cart id and the customer id
This commit is contained in:
committed by
GitHub
parent
47700899ed
commit
fff285f8d2
@@ -6,9 +6,10 @@ import {
|
||||
WorkflowData,
|
||||
WorkflowResponse,
|
||||
} from "@medusajs/framework/workflows-sdk"
|
||||
import { useQueryGraphStep } from "../../common"
|
||||
import { emitEventStep, useQueryGraphStep } from "../../common"
|
||||
import { updateCartsStep } from "../steps"
|
||||
import { refreshCartItemsWorkflow } from "./refresh-cart-items"
|
||||
import { CartWorkflowEvents } from "@medusajs/framework/utils"
|
||||
|
||||
/**
|
||||
* The cart ownership transfer details.
|
||||
@@ -110,6 +111,14 @@ export const transferCartCustomerWorkflow = createWorkflow(
|
||||
refreshCartItemsWorkflow.runAsStep({
|
||||
input: { cart_id: input.id, force_refresh: true },
|
||||
})
|
||||
|
||||
emitEventStep({
|
||||
eventName: CartWorkflowEvents.CUSTOMER_TRANSFERRED,
|
||||
data: {
|
||||
id: input.id,
|
||||
customer_id: customer.customer_id,
|
||||
},
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user