diff --git a/.eslintrc.js b/.eslintrc.js index 84ddf9d73d..9a66e49699 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -57,5 +57,22 @@ module.exports = { ], }, }, + { + files: ['**/*.ts', '**/*.tsx'], + excludedFiles: ['src/analytics/*'], + rules: { + 'no-restricted-imports': [ + 'error', + { + paths: [ + { + name: '@uniswap/analytics', + message: `Do not import from '@uniswap/analytics' directly. Use 'analytics' instead.`, + }, + ], + }, + ], + }, + }, ], } diff --git a/src/analytics/index.tsx b/src/analytics/index.tsx new file mode 100644 index 0000000000..56a88602bc --- /dev/null +++ b/src/analytics/index.tsx @@ -0,0 +1,47 @@ +import { + sendAnalyticsEvent as sendAnalyticsTraceEvent, + Trace as AnalyticsTrace, + TraceEvent as AnalyticsEvent, +} from '@uniswap/analytics' +import { atomWithStorage, useAtomValue } from 'jotai/utils' +import { memo } from 'react' + +export { getDeviceId, initializeAnalytics, OriginApplication, user, useTrace } from '@uniswap/analytics' + +const allowAnalyticsAtomKey = 'allow_analytics' +export const allowAnalyticsAtom = atomWithStorage(allowAnalyticsAtomKey, true) + +export const Trace = memo((props: React.ComponentProps) => { + const allowAnalytics = useAtomValue(allowAnalyticsAtom) + const shouldLogImpression = allowAnalytics ? props.shouldLogImpression : false + + return +}) + +Trace.displayName = 'Trace' + +export const TraceEvent = memo((props: React.ComponentProps) => { + const allowAnalytics = useAtomValue(allowAnalyticsAtom) + const shouldLogImpression = allowAnalytics ? props.shouldLogImpression : false + + return +}) + +TraceEvent.displayName = 'TraceEvent' + +export const sendAnalyticsEvent: typeof sendAnalyticsTraceEvent = (event, properties) => { + let allowAnalytics = true + + try { + const value = localStorage.getItem(allowAnalyticsAtomKey) + + if (typeof value === 'string') { + allowAnalytics = JSON.parse(value) + } + // eslint-disable-next-line no-empty + } catch {} + + if (allowAnalytics) { + sendAnalyticsTraceEvent(event, properties) + } +} diff --git a/src/components/About/AboutFooter.tsx b/src/components/About/AboutFooter.tsx index a04d45d711..5630d44a46 100644 --- a/src/components/About/AboutFooter.tsx +++ b/src/components/About/AboutFooter.tsx @@ -1,5 +1,5 @@ -import { TraceEvent } from '@uniswap/analytics' import { BrowserEvent, InterfaceElementName, SharedEventName } from '@uniswap/analytics-events' +import { TraceEvent } from 'analytics' import { useDisableNFTRoutes } from 'hooks/useDisableNFTRoutes' import styled from 'styled-components/macro' import { BREAKPOINTS, ExternalLink, StyledRouterLink } from 'theme' diff --git a/src/components/About/Card.tsx b/src/components/About/Card.tsx index 95fc8fa502..99e799328e 100644 --- a/src/components/About/Card.tsx +++ b/src/components/About/Card.tsx @@ -1,5 +1,5 @@ -import { TraceEvent } from '@uniswap/analytics' import { BrowserEvent, SharedEventName } from '@uniswap/analytics-events' +import { TraceEvent } from 'analytics' import { Link } from 'react-router-dom' import styled, { DefaultTheme } from 'styled-components/macro' import { BREAKPOINTS } from 'theme' diff --git a/src/components/AccountDrawer/AnalyticsToggle.tsx b/src/components/AccountDrawer/AnalyticsToggle.tsx new file mode 100644 index 0000000000..de616d8e65 --- /dev/null +++ b/src/components/AccountDrawer/AnalyticsToggle.tsx @@ -0,0 +1,18 @@ +import { t } from '@lingui/macro' +import { allowAnalyticsAtom } from 'analytics' +import { useAtom } from 'jotai' + +import { SettingsToggle } from './SettingsToggle' + +export function AnalyticsToggle() { + const [allowAnalytics, updateAllowAnalytics] = useAtom(allowAnalyticsAtom) + + return ( + void updateAllowAnalytics((value) => !value)} + /> + ) +} diff --git a/src/components/AccountDrawer/AuthenticatedHeader.tsx b/src/components/AccountDrawer/AuthenticatedHeader.tsx index 9736a07a31..2278c17689 100644 --- a/src/components/AccountDrawer/AuthenticatedHeader.tsx +++ b/src/components/AccountDrawer/AuthenticatedHeader.tsx @@ -1,9 +1,9 @@ import { Trans } from '@lingui/macro' -import { sendAnalyticsEvent, TraceEvent } from '@uniswap/analytics' import { BrowserEvent, InterfaceElementName, InterfaceEventName, SharedEventName } from '@uniswap/analytics-events' import { formatNumber, NumberType } from '@uniswap/conedison/format' import { CurrencyAmount, Token } from '@uniswap/sdk-core' import { useWeb3React } from '@web3-react/core' +import { sendAnalyticsEvent, TraceEvent } from 'analytics' import { ButtonEmphasis, ButtonSize, LoadingButtonSpinner, ThemeButton } from 'components/Button' import Column from 'components/Column' import { AutoRow } from 'components/Row' diff --git a/src/components/AccountDrawer/MiniPortfolio/Activity/ActivityRow.tsx b/src/components/AccountDrawer/MiniPortfolio/Activity/ActivityRow.tsx index 2054f13e84..299eab7409 100644 --- a/src/components/AccountDrawer/MiniPortfolio/Activity/ActivityRow.tsx +++ b/src/components/AccountDrawer/MiniPortfolio/Activity/ActivityRow.tsx @@ -1,5 +1,5 @@ -import { TraceEvent } from '@uniswap/analytics' import { BrowserEvent, InterfaceElementName, SharedEventName } from '@uniswap/analytics-events' +import { TraceEvent } from 'analytics' import Column from 'components/Column' import AlertTriangleFilled from 'components/Icons/AlertTriangleFilled' import { LoaderV2 } from 'components/Icons/LoadingSpinner' diff --git a/src/components/AccountDrawer/MiniPortfolio/NFTs/NFTItem.tsx b/src/components/AccountDrawer/MiniPortfolio/NFTs/NFTItem.tsx index f61e1861ac..b30af153eb 100644 --- a/src/components/AccountDrawer/MiniPortfolio/NFTs/NFTItem.tsx +++ b/src/components/AccountDrawer/MiniPortfolio/NFTs/NFTItem.tsx @@ -1,5 +1,5 @@ -import { sendAnalyticsEvent, useTrace } from '@uniswap/analytics' import { InterfaceElementName, SharedEventName } from '@uniswap/analytics-events' +import { sendAnalyticsEvent, useTrace } from 'analytics' import { useToggleAccountDrawer } from 'components/AccountDrawer' import Column from 'components/Column' import Row from 'components/Row' diff --git a/src/components/AccountDrawer/MiniPortfolio/Pools/index.tsx b/src/components/AccountDrawer/MiniPortfolio/Pools/index.tsx index db9cd8c309..93a85ea70a 100644 --- a/src/components/AccountDrawer/MiniPortfolio/Pools/index.tsx +++ b/src/components/AccountDrawer/MiniPortfolio/Pools/index.tsx @@ -1,9 +1,9 @@ import { t } from '@lingui/macro' -import { TraceEvent } from '@uniswap/analytics' import { BrowserEvent, InterfaceElementName, SharedEventName } from '@uniswap/analytics-events' import { formatNumber, NumberType } from '@uniswap/conedison/format' import { Position } from '@uniswap/v3-sdk' import { useWeb3React } from '@web3-react/core' +import { TraceEvent } from 'analytics' import { useToggleAccountDrawer } from 'components/AccountDrawer' import Row from 'components/Row' import { MouseoverTooltip } from 'components/Tooltip' diff --git a/src/components/AccountDrawer/MiniPortfolio/Tokens/index.tsx b/src/components/AccountDrawer/MiniPortfolio/Tokens/index.tsx index 83cbde8897..de6e81876c 100644 --- a/src/components/AccountDrawer/MiniPortfolio/Tokens/index.tsx +++ b/src/components/AccountDrawer/MiniPortfolio/Tokens/index.tsx @@ -1,6 +1,6 @@ -import { TraceEvent } from '@uniswap/analytics' import { BrowserEvent, InterfaceElementName, SharedEventName } from '@uniswap/analytics-events' import { formatNumber, NumberType } from '@uniswap/conedison/format' +import { TraceEvent } from 'analytics' import { useCachedPortfolioBalancesQuery } from 'components/AccountDrawer/PrefetchBalancesWrapper' import Row from 'components/Row' import { formatDelta } from 'components/Tokens/TokenDetails/PriceChart' diff --git a/src/components/AccountDrawer/MiniPortfolio/index.tsx b/src/components/AccountDrawer/MiniPortfolio/index.tsx index b6b5a7bd72..706efebcd7 100644 --- a/src/components/AccountDrawer/MiniPortfolio/index.tsx +++ b/src/components/AccountDrawer/MiniPortfolio/index.tsx @@ -1,6 +1,6 @@ import { Trans } from '@lingui/macro' -import { Trace, TraceEvent } from '@uniswap/analytics' import { BrowserEvent, InterfaceElementName, InterfaceSectionName, SharedEventName } from '@uniswap/analytics-events' +import { Trace, TraceEvent } from 'analytics' import Column from 'components/Column' import { LoaderV2 } from 'components/Icons/LoadingSpinner' import { AutoRow } from 'components/Row' diff --git a/src/components/AccountDrawer/SettingsMenu.tsx b/src/components/AccountDrawer/SettingsMenu.tsx index ed70b533bc..c001895252 100644 --- a/src/components/AccountDrawer/SettingsMenu.tsx +++ b/src/components/AccountDrawer/SettingsMenu.tsx @@ -8,6 +8,7 @@ import styled, { useTheme } from 'styled-components/macro' import { ClickableStyle, ThemedText } from 'theme' import ThemeToggle from 'theme/components/ThemeToggle' +import { AnalyticsToggle } from './AnalyticsToggle' import { GitVersionRow } from './GitVersionRow' import { SlideOutMenu } from './SlideOutMenu' import { SmallBalanceToggle } from './SmallBalanceToggle' @@ -63,6 +64,7 @@ export default function SettingsMenu({ onClose }: { onClose: () => void }) { + diff --git a/src/components/AccountDrawer/SettingsToggle.tsx b/src/components/AccountDrawer/SettingsToggle.tsx new file mode 100644 index 0000000000..d9b842149f --- /dev/null +++ b/src/components/AccountDrawer/SettingsToggle.tsx @@ -0,0 +1,37 @@ +import Column from 'components/Column' +import Row from 'components/Row' +import Toggle from 'components/Toggle' +import styled from 'styled-components/macro' +import { ThemedText } from 'theme' + +const StyledColumn = styled(Column)` + width: 100%; +` + +interface SettingsToggleProps { + title: string + description?: string + dataid?: string + isActive: boolean + toggle: () => void +} + +export function SettingsToggle({ title, description, dataid, isActive, toggle }: SettingsToggleProps) { + return ( + + + + {title} + + {description && ( + + + {description} + + + )} + + + + ) +} diff --git a/src/components/AccountDrawer/SmallBalanceToggle.tsx b/src/components/AccountDrawer/SmallBalanceToggle.tsx index e7cf28a3ae..bc6eb6c73a 100644 --- a/src/components/AccountDrawer/SmallBalanceToggle.tsx +++ b/src/components/AccountDrawer/SmallBalanceToggle.tsx @@ -1,9 +1,8 @@ -import { Trans } from '@lingui/macro' -import Row from 'components/Row' -import Toggle from 'components/Toggle' +import { t } from '@lingui/macro' import { useAtom } from 'jotai' import { atomWithStorage } from 'jotai/utils' -import { ThemedText } from 'theme' + +import { SettingsToggle } from './SettingsToggle' export const hideSmallBalancesAtom = atomWithStorage('hideSmallBalances', true) @@ -11,20 +10,10 @@ export function SmallBalanceToggle() { const [hideSmallBalances, updateHideSmallBalances] = useAtom(hideSmallBalancesAtom) return ( - - - - Hide small balances - - - - { - updateHideSmallBalances(!hideSmallBalances) - }} - /> - - + void updateHideSmallBalances((value) => !value)} + /> ) } diff --git a/src/components/AccountDrawer/TestnetsToggle.tsx b/src/components/AccountDrawer/TestnetsToggle.tsx index 17d1450c89..c914aea84a 100644 --- a/src/components/AccountDrawer/TestnetsToggle.tsx +++ b/src/components/AccountDrawer/TestnetsToggle.tsx @@ -1,9 +1,8 @@ -import { Trans } from '@lingui/macro' -import Row from 'components/Row' -import Toggle from 'components/Toggle' +import { t } from '@lingui/macro' import { useAtom } from 'jotai' import { atomWithStorage } from 'jotai/utils' -import { ThemedText } from 'theme' + +import { SettingsToggle } from './SettingsToggle' export const showTestnetsAtom = atomWithStorage('showTestnets', false) @@ -11,21 +10,11 @@ export function TestnetsToggle() { const [showTestnets, updateShowTestnets] = useAtom(showTestnetsAtom) return ( - - - - Show testnets - - - - { - updateShowTestnets(!showTestnets) - }} - /> - - + void updateShowTestnets((value) => !value)} + /> ) } diff --git a/src/components/AccountDrawer/UniwalletModal.tsx b/src/components/AccountDrawer/UniwalletModal.tsx index 39a20146f6..b6dcd350d5 100644 --- a/src/components/AccountDrawer/UniwalletModal.tsx +++ b/src/components/AccountDrawer/UniwalletModal.tsx @@ -1,7 +1,7 @@ import { Trans } from '@lingui/macro' -import { sendAnalyticsEvent } from '@uniswap/analytics' import { InterfaceElementName } from '@uniswap/analytics-events' import { WalletConnect as WalletConnectv2 } from '@web3-react/walletconnect-v2' +import { sendAnalyticsEvent } from 'analytics' import Column, { AutoColumn } from 'components/Column' import Modal from 'components/Modal' import { RowBetween } from 'components/Row' diff --git a/src/components/AccountDrawer/index.tsx b/src/components/AccountDrawer/index.tsx index 2f38e0e876..61fbb85927 100644 --- a/src/components/AccountDrawer/index.tsx +++ b/src/components/AccountDrawer/index.tsx @@ -1,5 +1,5 @@ -import { TraceEvent } from '@uniswap/analytics' import { BrowserEvent, InterfaceEventName } from '@uniswap/analytics-events' +import { TraceEvent } from 'analytics' import { ScrollBarStyles } from 'components/Common' import { useWindowSize } from 'hooks/useWindowSize' import { atom } from 'jotai' diff --git a/src/components/CurrencyInputPanel/SwapCurrencyInputPanel.tsx b/src/components/CurrencyInputPanel/SwapCurrencyInputPanel.tsx index 854358094e..640290afaf 100644 --- a/src/components/CurrencyInputPanel/SwapCurrencyInputPanel.tsx +++ b/src/components/CurrencyInputPanel/SwapCurrencyInputPanel.tsx @@ -1,10 +1,10 @@ import { Trans } from '@lingui/macro' -import { TraceEvent } from '@uniswap/analytics' import { BrowserEvent, InterfaceElementName, SwapEventName } from '@uniswap/analytics-events' import { formatCurrencyAmount, NumberType } from '@uniswap/conedison/format' import { Currency, CurrencyAmount, Percent } from '@uniswap/sdk-core' import { Pair } from '@uniswap/v2-sdk' import { useWeb3React } from '@web3-react/core' +import { TraceEvent } from 'analytics' import PrefetchBalancesWrapper from 'components/AccountDrawer/PrefetchBalancesWrapper' import { AutoColumn } from 'components/Column' import { LoadingOpacityContainer, loadingOpacityMixin } from 'components/Loader/styled' diff --git a/src/components/CurrencyInputPanel/index.tsx b/src/components/CurrencyInputPanel/index.tsx index 2a1cd580c2..f0fbd6cc00 100644 --- a/src/components/CurrencyInputPanel/index.tsx +++ b/src/components/CurrencyInputPanel/index.tsx @@ -1,9 +1,9 @@ import { Trans } from '@lingui/macro' -import { TraceEvent } from '@uniswap/analytics' import { BrowserEvent, InterfaceElementName, SwapEventName } from '@uniswap/analytics-events' import { Currency, CurrencyAmount } from '@uniswap/sdk-core' import { Pair } from '@uniswap/v2-sdk' import { useWeb3React } from '@web3-react/core' +import { TraceEvent } from 'analytics' import { AutoColumn } from 'components/Column' import { LoadingOpacityContainer, loadingOpacityMixin } from 'components/Loader/styled' import { isSupportedChain } from 'constants/chains' diff --git a/src/components/NavBar/SearchBar.tsx b/src/components/NavBar/SearchBar.tsx index 72046c6111..0229140559 100644 --- a/src/components/NavBar/SearchBar.tsx +++ b/src/components/NavBar/SearchBar.tsx @@ -1,8 +1,8 @@ // eslint-disable-next-line no-restricted-imports import { t } from '@lingui/macro' -import { sendAnalyticsEvent, Trace, TraceEvent, useTrace } from '@uniswap/analytics' import { BrowserEvent, InterfaceElementName, InterfaceEventName, InterfaceSectionName } from '@uniswap/analytics-events' import { useWeb3React } from '@web3-react/core' +import { sendAnalyticsEvent, Trace, TraceEvent, useTrace } from 'analytics' import clsx from 'clsx' import { useCollectionSearch } from 'graphql/data/nft/CollectionSearch' import { useSearchTokens } from 'graphql/data/SearchTokens' diff --git a/src/components/NavBar/SearchBarDropdown.tsx b/src/components/NavBar/SearchBarDropdown.tsx index 30c2f5c95f..0d0d2cfe82 100644 --- a/src/components/NavBar/SearchBarDropdown.tsx +++ b/src/components/NavBar/SearchBarDropdown.tsx @@ -1,8 +1,8 @@ import { Trans } from '@lingui/macro' -import { useTrace } from '@uniswap/analytics' import { InterfaceSectionName, NavBarSearchTypes } from '@uniswap/analytics-events' import { ChainId } from '@uniswap/sdk-core' import { useWeb3React } from '@web3-react/core' +import { useTrace } from 'analytics' import clsx from 'clsx' import Badge from 'components/Badge' import { getChainInfo } from 'constants/chainInfo' diff --git a/src/components/NavBar/SuggestionRow.tsx b/src/components/NavBar/SuggestionRow.tsx index 54aee087af..86d0760bd9 100644 --- a/src/components/NavBar/SuggestionRow.tsx +++ b/src/components/NavBar/SuggestionRow.tsx @@ -1,6 +1,6 @@ -import { sendAnalyticsEvent } from '@uniswap/analytics' import { InterfaceEventName } from '@uniswap/analytics-events' import { formatUSDPrice } from '@uniswap/conedison/format' +import { sendAnalyticsEvent } from 'analytics' import clsx from 'clsx' import QueryTokenLogo from 'components/Logo/QueryTokenLogo' import TokenSafetyIcon from 'components/TokenSafety/TokenSafetyIcon' diff --git a/src/components/SearchModal/CommonBases.tsx b/src/components/SearchModal/CommonBases.tsx index adb2f17224..101c6669ef 100644 --- a/src/components/SearchModal/CommonBases.tsx +++ b/src/components/SearchModal/CommonBases.tsx @@ -1,6 +1,6 @@ -import { TraceEvent } from '@uniswap/analytics' import { BrowserEvent, InterfaceElementName, InterfaceEventName } from '@uniswap/analytics-events' import { Currency } from '@uniswap/sdk-core' +import { TraceEvent } from 'analytics' import { AutoColumn } from 'components/Column' import CurrencyLogo from 'components/Logo/CurrencyLogo' import { AutoRow } from 'components/Row' diff --git a/src/components/SearchModal/CurrencyList/index.tsx b/src/components/SearchModal/CurrencyList/index.tsx index 85228dd925..4566386ff4 100644 --- a/src/components/SearchModal/CurrencyList/index.tsx +++ b/src/components/SearchModal/CurrencyList/index.tsx @@ -1,7 +1,7 @@ -import { TraceEvent } from '@uniswap/analytics' import { BrowserEvent, InterfaceElementName, InterfaceEventName } from '@uniswap/analytics-events' import { Currency, CurrencyAmount, Token } from '@uniswap/sdk-core' import { useWeb3React } from '@web3-react/core' +import { TraceEvent } from 'analytics' import Loader from 'components/Icons/LoadingSpinner' import TokenSafetyIcon from 'components/TokenSafety/TokenSafetyIcon' import { checkWarning } from 'constants/tokenSafety' diff --git a/src/components/SearchModal/CurrencySearch.tsx b/src/components/SearchModal/CurrencySearch.tsx index 120f8e2545..e6166288f2 100644 --- a/src/components/SearchModal/CurrencySearch.tsx +++ b/src/components/SearchModal/CurrencySearch.tsx @@ -1,9 +1,9 @@ // eslint-disable-next-line no-restricted-imports import { t, Trans } from '@lingui/macro' -import { Trace } from '@uniswap/analytics' import { InterfaceEventName, InterfaceModalName } from '@uniswap/analytics-events' import { Currency, Token } from '@uniswap/sdk-core' import { useWeb3React } from '@web3-react/core' +import { Trace } from 'analytics' import { useCachedPortfolioBalancesQuery } from 'components/AccountDrawer/PrefetchBalancesWrapper' import { sendEvent } from 'components/analytics' import { supportedChainIdFromGQLChain } from 'graphql/data/util' diff --git a/src/components/Tokens/TokenDetails/index.tsx b/src/components/Tokens/TokenDetails/index.tsx index e013e92346..49d1d076d0 100644 --- a/src/components/Tokens/TokenDetails/index.tsx +++ b/src/components/Tokens/TokenDetails/index.tsx @@ -1,7 +1,7 @@ import { Trans } from '@lingui/macro' -import { Trace } from '@uniswap/analytics' import { InterfacePageName } from '@uniswap/analytics-events' import { useWeb3React } from '@web3-react/core' +import { Trace } from 'analytics' import CurrencyLogo from 'components/Logo/CurrencyLogo' import { AboutSection } from 'components/Tokens/TokenDetails/About' import AddressSection from 'components/Tokens/TokenDetails/AddressSection' diff --git a/src/components/Tokens/TokenTable/SearchBar.tsx b/src/components/Tokens/TokenTable/SearchBar.tsx index d73713c460..a1fa6a2de9 100644 --- a/src/components/Tokens/TokenTable/SearchBar.tsx +++ b/src/components/Tokens/TokenTable/SearchBar.tsx @@ -1,6 +1,6 @@ import { Trans } from '@lingui/macro' -import { TraceEvent } from '@uniswap/analytics' import { BrowserEvent, InterfaceElementName, InterfaceEventName } from '@uniswap/analytics-events' +import { TraceEvent } from 'analytics' import searchIcon from 'assets/svg/search.svg' import xIcon from 'assets/svg/x.svg' import useDebounce from 'hooks/useDebounce' diff --git a/src/components/Tokens/TokenTable/TokenRow.tsx b/src/components/Tokens/TokenTable/TokenRow.tsx index 97824e0d44..87b4a05064 100644 --- a/src/components/Tokens/TokenTable/TokenRow.tsx +++ b/src/components/Tokens/TokenTable/TokenRow.tsx @@ -1,8 +1,8 @@ import { Trans } from '@lingui/macro' -import { sendAnalyticsEvent } from '@uniswap/analytics' import { InterfaceEventName } from '@uniswap/analytics-events' import { formatNumber, formatUSDPrice, NumberType } from '@uniswap/conedison/format' import { ParentSize } from '@visx/responsive' +import { sendAnalyticsEvent } from 'analytics' import SparklineChart from 'components/Charts/SparklineChart' import QueryTokenLogo from 'components/Logo/QueryTokenLogo' import { MouseoverTooltip } from 'components/Tooltip' diff --git a/src/components/WalletModal/Option.tsx b/src/components/WalletModal/Option.tsx index 4b8e471626..47b47355d2 100644 --- a/src/components/WalletModal/Option.tsx +++ b/src/components/WalletModal/Option.tsx @@ -1,6 +1,6 @@ -import { TraceEvent } from '@uniswap/analytics' import { BrowserEvent, InterfaceElementName, InterfaceEventName } from '@uniswap/analytics-events' import { useWeb3React } from '@web3-react/core' +import { TraceEvent } from 'analytics' import { useToggleAccountDrawer } from 'components/AccountDrawer' import Loader from 'components/Icons/LoadingSpinner' import { ActivationStatus, useActivationState } from 'connection/activate' diff --git a/src/components/Web3Provider/index.test.tsx b/src/components/Web3Provider/index.test.tsx index acb279cf56..391f966999 100644 --- a/src/components/Web3Provider/index.test.tsx +++ b/src/components/Web3Provider/index.test.tsx @@ -1,9 +1,9 @@ import { act, render } from '@testing-library/react' -import { sendAnalyticsEvent, user } from '@uniswap/analytics' import { InterfaceEventName, WalletConnectionResult } from '@uniswap/analytics-events' import { initializeConnector, MockEIP1193Provider } from '@web3-react/core' import { EIP1193 } from '@web3-react/eip1193' import { Provider as EIP1193Provider } from '@web3-react/types' +import { sendAnalyticsEvent, user } from 'analytics' import { getConnection } from 'connection' import { Connection, ConnectionType } from 'connection/types' import useEagerlyConnect from 'hooks/useEagerlyConnect' @@ -15,7 +15,7 @@ import { mocked } from 'test-utils/mocked' import Web3Provider from '.' -jest.mock('@uniswap/analytics', () => ({ +jest.mock('analytics', () => ({ sendAnalyticsEvent: jest.fn(), user: { set: jest.fn(), postInsert: jest.fn() }, })) diff --git a/src/components/Web3Provider/index.tsx b/src/components/Web3Provider/index.tsx index d6dd0653b6..8ff82adc6f 100644 --- a/src/components/Web3Provider/index.tsx +++ b/src/components/Web3Provider/index.tsx @@ -1,8 +1,8 @@ -import { sendAnalyticsEvent, user } from '@uniswap/analytics' import { CustomUserProperties, InterfaceEventName, WalletConnectionResult } from '@uniswap/analytics-events' import { getWalletMeta } from '@uniswap/conedison/provider/meta' import { useWeb3React, Web3ReactHooks, Web3ReactProvider } from '@web3-react/core' import { Connector } from '@web3-react/types' +import { sendAnalyticsEvent, user } from 'analytics' import { getConnection } from 'connection' import { isSupportedChain } from 'constants/chains' import { RPC_PROVIDERS } from 'constants/providers' diff --git a/src/components/Web3Status/index.tsx b/src/components/Web3Status/index.tsx index 5ca3941d5f..5f90d60e3f 100644 --- a/src/components/Web3Status/index.tsx +++ b/src/components/Web3Status/index.tsx @@ -1,7 +1,7 @@ import { Trans } from '@lingui/macro' -import { sendAnalyticsEvent, TraceEvent } from '@uniswap/analytics' import { BrowserEvent, InterfaceElementName, InterfaceEventName } from '@uniswap/analytics-events' import { useWeb3React } from '@web3-react/core' +import { sendAnalyticsEvent, TraceEvent } from 'analytics' import PortfolioDrawer, { useAccountDrawer } from 'components/AccountDrawer' import PrefetchBalancesWrapper from 'components/AccountDrawer/PrefetchBalancesWrapper' import Loader from 'components/Icons/LoadingSpinner' diff --git a/src/components/swap/AdvancedSwapDetails.tsx b/src/components/swap/AdvancedSwapDetails.tsx index adbbe79b7b..19aa6ad47d 100644 --- a/src/components/swap/AdvancedSwapDetails.tsx +++ b/src/components/swap/AdvancedSwapDetails.tsx @@ -1,9 +1,9 @@ import { Plural, Trans } from '@lingui/macro' -import { sendAnalyticsEvent } from '@uniswap/analytics' import { InterfaceElementName, SwapEventName } from '@uniswap/analytics-events' import { formatCurrencyAmount, formatNumber, formatPriceImpact, NumberType } from '@uniswap/conedison/format' import { Percent, TradeType } from '@uniswap/sdk-core' import { useWeb3React } from '@web3-react/core' +import { sendAnalyticsEvent } from 'analytics' import { LoadingRows } from 'components/Loader/styled' import { SUPPORTED_GAS_ESTIMATE_CHAIN_IDS } from 'constants/chains' import useNativeCurrency from 'lib/hooks/useNativeCurrency' diff --git a/src/components/swap/ConfirmSwapModal.tsx b/src/components/swap/ConfirmSwapModal.tsx index 59c652c998..69ba21b6db 100644 --- a/src/components/swap/ConfirmSwapModal.tsx +++ b/src/components/swap/ConfirmSwapModal.tsx @@ -1,5 +1,4 @@ import { Trans } from '@lingui/macro' -import { sendAnalyticsEvent, Trace, useTrace } from '@uniswap/analytics' import { InterfaceEventName, InterfaceModalName, @@ -9,6 +8,7 @@ import { import { formatCurrencyAmount, NumberType } from '@uniswap/conedison/format' import { Currency, Percent } from '@uniswap/sdk-core' import { useWeb3React } from '@web3-react/core' +import { sendAnalyticsEvent, Trace, useTrace } from 'analytics' import Badge from 'components/Badge' import Modal, { MODAL_TRANSITION_DURATION } from 'components/Modal' import { RowFixed } from 'components/Row' diff --git a/src/components/swap/GasEstimateTooltip.tsx b/src/components/swap/GasEstimateTooltip.tsx index a7c9686815..6a314774b3 100644 --- a/src/components/swap/GasEstimateTooltip.tsx +++ b/src/components/swap/GasEstimateTooltip.tsx @@ -1,7 +1,7 @@ -import { sendAnalyticsEvent } from '@uniswap/analytics' import { InterfaceElementName, SwapEventName } from '@uniswap/analytics-events' import { formatNumber, NumberType } from '@uniswap/conedison/format' import { useWeb3React } from '@web3-react/core' +import { sendAnalyticsEvent } from 'analytics' import { LoadingOpacityContainer } from 'components/Loader/styled' import { UniswapXRouterIcon } from 'components/RouterLabel/UniswapXRouterLabel' import Row, { RowFixed } from 'components/Row' diff --git a/src/components/swap/SwapBuyFiatButton.tsx b/src/components/swap/SwapBuyFiatButton.tsx index 59274f534a..9fd695b499 100644 --- a/src/components/swap/SwapBuyFiatButton.tsx +++ b/src/components/swap/SwapBuyFiatButton.tsx @@ -1,7 +1,7 @@ import { Trans } from '@lingui/macro' -import { TraceEvent } from '@uniswap/analytics' import { BrowserEvent, InterfaceElementName, SharedEventName } from '@uniswap/analytics-events' import { useWeb3React } from '@web3-react/core' +import { TraceEvent } from 'analytics' import { useAccountDrawer } from 'components/AccountDrawer' import { ButtonText } from 'components/Button' import { MouseoverTooltip } from 'components/Tooltip' diff --git a/src/components/swap/SwapDetailsDropdown.tsx b/src/components/swap/SwapDetailsDropdown.tsx index ca3dfe634d..8c047b4e43 100644 --- a/src/components/swap/SwapDetailsDropdown.tsx +++ b/src/components/swap/SwapDetailsDropdown.tsx @@ -1,7 +1,7 @@ import { Trans } from '@lingui/macro' -import { TraceEvent, useTrace } from '@uniswap/analytics' import { BrowserEvent, InterfaceElementName, SwapEventName } from '@uniswap/analytics-events' import { Percent } from '@uniswap/sdk-core' +import { TraceEvent, useTrace } from 'analytics' import AnimatedDropdown from 'components/AnimatedDropdown' import Column from 'components/Column' import { LoadingOpacityContainer } from 'components/Loader/styled' diff --git a/src/components/swap/SwapModalFooter.tsx b/src/components/swap/SwapModalFooter.tsx index e939b31df7..3cabb4a45e 100644 --- a/src/components/swap/SwapModalFooter.tsx +++ b/src/components/swap/SwapModalFooter.tsx @@ -1,9 +1,9 @@ import { Plural, Trans } from '@lingui/macro' -import { TraceEvent } from '@uniswap/analytics' import { BrowserEvent, InterfaceElementName, SwapEventName } from '@uniswap/analytics-events' import { formatNumber, formatPriceImpact, NumberType } from '@uniswap/conedison/format' import { Percent, TradeType } from '@uniswap/sdk-core' import { useWeb3React } from '@web3-react/core' +import { TraceEvent } from 'analytics' import Column from 'components/Column' import { MouseoverTooltip, TooltipSize } from 'components/Tooltip' import { SwapResult } from 'hooks/useSwapCallback' diff --git a/src/connection/WalletConnectV2.ts b/src/connection/WalletConnectV2.ts index cf75f684ad..9f0f83b527 100644 --- a/src/connection/WalletConnectV2.ts +++ b/src/connection/WalletConnectV2.ts @@ -1,6 +1,6 @@ -import { sendAnalyticsEvent } from '@uniswap/analytics' import { ChainId } from '@uniswap/sdk-core' import { URI_AVAILABLE, WalletConnect, WalletConnectConstructorArgs } from '@web3-react/walletconnect-v2' +import { sendAnalyticsEvent } from 'analytics' import { L1_CHAIN_IDS, L2_CHAIN_IDS } from 'constants/chains' import { Z_INDEX } from 'theme/zIndex' import { isIOS } from 'utils/userAgent' diff --git a/src/connection/activate.ts b/src/connection/activate.ts index 9c4b4d3299..4a7583986a 100644 --- a/src/connection/activate.ts +++ b/src/connection/activate.ts @@ -1,6 +1,6 @@ -import { sendAnalyticsEvent } from '@uniswap/analytics' import { InterfaceEventName, WalletConnectionResult } from '@uniswap/analytics-events' import { ChainId } from '@uniswap/sdk-core' +import { sendAnalyticsEvent } from 'analytics' import { Connection } from 'connection/types' import { atom } from 'jotai' import { useAtomValue, useUpdateAtom } from 'jotai/utils' diff --git a/src/hooks/useUniswapXSwapCallback.ts b/src/hooks/useUniswapXSwapCallback.ts index c8bf5023a4..a88b9f4b7d 100644 --- a/src/hooks/useUniswapXSwapCallback.ts +++ b/src/hooks/useUniswapXSwapCallback.ts @@ -1,9 +1,9 @@ -import { sendAnalyticsEvent, useTrace } from '@uniswap/analytics' import { SwapEventName } from '@uniswap/analytics-events' import { signTypedData } from '@uniswap/conedison/provider/signing' import { Percent } from '@uniswap/sdk-core' import { DutchOrder, DutchOrderBuilder } from '@uniswap/uniswapx-sdk' import { useWeb3React } from '@web3-react/core' +import { sendAnalyticsEvent, useTrace } from 'analytics' import { formatSwapSignedAnalyticsEventProperties } from 'lib/utils/analytics' import { useCallback } from 'react' import { DutchOrderTrade, TradeFillType } from 'state/routing/types' diff --git a/src/hooks/useUniversalRouter.ts b/src/hooks/useUniversalRouter.ts index f4d9e90dfd..62471913ac 100644 --- a/src/hooks/useUniversalRouter.ts +++ b/src/hooks/useUniversalRouter.ts @@ -1,11 +1,11 @@ import { BigNumber } from '@ethersproject/bignumber' import { t } from '@lingui/macro' -import { sendAnalyticsEvent, useTrace } from '@uniswap/analytics' import { SwapEventName } from '@uniswap/analytics-events' import { Percent } from '@uniswap/sdk-core' import { SwapRouter, UNIVERSAL_ROUTER_ADDRESS } from '@uniswap/universal-router-sdk' import { FeeOptions, toHex } from '@uniswap/v3-sdk' import { useWeb3React } from '@web3-react/core' +import { sendAnalyticsEvent, useTrace } from 'analytics' import { formatSwapSignedAnalyticsEventProperties } from 'lib/utils/analytics' import { useCallback } from 'react' import { ClassicTrade, TradeFillType } from 'state/routing/types' diff --git a/src/hooks/useWrapCallback.tsx b/src/hooks/useWrapCallback.tsx index 5931d02dad..e5a0b8a16d 100644 --- a/src/hooks/useWrapCallback.tsx +++ b/src/hooks/useWrapCallback.tsx @@ -1,8 +1,8 @@ import { Trans } from '@lingui/macro' -import { sendAnalyticsEvent } from '@uniswap/analytics' import { InterfaceEventName } from '@uniswap/analytics-events' import { Currency } from '@uniswap/sdk-core' import { useWeb3React } from '@web3-react/core' +import { sendAnalyticsEvent } from 'analytics' import useNativeCurrency from 'lib/hooks/useNativeCurrency' import { formatToDecimal, getTokenAddress } from 'lib/utils/analytics' import tryParseCurrencyAmount from 'lib/utils/tryParseCurrencyAmount' diff --git a/src/lib/hooks/useApproval.ts b/src/lib/hooks/useApproval.ts index c90f03ca77..95ed9fff2a 100644 --- a/src/lib/hooks/useApproval.ts +++ b/src/lib/hooks/useApproval.ts @@ -1,9 +1,9 @@ import { MaxUint256 } from '@ethersproject/constants' import type { TransactionResponse } from '@ethersproject/providers' -import { sendAnalyticsEvent } from '@uniswap/analytics' import { InterfaceEventName } from '@uniswap/analytics-events' import { Currency, CurrencyAmount, Token } from '@uniswap/sdk-core' import { useWeb3React } from '@web3-react/core' +import { sendAnalyticsEvent } from 'analytics' import { useTokenContract } from 'hooks/useContract' import { useTokenAllowance } from 'hooks/useTokenAllowance' import { getTokenAddress } from 'lib/utils/analytics' diff --git a/src/nft/components/bag/Bag.tsx b/src/nft/components/bag/Bag.tsx index 0e87da4af8..0b0025f9ca 100644 --- a/src/nft/components/bag/Bag.tsx +++ b/src/nft/components/bag/Bag.tsx @@ -1,6 +1,6 @@ import { Trans } from '@lingui/macro' -import { sendAnalyticsEvent } from '@uniswap/analytics' import { NFTEventName } from '@uniswap/analytics-events' +import { sendAnalyticsEvent } from 'analytics' import { useIsNftDetailsPage, useIsNftPage, useIsNftProfilePage } from 'hooks/useIsNftPage' import { BagFooter } from 'nft/components/bag/BagFooter' import { Box } from 'nft/components/Box' diff --git a/src/nft/components/bag/BagContent.tsx b/src/nft/components/bag/BagContent.tsx index ac6e0a758d..159306f774 100644 --- a/src/nft/components/bag/BagContent.tsx +++ b/src/nft/components/bag/BagContent.tsx @@ -1,5 +1,5 @@ -import { sendAnalyticsEvent, Trace } from '@uniswap/analytics' import { NFTEventName } from '@uniswap/analytics-events' +import { sendAnalyticsEvent, Trace } from 'analytics' import { BagRow, PriceChangeBagRow, UnavailableAssetsHeaderRow } from 'nft/components/bag/BagRow' import { Column } from 'nft/components/Flex' import { useBag, useIsMobile } from 'nft/hooks' diff --git a/src/nft/components/bag/BagFooter.tsx b/src/nft/components/bag/BagFooter.tsx index 7bf286043f..e448d018a1 100644 --- a/src/nft/components/bag/BagFooter.tsx +++ b/src/nft/components/bag/BagFooter.tsx @@ -1,10 +1,10 @@ import { BigNumber } from '@ethersproject/bignumber' import { formatEther, parseEther } from '@ethersproject/units' import { t, Trans } from '@lingui/macro' -import { sendAnalyticsEvent, TraceEvent } from '@uniswap/analytics' import { BrowserEvent, InterfaceElementName, NFTEventName } from '@uniswap/analytics-events' import { ChainId, Currency, CurrencyAmount, Token } from '@uniswap/sdk-core' import { useWeb3React } from '@web3-react/core' +import { sendAnalyticsEvent, TraceEvent } from 'analytics' import { useToggleAccountDrawer } from 'components/AccountDrawer' import Column from 'components/Column' import Loader from 'components/Icons/LoadingSpinner' diff --git a/src/nft/components/collection/ActivityCells.tsx b/src/nft/components/collection/ActivityCells.tsx index eb56f3eb43..71b4ffb194 100644 --- a/src/nft/components/collection/ActivityCells.tsx +++ b/src/nft/components/collection/ActivityCells.tsx @@ -1,7 +1,7 @@ import { Trans } from '@lingui/macro' -import { sendAnalyticsEvent, useTrace } from '@uniswap/analytics' import { InterfacePageName, NFTEventName } from '@uniswap/analytics-events' import { ChainId } from '@uniswap/sdk-core' +import { sendAnalyticsEvent, useTrace } from 'analytics' import { MouseoverTooltip } from 'components/Tooltip' import { NftActivityType, NftMarketplace, OrderStatus } from 'graphql/data/__generated__/types-and-hooks' import { Box } from 'nft/components/Box' diff --git a/src/nft/components/collection/ActivitySwitcher.tsx b/src/nft/components/collection/ActivitySwitcher.tsx index bf5451f4c7..9bd881dcae 100644 --- a/src/nft/components/collection/ActivitySwitcher.tsx +++ b/src/nft/components/collection/ActivitySwitcher.tsx @@ -1,5 +1,5 @@ -import { TraceEvent } from '@uniswap/analytics' import { BrowserEvent, InterfaceElementName, NFTEventName } from '@uniswap/analytics-events' +import { TraceEvent } from 'analytics' import { Box } from 'nft/components/Box' import { Row } from 'nft/components/Flex' import { useIsCollectionLoading } from 'nft/hooks' diff --git a/src/nft/components/collection/CollectionAsset.tsx b/src/nft/components/collection/CollectionAsset.tsx index ab2dbdb1e0..f911909e35 100644 --- a/src/nft/components/collection/CollectionAsset.tsx +++ b/src/nft/components/collection/CollectionAsset.tsx @@ -1,7 +1,7 @@ import { BigNumber } from '@ethersproject/bignumber' import { Trans } from '@lingui/macro' -import { sendAnalyticsEvent, useTrace } from '@uniswap/analytics' import { InterfacePageName, NFTEventName } from '@uniswap/analytics-events' +import { sendAnalyticsEvent, useTrace } from 'analytics' import { NftCard, NftCardDisplayProps } from 'nft/components/card' import { Ranking as RankingContainer, Suspicious as SuspiciousContainer } from 'nft/components/card/icons' import { useBag } from 'nft/hooks' diff --git a/src/nft/components/collection/CollectionNfts.tsx b/src/nft/components/collection/CollectionNfts.tsx index b93fb38c74..f76809410d 100644 --- a/src/nft/components/collection/CollectionNfts.tsx +++ b/src/nft/components/collection/CollectionNfts.tsx @@ -1,7 +1,7 @@ import { BigNumber } from '@ethersproject/bignumber' -import { TraceEvent } from '@uniswap/analytics' import { BrowserEvent, InterfaceElementName, NFTEventName } from '@uniswap/analytics-events' import { useWeb3React } from '@web3-react/core' +import { TraceEvent } from 'analytics' import clsx from 'clsx' import { OpacityHoverState } from 'components/Common' import { parseEther } from 'ethers/lib/utils' diff --git a/src/nft/components/collection/MarketplaceSelect.tsx b/src/nft/components/collection/MarketplaceSelect.tsx index 3faa1e4971..3fef8e7a01 100644 --- a/src/nft/components/collection/MarketplaceSelect.tsx +++ b/src/nft/components/collection/MarketplaceSelect.tsx @@ -1,5 +1,5 @@ -import { sendAnalyticsEvent } from '@uniswap/analytics' import { NFTEventName, NFTFilterTypes } from '@uniswap/analytics-events' +import { sendAnalyticsEvent } from 'analytics' import clsx from 'clsx' import { Box } from 'nft/components/Box' import * as styles from 'nft/components/collection/Filters.css' diff --git a/src/nft/components/collection/PriceRange.tsx b/src/nft/components/collection/PriceRange.tsx index 7ffd192be1..db4db1d0e0 100644 --- a/src/nft/components/collection/PriceRange.tsx +++ b/src/nft/components/collection/PriceRange.tsx @@ -1,7 +1,7 @@ import 'rc-slider/assets/index.css' -import { sendAnalyticsEvent } from '@uniswap/analytics' import { NFTEventName, NFTFilterTypes } from '@uniswap/analytics-events' +import { sendAnalyticsEvent } from 'analytics' import { Box } from 'nft/components/Box' import { Row } from 'nft/components/Flex' import { NumericInput } from 'nft/components/layout/Input' diff --git a/src/nft/components/collection/TraitSelect.tsx b/src/nft/components/collection/TraitSelect.tsx index 8f2fd6c5ab..ca60e19c82 100644 --- a/src/nft/components/collection/TraitSelect.tsx +++ b/src/nft/components/collection/TraitSelect.tsx @@ -1,5 +1,5 @@ -import { sendAnalyticsEvent } from '@uniswap/analytics' import { NFTEventName, NFTFilterTypes } from '@uniswap/analytics-events' +import { sendAnalyticsEvent } from 'analytics' import useDebounce from 'hooks/useDebounce' import { Box } from 'nft/components/Box' import { Column, Row } from 'nft/components/Flex' diff --git a/src/nft/components/collection/TransactionCompleteModal.tsx b/src/nft/components/collection/TransactionCompleteModal.tsx index 57756cc958..d106841326 100644 --- a/src/nft/components/collection/TransactionCompleteModal.tsx +++ b/src/nft/components/collection/TransactionCompleteModal.tsx @@ -1,7 +1,7 @@ import { formatEther } from '@ethersproject/units' import { Trans } from '@lingui/macro' -import { Trace, useTrace } from '@uniswap/analytics' import { InterfaceModalName, NFTEventName } from '@uniswap/analytics-events' +import { Trace, useTrace } from 'analytics' import clsx from 'clsx' import { OpacityHoverState } from 'components/Common' import { Box } from 'nft/components/Box' diff --git a/src/nft/components/details/AssetPriceDetails.tsx b/src/nft/components/details/AssetPriceDetails.tsx index aa6fb10756..84b91f9e0d 100644 --- a/src/nft/components/details/AssetPriceDetails.tsx +++ b/src/nft/components/details/AssetPriceDetails.tsx @@ -1,7 +1,6 @@ -import { useTrace } from '@uniswap/analytics' -import { sendAnalyticsEvent } from '@uniswap/analytics' import { NFTEventName } from '@uniswap/analytics-events' import { useWeb3React } from '@web3-react/core' +import { sendAnalyticsEvent, useTrace } from 'analytics' import { OpacityHoverState } from 'components/Common' import { useNftBalance } from 'graphql/data/nft/NftBalance' import { CancelListingIcon, VerifiedIcon } from 'nft/components/icons' diff --git a/src/nft/components/explore/Table.tsx b/src/nft/components/explore/Table.tsx index 25ba4007de..7a2e630830 100644 --- a/src/nft/components/explore/Table.tsx +++ b/src/nft/components/explore/Table.tsx @@ -1,6 +1,6 @@ -import { TraceEvent } from '@uniswap/analytics' import { BrowserEvent, InterfaceElementName, NFTEventName } from '@uniswap/analytics-events' import { useWeb3React } from '@web3-react/core' +import { TraceEvent } from 'analytics' import { LoadingBubble } from 'components/Tokens/loading' import { useWindowSize } from 'hooks/useWindowSize' import { useIsMobile } from 'nft/hooks' diff --git a/src/nft/components/profile/list/ListPage.tsx b/src/nft/components/profile/list/ListPage.tsx index 3e97afa175..29d3d463ae 100644 --- a/src/nft/components/profile/list/ListPage.tsx +++ b/src/nft/components/profile/list/ListPage.tsx @@ -1,8 +1,8 @@ import { Trans } from '@lingui/macro' -import { sendAnalyticsEvent, useTrace } from '@uniswap/analytics' import { InterfaceModalName, NFTEventName } from '@uniswap/analytics-events' import { formatCurrencyAmount, NumberType } from '@uniswap/conedison/format' import { useWeb3React } from '@web3-react/core' +import { sendAnalyticsEvent, useTrace } from 'analytics' import Column from 'components/Column' import Row from 'components/Row' import { useStablecoinValue } from 'hooks/useStablecoinPrice' diff --git a/src/nft/components/profile/list/Modal/ListModal.tsx b/src/nft/components/profile/list/Modal/ListModal.tsx index 56e18fdb76..7c0e1bbcfe 100644 --- a/src/nft/components/profile/list/Modal/ListModal.tsx +++ b/src/nft/components/profile/list/Modal/ListModal.tsx @@ -1,8 +1,8 @@ import { Trans } from '@lingui/macro' -import { sendAnalyticsEvent, Trace, useTrace } from '@uniswap/analytics' import { InterfaceModalName, NFTEventName } from '@uniswap/analytics-events' import { formatCurrencyAmount, NumberType } from '@uniswap/conedison/format' import { useWeb3React } from '@web3-react/core' +import { sendAnalyticsEvent, Trace, useTrace } from 'analytics' import { useStablecoinValue } from 'hooks/useStablecoinPrice' import useNativeCurrency from 'lib/hooks/useNativeCurrency' import tryParseCurrencyAmount from 'lib/utils/tryParseCurrencyAmount' diff --git a/src/nft/components/profile/view/ViewMyNftsAsset.tsx b/src/nft/components/profile/view/ViewMyNftsAsset.tsx index f6e9d687d7..c77763cf04 100644 --- a/src/nft/components/profile/view/ViewMyNftsAsset.tsx +++ b/src/nft/components/profile/view/ViewMyNftsAsset.tsx @@ -1,7 +1,6 @@ import { Trans } from '@lingui/macro' -import { useTrace } from '@uniswap/analytics' -import { sendAnalyticsEvent } from '@uniswap/analytics' import { NFTEventName } from '@uniswap/analytics-events' +import { sendAnalyticsEvent, useTrace } from 'analytics' import { NftCard, NftCardDisplayProps } from 'nft/components/card' import { detailsHref } from 'nft/components/card/utils' import { VerifiedIcon } from 'nft/components/icons' diff --git a/src/nft/hooks/usePermit2Approval.ts b/src/nft/hooks/usePermit2Approval.ts index 69d9aa4476..4c8c01b84d 100644 --- a/src/nft/hooks/usePermit2Approval.ts +++ b/src/nft/hooks/usePermit2Approval.ts @@ -1,8 +1,8 @@ -import { sendAnalyticsEvent } from '@uniswap/analytics' import { InterfaceEventName } from '@uniswap/analytics-events' import { ChainId, CurrencyAmount, Token } from '@uniswap/sdk-core' import { UNIVERSAL_ROUTER_ADDRESS } from '@uniswap/universal-router-sdk' import { useWeb3React } from '@web3-react/core' +import { sendAnalyticsEvent } from 'analytics' import { isSupportedChain } from 'constants/chains' import usePermit2Allowance, { AllowanceState } from 'hooks/usePermit2Allowance' import { useCallback, useMemo, useState } from 'react' diff --git a/src/nft/hooks/useSendTransaction.ts b/src/nft/hooks/useSendTransaction.ts index 22ed8b9341..136a61c778 100644 --- a/src/nft/hooks/useSendTransaction.ts +++ b/src/nft/hooks/useSendTransaction.ts @@ -3,8 +3,8 @@ import { BigNumber } from '@ethersproject/bignumber' import { hexStripZeros } from '@ethersproject/bytes' import { ContractReceipt } from '@ethersproject/contracts' import type { JsonRpcSigner } from '@ethersproject/providers' -import { sendAnalyticsEvent } from '@uniswap/analytics' import { NFTEventName } from '@uniswap/analytics-events' +import { sendAnalyticsEvent } from 'analytics' import { create } from 'zustand' import { devtools } from 'zustand/middleware' diff --git a/src/nft/pages/asset/Asset.tsx b/src/nft/pages/asset/Asset.tsx index c8babd86f8..e0df5f4ac0 100644 --- a/src/nft/pages/asset/Asset.tsx +++ b/src/nft/pages/asset/Asset.tsx @@ -1,5 +1,5 @@ -import { Trace } from '@uniswap/analytics' import { InterfacePageName } from '@uniswap/analytics-events' +import { Trace } from 'analytics' import { useDetailsV2Enabled } from 'featureFlags/flags/nftDetails' import { useNftAssetDetails } from 'graphql/data/nft/Details' import { AssetDetails } from 'nft/components/details/AssetDetails' diff --git a/src/nft/pages/collection/index.tsx b/src/nft/pages/collection/index.tsx index f57c439b04..c5694650d1 100644 --- a/src/nft/pages/collection/index.tsx +++ b/src/nft/pages/collection/index.tsx @@ -1,6 +1,6 @@ -import { Trace } from '@uniswap/analytics' import { InterfacePageName } from '@uniswap/analytics-events' import { useWeb3React } from '@web3-react/core' +import { Trace } from 'analytics' import Column from 'components/Column' import { OpacityHoverState } from 'components/Common' import Row from 'components/Row' diff --git a/src/nft/pages/explore/index.tsx b/src/nft/pages/explore/index.tsx index 8a031db7db..c5540b3662 100644 --- a/src/nft/pages/explore/index.tsx +++ b/src/nft/pages/explore/index.tsx @@ -1,5 +1,5 @@ -import { Trace } from '@uniswap/analytics' import { InterfacePageName } from '@uniswap/analytics-events' +import { Trace } from 'analytics' import Banner from 'nft/components/explore/Banner' import TrendingCollections from 'nft/components/explore/TrendingCollections' import { useBag } from 'nft/hooks' diff --git a/src/nft/pages/profile/profile.tsx b/src/nft/pages/profile/profile.tsx index d4cf4d6d88..36399f7144 100644 --- a/src/nft/pages/profile/profile.tsx +++ b/src/nft/pages/profile/profile.tsx @@ -1,7 +1,7 @@ import { Trans } from '@lingui/macro' -import { Trace } from '@uniswap/analytics' import { InterfacePageName } from '@uniswap/analytics-events' import { useWeb3React } from '@web3-react/core' +import { Trace } from 'analytics' import { useToggleAccountDrawer } from 'components/AccountDrawer' import { ButtonPrimary } from 'components/Button' import { XXXL_BAG_WIDTH } from 'nft/components/bag/Bag' diff --git a/src/pages/AddLiquidity/index.tsx b/src/pages/AddLiquidity/index.tsx index fbb5e4266c..7258a3bca5 100644 --- a/src/pages/AddLiquidity/index.tsx +++ b/src/pages/AddLiquidity/index.tsx @@ -1,11 +1,11 @@ import { BigNumber } from '@ethersproject/bignumber' import type { TransactionResponse } from '@ethersproject/providers' import { Trans } from '@lingui/macro' -import { TraceEvent } from '@uniswap/analytics' import { BrowserEvent, InterfaceElementName, InterfaceEventName } from '@uniswap/analytics-events' import { Currency, CurrencyAmount, NONFUNGIBLE_POSITION_MANAGER_ADDRESSES, Percent } from '@uniswap/sdk-core' import { FeeAmount, NonfungiblePositionManager } from '@uniswap/v3-sdk' import { useWeb3React } from '@web3-react/core' +import { TraceEvent } from 'analytics' import { useToggleAccountDrawer } from 'components/AccountDrawer' import OwnershipWarning from 'components/addLiquidity/OwnershipWarning' import { sendEvent } from 'components/analytics' diff --git a/src/pages/AddLiquidityV2/index.tsx b/src/pages/AddLiquidityV2/index.tsx index 307f13b6f3..daa00b9c73 100644 --- a/src/pages/AddLiquidityV2/index.tsx +++ b/src/pages/AddLiquidityV2/index.tsx @@ -1,10 +1,10 @@ import { BigNumber } from '@ethersproject/bignumber' import type { TransactionResponse } from '@ethersproject/providers' import { Trans } from '@lingui/macro' -import { TraceEvent } from '@uniswap/analytics' import { BrowserEvent, InterfaceElementName, InterfaceEventName } from '@uniswap/analytics-events' import { Currency, CurrencyAmount, Percent } from '@uniswap/sdk-core' import { useWeb3React } from '@web3-react/core' +import { TraceEvent } from 'analytics' import { useToggleAccountDrawer } from 'components/AccountDrawer' import { sendEvent } from 'components/analytics' import UnsupportedCurrencyFooter from 'components/swap/UnsupportedCurrencyFooter' diff --git a/src/pages/App.tsx b/src/pages/App.tsx index 7da2e9113a..445904574c 100644 --- a/src/pages/App.tsx +++ b/src/pages/App.tsx @@ -1,6 +1,6 @@ -import { getDeviceId, sendAnalyticsEvent, Trace, user } from '@uniswap/analytics' import { CustomUserProperties, getBrowser, SharedEventName } from '@uniswap/analytics-events' import { useWeb3React } from '@web3-react/core' +import { getDeviceId, sendAnalyticsEvent, Trace, user } from 'analytics' import Loader from 'components/Icons/LoadingSpinner' import TopLevelModals from 'components/TopLevelModals' import { useFeatureFlagsIsLoaded } from 'featureFlags' diff --git a/src/pages/CreateProposal/index.tsx b/src/pages/CreateProposal/index.tsx index 7ad389f93e..343170c988 100644 --- a/src/pages/CreateProposal/index.tsx +++ b/src/pages/CreateProposal/index.tsx @@ -1,10 +1,10 @@ import { defaultAbiCoder } from '@ethersproject/abi' import { getAddress, isAddress } from '@ethersproject/address' import { Trans } from '@lingui/macro' -import { Trace } from '@uniswap/analytics' import { InterfacePageName } from '@uniswap/analytics-events' import { Currency, CurrencyAmount, Token } from '@uniswap/sdk-core' import { useWeb3React } from '@web3-react/core' +import { Trace } from 'analytics' import { ButtonError } from 'components/Button' import { BlueCard } from 'components/Card' import { AutoColumn } from 'components/Column' diff --git a/src/pages/Landing/index.tsx b/src/pages/Landing/index.tsx index 375c7f9010..aee59c28e5 100644 --- a/src/pages/Landing/index.tsx +++ b/src/pages/Landing/index.tsx @@ -1,6 +1,6 @@ import { Trans } from '@lingui/macro' -import { Trace, TraceEvent } from '@uniswap/analytics' import { BrowserEvent, InterfaceElementName, InterfacePageName, SharedEventName } from '@uniswap/analytics-events' +import { Trace, TraceEvent } from 'analytics' import { AboutFooter } from 'components/About/AboutFooter' import Card, { CardType } from 'components/About/Card' import { MAIN_CARDS, MORE_CARDS } from 'components/About/constants' diff --git a/src/pages/NotFound/index.tsx b/src/pages/NotFound/index.tsx index 21bd03f5ff..4cbd4dde14 100644 --- a/src/pages/NotFound/index.tsx +++ b/src/pages/NotFound/index.tsx @@ -1,6 +1,6 @@ import { Trans } from '@lingui/macro' -import { Trace } from '@uniswap/analytics' import { InterfacePageName } from '@uniswap/analytics-events' +import { Trace } from 'analytics' import { SmallButtonPrimary } from 'components/Button' import { useIsMobile } from 'nft/hooks' import { Link } from 'react-router-dom' diff --git a/src/pages/Pool/PositionPage.tsx b/src/pages/Pool/PositionPage.tsx index 097f31006e..85309f9522 100644 --- a/src/pages/Pool/PositionPage.tsx +++ b/src/pages/Pool/PositionPage.tsx @@ -1,12 +1,12 @@ import { BigNumber } from '@ethersproject/bignumber' import type { TransactionResponse } from '@ethersproject/providers' import { Trans } from '@lingui/macro' -import { Trace } from '@uniswap/analytics' import { InterfacePageName } from '@uniswap/analytics-events' import { formatPrice, NumberType } from '@uniswap/conedison/format' import { ChainId, Currency, CurrencyAmount, Fraction, Percent, Price, Token } from '@uniswap/sdk-core' import { NonfungiblePositionManager, Pool, Position } from '@uniswap/v3-sdk' import { useWeb3React } from '@web3-react/core' +import { Trace } from 'analytics' import { sendEvent } from 'components/analytics' import Badge from 'components/Badge' import { ButtonConfirmed, ButtonGray, ButtonPrimary } from 'components/Button' diff --git a/src/pages/Pool/index.tsx b/src/pages/Pool/index.tsx index d1b42d5893..0ddf2e51a3 100644 --- a/src/pages/Pool/index.tsx +++ b/src/pages/Pool/index.tsx @@ -1,8 +1,8 @@ import { Trans } from '@lingui/macro' -import { Trace, TraceEvent } from '@uniswap/analytics' import { BrowserEvent, InterfaceElementName, InterfaceEventName, InterfacePageName } from '@uniswap/analytics-events' import { V2_FACTORY_ADDRESSES } from '@uniswap/sdk-core' import { useWeb3React } from '@web3-react/core' +import { Trace, TraceEvent } from 'analytics' import { useToggleAccountDrawer } from 'components/AccountDrawer' import { ButtonGray, ButtonPrimary, ButtonText } from 'components/Button' import { AutoColumn } from 'components/Column' diff --git a/src/pages/Pool/v2.tsx b/src/pages/Pool/v2.tsx index 7b996807cd..38caff4e19 100644 --- a/src/pages/Pool/v2.tsx +++ b/src/pages/Pool/v2.tsx @@ -1,8 +1,8 @@ import { Trans } from '@lingui/macro' -import { Trace } from '@uniswap/analytics' import { InterfacePageName } from '@uniswap/analytics-events' import { Pair } from '@uniswap/v2-sdk' import { useWeb3React } from '@web3-react/core' +import { Trace } from 'analytics' import { UNSUPPORTED_V2POOL_CHAIN_IDS } from 'constants/chains' import JSBI from 'jsbi' import { useMemo } from 'react' diff --git a/src/pages/PoolFinder/index.tsx b/src/pages/PoolFinder/index.tsx index bde79d18dc..cefbec34b6 100644 --- a/src/pages/PoolFinder/index.tsx +++ b/src/pages/PoolFinder/index.tsx @@ -1,8 +1,8 @@ import { Trans } from '@lingui/macro' -import { Trace } from '@uniswap/analytics' import { InterfacePageName } from '@uniswap/analytics-events' import { Currency, CurrencyAmount, Token } from '@uniswap/sdk-core' import { useWeb3React } from '@web3-react/core' +import { Trace } from 'analytics' import JSBI from 'jsbi' import { useCallback, useEffect, useState } from 'react' import { Plus } from 'react-feather' diff --git a/src/pages/RemoveLiquidity/index.tsx b/src/pages/RemoveLiquidity/index.tsx index 3cf00b16e9..df04b82355 100644 --- a/src/pages/RemoveLiquidity/index.tsx +++ b/src/pages/RemoveLiquidity/index.tsx @@ -2,10 +2,10 @@ import { BigNumber } from '@ethersproject/bignumber' import { Contract } from '@ethersproject/contracts' import type { TransactionResponse } from '@ethersproject/providers' import { Trans } from '@lingui/macro' -import { TraceEvent } from '@uniswap/analytics' import { BrowserEvent, InterfaceElementName, InterfaceEventName } from '@uniswap/analytics-events' import { Currency, Percent } from '@uniswap/sdk-core' import { useWeb3React } from '@web3-react/core' +import { TraceEvent } from 'analytics' import { useToggleAccountDrawer } from 'components/AccountDrawer' import { sendEvent } from 'components/analytics' import { isSupportedChain } from 'constants/chains' diff --git a/src/pages/Swap/UniswapXOptIn.tsx b/src/pages/Swap/UniswapXOptIn.tsx index 2c4683b189..f977649027 100644 --- a/src/pages/Swap/UniswapXOptIn.tsx +++ b/src/pages/Swap/UniswapXOptIn.tsx @@ -1,5 +1,5 @@ import { Trans } from '@lingui/macro' -import { sendAnalyticsEvent, Trace } from '@uniswap/analytics' +import { sendAnalyticsEvent, Trace } from 'analytics' import Column from 'components/Column' import UniswapXBrandMark from 'components/Logo/UniswapXBrandMark' import { Arrow } from 'components/Popover' diff --git a/src/pages/Swap/index.tsx b/src/pages/Swap/index.tsx index 7631a4d6db..ebe07c1abd 100644 --- a/src/pages/Swap/index.tsx +++ b/src/pages/Swap/index.tsx @@ -1,5 +1,4 @@ import { Trans } from '@lingui/macro' -import { sendAnalyticsEvent, Trace, TraceEvent, useTrace } from '@uniswap/analytics' import { BrowserEvent, InterfaceElementName, @@ -13,6 +12,7 @@ import { formatCurrencyAmount, NumberType } from '@uniswap/conedison/format' import { ChainId, Currency, CurrencyAmount, Percent, Token } from '@uniswap/sdk-core' import { UNIVERSAL_ROUTER_ADDRESS } from '@uniswap/universal-router-sdk' import { useWeb3React } from '@web3-react/core' +import { sendAnalyticsEvent, Trace, TraceEvent, useTrace } from 'analytics' import { useToggleAccountDrawer } from 'components/AccountDrawer' import AddressInputPanel from 'components/AddressInputPanel' import { ButtonError, ButtonLight, ButtonPrimary } from 'components/Button' diff --git a/src/pages/Tokens/index.tsx b/src/pages/Tokens/index.tsx index 3ef5d4c997..44c90fcde7 100644 --- a/src/pages/Tokens/index.tsx +++ b/src/pages/Tokens/index.tsx @@ -1,6 +1,6 @@ import { Trans } from '@lingui/macro' -import { Trace } from '@uniswap/analytics' import { InterfacePageName } from '@uniswap/analytics-events' +import { Trace } from 'analytics' import { MAX_WIDTH_MEDIA_BREAKPOINT, MEDIUM_MEDIA_BREAKPOINT } from 'components/Tokens/constants' import { filterStringAtom } from 'components/Tokens/state' import NetworkFilter from 'components/Tokens/TokenTable/NetworkFilter' diff --git a/src/pages/Vote/Landing.tsx b/src/pages/Vote/Landing.tsx index e6fbf37e28..c689ce4223 100644 --- a/src/pages/Vote/Landing.tsx +++ b/src/pages/Vote/Landing.tsx @@ -1,8 +1,8 @@ import { Trans } from '@lingui/macro' -import { Trace } from '@uniswap/analytics' import { InterfacePageName } from '@uniswap/analytics-events' import { CurrencyAmount, Token } from '@uniswap/sdk-core' import { useWeb3React } from '@web3-react/core' +import { Trace } from 'analytics' import { ButtonPrimary } from 'components/Button' import { AutoColumn } from 'components/Column' import { CardBGImage, CardNoise, CardSection, DataCard } from 'components/earn/styled' diff --git a/src/pages/Vote/VotePage.tsx b/src/pages/Vote/VotePage.tsx index cf65733596..ff32695d11 100644 --- a/src/pages/Vote/VotePage.tsx +++ b/src/pages/Vote/VotePage.tsx @@ -1,9 +1,9 @@ import { BigNumber } from '@ethersproject/bignumber' import { Trans } from '@lingui/macro' -import { Trace } from '@uniswap/analytics' import { InterfacePageName } from '@uniswap/analytics-events' import { CurrencyAmount, Fraction, Token } from '@uniswap/sdk-core' import { useWeb3React } from '@web3-react/core' +import { Trace } from 'analytics' import ExecuteModal from 'components/vote/ExecuteModal' import QueueModal from 'components/vote/QueueModal' import { useActiveLocale } from 'hooks/useActiveLocale' diff --git a/src/state/application/hooks.ts b/src/state/application/hooks.ts index 4c9d52d7f3..8504f8216e 100644 --- a/src/state/application/hooks.ts +++ b/src/state/application/hooks.ts @@ -1,5 +1,5 @@ -import { sendAnalyticsEvent } from '@uniswap/analytics' import { MoonpayEventName } from '@uniswap/analytics-events' +import { sendAnalyticsEvent } from 'analytics' import { DEFAULT_TXN_DISMISS_MS } from 'constants/misc' import { useCallback, useEffect, useMemo, useState } from 'react' import { useAppDispatch, useAppSelector } from 'state/hooks' diff --git a/src/tracing/index.ts b/src/tracing/index.ts index 9c7f307cb5..13cd241b7d 100644 --- a/src/tracing/index.ts +++ b/src/tracing/index.ts @@ -2,8 +2,8 @@ import 'components/analytics' import * as Sentry from '@sentry/react' import { BrowserTracing } from '@sentry/tracing' -import { initializeAnalytics, OriginApplication } from '@uniswap/analytics' import { SharedEventName } from '@uniswap/analytics-events' +import { initializeAnalytics, OriginApplication } from 'analytics' import { isSentryEnabled } from 'utils/env' import { getEnvName, isProductionEnv } from 'utils/env' import { v4 as uuidv4 } from 'uuid' diff --git a/src/utils/openDownloadApp.ts b/src/utils/openDownloadApp.ts index eada523106..0bca3a4cd5 100644 --- a/src/utils/openDownloadApp.ts +++ b/src/utils/openDownloadApp.ts @@ -1,5 +1,5 @@ -import { sendAnalyticsEvent } from '@uniswap/analytics' import { InterfaceElementName, InterfaceEventName } from '@uniswap/analytics-events' +import { sendAnalyticsEvent } from 'analytics' import { isIOS } from 'utils/userAgent' const APP_STORE_LINK = 'https://apps.apple.com/app/apple-store/id6443944476'