Skip to content

Commit

Permalink
fix(LinkContext): create full deep link with required parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Thore3 committed Jul 22, 2019
1 parent d5e4e12 commit c509ac7
Showing 1 changed file with 16 additions and 4 deletions.
Expand Up @@ -9,6 +9,9 @@ import Error from './template.error'
import { Wrapper } from 'components/Public'

const VALID_CONTEXTS = ['PIT_SIGNUP', 'KYC', 'SETTINGS']
const PARAM_DEEP_LINK_PATH = 'email_verified'
const PARAM_ISI = '493253309'
const PARAM_IBI = 'com.rainydayapps.Blockchain'

class VerifyEmailToken extends React.PureComponent {
state = {
Expand All @@ -27,12 +30,21 @@ class VerifyEmailToken extends React.PureComponent {
const isProdEnv = this.props.appEnv === 'prod'

const link = isProdEnv
? 'https://blockchain.page.link/email_verified'
: 'https://blockchainwalletstaging.page.link/email_verified'
? 'https://blockchain.page.link/'
: 'https://blockchainwalletstaging.page.link/'

const isValidContext = VALID_CONTEXTS.indexOf(context) > -1
const params = new URLSearchParams()
params.set('deep_link_path', PARAM_DEEP_LINK_PATH)
params.set('isi', PARAM_ISI)
params.set('ibi', PARAM_IBI)

return isValidContext ? `${link}?context=${context}` : link
if (VALID_CONTEXTS.indexOf(context) > -1) {
params.set('context', context)
}

const deepLinkComponent = `${window.location.origin}/login?${params}`

return link + '?link=' + encodeURIComponent(deepLinkComponent)
}

render () {
Expand Down

0 comments on commit c509ac7

Please sign in to comment.