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.

updates to email language

Steven Tey1312c56507f0
diff --git a/apps/web/app/(ee)/api/bounties/[bountyId]/route.ts b/apps/web/app/(ee)/api/bounties/[bountyId]/route.ts
index 4ef8bc57ce..459f63564a 100644
--- a/apps/web/app/(ee)/api/bounties/[bountyId]/route.ts
+++ b/apps/web/app/(ee)/api/bounties/[bountyId]/route.ts
@@ -1,4 +1,5 @@
import { getBountyOrThrow } from "@/lib/api/bounties/get-bounty-or-throw";
+import { DubApiError } from "@/lib/api/errors";
import { getDefaultProgramIdOrThrow } from "@/lib/api/programs/get-default-program-id-or-throw";
import { parseRequestBody } from "@/lib/api/utils";
import { withWorkspace } from "@/lib/auth";
@@ -53,6 +54,12 @@ export const PATCH = withWorkspace(async ({ workspace, params, req }) => {
groupIds,
} = updateBountySchema.parse(await parseRequestBody(req));
+ if (endsAt && endsAt < startsAt) {
+ throw new DubApiError({
+ message: "endsAt must be on or after startsAt.",
+ code: "bad_request",
+ });
+ }
const bounty = await getBountyOrThrow({
bountyId,
programId,
@@ -133,9 +140,6 @@ export const DELETE = withWorkspace(async ({ workspace, params }) => {
programId,
});
- // TODO:
- // What happens to the created commissions?
-
await prisma.$transaction(async (tx) => {
const bounty = await tx.bounty.delete({
where: {
diff --git a/apps/web/app/(ee)/api/bounties/route.ts b/apps/web/app/(ee)/api/bounties/route.ts
index 8e128e496f..b0c7c9daf1 100644
--- a/apps/web/app/(ee)/api/bounties/route.ts
+++ b/apps/web/app/(ee)/api/bounties/route.ts
@@ -1,5 +1,6 @@
import { getBounties } from "@/lib/api/bounties/get-bounties";
import { createId } from "@/lib/api/create-id";
+import { DubApiError } from "@/lib/api/errors";
import { getDefaultProgramIdOrThrow } from "@/lib/api/programs/get-default-program-id-or-throw";
import { parseRequestBody } from "@/lib/api/utils";
import { withWorkspace } from "@/lib/auth";
@@ -51,6 +52,13 @@ export const POST = withWorkspace(
performanceCondition,
} = createBountySchema.parse(await parseRequestBody(req));
+ if (endsAt && endsAt < startsAt) {
+ throw new DubApiError({
+ message: "endsAt must be on or after startsAt.",
+ code: "bad_request",
+ });
+ }
+
const groups = groupIds?.length
? await prisma.partnerGroup.findMany({
where: {
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-submissions-table.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-submissions-table.tsx
index b50e49dec5..ad4d76e659 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-submissions-table.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-submissions-table.tsx
@@ -144,12 +144,7 @@ export function BountySubmissionsTable() {
header: "Partner",
minSize: 250,
cell: ({ row }) => {
- return (
- <PartnerRowItem
- partner={row.original.partner}
- showPermalink={false}
- />
- );
+ return <PartnerRowItem partner={row.original.partner} />;
},
},
{
diff --git a/packages/email/src/templates/bounty-approved.tsx b/packages/email/src/templates/bounty-approved.tsx
index 4c3a023aad..9c0aefcac9 100644
--- a/packages/email/src/templates/bounty-approved.tsx
+++ b/packages/email/src/templates/bounty-approved.tsx
@@ -50,12 +50,12 @@ export default function BountyApproved({
</Section>
<Heading className="mx-0 my-8 p-0 text-lg font-medium text-black">
- Bounty confirmed!
+ Bounty confirmed for <strong>{program.name}</strong>
</Heading>
<Text className="text-sm leading-5 text-neutral-600">
- The bounty for <strong>{bounty.name}</strong> has been confirmed,
- and the reward is on it’s way!
+ Good news: Your bounty submission for{" "}
+ <strong>{bounty.name}</strong> has been confirmed.
</Text>
<Section className="h-[140px] rounded-lg bg-neutral-100 py-1.5 text-center">
@@ -63,8 +63,9 @@ export default function BountyApproved({
</Section>
<Text className="text-sm leading-5 text-neutral-600">
- The reward has been sent to your payouts, ready for Acme to
- complete on their next payout day.
+ The commission from the bounty has been added to your upcoming
+ payout, and will be sent to your bank account when{" "}
+ <strong>{program.name}</strong> processes their next payout.
</Text>
<Text className="text-sm leading-5 text-neutral-600">
diff --git a/packages/email/src/templates/bounty-completed.tsx b/packages/email/src/templates/bounty-completed.tsx
index 3cdfdc9af7..174599d47e 100644
--- a/packages/email/src/templates/bounty-completed.tsx
+++ b/packages/email/src/templates/bounty-completed.tsx
@@ -18,7 +18,7 @@ import { Footer } from "../components/footer";
export default function BountyCompleted({
bounty = {
name: "Promote Acme at your campus and earn $500 ",
- type: "performance",
+ type: "submission",
},
program = {
name: "Acme",
@@ -50,26 +50,34 @@ export default function BountyCompleted({
</Section>
<Heading className="mx-0 my-8 p-0 text-lg font-medium text-black">
- Bounty completed!
+ Bounty completed for <strong>{program.name}</strong>
</Heading>
<Text className="text-sm leading-5 text-neutral-600">
Congratulations on completing the <strong>{bounty.name}</strong>{" "}
- bounty!
+ bounty for <strong>{program.name}</strong>!
</Text>
<Section className="h-[140px] rounded-lg bg-neutral-100 py-1.5 text-center">
<BountyThumbnailImage type={bounty.type} />
</Section>
- <Text className="text-sm leading-5 text-neutral-600">
- Once <strong>{program.name}</strong> has confirmed your bounty,
- the reward will be added to your payouts.
- </Text>
+ {bounty.type === "submission" ? (
+ <Text className="text-sm leading-5 text-neutral-600">
+ Once <strong>{program.name}</strong> has confirmed your bounty,
+ you will receive an email with the commission details.
+ </Text>
+ ) : (
+ <Text className="text-sm leading-5 text-neutral-600">
+ The commission from the bounty has been added to your upcoming
+ payout, and will be sent to your bank account when{" "}
+ <strong>{program.name}</strong> processes their next payout.
+ </Text>
+ )}
<Text className="text-sm leading-5 text-neutral-600">
- If you have any questions about the program please don’t hesitate
- to reach out to the <strong>{program.name}</strong> team{" "}
+ If you have any questions, please don't hesitate to reach out to
+ the <strong>{program.name}</strong> team{" "}
<span className="font-semibold text-blue-600">
({program.supportEmail})
</span>