Skip to content

Commit

Permalink
Merge pull request #291 from Outblock:288-feature-call-mixpanel-from-…
Browse files Browse the repository at this point in the history
…background

288-feature-call-mixpanel-from-background
  • Loading branch information
tombeckenham authored Dec 16, 2024
2 parents ca2a651 + 6851afc commit 735120d
Show file tree
Hide file tree
Showing 18 changed files with 351 additions and 324 deletions.
1 change: 1 addition & 0 deletions _raw/manifest/manifest.dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"extension_pages": "script-src 'self' 'wasm-unsafe-eval'; object-src 'self' 'wasm-unsafe-eval';"
},
"permissions": ["storage", "activeTab", "tabs", "notifications", "identity", "camera"],
"host_permissions": ["https://api.mixpanel.com/*"],
"web_accessible_resources": [
{
"resources": [
Expand Down
1 change: 1 addition & 0 deletions _raw/manifest/manifest.pro.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"extension_pages": "script-src 'self' 'wasm-unsafe-eval'; object-src 'self' 'wasm-unsafe-eval';"
},
"permissions": ["storage", "activeTab", "tabs", "notifications", "identity", "camera", "*://*/*"],
"host_permissions": ["https://api.mixpanel.com/*"],
"web_accessible_resources": [
{
"resources": [
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
"@trustwallet/wallet-core": "^4.1.19",
"@tsparticles/engine": "^3.6.0",
"@tsparticles/react": "^3.0.0",
"@types/mixpanel-browser": "^2.50.2",
"@walletconnect/core": "^2.17.2",
"@walletconnect/jsonrpc-utils": "^1.0.8",
"@walletconnect/modal": "^2.7.0",
Expand Down Expand Up @@ -101,7 +100,6 @@
"lodash": "^4.17.21",
"loglevel": "^1.9.2",
"lru-cache": "^6.0.0",
"mixpanel-browser": "^2.56.0",
"nanoid": "^3.3.7",
"obs-store": "^4.0.3",
"process": "^0.11.10",
Expand Down
79 changes: 0 additions & 79 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions src/background/controller/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import web3, { TransactionError } from 'web3';

import eventBus from '@/eventBus';
import { type FeatureFlags } from '@/shared/types/feature-types';
import { type TrackingEvents } from '@/shared/types/tracking-types';
import { isValidEthereumAddress, withPrefix } from '@/shared/utils/address';
import { getHashAlgo, getSignAlgo } from '@/shared/utils/algo';
// eslint-disable-next-line no-restricted-imports
Expand Down Expand Up @@ -4097,6 +4098,23 @@ export class WalletController extends BaseController {
source: source,
});
};

// This is called from the front end, we should find a better way to track this event
trackAccountRecovered = async () => {
mixpanelTrack.track('account_recovered', {
address: (await this.getCurrentAddress()) || '',
mechanism: 'multi-backup',
methods: [],
});
};

trackPageView = async (pathname: string) => {
mixpanelTrack.trackPageView(pathname);
};

trackTime = async (eventName: keyof TrackingEvents) => {
mixpanelTrack.time(eventName);
};
}

export default new WalletController();
Loading

0 comments on commit 735120d

Please sign in to comment.