@@ -19,7 +19,6 @@ import {
19
19
getCFDPlatformLabel ,
20
20
getCFDPlatformNames ,
21
21
getErrorMessages ,
22
- getLegalEntityName ,
23
22
routes ,
24
23
validLength ,
25
24
validPassword ,
@@ -31,13 +30,22 @@ import {
31
30
import { observer , useStore } from '@deriv/stores' ;
32
31
import { Localize , localize } from '@deriv/translations' ;
33
32
import SuccessDialog from '../Components/success-dialog.jsx' ;
34
- import CFDPasswordModalTitle from './cfd-password-modal-title' ;
33
+ import CFDEnterPasswordModalTitle from './cfd-enter -password-modal-title' ;
35
34
import MigrationSuccessModal from '../Components/migration-success-modal' ;
36
35
import { useCfdStore } from '../Stores/Modules/CFD/Helpers/useCfdStores' ;
37
- import { CFD_PLATFORMS , CATEGORY , PRODUCT } from '../Helpers/cfd-config' ;
36
+ import { CFD_PLATFORMS , CATEGORY } from '../Helpers/cfd-config' ;
38
37
import { getDxCompanies , getMtCompanies , TDxCompanies , TMtCompanies } from '../Stores/Modules/CFD/Helpers/cfd-config' ;
39
38
import '../sass/cfd.scss' ;
40
- import CfdPasswordModalTnc from './cfd-password-modal-tnc' ;
39
+
40
+ const MT5CreatePassword = makeLazyLoader (
41
+ ( ) => moduleLoader ( ( ) => import ( './mt5-create-password' ) ) ,
42
+ ( ) => < div />
43
+ ) ( ) ;
44
+
45
+ const CfdPasswordModalTnc = makeLazyLoader (
46
+ ( ) => moduleLoader ( ( ) => import ( './cfd-password-modal-tnc' ) ) ,
47
+ ( ) => < div />
48
+ ) ( ) ;
41
49
42
50
const CFDPasswordChange = makeLazyLoader (
43
51
( ) => moduleLoader ( ( ) => import ( './cfd-password-change' ) ) ,
@@ -79,14 +87,12 @@ type TCFDPasswordFormReusedProps = {
79
87
type TCFDCreatePasswordProps = TCFDPasswordFormReusedProps & {
80
88
password : string ;
81
89
onSubmit : TOnSubmitPassword ;
82
- is_real_financial_stp : boolean ;
83
90
need_tnc : boolean ;
84
91
} ;
85
92
86
93
type TCFDCreatePasswordFormProps = TCFDPasswordFormReusedProps & {
87
94
has_mt5_account : boolean ;
88
95
submitPassword : TOnSubmitPassword ;
89
- is_real_financial_stp : boolean ;
90
96
need_tnc : boolean ;
91
97
} ;
92
98
@@ -100,9 +106,7 @@ type TCFDPasswordFormProps = TCFDPasswordFormReusedProps & {
100
106
error_type ?: string ;
101
107
form_error ?: string ;
102
108
has_mt5_account : boolean ;
103
- is_bvi : boolean ;
104
109
is_dxtrade_allowed : boolean ;
105
- is_real_financial_stp : boolean ;
106
110
onCancel : ( ) => void ;
107
111
onForgotPassword : ( ) => void ;
108
112
should_set_trading_password : boolean ;
@@ -121,23 +125,46 @@ const PasswordModalHeader = ({
121
125
platform,
122
126
} : TPasswordModalHeaderProps ) => {
123
127
const { isDesktop } = useDevice ( ) ;
128
+ const is_mt5 = platform === CFD_PLATFORMS . MT5 ;
124
129
125
130
const element = ! isDesktop ? 'p' : 'span' ;
126
- const alignment = 'center' ;
127
- const font_size = 's' ;
131
+
128
132
const style = ! isDesktop
129
133
? {
130
134
padding : '2rem' ,
131
135
}
132
136
: { } ;
133
137
138
+ if ( is_mt5 && ! is_password_reset_error ) {
139
+ const platform_name = getCFDPlatformNames ( platform ) ;
140
+ return (
141
+ < Text styles = { style } as = { element } line_height = 'm' weight = 'bold' size = 's' align = 'center' >
142
+ { should_set_trading_password ? (
143
+ < Localize
144
+ i18n_default_text = 'Create an {{platform_name}} account'
145
+ values = { {
146
+ platform_name,
147
+ } }
148
+ />
149
+ ) : (
150
+ < Localize
151
+ i18n_default_text = 'Add an {{platform_name}} account'
152
+ values = { {
153
+ platform_name,
154
+ } }
155
+ />
156
+ ) }
157
+ </ Text >
158
+ ) ;
159
+ }
160
+
134
161
return (
135
- < Text styles = { style } as = { element } line_height = 'm' weight = 'bold' size = { font_size } align = { alignment } >
162
+ < Text styles = { style } as = { element } line_height = 'm' weight = 'bold' size = 's' align = 'center' >
136
163
{ ! should_set_trading_password && ! is_password_reset_error && (
137
164
< Localize
138
- i18n_default_text = 'Add a {{platform}} account '
165
+ i18n_default_text = 'Enter your {{platform}} password '
139
166
values = { {
140
- platform : getCFDPlatformNames ( platform ) ,
167
+ platform : getCFDPlatformLabel ( platform ) ,
141
168
} }
142
169
/>
143
170
) }
@@ -170,21 +197,7 @@ const handlePasswordInputChange = (
170
197
} ) ;
171
198
} ;
172
199
173
- // first MT5 password
174
- const CreatePassword = ( {
175
- password,
176
- platform,
177
- validatePassword,
178
- onSubmit,
179
- error_message,
180
- is_real_financial_stp,
181
- need_tnc,
182
- } : TCFDCreatePasswordProps ) => {
183
- const { product, account_type } = useCfdStore ( ) ;
184
- const [ checked , setChecked ] = React . useState (
185
- ! ( product === PRODUCT . ZEROSPREAD && account_type . category === CATEGORY . REAL )
186
- ) ;
187
-
200
+ const CreatePassword = ( { password, platform, validatePassword, onSubmit, error_message } : TCFDCreatePasswordProps ) => {
188
201
return (
189
202
< Formik
190
203
initialValues = { {
@@ -210,11 +223,7 @@ const CreatePassword = ({
210
223
className = 'cfd-password-modal__content dc-modal__container_cfd-password-modal__body cfd-password-modal__create-password-content'
211
224
data-testid = 'dt_create_password'
212
225
>
213
- < Icon
214
- icon = { platform === CFD_PLATFORMS . MT5 ? 'IcMt5OnePassword' : 'IcDxtradeOnePassword' }
215
- width = '122'
216
- height = '108'
217
- />
226
+ < Icon icon = 'IcDxtradeOnePassword' width = '122' height = '108' />
218
227
< Text
219
228
size = 's'
220
229
align = 'center'
@@ -263,20 +272,8 @@ const CreatePassword = ({
263
272
) }
264
273
</ PasswordMeter >
265
274
</ div >
266
- { is_real_financial_stp && (
267
- < div className = 'dc-modal__container_cfd-password-modal__description' >
268
- < Localize i18n_default_text = 'Your MT5 Financial STP account will be opened through Deriv (FX) Ltd. All trading in this account is subject to the regulations and guidelines of the Labuan Financial Service Authority (LFSA). None of your other accounts, including your Deriv account, is subject to the regulations and guidelines of the Labuan Financial Service Authority (LFSA).' />
269
- </ div >
270
- ) }
271
- { need_tnc && (
272
- < CfdPasswordModalTnc
273
- platform = { platform }
274
- checked = { checked }
275
- onCheck = { ( ) => setChecked ( prev => ! prev ) }
276
- />
277
- ) }
278
275
< FormSubmitButton
279
- is_disabled = { ! values . password || ! checked || Object . keys ( errors ) . length > 0 }
276
+ is_disabled = { ! values . password || Object . keys ( errors ) . length > 0 }
280
277
is_loading = { isSubmitting }
281
278
label = { localize ( 'Create {{platform}} password' , {
282
279
platform : getCFDPlatformLabel ( platform ) ,
@@ -296,7 +293,6 @@ const CFDCreatePasswordForm = ({
296
293
error_message,
297
294
validatePassword,
298
295
submitPassword,
299
- is_real_financial_stp,
300
296
need_tnc,
301
297
} : TCFDCreatePasswordFormProps ) => {
302
298
const multi_step_ref = React . useRef < TMultiStepRefProps > ( ) ;
@@ -313,17 +309,26 @@ const CFDCreatePasswordForm = ({
313
309
314
310
const steps = [
315
311
{
316
- component : (
317
- < CreatePassword
318
- password = { password }
319
- platform = { platform }
320
- error_message = { error_message }
321
- validatePassword = { validatePassword }
322
- onSubmit = { onSubmit }
323
- is_real_financial_stp = { is_real_financial_stp }
324
- need_tnc = { need_tnc }
325
- />
326
- ) ,
312
+ component :
313
+ platform === CFD_PLATFORMS . MT5 ? (
314
+ < MT5CreatePassword
315
+ password = { password }
316
+ platform = { platform }
317
+ error_message = { error_message }
318
+ validatePassword = { validatePassword }
319
+ onSubmit = { onSubmit }
320
+ need_tnc = { need_tnc }
321
+ />
322
+ ) : (
323
+ < CreatePassword
324
+ password = { password }
325
+ platform = { platform }
326
+ error_message = { error_message }
327
+ validatePassword = { validatePassword }
328
+ onSubmit = { onSubmit }
329
+ need_tnc = { need_tnc }
330
+ />
331
+ ) ,
327
332
} ,
328
333
{
329
334
component : (
@@ -349,7 +354,6 @@ const CFDPasswordForm = observer(
349
354
error_type,
350
355
form_error,
351
356
has_mt5_account,
352
- is_real_financial_stp,
353
357
onCancel,
354
358
onForgotPassword,
355
359
platform,
@@ -418,7 +422,6 @@ const CFDPasswordForm = observer(
418
422
validatePassword = { validatePassword }
419
423
submitPassword = { submitPassword }
420
424
has_mt5_account = { has_mt5_account }
421
- is_real_financial_stp = { is_real_financial_stp }
422
425
need_tnc = { need_tnc }
423
426
/>
424
427
) ;
@@ -447,7 +450,7 @@ const CFDPasswordForm = observer(
447
450
} ) => (
448
451
< form onSubmit = { handleSubmit } >
449
452
< div className = 'cfd-password-modal__content dc-modal__container_cfd-password-modal__body' >
450
- < CFDPasswordModalTitle platform = { platform } />
453
+ < CFDEnterPasswordModalTitle platform = { platform } />
451
454
< div className = 'input-element' >
452
455
< PasswordInput
453
456
autoComplete = 'new-password'
@@ -467,17 +470,6 @@ const CFDPasswordForm = observer(
467
470
data_testId = { `dt_${ platform } _password` }
468
471
/>
469
472
</ div >
470
-
471
- { is_real_financial_stp && (
472
- < div className = 'dc-modal__container_cfd-password-modal__description' >
473
- < Localize
474
- i18n_default_text = 'Your MT5 Financial STP account will be opened through {{legal_entity_name}}. All trading in this account is subject to the regulations and guidelines of the Labuan Financial Service Authority (LFSA). None of your other accounts, including your Deriv account, is subject to the regulations and guidelines of the Labuan Financial Service Authority (LFSA).'
475
- values = { {
476
- legal_entity_name : getLegalEntityName ( 'fx' ) ,
477
- } }
478
- />
479
- </ div >
480
- ) }
481
473
{ error_type === 'PasswordError' && (
482
474
< Text size = 'xs' as = 'p' className = 'dc-modal__container_mt5-password-modal__hint' >
483
475
< Localize
@@ -488,7 +480,6 @@ const CFDPasswordForm = observer(
488
480
/>
489
481
</ Text >
490
482
) }
491
- { /* {product === PRODUCT.ZEROSPREAD && account_type.category === CATEGORY.REAL && ( */ }
492
483
{ need_tnc && (
493
484
< CfdPasswordModalTnc
494
485
className = 'cfd-password-modal-tnc--bottom'
@@ -560,7 +551,6 @@ const CFDPasswordModal = observer(({ form_error, platform }: TCFDPasswordModalPr
560
551
const history = useHistory ( ) ;
561
552
562
553
const [ is_password_modal_exited , setPasswordModalExited ] = React . useState ( true ) ;
563
- const is_bvi = landing_companies ?. mt_financial_company ?. financial_stp ?. shortcode === 'bvi' ;
564
554
const has_mt5_account = Boolean ( mt5_login_list ?. length ) ;
565
555
const should_set_trading_password =
566
556
Array . isArray ( account_status ?. status ) &&
@@ -708,8 +698,6 @@ const CFDPasswordModal = observer(({ form_error, platform }: TCFDPasswordModalPr
708
698
709
699
const should_show_sent_email_modal = is_sent_email_modal_enabled && is_password_modal_exited ;
710
700
711
- const is_real_financial_stp = [ account_type . category , account_type . type ] . join ( '_' ) === 'real_financial_stp' ;
712
-
713
701
const should_show_password_modal = React . useMemo ( ( ) => {
714
702
if ( should_show_password ) {
715
703
return should_set_trading_password ? true : isDesktop ;
@@ -829,14 +817,12 @@ const CFDPasswordModal = observer(({ form_error, platform }: TCFDPasswordModalPr
829
817
830
818
const cfd_password_form = (
831
819
< CFDPasswordForm
832
- is_bvi = { is_bvi }
833
820
closeModal = { closeModal }
834
821
error_type = { error_type }
835
822
error_message = { error_type !== 'InvalidTradingPlatformPasswordFormat' ? error_message : '' }
836
823
has_mt5_account = { has_mt5_account }
837
824
form_error = { form_error }
838
825
should_set_trading_password = { should_set_trading_password }
839
- is_real_financial_stp = { is_real_financial_stp }
840
826
validatePassword = { validatePassword }
841
827
onForgotPassword = { handleForgotPassword }
842
828
submitPassword = { submitPassword }
0 commit comments