Skip to content

Commit

Permalink
feat(sofi-referral): set referral cookie if the ref param is present
Browse files Browse the repository at this point in the history
  • Loading branch information
mrodriguez-bc committed Jan 26, 2024
1 parent 0006170 commit 55006d8
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/blockchain-wallet-v4-frontend/src/scenes/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { ThemeProvider as ConstellationTP } from '@blockchain-com/constellation'
import { ConnectedRouter } from 'connected-react-router'
import { Store } from 'redux'
import { PersistGate } from 'redux-persist/integration/react'
import Cookies from 'universal-cookie'
import { createClient, Provider as UrqlProvider } from 'urql'

import { WalletOptionsType } from '@core/types'
Expand Down Expand Up @@ -122,6 +123,20 @@ const App = ({
}
})

// effect for handling partner referrals
useEffect(() => {
const queryString = window.location.search
const urlParams = new URLSearchParams(queryString)
const referral = urlParams.get('ref')
if (referral) {
const cookies = new Cookies()
cookies.set('partnerReferralCode', referral, {
domain: '.blockchain.com',
path: '/'
})
}
}, [])

const client = createClient({
url: `${apiUrl}/nft-market-api/graphql/`
})
Expand Down

0 comments on commit 55006d8

Please sign in to comment.