Skip to content

Commit

Permalink
feat(Jumio): add 'next' to jumio flow, if user has account close, if …
Browse files Browse the repository at this point in the history
…not go to funding
  • Loading branch information
plondon committed Jul 17, 2018
1 parent d39f88d commit 3d34a25
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,33 @@ import { getData } from './selectors'
import Success from './template.success'

class JumioContainer extends React.PureComponent {
constructor (props) {
super(props)
this.onFinish = this.onFinish.bind(this)
}

componentWillMount () {
this.props.sfoxActions.getJumioToken()
}

onFinish () {
const { data } = this.props
const { accounts } = data.getOrElse({})
accounts.length
? this.props.modalActions.closeModal()
: this.props.sfoxActions.nextStep('funding')
}

render () {
const { data } = this.props
return data.cata({
Success: value => <Success token={value.token} options={value.options} />,
Success: value => (
<Success
token={value.token}
options={value.options}
onFinish={this.onFinish}
/>
),
Loading: () => <div>Loading</div>,
Failure: msg => <div>{msg}</div>,
NotAsked: () => <div />
Expand All @@ -27,6 +46,7 @@ const mapStateToProps = state => ({
})

const mapDispatchToProps = dispatch => ({
modalActions: bindActionCreators(actions.modals, dispatch),
sfoxActions: bindActionCreators(actions.modules.sfox, dispatch)
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@ import { lift, path } from 'ramda'
import { createDeepEqualSelector } from 'services/ReselectHelper'

export const getData = createDeepEqualSelector(
[selectors.core.walletOptions.getOptions, path(['sfoxSignup', 'jumioToken'])],
(optionsR, tokenR) => {
const transform = (options, token) => {
[
selectors.core.data.sfox.getAccounts,
selectors.core.walletOptions.getOptions,
path(['sfoxSignup', 'jumioToken'])
],
(accountsR, optionsR, tokenR) => {
const transform = (accounts, options, token) => {
return {
accounts,
options,
token
}
}
return lift(transform)(optionsR, tokenR)
return lift(transform)(accountsR, optionsR, tokenR)
}
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const Container = styled.div`
width: 100%;
height: 100%;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
flex-direction: column;
`
const JumioFrame = styled.iframe`
width: 80%;
Expand All @@ -16,9 +16,20 @@ const JumioFrame = styled.iframe`
border-style: solid;
border-color: ${props => props.theme['gray-1']};
`
const LinkContainer = styled.div`
width: 80%;
margin-top: 5px;
text-align: right;
`
const Link = styled.span`
cursor: pointer;
font-size: 13px;
text-decoration: underline;
color: ${props => props.theme['brand-secondary']};
`

const Success = value => {
const { options, token } = value
const Success = props => {
const { options, token, onFinish } = props
const { authorizationToken } = token
const walletHelperRoot = path(['domains', 'walletHelper'], options)
const jumioUrl = `${walletHelperRoot}/wallet-helper/jumio/#/key/${authorizationToken}`
Expand All @@ -31,6 +42,9 @@ const Success = value => {
scrolling='yes'
id='jumio'
/>
<LinkContainer>
<Link onClick={onFinish}>Next</Link>
</LinkContainer>
</Container>
)
}
Expand Down

0 comments on commit 3d34a25

Please sign in to comment.