The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
update workflow schema
Kiran K0f12eb08cb61
diff --git a/apps/web/lib/api/create-id.ts b/apps/web/lib/api/create-id.tsindex 4f43e7b88f..ff7308f91f 100644--- a/apps/web/lib/api/create-id.ts+++ b/apps/web/lib/api/create-id.ts@@ -34,7 +34,8 @@ const prefixes = ["bnty_sub_", // bounty submission"wf_", // workflow"msg_", // message- "em_", // notification email+ "em_", // notification email,+ "cmp_", // campaign] as const;// ULID uses base32 encodingdiff --git a/apps/web/lib/zod/schemas/campaigns.ts b/apps/web/lib/zod/schemas/campaigns.tsnew file mode 100644index 0000000000..071f7d786a--- /dev/null+++ b/apps/web/lib/zod/schemas/campaigns.ts@@ -0,0 +1,2 @@+import { z } from "zod";+diff --git a/apps/web/lib/zod/schemas/workflows.ts b/apps/web/lib/zod/schemas/workflows.tsindex 1bcd492146..47d6d57042 100644--- a/apps/web/lib/zod/schemas/workflows.ts+++ b/apps/web/lib/zod/schemas/workflows.ts@@ -11,6 +11,7 @@ export const WORKFLOW_ATTRIBUTES = ["totalConversions","totalSaleAmount","totalCommissions",+ "partnerJoinedDuration",] as const;export const WORKFLOW_ATTRIBUTE_LABELS: Record<@@ -21,6 +22,7 @@ export const WORKFLOW_ATTRIBUTE_LABELS: Record<totalConversions: "Conversions",totalSaleAmount: "Revenue",totalCommissions: "Commissions",+ partnerJoinedDuration: "been in the program for",} as const;export const WORKFLOW_ATTRIBUTE_TRIGGER_MAP: Record<@@ -31,6 +33,7 @@ export const WORKFLOW_ATTRIBUTE_TRIGGER_MAP: Record<totalConversions: WorkflowTrigger.saleRecorded,totalSaleAmount: WorkflowTrigger.saleRecorded,totalCommissions: WorkflowTrigger.commissionEarned,+ partnerJoinedDuration: WorkflowTrigger.partnerJoinedDuration,} as const;export const WORKFLOW_COMPARISON_OPERATORS = ["gte"] as const;@@ -51,6 +54,7 @@ export const WORKFLOW_COMPARISON_OPERATOR_LABELS: Record<export enum WORKFLOW_ACTION_TYPES {AwardBounty = "awardBounty",+ SendCampaign = "sendCampaign",}export const WORKFLOW_LOGICAL_OPERATORS = ["AND"] as const;@@ -71,11 +75,18 @@ export const workflowConditionsSchema = z.object({// Individual actionexport const workflowActionSchema = z.discriminatedUnion("type", [z.object({- type: z.literal("awardBounty"),+ type: z.literal(WORKFLOW_ACTION_TYPES.AwardBounty),data: z.object({bountyId: z.string(),}),}),++ z.object({+ type: z.literal(WORKFLOW_ACTION_TYPES.SendCampaign),+ data: z.object({+ campaignId: z.string(),+ }),+ }),]);// Array of actions (Only supports one action for now)