From aeaa556349a4cb38967017a04128e1498ed9fdca Mon Sep 17 00:00:00 2001
From: kushagrasarathe <76868364+kushagrasarathe@users.noreply.github.com>
Date: Tue, 26 May 2026 16:46:01 +0530
Subject: [PATCH] Fix Bridge KYC gates
Fresh Bridge-country deposit users (e.g. Germany) were treated as
transfer-ready before standard KYC. Now a needs_kyc gate fires for
users with no Sumsub approval and no approved Bridge rail, opening
the standard KYC modal instead of the transfer confirmation slider.
Also fixes abandoned-KYC drawer CTAs leaking React click events into
KYC initiation callbacks, preventing circular JSON errors from DOM
event objects.
Adapted from #2101 (dev-based) for the main branch.
---
.../__tests__/add-money-states.test.tsx | 4 +-
.../Kyc/states/KycActionRequired.tsx | 2 +-
src/components/Kyc/states/KycFailed.tsx | 2 +-
src/components/Kyc/states/KycNotStarted.tsx | 2 +-
.../Kyc/states/KycRequiresDocuments.tsx | 8 +-
.../states/__tests__/KycNotStarted.test.tsx | 94 +++++++++++++++++++
.../useBridgeTransferReadiness.test.ts | 20 ++++
src/hooks/useBridgeTransferReadiness.ts | 17 +++-
8 files changed, 139 insertions(+), 10 deletions(-)
create mode 100644 src/components/Kyc/states/__tests__/KycNotStarted.test.tsx
diff --git a/src/app/(mobile-ui)/add-money/__tests__/add-money-states.test.tsx b/src/app/(mobile-ui)/add-money/__tests__/add-money-states.test.tsx
index 91a24a606..4a2b2b0fc 100644
--- a/src/app/(mobile-ui)/add-money/__tests__/add-money-states.test.tsx
+++ b/src/app/(mobile-ui)/add-money/__tests__/add-money-states.test.tsx
@@ -1109,12 +1109,12 @@ describe('GROUP 5: Bridge Bank Onramp', () => {
expect(screen.getByText('Country not found')).toBeInTheDocument()
})
- test('user not KYC approved shows InitiateKycModal on Continue', async () => {
+ test('fresh user needs KYC before Bridge deposit confirmation', async () => {
mockUseKycStatus.mockReturnValue({
isUserKycApproved: false,
isUserMantecaKycApproved: false,
})
- mockGate.mockReturnValue({ type: 'needs_enrollment' })
+ mockGate.mockReturnValue({ type: 'needs_kyc' })
resetQueryState({ step: 'inputAmount', amount: '100' })
renderWithProviders()
diff --git a/src/components/Kyc/states/KycActionRequired.tsx b/src/components/Kyc/states/KycActionRequired.tsx
index 418f28842..a2ba581f3 100644
--- a/src/components/Kyc/states/KycActionRequired.tsx
+++ b/src/components/Kyc/states/KycActionRequired.tsx
@@ -24,7 +24,7 @@ export const KycActionRequired = ({
icon={'retry' as IconName}
className="w-full"
shadowSize="4"
- onClick={onResume}
+ onClick={() => onResume()}
disabled={isLoading}
>
{isLoading ? 'Loading...' : 'Re-submit verification'}
diff --git a/src/components/Kyc/states/KycFailed.tsx b/src/components/Kyc/states/KycFailed.tsx
index 01166f00c..3c224c18b 100644
--- a/src/components/Kyc/states/KycFailed.tsx
+++ b/src/components/Kyc/states/KycFailed.tsx
@@ -97,7 +97,7 @@ export const KycFailed = ({
variant="purple"
className="w-full"
shadowSize="4"
- onClick={onRetry}
+ onClick={() => onRetry()}
disabled={isLoading}
>
{isLoading ? 'Loading...' : 'Retry verification'}
diff --git a/src/components/Kyc/states/KycNotStarted.tsx b/src/components/Kyc/states/KycNotStarted.tsx
index cb649ade9..e55149ff0 100644
--- a/src/components/Kyc/states/KycNotStarted.tsx
+++ b/src/components/Kyc/states/KycNotStarted.tsx
@@ -15,7 +15,7 @@ export const KycNotStarted = ({ onResume, isLoading }: { onResume: () => void; i
payments."
/>
-