Skip to content

Commit

Permalink
Merge branch 'develop' into feat/vs-2516
Browse files Browse the repository at this point in the history
  • Loading branch information
vinistevam committed Oct 29, 2024
2 parents dc3a90f + b649acf commit 5994e46
Show file tree
Hide file tree
Showing 108 changed files with 4,385 additions and 1,889 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/scripts/lib/transaction/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ import {

export type TransactionMetricsRequest = {
createEventFragment: (
options: MetaMetricsEventFragment,
options: Omit<MetaMetricsEventFragment, 'id'>,
) => MetaMetricsEventFragment;
finalizeEventFragment: (
fragmentId: string,
Expand Down
19 changes: 6 additions & 13 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ import {
NotificationServicesPushController,
NotificationServicesController,
} from '@metamask/notification-services-controller';
import { isProduction } from '../../shared/modules/environment';
import { methodsRequiringNetworkSwitch } from '../../shared/constants/methods-tags';

///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
Expand Down Expand Up @@ -755,31 +754,25 @@ export default class MetamaskController extends EventEmitter {
});

this.metaMetricsController = new MetaMetricsController({
initState: initState.MetaMetricsController,
segment,
onPreferencesStateChange: preferencesMessenger.subscribe.bind(
preferencesMessenger,
'PreferencesController:stateChange',
),
preferencesControllerState: {
currentLocale: this.preferencesController.state.currentLocale,
selectedAddress: this.preferencesController.state.selectedAddress,
},
onPreferencesStateChange: preferencesMessenger.subscribe.bind(
preferencesMessenger,
'PreferencesController:stateChange',
),
onNetworkDidChange: networkControllerMessenger.subscribe.bind(
networkControllerMessenger,
'NetworkController:networkDidChange',
),
getNetworkIdentifier: () => {
const { type, rpcUrl } = getProviderConfig({
metamask: this.networkController.state,
});
return type === NETWORK_TYPES.RPC ? rpcUrl : type;
},
getCurrentChainId: () =>
getCurrentChainId({ metamask: this.networkController.state }),
version: process.env.METAMASK_VERSION,
environment: process.env.METAMASK_ENVIRONMENT,
extension: this.extension,
initState: initState.MetaMetricsController,
captureException,
});

Expand Down Expand Up @@ -1565,7 +1558,7 @@ export default class MetamaskController extends EventEmitter {
},
},
env: {
isAccountSyncingEnabled: !isProduction() && isManifestV3,
isAccountSyncingEnabled: isManifestV3,
},
messenger: this.controllerMessenger.getRestricted({
name: 'UserStorageController',
Expand Down
1 change: 1 addition & 0 deletions lavamoat/browserify/beta/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1979,6 +1979,7 @@
"globals": {
"TextEncoder": true,
"URL": true,
"console.error": true,
"fetch": true
},
"packages": {
Expand Down
1 change: 1 addition & 0 deletions lavamoat/browserify/flask/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1979,6 +1979,7 @@
"globals": {
"TextEncoder": true,
"URL": true,
"console.error": true,
"fetch": true
},
"packages": {
Expand Down
1 change: 1 addition & 0 deletions lavamoat/browserify/main/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1979,6 +1979,7 @@
"globals": {
"TextEncoder": true,
"URL": true,
"console.error": true,
"fetch": true
},
"packages": {
Expand Down
1 change: 1 addition & 0 deletions lavamoat/browserify/mmi/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -2071,6 +2071,7 @@
"globals": {
"TextEncoder": true,
"URL": true,
"console.error": true,
"fetch": true
},
"packages": {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@
"@metamask/approval-controller": "^7.0.0",
"@metamask/assets-controllers": "patch:@metamask/assets-controllers@npm%3A38.3.0#~/.yarn/patches/@metamask-assets-controllers-npm-38.3.0-57b3d695bb.patch",
"@metamask/base-controller": "^7.0.0",
"@metamask/bitcoin-wallet-snap": "^0.8.1",
"@metamask/bitcoin-wallet-snap": "^0.8.2",
"@metamask/browser-passworder": "^4.3.0",
"@metamask/contract-metadata": "^2.5.0",
"@metamask/controller-utils": "^11.2.0",
Expand Down Expand Up @@ -326,7 +326,7 @@
"@metamask/obs-store": "^9.0.0",
"@metamask/permission-controller": "^10.0.0",
"@metamask/permission-log-controller": "^2.0.1",
"@metamask/phishing-controller": "^12.0.1",
"@metamask/phishing-controller": "^12.3.0",
"@metamask/post-message-stream": "^8.0.0",
"@metamask/ppom-validator": "0.35.1",
"@metamask/preinstalled-example-snap": "^0.2.0",
Expand Down
99 changes: 91 additions & 8 deletions shared/constants/metametrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export type MetaMetricsReferrerObject = {
* function, but still provides the consumer a way to override these values if
* necessary.
*/
type MetaMetricsContext = {
export type MetaMetricsContext = {
/**
* Application metadata.
*/
Expand All @@ -65,6 +65,10 @@ type MetaMetricsContext = {
* The dapp that triggered an interaction (MetaMask only).
*/
referrer?: MetaMetricsReferrerObject;
/**
* The marketing campaign cookie ID.
*/
marketingCampaignCookieId?: string | null;
};

export type MetaMetricsEventPayload = {
Expand All @@ -79,7 +83,7 @@ export type MetaMetricsEventPayload = {
/**
* The action ID to deduplicate event requests from the UI.
*/
actionId?: number;
actionId?: string;
/**
* The type of environment this event occurred in. Defaults to the background
* process type.
Expand Down Expand Up @@ -116,6 +120,14 @@ export type MetaMetricsEventPayload = {
* The origin of the dapp that triggered this event.
*/
referrer?: MetaMetricsReferrerObject;
/*
* The unique identifier for the event.
*/
uniqueIdentifier?: string;
/**
* Whether the event is a duplicate of an anonymized event.
*/
isDuplicateAnonymizedEvent?: boolean;
};

export type MetaMetricsEventOptions = {
Expand Down Expand Up @@ -223,6 +235,18 @@ export type MetaMetricsEventFragment = {
* to avoid unnecessary lookups and reduce accidental duplication.
*/
uniqueIdentifier?: string;
/*
* The event id.
*/
id: string;
/*
* The environment type.
*/
environmentType?: string;
/*
* The event name.
*/
event?: string;
};

/**
Expand All @@ -245,11 +269,38 @@ export type SegmentEventPayload = {
/**
* Properties to attach to the event.
*/
properties: object;
properties: {
params?: Record<string, string>;
legacy_event?: boolean;
locale: string;
chain_id: string;
environment_type?: string;
revenue?: number;
value?: number;
currency?: string;
category?: string;
};
/**
* The context the event occurred in.
*/
context: MetaMetricsContext;
/**
* The message id
*/
messageId?: string;

/**
* The timestamp of the event.
*/
timestamp?: string;
/*
* The event name.
*/
name?: string;
/*
* The user trais
*/
traits?: MetaMetricsUserTraits;
};

/**
Expand All @@ -259,18 +310,18 @@ export type MetaMetricsPagePayload = {
/**
* The name of the page that was viewed.
*/
name: string;
name?: string;
/**
* The variadic parts of the page URL.
*
* Example: If the route is `/asset/:asset` and the path is `/asset/ETH`,
* the `params` property would be `{ asset: 'ETH' }`.
*/
params?: object;
params?: Record<string, string>;
/**
* The environment type that the page was viewed in.
*/
environmentType: EnvironmentType;
environmentType?: EnvironmentType;
/**
* The details of the page.
*/
Expand All @@ -279,6 +330,10 @@ export type MetaMetricsPagePayload = {
* The dapp that triggered the page view.
*/
referrer?: MetaMetricsReferrerObject;
/**
* The action ID of the page view.
*/
actionId?: string;
};

export type MetaMetricsPageOptions = {
Expand Down Expand Up @@ -315,7 +370,7 @@ export type MetaMetricsUserTraits = {
/**
* Does the user have the Autodetect NFTs feature enabled?
*/
nft_autodetection_enabled?: number;
nft_autodetection_enabled?: boolean;
/**
* A number representing the number of identities (accounts) added to the
* user's wallet.
Expand Down Expand Up @@ -354,10 +409,30 @@ export type MetaMetricsUserTraits = {
* Does the user have token detection enabled?
*/
token_detection_enabled?: boolean;
/**
* Does the user have a selected currency in the settings
*/
current_currency?: string;
/**
* Does the user have show native token as main balance enabled.
*/
show_native_token_as_main_balance?: boolean;
/**
* Does the user have native currency enabled?
*/
use_native_as_primary_currency?: boolean;
/**
* Does the user opt in for metrics
*/
is_metrics_opted_in?: boolean;
/**
* Does the user accepted marketing consent
*/
has_marketing_consent?: boolean;
/**
* The date the extension was installed.
*/
install_date_ext?: string;
/**
* Whether the security provider feature has been enabled.
*/
Expand All @@ -366,7 +441,7 @@ export type MetaMetricsUserTraits = {
/**
* The address of the MMI account in question
*/
mmi_account_address?: string;
mmi_account_address?: string | null;
/**
* What is the MMI extension ID
*/
Expand All @@ -376,6 +451,14 @@ export type MetaMetricsUserTraits = {
*/
mmi_is_custodian?: boolean;
///: END:ONLY_INCLUDE_IF
/**
* Does the user change the token sort order on the asset list
*/
token_sort_preference?: string;
/**
* The number of petname addresses
*/
petname_addresses_count?: number;
};

export enum MetaMetricsUserTrait {
Expand Down
Loading

0 comments on commit 5994e46

Please sign in to comment.