fix: log opt in impression (#6959)

* fix: log opt in impression

* fix: move trace up to parent level
This commit is contained in:
eddie 2023-07-17 10:06:42 -07:00 committed by GitHub
parent b722a20d96
commit ca02a6b56a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -30,6 +30,7 @@ import { ThemedText } from 'theme'
export const UniswapXOptIn = (props: { swapInfo: SwapInfo; isSmall: boolean }) => {
const {
trade: { trade },
allowedSlippage,
} = props.swapInfo
const userDisabledUniswapX = useUserDisabledUniswapX()
const isOnClassic = Boolean(trade && isClassicTrade(trade) && trade.isUniswapXBetter && !userDisabledUniswapX)
@ -44,7 +45,15 @@ export const UniswapXOptIn = (props: { swapInfo: SwapInfo; isSmall: boolean }) =
return null
}
return <OptInContents isOnClassic={isOnClassic} {...props} />
return (
<Trace
shouldLogImpression
name="UniswapX Opt In Impression"
properties={trade ? formatCommonPropertiesForTrade(trade, allowedSlippage) : undefined}
>
<OptInContents isOnClassic={isOnClassic} {...props} />
</Trace>
)
}
const OptInContents = ({
@ -111,20 +120,8 @@ const OptInContents = ({
const containerRef = useRef<HTMLDivElement>()
const wrapTrace = (children: JSX.Element) => {
return (
<Trace
shouldLogImpression={isVisible}
name="UniswapX Opt In Impression"
properties={trade ? formatCommonPropertiesForTrade(trade, allowedSlippage) : undefined}
>
{children}
</Trace>
)
}
if (isSmall) {
return wrapTrace(
return (
<SwapOptInSmallContainer ref={containerRef as any} visible={isVisible} shouldAnimate={shouldAnimate}>
<SwapMustache>
<UniswapXShine />
@ -143,7 +140,7 @@ const OptInContents = ({
)
}
return wrapTrace(
return (
<>
{/* first popover: intro */}
<UniswapXOptInPopover shiny visible={isVisible && !showYoureIn}>