diff --git a/packages/blockchain-wallet-v4-frontend/src/components/Navbar/SuperAppLink/index.tsx b/packages/blockchain-wallet-v4-frontend/src/components/Navbar/SuperAppLink/index.tsx index 11e53918672..c1e71bc4b95 100644 --- a/packages/blockchain-wallet-v4-frontend/src/components/Navbar/SuperAppLink/index.tsx +++ b/packages/blockchain-wallet-v4-frontend/src/components/Navbar/SuperAppLink/index.tsx @@ -20,7 +20,13 @@ const SuperAppLink = () => { const hasSuperAppAccess = localStorage.getItem('wallet_v5_ui_available') === 'true' const handleClick = () => { + const optOutDate = localStorage.getItem('opt_out_date') + + if (optOutDate) { + localStorage.removeItem('opt_out_date') + } localStorage.setItem('opt_out_wallet_v5_ui', 'false') + window.location.reload() } diff --git a/packages/blockchain-wallet-v4-frontend/src/scenes/app.tsx b/packages/blockchain-wallet-v4-frontend/src/scenes/app.tsx index 7f23448671d..6bcf2656bed 100644 --- a/packages/blockchain-wallet-v4-frontend/src/scenes/app.tsx +++ b/packages/blockchain-wallet-v4-frontend/src/scenes/app.tsx @@ -112,6 +112,8 @@ const App = ({ useEffect(() => { // Used to get cached values from old implementation, if they exist. const cookies = new Cookies() + const optOut = localStorage.getItem('opt_out_wallet_v5_ui') + const optOutDate = localStorage.getItem('opt_out_date') const cache = { canary_position: cookies.get('canary_position'), opt_out_wallet_v5_ui: cookies.get('opt_out_wallet_v5_ui') @@ -123,10 +125,14 @@ const App = ({ } // Update localStorage cache with current values, if exists. - if (localStorage.getItem('opt_out_wallet_v5_ui') === null && cache.opt_out_wallet_v5_ui) { + if (optOut === null && cache.opt_out_wallet_v5_ui) { localStorage.setItem('opt_out_wallet_v5_ui', JSON.stringify(cache.opt_out_wallet_v5_ui)) } + if (optOut && optOutDate === null) { + localStorage.setItem('opt_out_date', new Date().toISOString()) + } + // OBTAIN THE THRESHOLD - STATICALLY SET, DECIDED BY TEAM. const THRESHOLD = 30