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 import-affiliate-coupons.ts

Kiran Kca76c57123f7
diff --git a/apps/web/lib/rewardful/import-affiliate-coupons.ts b/apps/web/lib/rewardful/import-affiliate-coupons.ts
index a0f831526d..59e05bffe6 100644
--- a/apps/web/lib/rewardful/import-affiliate-coupons.ts
+++ b/apps/web/lib/rewardful/import-affiliate-coupons.ts
@@ -76,10 +76,18 @@ export async function importAffiliateCoupons(payload: RewardfulImportPayload) {
continue;
}
+ const activeCoupons = affiliateCoupons.filter(
+ (coupon) => !coupon.archived,
+ );
+
+ if (activeCoupons.length === 0) {
+ continue;
+ }
+
linksToCreate.push(
- ...coupons.map((coupon) => ({
+ ...activeCoupons.map((coupon) => ({
domain: program.domain,
- key: coupon.token.toLowerCase(),
+ key: coupon.token,
url: program.url,
trackConversion: true,
programId,