diff --git a/packages/core/src/App/Containers/app-notification-messages.jsx b/packages/core/src/App/Containers/app-notification-messages.jsx index 8a6a94f0b2da..267b0c14cabf 100644 --- a/packages/core/src/App/Containers/app-notification-messages.jsx +++ b/packages/core/src/App/Containers/app-notification-messages.jsx @@ -138,7 +138,7 @@ const AppNotificationMessages = ({ 'has_changed_two_fa', 'svg_needs_poi', 'svg_poi_expired', - 'switched_to_real', + 'success_wallets_upgrade', ].includes(message.key) || message.type === 'p2p_completed_order' : true; @@ -156,10 +156,7 @@ const AppNotificationMessages = ({ : excluded_notifications.includes(message.key) ); - const notifications_sublist = - window.location.pathname === routes.cashier_deposit - ? filtered_excluded_notifications.filter(message => message.key.includes('switched_to_real')) - : filtered_excluded_notifications.slice(0, notifications_limit); + const notifications_sublist = filtered_excluded_notifications.slice(0, notifications_limit); if (!should_show_popups) return null; diff --git a/packages/core/src/Stores/Helpers/client-notifications.js b/packages/core/src/Stores/Helpers/client-notifications.js index 16cf5ec70b34..61b3fa984d59 100644 --- a/packages/core/src/Stores/Helpers/client-notifications.js +++ b/packages/core/src/Stores/Helpers/client-notifications.js @@ -62,6 +62,12 @@ export const getCashierValidations = cashier_arr => { }; // Notifications keys will not be added to localStorage and will appear again after user logout/login -export const excluded_notifications = ['contract_sold', 'switched_to_real', 'has_changed_two_fa']; +export const excluded_notifications = ['contract_sold', 'has_changed_two_fa', 'success_wallets_upgrade']; -export const priority_toast_messages = ['svg', 'need_fa', 'p2p_daily_limit_increase', 'authenticate']; +export const priority_toast_messages = [ + 'svg', + 'need_fa', + 'p2p_daily_limit_increase', + 'authenticate', + 'success_wallets_upgrade', +]; diff --git a/packages/core/src/Stores/notification-store.js b/packages/core/src/Stores/notification-store.js index 3d26e79fc3af..57ee5633f3b9 100644 --- a/packages/core/src/Stores/notification-store.js +++ b/packages/core/src/Stores/notification-store.js @@ -337,6 +337,9 @@ export default class NotificationStore extends BaseStore { this.handlePOAAddressMismatchNotifications(); + // TODO: Update logic when BE API is integrated [Wallets] + this.showSuccessWalletsUpgradeNotification(); + if (!has_enabled_two_fa && obj_total_balance.amount_real > 0) { this.addNotificationMessage(this.client_notifications.two_f_a); } else { @@ -1574,23 +1577,6 @@ export default class NotificationStore extends BaseStore { }); }; - showAccountSwitchToRealNotification = (loginid, currency) => { - const regulation = loginid?.startsWith('CR') ? localize('non-EU') : localize('EU'); - - this.addNotificationMessage({ - key: 'switched_to_real', - header: localize('Switched to real account'), - message: ( - - ), - type: 'info', - should_show_again: true, - }); - }; - async getP2pCompletedOrders() { await WS.wait('authorize'); const response = await WS.send?.({ p2p_order_list: 1, active: 0 }); @@ -1599,4 +1585,27 @@ export default class NotificationStore extends BaseStore { this.p2p_completed_orders = response?.p2p_order_list?.list || []; } } + + showSuccessWalletsUpgradeNotification = () => { + const { client } = this.root_store; + const { logout } = client; + this.addNotificationMessage({ + key: 'success_wallets_upgrade', + header: localize('Your Wallets are ready'), + message: localize( + 'To complete the upgrade, please log out and log in again to add more accounts and make transactions with your Wallets.' + ), + action: { + onClick: async () => { + await logout(); + this.removeNotificationMessage({ + key: this.client_notifications.failed_wallets_upgrade.key, + should_show_again: false, + }); + }, + text: localize('Log out'), + }, + type: 'announce', + }); + }; } diff --git a/packages/stores/src/mockStore.ts b/packages/stores/src/mockStore.ts index 4fc0802ff0db..cfeda5cf2cdf 100644 --- a/packages/stores/src/mockStore.ts +++ b/packages/stores/src/mockStore.ts @@ -306,6 +306,7 @@ const mock = (): TStores & { is_mock: boolean } => { setP2POrderProps: jest.fn(), showAccountSwitchToRealNotification: jest.fn(), setP2PRedirectTo: jest.fn(), + showSuccessWalletsUpgradeNotification: jest.fn(), }, portfolio: { active_positions: [], diff --git a/packages/stores/types.ts b/packages/stores/types.ts index 608b41bba10a..4bdb1b3b5d61 100644 --- a/packages/stores/types.ts +++ b/packages/stores/types.ts @@ -332,6 +332,7 @@ type TNotificationStore = { setP2POrderProps: () => void; showAccountSwitchToRealNotification: (loginid: string, currency: string) => void; setP2PRedirectTo: () => void; + showSuccessWalletsUpgradeNotification: () => void; }; type TTradersHubStore = {