|
| 1 | +import React from 'react'; |
| 2 | +import { Trans } from 'react-i18next'; |
| 3 | +import { WalletLink, WalletText } from '../../../../components'; |
| 4 | + |
| 5 | +type TDepositLockedDescProps = { |
| 6 | + askFixDetails?: boolean; |
| 7 | + clientTncStatus?: string | null; |
| 8 | + excludedUntil?: Date; |
| 9 | + financialInformationNotComplete?: boolean; |
| 10 | + isMFAccount: boolean; |
| 11 | + poaNeedsVerification?: boolean; |
| 12 | + poaStatus: string; |
| 13 | + poiNeedsVerification?: boolean; |
| 14 | + poiStatus: string; |
| 15 | + selfExclusion?: boolean; |
| 16 | + tradingExperienceNotComplete?: boolean; |
| 17 | + unwelcomeStatus?: boolean; |
| 18 | + websiteTncVersion?: string; |
| 19 | +}; |
| 20 | + |
| 21 | +const getDepositLockedDesc = ({ |
| 22 | + askFixDetails, |
| 23 | + clientTncStatus, |
| 24 | + excludedUntil, |
| 25 | + financialInformationNotComplete, |
| 26 | + isMFAccount, |
| 27 | + poaNeedsVerification, |
| 28 | + poaStatus, |
| 29 | + poiNeedsVerification, |
| 30 | + poiStatus, |
| 31 | + selfExclusion, |
| 32 | + tradingExperienceNotComplete, |
| 33 | + unwelcomeStatus, |
| 34 | + websiteTncVersion, |
| 35 | +}: TDepositLockedDescProps) => { |
| 36 | + if (poiNeedsVerification && poiStatus !== 'none') |
| 37 | + return { |
| 38 | + description: ( |
| 39 | + <WalletText align='center'> |
| 40 | + <Trans |
| 41 | + components={[<WalletLink href='/account/proof-of-identity' key={0} variant='bold' />]} |
| 42 | + defaults='To enable deposits, you must check your <0>proof of identity document verification status</0>.' |
| 43 | + /> |
| 44 | + </WalletText> |
| 45 | + ), |
| 46 | + }; |
| 47 | + |
| 48 | + if (poaNeedsVerification && poaStatus !== 'none') |
| 49 | + return { |
| 50 | + description: ( |
| 51 | + <WalletText align='center'> |
| 52 | + <Trans |
| 53 | + components={[<WalletLink href='/account/proof-of-address' key={0} variant='bold' />]} |
| 54 | + defaults='To enable deposits, you must check your <0>proof of address document verification status</0>.' |
| 55 | + /> |
| 56 | + </WalletText> |
| 57 | + ), |
| 58 | + }; |
| 59 | + |
| 60 | + if (clientTncStatus !== websiteTncVersion) |
| 61 | + return { |
| 62 | + description: ( |
| 63 | + <WalletText align='center'> |
| 64 | + <Trans |
| 65 | + components={[<WalletLink key={0} staticUrl='/terms-and-conditions/#clients' variant='bold' />]} |
| 66 | + defaults='To enable deposits, you must accept our <0>updated terms and conditions</0>.' |
| 67 | + /> |
| 68 | + </WalletText> |
| 69 | + ), |
| 70 | + }; |
| 71 | + |
| 72 | + if (isMFAccount && (financialInformationNotComplete || tradingExperienceNotComplete)) |
| 73 | + return { |
| 74 | + description: ( |
| 75 | + <WalletText align='center'> |
| 76 | + <Trans |
| 77 | + components={[<WalletLink href='/account/financial-assessment' key={0} variant='bold' />]} |
| 78 | + defaults='To enable deposits, you must complete the <0>financial assessment form</0>.' |
| 79 | + /> |
| 80 | + </WalletText> |
| 81 | + ), |
| 82 | + }; |
| 83 | + |
| 84 | + if (askFixDetails) |
| 85 | + return { |
| 86 | + description: ( |
| 87 | + <WalletText align='center'> |
| 88 | + <Trans |
| 89 | + components={[<WalletLink href='/account/personal-details' key={0} variant='bold' />]} |
| 90 | + defaults='Your <0>personal details</0> are incomplete. Please go to your account settings and complete your personal details to enable deposits.' |
| 91 | + /> |
| 92 | + </WalletText> |
| 93 | + ), |
| 94 | + }; |
| 95 | + |
| 96 | + if (selfExclusion) |
| 97 | + return { |
| 98 | + description: ( |
| 99 | + <WalletText align='center'> |
| 100 | + <Trans |
| 101 | + components={[ |
| 102 | + <button |
| 103 | + className='wallets-link wallets-link__variant--bold' |
| 104 | + key={0} |
| 105 | + onClick={() => window.LC_API.open_chat_window()} |
| 106 | + />, |
| 107 | + ]} |
| 108 | + defaults='You have chosen to exclude yourself from trading on our website until {{excludedUntil}}. If you are unable to place a trade or deposit after your self-exclusion period, please contact us via <0>live chat</0>.' |
| 109 | + values={{ excludedUntil }} |
| 110 | + /> |
| 111 | + </WalletText> |
| 112 | + ), |
| 113 | + }; |
| 114 | + |
| 115 | + if (unwelcomeStatus) |
| 116 | + return { |
| 117 | + description: ( |
| 118 | + <WalletText align='center'> |
| 119 | + <Trans |
| 120 | + components={[ |
| 121 | + <button |
| 122 | + className='wallets-link wallets-link__variant--bold' |
| 123 | + key={0} |
| 124 | + onClick={() => window.LC_API.open_chat_window()} |
| 125 | + />, |
| 126 | + ]} |
| 127 | + defaults='Please contact us via <0>live chat</0>.' |
| 128 | + /> |
| 129 | + </WalletText> |
| 130 | + ), |
| 131 | + }; |
| 132 | +}; |
| 133 | + |
| 134 | +export default getDepositLockedDesc; |
0 commit comments