chore(core-flows): Add invite resent event (#8986)
This commit is contained in:
1 parent
4b1827ed48
commit
f063a69632
2 files changed
+18
-1
No files matched your search
@@ -3,8 +3,11 @@ import {
|
|||||||
WorkflowData,
|
WorkflowData,
|
||||||
WorkflowResponse,
|
WorkflowResponse,
|
||||||
createWorkflow,
|
createWorkflow,
|
||||||
|
transform,
|
||||||
} from "@medusajs/workflows-sdk"
|
} from "@medusajs/workflows-sdk"
|
||||||
|
|
||||||
|
import { InviteWorkflowEvents } from "@medusajs/utils"
|
||||||
|
import { emitEventStep } from "../../common"
|
||||||
import { refreshInviteTokensStep } from "../steps/refresh-invite-tokens"
|
import { refreshInviteTokensStep } from "../steps/refresh-invite-tokens"
|
||||||
|
|
||||||
export const refreshInviteTokensWorkflowId = "refresh-invite-tokens-workflow"
|
export const refreshInviteTokensWorkflowId = "refresh-invite-tokens-workflow"
|
||||||
@@ -16,6 +19,19 @@ export const refreshInviteTokensWorkflow = createWorkflow(
|
|||||||
(
|
(
|
||||||
input: WorkflowData<InviteWorkflow.ResendInvitesWorkflowInputDTO>
|
input: WorkflowData<InviteWorkflow.ResendInvitesWorkflowInputDTO>
|
||||||
): WorkflowResponse<InviteDTO[]> => {
|
): 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",
|
ACCEPTED: "invite.accepted",
|
||||||
CREATED: "invite.created",
|
CREATED: "invite.created",
|
||||||
DELETED: "invite.deleted",
|
DELETED: "invite.deleted",
|
||||||
|
RESENT: "invite.resent",
|
||||||
}
|
}
|
||||||
|
|
||||||
export const RegionWorkflowEvents = {
|
export const RegionWorkflowEvents = {
|
||||||
|
|||||||
Reference in new issue
Block a user