You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/web/app/(ee)/api/discount-codes/route.ts
+6-2Lines changed: 6 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,7 @@ import {
11
11
DiscountCodeSchema,
12
12
getDiscountCodesQuerySchema,
13
13
}from"@/lib/zod/schemas/discount";
14
+
import{APP_DOMAIN}from"@dub/utils";
14
15
import{waitUntil}from"@vercel/functions";
15
16
import{NextResponse}from"next/server";
16
17
@@ -100,12 +101,15 @@ export const POST = withWorkspace(
100
101
code,
101
102
},
102
103
},
104
+
include: {
105
+
partner: true,
106
+
},
103
107
});
104
108
105
109
if(duplicateByCode){
106
110
thrownewDubApiError({
107
-
code: "bad_request",
108
-
message: `A discount with the code ${code}already exists in the program. Please choose a different code.`,
111
+
code: "conflict",
112
+
message: `This discount code "${code}" is already in use by [${duplicateByCode.partner.email}](${APP_DOMAIN}/${workspace.slug}/program/partners/${duplicateByCode.partner.id}). Please choose a different code.`,
Copy file name to clipboardExpand all lines: apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/links/partner-link-card.tsx
+22-14Lines changed: 22 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -28,6 +28,7 @@ import {
28
28
getApexDomain,
29
29
getPrettyUrl,
30
30
nFormatter,
31
+
PARTNERS_DOMAIN,
31
32
}from"@dub/utils";
32
33
importNumberFlowfrom"@number-flow/react";
33
34
importLinkfrom"next/link";
@@ -75,6 +76,19 @@ export function PartnerLinkCard({ link }: { link: PartnerProfileLinkProps }) {
disabledTooltip={`This discount code was disabled by the program. [Contact the program owner](${PARTNERS_DOMAIN}/messages/${programEnrollment?.program.slug}) if you need a new code.`}
@@ -153,20 +167,14 @@ export function PartnerLinkCard({ link }: { link: PartnerProfileLinkProps }) {
153
167
</StatusBadge>
154
168
);
155
169
})()}
156
-
{link.discountCode&&(
157
-
<Tooltip
158
-
content={
159
-
"This program supports discount code tracking. Copy the code to use it in podcasts, videos, etc. [Learn more](https://dub.co/help/article/dual-sided-incentives)"
<Tooltipcontent="This program supports discount code tracking. Copy the code to use it in podcasts, videos, etc. [Learn more](https://dub.co/help/article/dual-sided-incentives)">
0 commit comments