chore(core-flows): Add invite resent event (#8986)
This commit is contained in:
@@ -3,8 +3,11 @@ import {
|
||||
WorkflowData,
|
||||
WorkflowResponse,
|
||||
createWorkflow,
|
||||
transform,
|
||||
} from "@medusajs/workflows-sdk"
|
||||
|
||||
import { InviteWorkflowEvents } from "@medusajs/utils"
|
||||
import { emitEventStep } from "../../common"
|
||||
import { refreshInviteTokensStep } from "../steps/refresh-invite-tokens"
|
||||
|
||||
export const refreshInviteTokensWorkflowId = "refresh-invite-tokens-workflow"
|
||||
@@ -16,6 +19,19 @@ export const refreshInviteTokensWorkflow = createWorkflow(
|
||||
(
|
||||
input: WorkflowData<InviteWorkflow.ResendInvitesWorkflowInputDTO>
|
||||
): WorkflowResponse<InviteDTO[]> => {
|
||||
return new WorkflowResponse(refreshInviteTokensStep(input.invite_ids))
|
||||
const invites = refreshInviteTokensStep(input.invite_ids)
|
||||
|
||||
const invitesIdEvents = transform({ invites }, ({ invites }) => {
|
||||
return invites.map((v) => {
|
||||
return { id: v.id }
|
||||
})
|
||||
})
|
||||
|
||||
emitEventStep({
|
||||
eventName: InviteWorkflowEvents.RESENT,
|
||||
data: invitesIdEvents,
|
||||
})
|
||||
|
||||
return new WorkflowResponse(invites)
|
||||
}
|
||||
)
|
||||
|
||||
@@ -44,6 +44,7 @@ export const InviteWorkflowEvents = {
|
||||
ACCEPTED: "invite.accepted",
|
||||
CREATED: "invite.created",
|
||||
DELETED: "invite.deleted",
|
||||
RESENT: "invite.resent",
|
||||
}
|
||||
|
||||
export const RegionWorkflowEvents = {
|
||||
|
||||
Reference in New Issue
Block a user