Skip to content

Commit 1c00889

Browse files
authored
Merge branch 'main' into jc/WAPI-1369
2 parents b52251e + 09f76fa commit 1c00889

File tree

41 files changed

+2496
-318
lines changed

Some content is hidden

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

41 files changed

+2496
-318
lines changed

.github/workflows/security-code-scanner.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
paths_ignored: |
2525
tests/
2626
docs/
27+
scripts/money-movement/debug-dashboard/
2728
.storybook/
2829
'**/*.test.js'
2930
'**/*.test.ts'

.js.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ export METAMASK_ENVIRONMENT="dev"
5454
# Build type: "main" or "flask" or "beta"
5555
export METAMASK_BUILD_TYPE="main"
5656

57+
# Optional: enable Ramps debug dashboard bridge in __DEV__ (WebSocket + fetch instrumentation).
58+
# See app/components/UI/Ramp/debug/README.md
59+
# export RAMPS_DEBUG_DASHBOARD="true"
60+
5761
# Segment SDK proxy endpoint and write key
5862
export SEGMENT_WRITE_KEY_DEV=""
5963
export SEGMENT_PROXY_URL_DEV=""

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [7.71.1]
11+
12+
### Changed
13+
14+
- Pointed Market Insights digest fallback URL at the production endpoint when `DIGEST_API_URL` is not set at build time (#28098)
15+
1016
## [7.71.0]
1117

1218
### Added
@@ -11072,7 +11078,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1107211078
- [#957](https://github.com/MetaMask/metamask-mobile/pull/957): fix timeouts (#957)
1107311079
- [#954](https://github.com/MetaMask/metamask-mobile/pull/954): Bugfix: onboarding navigation (#954)
1107411080

11075-
[Unreleased]: https://github.com/MetaMask/metamask-mobile/compare/v7.71.0...HEAD
11081+
[Unreleased]: https://github.com/MetaMask/metamask-mobile/compare/v7.71.1...HEAD
11082+
[7.71.1]: https://github.com/MetaMask/metamask-mobile/compare/v7.71.0...v7.71.1
1107611083
[7.71.0]: https://github.com/MetaMask/metamask-mobile/compare/v7.70.1...v7.71.0
1107711084
[7.70.1]: https://github.com/MetaMask/metamask-mobile/compare/v7.70.0...v7.70.1
1107811085
[7.70.0]: https://github.com/MetaMask/metamask-mobile/compare/v7.69.1...v7.70.0

app/components/UI/BackupAlert/BackupAlert.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import Icon, {
2121
import Text, {
2222
TextVariant,
2323
} from '../../../component-library/components/Texts/Text';
24-
import { useMetrics } from '../../../components/hooks/useMetrics';
24+
import { useAnalytics } from '../../../components/hooks/useAnalytics/useAnalytics';
2525
import Routes from '../../../constants/navigation/Routes';
2626
import { selectSeedlessOnboardingLoginFlow } from '../../../selectors/seedlessOnboardingController';
2727
import { RootState } from '../../../reducers';
@@ -44,7 +44,7 @@ const BLOCKED_LIST = [
4444

4545
const BackupAlert = ({ navigation, onDismiss }: BackupAlertI) => {
4646
const { styles } = useStyles(styleSheet, {});
47-
const { trackEvent, createEventBuilder } = useMetrics();
47+
const { trackEvent, createEventBuilder } = useAnalytics();
4848
const [inBrowserView, setInBrowserView] = useState(false);
4949
const [inBlockedView, setInBlockedView] = useState(false);
5050
const [isVisible, setIsVisible] = useState(true);

app/components/UI/BalanceEmptyState/BalanceEmptyState.test.tsx

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import { backgroundState } from '../../../util/test/initial-root-state';
55
import BalanceEmptyState from './BalanceEmptyState';
66
import { BalanceEmptyStateProps } from './BalanceEmptyState.types';
77
import { RampsButtonClickData } from '../Ramp/hooks/useRampsButtonClickData';
8-
import { useMetrics } from '../../hooks/useMetrics';
8+
import { useAnalytics } from '../../hooks/useAnalytics/useAnalytics';
9+
import { createMockUseAnalyticsHook } from '../../../util/test/analyticsMock';
10+
import { MetaMetricsEvents } from '../../../core/Analytics';
911

1012
// Mock useRampNavigation hook
1113
const mockGoToBuy = jest.fn();
@@ -39,12 +41,7 @@ const mockEventBuilder = {
3941
build: jest.fn().mockReturnValue({ event: 'built' }),
4042
};
4143

42-
jest.mock('../../hooks/useMetrics', () => ({
43-
useMetrics: jest.fn(),
44-
MetaMetricsEvents: {
45-
RAMPS_BUTTON_CLICKED: 'ramps_button_clicked',
46-
},
47-
}));
44+
jest.mock('../../hooks/useAnalytics/useAnalytics');
4845

4946
jest.mock('../../../util/networks', () => ({
5047
getDecimalChainId: jest.fn(() => 1),
@@ -54,10 +51,12 @@ describe('BalanceEmptyState', () => {
5451
beforeEach(() => {
5552
jest.clearAllMocks();
5653
mockCreateEventBuilder.mockReturnValue(mockEventBuilder);
57-
(useMetrics as jest.Mock).mockReturnValue({
58-
trackEvent: mockTrackEvent,
59-
createEventBuilder: mockCreateEventBuilder,
60-
});
54+
jest.mocked(useAnalytics).mockReturnValue(
55+
createMockUseAnalyticsHook({
56+
trackEvent: mockTrackEvent,
57+
createEventBuilder: mockCreateEventBuilder,
58+
}),
59+
);
6160
mockUseRampsUnifiedV1Enabled.mockReturnValue(false);
6261
});
6362

@@ -103,7 +102,9 @@ describe('BalanceEmptyState', () => {
103102

104103
fireEvent.press(actionButton);
105104

106-
expect(mockCreateEventBuilder).toHaveBeenCalledWith('ramps_button_clicked');
105+
expect(mockCreateEventBuilder).toHaveBeenCalledWith(
106+
MetaMetricsEvents.RAMPS_BUTTON_CLICKED,
107+
);
107108
expect(mockEventBuilder.addProperties).toHaveBeenCalledWith(
108109
expect.objectContaining({
109110
button_text: 'Add funds',
@@ -126,7 +127,9 @@ describe('BalanceEmptyState', () => {
126127

127128
fireEvent.press(actionButton);
128129

129-
expect(mockCreateEventBuilder).toHaveBeenCalledWith('ramps_button_clicked');
130+
expect(mockCreateEventBuilder).toHaveBeenCalledWith(
131+
MetaMetricsEvents.RAMPS_BUTTON_CLICKED,
132+
);
130133
expect(mockEventBuilder.addProperties).toHaveBeenCalledWith(
131134
expect.objectContaining({
132135
button_text: 'Add funds',

app/components/UI/BalanceEmptyState/BalanceEmptyState.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ import {
1616
} from '@metamask/design-system-react-native';
1717
import { useTailwind } from '@metamask/design-system-twrnc-preset';
1818
import { strings } from '../../../../locales/i18n';
19-
import { MetaMetricsEvents, useMetrics } from '../../hooks/useMetrics';
19+
import { MetaMetricsEvents } from '../../../core/Analytics';
20+
import { useAnalytics } from '../../hooks/useAnalytics/useAnalytics';
2021
import { getDecimalChainId } from '../../../util/networks';
2122
import { selectChainId } from '../../../selectors/networkController';
2223
import { trace, TraceName } from '../../../util/trace';
@@ -38,7 +39,7 @@ const BalanceEmptyState: React.FC<BalanceEmptyStateProps> = ({
3839
}) => {
3940
const tw = useTailwind();
4041
const chainId = useSelector(selectChainId);
41-
const { trackEvent, createEventBuilder } = useMetrics();
42+
const { trackEvent, createEventBuilder } = useAnalytics();
4243
const rampGeodetectedRegion = useSelector(getDetectedGeolocation);
4344
const { goToBuy } = useRampNavigation();
4445
const buttonClickData = useRampsButtonClickData();

app/components/UI/Carousel/index.test.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import Routes from '../../../constants/navigation/Routes';
2323
import { WalletClientType } from '../../../core/SnapKeyring/MultichainWalletSnapClient';
2424
import { SolScope } from '@metamask/keyring-api';
2525
import { setContentPreviewToken } from '../../../actions/notification/helpers';
26+
import { createMockUseAnalyticsHook } from '../../../util/test/analyticsMock';
27+
import { useAnalytics } from '../../../components/hooks/useAnalytics/useAnalytics';
2628

2729
const makeMockState = () =>
2830
({
@@ -60,16 +62,7 @@ jest.mock('../../../core/Engine', () => ({
6062
context: { PreferencesController: { state: {} } },
6163
}));
6264

63-
const mockTrackEvent = jest.fn();
64-
const mockCreateEventBuilder = jest.fn(() => ({
65-
build: () => ({ category: 'Banner Display', properties: {} }),
66-
}));
67-
jest.mock('../../../components/hooks/useMetrics', () => ({
68-
useMetrics: () => ({
69-
trackEvent: mockTrackEvent,
70-
createEventBuilder: mockCreateEventBuilder,
71-
}),
72-
}));
65+
jest.mock('../../../components/hooks/useAnalytics/useAnalytics');
7366

7467
jest.mock('../../../core/DeeplinkManager/DeeplinkManager', () => {
7568
const mockParse = jest.fn().mockResolvedValue(true);
@@ -119,6 +112,7 @@ const mockReduxHooks = (state?: RootState) => {
119112

120113
beforeEach(() => {
121114
jest.clearAllMocks();
115+
jest.mocked(useAnalytics).mockReturnValue(createMockUseAnalyticsHook());
122116
mockReduxHooks();
123117
jest
124118
.spyOn(FeatureFlagSelectorsModule, 'selectContentfulCarouselEnabledFlag')

app/components/UI/Carousel/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
TextColor,
2222
} from '@metamask/design-system-react-native';
2323
import { useTailwind } from '@metamask/design-system-twrnc-preset';
24-
import { useMetrics } from '../../../components/hooks/useMetrics';
24+
import { useAnalytics } from '../../../components/hooks/useAnalytics/useAnalytics';
2525
import { WalletViewSelectorsIDs } from '../../Views/Wallet/WalletView.testIds';
2626
import { selectDismissedBanners } from '../../../selectors/banner';
2727
///: BEGIN:ONLY_INCLUDE_IF(solana)
@@ -170,7 +170,7 @@ const CarouselComponent: FC<CarouselProps> = ({ style, onEmptyState }) => {
170170
carouselScaleY,
171171
});
172172

173-
const { trackEvent, createEventBuilder } = useMetrics();
173+
const { trackEvent, createEventBuilder } = useAnalytics();
174174
const hasBalance = useSelector(selectAddressHasTokenBalances);
175175
const dispatch = useDispatch();
176176
const { navigate } = useNavigation();

app/components/UI/OTAUpdatesModal/OTAUpdatesModal.test.tsx

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import { reloadAsync } from 'expo-updates';
55
import Logger from '../../../util/Logger';
66
import { MetaMetricsEvents } from '../../../core/Analytics';
77
import renderWithProvider from '../../../util/test/renderWithProvider';
8+
import { useAnalytics } from '../../hooks/useAnalytics/useAnalytics';
9+
import { createMockUseAnalyticsHook } from '../../../util/test/analyticsMock';
10+
import { AnalyticsEventBuilder } from '../../../util/analytics/AnalyticsEventBuilder';
811

912
// Mock theme utility
1013
jest.mock('../../../util/theme', () => ({
@@ -107,38 +110,22 @@ const mockLoggerError = Logger.error as jest.MockedFunction<
107110
typeof Logger.error
108111
>;
109112

110-
interface MockEventBuilder {
111-
addProperties: jest.Mock;
112-
build: jest.Mock;
113-
}
114-
115-
const mockCreateEventBuilder = jest.fn((event: string): MockEventBuilder => {
116-
const builder: MockEventBuilder = {
117-
addProperties: jest.fn(),
118-
build: jest.fn(),
119-
};
120-
121-
builder.addProperties.mockReturnValue(builder);
122-
builder.build.mockReturnValue({ event });
123-
124-
return builder;
125-
});
126-
127113
const mockTrackEvent = jest.fn();
128114

129-
jest.mock('../../hooks/useMetrics', () => ({
130-
useMetrics: () => ({
131-
trackEvent: mockTrackEvent,
132-
createEventBuilder: mockCreateEventBuilder,
133-
}),
134-
}));
115+
jest.mock('../../hooks/useAnalytics/useAnalytics');
135116

136117
// Import component AFTER all mocks are defined
137118
import OTAUpdatesModal from './OTAUpdatesModal';
138119

139120
describe('OTAUpdatesModal', () => {
140121
beforeEach(() => {
141122
jest.clearAllMocks();
123+
jest.mocked(useAnalytics).mockReturnValue(
124+
createMockUseAnalyticsHook({
125+
trackEvent: mockTrackEvent,
126+
createEventBuilder: AnalyticsEventBuilder.createEventBuilder,
127+
}),
128+
);
142129
(Platform as unknown as { OS: string }).OS = 'ios';
143130
mockOnCloseBottomSheet.mockImplementation((callback?: () => void) => {
144131
if (callback) callback();
@@ -150,7 +137,7 @@ describe('OTAUpdatesModal', () => {
150137

151138
expect(mockTrackEvent).toHaveBeenCalledWith(
152139
expect.objectContaining({
153-
event: MetaMetricsEvents.OTA_UPDATES_MODAL_VIEWED,
140+
name: MetaMetricsEvents.OTA_UPDATES_MODAL_VIEWED.category,
154141
}),
155142
);
156143
});
@@ -163,7 +150,8 @@ describe('OTAUpdatesModal', () => {
163150
await waitFor(() => {
164151
expect(mockTrackEvent).toHaveBeenCalledWith(
165152
expect.objectContaining({
166-
event: MetaMetricsEvents.OTA_UPDATES_MODAL_PRIMARY_ACTION_CLICKED,
153+
name: MetaMetricsEvents.OTA_UPDATES_MODAL_PRIMARY_ACTION_CLICKED
154+
.category,
167155
}),
168156
);
169157
});

app/components/UI/OTAUpdatesModal/OTAUpdatesModal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import Logger from '../../../util/Logger';
1717
import { useAssetFromTheme } from '../../../util/theme';
1818
import { MetaMetricsEvents } from '../../../core/Analytics';
1919
import generateDeviceAnalyticsMetaData from '../../../util/metrics';
20-
import { useMetrics } from '../../hooks/useMetrics';
20+
import { useAnalytics } from '../../hooks/useAnalytics/useAnalytics';
2121
import BottomSheet, {
2222
BottomSheetRef,
2323
} from '../../../component-library/components/BottomSheets/BottomSheet';
@@ -35,7 +35,7 @@ export const createOTAUpdatesModalNavDetails = createNavigationDetails(
3535

3636
const OTAUpdatesModal = () => {
3737
const tw = useTailwind();
38-
const { trackEvent, createEventBuilder } = useMetrics();
38+
const { trackEvent, createEventBuilder } = useAnalytics();
3939
const bottomSheetRef = useRef<BottomSheetRef | null>(null);
4040
const metamaskName = useAssetFromTheme(
4141
metamaskNameLightMode,

0 commit comments

Comments
 (0)