Skip to content

Commit e64e47a

Browse files
jjramireznkushagrasaratheZishan-7Hugo0
authored
[TASK-14052] Prod release 105 (#1122)
* feat: handle send link claims to bank account for peanut users (#1078) * reafactor: create reusable country list component and use it for all the flows * feat: reusable user accounts components * feat: handle different cases based on kyc status for bank claim * fix: account creation * chore: add docstring to hooks * chore: better comments for bank flow manager * fix: kyc modal closing after tos acceptance issue * fix: remove bank acc caching from withdraw flow * fix: update confirm claim modal copy * fix: remove bank acc caching from claim flow * fix: navheader title * remove duplicate debounce code and use `useDebounce` hook instead (#1079) * Landing page v2.1 (#1089) * lpv2.1 part 1 * Add exchange widget * add and integrate exchange API * add yourMoney component bg * update landing countries svg * integrate frankfurter API * fixes and improvements * decrease hero section height * allow max 2 decimal places * Add `/exchange` route * fix: overlay * make destination amount editable and bugg fixes * some fixes & currency improvements * crucial commit * fix checkmark, font size and weight --------- Co-authored-by: Hugo Montenegro <[email protected]> * [TASK-13186] refactor: use networkName instead of axelarChainName (#1095) * refactor: use networkName instead of axelarChainName * fix: types * fix: onramp currency (#1096) * fix: stretched favicon (#1099) * [TASK-13971] fix: scientific notation in eip681 parsing (#1097) * fix: scientific notation in eip681 parsing * fix: qr handling tests * fix: peanut sdk mock * pull iban hotfix (#1100) * fix: claim flow bugs (#1102) * fix: cross chain claim * fix: full name issue on confirm bank claim view * fix: back navigation on desktop views * Fix back button not working on /profile (#1101) * Fix back button not working * fix public profile page * extract internal navigation logic to utility function * fix: send link claims to us bank accounts (#1108) * fix: usa bank account claims * fix: show bank account details in confirm claim view * Sync Landing page changes (#1111) * reduce clouds size and update font * fix: hero section responsiveness issue * fix: formatting errors * add currency animation * fix: us bank claims after kyc for logged in users (#1112) * fix: trim account form inputs for spaces (#1114) * [TASK-14107] fix: don't allow claiming on xChain if route is not found (#1115) * fix: don't allow claiming on xChain if route is not found * fix(claim): use correct decimals for min receive amount * feat: handle redirect uri when on unsupported browsers (#1117) * feat: handle redirect uri when on unsupported browsers * fix: confirm bank claim ui rows for iban guest claim * remove animation (#1118) * fix: formatting --------- Co-authored-by: Kushagra Sarathe <[email protected]> Co-authored-by: Mohd Zishan <[email protected]> Co-authored-by: Hugo Montenegro <[email protected]>
1 parent da2c464 commit e64e47a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1440
-871
lines changed

src/app/(mobile-ui)/claim/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export async function generateMetadata({
9797
description,
9898
...(siteUrl ? { metadataBase: new URL(siteUrl) } : {}),
9999
icons: {
100-
icon: '/logo-favicon.png',
100+
icon: '/favicon.ico',
101101
},
102102
openGraph: {
103103
title,

src/app/(mobile-ui)/home/page.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ import { AccountType } from '@/interfaces'
3838
import { formatUnits } from 'viem'
3939
import { PEANUT_WALLET_TOKEN_DECIMALS } from '@/constants'
4040
import { PostSignupActionManager } from '@/components/Global/PostSignupActionManager'
41-
import { useGuestFlow } from '@/context/GuestFlowContext'
4241
import { useWithdrawFlow } from '@/context/WithdrawFlowContext'
42+
import { useClaimBankFlow } from '@/context/ClaimBankFlowContext'
4343

4444
const BALANCE_WARNING_THRESHOLD = parseInt(process.env.NEXT_PUBLIC_BALANCE_WARNING_THRESHOLD ?? '500')
4545
const BALANCE_WARNING_EXPIRY = parseInt(process.env.NEXT_PUBLIC_BALANCE_WARNING_EXPIRY ?? '1814400') // 21 days in seconds
@@ -48,7 +48,7 @@ export default function Home() {
4848
const { balance, address, isFetchingBalance, isFetchingRewardBalance } = useWallet()
4949
const { rewardWalletBalance } = useWalletStore()
5050
const [isRewardsModalOpen, setIsRewardsModalOpen] = useState(false)
51-
const { resetGuestFlow } = useGuestFlow()
51+
const { resetFlow: resetClaimBankFlow } = useClaimBankFlow()
5252
const { resetWithdrawFlow } = useWithdrawFlow()
5353
const [isBalanceHidden, setIsBalanceHidden] = useState(() => {
5454
const prefs = getUserPreferences()
@@ -84,9 +84,9 @@ export default function Home() {
8484
const isLoading = isFetchingUser && !username
8585

8686
useEffect(() => {
87-
resetGuestFlow()
87+
resetClaimBankFlow()
8888
resetWithdrawFlow()
89-
}, [resetGuestFlow, resetWithdrawFlow])
89+
}, [resetClaimBankFlow, resetWithdrawFlow])
9090

9191
useEffect(() => {
9292
// We have some users that didn't have the peanut wallet created

src/app/(mobile-ui)/request/pay/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export async function generateMetadata({
6868
title,
6969
description: 'Request cryptocurrency from friends, family, or anyone else using Peanut on any chain.',
7070
icons: {
71-
icon: '/logo-favicon.png',
71+
icon: '/favicon.ico',
7272
},
7373
openGraph: {
7474
images: [

src/app/[...recipient]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export async function generateMetadata({ params, searchParams }: any) {
137137
description,
138138
...(siteUrl ? { metadataBase: new URL(siteUrl) } : {}),
139139
icons: {
140-
icon: '/logo-favicon.png',
140+
icon: '/favicon.ico',
141141
},
142142
openGraph: {
143143
title,

src/app/actions/squid.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,17 @@ const getSquidTokensCache = unstable_cache(
3434
)
3535

3636
export const getSquidChainsAndTokens = unstable_cache(
37-
async (): Promise<Record<string, interfaces.ISquidChain & { tokens: interfaces.ISquidToken[] }>> => {
37+
async (): Promise<
38+
Record<string, interfaces.ISquidChain & { networkName: string; tokens: interfaces.ISquidToken[] }>
39+
> => {
3840
const [chains, tokens] = await Promise.all([getSquidChainsCache(), getSquidTokensCache()])
3941

40-
const chainsById = chains.reduce<Record<string, interfaces.ISquidChain & { tokens: interfaces.ISquidToken[] }>>(
41-
(acc, chain) => {
42-
acc[chain.chainId] = { ...chain, tokens: [] }
43-
return acc
44-
},
45-
{}
46-
)
42+
const chainsById = chains.reduce<
43+
Record<string, interfaces.ISquidChain & { networkName: string; tokens: interfaces.ISquidToken[] }>
44+
>((acc, chain) => {
45+
acc[chain.chainId] = { ...(chain as interfaces.ISquidChain & { networkName: string }), tokens: [] }
46+
return acc
47+
}, {})
4748

4849
tokens.forEach((token) => {
4950
if (token.active && token.chainId in chainsById) {

src/app/exchange/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Footer from '@/components/LandingPage/Footer'
66
export default function ExchangePage() {
77
return (
88
<Layout className="enable-select !m-0 w-full !p-0">
9-
<NoFees isExchangePage />
9+
<NoFees />
1010
<Footer />
1111
</Layout>
1212
)

src/components/0_Bruddle/Button.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
'use client'
12
import React, { forwardRef, useEffect, useRef, useState, useCallback } from 'react'
23
import { twMerge } from 'tailwind-merge'
34
import { Icon, IconName } from '../Global/Icons/Icon'

src/components/AddMoney/components/DepositMethodList.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import { CardPosition } from '@/components/Global/Card'
33
import AvatarWithBadge from '@/components/Profile/AvatarWithBadge'
44
import { SearchResultCard } from '@/components/SearchUsers/SearchResultCard'
5-
import { IconName } from '@/components/Global/Icons/Icon'
65
import Image from 'next/image'
76
import { twMerge } from 'tailwind-merge'
87
import { countryCodeMap } from '../consts'
@@ -38,7 +37,7 @@ export const DepositMethodList = ({ methods, onItemClick, isAllMethodsView = fal
3837
if (isSingleOverall) {
3938
determinedPosition = 'single'
4039
} else if (isFirstOverall) {
41-
determinedPosition = 'first'
40+
determinedPosition = isCryptoAtSlot0 && isAllMethodsView ? 'single' : 'first'
4241
} else if (isCryptoAtSlot0 && isCurrentMethodCountry && index === 1 && isAllMethodsView) {
4342
// if crypto card is at methods[0], and this is the country card at methods[1],
4443
// treat this country card as 'first' in its own group.

src/components/AddMoney/views/NetworkSelection.view.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const NetworkSelectionView: React.FC<NetworkSelectionViewProps> = ({ onNetworkSe
4949
<NetworkListItem
5050
key={index}
5151
chainId={squidChainDetails?.chainId ?? network.chainId}
52-
name={squidChainDetails?.axelarChainName ?? network.name}
52+
name={squidChainDetails?.networkName ?? network.name}
5353
iconUrl={squidChainDetails?.chainIconURI ?? network.iconUrl}
5454
isComingSoon={isComingSoon}
5555
iconClassName={
@@ -60,7 +60,7 @@ const NetworkSelectionView: React.FC<NetworkSelectionViewProps> = ({ onNetworkSe
6060
onClick={() =>
6161
onNetworkSelect({
6262
chainId: squidChainDetails?.chainId ?? network.chainId,
63-
name: squidChainDetails?.axelarChainName ?? network.name,
63+
name: squidChainDetails?.networkName ?? network.name,
6464
iconUrl: squidChainDetails?.chainIconURI ?? network.iconUrl,
6565
})
6666
}

src/components/AddWithdraw/AddWithdrawCountriesList.tsx

Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,10 @@ import { useEffect, useMemo, useRef, useState } from 'react'
2020
import { InitiateKYCModal } from '@/components/Kyc'
2121
import { DynamicBankAccountForm, IBankAccountDetails } from './DynamicBankAccountForm'
2222
import { addBankAccount, updateUserById } from '@/app/actions/users'
23-
import { jsonParse, jsonStringify } from '@/utils/general.utils'
2423
import { KYCStatus } from '@/utils/bridge-accounts.utils'
2524
import { AddBankAccountPayload } from '@/app/actions/types/users.types'
2625
import { useWebSocket } from '@/hooks/useWebSocket'
2726
import { useWithdrawFlow } from '@/context/WithdrawFlowContext'
28-
import { useOnrampFlow } from '@/context/OnrampFlowContext'
2927
import { Account } from '@/interfaces'
3028
import PeanutLoading from '../Global/PeanutLoading'
3129
import { getCountryCodeForWithdraw } from '@/utils/withdraw.utils'
@@ -39,10 +37,8 @@ const AddWithdrawCountriesList = ({ flow }: AddWithdrawCountriesListProps) => {
3937
const params = useParams()
4038
const { user, fetchUser } = useAuth()
4139
const { setSelectedBankAccount, amountToWithdraw } = useWithdrawFlow()
42-
const { setFromBankSelected } = useOnrampFlow()
4340
const [view, setView] = useState<'list' | 'form'>('list')
4441
const [isKycModalOpen, setIsKycModalOpen] = useState(false)
45-
const [cachedBankDetails, setCachedBankDetails] = useState<Partial<IBankAccountDetails> | null>(null)
4642
const formRef = useRef<{ handleSubmit: () => void }>(null)
4743
const [liveKycStatus, setLiveKycStatus] = useState<KYCStatus | undefined>(user?.user?.kycStatus as KYCStatus)
4844

@@ -72,18 +68,6 @@ const AddWithdrawCountriesList = ({ flow }: AddWithdrawCountriesListProps) => {
7268
(country) => country.type === 'country' && country.path === countrySlugFromUrl
7369
)
7470

75-
useEffect(() => {
76-
if (user?.user.userId) {
77-
const item = sessionStorage.getItem(`temp-bank-account-${user.user.userId}`)
78-
const data = item ? jsonParse(item) : null
79-
const currentStatus = liveKycStatus || user.user.kycStatus
80-
if (data && currentStatus === 'approved' && !cachedBankDetails) {
81-
setCachedBankDetails(data)
82-
setView('form')
83-
}
84-
}
85-
}, [user, liveKycStatus, cachedBankDetails])
86-
8771
const handleFormSubmit = async (
8872
payload: AddBankAccountPayload,
8973
rawData: IBankAccountDetails
@@ -130,9 +114,6 @@ const AddWithdrawCountriesList = ({ flow }: AddWithdrawCountriesListProps) => {
130114
setSelectedBankAccount(newAccountFromResponse)
131115
}
132116

133-
if (user?.user.userId) {
134-
sessionStorage.removeItem(`temp-bank-account-${user.user.userId}`)
135-
}
136117
if (currentCountry) {
137118
router.push(`/withdraw/${currentCountry.path}/bank`)
138119
}
@@ -157,20 +138,17 @@ const AddWithdrawCountriesList = ({ flow }: AddWithdrawCountriesListProps) => {
157138

158139
// scenario (2): if the user hasn't completed kyc yet
159140
if (!isUserKycVerified) {
160-
const { firstName, lastName, email, ...detailsToSave } = rawData
161-
if (user?.user.userId) {
162-
sessionStorage.setItem(`temp-bank-account-${user.user.userId}`, jsonStringify(detailsToSave))
163-
}
164141
setIsKycModalOpen(true)
165142
}
166143

167144
return {}
168145
}
169146

170147
const handleKycSuccess = () => {
171-
setIsKycModalOpen(false)
172-
if (formRef.current) {
173-
formRef.current.handleSubmit()
148+
// only transition to form if this component initiated the KYC modal
149+
if (isKycModalOpen) {
150+
setIsKycModalOpen(false)
151+
setView('form')
174152
}
175153
}
176154

@@ -213,16 +191,20 @@ const AddWithdrawCountriesList = ({ flow }: AddWithdrawCountriesListProps) => {
213191
if (view === 'form') {
214192
return (
215193
<div className="flex min-h-[inherit] flex-col justify-normal gap-8">
216-
<NavHeader title={'Withdraw'} onPrev={() => setView('list')} />
217-
218-
<div className="flex h-full w-full flex-1 flex-col justify-start gap-4">
219-
<DynamicBankAccountForm
220-
ref={formRef}
221-
country={getCountryCodeForWithdraw(currentCountry.id)}
222-
onSuccess={handleFormSubmit}
223-
initialData={cachedBankDetails ?? {}}
224-
/>
225-
</div>
194+
<NavHeader
195+
title={flow === 'withdraw' ? 'Withdraw' : 'Add money'}
196+
onPrev={() => {
197+
// ensure kyc modal isn't open so late success events don't flip view
198+
setIsKycModalOpen(false)
199+
setView('list')
200+
}}
201+
/>
202+
<DynamicBankAccountForm
203+
ref={formRef}
204+
country={getCountryCodeForWithdraw(currentCountry.id)}
205+
onSuccess={handleFormSubmit}
206+
initialData={{}}
207+
/>
226208
<InitiateKYCModal
227209
isOpen={isKycModalOpen}
228210
onClose={() => setIsKycModalOpen(false)}

0 commit comments

Comments
 (0)