diff --git a/app/components/UI/Bridge/hooks/useRewards/useRewards.test.ts b/app/components/UI/Bridge/hooks/useRewards/useRewards.test.ts index 7a9b0536e75..da8bc2d0e20 100644 --- a/app/components/UI/Bridge/hooks/useRewards/useRewards.test.ts +++ b/app/components/UI/Bridge/hooks/useRewards/useRewards.test.ts @@ -197,10 +197,10 @@ describe('useRewards', () => { mockUnsubscribe.mockClear(); }); - describe('when rewards feature is disabled', () => { - it('should return default state when rewards feature is disabled', async () => { + describe('when there is no active season', () => { + it('should return default state when there is no active season', async () => { mockCall.mockImplementation((method) => { - if (method === 'RewardsController:isRewardsFeatureEnabled') { + if (method === 'RewardsController:hasActiveSeason') { return Promise.resolve(false); } return Promise.resolve(null); @@ -235,7 +235,7 @@ describe('useRewards', () => { }); expect(mockCall).toHaveBeenCalledWith( - 'RewardsController:isRewardsFeatureEnabled', + 'RewardsController:hasActiveSeason', ); }); }); @@ -243,7 +243,7 @@ describe('useRewards', () => { describe('when user has not opted in', () => { it('should return default state when user has not opted in and opt-in is not supported', async () => { mockCall.mockImplementation((method) => { - if (method === 'RewardsController:isRewardsFeatureEnabled') { + if (method === 'RewardsController:hasActiveSeason') { return Promise.resolve(true); } if (method === 'RewardsController:getCandidateSubscriptionId') { @@ -301,7 +301,7 @@ describe('useRewards', () => { it('should show rewards row when user has not opted in but opt-in is supported', async () => { mockCall.mockImplementation((method) => { - if (method === 'RewardsController:isRewardsFeatureEnabled') { + if (method === 'RewardsController:hasActiveSeason') { return Promise.resolve(true); } if (method === 'RewardsController:getCandidateSubscriptionId') { @@ -361,7 +361,7 @@ describe('useRewards', () => { describe('when rewards estimation is successful', () => { it('should return estimated points when all conditions are met', async () => { mockCall.mockImplementation((method) => { - if (method === 'RewardsController:isRewardsFeatureEnabled') { + if (method === 'RewardsController:hasActiveSeason') { return Promise.resolve(true); } if (method === 'RewardsController:getCandidateSubscriptionId') { @@ -432,7 +432,7 @@ describe('useRewards', () => { it('should handle source token without exchange rate', async () => { mockCall.mockImplementation((method) => { - if (method === 'RewardsController:isRewardsFeatureEnabled') { + if (method === 'RewardsController:hasActiveSeason') { return Promise.resolve(true); } if (method === 'RewardsController:getCandidateSubscriptionId') { @@ -603,7 +603,7 @@ describe('useRewards', () => { describe('when subscription ID is missing', () => { it('should return default state when there is no subscription', async () => { mockCall.mockImplementation((method) => { - if (method === 'RewardsController:isRewardsFeatureEnabled') { + if (method === 'RewardsController:hasActiveSeason') { return Promise.resolve(true); } if (method === 'RewardsController:getCandidateSubscriptionId') { @@ -641,7 +641,7 @@ describe('useRewards', () => { }); expect(mockCall).toHaveBeenCalledWith( - 'RewardsController:isRewardsFeatureEnabled', + 'RewardsController:hasActiveSeason', ); expect(mockCall).toHaveBeenCalledWith( 'RewardsController:getCandidateSubscriptionId', @@ -656,7 +656,7 @@ describe('useRewards', () => { describe('error handling', () => { it('should handle rewards estimation error gracefully', async () => { mockCall.mockImplementation((method) => { - if (method === 'RewardsController:isRewardsFeatureEnabled') { + if (method === 'RewardsController:hasActiveSeason') { return Promise.resolve(true); } if (method === 'RewardsController:getCandidateSubscriptionId') { @@ -700,10 +700,10 @@ describe('useRewards', () => { }); }); - it('should set hasError to true when isRewardsFeatureEnabled throws an error', async () => { + it('should set hasError to true when hasActiveSeason throws an error', async () => { mockCall.mockImplementation((method) => { - if (method === 'RewardsController:isRewardsFeatureEnabled') { - throw new Error('Feature check failed'); + if (method === 'RewardsController:hasActiveSeason') { + throw new Error('Active season check failed'); } return Promise.resolve(null); }); @@ -739,7 +739,7 @@ describe('useRewards', () => { it('should set hasError to true when getHasAccountOptedIn throws an error', async () => { mockCall.mockImplementation((method) => { - if (method === 'RewardsController:isRewardsFeatureEnabled') { + if (method === 'RewardsController:hasActiveSeason') { return Promise.resolve(true); } if (method === 'RewardsController:getCandidateSubscriptionId') { @@ -783,7 +783,7 @@ describe('useRewards', () => { it('should reset hasError to false when estimation succeeds after previous error', async () => { // First mock returns error mockCall.mockImplementationOnce((method) => { - if (method === 'RewardsController:isRewardsFeatureEnabled') { + if (method === 'RewardsController:hasActiveSeason') { return Promise.resolve(true); } if (method === 'RewardsController:getCandidateSubscriptionId') { @@ -822,7 +822,7 @@ describe('useRewards', () => { // Now mock successful response mockCall.mockImplementation((method) => { - if (method === 'RewardsController:isRewardsFeatureEnabled') { + if (method === 'RewardsController:hasActiveSeason') { return Promise.resolve(true); } if (method === 'RewardsController:getCandidateSubscriptionId') { diff --git a/app/components/UI/Bridge/hooks/useRewards/useRewards.ts b/app/components/UI/Bridge/hooks/useRewards/useRewards.ts index d0300dff234..73a0ed0bc1d 100644 --- a/app/components/UI/Bridge/hooks/useRewards/useRewards.ts +++ b/app/components/UI/Bridge/hooks/useRewards/useRewards.ts @@ -140,12 +140,12 @@ export const useRewards = ({ setHasError(false); try { - // Check if rewards feature is enabled - const isRewardsEnabled = await Engine.controllerMessenger.call( - 'RewardsController:isRewardsFeatureEnabled', + // Check if there is an active season + const hasActiveSeason = await Engine.controllerMessenger.call( + 'RewardsController:hasActiveSeason', ); - if (!isRewardsEnabled) { + if (!hasActiveSeason) { setEstimatedPoints(null); setShouldShowRewardsRow(false); setAccountOptedIn(null); diff --git a/app/components/UI/Perps/Views/PerpsTransactionsView/PerpsTransactionsView.tsx b/app/components/UI/Perps/Views/PerpsTransactionsView/PerpsTransactionsView.tsx index b4fa29dec3f..e81c6dda770 100644 --- a/app/components/UI/Perps/Views/PerpsTransactionsView/PerpsTransactionsView.tsx +++ b/app/components/UI/Perps/Views/PerpsTransactionsView/PerpsTransactionsView.tsx @@ -36,10 +36,8 @@ import { formatDateSection } from '../../utils/formatUtils'; import { styleSheet } from './PerpsTransactionsView.styles'; import { usePerpsMeasurement } from '../../hooks/usePerpsMeasurement'; import { TraceName } from '../../../../../util/trace'; -import Button, { - ButtonSize, - ButtonVariants, -} from '../../../../../component-library/components/Buttons/Button'; +import ButtonFilter from '../../../../../component-library/components-temp/ButtonFilter'; +import { ButtonSize } from '@metamask/design-system-react-native'; const PerpsTransactionsView: React.FC = () => { const { styles } = useStyles(styleSheet, {}); @@ -225,14 +223,15 @@ const PerpsTransactionsView: React.FC = () => { }; return ( -