Skip to content

Commit 7b2c88f

Browse files
authored
feat(extension): [LW-9230] add multi delegation and dapp issues modal (#1133)
* feat(extension): add multi delegation and dapp issues modal * fix(extension): fix multi deleg banner visibility * fix(extension): show modal from manage portfolio * fix(extension): rename LS key * fix(extension): handle select by checking checkbox from list view
1 parent ea1ad81 commit 7b2c88f

File tree

22 files changed

+346
-105
lines changed

22 files changed

+346
-105
lines changed

apps/browser-extension-wallet/src/features/delegation/components/MultiDelegationStakingPopup.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { useTranslation } from 'react-i18next';
1919
import { BrowserViewSections } from '@lib/scripts/types';
2020
import { useWalletActivities } from '@hooks/useWalletActivities';
2121
import {
22+
MULTIDELEGATION_DAPP_COMPATIBILITY_LS_KEY,
2223
MULTIDELEGATION_FIRST_VISIT_LS_KEY,
2324
MULTIDELEGATION_FIRST_VISIT_SINCE_PORTFOLIO_PERSISTENCE_LS_KEY,
2425
STAKING_BROWSER_PREFERENCES_LS_KEY
@@ -86,6 +87,8 @@ export const MultiDelegationStakingPopup = (): JSX.Element => {
8687
MULTIDELEGATION_FIRST_VISIT_LS_KEY,
8788
true
8889
);
90+
const [multidelegationDAppCompatibility, { updateLocalStorage: setMultidelegationDAppCompatibility }] =
91+
useLocalStorage(MULTIDELEGATION_DAPP_COMPATIBILITY_LS_KEY, true);
8992
const [
9093
multidelegationFirstVisitSincePortfolioPersistence,
9194
{ updateLocalStorage: setMultidelegationFirstVisitSincePortfolioPersistence }
@@ -109,6 +112,8 @@ export const MultiDelegationStakingPopup = (): JSX.Element => {
109112
setStakingBrowserPreferencesPersistence,
110113
multidelegationFirstVisit,
111114
triggerMultidelegationFirstVisit: () => setMultidelegationFirstVisit(false),
115+
multidelegationDAppCompatibility,
116+
triggerMultidelegationDAppCompatibility: () => setMultidelegationDAppCompatibility(false),
112117
multidelegationFirstVisitSincePortfolioPersistence,
113118
triggerMultidelegationFirstVisitSincePortfolioPersistence: () => {
114119
setMultidelegationFirstVisit(false);

apps/browser-extension-wallet/src/hooks/__tests__/useWalletManager.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,7 @@ describe('Testing useWalletManager hook', () => {
554554
'hideBalance',
555555
'isForgotPasswordFlow',
556556
'multidelegationFirstVisit',
557+
'isMultiDelegationDAppCompatibilityModalVisible',
557558
'multidelegationFirstVisitSincePortfolioPersistence'
558559
]
559560
});

apps/browser-extension-wallet/src/hooks/useWalletManager.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,7 @@ export const useWalletManager = (): UseWalletManager => {
614614
'hideBalance',
615615
'isForgotPasswordFlow',
616616
'multidelegationFirstVisit',
617+
'isMultiDelegationDAppCompatibilityModalVisible',
617618
'multidelegationFirstVisitSincePortfolioPersistence'
618619
];
619620

apps/browser-extension-wallet/src/types/local-storage.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export interface ILocalStorage {
5858
analyticsStatus?: EnhancedAnalyticsOptInStatus;
5959
isForgotPasswordFlow?: boolean;
6060
multidelegationFirstVisit?: boolean;
61+
isMultiDelegationDAppCompatibilityModalVisible?: boolean;
6162
multidelegationFirstVisitSincePortfolioPersistence?: boolean;
6263
unconfirmedTransactions: UnconfirmedTransaction[];
6364
stakingBrowserPreferences: StakingBrowserPreferences;

apps/browser-extension-wallet/src/utils/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,5 @@ export const COINGECKO_URL = 'https://www.coingecko.com';
107107
export const MULTIDELEGATION_FIRST_VISIT_SINCE_PORTFOLIO_PERSISTENCE_LS_KEY =
108108
'multidelegationFirstVisitSincePortfolioPersistence';
109109
export const MULTIDELEGATION_FIRST_VISIT_LS_KEY = 'multidelegationFirstVisit';
110+
export const MULTIDELEGATION_DAPP_COMPATIBILITY_LS_KEY = 'isMultiDelegationDAppCompatibilityModalVisible';
110111
export const STAKING_BROWSER_PREFERENCES_LS_KEY = 'stakingBrowserPreferences';

apps/browser-extension-wallet/src/views/browser-view/features/staking/components/StakingContainer.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { useAnalyticsContext, useCurrencyStore, useExternalLinkOpener } from '@p
1313
import { DEFAULT_STAKING_BROWSER_PREFERENCES, OutsideHandlesProvider } from '@lace/staking';
1414
import { useBalances, useCustomSubmitApi, useFetchCoinPrice, useLocalStorage } from '@hooks';
1515
import {
16+
MULTIDELEGATION_DAPP_COMPATIBILITY_LS_KEY,
1617
MULTIDELEGATION_FIRST_VISIT_LS_KEY,
1718
MULTIDELEGATION_FIRST_VISIT_SINCE_PORTFOLIO_PERSISTENCE_LS_KEY,
1819
STAKING_BROWSER_PREFERENCES_LS_KEY
@@ -32,6 +33,8 @@ export const StakingContainer = (): React.ReactElement => {
3233
MULTIDELEGATION_FIRST_VISIT_LS_KEY,
3334
true
3435
);
36+
const [multidelegationDAppCompatibility, { updateLocalStorage: setMultidelegationDAppCompatibility }] =
37+
useLocalStorage(MULTIDELEGATION_DAPP_COMPATIBILITY_LS_KEY, true);
3538
const [
3639
multidelegationFirstVisitSincePortfolioPersistence,
3740
{ updateLocalStorage: setMultidelegationFirstVisitSincePortfolioPersistence }
@@ -125,6 +128,8 @@ export const StakingContainer = (): React.ReactElement => {
125128
compactNumber: compactNumberWithUnit,
126129
multidelegationFirstVisit,
127130
triggerMultidelegationFirstVisit: () => setMultidelegationFirstVisit(false),
131+
multidelegationDAppCompatibility,
132+
triggerMultidelegationDAppCompatibility: () => setMultidelegationDAppCompatibility(false),
128133
multidelegationFirstVisitSincePortfolioPersistence,
129134
triggerMultidelegationFirstVisitSincePortfolioPersistence: () => {
130135
setMultidelegationFirstVisit(false);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/* eslint-disable no-undef */
2+
import { ChainablePromiseElement } from 'webdriverio';
3+
4+
class MultidelegationDAppIssueModal {
5+
private TITLE = '[data-testid="stake-modal-title"]';
6+
private DESCRIPTION = '[data-testid="stake-modal-description"]';
7+
private GOT_IT_BUTTON = '[data-testid="multidelegation-dapp-modal-button"]';
8+
9+
get title(): ChainablePromiseElement<WebdriverIO.Element> {
10+
return $(this.TITLE);
11+
}
12+
13+
get description(): ChainablePromiseElement<WebdriverIO.Element> {
14+
return $(this.DESCRIPTION);
15+
}
16+
17+
get gotItButton(): ChainablePromiseElement<WebdriverIO.Element> {
18+
return $(this.GOT_IT_BUTTON);
19+
}
20+
}
21+
22+
export default new MultidelegationDAppIssueModal();

packages/e2e-tests/src/features/e2e/StakingInitialFundsE2E.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Feature: Delegating funds to new pool E2E
2828
And I navigate to Transactions extended page
2929
Then the Received transaction is displayed with value: "5.00 tADA" and tokens count 1
3030
And I disable showing Multidelegation beta banner
31+
And I disable showing Multidelegation DApps issue modal
3132
And I navigate to Staking extended page
3233
And I open Browse pools tab
3334
And I switch to list view on "Browse pools" tab

packages/e2e-tests/src/fixture/localStorageInitializer.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ class LocalStorageInitializer {
8585
await localStorageManager.setItem('analyticsStatus', '');
8686
};
8787

88+
disableShowingMultidelegationDAppsIssueModal = async () => {
89+
await localStorageManager.setItem('isMultiDelegationDAppCompatibilityModalVisible', 'false');
90+
};
91+
8892
initialiseBasicLocalStorageData = async (
8993
walletName: string,
9094
chainName: 'Preprod' | 'Preview' | 'Mainnet'

packages/e2e-tests/src/hooks/beforeTagHooks.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,13 @@ Before(
152152
Before({ tags: '@Staking-NonDelegatedFunds-Extended' }, async () => {
153153
await extendedViewWalletInitialization(TestWalletName.TAWalletNonDelegatedFunds);
154154
await localStorageInitializer.disableShowingMultidelegationBetaBanner();
155+
await localStorageInitializer.disableShowingMultidelegationDAppsIssueModal();
155156
});
156157

157158
Before({ tags: '@Staking-NonDelegatedFunds-Popup' }, async () => {
158159
await popupViewWalletInitialization(TestWalletName.TAWalletNonDelegatedFunds);
159160
await localStorageInitializer.disableShowingMultidelegationBetaBanner();
161+
await localStorageInitializer.disableShowingMultidelegationDAppsIssueModal();
160162
});
161163

162164
Before(
@@ -174,6 +176,7 @@ Before({ tags: '@AdaHandle-popup' }, async () => await popupViewWalletInitializa
174176
Before({ tags: '@Multidelegation-SwitchingPools-Extended-E2E' }, async () => {
175177
await extendedViewWalletInitialization(TestWalletName.WalletMultidelegationSwitchPoolsE2E);
176178
await localStorageInitializer.disableShowingMultidelegationBetaBanner();
179+
await localStorageInitializer.disableShowingMultidelegationDAppsIssueModal();
177180
});
178181

179182
Before(
@@ -189,23 +192,27 @@ Before(
189192
Before({ tags: '@Multidelegation-DelegatedFunds-SinglePool-Popup' }, async () => {
190193
await popupViewWalletInitialization(TestWalletName.MultidelegationDelegatedSingle);
191194
await localStorageInitializer.disableShowingMultidelegationBetaBanner();
195+
await localStorageInitializer.disableShowingMultidelegationDAppsIssueModal();
192196
await localStorageInitializer.initializeShowMultiAddressDiscoveryModal(false);
193197
});
194198

195199
Before({ tags: '@Multidelegation-DelegatedFunds-SinglePool-Extended' }, async () => {
196200
await extendedViewWalletInitialization(TestWalletName.MultidelegationDelegatedSingle);
197201
await localStorageInitializer.disableShowingMultidelegationBetaBanner();
202+
await localStorageInitializer.disableShowingMultidelegationDAppsIssueModal();
198203
await localStorageInitializer.initializeShowMultiAddressDiscoveryModal(false);
199204
});
200205

201206
Before({ tags: '@Multidelegation-DelegatedFunds-MultiplePools-Popup' }, async () => {
202207
await popupViewWalletInitialization(TestWalletName.MultidelegationDelegatedMulti);
203208
await localStorageInitializer.disableShowingMultidelegationBetaBanner();
209+
await localStorageInitializer.disableShowingMultidelegationDAppsIssueModal();
204210
await localStorageInitializer.initializeShowMultiAddressDiscoveryModal(false);
205211
});
206212

207213
Before({ tags: '@Multidelegation-DelegatedFunds-MultiplePools-Extended' }, async () => {
208214
await extendedViewWalletInitialization(TestWalletName.MultidelegationDelegatedMulti);
209215
await localStorageInitializer.disableShowingMultidelegationBetaBanner();
216+
await localStorageInitializer.disableShowingMultidelegationDAppsIssueModal();
210217
await localStorageInitializer.initializeShowMultiAddressDiscoveryModal(false);
211218
});

0 commit comments

Comments
 (0)