Skip to content

Commit

Permalink
feat(The PIT): everyones invited❕
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip London committed Oct 24, 2019
1 parent 0187fe1 commit 6509b25
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 119 deletions.
2 changes: 1 addition & 1 deletion config/mocks/wallet-options-v4.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@
}
},
"thePit": {
"countries": ["US"]
"countries": []
},
"sfox": {
"countries": ["US"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ const ThePitSidenavItem = (showSpotlight, isPitAccountLinked) => (
)

const PitLink = props => {
if (!props.showThePitPulse || props.pitConnectTest === 'original')
return (
<SpotlightLinkContainer to='/thepit' activeClassName='active'>
{props.children}
</SpotlightLinkContainer>
)
// if (!props.showThePitPulse || props.pitConnectTest === 'original')
return (
<SpotlightLinkContainer to='/thepit' activeClassName='active'>
{props.children}
</SpotlightLinkContainer>
)

return <div>{props.children}</div>
// return <div>{props.children}</div>
}

const PitLinkContent = props => {
Expand Down Expand Up @@ -134,22 +134,20 @@ const PitLinkContent = props => {
}

const ThePitLink = props => {
return props.isInvitedToPitSidenav ? (
props.isPitAccountLinked ? (
<Link
href={props.pitUrl}
rel='noopener noreferrer'
target='_blank'
style={{ width: '100%' }}
>
<MenuItem data-e2e='thePitLink'>
{ThePitSidenavItem(null, props.isPitAccountLinked)}
</MenuItem>
</Link>
) : (
<PitLinkContent {...props} />
)
) : null
return props.isPitAccountLinked ? (
<Link
href={props.pitUrl}
rel='noopener noreferrer'
target='_blank'
style={{ width: '100%' }}
>
<MenuItem data-e2e='thePitLink'>
{ThePitSidenavItem(null, props.isPitAccountLinked)}
</MenuItem>
</Link>
) : (
<PitLinkContent {...props} />
)
}

export default ThePitLink
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
import React from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { pathOr } from 'ramda'
import { actions, model, selectors } from 'data'
// import { pathOr } from 'ramda'
import { actions } from 'data'
import { getData } from './selectors'
import { Remote } from 'blockchain-wallet-v4/src'
// import { Remote } from 'blockchain-wallet-v4/src'
import MenuLeft from './template.success'
import Loading from './template.loading'
import Failure from './template.failure'

const { AB_TESTS } = model.analytics
// const { AB_TESTS } = model.analytics
class MenuLeftContainer extends React.PureComponent {
componentDidMount () {
if (Remote.Success.is(this.props.abTest)) return
this.props.analyticsActions.createABTest(AB_TESTS.PIT_CONNECT_TEST)
window.addEventListener('message', this.receiveMatomoMessage, false)
// Fallback if a/b test can not be created
setTimeout(() => {
if (!Remote.Success.is(this.props.abTest)) {
this.props.analyticsActions.createABTestSuccess(
AB_TESTS.PIT_CONNECT_TEST,
'original'
)
}
}, 1000)
}
// componentDidMount () {
// if (Remote.Success.is(this.props.abTest)) return
// this.props.analyticsActions.createABTest(AB_TESTS.PIT_CONNECT_TEST)
// window.addEventListener('message', this.receiveMatomoMessage, false)
// // Fallback if a/b test can not be created
// setTimeout(() => {
// if (!Remote.Success.is(this.props.abTest)) {
// this.props.analyticsActions.createABTestSuccess(
// AB_TESTS.PIT_CONNECT_TEST,
// 'original'
// )
// }
// }, 1000)
// }

receiveMatomoMessage = res => {
if (res.data.from === 'matomo') {
const result = pathOr('original', ['data', 'command'], res)
this.props.analyticsActions.createABTestSuccess(
AB_TESTS.PIT_CONNECT_TEST,
result
)
}
}
// receiveMatomoMessage = res => {
// if (res.data.from === 'matomo') {
// const result = pathOr('original', ['data', 'command'], res)
// this.props.analyticsActions.createABTestSuccess(
// AB_TESTS.PIT_CONNECT_TEST,
// result
// )
// }
// }

render () {
const { data } = this.props
Expand All @@ -49,8 +49,8 @@ class MenuLeftContainer extends React.PureComponent {
}

const mapStateToProps = state => ({
data: getData(state),
abTest: selectors.analytics.selectAbTest(AB_TESTS.PIT_CONNECT_TEST)(state)
data: getData(state)
// abTest: selectors.analytics.selectAbTest(AB_TESTS.PIT_CONNECT_TEST)(state)
})

const mapDispatchToProps = dispatch => ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { lift } from 'ramda'
import { model, selectors } from 'data'
import { selectors } from 'data'
import { createDeepEqualSelector } from 'services/ReselectHelper'
import { STATUS } from 'react-joyride/lib'

const { AB_TESTS } = model.analytics
// const { AB_TESTS } = model.analytics

export const getData = createDeepEqualSelector(
[
selectors.analytics.selectAbTest(AB_TESTS.PIT_CONNECT_TEST),
// selectors.analytics.selectAbTest(AB_TESTS.PIT_CONNECT_TEST),
selectors.preferences.getShowThePitPulse,
selectors.components.layoutWallet.getMenuOpened,
selectors.components.layoutWallet.getLockboxOpened,
Expand All @@ -19,11 +20,10 @@ export const getData = createDeepEqualSelector(
selectors.core.settings.getCountryCode,
selectors.core.walletOptions.getAdsBlacklist,
selectors.core.walletOptions.getAdsUrl,
selectors.modules.profile.getUserKYCState,
selectors.modules.profile.isInvitedToPitSidenav
selectors.modules.profile.getUserKYCState
],
(
pitConnectTest,
// pitConnectTest,
showThePitPulse,
menuOpened,
lockboxOpened,
Expand All @@ -36,43 +36,39 @@ export const getData = createDeepEqualSelector(
countryCodeR,
adsBlacklistR,
adsUrlR,
userKYCState,
isInvitedToPitSidenavR
userKYCState
) => {
const transform = (
pitConnectTest,
// pitConnectTest,
canTrade,
lockboxDevices,
countryCode,
userKYCState,
isInvitedToPitSidenav
userKYCState
) => {
return {
adsBlacklist: adsBlacklistR.getOrElse([]),
adsUrl: adsUrlR.getOrElse(''),
canTrade,
countryCode,
hasRunWalletTour: walletTourVisibility,
hasRunWalletTour: walletTourVisibility === STATUS.FINISHED,
hasSkippedTour: hasSkippedTourR.getOrElse(false),
isInvitedToPitSidenav,
firstLogin,
lockboxDevices,
lockboxOpened,
menuOpened,
pathname,
pitConnectTest,
// pitConnectTest,
showThePitPulse,
userKYCState
}
}

return lift(transform)(
pitConnectTest,
// pitConnectTest,
canTradeR,
lockboxDevicesR,
countryCodeR,
userKYCState,
isInvitedToPitSidenavR
userKYCState
)
}
)
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const Home = props => {

const handleTourCallbacks = data => {
if ([STATUS.FINISHED, STATUS.SKIPPED].includes(data.status)) {
onboardingActions.setWalletTourVisibility(false)
onboardingActions.setWalletTourVisibility(STATUS.FINISHED)
}
// PIT tooltip seen
if (data.index === 5) {
Expand All @@ -119,7 +119,7 @@ const Home = props => {
</ColumnRight>
</ColumnWrapper>
<Joyride
run={showWalletTour}
run={showWalletTour === true}
steps={TOUR_STEPS}
disableScrollParentFix={true}
callback={handleTourCallbacks}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { actions, model, selectors } from 'data'
import { actions, model } from 'data'
import ThePit from './template'

const { AB_TESTS, PIT_EVENTS } = model.analytics
const { PIT_EVENTS } = model.analytics

class ThePitContainer extends React.PureComponent {
componentDidMount () {
Expand All @@ -31,19 +31,13 @@ class ThePitContainer extends React.PureComponent {
}
}

const mapStateToProps = state => ({
pitConnectTest: selectors.analytics.selectAbTest(AB_TESTS.PIT_CONNECT_TEST)(
state
)
})

const mapDispatchToProps = dispatch => ({
analyticsActions: bindActionCreators(actions.analytics, dispatch),
modalActions: bindActionCreators(actions.modals, dispatch),
preferencesActions: bindActionCreators(actions.preferences, dispatch)
})

export default connect(
mapStateToProps,
null,
mapDispatchToProps
)(ThePitContainer)
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@ import styled from 'styled-components'
import { FormattedMessage } from 'react-intl'

import media from 'services/ResponsiveService'
import {
Button,
Image,
Link,
Text,
TextGroup
} from 'blockchain-info-components'
import { Button, Image, Text, TextGroup } from 'blockchain-info-components'

const Wrapper = styled.div`
height: 100%;
Expand Down Expand Up @@ -83,13 +77,6 @@ const Column = styled.div`
}
`

const FooterColumn = styled(Column)`
padding-left: 25px;
${media.tablet`
padding-left: 0;
`}
`

const StarfieldColumn = styled(Column)`
background-image: url('/img/starfield2.png');
background-repeat: no-repeat;
Expand Down Expand Up @@ -131,17 +118,14 @@ const FooterButton = styled(Button)`
font-size: 16px;
font-weight: 700;
`
const FooterLink = styled(Link)`
width: 100%;
`
const PitLogo = styled(Image)`
margin-bottom: 10px;
filter: invert(0);
height: 40px;
`

const ThePit = props => {
const { onLearnMore, onSignup, pitConnectTest } = props
const { onSignup } = props
return (
<Wrapper>
<Container>
Expand Down Expand Up @@ -227,26 +211,6 @@ const ThePit = props => {
/>
</FooterButton>
</Column>
<FooterColumn>
<FooterLink
href={`https://pit.blockchain.com/?utm_source=web_wallet&utm_medium=referral&utm_campaign=${pitConnectTest.getOrElse(
'original'
)}`}
target='_blank'
rel='noopener noreferrer'
>
<FooterButton
nature='empty-secondary'
fullwidth
onClick={onLearnMore}
>
<FormattedMessage
id='scenes.thepit.learnmore'
defaultMessage='Learn More'
/>
</FooterButton>
</FooterLink>
</FooterColumn>
</Row>
</Container>
</Wrapper>
Expand Down

0 comments on commit 6509b25

Please sign in to comment.