Skip to content

Commit

Permalink
WEBREL-602 - Invalid success message for swap-free account (binary-co…
Browse files Browse the repository at this point in the history
…m#9112)

* feat: added derivez demo/real/static to tradershub/onboarding

* fix: call success modal instead of logging out

* fix: roundup patch #1 based on reviews

* fix: move consts to Helpers/constants file

* fix: roundup patch #2 based on reviews

* Revert "fix: roundup patch #2 based on reviews"

This reverts commit f0cf7f5.

* fix: round up patch#2 based on review

* fix: clean up

* fix: outdated icons after merging

* fix: fixed derivx testcase error

* fix: update derivx icon

* fix: fixed conflicts

* fix: roundup patch #3 based on code reviews

* fix: round up patch#3 based on code reviews

* chore: unit test for derivez static

* fix: asdf

* feat: token implementation for derivez (todo: pandats error)

* fix: qrcode, download links, and download options

* fix: round-up-patch 1

* fix: round-up-patch 2
 - Description Text below the Deriv EZ header on Onboarding page is different from Design
 - Text format is incorrect in DerivEZ Account creation success modal
 - Multiple discrepancies in Trade modal (fixed in round-up-patch 1)

* fix: round-up-patch 3

 - use <React.Fragment> instead ov <>
 - remove unintentional {' '} whitespaces

* fix: code smells

* fix: asdf

* feat: disable derivez real flow

* fix: added top up for DerivEz

* fix: qr code for derivez and derivx

* fix: hide qr box if isMobile

* fix: derivez fund topup text

* fix: derivx fund topup text

* fix: onboarding demo title

* fix: Deriv Ez -> Deriv EZ

* fix: Go -> GO

* fix: Description Text below the Deriv EZ header on Onboarding page

* fix: revert changes on tradershub

* fix: updated to latest description (derivez onboarding/tradershub)

* fix: hide derivez and dxtrade in cfd_restricted countries (japan, norway)

* fix: corrected the time in server maintenance notice on derivez trade modal

* fix: Server maintenance notice time

* fix: DerivEZ icon redirect to https://deriv.com/derivez/

* fix: derivez topupVirtual

* revert: undo changes in cfd-dashboard.tsx (deprecated file)

* remove unnecesary parameter

* fix: fixed derivX top up and trade button in onboarding page

* fix: disable button while getting account creating

* fix: disable GET button while account is being created

* fix: disable GET button while account is being created

* fix: setIsAccountBeingCreated(false) after account creation to reenable get buttons

* fix: remove redundant use of await

* fix: server maintenance time TEXT (not time) for derivez

* fix: reenable button when error is triggered too

* fix: blur derivez icon on onboarding 5th page

* fix: remove function call that trigger token error

* Update cfd-store.js

* fix: pull upstream

* fix: hide derivez from oboarding page

* fix: show derivez on onboarding and remove "Demo" from appname

* fix: empty commit

* fix: total asset included derivez balance

* fix: updated mockstore

* fix: separate dxtrade and derivez token loader into two reactions

* fix: rerunning all of our tests

* chore: empty commit

* fix: capitalization on module import

* chore: empty commit

* fix: hotfix

* refactor: use switch-case instead of if-else for type_label

* fix: use short_title instead of title for type_label

* chore: empty commit

* fix: circle ci failing

* fix: font

* Update index.tsx

* fix: text

* fix: asdf

* chore: empty commit

* chore: update branch

* Update cfd-password-modal.tsx

---------

Co-authored-by: hirad-deriv <hirad@re-work.dev>
Co-authored-by: Ali(Ako) Hosseini <ali.hosseini@deriv.com>
  • Loading branch information
3 people committed Jun 27, 2023
1 parent fa04262 commit 93e8ca7
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ const PoiConfirmWithExampleFormContainer = ({
setFieldTouched={setFieldTouched}
editable_fields={rest_state.changeable_fields}
is_rendered_for_onfido
warning_items={undefined}
/>
<button
type='submit'
Expand Down
57 changes: 33 additions & 24 deletions packages/cfd/src/Containers/cfd-password-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ import RootStore from '../Stores/index';
import {
getDxCompanies,
getMtCompanies,
getDerivezCompanies,
getFormattedJurisdictionCode,
TMtCompanies,
TDxCompanies,
TDerivezCompanies,
} from '../Stores/Modules/CFD/Helpers/cfd-config';
import {
FormSubmitButton,
Expand Down Expand Up @@ -839,15 +841,33 @@ const CFDPasswordModal = ({
if (!category && !type) return '';

const category_label = category === 'real' ? localize('real') : localize('demo');
const type_label =
getMtCompanies(show_eu_related_content)[category as keyof TMtCompanies][
type as keyof TMtCompanies['demo' | 'real']
].short_title;
const deriv_x_type_label =
getDxCompanies()[category as keyof TDxCompanies][type as keyof TDxCompanies['demo' | 'real']].short_title;
let type_label = '';
switch (platform) {
case CFD_PLATFORMS.MT5:
type_label =
getMtCompanies(show_eu_related_content)[category as keyof TMtCompanies][
type as keyof TMtCompanies['demo' | 'real']
].short_title;
break;
case CFD_PLATFORMS.DXTRADE:
type_label =
getDxCompanies()[category as keyof TDxCompanies][type as keyof TDxCompanies['demo' | 'real']]
.short_title;
break;
case CFD_PLATFORMS.DERIVEZ:
type_label =
getDerivezCompanies()[category as keyof TDerivezCompanies][
type as keyof TDerivezCompanies['demo' | 'real']
].short_title;
break;
default:
type_label = '';
break;
}

const jurisdiction_label =
jurisdiction_selected_shortcode && getFormattedJurisdictionCode(jurisdiction_selected_shortcode);
const mt5_platform_label = jurisdiction_selected_shortcode !== Jurisdiction.MALTA_INVEST ? 'MT5' : '';
const mt5_platform_label = jurisdiction_selected_shortcode !== Jurisdiction.MALTA_INVEST ? 'Deriv MT5' : '';

if (category === 'real') {
let platformName = '';
Expand All @@ -868,19 +888,14 @@ const CFDPasswordModal = ({
<Localize
i18n_default_text='Congratulations, you have successfully created your {{category}} <0>{{platform}}</0> <1>{{type}} {{jurisdiction_selected_shortcode}}</1> account. '
values={{
type:
platform === CFD_PLATFORMS.DERIVEZ
? 'CFDs'
: platform === CFD_PLATFORMS.DXTRADE
? deriv_x_type_label
: type_label,
type: type_label,
platform:
platform === CFD_PLATFORMS.MT5 ? mt5_platform_label : getCFDPlatformLabel(platform),
category: category_label,
jurisdiction_selected_shortcode:
platform === CFD_PLATFORMS.MT5 && !show_eu_related_content ? jurisdiction_label : '',
}}
components={[<span key={0} />, <strong key={1} className='cfd-account__platform' />]}
components={[<span key={0} className='cfd-account__platform' />, <strong key={1} />]}
/>
{platform === CFD_PLATFORMS.DXTRADE ? (
<Localize i18n_default_text='To start trading, transfer funds from your Deriv account into this account.' />
Expand All @@ -897,19 +912,13 @@ const CFDPasswordModal = ({

return (
<Localize
i18n_default_text='Congratulations, you have successfully created your {{category}} {{deriv_keyword}} <0>{{platform}}</0> <1>{{type}}</1> account.'
i18n_default_text='Congratulations, you have successfully created your {{category}} <0>{{platform}}</0> <1>{{type}}</1> account. '
values={{
deriv_keyword: platform === CFD_PLATFORMS.MT5 ? 'Deriv' : '',
type:
platform === CFD_PLATFORMS.DERIVEZ
? 'CFDs'
: platform === CFD_PLATFORMS.DXTRADE
? deriv_x_type_label
: type_label,
platform: platform === CFD_PLATFORMS.MT5 ? 'MT5' : getCFDPlatformLabel(platform),
type: type_label,
platform: getCFDPlatformLabel(platform),
category: category_label,
}}
components={[<span key={0} />, <strong key={1} className='cfd-account__platform' />]}
components={[<span key={0} className='cfd-account__platform' />, <strong key={1} />]}
/>
);
};
Expand Down
7 changes: 3 additions & 4 deletions packages/cfd/src/Stores/Modules/CFD/Helpers/cfd-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const getMtCompanies = (is_eu: boolean) => {
const all_config = {
account_type: '',
leverage: 100,
short_title: localize('Demo'),
short_title: localize('Swap-Free'),
};
const synthetic_config = {
account_type: '',
Expand All @@ -93,7 +93,6 @@ export const getMtCompanies = (is_eu: boolean) => {
leverage: 100,
short_title: localize('Financial STP'),
};

return {
demo: {
all: {
Expand All @@ -106,7 +105,7 @@ export const getMtCompanies = (is_eu: boolean) => {
mt5_account_type: all_config.account_type,
leverage: all_config.leverage,
title: localize('Demo Swap-Free SVG'),
short_title: all_config.short_title,
short_title: localize('Swap-Free SVG'),
},
derivez: {
mt5_account_type: all_config.account_type,
Expand Down Expand Up @@ -137,7 +136,7 @@ export const getMtCompanies = (is_eu: boolean) => {
mt5_account_type: financial_config.account_type,
leverage: financial_config.leverage,
title: is_eu ? localize('Demo CFDs') : localize('Demo Financial SVG'),
short_title: financial_config.short_title,
short_title: is_eu ? localize('CFDs') : localize('Financial SVG'),
},
financial_stp: {
mt5_account_type: financial_stp_config.account_type,
Expand Down

0 comments on commit 93e8ca7

Please sign in to comment.