( campaign: ReferralCampaign = 'claude_code_guest_pass', )
| 24 | let fetchInProgress: Promise<ReferralEligibilityResponse | null> | null = null |
| 25 | |
| 26 | export async function fetchReferralEligibility( |
| 27 | campaign: ReferralCampaign = 'claude_code_guest_pass', |
| 28 | ): Promise<ReferralEligibilityResponse> { |
| 29 | const { accessToken, orgUUID } = await prepareApiRequest() |
| 30 | |
| 31 | const headers = { |
| 32 | ...getOAuthHeaders(accessToken), |
| 33 | 'x-organization-uuid': orgUUID, |
| 34 | } |
| 35 | |
| 36 | const url = `${getOauthConfig().BASE_API_URL}/api/oauth/organizations/${orgUUID}/referral/eligibility` |
| 37 | |
| 38 | const response = await axios.get(url, { |
| 39 | headers, |
| 40 | params: { campaign }, |
| 41 | timeout: 5000, // 5 second timeout for background fetch |
| 42 | }) |
| 43 | |
| 44 | return response.data |
| 45 | } |
| 46 | |
| 47 | export async function fetchReferralRedemptions( |
| 48 | campaign: string = 'claude_code_guest_pass', |
no test coverage detected