import * as React from "react"; import { ChevronLeft, ChevronRight } from "lucide-react"; import { cn } from "@/lib/utils"; import { Button } from "@/components/ui/button"; // ─── Types ──────────────────────────────────────────────────────────────────── export type BankAccountItem = { id: string; name: string; balance?: string; institutionName?: string; institutionLogoUrl?: string; }; export type BankAccountCategory = | "banking" | "home-loan" | "credit-card" | "personal-loan"; export type BankAccountsByCategory = Partial< Record >; export type BankingAccountsConnectApplicant = { name: string; email?: string; }; export type BankingAccountsConnectProps = { applicant: BankingAccountsConnectApplicant; /** Connected accounts grouped by category. All accounts are flattened and shown in a single grid. */ accountsByCategory?: BankAccountsByCategory; /** Called when the "Connect Your Bank +" tile is clicked. */ onConnectBank?: () => void; onNext?: () => void; onPrev?: () => void; /** Hide the built-in Previous/Next navigation row — use when the parent wizard shell provides navigation. */ hideNavigation?: boolean; className?: string; }; // ─── Component ──────────────────────────────────────────────────────────────── /** * BankingAccountsConnect — shown on the Connections tab when the applicant * already has at least one bank account connected. * * Renders all connected accounts as horizontal card tiles plus a * "Connect Your Bank +" tile to add more. Layout mirrors the bank-selection * grid in ConnectBankStep. * * Figma: WealthX-Backoffice---Mobile-App — node 19308:53046 (Connection section) */ export function BankingAccountsConnect({ accountsByCategory = {}, onConnectBank, onNext, onPrev, hideNavigation = false, className, }: BankingAccountsConnectProps) { // Flatten all category accounts into a single list for display const allAccounts = ([] as BankAccountItem[]).concat( ...Object.values(accountsByCategory), ); return (
{/* Heading with left accent bar */}

Connect Available Banking Information

This will help auto-populate your application form and remove the need to upload bank statements.

{/* Connected accounts grid */}

Your Connected Accounts

{/* Tile grid — same border-collapse trick as ConnectBankStep. Capped at 2 columns (1 on mobile): the wizard's content area is ~628px wide regardless of viewport, so 3 columns leave too little room for longer account names (e.g. "ANZ Home Loan ••4512") and truncate even on desktop. */}
{allAccounts.map((account: BankAccountItem) => (
{/* Institution logo or abbreviation */} {account.institutionLogoUrl ? ( {account.institutionName ) : (
{account.institutionName?.[0] ?? "?"}
)} {/* Account name + balance */}
{account.name} {account.balance && ( {account.balance} )}
))} {/* "Connect Your Bank +" tile */}
{/* Navigation — hidden when the parent wizard shell owns navigation */} {!hideNavigation && (
)}
); }