forked from binary-com/deriv-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into sprint-10/account-package-refactor
- Loading branch information
Showing
206 changed files
with
4,974 additions
and
2,310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ name: Deriv App Staging Workflow | |
on: | ||
push: | ||
branches: | ||
- master | ||
- rc_* | ||
|
||
jobs: | ||
build_test_and_publish: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 6 additions & 24 deletions
30
packages/account/src/Components/account-limits/account-limits-article.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,13 @@ | ||
import * as React from 'react'; | ||
import { StaticUrl } from '@deriv/components'; | ||
import { Localize, localize } from '@deriv/translations'; | ||
import AccountArticle from 'Components/article'; | ||
|
||
type TAccountLimitsArticle = { | ||
is_from_derivgo?: boolean; | ||
}; | ||
const getDescription = () => [ | ||
<Localize key={0} i18n_default_text='These are default limits that we apply to your accounts.' />, | ||
]; | ||
|
||
const AccountLimitsArticle = ({ is_from_derivgo }: TAccountLimitsArticle) => { | ||
const getDescription = () => { | ||
const description = [ | ||
<Localize key={0} i18n_default_text='These are default limits that we apply to your accounts.' />, | ||
]; | ||
|
||
if (!is_from_derivgo) { | ||
description.push( | ||
<Localize | ||
key={1} | ||
i18n_default_text='To learn more about trading limits and how they apply, please go to the <0>Help Centre.</0>' | ||
components={[<StaticUrl key={0} className='link' href='/help-centre/trading/#trading-limits' />]} | ||
/> | ||
); | ||
} | ||
return description; | ||
}; | ||
|
||
return <AccountArticle title={localize('Account limits')} descriptions={getDescription()} />; | ||
}; | ||
const AccountLimitsArticle = () => ( | ||
<AccountArticle title={localize('Account limits')} descriptions={getDescription()} /> | ||
); | ||
|
||
export default AccountLimitsArticle; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import { useMemo } from 'react'; | ||
import useResidenceList from './useResidenceList'; | ||
import useGetAccountStatus from './useGetAccountStatus'; | ||
import useSettings from './useSettings'; | ||
|
||
/** A custom hook to get the user's identity verification status. */ | ||
const usePOI = () => { | ||
const { data: get_account_status_data, ...rest } = useGetAccountStatus(); | ||
const { data: residence_list_data } = useResidenceList(); | ||
const { data: get_settings_data } = useSettings(); | ||
|
||
const previous_service = useMemo(() => { | ||
const latest_poi_attempt = get_account_status_data?.authentication?.attempts?.latest; | ||
return latest_poi_attempt?.service; | ||
}, [get_account_status_data?.authentication?.attempts?.latest]); | ||
|
||
/** | ||
* @description Get the previous POI attempts details (if any) | ||
*/ | ||
const previous_poi = useMemo(() => { | ||
if (!previous_service) { | ||
return null; | ||
} | ||
|
||
const services = get_account_status_data?.authentication?.identity?.services; | ||
if (services && services.manual) { | ||
return { | ||
service: previous_service, | ||
status: services.manual.status, | ||
}; | ||
} | ||
|
||
const current_service = services?.[previous_service as 'idv' | 'onfido']; | ||
return { | ||
service: previous_service, | ||
status: current_service?.status, | ||
reported_properties: current_service?.reported_properties, | ||
last_rejected: current_service?.last_rejected, | ||
submissions_left: current_service?.submissions_left || 0, | ||
}; | ||
}, [get_account_status_data?.authentication?.identity?.services, previous_service]); | ||
|
||
/** | ||
* @description Get the next step based on a few check. Returns configuration for document validation as well | ||
*/ | ||
const next_poi = useMemo(() => { | ||
const user_country_code = get_settings_data?.citizen || get_settings_data?.country_code; | ||
const matching_residence_data = residence_list_data?.find(r => r.value === user_country_code); | ||
const is_idv_supported = matching_residence_data?.identity?.services?.idv?.is_country_supported; | ||
const is_onfido_supported = matching_residence_data?.identity?.services?.onfido?.documents_supported; | ||
const services = get_account_status_data?.authentication?.identity?.services; | ||
const idv_submission_left = services?.idv?.submissions_left ?? 0; | ||
const onfido_submission_left = services?.onfido?.submissions_left ?? 0; | ||
if (is_idv_supported && idv_submission_left && !get_account_status_data?.status?.includes('idv_disallowed')) { | ||
return { | ||
service: 'idv', | ||
submission_left: idv_submission_left, | ||
document_supported: matching_residence_data?.identity?.services?.idv?.documents_supported, | ||
}; | ||
} else if (is_onfido_supported && onfido_submission_left) { | ||
return { | ||
service: 'onfido', | ||
submission_left: onfido_submission_left, | ||
document_supported: matching_residence_data?.identity?.services?.onfido?.documents_supported, | ||
}; | ||
} | ||
return { | ||
service: 'manual', | ||
}; | ||
}, [ | ||
get_account_status_data?.authentication?.identity?.services, | ||
get_account_status_data?.status, | ||
get_settings_data?.citizen, | ||
get_settings_data?.country_code, | ||
residence_list_data, | ||
]); | ||
|
||
return { | ||
data: { | ||
...get_account_status_data?.authentication?.identity, | ||
previous: previous_poi, | ||
next: next_poi, | ||
}, | ||
...rest, | ||
}; | ||
}; | ||
|
||
export default usePOI; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -524,7 +524,6 @@ | |
&-description { | ||
display: flex; | ||
justify-content: center; | ||
margin-top: 1.4rem; | ||
} | ||
|
||
&-app { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.