From bc1635cc86050f008a0671da1efe4cef7af40fe4 Mon Sep 17 00:00:00 2001 From: 0xkkonrad Date: Wed, 5 Aug 2026 13:35:27 +0000 Subject: [PATCH] fix(badges): register naija and terere as bare claimable campaigns Both country-launch links ship with no inviter. Mapping them in UTM_CAMPAIGN_TO_BADGE_MAP was not enough: classifyBareCampaign only bypasses the invite gate for campaigns registered in WAITLIST_SKIP_CAMPAIGNS or BARE_VANITY_CAMPAIGNS, so a bare ?campaign=naija dead-ended on 'Invalid Invite Code' instead of awarding the badge. Same bug that left touched_grass unclaimable. They go in WAITLIST_SKIP_CAMPAIGNS, not BARE_VANITY_CAMPAIGNS: both badges are in peanut-api-ts POSTLAUNCH_SKIP_BADGE_CODES, and the vanity set is for badges with no card-waitlist skip. Filing them as vanity would show generic claim copy while the backend granted a skip anyway. --- src/components/Invites/campaign-maps.test.ts | 11 +++++++++++ src/components/Invites/campaign-maps.ts | 7 ++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/components/Invites/campaign-maps.test.ts b/src/components/Invites/campaign-maps.test.ts index 2c303e884..7e74de50e 100644 --- a/src/components/Invites/campaign-maps.test.ts +++ b/src/components/Invites/campaign-maps.test.ts @@ -59,6 +59,17 @@ describe('classifyBareCampaign', () => { }) }) + // Regression: both country-launch cohorts ship BARE links with no inviter. + // Mapping them in UTM_CAMPAIGN_TO_BADGE_MAP alone is not enough — without a + // bare-campaign registration the link dead-ends on "Invalid Invite Code". + it.each(['naija', 'terere'])('country-launch campaign "%s" is a bare claimable skip', (c) => { + expect(classifyBareCampaign(c, undefined)).toEqual({ + isBareClaimCampaign: true, + isWaitlistSkip: true, + }) + expect(classifyBareCampaign(c.toUpperCase(), undefined).isBareClaimCampaign).toBe(true) + }) + it('only waitlist-skip campaigns promise a card-waitlist skip', () => { for (const c of BARE_VANITY_CAMPAIGNS) { expect(classifyBareCampaign(c, undefined).isWaitlistSkip).toBe(false) diff --git a/src/components/Invites/campaign-maps.ts b/src/components/Invites/campaign-maps.ts index 6f0910259..8035c5b10 100644 --- a/src/components/Invites/campaign-maps.ts +++ b/src/components/Invites/campaign-maps.ts @@ -90,7 +90,12 @@ export function resolveCampaign( // - Vanity: a commemorative badge with NO card-waitlist skip. Claimable from a // bare link, but `/invite` shows generic badge-claim copy (not "skip"). export const SKIP_CAMPAIGN = 'skip' -export const WAITLIST_SKIP_CAMPAIGNS: ReadonlySet = new Set([SKIP_CAMPAIGN, 'event_alumni']) +// naija and terere are the country-launch cohorts. Both are distributed as BARE +// campaign links with no inviter, and both are in peanut-api-ts +// POSTLAUNCH_SKIP_BADGE_CODES — so they belong here, not in BARE_VANITY_CAMPAIGNS +// (that set is for badges with no card-waitlist skip, and would show the wrong +// copy while the backend granted a skip anyway). +export const WAITLIST_SKIP_CAMPAIGNS: ReadonlySet = new Set([SKIP_CAMPAIGN, 'event_alumni', 'naija', 'terere']) export const BARE_VANITY_CAMPAIGNS: ReadonlySet = new Set([ 'touched_grass', 'card_alpha',