Skip to content

Commit 0768b26

Browse files
committed
update navigation to include information related to first visit
1 parent 7832eb3 commit 0768b26

File tree

5 files changed

+23
-5
lines changed

5 files changed

+23
-5
lines changed

packages/checkout/src/components/SequenceCheckoutProvider/SequenceCheckoutProvider.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ export type SequenceCheckoutProviderProps = {
5656
const getDefaultLocationCheckout = (): NavigationCheckout => {
5757
return {
5858
location: 'payment-method-selection',
59-
params: {}
59+
params: {
60+
isFirstVisit: true
61+
}
6062
}
6163
}
6264
export const SequenceCheckoutProvider = ({ children, config }: SequenceCheckoutProviderProps) => {

packages/checkout/src/contexts/NavigationCheckout.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export interface PaymentMethodSelectionParams {
77
address: string
88
chainId: number
99
}
10+
isFirstVisit: boolean
1011
}
1112

1213
export interface PaymentMehodSelection {

packages/checkout/src/views/Checkout/PaymentMethodSelect/PayWithCrypto/index.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { useAccount, useChainId, usePublicClient, useReadContract, useSwitchChai
2424

2525
import { ERC_20_CONTRACT_ABI } from '../../../../constants/abi.js'
2626
import { EVENT_SOURCE } from '../../../../constants/index.js'
27+
import { type PaymentMethodSelectionParams } from '../../../../contexts/NavigationCheckout.js'
2728
import type { SelectPaymentSettings } from '../../../../contexts/SelectPaymentModal.js'
2829
import { useAddFundsModal } from '../../../../hooks/index.js'
2930
import { useSelectPaymentModal, useTransactionStatusModal } from '../../../../hooks/index.js'
@@ -46,6 +47,21 @@ export const PayWithCryptoTab = ({ skipOnCloseCallback, isSwitchingChainRef }: P
4647
const [isError, setIsError] = useState<boolean>(false)
4748
const { navigation, setNavigation } = useNavigationCheckout()
4849

50+
const isFirstVisit = (navigation.params as PaymentMethodSelectionParams).isFirstVisit
51+
console.log('isFirstVisit', isFirstVisit)
52+
53+
useEffect(() => {
54+
setTimeout(() => {
55+
setNavigation({
56+
location: 'payment-method-selection',
57+
params: {
58+
...navigation.params,
59+
isFirstVisit: false
60+
}
61+
})
62+
}, 5000)
63+
}, [])
64+
4965
const {
5066
chain,
5167
collectibles,

packages/checkout/src/views/Checkout/TokenSelection/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ export const TokenSelectionContent = () => {
124124
selectedCurrency: {
125125
address: token.contractAddress,
126126
chainId: token.chainId
127-
}
127+
},
128+
isFirstVisit: false
128129
}
129130
}
130131
])

packages/connect/src/styles.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2500,6 +2500,4 @@ export const styles = String.raw`
25002500
--tw-gradient-to-position: 100%;
25012501
}
25022502
}
2503-
}
2504-
2505-
`
2503+
}`

0 commit comments

Comments
 (0)