Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Update workflows.ts

Kiran Kf9236e7a8493
diff --git a/apps/web/lib/zod/schemas/workflows.ts b/apps/web/lib/zod/schemas/workflows.ts
index 95163ecede..9aa980a153 100644
--- a/apps/web/lib/zod/schemas/workflows.ts
+++ b/apps/web/lib/zod/schemas/workflows.ts
@@ -2,26 +2,20 @@ import { WorkflowTrigger } from "@dub/prisma/client";
import { z } from "zod";
export const WORKFLOW_CONDITION_ATTRIBUTES = [
- "totalClicks",
"totalLeads",
- "totalSales",
- "totalClickEarnings",
- "totalLeadEarnings",
- "totalSaleEarnings",
- "totalSaleRevenue",
- "totalEarnings",
- "totalRevenue",
+ "totalConversions",
+ "totalSaleAmount",
+ "totalCommission",
] as const;
-export const WORKFLOW_CONDITION_OPERATORS = ["gte"] as const;
-
export const WORKFLOW_ACTION_TYPES = [
- "awardBounty",
- // "moveToGroup",
- // "sendEmail",
- // "triggerWebhook",
+ "sendEmail", // send an email to the partner
+ "updateGroup", // move the partner to a group
+ "createCommission", // create a commission for the partner via Bounty
] as const;
+export const WORKFLOW_CONDITION_OPERATORS = ["gte"] as const;
+
// Individual condition
const workflowConditionSchema = z.object({
attribute: z.enum(WORKFLOW_CONDITION_ATTRIBUTES),
@@ -38,11 +32,25 @@ export const workflowConditionsSchema = z.object({
// Individual action
const workflowActionSchema = z.discriminatedUnion("type", [
z.object({
- type: z.literal("awardBounty"),
+ type: z.literal("createCommission"),
data: z.object({
bountyId: z.string(),
}),
}),
+
+ z.object({
+ type: z.literal("sendEmail"),
+ data: z.object({
+ emailId: z.string(),
+ }),
+ }),
+
+ z.object({
+ type: z.literal("updateGroup"),
+ data: z.object({
+ groupId: z.string(),
+ }),
+ }),
]);
// Array of actions (Only supports one action for now)