-
Notifications
You must be signed in to change notification settings - Fork 504
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Jumio): getJumioToken, add step to flow
- Loading branch information
plondon
committed
Jul 17, 2018
1 parent
8dc1536
commit d39f88d
Showing
12 changed files
with
266 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
packages/blockchain-wallet-v4-frontend/src/modals/SfoxExchangeData/Jumio/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React from 'react' | ||
import { connect } from 'react-redux' | ||
import { bindActionCreators, compose } from 'redux' | ||
import { actions } from 'data' | ||
|
||
import { getData } from './selectors' | ||
import Success from './template.success' | ||
|
||
class JumioContainer extends React.PureComponent { | ||
componentWillMount () { | ||
this.props.sfoxActions.getJumioToken() | ||
} | ||
|
||
render () { | ||
const { data } = this.props | ||
return data.cata({ | ||
Success: value => <Success token={value.token} options={value.options} />, | ||
Loading: () => <div>Loading</div>, | ||
Failure: msg => <div>{msg}</div>, | ||
NotAsked: () => <div /> | ||
}) | ||
} | ||
} | ||
|
||
const mapStateToProps = state => ({ | ||
data: getData(state) | ||
}) | ||
|
||
const mapDispatchToProps = dispatch => ({ | ||
sfoxActions: bindActionCreators(actions.modules.sfox, dispatch) | ||
}) | ||
|
||
const enhance = compose( | ||
connect( | ||
mapStateToProps, | ||
mapDispatchToProps | ||
) | ||
) | ||
|
||
export default enhance(JumioContainer) |
16 changes: 16 additions & 0 deletions
16
packages/blockchain-wallet-v4-frontend/src/modals/SfoxExchangeData/Jumio/selectors.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { selectors } from 'data' | ||
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) => { | ||
return { | ||
options, | ||
token | ||
} | ||
} | ||
return lift(transform)(optionsR, tokenR) | ||
} | ||
) |
38 changes: 38 additions & 0 deletions
38
packages/blockchain-wallet-v4-frontend/src/modals/SfoxExchangeData/Jumio/template.success.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React from 'react' | ||
import styled from 'styled-components' | ||
import { path } from 'ramda' | ||
|
||
const Container = styled.div` | ||
width: 100%; | ||
height: 100%; | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
` | ||
const JumioFrame = styled.iframe` | ||
width: 80%; | ||
height: 450px; | ||
border-width: 1px; | ||
border-style: solid; | ||
border-color: ${props => props.theme['gray-1']}; | ||
` | ||
|
||
const Success = value => { | ||
const { options, token } = value | ||
const { authorizationToken } = token | ||
const walletHelperRoot = path(['domains', 'walletHelper'], options) | ||
const jumioUrl = `${walletHelperRoot}/wallet-helper/jumio/#/key/${authorizationToken}` | ||
|
||
return ( | ||
<Container> | ||
<JumioFrame | ||
src={jumioUrl} | ||
sandbox='allow-same-origin allow-scripts allow-forms allow-popups' | ||
scrolling='yes' | ||
id='jumio' | ||
/> | ||
</Container> | ||
) | ||
} | ||
|
||
export default Success |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.