Skip to content

Commit b3e8cba

Browse files
authored
Merge pull request #494 from threshold-network/posthog-improvements
Posthog improvements Refs: #479 Enables posthog tracking by default and adds additional posthog events to some of the buttons related to tbtc deposit flow.
2 parents 4c64c84 + 955674a commit b3e8cba

File tree

25 files changed

+94
-46
lines changed

25 files changed

+94
-46
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"formik": "^2.2.9",
6464
"framer-motion": "^4",
6565
"numeral": "^2.0.6",
66-
"posthog-js": "^1.32.2",
66+
"posthog-js": "^1.53.1",
6767
"random-gradient": "^0.0.2",
6868
"react": "^17.0.2",
6969
"react-confetti": "^6.0.1",

src/components/Modal/SelectWalletModal/ConnectCoinbase.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { FC } from "react"
22
import { useWeb3React } from "@web3-react/core"
33
import { WalletConnectionModalBase } from "./components"
4-
import { ConnectionError } from "../../../enums"
4+
import { ConnectionError, WalletType } from "../../../enums"
55
import { coinbaseConnector } from "../../../web3/connectors"
66
import CoinbaseStatusAlert from "./components/CoinbaseStatusAlert"
77
import { CoinbaseWallet } from "../../../static/icons/CoinbaseWallet"
@@ -34,6 +34,7 @@ const ConnectCoinbase: FC<{ goBack: () => void; closeModal: () => void }> = ({
3434
tryAgain={
3535
connectionRejected ? () => activate(coinbaseConnector) : undefined
3636
}
37+
walletType={WalletType.Coinbase}
3738
>
3839
<CoinbaseStatusAlert
3940
connectionRejected={connectionRejected}

src/components/Modal/SelectWalletModal/ConnectLedger/SelectDerivationPath.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { Ledger } from "../../../../static/icons/Ledger"
1515
import { LEDGER_DERIVATION_PATHS } from "../../../../web3/connectors/ledger_subprovider"
1616
import { WalletConnectionModalBase } from "../components"
1717
import { WalletConnectionModalProps } from "../../../../types"
18+
import { WalletType } from "../../../../enums"
1819

1920
interface SelectDerivationPathProps extends WalletConnectionModalProps {
2021
derivationPath: string
@@ -46,6 +47,7 @@ const SelectDerivationPath: FC<SelectDerivationPathProps> = ({
4647
title="Ledger"
4748
subTitle="Plug in Ledger device and unlock. Choose one of the following:"
4849
onContinue={onContinue}
50+
walletType={WalletType.Ledger}
4951
>
5052
<RadioGroup
5153
onChange={setDerivationPath}

src/components/Modal/SelectWalletModal/ConnectLedger/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Icon, useColorModeValue } from "@chakra-ui/react"
33
import { useWeb3React } from "@web3-react/core"
44
import { LEDGER_DERIVATION_PATHS } from "../../../../web3/connectors/ledger_subprovider"
55
import { WalletConnectionModalProps } from "../../../../types"
6-
import { LedgerConnectionStage } from "../../../../enums"
6+
import { LedgerConnectionStage, WalletType } from "../../../../enums"
77
import {
88
LedgerConnector,
99
ledgerLegacyConnectorFactory,
@@ -102,6 +102,7 @@ const ConnectLedger: FC<WalletConnectionModalProps> = ({
102102
)}
103103
title="Ledger"
104104
eagerFetch
105+
walletType={WalletType.Ledger}
105106
/>
106107
)
107108

@@ -119,6 +120,7 @@ const ConnectLedger: FC<WalletConnectionModalProps> = ({
119120
)}
120121
title="Ledger"
121122
message="Your Ledger wallet is connected"
123+
walletType={WalletType.Ledger}
122124
/>
123125
)
124126

src/components/Modal/SelectWalletModal/ConnectMetamask.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
metamask,
77
} from "../../../web3/connectors"
88
import { MetamaskStatusAlert, WalletConnectionModalBase } from "./components"
9-
import { ConnectionError } from "../../../enums"
9+
import { ConnectionError, WalletType } from "../../../enums"
1010
import doesErrorInclude from "../../../web3/utils/doesErrorInclude"
1111

1212
const ConnectMetamask: FC<{ goBack: () => void; closeModal: () => void }> = ({
@@ -38,6 +38,7 @@ const ConnectMetamask: FC<{ goBack: () => void; closeModal: () => void }> = ({
3838
!error ? "The MetaMask extension will open in an external window." : ""
3939
}
4040
tryAgain={connectionRejected ? () => activate(metamask) : undefined}
41+
walletType={WalletType.Metamask}
4142
>
4243
<MetamaskStatusAlert
4344
metamaskNotInstalled={metamaskNotInstalled}

src/components/Modal/SelectWalletModal/ConnectTaho.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
WalletInitializeAlert,
1919
WalletRejectedAlert,
2020
} from "./components"
21-
import { ExternalHref } from "../../../enums"
21+
import { ExternalHref, WalletType } from "../../../enums"
2222
import Link from "../../Link"
2323

2424
const ConnectTaho: FC<{ goBack: () => void; closeModal: () => void }> = ({
@@ -59,6 +59,7 @@ const ConnectTaho: FC<{ goBack: () => void; closeModal: () => void }> = ({
5959
}
6060
: undefined
6161
}
62+
walletType={WalletType.TAHO}
6263
>
6364
{isTahoNotInstalled && <InstallTaho />}
6465
{isTahoNotDefaultWallet && <TahoIsNotSetAsDefaultWallet />}

src/components/Modal/SelectWalletModal/ConnectTrezor/index.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ import { FC, useEffect, useMemo, useState } from "react"
22
import { Icon, useColorModeValue } from "@chakra-ui/react"
33
import { useWeb3React } from "@web3-react/core"
44
import { WalletConnectionModalProps } from "../../../../types"
5-
import { ConnectionError, TrezorConnectionStage } from "../../../../enums"
5+
import {
6+
ConnectionError,
7+
TrezorConnectionStage,
8+
WalletType,
9+
} from "../../../../enums"
610
import HardwareAccountSelection from "../components/HardwareAccountSelection"
711
import ConfirmConnectedAddress from "../components/ConfirmConnectedAddress"
812
import trezorConnector from "../../../../web3/connectors/trezor"
@@ -69,6 +73,7 @@ const ConnectTrezor: FC<WalletConnectionModalProps> = ({
6973
tryAgain={
7074
connectionRejected ? () => fetchAddresses(10, 0) : undefined
7175
}
76+
walletType={WalletType.Trezor}
7277
>
7378
<TrezorStatusAlert connectionRejected={connectionRejected} />
7479
</WalletConnectionModalBase>
@@ -92,6 +97,7 @@ const ConnectTrezor: FC<WalletConnectionModalProps> = ({
9297
)}
9398
title="Trezor"
9499
eagerFetch={false}
100+
walletType={WalletType.Trezor}
95101
/>
96102
)
97103

@@ -102,6 +108,7 @@ const ConnectTrezor: FC<WalletConnectionModalProps> = ({
102108
icon={() => <Icon h="40px" w="40px" mr={4} />}
103109
title="Trezor"
104110
message="Your Trezor wallet is connected"
111+
walletType={WalletType.Ledger}
105112
/>
106113
)
107114

src/components/Modal/SelectWalletModal/ConnectWalletConnect.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
WalletConnectionModalBase,
77
WalletConnectStatusAlert,
88
} from "./components"
9-
import { ConnectionError } from "../../../enums"
9+
import { ConnectionError, WalletType } from "../../../enums"
1010
import doesErrorInclude from "../../../web3/utils/doesErrorInclude"
1111

1212
const ConnectWalletConnect: FC<{
@@ -35,6 +35,7 @@ const ConnectWalletConnect: FC<{
3535
walletconnect.walletConnectProvider = undefined
3636
activate(walletconnect)
3737
}}
38+
walletType={WalletType.WalletConnect}
3839
>
3940
<WalletConnectStatusAlert
4041
connectionRejected={connectionRejected}

src/components/Modal/SelectWalletModal/components/ConfirmConnectedAddress.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { FC } from "react"
22
import { AccountSuccessAlert, WalletConnectionModalBase } from "./index"
33
import { WalletConnectionModalProps } from "../../../../types"
4+
import { WalletType } from "../../../../enums"
45

56
interface Props {
67
icon: any
78
title: string
89
message: string
10+
walletType: WalletType
911
}
1012

1113
const ConfirmConnectedAddress: FC<Props & WalletConnectionModalProps> = ({
@@ -14,13 +16,15 @@ const ConfirmConnectedAddress: FC<Props & WalletConnectionModalProps> = ({
1416
icon: WalletIcon,
1517
title,
1618
message,
19+
walletType,
1720
}) => {
1821
return (
1922
<WalletConnectionModalBase
2023
goBack={goBack}
2124
closeModal={closeModal}
2225
WalletIcon={<WalletIcon />}
2326
title={title}
27+
walletType={walletType}
2428
>
2529
<AccountSuccessAlert message={message} />
2630
</WalletConnectionModalBase>

src/components/Modal/SelectWalletModal/components/HardwareAccountSelection.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { HiChevronLeft, HiChevronRight } from "react-icons/all"
1818
import createEtherscanLink, {
1919
ExplorerDataType,
2020
} from "../../../../utils/createEtherscanLink"
21+
import { WalletType } from "../../../../enums"
2122

2223
interface HardwareAccountSelectionProps extends WalletConnectionModalProps {
2324
selectedAddress: string
@@ -28,6 +29,7 @@ interface HardwareAccountSelectionProps extends WalletConnectionModalProps {
2829
icon: any
2930
title: string
3031
eagerFetch: boolean
32+
walletType: WalletType
3133
}
3234

3335
const HARDWARE_LOADING_TIMEOUT_MS = 60000
@@ -43,6 +45,7 @@ const HardwareAccountSelection: FC<HardwareAccountSelectionProps> = ({
4345
icon: WalletIcon,
4446
title,
4547
eagerFetch,
48+
walletType,
4649
}) => {
4750
const [loadingCountDown, setCounter] = useState(HARDWARE_LOADING_TIMEOUT_MS)
4851

@@ -105,6 +108,7 @@ const HardwareAccountSelection: FC<HardwareAccountSelectionProps> = ({
105108
title={title}
106109
subTitle="Choose an address below."
107110
onContinue={confirmAddress}
111+
walletType={walletType}
108112
>
109113
{loading ? (
110114
Array.from(Array(ROWS_PER_PAGE).keys()).map((address) => (

0 commit comments

Comments
 (0)