-
Notifications
You must be signed in to change notification settings - Fork 9
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
Ameerul / P2PS-464 [FE] - Mandatory Mobile Number Verification for Deriv P2P (New User) #400
Changes from all commits
465ec2f
490ea07
e032be0
e91c7c4
ccd399f
e357346
79c5675
85edc27
f61bd9e
9433785
f74cb9c
02956c0
447bbf4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,7 +84,10 @@ const BlockUnblockUserModal = ({ | |
}; | ||
|
||
const blockUnblockError = errorMessages.find( | ||
error => error.code === ERROR_CODES.PERMISSION_DENIED || error.code === ERROR_CODES.INVALID_ADVERTISER_ID | ||
error => | ||
error.code === ERROR_CODES.PERMISSION_DENIED || | ||
error.code === ERROR_CODES.INVALID_ADVERTISER_ID || | ||
error.code === ERROR_CODES.ADVERTISER_NOT_REGISTERED | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
); | ||
|
||
if (blockUnblockError && isModalOpenFor('ErrorModal')) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { TLocalize } from 'types'; | ||
import { Checklist } from '@/components'; | ||
import { usePoiPoaStatus } from '@/hooks/custom-hooks'; | ||
import { useGetPhoneNumberVerification, usePoiPoaStatus } from '@/hooks/custom-hooks'; | ||
import { DerivLightIcCashierSendEmailIcon } from '@deriv/quill-icons'; | ||
import { Localize, useTranslations } from '@deriv-com/translations'; | ||
import { Loader, Text, useDevice } from '@deriv-com/ui'; | ||
|
@@ -14,9 +14,9 @@ const getPoiAction = (status: string | undefined, localize: TLocalize) => { | |
case 'rejected': | ||
return localize('Identity verification failed. Please try again.'); | ||
case 'verified': | ||
return localize('Identity verification complete.'); | ||
return localize('Identity verified'); | ||
default: | ||
return localize('Upload documents to verify your identity.'); | ||
return localize('Your identity'); | ||
} | ||
}; | ||
|
||
|
@@ -32,15 +32,22 @@ const getPoaAction = ( | |
return localize('Address verification failed. Please try again.'); | ||
case 'verified': | ||
if (isPoaAuthenticatedWithIdv) return localize('Upload documents to verify your address.'); | ||
return localize('Address verification complete.'); | ||
return localize('Address verified'); | ||
default: | ||
return localize('Upload documents to verify your address.'); | ||
return localize('Your address'); | ||
} | ||
}; | ||
|
||
const getStatus = (status: string | undefined) => { | ||
if (status === 'verified') return 'done'; | ||
else if (status === 'rejected') return 'rejected'; | ||
return 'action'; | ||
}; | ||
|
||
const Verification = () => { | ||
const { isMobile } = useDevice(); | ||
const { localize } = useTranslations(); | ||
const { isPhoneNumberVerificationEnabled, isPhoneNumberVerified, phoneNumber } = useGetPhoneNumberVerification(); | ||
const { data, isLoading } = usePoiPoaStatus(); | ||
const { | ||
isP2PPoaRequired, | ||
|
@@ -69,13 +76,26 @@ const Verification = () => { | |
}; | ||
|
||
const checklistItems = [ | ||
...(isPhoneNumberVerificationEnabled | ||
? [ | ||
{ | ||
onClick: () => { | ||
window.location.href = `${URLConstants.derivAppProduction}/account/personal-details`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we do the redirection based on the environment.. if test link or staging, redirect to staging-app.deriv. else app.deriv ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmmm i dont think its necessary tbh, because either way we can still test the PNV using just prod link. Also even if we use staging and so forth, QA still need to set up the endpoint again |
||
}, | ||
phoneNumber: isPhoneNumberVerified ? phoneNumber : undefined, | ||
status: isPhoneNumberVerified ? 'done' : 'action', | ||
testId: 'dt_verification_phone_number_arrow_button', | ||
text: isPhoneNumberVerified ? localize('Phone number verified') : localize('Your phone number'), | ||
}, | ||
] | ||
: []), | ||
{ | ||
isDisabled: isPoiPending, | ||
onClick: () => { | ||
if (!isPoiVerified) | ||
redirectToVerification(`${URLConstants.derivAppProduction}/account/proof-of-identity`); | ||
}, | ||
status: isPoiVerified ? 'done' : 'action', | ||
status: getStatus(poiStatus), | ||
testId: 'dt_verification_poi_arrow_button', | ||
text: getPoiAction(poiStatus, localize), | ||
}, | ||
|
@@ -87,7 +107,7 @@ const Verification = () => { | |
if (allowPoaRedirection) | ||
redirectToVerification(`${URLConstants.derivAppProduction}/account/proof-of-address`); | ||
}, | ||
status: allowPoaRedirection ? 'action' : 'done', | ||
status: getStatus(poaStatus), | ||
testId: 'dt_verification_poa_arrow_button', | ||
text: getPoaAction(isPoaAuthenticatedWithIdv, poaStatus, localize), | ||
}, | ||
|
@@ -101,10 +121,10 @@ const Verification = () => { | |
<div className='verification'> | ||
<DerivLightIcCashierSendEmailIcon className='verification__icon' height={128} width={128} /> | ||
<Text className='verification__text' size={isMobile ? 'lg' : 'md'} weight='bold'> | ||
<Localize i18n_default_text='Verify your P2P account' /> | ||
<Localize i18n_default_text='Let’s get you secured' /> | ||
</Text> | ||
<Text align='center' className='verification__text' size={isMobile ? 'lg' : 'sm'}> | ||
<Localize i18n_default_text='Verify your identity and address to use Deriv P2P.' /> | ||
<Localize i18n_default_text='Complete your P2P profile to enjoy secure transactions.' /> | ||
</Text> | ||
<Checklist items={checklistItems} /> | ||
</div> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated the param name to make it more general since now we're also checking for PNV if enabled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a question. why do we keep this in the URL params? I mean it can be easily manipulated by the user.
can we add a hook and check this in component level using that hook? 🤔