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.

CR feedback

Kiran K65da0d9876e5
diff --git a/apps/web/lib/actions/partners/create-discount.ts b/apps/web/lib/actions/partners/create-discount.ts
index 2dbcc188d6..75dbb69e7f 100644
--- a/apps/web/lib/actions/partners/create-discount.ts
+++ b/apps/web/lib/actions/partners/create-discount.ts
@@ -82,8 +82,12 @@ export const createDiscountAction = authActionClient
type,
maxDuration,
provider,
- couponId: coupon?.id || couponId || null,
- ...(couponTestId && { couponTestId }),
+ couponId:
+ provider === DiscountProvider.stripe
+ ? coupon?.id || couponId || null
+ : null,
+ ...(provider === DiscountProvider.stripe &&
+ couponTestId && { couponTestId }),
...(autoProvision && { autoProvisionEnabledAt: new Date() }),
},
});
diff --git a/apps/web/lib/discounts/create-discount-code.ts b/apps/web/lib/discounts/create-discount-code.ts
index 43b10d3876..335a0d1674 100644
--- a/apps/web/lib/discounts/create-discount-code.ts
+++ b/apps/web/lib/discounts/create-discount-code.ts
@@ -97,11 +97,13 @@ export async function createDiscountCode({
}
waitUntil(
- sendWorkspaceWebhook({
- workspace,
- trigger: "discount_code.created",
- data: DiscountCodeWebhookSchema.parse(discountCode),
- }),
+ (async () => {
+ await sendWorkspaceWebhook({
+ workspace,
+ trigger: "discount_code.created",
+ data: DiscountCodeWebhookSchema.parse(discountCode),
+ });
+ })(),
);
return discountCode;
diff --git a/apps/web/ui/modals/delete-discount-code-modal.tsx b/apps/web/ui/modals/delete-discount-code-modal.tsx
index 0c363cdf8a..64a55d6efe 100644
--- a/apps/web/ui/modals/delete-discount-code-modal.tsx
+++ b/apps/web/ui/modals/delete-discount-code-modal.tsx
@@ -24,9 +24,7 @@ export const DeleteDiscountCodeModal = ({
const [inputValue, setInputValue] = useState("");
useEffect(() => {
- if (!showModal) {
- setInputValue("");
- }
+ setInputValue("");
}, [showModal, discountCode.id]);
const onSubmit = async (e: FormEvent<HTMLFormElement>) => {