diff --git a/packages/account/src/Components/terms-of-use/fatca-declaration.tsx b/packages/account/src/Components/terms-of-use/fatca-declaration.tsx index c846ca91b09c..fabeb7796cfb 100644 --- a/packages/account/src/Components/terms-of-use/fatca-declaration.tsx +++ b/packages/account/src/Components/terms-of-use/fatca-declaration.tsx @@ -8,6 +8,7 @@ import './terms-of-use.scss'; type TFATCADeclarationProps = { field: FieldInputProps<'0' | '1'>; + is_disabled: boolean; } & React.ComponentPropsWithoutRef; /** @@ -49,6 +50,7 @@ const FatcaDeclaration = ({ field: { value, onChange, name }, ...props }: TFATCA list={getAgreementOptions()} className='fatca-declaration__agreement' onChange={onChange} + disabled={props.is_disabled} /> diff --git a/packages/account/src/Components/terms-of-use/terms-of-use.tsx b/packages/account/src/Components/terms-of-use/terms-of-use.tsx index aa68550092d3..df0ba8f70cd8 100644 --- a/packages/account/src/Components/terms-of-use/terms-of-use.tsx +++ b/packages/account/src/Components/terms-of-use/terms-of-use.tsx @@ -36,6 +36,7 @@ type TTermsOfUseProps = { value: TTermsOfUseFormProps; real_account_signup_target: TBrokerCodes; form_error?: string; + is_multi_account: boolean; }; /** @@ -96,7 +97,11 @@ const TermsOfUse = ({

- +

diff --git a/packages/account/src/Configs/terms-of-use-config.ts b/packages/account/src/Configs/terms-of-use-config.ts index bcd20e2848c4..5dfc60eabe2c 100644 --- a/packages/account/src/Configs/terms-of-use-config.ts +++ b/packages/account/src/Configs/terms-of-use-config.ts @@ -1,8 +1,11 @@ import React from 'react'; -import { getDefaultFields, isDesktop, TSchema } from '@deriv/shared'; +import { getDefaultFields, isDesktop } from '@deriv/shared'; import { localize } from '@deriv/translations'; +import { GetSettings } from '@deriv/api-types'; -const terms_of_use_config: TSchema = { +type TTermsOfConfigSettings = GetSettings & { fatca_declaration: 0 | 1 }; + +const getTermsOfUseConfig = (account_settings: TTermsOfConfigSettings) => ({ agreed_tos: { supported_in: ['svg', 'maltainvest'], default_value: false, @@ -13,24 +16,29 @@ const terms_of_use_config: TSchema = { }, fatca_declaration: { supported_in: ['svg', 'maltainvest'], - default_value: '', + default_value: String(account_settings?.fatca_declaration ?? ''), }, -}; +}); const termsOfUseConfig = ( - { real_account_signup_target }: { real_account_signup_target: string }, + { + real_account_signup_target, + account_settings, + }: { real_account_signup_target: string; account_settings: TTermsOfConfigSettings }, TermsOfUse: React.Component ) => { const active_title = localize('Terms of use'); + return { header: { active_title: isDesktop() ? active_title : null, title: active_title, }, body: TermsOfUse, - form_value: getDefaultFields(real_account_signup_target, terms_of_use_config), + form_value: getDefaultFields(real_account_signup_target, getTermsOfUseConfig(account_settings)), props: { real_account_signup_target, + is_multi_account: Boolean(String(account_settings?.fatca_declaration ?? '')), }, icon: 'IcDashboardTermsOfUse', };