Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/airdrop push #1501

Merged
merged 11 commits into from
Mar 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/blockchain-info-components/src/Buttons/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ const selectColor = (nature, disabled, small) => {
backgroundColor: 'white',
borderColor: 'brand-secondary'
}
case 'purple':
return {
color: 'white',
backgroundColor: 'purple',
borderColor: 'purple'
}
default:
return {
color: 'gray-6',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default {
black: '#272727',
textBlack: '#9c9c9c',
// Blues
purple: '#0D3578',
'deep-blue': '#101C35',
'navy-blue': '#1F283C',
'darkblue-gray': '#2C343C',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default {
black: '#000000',
textBlack: '#030E26',
// Blues
purple: '#0D3578',
'deep-blue': '#152343',
'navy-blue': '#27324B',
'darkblue-gray': '#222D38',
Expand Down
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
953 changes: 370 additions & 583 deletions packages/blockchain-info-components/src/Fonts/Icomoon/selection.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions packages/blockchain-info-components/src/Icons/Icomoon.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default {
checkmark: '\\e95d',
'checkmark-in-circle': '\\e95c',
'checkmark-in-circle-filled': '\\e90b',
copy: '\\e91a',
close: '\\e93f',
'close-bold': '\\e90f',
'close-filled': '\\e90d',
Expand All @@ -39,6 +40,7 @@ export default {
'eth-circle': '\\e989',
'eth-circle-filled': '\\e907',
exchange: '\\e965',
facebook: '\\e918',
forbidden: '\\e904',
globe: '\\e945',
'hamburger-menu': '\\e919',
Expand Down Expand Up @@ -83,6 +85,7 @@ export default {
'sync-regular': '\\e93d',
transactions: '\\e976',
trash: '\\e951',
twitter: '\\e916',
'up-arrow': '\\e953',
'up-arrow-in-circle': '\\e952',
'usb-icon': '\\e95a',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,21 @@ export const headers = {
)
}

export const levelName = {
SILVER: (
<FormattedMessage
id='components.identityverification.tiercard.silverlevelname'
defaultMessage='Silver'
/>
),
GOLD: (
<FormattedMessage
id='components.identityverification.tiercard.goldlevelname'
defaultMessage='Gold'
/>
)
}

export const messages = {
EMAIL: (
<Text size='12px'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const Logo = styled(Image)`

const StepIndicator = props => {
const {
adjuster,
className,
step,
stepMap,
Expand All @@ -87,7 +88,7 @@ const StepIndicator = props => {
} = props
const steps = Object.keys(stepMap)
const index = steps.indexOf(step) + 1
const width = (index - 0.5) / steps.length
const width = (index - adjuster) / steps.length

return (
<Wrapper className={className} flexEnd={flexEnd}>
Expand All @@ -109,7 +110,7 @@ const StepIndicator = props => {
}

StepIndicator.defaultProps = {
adjuster: 0.0
adjuster: 0.5
}

export default StepIndicator
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ class Tooltips extends React.PureComponent {
render () {
return (
<div>
<Tooltip id='copied'>
<FormattedMessage id='tooltip.copied' defaultMessage='Copied!' />
</Tooltip>
<Tooltip id='addr' multiline offset={{ bottom: 8 }} />
<Tooltip id='lockbox.exportkeyswarning'>
<FormattedMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ exports[`ListItemContainer renders correctly 1`] = `
}
preferencesActions={
Object {
"hideAirdropClaimModal": [Function],
"hideAirdropReminderModal": [Function],
"hideKycCompleted": [Function],
"hideKycGetStarted": [Function],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export default ({ api, coreSagas }) => {
yield put(actions.goals.saveGoal('upgradeForAirdrop'))
yield put(actions.goals.saveGoal('swapUpgrade'))
yield put(actions.goals.saveGoal('swapGetStarted'))
yield put(actions.goals.saveGoal('airdropClaim'))
yield put(actions.goals.saveGoal('kycDocResubmit'))
yield put(actions.goals.saveGoal('bsv'))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ export default ({ api, coreSagas, networks }) => {
yield put(actions.form.stopSubmit(CONFIRM_FORM))
yield put(actions.router.push('/swap/history'))
yield put(A.setStep(EXCHANGE_STEPS.EXCHANGE_FORM))
yield delay(100)
yield take(actionTypes.modals.CLOSE_ALL_MODALS)
yield put(
actions.modals.showModal(RESULTS_MODAL, formatExchangeTrade(trade))
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export const RESEND_SMS_CODE = '@EVENT.KYC.RESEND_SMS_CODE'
export const REGISTER_USER_CAMPAIGN = '@EVENT.KYC.REGISTER_USER_CAMPAIGN'
export const CREATE_REGISTER_USER_CAMPAIGN =
'@EVENT.KYC.CREATE_REGISTER_USER_CAMPAIGN'
export const CLAIM_CAMPAIGN_CLICKED = '@EVENT.KYC.CLAIM_CAMPAIGN_CLICKED'

export const CHECK_KYC_FLOW = '@EVENT.KYC.CHECK_KYC_FLOW'
export const SET_KYC_FLOW_LOADING = '@DATA.KYC.SET_KYC_FLOW_LOADING'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ export const registerUserCampaign = newUser => ({
export const createRegisterUserCampaign = () => ({
type: AT.CREATE_REGISTER_USER_CAMPAIGN
})
export const claimCampaignClicked = campaign => ({
type: AT.CLAIM_CAMPAIGN_CLICKED,
payload: { campaign }
})

export const checkKycFlow = () => ({
type: AT.CHECK_KYC_FLOW
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ export const STEPS = {
personal: 'personal',
moreInfo: 'moreInfo',
mobile: 'mobile',
verify: 'verify'
verify: 'verify',
submitted: 'submitted'
}

export const STEP_TIERS = {
personal: TIERS[1],
moreInfo: TIERS[2],
mobile: TIERS[2],
verify: TIERS[2]
verify: TIERS[2],
submitted: TIERS[2]
}

export const COINIFY_STEP = 'coinify'
Expand All @@ -37,6 +39,7 @@ export const PERSONAL_FORM = '@KYC.personalForm'
export const EMAIL_FORM = '@KYC.emailForm'
export const SMS_NUMBER_FORM = '@KYC.smsNumberForm'
export const ADDRESS_FORM = '@KYC.addresForm'
export const ID_VERIFICATION_SUBMITTED_FORM = '@KYC.idVerificationSubmittedForm'

export const PHONE_EXISTS_ERROR = 'Phone number already registered'
export const BAD_CODE_ERROR = 'SMS Verification Code Incorrect.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ export default ({ api, coreSagas }) => {
AT.CREATE_REGISTER_USER_CAMPAIGN,
identityVerificationSagas.createRegisterUserCampaign
)
yield takeLatest(
AT.CLAIM_CAMPAIGN_CLICKED,
identityVerificationSagas.claimCampaignClicked
)
yield takeLatest(AT.GO_TO_PREV_STEP, identityVerificationSagas.goToPrevStep)
yield takeLatest(AT.GO_TO_NEXT_STEP, identityVerificationSagas.goToNextStep)
yield takeLatest(AT.CHECK_KYC_FLOW, identityVerificationSagas.checkKycFlow)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { put, select, call } from 'redux-saga/effects'
import { delay } from 'redux-saga'
import { call, put, select, take } from 'redux-saga/effects'
import { head, isEmpty, prop, toUpper } from 'ramda'

import { actions, selectors, model } from 'data'
import { actions, actionTypes, selectors, model } from 'data'
import profileSagas from 'data/modules/profile/sagas'
import * as C from 'services/AlertService'

Expand All @@ -12,6 +13,7 @@ import {
SMS_STEPS,
SMS_NUMBER_FORM,
PERSONAL_FORM,
ID_VERIFICATION_SUBMITTED_FORM,
BAD_CODE_ERROR,
PHONE_EXISTS_ERROR,
UPDATE_FAILURE,
Expand Down Expand Up @@ -96,6 +98,33 @@ export default ({ api, coreSagas }) => {
}
}

const claimCampaignClicked = function*({ payload }) {
const { campaign } = payload
try {
yield put(actions.form.startSubmit(ID_VERIFICATION_SUBMITTED_FORM))
yield put(actions.modules.profile.setCampaign({ name: campaign }))
yield put(A.registerUserCampaign())
// Buffer for tagging user
yield delay(3000)
yield put(actions.modules.profile.fetchUser())
yield take(actionTypes.modules.profile.FETCH_USER_DATA_SUCCESS)
yield put(actions.form.stopSubmit(ID_VERIFICATION_SUBMITTED_FORM))
yield put(actions.modals.closeAllModals())
yield put(actions.modals.showModal('AirdropSuccess'))
} catch (error) {
yield put(actions.form.stopSubmit(ID_VERIFICATION_SUBMITTED_FORM), {
_error: error
})
yield put(
actions.logs.logErrorMessage(
logLocation,
'claimCampaignClicked',
`Error claim campaign: ${error}`
)
)
}
}

const selectTier = function*(tier = 2) {
const { selected } = yield select(selectors.modules.profile.getUserTiers)
if (selected === tier) return
Expand Down Expand Up @@ -394,6 +423,7 @@ export default ({ api, coreSagas }) => {
}

return {
claimCampaignClicked,
defineSteps,
verifyIdentity,
initializeVerification,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ describe('defineSteps saga', () => {
.select(selectors.modules.profile.getUserData)
.select(selectors.core.settings.getSmsVerified)
.select(S.getVerificationStep)
.put(A.setStepsSuccess(['personal', 'mobile', 'verify']))
.put(A.setStepsSuccess(['personal', 'mobile', 'verify', 'submitted']))
.run())

it('should put steps loading failure if selectTier fails', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ const setSelectedTier = assocPath(['tiers', 'selected'])
const setNextTier = assocPath(['tiers', 'next'])

describe('steps selector', () => {
it('should select personal, mobile and verify steps for next 1 and selected 2', () => {
expect(computeSteps(options)).toEqual(['personal', 'mobile', 'verify'])
it('should select personal, mobile, verify, and submitted steps for next 1 and selected 2', () => {
expect(computeSteps(options)).toEqual([
'personal',
'mobile',
'verify',
'submitted'
])
})

it('should select personal step for next 1 and selected 1', () => {
Expand All @@ -34,23 +39,34 @@ describe('steps selector', () => {
it('should select mobile and verify step for next 2 and selected 2', () => {
expect(computeSteps(setNextTier(TIERS[2], options))).toEqual([
'mobile',
'verify'
'verify',
'submitted'
])
})

it('should filter out mobile step if smsVerified is true', () => {
const smsVerifiedOptions = { ...options, smsVerified: true }
expect(computeSteps(smsVerifiedOptions)).toEqual(['personal', 'verify'])
expect(computeSteps(smsVerifiedOptions)).toEqual([
'personal',
'verify',
'submitted'
])
expect(computeSteps(setNextTier(TIERS[2], smsVerifiedOptions))).toEqual([
'verify'
'verify',
'submitted'
])
})

it('should filter out mobile step if mobileVerified is true', () => {
const mobileVerifiedState = { ...options, mobileVerified: true }
expect(computeSteps(mobileVerifiedState)).toEqual(['personal', 'verify'])
expect(computeSteps(mobileVerifiedState)).toEqual([
'personal',
'verify',
'submitted'
])
expect(computeSteps(setNextTier(TIERS[2], mobileVerifiedState))).toEqual([
'verify'
'verify',
'submitted'
])
})

Expand All @@ -60,7 +76,8 @@ describe('steps selector', () => {
'coinify',
'personal',
'mobile',
'verify'
'verify',
'submitted'
])
expect(computeSteps(setSelectedTier(TIERS[1], coinifyOptions))).toEqual([
'coinify',
Expand All @@ -69,24 +86,27 @@ describe('steps selector', () => {
expect(computeSteps(setNextTier(TIERS[2], coinifyOptions))).toEqual([
'coinify',
'mobile',
'verify'
'verify',
'submitted'
])
})

it('should add more info step before tier 2 if needMoreInfo is true', () => {
const morInfoOptions = { ...options, needMoreInfo: true }
expect(computeSteps(morInfoOptions)).toEqual([
const moreInfoOptions = { ...options, needMoreInfo: true }
expect(computeSteps(moreInfoOptions)).toEqual([
'personal',
'mobile',
'verify'
'verify',
'submitted'
])
expect(computeSteps(setSelectedTier(TIERS[1], morInfoOptions))).toEqual([
expect(computeSteps(setSelectedTier(TIERS[1], moreInfoOptions))).toEqual([
'personal'
])
expect(computeSteps(setNextTier(TIERS[2], morInfoOptions))).toEqual([
expect(computeSteps(setNextTier(TIERS[2], moreInfoOptions))).toEqual([
'moreInfo',
'mobile',
'verify'
'verify',
'submitted'
])
})
})
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
export const SWAP_GET_STARTED_SUBMIT_CLICK =
'@EVENT.SWAP_GET_STARTED_SUBMIT_CLICK'
export const AIRDROP_CLAIM_SUBMIT_CLICKED =
'@EVENT.AIRDROP_CLAIM_SUBMIT_CLICKED'

export const AIRDROP_REMINDER_SUBMIT_CLICK =
'@EVENT.AIRDROP_REMINDER_SUBMIT_CLICK'
export const AIRDROP_REMINDER_SUBMIT_CLICKED =
'@EVENT.AIRDROP_REMINDER_SUBMIT_CLICKED'

export const SWAP_GET_STARTED_SUBMIT_CLICKED =
'@EVENT.SWAP_GET_STARTED_SUBMIT_CLICKED'

export const UPGRADE_FOR_AIRDROP_SUBMIT_CLICKED =
'@EVENT.UPGRADE_FOR_AIRDROP_SUBMIT_CLICKED'
Expand Down