diff --git a/apps/browser-extension-wallet/src/features/delegation/components/MultiDelegationStakingPopup.tsx b/apps/browser-extension-wallet/src/features/delegation/components/MultiDelegationStakingPopup.tsx index fad43c4b3..fdf8e7a83 100644 --- a/apps/browser-extension-wallet/src/features/delegation/components/MultiDelegationStakingPopup.tsx +++ b/apps/browser-extension-wallet/src/features/delegation/components/MultiDelegationStakingPopup.tsx @@ -111,7 +111,8 @@ export const MultiDelegationStakingPopup = (): JSX.Element => { setMultidelegationFirstVisit(false); setMultidelegationFirstVisitSincePortfolioPersistence(false); }, - expandStakingView: () => handleOpenBrowser({ section: BrowserViewSections.STAKING }), + expandStakingView: (urlSearchParams?: string) => + handleOpenBrowser({ section: BrowserViewSections.STAKING, urlSearchParams }), balancesBalance: balance, delegationStoreSetDelegationTxBuilder: setDelegationTxBuilder, delegationStoreDelegationTxBuilder: delegationTxBuilder, diff --git a/apps/browser-extension-wallet/src/lib/scripts/background/services/utilityServices.ts b/apps/browser-extension-wallet/src/lib/scripts/background/services/utilityServices.ts index ad000621e..608903eb4 100644 --- a/apps/browser-extension-wallet/src/lib/scripts/background/services/utilityServices.ts +++ b/apps/browser-extension-wallet/src/lib/scripts/background/services/utilityServices.ts @@ -43,6 +43,7 @@ interface TokenAPIResponse { const migrationState$ = new BehaviorSubject(undefined); +// eslint-disable-next-line complexity const handleOpenBrowser = async (data: OpenBrowserData) => { let path = ''; switch (data.section) { @@ -79,7 +80,8 @@ const handleOpenBrowser = async (data: OpenBrowserData) => { path = walletRoutePaths.sharedWallet.root; break; } - await tabs.create({ url: `app.html#${path}` }).catch((error) => console.error(error)); + const params = data.urlSearchParams ? `?${data.urlSearchParams}` : ''; + await tabs.create({ url: `app.html#${path}${params}` }).catch((error) => console.error(error)); }; const handleChangeTheme = (data: ChangeThemeData) => requestMessage$.next({ type: MessageTypes.CHANGE_THEME, data }); diff --git a/apps/browser-extension-wallet/src/lib/scripts/types/background-service.ts b/apps/browser-extension-wallet/src/lib/scripts/types/background-service.ts index cdfa2b0dd..5aaf8180f 100644 --- a/apps/browser-extension-wallet/src/lib/scripts/types/background-service.ts +++ b/apps/browser-extension-wallet/src/lib/scripts/types/background-service.ts @@ -39,6 +39,7 @@ export enum BrowserViewSections { export interface OpenBrowserData { section: BrowserViewSections; + urlSearchParams?: string; } interface ChangeThemeMessage { @@ -56,7 +57,7 @@ interface OpenBrowserMessage { export type Message = ChangeThemeMessage | HTTPConnectionMessage | OpenBrowserMessage; export type BackgroundService = { - handleOpenBrowser: (data: OpenBrowserData) => Promise; + handleOpenBrowser: (data: OpenBrowserData, urlSearchParams?: string) => Promise; requestMessage$: Subject; migrationState$: BehaviorSubject; coinPrices: CoinPrices; diff --git a/packages/staking/src/features/outside-handles-provider/types.ts b/packages/staking/src/features/outside-handles-provider/types.ts index f6c82d0f3..f61f0bda0 100644 --- a/packages/staking/src/features/outside-handles-provider/types.ts +++ b/packages/staking/src/features/outside-handles-provider/types.ts @@ -62,7 +62,7 @@ export type OutsideHandlesContextValue = { stakingBrowserPreferencesPersistence: StakingBrowserPreferences; setStakingBrowserPreferencesPersistence: (preferences: StakingBrowserPreferences) => void; walletManagerExecuteWithPassword: (action: () => Promise, password?: string) => Promise; - expandStakingView?: () => void; + expandStakingView?: (urlSearchParams?: string) => void; balancesBalance?: Balance; delegationStoreSetDelegationTxBuilder: (txBuilder?: TxBuilder) => void; delegationStoreSetDelegationTxFee: (fee?: string) => void; diff --git a/packages/staking/src/features/overview/ExpandViewBanner.tsx b/packages/staking/src/features/overview/ExpandViewBanner.tsx index b8b36209e..21d26b8c4 100644 --- a/packages/staking/src/features/overview/ExpandViewBanner.tsx +++ b/packages/staking/src/features/overview/ExpandViewBanner.tsx @@ -8,7 +8,7 @@ import styles from './ExpandViewBanner.module.scss'; export const ExpandViewBanner = (): React.ReactElement => { const { t } = useTranslation(); - const { expandStakingView } = useOutsideHandles(); + const { expandStakingView = () => void 0 } = useOutsideHandles(); return (
@@ -20,7 +20,7 @@ export const ExpandViewBanner = (): React.ReactElement => { {t('popup.expandBanner.description')}