From 5914b2f7648b67ea822db4e5db5337024c102a0d Mon Sep 17 00:00:00 2001 From: thisyahlen <104053934+thisyahlen-deriv@users.noreply.github.com> Date: Fri, 2 Jun 2023 12:34:59 +0800 Subject: [PATCH] thisyahlen/fix: change algo for realAccountSignup (#8656) * fix: change algo for realAccountSignup * fix: refactor * redeploy: vercel --- .../add-options-account/add-options-account.tsx | 2 +- .../components/options-multipliers-listing/index.tsx | 2 +- packages/cfd/src/Stores/Modules/CFD/cfd-store.js | 2 +- .../Modals/deriv-real-account-required-modal.jsx | 2 +- .../Containers/AccountSwitcher/account-switcher.jsx | 4 ++-- .../need-real-account-for-cashier-modal.tsx | 2 +- .../ready-to-deposit-modal.tsx | 2 +- .../core/src/App/Containers/Redirect/redirect.jsx | 2 +- packages/core/src/Stores/ui-store.js | 12 +++++++----- packages/stores/types.ts | 4 +++- 10 files changed, 19 insertions(+), 15 deletions(-) diff --git a/packages/appstore/src/components/add-options-account/add-options-account.tsx b/packages/appstore/src/components/add-options-account/add-options-account.tsx index 31851780ce25..a6281ff9626d 100644 --- a/packages/appstore/src/components/add-options-account/add-options-account.tsx +++ b/packages/appstore/src/components/add-options-account/add-options-account.tsx @@ -36,7 +36,7 @@ const AddOptions = observer(() => { openRealAccountSignup('maltainvest'); } } else { - openRealAccountSignup(); + openRealAccountSignup('svg'); } }} is_disabled={false} diff --git a/packages/appstore/src/components/options-multipliers-listing/index.tsx b/packages/appstore/src/components/options-multipliers-listing/index.tsx index 4193a420d075..5465ad10e9d0 100644 --- a/packages/appstore/src/components/options-multipliers-listing/index.tsx +++ b/packages/appstore/src/components/options-multipliers-listing/index.tsx @@ -85,7 +85,7 @@ const OptionsAndMultipliersListing = () => { openRealAccountSignup('maltainvest'); } } else { - openRealAccountSignup(); + openRealAccountSignup('svg'); } }} /> diff --git a/packages/cfd/src/Stores/Modules/CFD/cfd-store.js b/packages/cfd/src/Stores/Modules/CFD/cfd-store.js index 9562b77395a0..ae9771796202 100644 --- a/packages/cfd/src/Stores/Modules/CFD/cfd-store.js +++ b/packages/cfd/src/Stores/Modules/CFD/cfd-store.js @@ -310,7 +310,7 @@ export default class CFDStore extends BaseStore { beginRealSignupForMt5() { sessionStorage.setItem('post_real_account_signup', JSON.stringify(this.account_type)); - this.root_store.ui.openRealAccountSignup(); + this.root_store.ui.openRealAccountSignup('svg'); } realCFDSignup(set_password) { diff --git a/packages/core/src/App/Components/Elements/Modals/deriv-real-account-required-modal.jsx b/packages/core/src/App/Components/Elements/Modals/deriv-real-account-required-modal.jsx index b14b5f09a903..c2880096e4cf 100644 --- a/packages/core/src/App/Components/Elements/Modals/deriv-real-account-required-modal.jsx +++ b/packages/core/src/App/Components/Elements/Modals/deriv-real-account-required-modal.jsx @@ -19,7 +19,7 @@ const DerivRealAccountRequiredModal = ({ openRealAccountSignup('maltainvest'); } else { onClose(); - openRealAccountSignup(); + openRealAccountSignup('svg'); } }; diff --git a/packages/core/src/App/Containers/AccountSwitcher/account-switcher.jsx b/packages/core/src/App/Containers/AccountSwitcher/account-switcher.jsx index 802d7b57c73d..c4eabb7b72f0 100644 --- a/packages/core/src/App/Containers/AccountSwitcher/account-switcher.jsx +++ b/packages/core/src/App/Containers/AccountSwitcher/account-switcher.jsx @@ -316,7 +316,7 @@ const AccountSwitcher = ({ if (real_account_creation_unlock_date) { closeAccountsDialog(); setShouldShowCooldownModal(true); - } else openRealAccountSignup(account); + } else openRealAccountSignup('svg'); }} className='acc-switcher__new-account-btn' secondary @@ -390,7 +390,7 @@ const AccountSwitcher = ({ closeAccountsDialog(); setShouldShowCooldownModal(true); } else { - openRealAccountSignup(account); + openRealAccountSignup('maltainvest'); } }} className='acc-switcher__new-account-btn' diff --git a/packages/core/src/App/Containers/Modals/need-real-account-for-cashier-modal/need-real-account-for-cashier-modal.tsx b/packages/core/src/App/Containers/Modals/need-real-account-for-cashier-modal/need-real-account-for-cashier-modal.tsx index 44ad53d94cbe..02f22da6d699 100644 --- a/packages/core/src/App/Containers/Modals/need-real-account-for-cashier-modal/need-real-account-for-cashier-modal.tsx +++ b/packages/core/src/App/Containers/Modals/need-real-account-for-cashier-modal/need-real-account-for-cashier-modal.tsx @@ -21,7 +21,7 @@ const NeedRealAccountForCashierModal = observer(() => { const createAccount = () => { toggleNeedRealAccountForCashierModal(); - return is_eu_user ? openRealAccountSignup('maltainvest') : openRealAccountSignup(); + return is_eu_user ? openRealAccountSignup('maltainvest') : openRealAccountSignup('svg'); }; const switchRegulation = () => { diff --git a/packages/core/src/App/Containers/Modals/ready-to-deposit-modal/ready-to-deposit-modal.tsx b/packages/core/src/App/Containers/Modals/ready-to-deposit-modal/ready-to-deposit-modal.tsx index 4484f8517a5b..0698ed91b2d7 100644 --- a/packages/core/src/App/Containers/Modals/ready-to-deposit-modal/ready-to-deposit-modal.tsx +++ b/packages/core/src/App/Containers/Modals/ready-to-deposit-modal/ready-to-deposit-modal.tsx @@ -24,7 +24,7 @@ const ReadyToDepositModal = observer(() => { } else if (is_eu_user) { return openRealAccountSignup('maltainvest'); } - return openRealAccountSignup(); + return openRealAccountSignup('svg'); }; return ( diff --git a/packages/core/src/App/Containers/Redirect/redirect.jsx b/packages/core/src/App/Containers/Redirect/redirect.jsx index 53a67660a86d..ec9b7ca94c82 100644 --- a/packages/core/src/App/Containers/Redirect/redirect.jsx +++ b/packages/core/src/App/Containers/Redirect/redirect.jsx @@ -130,7 +130,7 @@ const Redirect = ({ WS.wait('get_account_status').then(() => { if (!currency) return openRealAccountSignup('set_currency'); if (hasAnyRealAccount()) return openRealAccountSignup('manage'); - return openRealAccountSignup(); + return openRealAccountSignup('svg'); }); const ext_platform_url = url_params.get('ext_platform_url'); if (ext_platform_url) { diff --git a/packages/core/src/Stores/ui-store.js b/packages/core/src/Stores/ui-store.js index 487690b9ffec..fbb0e5385e22 100644 --- a/packages/core/src/Stores/ui-store.js +++ b/packages/core/src/Stores/ui-store.js @@ -611,11 +611,13 @@ export default class UIStore extends BaseStore { this.is_positions_drawer_on = true; } - openRealAccountSignup(target = this.root_store.client.upgradeable_landing_companies?.[0]) { - this.is_real_acc_signup_on = true; - this.real_account_signup_target = target; - this.is_accounts_switcher_on = false; - localStorage.removeItem('current_question_index'); + openRealAccountSignup(target) { + if (target) { + this.is_real_acc_signup_on = true; + this.real_account_signup_target = target; + this.is_accounts_switcher_on = false; + localStorage.removeItem('current_question_index'); + } } setShouldShowCancel(value) { diff --git a/packages/stores/types.ts b/packages/stores/types.ts index 59eff0c6fbe8..a90c88e9ae7e 100644 --- a/packages/stores/types.ts +++ b/packages/stores/types.ts @@ -269,8 +269,10 @@ type TUiStore = { is_reports_visible: boolean; is_language_settings_modal_on: boolean; is_mobile: boolean; + openRealAccountSignup: ( + value: 'maltainvest' | 'svg' | 'add_crypto' | 'choose' | 'add_fiat' | 'set_currency' | 'manage' + ) => void; notification_messages_ui: React.FC | null; - openRealAccountSignup: (value?: string) => void; setCurrentFocus: (value: string) => void; setDarkMode: (is_dark_mode_on: boolean) => boolean; setReportsTabIndex: (value: number) => void;