Skip to content

Commit

Permalink
fix: remove the staking portfolio persistence modal (#1572)
Browse files Browse the repository at this point in the history
* feat: remove the staking portfolio persistence modal

* test(extension): remove outdated step
  • Loading branch information
greatertomi authored Dec 10, 2024
1 parent bdf7d29 commit fef43f5
Show file tree
Hide file tree
Showing 19 changed files with 6 additions and 131 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { useWalletActivities } from '@hooks/useWalletActivities';
import {
MULTIDELEGATION_DAPP_COMPATIBILITY_LS_KEY,
MULTIDELEGATION_FIRST_VISIT_LS_KEY,
MULTIDELEGATION_FIRST_VISIT_SINCE_PORTFOLIO_PERSISTENCE_LS_KEY,
STAKING_BROWSER_PREFERENCES_LS_KEY
} from '@utils/constants';
import { withSignTxConfirmation } from '@lib/wallet-api-ui';
Expand Down Expand Up @@ -104,10 +103,6 @@ export const MultiDelegationStakingPopup = (): JSX.Element => {
);
const [multidelegationDAppCompatibility, { updateLocalStorage: setMultidelegationDAppCompatibility }] =
useLocalStorage(MULTIDELEGATION_DAPP_COMPATIBILITY_LS_KEY, true);
const [
multidelegationFirstVisitSincePortfolioPersistence,
{ updateLocalStorage: setMultidelegationFirstVisitSincePortfolioPersistence }
] = useLocalStorage(MULTIDELEGATION_FIRST_VISIT_SINCE_PORTFOLIO_PERSISTENCE_LS_KEY, true);

const [stakingBrowserPreferencesPersistence, { updateLocalStorage: setStakingBrowserPreferencesPersistence }] =
useLocalStorage(STAKING_BROWSER_PREFERENCES_LS_KEY, DEFAULT_STAKING_BROWSER_PREFERENCES);
Expand All @@ -127,14 +122,11 @@ export const MultiDelegationStakingPopup = (): JSX.Element => {
stakingBrowserPreferencesPersistence,
setStakingBrowserPreferencesPersistence,
multidelegationFirstVisit,
triggerMultidelegationFirstVisit: () => setMultidelegationFirstVisit(false),
multidelegationDAppCompatibility,
triggerMultidelegationDAppCompatibility: () => setMultidelegationDAppCompatibility(false),
multidelegationFirstVisitSincePortfolioPersistence,
triggerMultidelegationFirstVisitSincePortfolioPersistence: () => {
triggerMultidelegationFirstVisit: () => {
setMultidelegationFirstVisit(false);
setMultidelegationFirstVisitSincePortfolioPersistence(false);
},
multidelegationDAppCompatibility,
triggerMultidelegationDAppCompatibility: () => setMultidelegationDAppCompatibility(false),
expandStakingView: (urlSearchParams?: string) =>
handleOpenBrowser({ section: BrowserViewSections.STAKING, urlSearchParams }),
balancesBalance: balance,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -580,8 +580,7 @@ describe('Testing useWalletManager hook', () => {
'hideBalance',
'isForgotPasswordFlow',
'multidelegationFirstVisit',
'isMultiDelegationDAppCompatibilityModalVisible',
'multidelegationFirstVisitSincePortfolioPersistence'
'isMultiDelegationDAppCompatibilityModalVisible'
]
});
expect(clearBackgroundStorage).toBeCalledWith({
Expand Down
3 changes: 1 addition & 2 deletions apps/browser-extension-wallet/src/hooks/useWalletManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -698,8 +698,7 @@ export const useWalletManager = (): UseWalletManager => {
'hideBalance',
'isForgotPasswordFlow',
'multidelegationFirstVisit',
'isMultiDelegationDAppCompatibilityModalVisible',
'multidelegationFirstVisitSincePortfolioPersistence'
'isMultiDelegationDAppCompatibilityModalVisible'
];

if (isForgotPasswordFlow) {
Expand Down
1 change: 0 additions & 1 deletion apps/browser-extension-wallet/src/types/local-storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export interface ILocalStorage {
isForgotPasswordFlow?: boolean;
multidelegationFirstVisit?: boolean;
isMultiDelegationDAppCompatibilityModalVisible?: boolean;
multidelegationFirstVisitSincePortfolioPersistence?: boolean;
unconfirmedTransactions: UnconfirmedTransaction[];
stakingBrowserPreferences: StakingBrowserPreferences;
showPinExtension?: boolean;
Expand Down
4 changes: 0 additions & 4 deletions apps/browser-extension-wallet/src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ export const cardanoCoin: Wallet.CoinId = {
symbol: CARDANO_COIN_SYMBOL[Wallet.Cardano.NetworkId.Mainnet]
};

export const EPOCH_DURATION_DAYS = 5;

export const MIN_COIN_TO_SEND = 1;

export const COLLATERAL_ADA_AMOUNT = 5;
Expand Down Expand Up @@ -114,8 +112,6 @@ export const SEND_NFT_DEFAULT_AMOUNT = '1';

export const COINGECKO_URL = 'https://www.coingecko.com';

export const MULTIDELEGATION_FIRST_VISIT_SINCE_PORTFOLIO_PERSISTENCE_LS_KEY =
'multidelegationFirstVisitSincePortfolioPersistence';
export const MULTIDELEGATION_FIRST_VISIT_LS_KEY = 'multidelegationFirstVisit';
export const MULTIDELEGATION_DAPP_COMPATIBILITY_LS_KEY = 'isMultiDelegationDAppCompatibilityModalVisible';
export const STAKING_BROWSER_PREFERENCES_LS_KEY = 'stakingBrowserPreferences';
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { useBalances, useCustomSubmitApi, useFetchCoinPrice, useLocalStorage, us
import {
MULTIDELEGATION_DAPP_COMPATIBILITY_LS_KEY,
MULTIDELEGATION_FIRST_VISIT_LS_KEY,
MULTIDELEGATION_FIRST_VISIT_SINCE_PORTFOLIO_PERSISTENCE_LS_KEY,
STAKING_BROWSER_PREFERENCES_LS_KEY
} from '@utils/constants';
import { useDelegationStore } from '@src/features/delegation/stores';
Expand All @@ -35,10 +34,6 @@ export const StakingContainer = (): React.ReactElement => {
);
const [multidelegationDAppCompatibility, { updateLocalStorage: setMultidelegationDAppCompatibility }] =
useLocalStorage(MULTIDELEGATION_DAPP_COMPATIBILITY_LS_KEY, true);
const [
multidelegationFirstVisitSincePortfolioPersistence,
{ updateLocalStorage: setMultidelegationFirstVisitSincePortfolioPersistence }
] = useLocalStorage(MULTIDELEGATION_FIRST_VISIT_SINCE_PORTFOLIO_PERSISTENCE_LS_KEY, true);
const sendAnalytics = useCallback(() => {
// TODO implement analytics for the new flow
const an = {
Expand Down Expand Up @@ -142,11 +137,6 @@ export const StakingContainer = (): React.ReactElement => {
triggerMultidelegationFirstVisit: () => setMultidelegationFirstVisit(false),
multidelegationDAppCompatibility,
triggerMultidelegationDAppCompatibility: () => setMultidelegationDAppCompatibility(false),
multidelegationFirstVisitSincePortfolioPersistence,
triggerMultidelegationFirstVisitSincePortfolioPersistence: () => {
setMultidelegationFirstVisit(false);
setMultidelegationFirstVisitSincePortfolioPersistence(false);
},
walletAddress,
walletName,
currentChain,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ Feature: Staking Page - Delegated funds - Multiple pools - Popup View

@LW-8330
Scenario: Popup View - Delegation card displays correct data
And I disable showing Multidelegation persistence banner
When I navigate to Staking popup page
Then I see Delegation title displayed for multidelegation
And I see Delegation card displaying correct data

@LW-8338
Scenario: Popup View - Delegated pools cards are present
And I disable showing Multidelegation persistence banner
When I navigate to Staking popup page
And I see Delegation pool cards are displayed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ Feature: Staking Page - Delegated funds - Single pool - Popup View

@LW-8330
Scenario: Popup View - Delegation card displays correct data
And I disable showing Multidelegation persistence banner
When I navigate to Staking popup page
Then I see Delegation title displayed for multidelegation
And I see Delegation card displaying correct data

@LW-8338
Scenario: Popup View - Delegated pools cards are present
And I disable showing Multidelegation persistence banner
When I navigate to Staking popup page
And I see Delegation pool cards are displayed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Feature: LW: Network Switching - extended view
Background:
Given Wallet is synced
And I disable showing Multidelegation beta banner
And I disable showing Multidelegation persistence banner

@LW-3226
Scenario Outline: Extended View - Currency symbol is correct when on different network - <network> <ticker>
Expand Down
4 changes: 0 additions & 4 deletions packages/e2e-tests/src/fixture/localStorageInitializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ class LocalStorageInitializer {
await localStorageManager.setItem('multidelegationFirstVisit', 'false');
};

disableShowingMultidelegationPersistenceBanner = async () => {
await localStorageManager.setItem('multidelegationFirstVisitSincePortfolioPersistence', 'false');
};

enableShowingAnalyticsBanner = async () => {
await localStorageManager.setItem('analyticsStatus', '');
};
Expand Down
6 changes: 0 additions & 6 deletions packages/e2e-tests/src/hooks/beforeTagHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ Before(
async () => {
await extendedViewRepositoryWalletInitialization([TestWalletName.TestAutomationWallet]);
await localStorageInitializer.disableShowingMultidelegationBetaBanner();
await localStorageInitializer.disableShowingMultidelegationPersistenceBanner();
}
);

Expand All @@ -55,7 +54,6 @@ Before(
async () => {
await popupViewRepositoryWalletInitialization([TestWalletName.TestAutomationWallet]);
await localStorageInitializer.disableShowingMultidelegationBetaBanner();
await localStorageInitializer.disableShowingMultidelegationPersistenceBanner();
}
);

Expand Down Expand Up @@ -122,7 +120,6 @@ Before(
Before({ tags: '@Staking-DelegatedFunds-Popup or @NetworkSwitching-popup' }, async () => {
await popupViewRepositoryWalletInitialization([TestWalletName.TAWalletDelegatedFunds]);
await localStorageInitializer.disableShowingMultidelegationBetaBanner();
await localStorageInitializer.disableShowingMultidelegationPersistenceBanner();
});

Before(
Expand Down Expand Up @@ -248,7 +245,6 @@ Before(
async () => {
await extendedViewRepositoryWalletInitialization([TestWalletName.MultiAccActive1]);
await localStorageInitializer.disableShowingMultidelegationBetaBanner();
await localStorageInitializer.disableShowingMultidelegationPersistenceBanner();
}
);

Expand All @@ -259,7 +255,6 @@ Before(
async () => {
await popupViewRepositoryWalletInitialization([TestWalletName.MultiAccActive1]);
await localStorageInitializer.disableShowingMultidelegationBetaBanner();
await localStorageInitializer.disableShowingMultidelegationPersistenceBanner();
}
);

Expand All @@ -268,7 +263,6 @@ Before(
async () => {
await extendedViewRepositoryWalletInitialization([TestWalletName.AddNewWallet]);
await localStorageInitializer.disableShowingMultidelegationBetaBanner();
await localStorageInitializer.disableShowingMultidelegationPersistenceBanner();
await localStorageInitializer.initializeShowMultiAddressDiscoveryModal(false);
await localStorageInitializer.disableShowPinExtension();
}
Expand Down
4 changes: 0 additions & 4 deletions packages/e2e-tests/src/steps/commonSteps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,6 @@ Given(/^I disable showing Multidelegation beta banner$/, async () => {
await localStorageInitializer.disableShowingMultidelegationBetaBanner();
});

Given(/^I disable showing Multidelegation persistence banner$/, async () => {
await localStorageInitializer.disableShowingMultidelegationPersistenceBanner();
});

Given(/^I disable showing Multidelegation DApps issue modal$/, async () => {
await localStorageInitializer.disableShowingMultidelegationDAppsIssueModal();
});
Expand Down
1 change: 0 additions & 1 deletion packages/e2e-tests/src/steps/multidelegationSteps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,6 @@ Given(/^I am on Start Staking page in (extended|popup) mode$/, async (mode: 'ext
await TokensPage.waitUntilCardanoTokenLoaded();
await TokensPage.saveTokenBalance('Cardano');
await localStorageInitializer.disableShowingMultidelegationBetaBanner();
await localStorageInitializer.disableShowingMultidelegationPersistenceBanner();
await mainMenuPageObject.navigateToSection('Staking', mode);
const cardanoBalance = String(await TokensPage.loadTokenBalance('Cardano'));
await StartStakingPageAssert.assertSeeStartStakingPage(cardanoBalance, mode);
Expand Down
2 changes: 0 additions & 2 deletions packages/staking/.storybook/StakingStorybookProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ const outsideHandlesMocks: OutsideHandlesContextValue = {
triggerMultidelegationFirstVisit: undefined,
multidelegationDAppCompatibility: undefined,
triggerMultidelegationDAppCompatibility: undefined,
multidelegationFirstVisitSincePortfolioPersistence: undefined,
triggerMultidelegationFirstVisitSincePortfolioPersistence: undefined,
walletAddress: undefined,
walletName: undefined,
currentChain: undefined,
Expand Down
49 changes: 0 additions & 49 deletions packages/staking/src/features/modals/PortfolioPersistenceModal.tsx

This file was deleted.

1 change: 0 additions & 1 deletion packages/staking/src/features/modals/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export { ChangingPreferencesModal } from './ChangingPreferencesModal';
export { MultidelegationBetaModal } from './MultidelegationBetaModal';
export { PoolsManagementModal, PoolsManagementModalType } from './PoolsManagementModal';
export { PortfolioPersistenceModal } from './PortfolioPersistenceModal';
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ export type OutsideHandlesContextValue = {
triggerMultidelegationFirstVisit: () => void;
multidelegationDAppCompatibility: boolean;
triggerMultidelegationDAppCompatibility: () => void;
multidelegationFirstVisitSincePortfolioPersistence: boolean;
triggerMultidelegationFirstVisitSincePortfolioPersistence: () => void;
walletAddress: string;
walletName: string;
currentChain: Wallet.Cardano.ChainId;
Expand Down
26 changes: 1 addition & 25 deletions packages/staking/src/features/staking/OneTimeModals.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { MultidelegationDAppCompatibilityModal } from 'features/modals/MultidelegationDAppCompatibilityModal';
import { useDelegationPortfolioStore } from 'features/store';
import { isPortfolioSavedOnChain } from 'features/store/delegationPortfolioStore/isPortfolioSavedOnChain';
import { useEffect } from 'react';
import { MultidelegationBetaModal, PortfolioPersistenceModal } from '../modals';
import { MultidelegationBetaModal } from '../modals';
import { useOutsideHandles } from '../outside-handles-provider';

type OneTimeModalManagerProps = { popupView?: boolean };
Expand All @@ -13,14 +12,11 @@ export const OneTimeModals = ({ popupView }: OneTimeModalManagerProps) => {
triggerMultidelegationFirstVisit,
multidelegationDAppCompatibility,
triggerMultidelegationDAppCompatibility,
multidelegationFirstVisitSincePortfolioPersistence,
triggerMultidelegationFirstVisitSincePortfolioPersistence,
} = useOutsideHandles();
const { currentPortfolio } = useDelegationPortfolioStore((store) => ({
currentPortfolio: store.currentPortfolio,
}));
const userAlreadyMultidelegated = currentPortfolio.length > 1;
const portfolioSavedOnChain = isPortfolioSavedOnChain(currentPortfolio);

// the useEffects below prevent the modals from appearing to the user in the future e.g. after undelegating the portfolio
useEffect(() => {
Expand All @@ -29,16 +25,6 @@ export const OneTimeModals = ({ popupView }: OneTimeModalManagerProps) => {
}
}, [userAlreadyMultidelegated, multidelegationFirstVisit, triggerMultidelegationFirstVisit]);

useEffect(() => {
if (multidelegationFirstVisitSincePortfolioPersistence && portfolioSavedOnChain) {
triggerMultidelegationFirstVisitSincePortfolioPersistence();
}
}, [
multidelegationFirstVisitSincePortfolioPersistence,
triggerMultidelegationFirstVisitSincePortfolioPersistence,
portfolioSavedOnChain,
]);

if (!userAlreadyMultidelegated) {
return (
<MultidelegationBetaModal
Expand All @@ -59,15 +45,5 @@ export const OneTimeModals = ({ popupView }: OneTimeModalManagerProps) => {
);
}

if (!portfolioSavedOnChain) {
return (
<PortfolioPersistenceModal
visible={multidelegationFirstVisitSincePortfolioPersistence}
onConfirm={triggerMultidelegationFirstVisitSincePortfolioPersistence}
popupView={popupView}
/>
);
}

return null;
};
2 changes: 0 additions & 2 deletions packages/translation/src/lib/translations/staking/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,6 @@
"modals.beta.button": "Got it",
"modals.beta.description": "This feature allows you to stake to up to {{maxPools}} pools. This is still in beta version, so some functionality might not be available. Read more about multi-delegation in our <Link>dedicated blog.</Link>",
"modals.beta.pill": "Beta",
"modals.beta.portfolioPersistence.description": "Lace now supports on-chain portfolio persistence! This feature helps protect portfolios from significant drift and ensures cross-device syncing. If you've previously submitted a delegation, please resubmit your current (or a new) delegation to enable on-chain portfolio persistence.",
"modals.beta.portfolioPersistence.title": "Multi-delegation: Portfolio Persistence",
"modals.beta.title": "Multi-delegation",
"modals.changingPreferences.buttons.cancel": "Cancel",
"modals.changingPreferences.buttons.confirm": "Fine by me",
Expand Down

0 comments on commit fef43f5

Please sign in to comment.