Skip to content

Conversation

kushagrasarathe
Copy link
Contributor

@kushagrasarathe kushagrasarathe commented Sep 16, 2025

  • contributes to TASK-14783
Screenshot 2025-09-16 at 1 26 19 PM Screenshot 2025-09-16 at 1 26 30 PM

Copy link

vercel bot commented Sep 16, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
peanut-wallet Ready Ready Preview Comment Sep 16, 2025 8:26am

Copy link
Contributor

coderabbitai bot commented Sep 16, 2025

Warning

Rate limit exceeded

@kushagrasarathe has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 6 minutes and 40 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between d09105c and d4226d4.

📒 Files selected for processing (5)
  • src/app/(mobile-ui)/add-money/[country]/bank/page.tsx (2 hunks)
  • src/components/Claim/Link/views/BankFlowManager.view.tsx (2 hunks)
  • src/components/Kyc/InitiateBridgeKYCModal.tsx (1 hunks)
  • src/components/Kyc/KycStatusDrawer.tsx (4 hunks)
  • src/components/Request/views/ReqFulfillBankFlowManager.tsx (2 hunks)

Walkthrough

Refactors KYC history and status handling to support verification objects and bridge KYC statuses, adds live WebSocket updates, introduces country/region display components, updates KYC state views and drawer, swaps to InitiateBridgeKYCModal in flows, adds Image styling prop to IconStack, and extends KYC-related types.

Changes

Cohort / File(s) Summary of Changes
Mobile history page
src/app/(mobile-ui)/history/page.tsx
Remove unused pathname usage; guard history building by loading state; integrate KYC entries generation changes and update rendering/empty-state logic.
Home history UI
src/components/Home/HomeHistory.tsx
Gate history processing with isLoading; inject bridge KYC status entry and per-verification entries for same-user views; pass verification/bridge props to KycStatusItem; adjust Activity/empty-state rendering.
KYC drawer & item
src/components/Kyc/KycStatusDrawer.tsx, src/components/Kyc/KycStatusItem.tsx
Drawer accepts optional verification or bridgeKycStatus, derives timestamps/country from user or verification, mounts separate bridge/manteca iframes, fetches rejection reasons; Item subscribes to WebSocket, resolves status from verification/bridge/user, adjusts subtitle/date and drawer invocation.
KYC state views
src/components/Kyc/states/KycCompleted.tsx, src/components/Kyc/states/KycFailed.tsx, src/components/Kyc/states/KycProcessing.tsx
Add optional countryCode/isBridge props; render CountryRegionRow; update content (status/reason/retry) and button loading handling.
New KYC display components
src/components/Kyc/Country-Flag-And-Name.tsx, src/components/Kyc/CountryRegionRow.tsx
Add components to render single or bridge multi-flag visuals and encapsulate Country/Region PaymentInfoRow.
KYC modal migrations
src/components/Kyc/InitiateBridgeKYCModal.tsx, src/app/(mobile-ui)/add-money/[country]/bank/page.tsx, src/components/AddWithdraw/AddWithdrawCountriesList.tsx, src/components/Claim/Link/views/BankFlowManager.view.tsx, src/components/Request/views/ReqFulfillBankFlowManager.tsx
Rename/replace InitiateKYCModal → InitiateBridgeKYCModal, update prop typing (BridgeKycModalFlowProps) and add onManualClose/flow usage where applied.
Icon stack UI
src/components/Global/IconStack.tsx
Add optional imageClassName?: string prop and twMerge it with base classes for the inner Image element.
Hooks & types
src/hooks/useBridgeKycFlow.ts, src/interfaces/interfaces.ts
Convert KycHistoryEntry to interface with optional verification and bridgeKycStatus; import IUserKycVerification; extend IUserKycVerification with required createdAt and updatedAt fields.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • Zishan-7
  • jjramirezn

Suggested labels

enhancement

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The PR title "feat: kyc activity updates" is concise and accurately captures the primary scope of the changeset, which centers on KYC-related UI, data-model, and flow updates across multiple files; it is specific enough for a teammate scanning history to understand the main change.
Description Check ✅ Passed The PR description references TASK-14783 and includes screenshots relevant to the KYC UI changes in the diff; while brief, it is on-topic and therefore passes this lenient check.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai bot added the enhancement New feature or request label Sep 16, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (9)
src/interfaces/interfaces.ts (1)

230-240: Consider a discriminated union for provider-specific statuses

provider: 'MANTECA' | 'BRIDGE' with status: MantecaKycStatus risks confusion for BRIDGE. Prefer a discriminated union so status aligns with provider, or document that status is only meaningful for MANTECA.

-export interface IUserKycVerification {
-  provider: 'MANTECA' | 'BRIDGE'
-  ...
-  status: MantecaKycStatus
-  ...
-}
+type MantecaVerification = {
+  provider: 'MANTECA'
+  status: MantecaKycStatus
+  ...
+}
+type BridgeVerification = {
+  provider: 'BRIDGE'
+  bridgeGeo?: string | null
+  ...
+}
+export type IUserKycVerification = MantecaVerification | BridgeVerification
src/components/Global/IconStack.tsx (1)

18-21: Align wrapper/image sizing with iconSize to avoid clipping and overfetching

The wrapper enforces 24px (min/max-h/w-6) while callers can pass iconSize=80 and a 20px imageClassName. This mismatch can clip or waste bandwidth.

Apply this to size the wrapper by iconSize and drop fixed h/w classes:

-                    className={twMerge(
-                        `flex max-h-6 min-h-6 min-w-6 max-w-6 items-center justify-center rounded-full bg-white`,
-                        iconClassName
-                    )}
-                    style={{ zIndex: index }}
+                    className={twMerge(
+                        `flex items-center justify-center rounded-full bg-white`,
+                        iconClassName
+                    )}
+                    style={{ zIndex: index, width: iconSize, height: iconSize }}

Optionally, keep image classes purely for shape, not size:

-                        className={twMerge('min-h-6 min-w-6 rounded-full', imageClassName)}
+                        className={twMerge('rounded-full', imageClassName)}

Also applies to: 28-28

src/components/Kyc/CountryRegionRow.tsx (1)

15-18: Avoid passing empty string when countryCode is absent

You already guard above. Passing '' isn’t needed and can lead to accidental broken URLs if reused elsewhere.

-            value={<CountryFlagAndName countryCode={countryCode ?? ''} isBridgeRegion={isBridge} />}
+            value={<CountryFlagAndName countryCode={countryCode ?? undefined} isBridgeRegion={isBridge} />}
src/components/Kyc/Country-Flag-And-Name.tsx (1)

39-39: Update comment to reflect broader use

This component is now used across multiple KYC states, not just “completed”.

-// this component is used for the completed state of the kyc
+// Used across KYC states to render country/region flags and labels
src/app/(mobile-ui)/history/page.tsx (1)

162-169: Use the item’s timestamp to keep subtitle consistent with sort.

Passing user store time can drift from the item being rendered if state updates mid‑render. Prefer the entry’s timestamp.

-                                    bridgeKycStartedAt={
-                                        item.bridgeKycStatus ? user?.user.bridgeKycStartedAt : undefined
-                                    }
+                                    bridgeKycStartedAt={item.bridgeKycStatus ? item.timestamp : undefined}
src/components/Kyc/KycStatusItem.tsx (2)

17-25: Prop types look good; consider allowing null for bridgeKycStartedAt.

Upstream may pass null; widening avoids unnecessary casts.

-    bridgeKycStartedAt?: string
+    bridgeKycStartedAt?: string | null

47-60: Avoid brittle string split on formatted date.

Splitting formatDate by " - " couples the UI to a formatting detail. Prefer a date‑only formatter.

Example:

const formatDateOnly = (d: Date) =>
  new Intl.DateTimeFormat('en-US', { year: 'numeric', month: 'long', day: 'numeric' }).format(d)

// ...
return `Submitted on ${formatDateOnly(new Date(date))}`
src/components/Home/HomeHistory.tsx (1)

286-296: Keep subtitle date consistent with sorted timestamp.

As in the mobile history page, prefer the entry’s timestamp when rendering a bridge KYC item.

-                                    bridgeKycStartedAt={
-                                        item.bridgeKycStatus ? user?.user.bridgeKycStartedAt : undefined
-                                    }
+                                    bridgeKycStartedAt={item.bridgeKycStatus ? item.timestamp : undefined}
src/components/Kyc/KycStatusDrawer.tsx (1)

52-56: Fetch rejection reasons only for Bridge KYC and guard against state updates after close.

Avoid hitting getKycDetails for Manteca verifications and prevent setting state after the drawer closes.

Here’s a safe pattern (outside the changed range):

useEffect(() => {
  let cancelled = false
  if (isOpen && isBridgeKyc && statusCategory === 'failed') {
    ;(async () => {
      setIsLoading(true)
      setRejectionReason(null)
      try {
        const response = await getKycDetails()
        if (cancelled) return
        if (response.data?.reasons?.length) setRejectionReason(response.data.reasons[0].reason)
        else if (response.error) setRejectionReason(response.error)
        else setRejectionReason('No specific reason provided.')
      } catch (e: unknown) {
        if (!cancelled) setRejectionReason((e as Error).message || 'Could not retrieve rejection reason.')
      } finally {
        if (!cancelled) setIsLoading(false)
      }
    })()
  }
  return () => {
    cancelled = true
  }
}, [isOpen, isBridgeKyc, statusCategory])
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b6e0026 and c32cd1b.

📒 Files selected for processing (12)
  • src/app/(mobile-ui)/history/page.tsx (4 hunks)
  • src/components/Global/IconStack.tsx (2 hunks)
  • src/components/Home/HomeHistory.tsx (5 hunks)
  • src/components/Kyc/Country-Flag-And-Name.tsx (1 hunks)
  • src/components/Kyc/CountryRegionRow.tsx (1 hunks)
  • src/components/Kyc/KycStatusDrawer.tsx (3 hunks)
  • src/components/Kyc/KycStatusItem.tsx (3 hunks)
  • src/components/Kyc/states/KycCompleted.tsx (2 hunks)
  • src/components/Kyc/states/KycFailed.tsx (2 hunks)
  • src/components/Kyc/states/KycProcessing.tsx (2 hunks)
  • src/hooks/useBridgeKycFlow.ts (1 hunks)
  • src/interfaces/interfaces.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (6)
📚 Learning: 2025-05-22T15:38:48.586Z
Learnt from: kushagrasarathe
PR: peanutprotocol/peanut-ui#869
File: src/app/(mobile-ui)/withdraw/page.tsx:82-88
Timestamp: 2025-05-22T15:38:48.586Z
Learning: The country-specific withdrawal route exists at src/app/(mobile-ui)/withdraw/[...country]/page.tsx and renders the AddWithdrawCountriesList component with flow="withdraw".

Applied to files:

  • src/components/Kyc/CountryRegionRow.tsx
📚 Learning: 2025-08-14T14:42:54.411Z
Learnt from: Zishan-7
PR: peanutprotocol/peanut-ui#1094
File: src/utils/withdraw.utils.ts:181-191
Timestamp: 2025-08-14T14:42:54.411Z
Learning: The countryCodeMap in src/components/AddMoney/consts/index.ts uses uppercase 3-letter country codes as keys (like 'AUT', 'BEL', 'CZE') that map to 2-letter country codes, requiring input normalization to uppercase for proper lookups.

Applied to files:

  • src/components/Kyc/Country-Flag-And-Name.tsx
  • src/components/Kyc/states/KycFailed.tsx
📚 Learning: 2025-08-14T14:36:18.758Z
Learnt from: Zishan-7
PR: peanutprotocol/peanut-ui#1094
File: src/components/Claim/Link/views/BankFlowManager.view.tsx:0-0
Timestamp: 2025-08-14T14:36:18.758Z
Learning: Bridge API requires ISO3 country codes (3-letter codes like "USA", "GBR") while flag display components need ISO2 codes (2-letter codes like "US", "GB").

Applied to files:

  • src/components/Kyc/Country-Flag-And-Name.tsx
📚 Learning: 2025-08-15T08:05:05.417Z
Learnt from: Zishan-7
PR: peanutprotocol/peanut-ui#1098
File: src/components/LandingPage/noFees.tsx:243-248
Timestamp: 2025-08-15T08:05:05.417Z
Learning: In the peanut-ui project, when displaying country flags from external CDNs like flagcdn.com, the preference is to show country-specific images without fallback handling. The team prioritizes showing accurate country flags over having generic fallback images.

Applied to files:

  • src/components/Kyc/Country-Flag-And-Name.tsx
📚 Learning: 2025-05-15T14:47:26.891Z
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#857
File: src/hooks/useWebSocket.ts:77-82
Timestamp: 2025-05-15T14:47:26.891Z
Learning: The useWebSocket hook in src/hooks/useWebSocket.ts is designed to provide raw history entries, while the components using it (such as HomeHistory.tsx) are responsible for implementing deduplication logic based on UUID to prevent duplicate entries when combining WebSocket data with other data sources.

Applied to files:

  • src/components/Home/HomeHistory.tsx
  • src/app/(mobile-ui)/history/page.tsx
📚 Learning: 2025-04-11T11:33:53.245Z
Learnt from: kushagrasarathe
PR: peanutprotocol/peanut-ui#798
File: src/components/Home/HomeHistory.tsx:138-192
Timestamp: 2025-04-11T11:33:53.245Z
Learning: In the HomeHistory component, infinite scrolling is intentionally not implemented despite the presence of useInfiniteQuery and IntersectionObserver code. The component is designed to only display the first 5 entries with a "View all transactions" link for viewing the complete history.

Applied to files:

  • src/app/(mobile-ui)/history/page.tsx
🧬 Code graph analysis (10)
src/components/Kyc/states/KycCompleted.tsx (2)
src/components/Kyc/CountryRegionRow.tsx (1)
  • CountryRegionRow (9-20)
src/components/Payment/PaymentInfoRow.tsx (1)
  • PaymentInfoRow (7-81)
src/components/Kyc/CountryRegionRow.tsx (2)
src/components/Payment/PaymentInfoRow.tsx (1)
  • PaymentInfoRow (7-81)
src/components/Kyc/Country-Flag-And-Name.tsx (1)
  • CountryFlagAndName (10-37)
src/components/Kyc/Country-Flag-And-Name.tsx (1)
src/components/AddMoney/consts/index.ts (1)
  • countryData (271-2439)
src/components/Kyc/states/KycProcessing.tsx (1)
src/components/Kyc/CountryRegionRow.tsx (1)
  • CountryRegionRow (9-20)
src/components/Home/HomeHistory.tsx (2)
src/components/Kyc/KycStatusItem.tsx (1)
  • KycStatusItem (14-92)
src/components/Global/EmptyStates/EmptyState.tsx (1)
  • EmptyState (13-28)
src/app/(mobile-ui)/history/page.tsx (1)
src/components/Kyc/KycStatusItem.tsx (1)
  • KycStatusItem (14-92)
src/components/Kyc/KycStatusItem.tsx (4)
src/components/Global/Card/index.tsx (1)
  • CardPosition (4-4)
src/interfaces/interfaces.ts (1)
  • IUserKycVerification (230-240)
src/utils/bridge-accounts.utils.ts (1)
  • BridgeKycStatus (34-34)
src/utils/general.utils.ts (1)
  • formatDate (937-949)
src/components/Kyc/states/KycFailed.tsx (2)
src/components/Kyc/CountryRegionRow.tsx (1)
  • CountryRegionRow (9-20)
src/components/Payment/PaymentInfoRow.tsx (1)
  • PaymentInfoRow (7-81)
src/components/Kyc/KycStatusDrawer.tsx (7)
src/utils/bridge-accounts.utils.ts (1)
  • BridgeKycStatus (34-34)
src/interfaces/interfaces.ts (1)
  • IUserKycVerification (230-240)
src/redux/hooks.ts (1)
  • useUserStore (13-13)
src/hooks/useBridgeKycFlow.ts (1)
  • useBridgeKycFlow (30-180)
src/components/Kyc/states/KycProcessing.tsx (1)
  • KycProcessing (9-42)
src/components/Kyc/states/KycCompleted.tsx (1)
  • KycCompleted (9-38)
src/components/Kyc/states/KycFailed.tsx (1)
  • KycFailed (11-53)
src/hooks/useBridgeKycFlow.ts (2)
src/interfaces/interfaces.ts (1)
  • IUserKycVerification (230-240)
src/utils/bridge-accounts.utils.ts (1)
  • BridgeKycStatus (34-34)
🔇 Additional comments (20)
src/components/Global/IconStack.tsx (1)

8-8: Prop addition LGTM

imageClassName unlocks needed styling control without breaking existing uses.

src/components/Kyc/CountryRegionRow.tsx (1)

9-13: Conditional render guard is solid

Rendering only when bridge region or countryCode is present prevents broken flag URLs.

src/components/Kyc/states/KycFailed.tsx (1)

40-46: LGTM: clear reason messaging and added Country/Region

This improves context for users after rejection without overexposing backend details.

src/components/Kyc/states/KycProcessing.tsx (1)

33-33: LGTM: Country/Region in processing state

Consistent with other states and keeps users informed during review.

src/components/Kyc/states/KycCompleted.tsx (1)

33-35: LGTM: Country/Region plus concise success copy

Good UX polish; confirms verification and shows region context.

src/hooks/useBridgeKycFlow.ts (1)

17-23: Approved — history entries populate new fields

src/components/Home/HomeHistory.tsx and src/app/(mobile-ui)/history/page.tsx push KYC history entries that include bridgeKycStatus and verification; no changes required.

src/components/Kyc/Country-Flag-And-Name.tsx (1)

10-35: ```shell
#!/bin/bash
set -euo pipefail

echo "=== 1) Show src/components/Kyc/Country-Flag-And-Name.tsx (if present) ==="
if [ -f src/components/Kyc/Country-Flag-And-Name.tsx ]; then
sed -n '1,240p' src/components/Kyc/Country-Flag-And-Name.tsx || true
else
echo "File not found: src/components/Kyc/Country-Flag-And-Name.tsx"
fi

echo
echo "=== 2) Find usages of CountryFlagAndName ==="
rg -n --hidden --no-ignore 'CountryFlagAndName' -C3 src || true

echo
echo "=== 3) Search for countryData definitions / country lists ==="
rg -n --hidden --no-ignore 'countryData' -C3 || true
rg -n --hidden --no-ignore 'countryCodeMap' -C3 || true

echo
echo "=== 4) Search for iso2 / iso3 fields and flagcdn usages ==="
rg -n --hidden --no-ignore 'iso2|iso3|iso_2|iso_3' -S -C3 || true
rg -n --hidden --no-ignore 'flagcdn' -S || true

echo
echo "=== 5) Show next.config.js (to check images.remotePatterns / domains) ==="
if [ -f next.config.js ]; then
sed -n '1,240p' next.config.js || true
else
echo "File not found: next.config.js"
fi

echo
echo "=== 6) Find IconStack component usage / definition ==="
rg -n --hidden --no-ignore 'IconStack' -C3 src || true

echo
echo "=== 7) Find occurrences of prop name 'countryCode' to inspect passed values ==="
rg -n --hidden --no-ignore 'countryCode' -C3 src || true


</blockquote></details>
<details>
<summary>src/interfaces/interfaces.ts (1)</summary><blockquote>

`238-239`: **createdAt/updatedAt: confirm API contract or make fields optional**

Found required timestamps in src/interfaces/interfaces.ts (lines 238–239) and in services.types.ts; multiple call sites rely on them or assume presence. Unguarded usages to address: src/components/Claim/Claim.tsx:106 (new Date(claimLinkData.createdAt)), src/components/TransactionDetails/TransactionDetailsReceipt.tsx:306 (transaction.createdAt! used), src/components/Payment/Views/Status.payment.view.tsx:107, src/app/[...recipient]/client.tsx:323. Action: confirm the backend always returns createdAt/updatedAt for all providers/historical records; if not, mark these fields optional and add guards/fallbacks (or default values) at the listed call sites.

</blockquote></details>
<details>
<summary>src/app/(mobile-ui)/history/page.tsx (3)</summary><blockquote>

`64-66`: **Good guard to avoid work during loading.**

Early-returning an empty list while loading prevents unnecessary computation and flicker.

---

`95-95`: **Correct dependency list.**

Including isLoading ensures recomputation once data is ready.

---

`112-121`: **Empty state behavior reads well.**

Shows NoData when not loading and no entries; consistent with surrounding UX.

</blockquote></details>
<details>
<summary>src/components/Kyc/KycStatusItem.tsx (2)</summary><blockquote>

`44-46`: **Status resolution is sound.**

Live WS status > prop > store is a sensible precedence; deriving kycStatus from verification when present is correct.

---

`87-89`: **Drawer props align with new data flow.**

Passing verification and finalBridgeKycStatus matches the updated drawer API.

</blockquote></details>
<details>
<summary>src/components/Home/HomeHistory.tsx (1)</summary><blockquote>

`84-84`: **Good: process only after load completes.**

Prevents transient empty/partial combined lists.

</blockquote></details>
<details>
<summary>src/components/Kyc/KycStatusDrawer.tsx (6)</summary><blockquote>

`15-29`: **Status mapping covers both Bridge and Manteca.**

ACTIVE/approved → completed, INACTIVE/rejected → failed, otherwise processing. Looks correct.

---

`10-13`: **Good: type-driven inputs and store access.**

Accepting IUserKycVerification and reading fallback timestamps from the store aligns with upstream changes.

---

`93-101`: **Processing state rendering is consistent with new data flow.**

Reads startedAt from store, passes country and isBridge flags. LGTM.

---

`103-109`: **Completed state rendering is consistent.**

Uses verification.approvedAt then store fallback; includes country and isBridge. Good.

---

`114-118`: **Failed state rendering is consistent.**

Passes rejection reason and retry handler via useBridgeKycFlow. Good.

---

`126-126`: **Guarding not_started/unknown avoids rendering a no-op drawer.**

Correct early return.

</blockquote></details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Copy link

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (7)
src/components/Kyc/InitiateBridgeKYCModal.tsx (1)

50-67: Make error CTA a true “Retry” and avoid rendering raw error as button text.

Using the error string as the CTA label can be noisy. Prefer a stable “Retry” label that retriggers KYC; keep detailed error copy elsewhere if needed.

Apply:

-                    {
-                        hidden: !error,
-                        text: error ?? 'Retry',
-                        onClick: onClose,
-                        variant: 'transparent',
-                        className:
-                            'underline text-xs md:text-sm !font-normal w-full !transform-none !pt-2 text-error-3 px-0',
-                    },
+                    {
+                        hidden: !error,
+                        text: 'Retry',
+                        onClick: handleVerifyClick,
+                        disabled: isLoading,
+                        variant: 'transparent',
+                        className:
+                            'underline text-xs md:text-sm !font-normal w-full !transform-none !pt-2 text-error-3 px-0',
+                    },
src/components/Claim/Link/views/BankFlowManager.view.tsx (1)

483-487: Pass flow to modal for accurate telemetry/routing inside the hook.

Claim-to-bank is effectively a withdrawal context; feed that through.

-                    <InitiateBridgeKYCModal
+                    <InitiateBridgeKYCModal
                         isOpen={isKycModalOpen}
                         onClose={() => setIsKycModalOpen(false)}
-                        onKycSuccess={handleKycSuccess}
+                        onKycSuccess={handleKycSuccess}
+                        flow="withdraw"
                     />

Please confirm that useBridgeKycFlow uses this to adjust analytics or copy; if it is intentionally optional here, feel free to skip.

src/components/AddWithdraw/AddWithdrawCountriesList.tsx (2)

247-251: Provide flow to the modal so the hook has full context.

Forward the parent prop; no behavior change expected, but improves consistency/telemetry.

                 <InitiateBridgeKYCModal
                     isOpen={isKycModalOpen}
                     onClose={() => setIsKycModalOpen(false)}
                     onKycSuccess={handleKycSuccess}
+                    flow={flow}
                 />

351-355: Mirror the same flow prop in the footer modal instance.

Keeps both instances consistent.

             <InitiateBridgeKYCModal
                 isOpen={isKycModalOpen}
                 onClose={() => setIsKycModalOpen(false)}
                 onKycSuccess={handleKycSuccess}
+                flow={flow}
             />
src/components/Kyc/states/KycFailed.tsx (1)

50-59: Use Button’s loading prop and add aria-busy for better UX/a11y.

Leverage the Button’s built‑in spinner and expose loading state to assistive tech.

Apply this diff:

-            <Button
+            <Button
                 icon="retry"
                 variant="purple"
                 className="w-full"
                 shadowSize="4"
                 onClick={onRetry}
-                disabled={isLoading}
+                disabled={isLoading}
+                loading={isLoading}
+                aria-busy={isLoading}
             >
-                {isLoading ? 'Loading...' : 'Retry verification'}
+                Retry verification
             </Button>
src/components/Kyc/KycStatusDrawer.tsx (2)

59-71: Avoid unsafe type assertion for country; pass it through as optional.

country may be undefined; asserting as CountryData masks that. The hook accepts an optional param, so pass it directly.

Apply this diff:

-    const country = countryCode ? countryData.find((c) => c.id.toUpperCase() === countryCode.toUpperCase()) : undefined
+    const country = countryCode
+        ? countryData.find((c) => c.id.toUpperCase() === countryCode.toUpperCase())
+        : undefined
@@
-        if (provider === 'MANTECA') {
-            await openMantecaKyc(country as CountryData)
+        if (provider === 'MANTECA') {
+            await openMantecaKyc(country)
         } else {
             await initiateBridgeKyc()
         }

Also applies to: 73-79


162-164: Gate IFrame mounts to when a URL exists.

Prevents unnecessary renders/listeners when options are empty.

Apply this diff:

-            <IFrameWrapper {...bridgeIframeOptions} onClose={handleBridgeIframeClose} />
-            <IFrameWrapper {...mantecaIframeOptions} onClose={handleMantecaIframeClose} />
+            {bridgeIframeOptions?.src && (
+                <IFrameWrapper {...bridgeIframeOptions} onClose={handleBridgeIframeClose} />
+            )}
+            {mantecaIframeOptions?.src && (
+                <IFrameWrapper {...mantecaIframeOptions} onClose={handleMantecaIframeClose} />
+            )}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c32cd1b and d09105c.

📒 Files selected for processing (8)
  • src/app/(mobile-ui)/add-money/[country]/bank/page.tsx (2 hunks)
  • src/components/AddWithdraw/AddWithdrawCountriesList.tsx (3 hunks)
  • src/components/Claim/Link/views/BankFlowManager.view.tsx (2 hunks)
  • src/components/Kyc/Country-Flag-And-Name.tsx (1 hunks)
  • src/components/Kyc/InitiateBridgeKYCModal.tsx (1 hunks)
  • src/components/Kyc/KycStatusDrawer.tsx (4 hunks)
  • src/components/Kyc/states/KycFailed.tsx (2 hunks)
  • src/components/Request/views/ReqFulfillBankFlowManager.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/Kyc/Country-Flag-And-Name.tsx
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2024-10-25T11:33:46.776Z
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#484
File: src/components/Cashout/Components/Initial.view.tsx:273-274
Timestamp: 2024-10-25T11:33:46.776Z
Learning: In the `InitialCashoutView` component (`src/components/Cashout/Components/Initial.view.tsx`), linked bank accounts should not generate error states, and the `ValidatedInput` component will clear any error messages if needed. Therefore, it's unnecessary to manually clear the error state when selecting or clearing linked bank accounts.

Applied to files:

  • src/components/Claim/Link/views/BankFlowManager.view.tsx
  • src/components/AddWithdraw/AddWithdrawCountriesList.tsx
📚 Learning: 2025-05-22T15:38:48.586Z
Learnt from: kushagrasarathe
PR: peanutprotocol/peanut-ui#869
File: src/app/(mobile-ui)/withdraw/page.tsx:82-88
Timestamp: 2025-05-22T15:38:48.586Z
Learning: The country-specific withdrawal route exists at src/app/(mobile-ui)/withdraw/[...country]/page.tsx and renders the AddWithdrawCountriesList component with flow="withdraw".

Applied to files:

  • src/components/Claim/Link/views/BankFlowManager.view.tsx
  • src/app/(mobile-ui)/add-money/[country]/bank/page.tsx
  • src/components/AddWithdraw/AddWithdrawCountriesList.tsx
📚 Learning: 2025-08-14T14:42:54.411Z
Learnt from: Zishan-7
PR: peanutprotocol/peanut-ui#1094
File: src/utils/withdraw.utils.ts:181-191
Timestamp: 2025-08-14T14:42:54.411Z
Learning: The countryCodeMap in src/components/AddMoney/consts/index.ts uses uppercase 3-letter country codes as keys (like 'AUT', 'BEL', 'CZE') that map to 2-letter country codes, requiring input normalization to uppercase for proper lookups.

Applied to files:

  • src/app/(mobile-ui)/add-money/[country]/bank/page.tsx
🧬 Code graph analysis (6)
src/components/Request/views/ReqFulfillBankFlowManager.tsx (1)
src/components/Kyc/InitiateBridgeKYCModal.tsx (1)
  • InitiateBridgeKYCModal (15-76)
src/components/Claim/Link/views/BankFlowManager.view.tsx (1)
src/components/Kyc/InitiateBridgeKYCModal.tsx (1)
  • InitiateBridgeKYCModal (15-76)
src/components/Kyc/states/KycFailed.tsx (3)
src/components/Kyc/CountryRegionRow.tsx (1)
  • CountryRegionRow (9-20)
src/components/Payment/PaymentInfoRow.tsx (1)
  • PaymentInfoRow (7-81)
src/components/0_Bruddle/Button.tsx (1)
  • Button (76-267)
src/app/(mobile-ui)/add-money/[country]/bank/page.tsx (1)
src/components/Kyc/InitiateBridgeKYCModal.tsx (1)
  • InitiateBridgeKYCModal (15-76)
src/components/AddWithdraw/AddWithdrawCountriesList.tsx (1)
src/components/Kyc/InitiateBridgeKYCModal.tsx (1)
  • InitiateBridgeKYCModal (15-76)
src/components/Kyc/KycStatusDrawer.tsx (9)
src/utils/bridge-accounts.utils.ts (1)
  • BridgeKycStatus (34-34)
src/interfaces/interfaces.ts (1)
  • IUserKycVerification (230-240)
src/redux/hooks.ts (1)
  • useUserStore (13-13)
src/hooks/useBridgeKycFlow.ts (1)
  • useBridgeKycFlow (30-180)
src/components/AddMoney/consts/index.ts (2)
  • countryData (271-2439)
  • CountryData (153-162)
src/hooks/useMantecaKycFlow.ts (1)
  • useMantecaKycFlow (16-98)
src/components/Kyc/states/KycProcessing.tsx (1)
  • KycProcessing (9-42)
src/components/Kyc/states/KycCompleted.tsx (1)
  • KycCompleted (9-38)
src/components/Kyc/states/KycFailed.tsx (1)
  • KycFailed (11-62)
🔇 Additional comments (10)
src/components/Kyc/InitiateBridgeKYCModal.tsx (1)

7-13: Props interface rename looks good.

The shape reads clean and optionality makes sense for broad reuse.

src/components/Request/views/ReqFulfillBankFlowManager.tsx (2)

13-13: Import swap to Bridge modal is correct.

Consistent with the PR-wide migration.


161-173: KYC modal wiring matches the flow intent.

Passing flow="request_fulfillment" and a targeted onManualClose that resets view state is spot on.

src/components/Claim/Link/views/BankFlowManager.view.tsx (1)

33-33: Import update LGTM.

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

28-28: Import swap to Bridge modal LGTM.


308-315: Nice: supplies flow and a context-aware manual close.

This aligns the add-money path with the new bridge KYC flow.

src/components/AddWithdraw/AddWithdrawCountriesList.tsx (1)

28-28: Import migration looks good.

src/components/Kyc/states/KycFailed.tsx (1)

7-7: Country/Region row integration looks good.

Propagating countryCode/isBridge and reusing CountryRegionRow keeps this consistent with the other KYC states.

Also applies to: 42-42

src/components/Kyc/KycStatusDrawer.tsx (2)

17-30: Status mapping reads well and covers both providers.

Good normalization of Bridge and Manteca statuses into UI categories; defaulting to “processing” is sensible.


153-154: Early return for ‘not_started’ avoids showing a misleading “processing” state.

This guard prevents accidental drawer render before a flow actually begins.

Copy link
Contributor

@jjramirezn jjramirezn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, check comments before merging

@kushagrasarathe kushagrasarathe merged commit 0f90d9d into feat/manteca-kyc Sep 17, 2025
4 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Sep 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants