Skip to content

Commit

Permalink
feat(TypeScript): minor cleanup of identityVerification/types
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip London committed Jan 10, 2020
1 parent 989ef02 commit a8ed2f1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const goToNextStep = () => ({
type: AT.GO_TO_NEXT_STEP
})
export const setVerificationStep = (
step: keyof StepsType
step: StepsType
): IdentityVerificationActionTypes => ({
type: AT.SET_VERIFICATION_STEP,
payload: { step }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,7 @@ export default ({ api, coreSagas }) => {
}

const initializeStep = function * () {
const steps: Array<keyof StepsType> = (yield select(S.getSteps)).getOrElse(
[]
)
const steps: Array<StepsType> = (yield select(S.getSteps)).getOrElse([])
return yield put(A.setVerificationStep(steps[0]))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,15 @@ export interface CampaignType {
userCampaignTransactionResponseList: Array<CampaignTransaction>
}

export type EmailSmsStepTypes = { edit: 'edit'; verify: 'verify' }
export type EmailSmsStepType = 'edit' | 'verify'

export type StepsType = typeof STEPS
export type StepsType =
| 'coinify'
| 'personal'
| 'moreInfo'
| 'mobile'
| 'verify'
| 'submitted'

export type KycStatesType =
| 'NONE'
Expand Down Expand Up @@ -79,15 +85,15 @@ export type CountryType = {
// State
export interface IdentityVerificationState {
addressRefetchVisible: boolean
emailStep: keyof EmailSmsStepTypes
emailStep: EmailSmsStepType
flowConfig: RemoteData<string, any>
preIdvData: RemoteData<string, PreIdvDataType>
smsStep: RemoteData<string, keyof EmailSmsStepTypes>
smsStep: RemoteData<string, EmailSmsStepType>
states: RemoteData<string, StateType>
steps: RemoteData<string, any>
supportedCountries: RemoteData<string, Array<CountryType>>
supportedDocuments: RemoteData<string, Array<DocumentType>>
verificationStep: keyof StepsType | null
verificationStep: StepsType | null
}

// Actions
Expand All @@ -101,7 +107,7 @@ interface FetchSupportedDocumentAction {

interface SetEmailStepAction {
payload: {
step: keyof EmailSmsStepTypes
step: EmailSmsStepType
}
type: typeof AT.SET_EMAIL_STEP
}
Expand Down Expand Up @@ -147,7 +153,7 @@ interface SetPreIdvSuccessAction {

interface SetSmsStepAction {
payload: {
step: keyof EmailSmsStepTypes
step: EmailSmsStepType
}
type: typeof AT.SET_SMS_STEP
}
Expand All @@ -166,7 +172,7 @@ interface SetStepsLoadingAction {

interface SetStepsSuccessAction {
payload: {
steps: StepsType
steps: Array<StepsType>
}
type: typeof AT.SET_STEPS_SUCCESS
}
Expand Down Expand Up @@ -229,7 +235,7 @@ interface SetSupportedDocumentSuccessAction {

interface SetVerificationStepAction {
payload: {
step: keyof StepsType
step: StepsType
}
type: typeof AT.SET_VERIFICATION_STEP
}
Expand Down

0 comments on commit a8ed2f1

Please sign in to comment.