Skip to content

Commit a60a7b4

Browse files
Hugo0jjramirezncoderabbitai[bot]kushagrasaratheFacuBozzi
authored
Prod release SP 102 - Links v2 send flow guest claims (#1024)
* feat: abstract squid route fetching Stop using the skd and use the squid API directly, this give us more control and access to all the data that returns squid (for example, we now have access to the fees and don't have to recalculate them ourselves) * refactor: use parseunits Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * refactor: remove console.dir * feat: handle very large numbers with careful scaling * refactor: use const for squid api url * feat: add cross-chain action card Use coral through squid to get the cross-chain route for the different flows. This enables xchain withdraw for peanut wallet * refactor: use decimals from token price instead of hardcoded * style: Apply prettier formatting * feat: show min received for cross-chain payments * chore: clean unused variables * fix: tests ach_pull to ach * fix: pr comments * fix: withdrawData and pulsate animation * fix: cursor placement in token amount input * fix: delete unused code * fix: add camera perm modal * fix: enable mexico bank offramp * refactor: better comments for direct usd payments * feat: add qr scanning for xchain * fix: remove malicious code * fix: handle mxn in offramp destination details (#945) * fix: show share receipt option in direct send status view (#946) * [TASK-12678] fix: coral withdraw fixes (#949) * fix: coral withdraw fixes - Stop refreshing the page after successful payment - Better error message for unsupported token pairs * chore: add squid env vars * refactor: better copy for non rfq routes from peanut wallet Also send warning to sentry * fix: show amount in USD for withdrawals to other tokens to other tokens * fix: lock orientation to portrait mode (#947) * fix: lock orienatation to protrait mode * style(fix): add new line * style: format * fix: if condition * fix: update payment form for crosschain add money (#954) * [TASK-12682] fix: show token selector for guest flow (#955) * fix: show token selector for guest flow * docs: add comment to explain url request flow * implemented Context instead of sessionStorage in onrampData to avoid discrepancies with the Offramp logic (#953) * refactor: fetch external wallet balances from mobula (#956) (#958) * [TASK-12645] copy button for individual fields (#960) * copy button for individual fields * changed getOnrampCurrencyConfig (deprecated)to getCurrencyConfig + user now copies raw IBAN value * fix: gas estimation for external wallets (#961) We were re-rendering unnecesarily the prepare transaction, also now we catch error if any * [TASK-12603] reset send flow state when navigating to/from payment link creation (#964) * reset send flow state when navigating to/from payment link creation * linting (formatting) * [TASK-12312] ENS/eth address network error being displayed on the frontend (#963) * ENS/eth address network error being displayed on the frontend * linting * fix: centre align views on mobile (#950) * [TASK-12542] added formatIban function for correct display (#952) * added formatIban function for correct display * coderabbit suggestion Signed-off-by: facundobozzi <72771544+FacuBozzi@users.noreply.github.com> * updated formatting * added iban formatting in all pages --------- Signed-off-by: facundobozzi <72771544+FacuBozzi@users.noreply.github.com> * [TASK-12672] feat: show sponsored by peanut message (#959) * feat: show sponsored by peanut message This message is shown when we are making a transaction from the peanut wallet. If the amount is more than one cent we also show the fee that the user is saving by using peanut. * fix(fees): show correct ammounts for externalwallet * refactor: rename estimatedGasCostUsd to estimatedGasCostUsdUsd * fix: correct approval owner and base rpc (#965) Two things here: 1. We were using the peanut address for approval checking on deposits, this didn't affect because if the approval call failed we just continued with the deposit 2: The base rpc url was the sepolia one, not the mainnet. Big oversight there * feat: add alachemy as fallback rpc url (#948) * feat: add alachemy as fallback rpc url * fix: remove commented line * fix: address pr review comments * [TASK-12866] fix: small fixes around crosschain ui (#966) * fix: small fixes around crosschain ui * fix: avoid negative expiry time * removed white spaces before processing to BIC (#951) * feat: resuable slider component (#968) * fix: update desktop navigation with add/withdraw paths (#969) * [TASK-11884] request via link with comment and attachment is creating 2 txs in the history (#943) * PATCH implemented in frontend * comment input state updating correctly (onBlur) * freezing amount after updating comments/files input * debounce attachment options and update requests on file change (avoiding race conditions when attaching files!) * style: Apply prettier formatting * removed malicious code Signed-off-by: facundobozzi <72771544+FacuBozzi@users.noreply.github.com> * PATCH method using withFormData * better onBlur logic * bug fixes * blur logic fixed * nit pick comments * code rabbit suggestion * replaced useEffect setting state with derived state and debouncing * disabling amount input after request creation * linting --------- Signed-off-by: facundobozzi <72771544+FacuBozzi@users.noreply.github.com> * fix: support page staging (#972) * fix: update desktop navigation with add/withdraw paths * fix: support page * fix: ui comments (#973) * Support and beta changes to staging (#978) * refactor: fetch external wallet balances from mobula (#956) * fix: update desktop navigation (#970) * fix: support page prod (#971) * fix: update desktop navigation * fix: support page * [TASK-12746] feat: beta changes (#975) * feat: beta changes - Banner that redirects to support page - Funds warning modal * refactor(banner): remove from landing and add hand thumbs up --------- Co-authored-by: Kushagra Sarathe <76868364+kushagrasarathe@users.noreply.github.com> * [TASK-12312] Bugfix/ens error withdrawing (#976) * ENS/eth address network error being displayed on the frontend * linting * fixed andre QA observations * deleting console.log * formatting * logic fixed * fixed testst --------- Signed-off-by: facundobozzi <72771544+FacuBozzi@users.noreply.github.com> * fix: coral small issues (#979) * chore: enable usdt in mainnet (#980) * fix: slider tap bug logic (#983) * fix: slider tap bug logic * fix: tap bug on slider * fix: some issues and comments (#984) * [TASK-12771] Feat/new landing page (#974) * removed legacy button and changed try now button colors * try now button color and hero description * YourMoney component * NoFees component first part * stars done * scribble in zero fees * no hidden fees section done * securityBuiltIn done * sendInSeconds progress * sendInSeconds done * updated try now button to be a link * business integration initiation * businessIntegrate done * order and marquee reusability * order fixed * background animations in Landing Page compoejnnts * changed image for text in hero section * figma details * landing page responsiveness improvements * landing page responsiveness done * coderabbit suggestion * business integration button * fixed iphone screenshots * CTA button animation * added debugging for CTA button animation * changed animation since react gave errors * arrows in hero section * NoFees new Zero * no fees responsiveness fixed * sendInSeconds details done * coderabbit suggestions * formatting * hand-token wasnt pushed? forgot to stage or sum? anyways fixed * build issues fixed * coderabbit optimization * code formatting * arrows and ZERO thickness * shade in try now button * progress in button animation * undoing button changes * small detail fixes * added asset * changed peanut business to svg * integrate peanut component done * added pay-zero-fees.svg * added new illustrations * uout money anywhere svg * securitybuiltin component SVGs * adding YourMoney new SVGs * your money anywhere component * instantly send & receive svg * arrows fixed * button and arrows done * desktop sendinseconds button done * removed arrows disappearing effect * MOBILE: hero button done * added mobile svg * yourMoney responsive component done * added mobile-zero-fees.svg * added no-hidden-fees.svg * noFees mobile svg * noFees desktop + mobile improvements * noFees done * mobile security built in SVG * securityprivacy mobile done * mobile-send-in-seconds.svg * sendInSeconds mobile done * business integrate mobile * business integrate button and final details * removed footer * formatting * removed pino-pretty * fixed button instead of sticky/floating --------- Signed-off-by: facundobozzi <72771544+FacuBozzi@users.noreply.github.com> * [TASK-13136] feat: allow uppercase in url (#986) * feat: allow uppercase in url * fix: allow uppercase in recipient * fix: inform create request type when creating from UI (#987) * fix: balance warning modal (#988) - Slider instead of button - Expiry for local storage instead of session storage - Warning icon color * chore: remove unused file (#990) * feat: send links guest flow ( exchange/crypto) (#982) * feat: update add/withdraw flow to use new slider component * feat: guest receive to exchange/crypto flows * fix: coderabbit comments * fix: slider usage * Chore/prod to staging (#994) * refactor: fetch external wallet balances from mobula (#956) * fix: update desktop navigation (#970) * fix: support page prod (#971) * fix: update desktop navigation * fix: support page * [TASK-12746] feat: beta changes (#975) * feat: beta changes - Banner that redirects to support page - Funds warning modal * refactor(banner): remove from landing and add hand thumbs up * [TASK-13082] Sprint 100 prod release (#992) * feat: abstract squid route fetching Stop using the skd and use the squid API directly, this give us more control and access to all the data that returns squid (for example, we now have access to the fees and don't have to recalculate them ourselves) * refactor: use parseunits Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * refactor: remove console.dir * feat: handle very large numbers with careful scaling * refactor: use const for squid api url * feat: add cross-chain action card Use coral through squid to get the cross-chain route for the different flows. This enables xchain withdraw for peanut wallet * refactor: use decimals from token price instead of hardcoded * style: Apply prettier formatting * feat: show min received for cross-chain payments * chore: clean unused variables * fix: tests ach_pull to ach * fix: pr comments * fix: withdrawData and pulsate animation * fix: cursor placement in token amount input * fix: delete unused code * fix: add camera perm modal * fix: enable mexico bank offramp * refactor: better comments for direct usd payments * feat: add qr scanning for xchain * fix: remove malicious code * fix: handle mxn in offramp destination details (#945) * fix: show share receipt option in direct send status view (#946) * [TASK-12678] fix: coral withdraw fixes (#949) * fix: coral withdraw fixes - Stop refreshing the page after successful payment - Better error message for unsupported token pairs * chore: add squid env vars * refactor: better copy for non rfq routes from peanut wallet Also send warning to sentry * fix: show amount in USD for withdrawals to other tokens to other tokens * fix: lock orientation to portrait mode (#947) * fix: lock orienatation to protrait mode * style(fix): add new line * style: format * fix: if condition * fix: update payment form for crosschain add money (#954) * [TASK-12682] fix: show token selector for guest flow (#955) * fix: show token selector for guest flow * docs: add comment to explain url request flow * implemented Context instead of sessionStorage in onrampData to avoid discrepancies with the Offramp logic (#953) * refactor: fetch external wallet balances from mobula (#956) (#958) * [TASK-12645] copy button for individual fields (#960) * copy button for individual fields * changed getOnrampCurrencyConfig (deprecated)to getCurrencyConfig + user now copies raw IBAN value * fix: gas estimation for external wallets (#961) We were re-rendering unnecesarily the prepare transaction, also now we catch error if any * [TASK-12603] reset send flow state when navigating to/from payment link creation (#964) * reset send flow state when navigating to/from payment link creation * linting (formatting) * [TASK-12312] ENS/eth address network error being displayed on the frontend (#963) * ENS/eth address network error being displayed on the frontend * linting * fix: centre align views on mobile (#950) * [TASK-12542] added formatIban function for correct display (#952) * added formatIban function for correct display * coderabbit suggestion Signed-off-by: facundobozzi <72771544+FacuBozzi@users.noreply.github.com> * updated formatting * added iban formatting in all pages --------- Signed-off-by: facundobozzi <72771544+FacuBozzi@users.noreply.github.com> * [TASK-12672] feat: show sponsored by peanut message (#959) * feat: show sponsored by peanut message This message is shown when we are making a transaction from the peanut wallet. If the amount is more than one cent we also show the fee that the user is saving by using peanut. * fix(fees): show correct ammounts for externalwallet * refactor: rename estimatedGasCostUsd to estimatedGasCostUsdUsd * fix: correct approval owner and base rpc (#965) Two things here: 1. We were using the peanut address for approval checking on deposits, this didn't affect because if the approval call failed we just continued with the deposit 2: The base rpc url was the sepolia one, not the mainnet. Big oversight there * feat: add alachemy as fallback rpc url (#948) * feat: add alachemy as fallback rpc url * fix: remove commented line * fix: address pr review comments * [TASK-12866] fix: small fixes around crosschain ui (#966) * fix: small fixes around crosschain ui * fix: avoid negative expiry time * removed white spaces before processing to BIC (#951) * feat: resuable slider component (#968) * fix: update desktop navigation with add/withdraw paths (#969) * [TASK-11884] request via link with comment and attachment is creating 2 txs in the history (#943) * PATCH implemented in frontend * comment input state updating correctly (onBlur) * freezing amount after updating comments/files input * debounce attachment options and update requests on file change (avoiding race conditions when attaching files!) * style: Apply prettier formatting * removed malicious code Signed-off-by: facundobozzi <72771544+FacuBozzi@users.noreply.github.com> * PATCH method using withFormData * better onBlur logic * bug fixes * blur logic fixed * nit pick comments * code rabbit suggestion * replaced useEffect setting state with derived state and debouncing * disabling amount input after request creation * linting --------- Signed-off-by: facundobozzi <72771544+FacuBozzi@users.noreply.github.com> * fix: support page staging (#972) * fix: update desktop navigation with add/withdraw paths * fix: support page * fix: ui comments (#973) * Support and beta changes to staging (#978) * refactor: fetch external wallet balances from mobula (#956) * fix: update desktop navigation (#970) * fix: support page prod (#971) * fix: update desktop navigation * fix: support page * [TASK-12746] feat: beta changes (#975) * feat: beta changes - Banner that redirects to support page - Funds warning modal * refactor(banner): remove from landing and add hand thumbs up --------- Co-authored-by: Kushagra Sarathe <76868364+kushagrasarathe@users.noreply.github.com> * [TASK-12312] Bugfix/ens error withdrawing (#976) * ENS/eth address network error being displayed on the frontend * linting * fixed andre QA observations * deleting console.log * formatting * logic fixed * fixed testst --------- Signed-off-by: facundobozzi <72771544+FacuBozzi@users.noreply.github.com> * fix: coral small issues (#979) * chore: enable usdt in mainnet (#980) * fix: slider tap bug logic (#983) * fix: slider tap bug logic * fix: tap bug on slider * fix: some issues and comments (#984) * [TASK-12771] Feat/new landing page (#974) * removed legacy button and changed try now button colors * try now button color and hero description * YourMoney component * NoFees component first part * stars done * scribble in zero fees * no hidden fees section done * securityBuiltIn done * sendInSeconds progress * sendInSeconds done * updated try now button to be a link * business integration initiation * businessIntegrate done * order and marquee reusability * order fixed * background animations in Landing Page compoejnnts * changed image for text in hero section * figma details * landing page responsiveness improvements * landing page responsiveness done * coderabbit suggestion * business integration button * fixed iphone screenshots * CTA button animation * added debugging for CTA button animation * changed animation since react gave errors * arrows in hero section * NoFees new Zero * no fees responsiveness fixed * sendInSeconds details done * coderabbit suggestions * formatting * hand-token wasnt pushed? forgot to stage or sum? anyways fixed * build issues fixed * coderabbit optimization * code formatting * arrows and ZERO thickness * shade in try now button * progress in button animation * undoing button changes * small detail fixes * added asset * changed peanut business to svg * integrate peanut component done * added pay-zero-fees.svg * added new illustrations * uout money anywhere svg * securitybuiltin component SVGs * adding YourMoney new SVGs * your money anywhere component * instantly send & receive svg * arrows fixed * button and arrows done * desktop sendinseconds button done * removed arrows disappearing effect * MOBILE: hero button done * added mobile svg * yourMoney responsive component done * added mobile-zero-fees.svg * added no-hidden-fees.svg * noFees mobile svg * noFees desktop + mobile improvements * noFees done * mobile security built in SVG * securityprivacy mobile done * mobile-send-in-seconds.svg * sendInSeconds mobile done * business integrate mobile * business integrate button and final details * removed footer * formatting * removed pino-pretty * fixed button instead of sticky/floating --------- Signed-off-by: facundobozzi <72771544+FacuBozzi@users.noreply.github.com> * [TASK-13136] feat: allow uppercase in url (#986) * feat: allow uppercase in url * fix: allow uppercase in recipient * fix: inform create request type when creating from UI (#987) * fix: balance warning modal (#988) - Slider instead of button - Expiry for local storage instead of session storage - Warning icon color * chore: remove unused file (#990) * chore: re-add removed code for gas estimation --------- Signed-off-by: facundobozzi <72771544+FacuBozzi@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: kushagrasarathe <76868364+kushagrasarathe@users.noreply.github.com> Co-authored-by: facundobozzi <72771544+FacuBozzi@users.noreply.github.com> --------- Signed-off-by: facundobozzi <72771544+FacuBozzi@users.noreply.github.com> Co-authored-by: Kushagra Sarathe <76868364+kushagrasarathe@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: facundobozzi <72771544+FacuBozzi@users.noreply.github.com> * refactor(payments): add payerAddress to payment creation (#1002) * feat: claim a send link to bank flow (#995) * feat: update add/withdraw flow to use new slider component * feat: guest receive to exchange/crypto flows * fix: coderabbit comments * fix: slider usage * feat: new server actions for guest flow * feat: update card and success view component for bank claims * feat: claim to bank flow components * fix: coderbbit comments * fix: import * feat: handle bank link claims for when sender is non-kyced (#996) * feat: handle bank link claims for when sender is non-kyced * fix: kyc status check for sender * fix: codderabbit comments * fix: update route payloads based on be changes * fix: merge conflict * feat: ui updates to bank flow * fix: rename comp name * fix: wrap fn in callback * feat: min ammount modal for send link claims * [TASK-12649] fix: allow user to change their email address if they have not completed kyc (#999) * fix: allow user to change their email address if they have not completed kyc * fix: account incorrect field * Feat: Landing page changes (#1006) * fix: links v2 send flow qa fixes (#1008) * fix: add reuseOnError key for guest external accounts creation * fix: success view for guest claim to bank account flow * fix: infinite loop of post signup flow using claim link * fix: back btn navigation * fix: show confirm view for xchain claims * fix: links v2 qa bug fixes (#1014) * feat: add slider in withdraw crypto flow * fix: cross chain claiming * fix: claim modal on homepage * fix: coral issue on staging (#1018) * fix: coral issue on staging * fix: squid api url const * Make txn history private (#1017) * chore: update mobula endpoint (#1020) * chore: update mobula endpoint * Update tokens.ts Signed-off-by: Hugo Montenegro <hugo@peanut.to> --------- Signed-off-by: Hugo Montenegro <hugo@peanut.to> Co-authored-by: Hugo Montenegro <hugo@peanut.to> * fix: minor bugs before prod-release (#1025) * fix: add money ui issue for same chain external wallet txn * fix: amount in withdraw to crypto sucess view * fix: reset states on flows (#1026) * fix: add money ui issue for same chain external wallet txn * fix: amount in withdraw to crypto sucess view * fix; reset states * merge: peanut-wallet in peanut-wallet-dev * fix: remove dupe title * merge: peanut-wallet in peanut-wallet-dev (#1032) * merge: peanut-wallet in peanut-wallet-dev * fix: remove dupe title * Fix KYC issues (#1029) * fix: TOS acceptance taking too much time * remove log * Fix: add money button position (#1031) * fix: Wrong flag shown in add monet flow for some countries (#1027) * fix(kernel-client): catch kernel client errors (#1036) --------- Signed-off-by: facundobozzi <72771544+FacuBozzi@users.noreply.github.com> Signed-off-by: Hugo Montenegro <hugo@peanut.to> Co-authored-by: Juan José Ramírez <artjjrn@gmail.com> Co-authored-by: Juan José Ramírez <70615692+jjramirezn@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: kushagrasarathe <76868364+kushagrasarathe@users.noreply.github.com> Co-authored-by: facundobozzi <72771544+FacuBozzi@users.noreply.github.com> Co-authored-by: Mohd Zishan <72738005+Zishan-7@users.noreply.github.com>
1 parent b1c1def commit a60a7b4

67 files changed

Lines changed: 1776 additions & 761 deletions

File tree

Some content is hidden

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

src/app/(mobile-ui)/add-money/[country]/bank/page.tsx

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { UserDetailsForm, type UserDetailsFormData } from '@/components/AddMoney
2525
import { updateUserById } from '@/app/actions/users'
2626
import AddMoneyBankDetails from '@/components/AddMoney/components/AddMoneyBankDetails'
2727
import { getOnrampCurrencyConfig, getCurrencySymbol, getMinimumAmount } from '@/utils/bridge.utils'
28+
import { Slider } from '@/components/Slider'
2829

2930
type AddStep = 'inputAmount' | 'kyc' | 'loading' | 'collectUserDetails' | 'showDetails'
3031

@@ -97,14 +98,9 @@ export default function OnrampBankPage() {
9798
if (step === 'loading') {
9899
const currentKycStatus = liveKycStatus || user?.user.kycStatus
99100
const isUserKycVerified = currentKycStatus === 'approved'
100-
const hasUserDetails = user?.user.fullName && user?.user.email
101101

102102
if (!isUserKycVerified) {
103-
if (hasUserDetails) {
104-
setStep('kyc')
105-
} else {
106-
setStep('collectUserDetails')
107-
}
103+
setStep('collectUserDetails')
108104
} else {
109105
setStep('inputAmount')
110106
if (amountFromContext && !rawTokenAmount) {
@@ -388,28 +384,20 @@ export default function OnrampBankPage() {
388384
title="IMPORTANT!"
389385
description={
390386
<>
391-
In the following step you'll see a <strong>"Deposit Message" item</strong>, copy and paste
392-
it exactly as it is on the description field of your transfer.
387+
In the following step you'll see a <br /> <strong>"Deposit Message" item</strong> <br />{' '}
388+
copy and paste it exactly as it is on <br /> the description field of your transfer.
393389
<br />
394390
<br />
395-
<strong>Without it, we won't be able to credit your money.</strong>
391+
<strong>
392+
Without it your deposit will be returned and might take 2-10 working days to process.
393+
</strong>
396394
</>
397395
}
398-
checkbox={{
399-
text: 'I understand and accept the risk.',
400-
checked: isRiskAccepted,
401-
onChange: setIsRiskAccepted,
402-
}}
403-
ctas={[
404-
{
405-
text: 'Continue',
406-
variant: isRiskAccepted ? 'purple' : 'dark',
407-
shadowSize: '4',
408-
onClick: handleWarningConfirm,
409-
disabled: !isRiskAccepted,
410-
className: 'w-full',
411-
},
412-
]}
396+
footer={
397+
<div className="w-full">
398+
<Slider onValueChange={(v) => v && handleWarningConfirm()} />
399+
</div>
400+
}
413401
preventClose={false}
414402
modalPanelClassName="max-w-md mx-8"
415403
/>

src/app/(mobile-ui)/add-money/crypto/direct/page.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
import PaymentPage from '@/app/[...recipient]/client'
44
import PeanutLoading from '@/components/Global/PeanutLoading'
5-
import { useUserStore } from '@/redux/hooks'
5+
import { useAppDispatch, useUserStore } from '@/redux/hooks'
6+
import { paymentActions } from '@/redux/slices/payment-slice'
67
import { useRouter, useSearchParams } from 'next/navigation'
78
import { useEffect, useState } from 'react'
89

@@ -12,6 +13,11 @@ export default function AddMoneyCryptoDirectPage() {
1213
const { user } = useUserStore()
1314
const [recipientUsername, setRecipientUsername] = useState<string | null>(null)
1415
const [isLoading, setIsLoading] = useState(true)
16+
const dispatch = useAppDispatch()
17+
18+
useEffect(() => {
19+
dispatch(paymentActions.resetPaymentState())
20+
}, [dispatch])
1521

1622
useEffect(() => {
1723
if (user?.user.username) {
@@ -21,7 +27,7 @@ export default function AddMoneyCryptoDirectPage() {
2127
return
2228
}
2329
setIsLoading(false)
24-
}, [searchParams, router])
30+
}, [searchParams, router, user])
2531

2632
if (isLoading) {
2733
return <PeanutLoading />

src/app/(mobile-ui)/add-money/crypto/page.tsx

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import NetworkSelectionView, { SelectedNetwork } from '@/components/AddMoney/vie
66
import TokenSelectionView from '@/components/AddMoney/views/TokenSelection.view'
77
import ActionModal from '@/components/Global/ActionModal'
88
import NavHeader from '@/components/Global/NavHeader'
9+
import { Slider } from '@/components/Slider'
910
import { useWallet } from '@/hooks/wallet/useWallet'
1011
import { useRouter } from 'next/navigation'
11-
import { useState } from 'react'
12-
import { twMerge } from 'tailwind-merge'
12+
import { useEffect, useState } from 'react'
1313

1414
type AddMoneyCryptoStep = 'sourceSelection' | 'tokenSelection' | 'networkSelection' | 'riskModal' | 'qrScreen'
1515

@@ -22,6 +22,12 @@ const AddMoneyCryptoPage = () => {
2222
const [selectedNetwork, setSelectedNetwork] = useState<SelectedNetwork | null>(null)
2323
const [isRiskAccepted, setIsRiskAccepted] = useState(false)
2424

25+
useEffect(() => {
26+
if (isRiskAccepted) {
27+
setCurrentStep('qrScreen')
28+
}
29+
}, [isRiskAccepted])
30+
2531
const handleCryptoSourceSelected = (source: CryptoSource) => {
2632
setSelectedSource(source)
2733
setCurrentStep('tokenSelection')
@@ -38,12 +44,6 @@ const AddMoneyCryptoPage = () => {
3844
setCurrentStep('riskModal')
3945
}
4046

41-
const handleRiskContinue = () => {
42-
if (isRiskAccepted) {
43-
setCurrentStep('qrScreen')
44-
}
45-
}
46-
4747
const resetSelections = () => {
4848
setSelectedToken(null)
4949
setSelectedNetwork(null)
@@ -88,26 +88,19 @@ const AddMoneyCryptoPage = () => {
8888
visible={true}
8989
onClose={handleBackToNetworkSelectionFromRisk}
9090
icon={'alert'}
91+
iconContainerClassName="bg-yellow-1"
9192
title={`Only send ${selectedToken.symbol} on ${selectedNetwork.name}`}
92-
description="Sending funds via any other network will result in a permanent loss of funds. Peanut is not responsible for any loss of funds due to incorrect network selection."
93-
checkbox={{
94-
text: 'I understand and accept the risk.',
95-
checked: isRiskAccepted,
96-
onChange: setIsRiskAccepted,
97-
}}
98-
ctas={[
99-
{
100-
text: 'Continue',
101-
onClick: handleRiskContinue,
102-
disabled: !isRiskAccepted,
103-
variant: isRiskAccepted ? 'purple' : 'stroke',
104-
shadowSize: '4',
105-
className: twMerge(
106-
!isRiskAccepted ? 'border-grey-2 text-grey-2' : '',
107-
'text-black border border-black h-11 hover:text-black'
108-
),
109-
},
110-
]}
93+
description={
94+
<span className="text-sm">
95+
Sending funds via any other network will result in a <b>permanent loss.</b>
96+
</span>
97+
}
98+
footer={
99+
<div className="w-full">
100+
<Slider onValueChange={(v) => v && setIsRiskAccepted(true)} />
101+
</div>
102+
}
103+
ctas={[]}
111104
modalPanelClassName="max-w-xs"
112105
/>
113106
)}

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

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ import FloatingReferralButton from '@/components/Home/FloatingReferralButton'
3737
import { AccountType } from '@/interfaces'
3838
import { formatUnits } from 'viem'
3939
import { PEANUT_WALLET_TOKEN_DECIMALS } from '@/constants'
40+
import { PostSignupActionManager } from '@/components/Global/PostSignupActionManager'
41+
import { useGuestFlow } from '@/context/GuestFlowContext'
4042

4143
const BALANCE_WARNING_THRESHOLD = parseInt(process.env.NEXT_PUBLIC_BALANCE_WARNING_THRESHOLD ?? '500')
4244
const BALANCE_WARNING_EXPIRY = parseInt(process.env.NEXT_PUBLIC_BALANCE_WARNING_EXPIRY ?? '1814400') // 21 days in seconds
@@ -45,6 +47,7 @@ export default function Home() {
4547
const { balance, address, isFetchingBalance, isFetchingRewardBalance } = useWallet()
4648
const { rewardWalletBalance } = useWalletStore()
4749
const [isRewardsModalOpen, setIsRewardsModalOpen] = useState(false)
50+
const { resetGuestFlow } = useGuestFlow()
4851
const [isBalanceHidden, setIsBalanceHidden] = useState(() => {
4952
const prefs = getUserPreferences()
5053
return prefs?.balanceHidden ?? false
@@ -60,6 +63,7 @@ export default function Home() {
6063
const [showAddMoneyPromptModal, setShowAddMoneyPromptModal] = useState(false)
6164
const [showBalanceWarningModal, setShowBalanceWarningModal] = useState(false)
6265
const [showReferralCampaignModal, setShowReferralCampaignModal] = useState(false)
66+
const [isPostSignupActionModalVisible, setIsPostSignupActionModalVisible] = useState(false)
6367

6468
const userFullName = useMemo(() => {
6569
if (!user) return
@@ -77,6 +81,10 @@ export default function Home() {
7781

7882
const isLoading = isFetchingUser && !username
7983

84+
useEffect(() => {
85+
resetGuestFlow()
86+
}, [resetGuestFlow])
87+
8088
useEffect(() => {
8189
// We have some users that didn't have the peanut wallet created
8290
// correctly, so we need to create it
@@ -104,15 +112,45 @@ export default function Home() {
104112
(navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)
105113
const isStandalone = window.matchMedia('(display-mode: standalone)').matches
106114
const hasSeenModalThisSession = sessionStorage.getItem('hasSeenIOSPWAPromptThisSession')
115+
const redirectUrl = getFromLocalStorage('redirect')
107116

108-
if (isIOS && !isStandalone && !hasSeenModalThisSession && !user?.hasPwaInstalled) {
117+
if (
118+
isIOS &&
119+
!isStandalone &&
120+
!hasSeenModalThisSession &&
121+
!user?.hasPwaInstalled &&
122+
!isPostSignupActionModalVisible &&
123+
!redirectUrl
124+
) {
109125
setShowIOSPWAInstallModal(true)
110126
sessionStorage.setItem('hasSeenIOSPWAPromptThisSession', 'true')
111127
} else {
112128
setShowIOSPWAInstallModal(false)
113129
}
114130
}
115-
}, [user?.hasPwaInstalled])
131+
}, [user?.hasPwaInstalled, isPostSignupActionModalVisible])
132+
133+
// effect for showing balance warning modal
134+
useEffect(() => {
135+
if (typeof window !== 'undefined' && !isFetchingBalance) {
136+
const hasSeenBalanceWarning = getFromLocalStorage('hasSeenBalanceWarning')
137+
const balanceInUsd = Number(formatUnits(balance, PEANUT_WALLET_TOKEN_DECIMALS))
138+
139+
// show if:
140+
// 1. balance is above the threshold
141+
// 2. user hasn't seen this warning in the current session
142+
// 3. no other modals are currently active
143+
if (
144+
balanceInUsd > BALANCE_WARNING_THRESHOLD &&
145+
!hasSeenBalanceWarning &&
146+
!showIOSPWAInstallModal &&
147+
!showAddMoneyPromptModal &&
148+
!isPostSignupActionModalVisible
149+
) {
150+
setShowBalanceWarningModal(true)
151+
}
152+
}
153+
}, [balance, isFetchingBalance, showIOSPWAInstallModal, showAddMoneyPromptModal])
116154

117155
// effect for showing balance warning modal
118156
useEffect(() => {
@@ -151,7 +189,8 @@ export default function Home() {
151189
balance === 0n &&
152190
!hasSeenAddMoneyPromptThisSession &&
153191
!showIOSPWAInstallModal &&
154-
!showBalanceWarningModal
192+
!showBalanceWarningModal &&
193+
!isPostSignupActionModalVisible
155194
) {
156195
setShowAddMoneyPromptModal(true)
157196
sessionStorage.setItem('hasSeenAddMoneyPromptThisSession', 'true')
@@ -236,6 +275,9 @@ export default function Home() {
236275

237276
{/* Floating Referral Button */}
238277
<FloatingReferralButton onClick={() => setShowReferralCampaignModal(true)} />
278+
279+
{/* Post Signup Action Modal */}
280+
<PostSignupActionManager onActionModalVisibilityChange={setIsPostSignupActionModalVisible} />
239281
</PageContainer>
240282
)
241283
}

src/app/(mobile-ui)/layout.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
'use client'
22

3+
import { MarqueeWrapper } from '@/components/Global/MarqueeWrapper'
34
import { useRouter } from 'next/navigation'
5+
import { HandThumbsUp } from '@/assets'
6+
import Image from 'next/image'
47
import GuestLoginModal from '@/components/Global/GuestLoginModal'
58
import PeanutLoading from '@/components/Global/PeanutLoading'
69
import TopNavbar from '@/components/Global/TopNavbar'
@@ -17,9 +20,6 @@ import PullToRefresh from 'pulltorefreshjs'
1720
import { useEffect, useMemo, useState } from 'react'
1821
import { twMerge } from 'tailwind-merge'
1922
import '../../styles/globals.css'
20-
import { MarqueeWrapper } from '@/components/Global/MarqueeWrapper'
21-
import Image from 'next/image'
22-
import { HandThumbsUp } from '@/assets'
2323

2424
const publicPathRegex = /^\/(request\/pay|claim|pay\/.+$)/
2525

@@ -114,7 +114,6 @@ const Layout = ({ children }: { children: React.ReactNode }) => {
114114
</MarqueeWrapper>
115115
</button>
116116
)}
117-
118117
{/* Fixed top navbar */}
119118
{showFullPeanutWallet && (
120119
<div className="sticky top-0 z-10 w-full">

src/app/(mobile-ui)/withdraw/crypto/page.tsx

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { useRouter } from 'next/navigation'
2727
import { useCallback, useEffect, useMemo } from 'react'
2828
import { captureMessage } from '@sentry/nextjs'
2929
import type { Address } from 'viem'
30+
import { Slider } from '@/components/Slider'
3031

3132
export default function WithdrawCryptoPage() {
3233
const router = useRouter()
@@ -77,6 +78,10 @@ export default function WithdrawCryptoPage() {
7778
setError(null)
7879
}, [setError])
7980

81+
useEffect(() => {
82+
dispatch(paymentActions.resetPaymentState())
83+
}, [dispatch])
84+
8085
useEffect(() => {
8186
if (!amountToWithdraw) {
8287
console.error('Amount not available in WithdrawFlowContext for withdrawal, redirecting.')
@@ -264,13 +269,6 @@ export default function WithdrawCryptoPage() {
264269
const fromChainId = isPeanutWallet ? PEANUT_WALLET_CHAIN.id.toString() : withdrawData.chain.chainId
265270
const toChainId = activeChargeDetailsFromStore.chainId
266271

267-
console.log('Cross-chain check:', {
268-
fromChainId,
269-
toChainId,
270-
isPeanutWallet,
271-
isCrossChain: fromChainId !== toChainId,
272-
})
273-
274272
return fromChainId !== toChainId
275273
}, [withdrawData, activeChargeDetailsFromStore, isPeanutWallet])
276274

@@ -345,7 +343,7 @@ export default function WithdrawCryptoPage() {
345343
headerTitle="Withdraw"
346344
recipientType="ADDRESS"
347345
type="SEND"
348-
currencyAmount={`$ ${amountToWithdraw}`}
346+
amount={amountToWithdraw}
349347
isWithdrawFlow={true}
350348
redirectTo="/withdraw"
351349
message={
@@ -368,16 +366,16 @@ export default function WithdrawCryptoPage() {
368366
title="Is this address compatible?"
369367
description="Only send to address that support the selected network and token. Incorrect transfers may be lost."
370368
icon="alert"
371-
ctas={[
372-
{
373-
text: 'Proceed',
374-
onClick: handleCompatibilityProceed,
375-
variant: 'purple',
376-
shadowSize: '4',
377-
className: 'h-10 text-sm',
378-
icon: 'check-circle',
379-
},
380-
]}
369+
footer={
370+
<div className="w-full">
371+
<Slider
372+
onValueChange={(v: boolean) => {
373+
if (!v) return
374+
handleCompatibilityProceed()
375+
}}
376+
/>
377+
</div>
378+
}
381379
/>
382380
</div>
383381
)

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ export default function PaymentPage({ recipient, flow = 'request_pay' }: Props)
389389
<div className={twMerge('mx-auto h-full min-h-[inherit] w-full space-y-8 self-center')}>
390390
{currentView === 'INITIAL' && (
391391
<InitialPaymentView
392+
key={`initial-${flow}`}
392393
{...(parsedPaymentData as ParsedURL)}
393394
isAddMoneyFlow={isAddMoneyFlow}
394395
isDirectUsdPayment={isDirectPay}
@@ -407,6 +408,7 @@ export default function PaymentPage({ recipient, flow = 'request_pay' }: Props)
407408
)}
408409
{currentView === 'CONFIRM' && (
409410
<ConfirmPaymentView
411+
key={`confirm-${flow}`}
410412
isPintaReq={parsedPaymentData?.token?.symbol === 'PNT'}
411413
currencyAmount={currencyCode && currencyAmount ? `${currencySymbol} ${currencyAmount}` : undefined}
412414
isAddMoneyFlow={isAddMoneyFlow}
@@ -421,6 +423,7 @@ export default function PaymentPage({ recipient, flow = 'request_pay' }: Props)
421423
<TransactionDetailsReceipt transaction={selectedTransaction} />
422424
) : (
423425
<DirectSuccessView
426+
key={`success-${flow}`}
424427
headerTitle={isAddMoneyFlow ? 'Add Money' : 'Send'}
425428
recipientType={parsedPaymentData?.recipient?.recipientType}
426429
type="SEND"

0 commit comments

Comments
 (0)