Skip to content

Commit

Permalink
feat(sb): speed up loads a bit and handle no tier 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip London committed Jul 25, 2020
1 parent aa832b3 commit 17bdadc
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 25 deletions.
Expand Up @@ -576,13 +576,35 @@ export default ({
return yield put(A.fetchSBPairsFailure(NO_PAIR_SELECTED))
}

yield put(
A.setStep({
step: 'ENTER_AMOUNT',
method,
...result
})
)
switch (method.type) {
case 'BANK_ACCOUNT':
const isUserTier2 = yield call(isTier2)
if (isUserTier2) {
return yield put(
A.setStep({
step: 'TRANSFER_DETAILS',
displayBack: true,
...result
})
)
} else {
return yield put(
actions.components.identityVerification.verifyIdentity(
2,
undefined,
'SBPaymentMethodSelection'
)
)
}
default:
yield put(
A.setStep({
step: 'ENTER_AMOUNT',
method,
...result
})
)
}
}

const initializeBillingAddress = function * () {
Expand Down
Expand Up @@ -49,6 +49,7 @@ export type ModalOriginType =
| 'RetrySendEth'
| 'RunKycGoal'
| 'SBEnterAmountCheckout'
| 'SBPaymentMethodSelection'
| 'Send'
| 'SendBch'
| 'SendBtc'
Expand Down
@@ -1,13 +1,14 @@
import { actions } from 'data'
import { bindActionCreators, Dispatch } from 'redux'
import { connect, ConnectedProps } from 'react-redux'
import { FiatType, PriceMovementDirType, SBPairType } from 'core/types'
import { getCoinFromPair } from 'data/components/simpleBuy/model'
import { RootState } from 'data/rootReducer'
import React, { PureComponent } from 'react'
import styled, { DefaultTheme } from 'styled-components'

import { FiatType, PriceMovementDirType, SBPairType } from 'core/types'
import { getCoinFromPair } from 'data/components/simpleBuy/model'
import { getData } from './selectors'
import { Remote } from 'blockchain-wallet-v4/src'
import { RootState } from 'data/rootReducer'
import { SkeletonRectangle } from 'blockchain-info-components'

const Container = styled.span`
Expand Down Expand Up @@ -42,8 +43,13 @@ const getColorFromMovement = (movement: PriceMovementDirType) => {

class PriceMovement extends PureComponent<Props, State> {
componentDidMount () {
const coin = getCoinFromPair(this.props.value.pair)
this.props.miscActions.fetchPrice24H(coin, this.props.fiatCurrency || 'EUR')
if (!Remote.Success.is(this.props.data)) {
const coin = getCoinFromPair(this.props.value.pair)
this.props.miscActions.fetchPrice24H(
coin,
this.props.fiatCurrency || 'EUR'
)
}
}

render () {
Expand Down
@@ -1,16 +1,18 @@
import { actions, selectors } from 'data'
import { bindActionCreators, Dispatch } from 'redux'
import { connect, ConnectedProps } from 'react-redux'
import React, { PureComponent } from 'react'

import { actions, selectors } from 'data'
import { getData } from './selectors'
import { Remote } from 'blockchain-wallet-v4/src'
import { RootState } from 'data/rootReducer'
import Failure from './template.failure'
import Loading from './template.loading'
import React, { PureComponent } from 'react'
import Success from './template.success'

class CryptoSelection extends PureComponent<Props> {
componentDidMount () {
if (this.props.fiatCurrency) {
if (this.props.fiatCurrency && !Remote.Success.is(this.props.data)) {
this.props.simpleBuyActions.fetchSBPairs(this.props.fiatCurrency)
this.props.simpleBuyActions.fetchSBFiatEligible(this.props.fiatCurrency)
}
Expand Down
@@ -1,6 +1,8 @@
import { actions, selectors } from 'data'
import { bindActionCreators, Dispatch } from 'redux'
import { connect, ConnectedProps } from 'react-redux'
import React, { PureComponent } from 'react'

import { actions, selectors } from 'data'
import {
ExtractSuccess,
FiatType,
Expand All @@ -10,15 +12,15 @@ import {
SBPaymentMethodType
} from 'core/types'
import { getData } from './selectors'
import { Remote } from 'blockchain-wallet-v4/src'
import { RootState } from 'data/rootReducer'
import Failure from './template.failure'
import Loading from './template.loading'
import React, { PureComponent } from 'react'
import Success from './template.success'

class EnterAmount extends PureComponent<Props> {
componentDidMount () {
if (this.props.fiatCurrency && !this.props.method) {
if (this.props.fiatCurrency && !Remote.Success.is(this.props.data)) {
this.props.simpleBuyActions.fetchSBPaymentMethods(this.props.fiatCurrency)
this.props.simpleBuyActions.fetchSBOrders()
this.props.simpleBuyActions.fetchSBCards()
Expand Down
Expand Up @@ -218,13 +218,7 @@ class Payments extends PureComponent<InjectedFormProps<{}, Props> & Props> {
key={`${bankAccount.text}`}
{...bankAccount}
icon={this.getIcon(bankAccount.value)}
onClick={() =>
this.props.simpleBuyActions.setStep({
step: 'TRANSFER_DETAILS',
fiatCurrency,
displayBack: true
})
}
onClick={() => this.handleSubmit(bankAccount.value)}
/>
)}
</PaymentsWrapper>
Expand Down

0 comments on commit 17bdadc

Please sign in to comment.