Skip to content

Commit 03db5db

Browse files
authored
Merge branch 'main' into fix/perps/refresh-colors
2 parents 7f6e2cf + 55f232b commit 03db5db

File tree

196 files changed

+9054
-2119
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

196 files changed

+9054
-2119
lines changed

app/components/Nav/App/App.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ import FundActionMenu from '../../UI/FundActionMenu';
7272
import NetworkSelector from '../../../components/Views/NetworkSelector';
7373
import ReturnToAppNotification from '../../Views/ReturnToAppNotification';
7474
import EditAccountName from '../../Views/EditAccountName/EditAccountName';
75+
import CardNotification from '../../Views/CardNotification';
7576
import LegacyEditMultichainAccountName from '../../Views/MultichainAccounts/sheets/EditAccountName';
7677
import { EditMultichainAccountName } from '../../Views/MultichainAccounts/sheets/EditMultichainAccountName';
7778
import { PPOMView } from '../../../lib/ppom/PPOMView';
@@ -573,6 +574,10 @@ const RootModalFlow = (props: RootModalFlowProps) => (
573574
component={ReturnToAppNotification}
574575
initialParams={{ ...props.route.params }}
575576
/>
577+
<Stack.Screen
578+
name={Routes.CARD.NOTIFICATION}
579+
component={CardNotification}
580+
/>
576581
</Stack.Navigator>
577582
);
578583

app/components/UI/AssetOverview/AssetOverview.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ import { isNonEvmChainId } from '../../../core/Multichain/utils';
9797
import { selectTronResourcesBySelectedAccountGroup } from '../../../selectors/assets/assets-list';
9898
import { createStakedTrxAsset } from './utils/createStakedTrxAsset';
9999
///: END:ONLY_INCLUDE_IF
100+
import { getDetectedGeolocation } from '../../../reducers/fiatOrders';
100101

101102
interface AssetOverviewProps {
102103
asset: TokenI;
@@ -146,6 +147,8 @@ const AssetOverview: React.FC<AssetOverviewProps> = ({
146147
const tokenResult = useSelector((state: RootState) =>
147148
selectTokenDisplayData(state, asset.chainId as Hex, asset.address as Hex),
148149
);
150+
151+
const rampGeodetectedRegion = useSelector(getDetectedGeolocation);
149152
///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps)
150153
const multichainAssetsRates = useSelector(selectMultichainAssetsRates);
151154

@@ -346,6 +349,7 @@ const AssetOverview: React.FC<AssetOverviewProps> = ({
346349
text: 'Buy',
347350
location: 'TokenDetails',
348351
chain_id_destination: getDecimalChainId(chainId),
352+
region: rampGeodetectedRegion,
349353
})
350354
.build(),
351355
);

app/components/UI/BalanceEmptyState/BalanceEmptyState.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { trace, TraceName } from '../../../util/trace';
2424
import { createBuyNavigationDetails } from '../Ramp/Aggregator/routes/utils';
2525
import { BalanceEmptyStateProps } from './BalanceEmptyState.types';
2626
import bankTransferImage from '../../../images/bank-transfer.png';
27+
import { getDetectedGeolocation } from '../../../reducers/fiatOrders';
2728

2829
/**
2930
* BalanceEmptyState smart component displays an empty state for wallet balance
@@ -37,6 +38,7 @@ const BalanceEmptyState: React.FC<BalanceEmptyStateProps> = ({
3738
const chainId = useSelector(selectChainId);
3839
const navigation = useNavigation();
3940
const { trackEvent, createEventBuilder } = useMetrics();
41+
const rampGeodetectedRegion = useSelector(getDetectedGeolocation);
4042

4143
const handleAction = () => {
4244
navigation.navigate(...createBuyNavigationDetails());
@@ -52,6 +54,7 @@ const BalanceEmptyState: React.FC<BalanceEmptyStateProps> = ({
5254
location: 'BalanceEmptyState',
5355
chain_id_destination: getDecimalChainId(chainId),
5456
ramp_type: 'BUY',
57+
region: rampGeodetectedRegion,
5558
})
5659
.build(),
5760
);

app/components/UI/Card/components/AddFundsBottomSheet/AddFundsBottomSheet.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { useCallback } from 'react';
2+
import { useSelector } from 'react-redux';
23
import { NavigationProp, ParamListBase } from '@react-navigation/native';
34
import BottomSheet, {
45
BottomSheetRef,
@@ -32,6 +33,7 @@ import { strings } from '../../../../../../locales/i18n';
3233
import { CardHomeSelectors } from '../../../../../../e2e/selectors/Card/CardHome.selectors';
3334
import { createDepositNavigationDetails } from '../../../Ramp/Deposit/routes/utils';
3435
import { safeFormatChainIdToHex } from '../../util/safeFormatChainIdToHex';
36+
import { getDetectedGeolocation } from '../../../../../reducers/fiatOrders';
3537

3638
export interface AddFundsBottomSheetProps {
3739
setOpenAddFundsBottomSheet: (open: boolean) => void;
@@ -53,6 +55,7 @@ const AddFundsBottomSheet: React.FC<AddFundsBottomSheetProps> = ({
5355
priorityToken,
5456
});
5557
const { trackEvent, createEventBuilder } = useMetrics();
58+
const rampGeodetectedRegion = useSelector(getDetectedGeolocation);
5659

5760
const closeBottomSheetAndNavigate = useCallback(
5861
(navigateFunc: () => void) => {
@@ -85,6 +88,7 @@ const AddFundsBottomSheet: React.FC<AddFundsBottomSheetProps> = ({
8588
location: 'CardHome',
8689
chain_id_destination: getDecimalChainId(priorityToken?.caipChainId),
8790
ramp_type: 'DEPOSIT',
91+
region: rampGeodetectedRegion,
8892
})
8993
.build(),
9094
);
@@ -93,6 +97,7 @@ const AddFundsBottomSheet: React.FC<AddFundsBottomSheetProps> = ({
9397
name: TraceName.LoadDepositExperience,
9498
});
9599
}, [
100+
rampGeodetectedRegion,
96101
closeBottomSheetAndNavigate,
97102
navigate,
98103
trackEvent,

app/components/UI/Card/components/Onboarding/OnboardingStep.test.tsx

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { render, screen } from '@testing-library/react-native';
2+
import { render } from '@testing-library/react-native';
33
import { Text, View, TouchableOpacity, Image } from 'react-native';
44
import OnboardingStep from './OnboardingStep';
55

@@ -61,25 +61,6 @@ jest.mock('@metamask/design-system-react-native', () => {
6161
};
6262
});
6363

64-
// Mock react-native-safe-area-context
65-
jest.mock('react-native-safe-area-context', () => ({
66-
SafeAreaView: ({
67-
children,
68-
...props
69-
}: {
70-
children: React.ReactNode;
71-
[key: string]: unknown;
72-
}) => {
73-
const ReactActual = jest.requireActual('react');
74-
const { View } = jest.requireActual('react-native');
75-
return ReactActual.createElement(
76-
View,
77-
{ testID: 'safe-area-view', ...props },
78-
children,
79-
);
80-
},
81-
}));
82-
8364
// Mock the FOX logo image
8465
jest.mock('../../../../../images/branding/fox.png', () => 'fox-logo');
8566

@@ -96,12 +77,6 @@ describe('OnboardingStep Component', () => {
9677
});
9778

9879
describe('Component Rendering', () => {
99-
it('renders without crashing with required props', () => {
100-
render(<OnboardingStep {...defaultProps} />);
101-
102-
expect(screen.getByTestId('safe-area-view')).toBeDefined();
103-
});
104-
10580
it('renders with all required props provided', () => {
10681
const { getByText } = render(<OnboardingStep {...defaultProps} />);
10782

@@ -284,22 +259,12 @@ describe('OnboardingStep Component', () => {
284259
});
285260

286261
describe('Layout Structure', () => {
287-
it('renders with proper container structure', () => {
288-
const { getByTestId } = render(<OnboardingStep {...defaultProps} />);
289-
290-
// Verify SafeAreaView is rendered with correct props
291-
const safeAreaView = getByTestId('safe-area-view');
292-
expect(safeAreaView).toBeDefined();
293-
expect(safeAreaView.props.edges).toEqual(['bottom']);
294-
});
295-
296262
it('maintains proper component hierarchy', () => {
297263
const { getByText, getByTestId } = render(
298264
<OnboardingStep {...defaultProps} />,
299265
);
300266

301267
// Verify all main elements are present in the component tree
302-
expect(getByTestId('safe-area-view')).toBeDefined();
303268
expect(getByText('Test Title')).toBeDefined();
304269
expect(getByText('Test Description')).toBeDefined();
305270
expect(getByTestId('test-form-fields')).toBeDefined();

app/components/UI/Card/components/Onboarding/OnboardingStep.tsx

Lines changed: 43 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
import React from 'react';
2-
import {
3-
KeyboardAvoidingView,
4-
Platform,
5-
ScrollView,
6-
Image,
7-
} from 'react-native';
8-
import { SafeAreaView } from 'react-native-safe-area-context';
2+
import { Image } from 'react-native';
93
import { useTailwind } from '@metamask/design-system-twrnc-preset';
104
import { Box, Text, TextVariant } from '@metamask/design-system-react-native';
115
import MM_CARD_MOCKUP from '../../../../../images/mm-card-mockup.png';
6+
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
127

138
interface OnboardingStepProps {
149
title: string;
@@ -26,57 +21,50 @@ const OnboardingStep = ({
2621
const tw = useTailwind();
2722

2823
return (
29-
<KeyboardAvoidingView
30-
style={tw.style('flex-1')}
31-
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
24+
<KeyboardAwareScrollView
25+
contentContainerStyle={tw.style('flex-grow p-4')}
26+
showsVerticalScrollIndicator={false}
27+
alwaysBounceVertical={false}
3228
>
33-
<SafeAreaView style={tw.style('flex-1')} edges={['bottom']}>
34-
<ScrollView
35-
contentContainerStyle={tw.style('flex-grow px-4 pt-6 pb-6')}
36-
showsVerticalScrollIndicator={false}
37-
alwaysBounceVertical={false}
38-
>
39-
<Box twClassName="flex-1 items-stretch gap-4">
40-
{/* Card Mockup Image */}
41-
<Box twClassName="items-center">
42-
<Image
43-
source={MM_CARD_MOCKUP}
44-
style={tw.style('w-full h-52')}
45-
resizeMode="contain"
46-
/>
47-
</Box>
48-
<Box twClassName="gap-2">
49-
{/* Title */}
50-
<Text
51-
variant={TextVariant.HeadingMd}
52-
testID="onboarding-step-title"
53-
twClassName="text-center text-default"
54-
>
55-
{title}
56-
</Text>
29+
<Box twClassName="flex-1 items-stretch gap-4 mb-6">
30+
{/* Card Mockup Image */}
31+
<Box twClassName="items-center">
32+
<Image
33+
source={MM_CARD_MOCKUP}
34+
style={tw.style('w-full h-52')}
35+
resizeMode="contain"
36+
/>
37+
</Box>
38+
<Box twClassName="gap-2">
39+
{/* Title */}
40+
<Text
41+
variant={TextVariant.HeadingMd}
42+
testID="onboarding-step-title"
43+
twClassName="text-center text-default"
44+
>
45+
{title}
46+
</Text>
5747

58-
{/* Description */}
59-
<Text
60-
variant={TextVariant.BodyMd}
61-
testID="onboarding-step-description"
62-
twClassName="text-center"
63-
>
64-
{description}
65-
</Text>
66-
</Box>
67-
{/* Form */}
68-
<Box testID="onboarding-step-form" twClassName="gap-4 flex-1">
69-
{formFields}
70-
</Box>
48+
{/* Description */}
49+
<Text
50+
variant={TextVariant.BodyMd}
51+
testID="onboarding-step-description"
52+
twClassName="text-center"
53+
>
54+
{description}
55+
</Text>
56+
</Box>
57+
{/* Form */}
58+
<Box testID="onboarding-step-form" twClassName="gap-4 flex-1">
59+
{formFields}
60+
</Box>
7161

72-
{/* Actions */}
73-
<Box testID="onboarding-step-actions" twClassName="mt-2">
74-
{actions}
75-
</Box>
76-
</Box>
77-
</ScrollView>
78-
</SafeAreaView>
79-
</KeyboardAvoidingView>
62+
{/* Actions */}
63+
<Box testID="onboarding-step-actions" twClassName="mt-2">
64+
{actions}
65+
</Box>
66+
</Box>
67+
</KeyboardAwareScrollView>
8068
);
8169
};
8270

app/components/UI/Card/components/Onboarding/PhysicalAddress.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,6 @@ const PhysicalAddress = () => {
633633
{strings(
634634
'card.card_onboarding.physical_address.privacy_policy_1',
635635
)}
636-
637636
<Text
638637
variant={TextVariant.BodyMd}
639638
twClassName="text-primary-default underline"
@@ -642,10 +641,6 @@ const PhysicalAddress = () => {
642641
'card.card_onboarding.physical_address.privacy_policy_2',
643642
)}
644643
</Text>
645-
646-
{strings(
647-
'card.card_onboarding.physical_address.privacy_policy_3',
648-
)}
649644
</Text>
650645
</TouchableOpacity>
651646
}

app/components/UI/Card/components/Onboarding/SetPhoneNumber.tsx

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,14 @@ const SetPhoneNumber = () => {
3939
if (!registrationSettings?.countries) {
4040
return [];
4141
}
42-
43-
const uniqueCallingCodes = new Map();
44-
45-
registrationSettings.countries
42+
return [...registrationSettings.countries]
43+
.sort((a, b) => a.name.localeCompare(b.name))
4644
.filter((country) => country.canSignUp)
47-
.forEach((country) => {
48-
const callingCode = country.callingCode;
49-
if (!uniqueCallingCodes.has(callingCode)) {
50-
uniqueCallingCodes.set(callingCode, {
51-
key: country.iso3166alpha2,
52-
value: callingCode,
53-
label: `+${callingCode}`,
54-
});
55-
}
56-
});
57-
58-
// Convert Map values to array and sort
59-
return Array.from(uniqueCallingCodes.values()).sort((a, b) =>
60-
a.value.localeCompare(b.value),
61-
);
45+
.map((country) => ({
46+
key: country.iso3166alpha2,
47+
value: country.callingCode,
48+
label: `+${country.callingCode} ${country.name}`,
49+
}));
6250
}, [registrationSettings]);
6351

6452
const initialSelectedCountryAreaCode = useMemo(() => {

app/components/UI/CollectibleModal/CollectibleModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const CollectibleModal = () => {
7272

7373
useEffect(() => {
7474
trackEvent(
75-
createEventBuilder(MetaMetricsEvents.COLLECTIBLE_DETAILS_OPENED)
75+
createEventBuilder(MetaMetricsEvents.NFT_DETAILS_OPENED)
7676
.addProperties({ chain_id: getDecimalChainId(chainId) })
7777
.build(),
7878
);

0 commit comments

Comments
 (0)