-
Notifications
You must be signed in to change notification settings - Fork 319
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Amina/trah 5318 poa redirection from high code to low code (#17985)
* fix: add addditional dropdown options for account opening reason * fix: redirection_of_poa * fix: redirection_of_poa * fix: redirection_of_poa * fix: comment * fix: vercel
- Loading branch information
1 parent
e3f78e2
commit 598e68f
Showing
6 changed files
with
66 additions
and
8 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
5 changes: 2 additions & 3 deletions
5
packages/account/src/Sections/Verification/ProofOfAddress/index.ts
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,3 +1,2 @@ | ||
import ProofOfAddress from './proof-of-address'; | ||
|
||
export default ProofOfAddress; | ||
export { default as ProofOfAddress } from './proof-of-address'; | ||
export { default as ProofOfAddressFlow } from './proof-of-address-flow'; |
53 changes: 53 additions & 0 deletions
53
packages/account/src/Sections/Verification/ProofOfAddress/proof-of-address-flow.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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React from 'react'; | ||
|
||
import { Loading } from '@deriv/components'; | ||
import { useGrowthbookGetFeatureValue } from '@deriv/hooks'; | ||
import { ACCOUNTS_OS_POA_URL, getAppId, getSocketURL } from '@deriv/shared'; | ||
import { observer, useStore } from '@deriv/stores'; | ||
|
||
import { useKycAuthStatus } from '../../../hooks'; | ||
|
||
import ProofOfAddress from './proof-of-address'; | ||
|
||
const ProofOfAddressFlow = observer(() => { | ||
const { | ||
client: { getToken, residence }, | ||
common: { is_from_tradershub_os }, | ||
} = useStore(); | ||
const { kyc_auth_status, isLoading: isKYCLoading } = useKycAuthStatus({ country: residence }); | ||
const [shouldRedirectToAccountsOSApp, isRedirectToAccountsOSAppFFLoaded] = useGrowthbookGetFeatureValue({ | ||
featureFlag: 'redirect_to_poa_in_accounts_os', | ||
}); | ||
|
||
const getFormattedURL = url_link => { | ||
const url = new URL(url_link); | ||
const urlParams = new URLSearchParams(location.search); | ||
const platform = urlParams.get('platform') ?? (is_from_tradershub_os ? 'tradershub_os' : 'deriv_app'); | ||
|
||
const params = { | ||
platform, | ||
appid: getAppId(), | ||
lang: 'en', | ||
server: getSocketURL(), | ||
token: getToken(), | ||
}; | ||
|
||
Object.entries(params).forEach(([key, value]) => { | ||
url.searchParams.append(key, value); | ||
}); | ||
|
||
return url.toString(); | ||
}; | ||
|
||
if (isRedirectToAccountsOSAppFFLoaded && !isKYCLoading) { | ||
if (shouldRedirectToAccountsOSApp && kyc_auth_status) { | ||
window.location.replace(getFormattedURL(ACCOUNTS_OS_POA_URL)); | ||
} else { | ||
return <ProofOfAddress />; | ||
} | ||
} | ||
|
||
return <Loading is_fullscreen={false} className='account__initial-loader' />; | ||
}); | ||
|
||
export default ProofOfAddressFlow; |
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