braid-ui 1.0.48 → 1.0.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/braid-ui.css +10 -2
- package/dist/css/braid-ui.min.css +1 -1
- package/dist/index.cjs +756 -447
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +179 -1
- package/dist/index.d.ts +179 -1
- package/dist/index.js +754 -450
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { cva } from 'class-variance-authority';
|
|
|
4
4
|
import { clsx } from 'clsx';
|
|
5
5
|
import { twMerge } from 'tailwind-merge';
|
|
6
6
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
|
-
import { ChevronDown, ChevronUp, Check, X, PanelLeft, Edit, Home, Globe, CreditCard, Building, MoreVertical, Minus, TrendingDown, TrendingUp, ChevronRight, Eye, Trash2, Plus, MessageSquare, Upload, FileText, Download, Copy, LayoutDashboard, Bell, Briefcase, FileCheck, Receipt,
|
|
7
|
+
import { ChevronDown, ChevronUp, Check, X, PanelLeft, Edit, Home, Globe, CreditCard, Building, MoreVertical, Minus, TrendingDown, TrendingUp, ChevronRight, Eye, Trash2, ArrowLeftRight, Settings, Building2, Zap, Plus, MessageSquare, Upload, FileText, Download, Copy, LayoutDashboard, Bell, Briefcase, FileCheck, Receipt, Users, Shield, AlertCircle, RefreshCw, Landmark, Search, Repeat, Box, BarChart3, Key, ChevronLeft, AlertTriangle, Clock, XCircle, CheckCircle, Ban, Circle, Wallet, Filter, User, Loader2, CheckCircle2, ArrowDownRight, ArrowUpRight, ArrowLeft, StickyNote, FileUp, RotateCcw, Send, PlayCircle, UserPlus, ChevronsUpDown, ArrowRightLeft, UserCheck, CalendarIcon, Package, File, FileJson, DollarSign } from 'lucide-react';
|
|
8
8
|
import { createPortal } from 'react-dom';
|
|
9
9
|
import { Slot } from '@radix-ui/react-slot';
|
|
10
10
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
@@ -12,7 +12,7 @@ import { NavLink, useLocation, useNavigate, useSearchParams, useParams, Link } f
|
|
|
12
12
|
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
13
13
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
14
14
|
import { FormProvider as FormProvider$1, useFormContext, Controller, useForm } from 'react-hook-form';
|
|
15
|
-
import { get } from 'lodash';
|
|
15
|
+
import { get, debounce } from 'lodash';
|
|
16
16
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
17
17
|
import { z } from 'zod';
|
|
18
18
|
import { Collapsible, CollapsibleTrigger, CollapsibleContent } from '@radix-ui/react-collapsible';
|
|
@@ -8344,6 +8344,489 @@ var WireDetailsSection = ({ data }) => {
|
|
|
8344
8344
|
) })
|
|
8345
8345
|
] });
|
|
8346
8346
|
};
|
|
8347
|
+
var Checkbox = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
8348
|
+
CheckboxPrimitive.Root,
|
|
8349
|
+
{
|
|
8350
|
+
ref,
|
|
8351
|
+
className: cn(
|
|
8352
|
+
"peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
|
|
8353
|
+
className
|
|
8354
|
+
),
|
|
8355
|
+
...props,
|
|
8356
|
+
children: /* @__PURE__ */ jsx(
|
|
8357
|
+
CheckboxPrimitive.Indicator,
|
|
8358
|
+
{
|
|
8359
|
+
className: cn("flex items-center justify-center text-current"),
|
|
8360
|
+
children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" })
|
|
8361
|
+
}
|
|
8362
|
+
)
|
|
8363
|
+
}
|
|
8364
|
+
));
|
|
8365
|
+
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
8366
|
+
var TRANSACTION_TYPES = [
|
|
8367
|
+
{ value: "transfer", label: "Transfer", icon: ArrowLeftRight },
|
|
8368
|
+
{ value: "adjustment", label: "Adjustment", icon: Settings },
|
|
8369
|
+
{ value: "ach", label: "ACH", icon: Building2 },
|
|
8370
|
+
{ value: "wire", label: "Wire", icon: Zap }
|
|
8371
|
+
];
|
|
8372
|
+
var ADJUSTMENT_DIRECTION_OPTIONS = [
|
|
8373
|
+
{ value: "debit", label: "Debit" },
|
|
8374
|
+
{ value: "credit", label: "Credit" }
|
|
8375
|
+
];
|
|
8376
|
+
var ADJUSTMENT_TYPE_OPTIONS = [
|
|
8377
|
+
{ value: "collection", label: "Collection" },
|
|
8378
|
+
{ value: "transaction_reversal", label: "Transaction Reversal" },
|
|
8379
|
+
{ value: "transaction_adjustment", label: "Transaction Adjustment" }
|
|
8380
|
+
];
|
|
8381
|
+
var NewTransactionView = ({
|
|
8382
|
+
form,
|
|
8383
|
+
accountLookedUp,
|
|
8384
|
+
accountData,
|
|
8385
|
+
counterpartyLookedUp,
|
|
8386
|
+
counterpartyData,
|
|
8387
|
+
confirmationOpen,
|
|
8388
|
+
submissionStatus,
|
|
8389
|
+
errorMessage,
|
|
8390
|
+
transactionId,
|
|
8391
|
+
isAccountLoading,
|
|
8392
|
+
isCounterpartyLoading,
|
|
8393
|
+
isSubmitting,
|
|
8394
|
+
counterpartySearchResults,
|
|
8395
|
+
isCounterpartySearching,
|
|
8396
|
+
showCounterpartyDropdown,
|
|
8397
|
+
onAccountLookup,
|
|
8398
|
+
onEditAccount,
|
|
8399
|
+
onEditCounterparty,
|
|
8400
|
+
onTransactionTypeChange,
|
|
8401
|
+
onSubmit,
|
|
8402
|
+
onCancel,
|
|
8403
|
+
onConfirmationClose,
|
|
8404
|
+
onConfirmationOpenChange,
|
|
8405
|
+
onCounterpartySearchChange,
|
|
8406
|
+
onCounterpartySelect,
|
|
8407
|
+
onCounterpartyDropdownClose,
|
|
8408
|
+
receiverAccountLookedUp,
|
|
8409
|
+
receiverAccountData,
|
|
8410
|
+
isReceiverAccountLoading,
|
|
8411
|
+
onReceiverAccountLookup,
|
|
8412
|
+
onEditReceiverAccount
|
|
8413
|
+
}) => {
|
|
8414
|
+
const transactionType = form.watch("transactionType");
|
|
8415
|
+
const accountNumber = form.watch("accountNumber");
|
|
8416
|
+
const counterpartyName = form.watch("counterpartyName");
|
|
8417
|
+
const amount = form.watch("amount");
|
|
8418
|
+
const receiverAccountNumber = form.watch("receiverAccountNumber");
|
|
8419
|
+
const adjustmentDirection = form.watch("adjustmentDirection");
|
|
8420
|
+
const adjustmentType = form.watch("adjustmentType");
|
|
8421
|
+
const requiresCounterparty = ["ach", "wire"].includes(transactionType);
|
|
8422
|
+
const isTransfer = transactionType === "transfer";
|
|
8423
|
+
const isAdjustment = transactionType === "adjustment";
|
|
8424
|
+
const accountDataGrid = accountData ? [
|
|
8425
|
+
{
|
|
8426
|
+
title: "Account Information",
|
|
8427
|
+
items: [
|
|
8428
|
+
{ label: "Account Number", value: accountData.accountNumber },
|
|
8429
|
+
{ label: "Account Name", value: accountData.accountName },
|
|
8430
|
+
{ label: "Account Type", value: accountData.accountType },
|
|
8431
|
+
{ label: "Balance", value: accountData.balance },
|
|
8432
|
+
{ label: "Customer Name", value: accountData.customerName },
|
|
8433
|
+
{ label: "Customer ID", value: accountData.customerId }
|
|
8434
|
+
]
|
|
8435
|
+
}
|
|
8436
|
+
] : [];
|
|
8437
|
+
const counterpartyDataGrid = counterpartyData ? [
|
|
8438
|
+
{
|
|
8439
|
+
title: "Counterparty Information",
|
|
8440
|
+
items: [
|
|
8441
|
+
{ label: "Counterparty Name", value: counterpartyData.counterpartyName },
|
|
8442
|
+
{ label: "Counterparty ID", value: counterpartyData.counterpartyId },
|
|
8443
|
+
{ label: "Instrument Type", value: counterpartyData.paymentInstrumentType?.toUpperCase() || "-" },
|
|
8444
|
+
{ label: "Contact Email", value: counterpartyData.contactEmail },
|
|
8445
|
+
{ label: "Contact Phone", value: counterpartyData.contactPhone }
|
|
8446
|
+
]
|
|
8447
|
+
}
|
|
8448
|
+
] : [];
|
|
8449
|
+
const receiverAccountDataGrid = receiverAccountData ? [
|
|
8450
|
+
{
|
|
8451
|
+
title: "Receiver Account Information",
|
|
8452
|
+
items: [
|
|
8453
|
+
{ label: "Account Number", value: receiverAccountData.accountNumber },
|
|
8454
|
+
{ label: "Account Name", value: receiverAccountData.accountName },
|
|
8455
|
+
{ label: "Account Type", value: receiverAccountData.accountType },
|
|
8456
|
+
{ label: "Customer Name", value: receiverAccountData.customerName },
|
|
8457
|
+
{ label: "Customer ID", value: receiverAccountData.customerId }
|
|
8458
|
+
]
|
|
8459
|
+
}
|
|
8460
|
+
] : [];
|
|
8461
|
+
const reviewItems = [
|
|
8462
|
+
{ label: "Transaction Type", value: TRANSACTION_TYPES.find((t) => t.value === transactionType)?.label || "-" },
|
|
8463
|
+
{ label: "Account Number", value: accountNumber || "-" },
|
|
8464
|
+
...isAdjustment ? [
|
|
8465
|
+
{ label: "Direction", value: adjustmentDirection === "debit" ? "Debit" : adjustmentDirection === "credit" ? "Credit" : "-" },
|
|
8466
|
+
{ label: "Adjustment Type", value: ADJUSTMENT_TYPE_OPTIONS.find((t) => t.value === adjustmentType)?.label || "-" }
|
|
8467
|
+
] : [],
|
|
8468
|
+
...isTransfer ? [{ label: "Receiver Account", value: receiverAccountNumber || "-" }] : [],
|
|
8469
|
+
...requiresCounterparty ? [{ label: "Counterparty", value: counterpartyName || "-" }] : [],
|
|
8470
|
+
{ label: "Amount", value: amount ? `$${amount}` : "-" },
|
|
8471
|
+
{ label: "Description", value: form.watch("description") || "N/A" }
|
|
8472
|
+
];
|
|
8473
|
+
const reviewData = [
|
|
8474
|
+
{
|
|
8475
|
+
title: "Transaction Summary",
|
|
8476
|
+
items: reviewItems
|
|
8477
|
+
}
|
|
8478
|
+
];
|
|
8479
|
+
return /* @__PURE__ */ jsx(PageLayout, { title: "New Transaction", children: /* @__PURE__ */ jsxs("div", { className: "max-w-4xl mx-auto space-y-6", children: [
|
|
8480
|
+
/* @__PURE__ */ jsx(FormProvider, { form, children: /* @__PURE__ */ jsxs("form", { onSubmit: (e) => e.preventDefault(), children: [
|
|
8481
|
+
!accountLookedUp ? /* @__PURE__ */ jsx(FormCard, { title: "Account Lookup", variant: "default", children: /* @__PURE__ */ jsxs("div", { className: "flex gap-3 items-start w-full", children: [
|
|
8482
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
|
|
8483
|
+
FormInput,
|
|
8484
|
+
{
|
|
8485
|
+
name: "accountNumber",
|
|
8486
|
+
placeholder: "Enter account number"
|
|
8487
|
+
}
|
|
8488
|
+
) }),
|
|
8489
|
+
/* @__PURE__ */ jsx(
|
|
8490
|
+
Button,
|
|
8491
|
+
{
|
|
8492
|
+
onClick: onAccountLookup,
|
|
8493
|
+
disabled: !accountNumber || isAccountLoading,
|
|
8494
|
+
className: "shrink-0 mt-0 w-48",
|
|
8495
|
+
children: isAccountLoading ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8496
|
+
/* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 mr-2 animate-spin" }),
|
|
8497
|
+
"Looking up..."
|
|
8498
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8499
|
+
/* @__PURE__ */ jsx(Search, { className: "h-4 w-4 mr-2" }),
|
|
8500
|
+
"Lookup Account"
|
|
8501
|
+
] })
|
|
8502
|
+
}
|
|
8503
|
+
)
|
|
8504
|
+
] }) }) : /* @__PURE__ */ jsx(
|
|
8505
|
+
FormCard,
|
|
8506
|
+
{
|
|
8507
|
+
title: "Account Information",
|
|
8508
|
+
variant: "subtle",
|
|
8509
|
+
headerActions: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8510
|
+
/* @__PURE__ */ jsx(CheckCircle2, { className: "h-5 w-5 text-success" }),
|
|
8511
|
+
/* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: onEditAccount, children: [
|
|
8512
|
+
/* @__PURE__ */ jsx(Edit, { className: "h-4 w-4 mr-1" }),
|
|
8513
|
+
"Edit"
|
|
8514
|
+
] })
|
|
8515
|
+
] }),
|
|
8516
|
+
children: /* @__PURE__ */ jsx(DataGrid, { data: accountDataGrid, columns: 2 })
|
|
8517
|
+
}
|
|
8518
|
+
),
|
|
8519
|
+
/* @__PURE__ */ jsx(
|
|
8520
|
+
FormCard,
|
|
8521
|
+
{
|
|
8522
|
+
title: "Transaction Type",
|
|
8523
|
+
variant: "default",
|
|
8524
|
+
className: cn(!accountLookedUp && "opacity-50 pointer-events-none"),
|
|
8525
|
+
children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 lg:grid-cols-4 gap-3 lg:gap-4", children: TRANSACTION_TYPES.map((type) => {
|
|
8526
|
+
const Icon2 = type.icon;
|
|
8527
|
+
const isSelected = transactionType === type.value;
|
|
8528
|
+
return /* @__PURE__ */ jsxs(
|
|
8529
|
+
"button",
|
|
8530
|
+
{
|
|
8531
|
+
type: "button",
|
|
8532
|
+
onClick: () => onTransactionTypeChange(type.value),
|
|
8533
|
+
disabled: !accountLookedUp,
|
|
8534
|
+
className: cn(
|
|
8535
|
+
"flex flex-col items-center justify-center p-4 lg:p-3 rounded-lg border-2 transition-all",
|
|
8536
|
+
"hover:border-primary/50 hover:shadow-md",
|
|
8537
|
+
isSelected ? "border-primary bg-primary/5 shadow-sm" : "border-border bg-card"
|
|
8538
|
+
),
|
|
8539
|
+
children: [
|
|
8540
|
+
/* @__PURE__ */ jsx(Icon2, { className: cn(
|
|
8541
|
+
"h-6 w-6 lg:h-5 lg:w-5 mb-2",
|
|
8542
|
+
isSelected ? "text-primary" : "text-muted-foreground"
|
|
8543
|
+
) }),
|
|
8544
|
+
/* @__PURE__ */ jsx("span", { className: cn(
|
|
8545
|
+
"text-sm font-medium",
|
|
8546
|
+
isSelected ? "text-primary" : "text-foreground"
|
|
8547
|
+
), children: type.label })
|
|
8548
|
+
]
|
|
8549
|
+
},
|
|
8550
|
+
type.value
|
|
8551
|
+
);
|
|
8552
|
+
}) })
|
|
8553
|
+
}
|
|
8554
|
+
),
|
|
8555
|
+
requiresCounterparty && (!counterpartyLookedUp ? /* @__PURE__ */ jsxs(
|
|
8556
|
+
FormCard,
|
|
8557
|
+
{
|
|
8558
|
+
title: "Counterparty Search",
|
|
8559
|
+
variant: "default",
|
|
8560
|
+
className: cn(!transactionType && "opacity-50 pointer-events-none"),
|
|
8561
|
+
children: [
|
|
8562
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
8563
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
8564
|
+
/* @__PURE__ */ jsx(
|
|
8565
|
+
"input",
|
|
8566
|
+
{
|
|
8567
|
+
type: "text",
|
|
8568
|
+
placeholder: "Start typing to search counterparties...",
|
|
8569
|
+
value: counterpartyName,
|
|
8570
|
+
onChange: (e) => onCounterpartySearchChange(e.target.value),
|
|
8571
|
+
disabled: !transactionType,
|
|
8572
|
+
className: cn(
|
|
8573
|
+
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",
|
|
8574
|
+
"ring-offset-background placeholder:text-muted-foreground",
|
|
8575
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
8576
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
8577
|
+
isCounterpartySearching && "pr-10"
|
|
8578
|
+
)
|
|
8579
|
+
}
|
|
8580
|
+
),
|
|
8581
|
+
isCounterpartySearching && /* @__PURE__ */ jsx("div", { className: "absolute right-3 top-1/2 -translate-y-1/2", children: /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin text-muted-foreground" }) })
|
|
8582
|
+
] }),
|
|
8583
|
+
showCounterpartyDropdown && counterpartySearchResults.length > 0 && /* @__PURE__ */ jsx("div", { className: "absolute z-50 w-full mt-1 bg-popover border border-border rounded-md shadow-lg max-h-60 overflow-auto", children: counterpartySearchResults.map((result) => /* @__PURE__ */ jsxs(
|
|
8584
|
+
"button",
|
|
8585
|
+
{
|
|
8586
|
+
type: "button",
|
|
8587
|
+
onClick: () => onCounterpartySelect(result),
|
|
8588
|
+
className: "w-full px-3 py-2 text-left hover:bg-accent transition-colors",
|
|
8589
|
+
children: [
|
|
8590
|
+
/* @__PURE__ */ jsx("div", { className: "font-medium text-sm", children: result.name }),
|
|
8591
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground", children: result.id })
|
|
8592
|
+
]
|
|
8593
|
+
},
|
|
8594
|
+
result.id
|
|
8595
|
+
)) }),
|
|
8596
|
+
showCounterpartyDropdown && counterpartySearchResults.length === 0 && !isCounterpartySearching && counterpartyName.length >= 2 && /* @__PURE__ */ jsx("div", { className: "absolute z-50 w-full mt-1 bg-popover border border-border rounded-md shadow-lg p-3", children: /* @__PURE__ */ jsxs("p", { className: "text-sm text-muted-foreground", children: [
|
|
8597
|
+
'No counterparties found matching "',
|
|
8598
|
+
counterpartyName,
|
|
8599
|
+
'"'
|
|
8600
|
+
] }) })
|
|
8601
|
+
] }),
|
|
8602
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-2", children: "Type at least 2 characters to search" })
|
|
8603
|
+
]
|
|
8604
|
+
}
|
|
8605
|
+
) : /* @__PURE__ */ jsx(
|
|
8606
|
+
FormCard,
|
|
8607
|
+
{
|
|
8608
|
+
title: "Counterparty Information",
|
|
8609
|
+
variant: "subtle",
|
|
8610
|
+
headerActions: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8611
|
+
/* @__PURE__ */ jsx(CheckCircle2, { className: "h-5 w-5 text-success" }),
|
|
8612
|
+
/* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: onEditCounterparty, children: [
|
|
8613
|
+
/* @__PURE__ */ jsx(Edit, { className: "h-4 w-4 mr-1" }),
|
|
8614
|
+
"Edit"
|
|
8615
|
+
] })
|
|
8616
|
+
] }),
|
|
8617
|
+
children: /* @__PURE__ */ jsx(DataGrid, { data: counterpartyDataGrid, columns: 2 })
|
|
8618
|
+
}
|
|
8619
|
+
)),
|
|
8620
|
+
isTransfer && (!receiverAccountLookedUp ? /* @__PURE__ */ jsx(
|
|
8621
|
+
FormCard,
|
|
8622
|
+
{
|
|
8623
|
+
title: "Receiver Account",
|
|
8624
|
+
variant: "default",
|
|
8625
|
+
className: cn(!transactionType && "opacity-50 pointer-events-none"),
|
|
8626
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex gap-3 items-start w-full", children: [
|
|
8627
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
|
|
8628
|
+
FormInput,
|
|
8629
|
+
{
|
|
8630
|
+
name: "receiverAccountNumber",
|
|
8631
|
+
placeholder: "Enter receiver account number",
|
|
8632
|
+
disabled: !transactionType
|
|
8633
|
+
}
|
|
8634
|
+
) }),
|
|
8635
|
+
/* @__PURE__ */ jsx(
|
|
8636
|
+
Button,
|
|
8637
|
+
{
|
|
8638
|
+
onClick: onReceiverAccountLookup,
|
|
8639
|
+
disabled: !receiverAccountNumber || isReceiverAccountLoading,
|
|
8640
|
+
className: "shrink-0 mt-0 w-48",
|
|
8641
|
+
children: isReceiverAccountLoading ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8642
|
+
/* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 mr-2 animate-spin" }),
|
|
8643
|
+
"Looking up..."
|
|
8644
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8645
|
+
/* @__PURE__ */ jsx(Search, { className: "h-4 w-4 mr-2" }),
|
|
8646
|
+
"Lookup Receiver"
|
|
8647
|
+
] })
|
|
8648
|
+
}
|
|
8649
|
+
)
|
|
8650
|
+
] })
|
|
8651
|
+
}
|
|
8652
|
+
) : /* @__PURE__ */ jsx(
|
|
8653
|
+
FormCard,
|
|
8654
|
+
{
|
|
8655
|
+
title: "Receiver Account Information",
|
|
8656
|
+
variant: "subtle",
|
|
8657
|
+
headerActions: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8658
|
+
/* @__PURE__ */ jsx(CheckCircle2, { className: "h-5 w-5 text-success" }),
|
|
8659
|
+
/* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: onEditReceiverAccount, children: [
|
|
8660
|
+
/* @__PURE__ */ jsx(Edit, { className: "h-4 w-4 mr-1" }),
|
|
8661
|
+
"Edit"
|
|
8662
|
+
] })
|
|
8663
|
+
] }),
|
|
8664
|
+
children: /* @__PURE__ */ jsx(DataGrid, { data: receiverAccountDataGrid, columns: 2 })
|
|
8665
|
+
}
|
|
8666
|
+
)),
|
|
8667
|
+
/* @__PURE__ */ jsx(
|
|
8668
|
+
FormCard,
|
|
8669
|
+
{
|
|
8670
|
+
title: "Transaction Details",
|
|
8671
|
+
variant: "default",
|
|
8672
|
+
className: cn(
|
|
8673
|
+
requiresCounterparty ? !counterpartyLookedUp && "opacity-50 pointer-events-none" : isTransfer ? !receiverAccountLookedUp && "opacity-50 pointer-events-none" : !transactionType && "opacity-50 pointer-events-none"
|
|
8674
|
+
),
|
|
8675
|
+
children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
8676
|
+
isAdjustment && /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
8677
|
+
/* @__PURE__ */ jsx(
|
|
8678
|
+
FormSelect,
|
|
8679
|
+
{
|
|
8680
|
+
name: "adjustmentDirection",
|
|
8681
|
+
label: "Direction",
|
|
8682
|
+
placeholder: "Select direction",
|
|
8683
|
+
options: ADJUSTMENT_DIRECTION_OPTIONS,
|
|
8684
|
+
disabled: !transactionType
|
|
8685
|
+
}
|
|
8686
|
+
),
|
|
8687
|
+
/* @__PURE__ */ jsx(
|
|
8688
|
+
FormSelect,
|
|
8689
|
+
{
|
|
8690
|
+
name: "adjustmentType",
|
|
8691
|
+
label: "Adjustment Type",
|
|
8692
|
+
placeholder: "Select type",
|
|
8693
|
+
options: ADJUSTMENT_TYPE_OPTIONS,
|
|
8694
|
+
disabled: !transactionType
|
|
8695
|
+
}
|
|
8696
|
+
)
|
|
8697
|
+
] }),
|
|
8698
|
+
/* @__PURE__ */ jsx(
|
|
8699
|
+
FormInput,
|
|
8700
|
+
{
|
|
8701
|
+
name: "amount",
|
|
8702
|
+
label: "Amount",
|
|
8703
|
+
placeholder: "0.00",
|
|
8704
|
+
type: "number",
|
|
8705
|
+
disabled: requiresCounterparty ? !counterpartyLookedUp : isTransfer ? !receiverAccountLookedUp : !transactionType
|
|
8706
|
+
}
|
|
8707
|
+
),
|
|
8708
|
+
/* @__PURE__ */ jsx(
|
|
8709
|
+
FormInput,
|
|
8710
|
+
{
|
|
8711
|
+
name: "description",
|
|
8712
|
+
label: "Description (Optional)",
|
|
8713
|
+
placeholder: "Enter transaction description",
|
|
8714
|
+
disabled: requiresCounterparty ? !counterpartyLookedUp : isTransfer ? !receiverAccountLookedUp : !transactionType
|
|
8715
|
+
}
|
|
8716
|
+
)
|
|
8717
|
+
] })
|
|
8718
|
+
}
|
|
8719
|
+
),
|
|
8720
|
+
/* @__PURE__ */ jsx(FormCard, { title: "Review & Submit", variant: "default", children: /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
8721
|
+
/* @__PURE__ */ jsx(DataGrid, { data: reviewData, columns: 2 }),
|
|
8722
|
+
/* @__PURE__ */ jsx("div", { className: "bg-muted/30 rounded-lg p-4 border border-border/50", children: /* @__PURE__ */ jsx(
|
|
8723
|
+
Controller,
|
|
8724
|
+
{
|
|
8725
|
+
name: "certifyInformation",
|
|
8726
|
+
control: form.control,
|
|
8727
|
+
render: ({ field }) => /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
8728
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
|
|
8729
|
+
/* @__PURE__ */ jsx(
|
|
8730
|
+
Checkbox,
|
|
8731
|
+
{
|
|
8732
|
+
id: "certifyInformation",
|
|
8733
|
+
checked: field.value,
|
|
8734
|
+
onCheckedChange: field.onChange
|
|
8735
|
+
}
|
|
8736
|
+
),
|
|
8737
|
+
/* @__PURE__ */ jsx(
|
|
8738
|
+
"label",
|
|
8739
|
+
{
|
|
8740
|
+
htmlFor: "certifyInformation",
|
|
8741
|
+
className: "text-sm font-medium leading-relaxed cursor-pointer select-none",
|
|
8742
|
+
children: "I certify that all information entered is correct and accurate to the best of my knowledge"
|
|
8743
|
+
}
|
|
8744
|
+
)
|
|
8745
|
+
] }),
|
|
8746
|
+
form.formState.errors.certifyInformation && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive ml-7", children: form.formState.errors.certifyInformation.message })
|
|
8747
|
+
] })
|
|
8748
|
+
}
|
|
8749
|
+
) }),
|
|
8750
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-3 justify-end pt-4 border-t border-border", children: [
|
|
8751
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", onClick: onCancel, className: "w-32", children: "Cancel" }),
|
|
8752
|
+
/* @__PURE__ */ jsx(
|
|
8753
|
+
Button,
|
|
8754
|
+
{
|
|
8755
|
+
type: "button",
|
|
8756
|
+
onClick: onSubmit,
|
|
8757
|
+
className: "w-48",
|
|
8758
|
+
disabled: !transactionType || !accountNumber || requiresCounterparty && !counterpartyName || isTransfer && !receiverAccountLookedUp || isAdjustment && (!adjustmentDirection || !adjustmentType) || !amount || !form.watch("certifyInformation") || isSubmitting,
|
|
8759
|
+
children: isSubmitting ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8760
|
+
/* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 mr-2 animate-spin" }),
|
|
8761
|
+
"Submitting..."
|
|
8762
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8763
|
+
/* @__PURE__ */ jsx(CheckCircle2, { className: "h-4 w-4 mr-2" }),
|
|
8764
|
+
"Submit Transaction"
|
|
8765
|
+
] })
|
|
8766
|
+
}
|
|
8767
|
+
)
|
|
8768
|
+
] })
|
|
8769
|
+
] }) })
|
|
8770
|
+
] }) }),
|
|
8771
|
+
/* @__PURE__ */ jsx(Dialog, { open: confirmationOpen, onOpenChange: onConfirmationOpenChange, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-md", children: [
|
|
8772
|
+
/* @__PURE__ */ jsxs(DialogHeader, { children: [
|
|
8773
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 mb-2", children: [
|
|
8774
|
+
submissionStatus === "success" ? /* @__PURE__ */ jsx("div", { className: "h-12 w-12 rounded-full bg-success/10 flex items-center justify-center", children: /* @__PURE__ */ jsx(CheckCircle2, { className: "h-6 w-6 text-success" }) }) : /* @__PURE__ */ jsx("div", { className: "h-12 w-12 rounded-full bg-destructive/10 flex items-center justify-center", children: /* @__PURE__ */ jsx(XCircle, { className: "h-6 w-6 text-destructive" }) }),
|
|
8775
|
+
/* @__PURE__ */ jsx(DialogTitle, { className: "text-xl", children: submissionStatus === "success" ? "Transaction Successful" : "Transaction Failed" })
|
|
8776
|
+
] }),
|
|
8777
|
+
/* @__PURE__ */ jsx(DialogDescription, { className: "text-left", children: submissionStatus === "success" ? /* @__PURE__ */ jsxs("div", { className: "space-y-4 pt-2", children: [
|
|
8778
|
+
/* @__PURE__ */ jsx("p", { className: "text-foreground", children: "Your transaction has been successfully submitted and is being processed." }),
|
|
8779
|
+
/* @__PURE__ */ jsxs("div", { className: "bg-muted/50 rounded-lg p-4 space-y-2", children: [
|
|
8780
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm", children: [
|
|
8781
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Transaction ID:" }),
|
|
8782
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono font-medium", children: transactionId })
|
|
8783
|
+
] }),
|
|
8784
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm", children: [
|
|
8785
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Amount:" }),
|
|
8786
|
+
/* @__PURE__ */ jsxs("span", { className: "font-medium", children: [
|
|
8787
|
+
"$",
|
|
8788
|
+
amount
|
|
8789
|
+
] })
|
|
8790
|
+
] }),
|
|
8791
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm", children: [
|
|
8792
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Type:" }),
|
|
8793
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: TRANSACTION_TYPES.find((t) => t.value === transactionType)?.label })
|
|
8794
|
+
] }),
|
|
8795
|
+
requiresCounterparty && counterpartyName && /* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm", children: [
|
|
8796
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Counterparty:" }),
|
|
8797
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: counterpartyName })
|
|
8798
|
+
] })
|
|
8799
|
+
] }),
|
|
8800
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 p-3 bg-blue-500/10 border border-blue-500/20 rounded-lg", children: [
|
|
8801
|
+
/* @__PURE__ */ jsx(AlertCircle, { className: "h-5 w-5 text-blue-500 mt-0.5 flex-shrink-0" }),
|
|
8802
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-blue-700 dark:text-blue-300", children: "You will receive a confirmation email once the transaction is completed." })
|
|
8803
|
+
] })
|
|
8804
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "space-y-4 pt-2", children: [
|
|
8805
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 p-4 bg-destructive/10 border border-destructive/20 rounded-lg", children: [
|
|
8806
|
+
/* @__PURE__ */ jsx(XCircle, { className: "h-5 w-5 text-destructive mt-0.5 flex-shrink-0" }),
|
|
8807
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
8808
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-destructive", children: "Error Processing Transaction" }),
|
|
8809
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: errorMessage })
|
|
8810
|
+
] })
|
|
8811
|
+
] }),
|
|
8812
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Please review the error message above and try again. If the problem persists, contact support." })
|
|
8813
|
+
] }) })
|
|
8814
|
+
] }),
|
|
8815
|
+
/* @__PURE__ */ jsxs(DialogFooter, { className: "sm:justify-end gap-2", children: [
|
|
8816
|
+
submissionStatus === "error" && /* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", onClick: () => onConfirmationOpenChange(false), children: "Try Again" }),
|
|
8817
|
+
/* @__PURE__ */ jsx(
|
|
8818
|
+
Button,
|
|
8819
|
+
{
|
|
8820
|
+
type: "button",
|
|
8821
|
+
onClick: onConfirmationClose,
|
|
8822
|
+
variant: submissionStatus === "success" ? "default" : "outline",
|
|
8823
|
+
children: submissionStatus === "success" ? "View Transactions" : "Close"
|
|
8824
|
+
}
|
|
8825
|
+
)
|
|
8826
|
+
] })
|
|
8827
|
+
] }) })
|
|
8828
|
+
] }) });
|
|
8829
|
+
};
|
|
8347
8830
|
var typeIcons = {
|
|
8348
8831
|
checking: CreditCard,
|
|
8349
8832
|
savings: Building,
|
|
@@ -8418,25 +8901,6 @@ var BusinessTypeBadge = ({ type, className }) => {
|
|
|
8418
8901
|
config.label
|
|
8419
8902
|
] });
|
|
8420
8903
|
};
|
|
8421
|
-
var Checkbox = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
8422
|
-
CheckboxPrimitive.Root,
|
|
8423
|
-
{
|
|
8424
|
-
ref,
|
|
8425
|
-
className: cn(
|
|
8426
|
-
"peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
|
|
8427
|
-
className
|
|
8428
|
-
),
|
|
8429
|
-
...props,
|
|
8430
|
-
children: /* @__PURE__ */ jsx(
|
|
8431
|
-
CheckboxPrimitive.Indicator,
|
|
8432
|
-
{
|
|
8433
|
-
className: cn("flex items-center justify-center text-current"),
|
|
8434
|
-
children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" })
|
|
8435
|
-
}
|
|
8436
|
-
)
|
|
8437
|
-
}
|
|
8438
|
-
));
|
|
8439
|
-
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
8440
8904
|
var DetailPageLayout = ({
|
|
8441
8905
|
title,
|
|
8442
8906
|
description,
|
|
@@ -13810,30 +14274,43 @@ var TransactionHistory_default = TransactionHistory;
|
|
|
13810
14274
|
var newTransactionSchema = z.object({
|
|
13811
14275
|
transactionType: z.string().min(1, "Transaction type is required"),
|
|
13812
14276
|
accountNumber: z.string().min(1, "Account number is required"),
|
|
13813
|
-
counterpartyName: z.string().
|
|
14277
|
+
counterpartyName: z.string().optional(),
|
|
13814
14278
|
amount: z.string().min(1, "Amount is required"),
|
|
13815
|
-
currency: z.string().min(1, "Currency is required"),
|
|
13816
14279
|
description: z.string().optional(),
|
|
13817
14280
|
certifyInformation: z.boolean().refine((val) => val === true, {
|
|
13818
14281
|
message: "You must certify the information is correct"
|
|
13819
|
-
})
|
|
14282
|
+
}),
|
|
14283
|
+
// Adjustment-specific fields
|
|
14284
|
+
adjustmentDirection: z.string().optional(),
|
|
14285
|
+
adjustmentType: z.string().optional(),
|
|
14286
|
+
// Transfer-specific fields
|
|
14287
|
+
receiverAccountNumber: z.string().optional()
|
|
14288
|
+
}).refine((data) => {
|
|
14289
|
+
const requiresCounterparty = ["ach", "wire"].includes(data.transactionType);
|
|
14290
|
+
if (requiresCounterparty && !data.counterpartyName) {
|
|
14291
|
+
return false;
|
|
14292
|
+
}
|
|
14293
|
+
return true;
|
|
14294
|
+
}, {
|
|
14295
|
+
message: "Counterparty is required for ACH and Wire transactions",
|
|
14296
|
+
path: ["counterpartyName"]
|
|
14297
|
+
}).refine((data) => {
|
|
14298
|
+
if (data.transactionType === "adjustment") {
|
|
14299
|
+
if (!data.adjustmentDirection || !data.adjustmentType) return false;
|
|
14300
|
+
}
|
|
14301
|
+
return true;
|
|
14302
|
+
}, {
|
|
14303
|
+
message: "Direction and Type are required for Adjustment transactions",
|
|
14304
|
+
path: ["adjustmentDirection"]
|
|
14305
|
+
}).refine((data) => {
|
|
14306
|
+
if (data.transactionType === "transfer") {
|
|
14307
|
+
if (!data.receiverAccountNumber) return false;
|
|
14308
|
+
}
|
|
14309
|
+
return true;
|
|
14310
|
+
}, {
|
|
14311
|
+
message: "Receiver account number is required for Transfer transactions",
|
|
14312
|
+
path: ["receiverAccountNumber"]
|
|
13820
14313
|
});
|
|
13821
|
-
var TRANSACTION_TYPES = [
|
|
13822
|
-
{ value: "transfer", label: "Transfer", icon: ArrowLeftRight },
|
|
13823
|
-
{ value: "adjustment", label: "Adjustment", icon: Settings },
|
|
13824
|
-
{ value: "ach", label: "ACH", icon: Building2 },
|
|
13825
|
-
{ value: "wire", label: "Wire", icon: Zap }
|
|
13826
|
-
];
|
|
13827
|
-
var CURRENCY_OPTIONS = [
|
|
13828
|
-
{ value: "USD", label: "USD - US Dollar" },
|
|
13829
|
-
{ value: "EUR", label: "EUR - Euro" },
|
|
13830
|
-
{ value: "GBP", label: "GBP - British Pound" },
|
|
13831
|
-
{ value: "JPY", label: "JPY - Japanese Yen" },
|
|
13832
|
-
{ value: "CAD", label: "CAD - Canadian Dollar" },
|
|
13833
|
-
{ value: "AUD", label: "AUD - Australian Dollar" },
|
|
13834
|
-
{ value: "CHF", label: "CHF - Swiss Franc" },
|
|
13835
|
-
{ value: "CNY", label: "CNY - Chinese Yuan" }
|
|
13836
|
-
];
|
|
13837
14314
|
var mockAccountData = {
|
|
13838
14315
|
accountNumber: "****1234",
|
|
13839
14316
|
accountName: "Business Checking",
|
|
@@ -13843,27 +14320,25 @@ var mockAccountData = {
|
|
|
13843
14320
|
customerId: "CUST-001",
|
|
13844
14321
|
customerType: "Business"
|
|
13845
14322
|
};
|
|
13846
|
-
var mockCounterpartyData = {
|
|
13847
|
-
counterpartyName: "Global Tech Solutions Inc.",
|
|
13848
|
-
counterpartyId: "CP-5678",
|
|
13849
|
-
counterpartyType: "Business",
|
|
13850
|
-
status: "Active",
|
|
13851
|
-
taxId: "98-7654321",
|
|
13852
|
-
primaryContact: "Sarah Johnson",
|
|
13853
|
-
contactEmail: "sarah.johnson@globaltech.com",
|
|
13854
|
-
contactPhone: "+1 (555) 987-6543",
|
|
13855
|
-
address: "456 Innovation Drive, San Francisco, CA 94105"
|
|
13856
|
-
};
|
|
13857
14323
|
function NewTransaction() {
|
|
13858
14324
|
const navigate = useNavigate();
|
|
13859
14325
|
const [accountLookedUp, setAccountLookedUp] = useState(false);
|
|
13860
14326
|
const [accountData, setAccountData] = useState(null);
|
|
13861
14327
|
const [counterpartyLookedUp, setCounterpartyLookedUp] = useState(false);
|
|
13862
14328
|
const [counterpartyData, setCounterpartyData] = useState(null);
|
|
14329
|
+
const [counterpartySearchResults, setCounterpartySearchResults] = useState([]);
|
|
14330
|
+
const [isCounterpartySearching, setIsCounterpartySearching] = useState(false);
|
|
14331
|
+
const [showCounterpartyDropdown, setShowCounterpartyDropdown] = useState(false);
|
|
13863
14332
|
const [confirmationOpen, setConfirmationOpen] = useState(false);
|
|
13864
14333
|
const [submissionStatus, setSubmissionStatus] = useState(null);
|
|
13865
14334
|
const [errorMessage, setErrorMessage] = useState("");
|
|
13866
14335
|
const [transactionId, setTransactionId] = useState("");
|
|
14336
|
+
const [isAccountLoading, setIsAccountLoading] = useState(false);
|
|
14337
|
+
const [isCounterpartyLoading, setIsCounterpartyLoading] = useState(false);
|
|
14338
|
+
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
14339
|
+
const [receiverAccountLookedUp, setReceiverAccountLookedUp] = useState(false);
|
|
14340
|
+
const [receiverAccountData, setReceiverAccountData] = useState(null);
|
|
14341
|
+
const [isReceiverAccountLoading, setIsReceiverAccountLoading] = useState(false);
|
|
13867
14342
|
const form = useForm({
|
|
13868
14343
|
resolver: zodResolver(newTransactionSchema),
|
|
13869
14344
|
defaultValues: {
|
|
@@ -13871,34 +14346,131 @@ function NewTransaction() {
|
|
|
13871
14346
|
accountNumber: "",
|
|
13872
14347
|
counterpartyName: "",
|
|
13873
14348
|
amount: "",
|
|
13874
|
-
currency: "USD",
|
|
13875
14349
|
description: "",
|
|
13876
|
-
certifyInformation: false
|
|
14350
|
+
certifyInformation: false,
|
|
14351
|
+
adjustmentDirection: "",
|
|
14352
|
+
adjustmentType: "",
|
|
14353
|
+
receiverAccountNumber: ""
|
|
13877
14354
|
}
|
|
13878
14355
|
});
|
|
13879
|
-
const
|
|
13880
|
-
const accountNumber = form.watch("accountNumber");
|
|
13881
|
-
const counterpartyName = form.watch("counterpartyName");
|
|
13882
|
-
const amount = form.watch("amount");
|
|
13883
|
-
const handleAccountLookup = () => {
|
|
14356
|
+
const handleAccountLookup = async () => {
|
|
13884
14357
|
const accNum = form.getValues("accountNumber");
|
|
13885
14358
|
if (!accNum) {
|
|
13886
14359
|
toast$1.error("Please enter an account number");
|
|
13887
14360
|
return;
|
|
13888
14361
|
}
|
|
13889
|
-
|
|
13890
|
-
|
|
13891
|
-
|
|
14362
|
+
setIsAccountLoading(true);
|
|
14363
|
+
try {
|
|
14364
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
14365
|
+
setAccountData(mockAccountData);
|
|
14366
|
+
setAccountLookedUp(true);
|
|
14367
|
+
toast$1.success("Account found");
|
|
14368
|
+
} catch (error) {
|
|
14369
|
+
toast$1.error("Failed to lookup account");
|
|
14370
|
+
} finally {
|
|
14371
|
+
setIsAccountLoading(false);
|
|
14372
|
+
}
|
|
13892
14373
|
};
|
|
13893
|
-
const
|
|
13894
|
-
|
|
13895
|
-
|
|
13896
|
-
|
|
13897
|
-
|
|
14374
|
+
const mockSearchResults = [
|
|
14375
|
+
{ id: "CP-5678", name: "Global Tech Solutions Inc.", type: "Business", paymentInstrumentType: "wire" },
|
|
14376
|
+
{ id: "CP-1234", name: "Global Industries LLC", type: "Business", paymentInstrumentType: "ach" },
|
|
14377
|
+
{ id: "CP-9012", name: "GlobalCorp Partners", type: "Business", paymentInstrumentType: "both" },
|
|
14378
|
+
{ id: "CP-3456", name: "Acme Corporation", type: "Business", paymentInstrumentType: "wire" },
|
|
14379
|
+
{ id: "CP-7890", name: "Tech Innovations Ltd", type: "Business", paymentInstrumentType: "ach" }
|
|
14380
|
+
];
|
|
14381
|
+
const isCounterpartyCompatible = (instrumentType, transactionType) => {
|
|
14382
|
+
if (instrumentType === "both") return true;
|
|
14383
|
+
if (transactionType === "ach" && instrumentType === "ach") return true;
|
|
14384
|
+
if (transactionType === "wire" && instrumentType === "wire") return true;
|
|
14385
|
+
return false;
|
|
14386
|
+
};
|
|
14387
|
+
const debouncedSearch = useMemo(
|
|
14388
|
+
() => debounce(async (query, txType) => {
|
|
14389
|
+
if (query.length < 2) {
|
|
14390
|
+
setCounterpartySearchResults([]);
|
|
14391
|
+
setShowCounterpartyDropdown(false);
|
|
14392
|
+
return;
|
|
14393
|
+
}
|
|
14394
|
+
setIsCounterpartySearching(true);
|
|
14395
|
+
try {
|
|
14396
|
+
await new Promise((resolve) => setTimeout(resolve, 350));
|
|
14397
|
+
let results = mockSearchResults.filter(
|
|
14398
|
+
(cp) => cp.name.toLowerCase().includes(query.toLowerCase())
|
|
14399
|
+
);
|
|
14400
|
+
if (txType === "ach") {
|
|
14401
|
+
results = results.filter(
|
|
14402
|
+
(cp) => cp.paymentInstrumentType === "ach" || cp.paymentInstrumentType === "both"
|
|
14403
|
+
);
|
|
14404
|
+
} else if (txType === "wire") {
|
|
14405
|
+
results = results.filter(
|
|
14406
|
+
(cp) => cp.paymentInstrumentType === "wire" || cp.paymentInstrumentType === "both"
|
|
14407
|
+
);
|
|
14408
|
+
}
|
|
14409
|
+
setCounterpartySearchResults(results);
|
|
14410
|
+
setShowCounterpartyDropdown(true);
|
|
14411
|
+
} finally {
|
|
14412
|
+
setIsCounterpartySearching(false);
|
|
14413
|
+
}
|
|
14414
|
+
}, 350),
|
|
14415
|
+
[]
|
|
14416
|
+
);
|
|
14417
|
+
useEffect(() => {
|
|
14418
|
+
return () => {
|
|
14419
|
+
debouncedSearch.cancel();
|
|
14420
|
+
};
|
|
14421
|
+
}, [debouncedSearch]);
|
|
14422
|
+
const handleCounterpartySearchChange = (value) => {
|
|
14423
|
+
form.setValue("counterpartyName", value);
|
|
14424
|
+
if (counterpartyLookedUp) {
|
|
14425
|
+
setCounterpartyLookedUp(false);
|
|
14426
|
+
setCounterpartyData(null);
|
|
14427
|
+
}
|
|
14428
|
+
debouncedSearch(value, form.getValues("transactionType"));
|
|
14429
|
+
};
|
|
14430
|
+
const handleTransactionTypeChange = (newType) => {
|
|
14431
|
+
form.setValue("transactionType", newType);
|
|
14432
|
+
if (counterpartyData && counterpartyLookedUp) {
|
|
14433
|
+
const requiresCounterparty = ["ach", "wire"].includes(newType);
|
|
14434
|
+
if (requiresCounterparty) {
|
|
14435
|
+
const isCompatible = isCounterpartyCompatible(
|
|
14436
|
+
counterpartyData.paymentInstrumentType,
|
|
14437
|
+
newType
|
|
14438
|
+
);
|
|
14439
|
+
if (!isCompatible) {
|
|
14440
|
+
setCounterpartyLookedUp(false);
|
|
14441
|
+
setCounterpartyData(null);
|
|
14442
|
+
setCounterpartySearchResults([]);
|
|
14443
|
+
form.setValue("counterpartyName", "");
|
|
14444
|
+
const typeLabel = newType === "ach" ? "ACH" : "Wire";
|
|
14445
|
+
toast$1.warning(
|
|
14446
|
+
`${counterpartyData.counterpartyName} doesn't support ${typeLabel} transactions. Please select a different counterparty.`
|
|
14447
|
+
);
|
|
14448
|
+
}
|
|
14449
|
+
}
|
|
13898
14450
|
}
|
|
13899
|
-
|
|
13900
|
-
|
|
13901
|
-
|
|
14451
|
+
};
|
|
14452
|
+
const handleCounterpartySelect = (result) => {
|
|
14453
|
+
form.setValue("counterpartyName", result.name);
|
|
14454
|
+
setShowCounterpartyDropdown(false);
|
|
14455
|
+
setCounterpartySearchResults([]);
|
|
14456
|
+
setIsCounterpartyLoading(true);
|
|
14457
|
+
setTimeout(() => {
|
|
14458
|
+
setCounterpartyData({
|
|
14459
|
+
counterpartyName: result.name,
|
|
14460
|
+
counterpartyId: result.id,
|
|
14461
|
+
counterpartyType: result.type,
|
|
14462
|
+
status: "Active",
|
|
14463
|
+
taxId: "XX-XXXXXXX",
|
|
14464
|
+
primaryContact: "Contact Name",
|
|
14465
|
+
contactEmail: "contact@example.com",
|
|
14466
|
+
contactPhone: "+1 (555) 123-4567",
|
|
14467
|
+
address: "123 Business Ave, City, ST 12345",
|
|
14468
|
+
paymentInstrumentType: result.paymentInstrumentType
|
|
14469
|
+
});
|
|
14470
|
+
setCounterpartyLookedUp(true);
|
|
14471
|
+
setIsCounterpartyLoading(false);
|
|
14472
|
+
toast$1.success("Counterparty selected");
|
|
14473
|
+
}, 500);
|
|
13902
14474
|
};
|
|
13903
14475
|
const handleEditAccount = () => {
|
|
13904
14476
|
setAccountLookedUp(false);
|
|
@@ -13909,40 +14481,100 @@ function NewTransaction() {
|
|
|
13909
14481
|
form.setValue("counterpartyName", "");
|
|
13910
14482
|
form.setValue("amount", "");
|
|
13911
14483
|
form.setValue("description", "");
|
|
14484
|
+
form.setValue("adjustmentDirection", "");
|
|
14485
|
+
form.setValue("adjustmentType", "");
|
|
14486
|
+
setReceiverAccountLookedUp(false);
|
|
14487
|
+
setReceiverAccountData(null);
|
|
14488
|
+
form.setValue("receiverAccountNumber", "");
|
|
14489
|
+
};
|
|
14490
|
+
const handleReceiverAccountLookup = async () => {
|
|
14491
|
+
const receiverNum = form.getValues("receiverAccountNumber");
|
|
14492
|
+
if (!receiverNum) {
|
|
14493
|
+
toast$1.error("Please enter a receiver account number");
|
|
14494
|
+
return;
|
|
14495
|
+
}
|
|
14496
|
+
setIsReceiverAccountLoading(true);
|
|
14497
|
+
try {
|
|
14498
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
14499
|
+
setReceiverAccountData({
|
|
14500
|
+
accountNumber: "****" + receiverNum.slice(-4),
|
|
14501
|
+
accountName: "Receiver Account",
|
|
14502
|
+
accountType: "Checking",
|
|
14503
|
+
balance: "$45,230.00",
|
|
14504
|
+
customerName: "Receiver Corp",
|
|
14505
|
+
customerId: "CUST-RCV-001",
|
|
14506
|
+
customerType: "Business"
|
|
14507
|
+
});
|
|
14508
|
+
setReceiverAccountLookedUp(true);
|
|
14509
|
+
toast$1.success("Receiver account found");
|
|
14510
|
+
} catch (error) {
|
|
14511
|
+
toast$1.error("Failed to lookup receiver account");
|
|
14512
|
+
} finally {
|
|
14513
|
+
setIsReceiverAccountLoading(false);
|
|
14514
|
+
}
|
|
14515
|
+
};
|
|
14516
|
+
const handleEditReceiverAccount = () => {
|
|
14517
|
+
setReceiverAccountLookedUp(false);
|
|
14518
|
+
setReceiverAccountData(null);
|
|
14519
|
+
form.setValue("receiverAccountNumber", "");
|
|
13912
14520
|
};
|
|
13913
14521
|
const handleEditCounterparty = () => {
|
|
13914
14522
|
setCounterpartyLookedUp(false);
|
|
13915
14523
|
setCounterpartyData(null);
|
|
14524
|
+
setCounterpartySearchResults([]);
|
|
14525
|
+
setShowCounterpartyDropdown(false);
|
|
14526
|
+
form.setValue("counterpartyName", "");
|
|
13916
14527
|
form.setValue("amount", "");
|
|
13917
14528
|
form.setValue("description", "");
|
|
13918
14529
|
};
|
|
13919
|
-
const handleSubmit = () => {
|
|
14530
|
+
const handleSubmit = async () => {
|
|
13920
14531
|
const data = form.getValues();
|
|
13921
|
-
|
|
14532
|
+
const requiresCounterparty = ["ach", "wire"].includes(data.transactionType);
|
|
14533
|
+
if (!data.transactionType || !data.accountNumber || !data.amount) {
|
|
13922
14534
|
toast$1.error("Please complete all required fields");
|
|
13923
14535
|
return;
|
|
13924
14536
|
}
|
|
13925
|
-
if (!
|
|
13926
|
-
toast$1.error("Please lookup
|
|
14537
|
+
if (requiresCounterparty && (!data.counterpartyName || !counterpartyLookedUp)) {
|
|
14538
|
+
toast$1.error("Please lookup counterparty for this transaction type");
|
|
13927
14539
|
return;
|
|
13928
14540
|
}
|
|
13929
|
-
|
|
13930
|
-
|
|
13931
|
-
|
|
13932
|
-
|
|
13933
|
-
|
|
13934
|
-
|
|
13935
|
-
"
|
|
13936
|
-
|
|
13937
|
-
|
|
13938
|
-
|
|
13939
|
-
|
|
13940
|
-
|
|
13941
|
-
|
|
13942
|
-
|
|
13943
|
-
|
|
13944
|
-
|
|
14541
|
+
if (!accountLookedUp) {
|
|
14542
|
+
toast$1.error("Please lookup account");
|
|
14543
|
+
return;
|
|
14544
|
+
}
|
|
14545
|
+
if (data.transactionType === "adjustment") {
|
|
14546
|
+
if (!data.adjustmentDirection || !data.adjustmentType) {
|
|
14547
|
+
toast$1.error("Please select direction and type for adjustment");
|
|
14548
|
+
return;
|
|
14549
|
+
}
|
|
14550
|
+
}
|
|
14551
|
+
if (data.transactionType === "transfer") {
|
|
14552
|
+
if (!data.receiverAccountNumber || !receiverAccountLookedUp) {
|
|
14553
|
+
toast$1.error("Please lookup receiver account for transfer");
|
|
14554
|
+
return;
|
|
14555
|
+
}
|
|
14556
|
+
}
|
|
14557
|
+
setIsSubmitting(true);
|
|
14558
|
+
try {
|
|
14559
|
+
await new Promise((resolve) => setTimeout(resolve, 1500));
|
|
14560
|
+
const hasError = Math.random() > 0.7;
|
|
14561
|
+
if (hasError) {
|
|
14562
|
+
const errorScenarios = [
|
|
14563
|
+
"Insufficient funds. Current balance: $125,450.00, Required: $" + parseFloat(data.amount).toFixed(2),
|
|
14564
|
+
"Transaction limit exceeded. Daily limit: $50,000.00",
|
|
14565
|
+
"Counterparty account is temporarily unavailable. Please try again later.",
|
|
14566
|
+
"Invalid routing number for the selected transaction type."
|
|
14567
|
+
];
|
|
14568
|
+
setSubmissionStatus("error");
|
|
14569
|
+
setErrorMessage(errorScenarios[Math.floor(Math.random() * errorScenarios.length)]);
|
|
14570
|
+
} else {
|
|
14571
|
+
const txId = "TXN-" + Math.random().toString(36).substr(2, 9).toUpperCase();
|
|
14572
|
+
setTransactionId(txId);
|
|
14573
|
+
setSubmissionStatus("success");
|
|
14574
|
+
}
|
|
13945
14575
|
setConfirmationOpen(true);
|
|
14576
|
+
} finally {
|
|
14577
|
+
setIsSubmitting(false);
|
|
13946
14578
|
}
|
|
13947
14579
|
};
|
|
13948
14580
|
const handleConfirmationClose = () => {
|
|
@@ -13954,368 +14586,40 @@ function NewTransaction() {
|
|
|
13954
14586
|
const handleCancel = () => {
|
|
13955
14587
|
navigate("/dashboard");
|
|
13956
14588
|
};
|
|
13957
|
-
const accountDataGrid = accountData ? [
|
|
13958
|
-
{
|
|
13959
|
-
title: "Account Information",
|
|
13960
|
-
items: [
|
|
13961
|
-
{ label: "Account Number", value: accountData.accountNumber },
|
|
13962
|
-
{ label: "Account Name", value: accountData.accountName },
|
|
13963
|
-
{ label: "Account Type", value: accountData.accountType },
|
|
13964
|
-
{ label: "Balance", value: accountData.balance },
|
|
13965
|
-
{ label: "Customer Name", value: accountData.customerName },
|
|
13966
|
-
{ label: "Customer ID", value: accountData.customerId }
|
|
13967
|
-
]
|
|
13968
|
-
}
|
|
13969
|
-
] : [];
|
|
13970
|
-
const counterpartyDataGrid = counterpartyData ? [
|
|
13971
|
-
{
|
|
13972
|
-
title: "Counterparty Information",
|
|
13973
|
-
items: [
|
|
13974
|
-
{ label: "Counterparty Name", value: counterpartyData.counterpartyName },
|
|
13975
|
-
{ label: "Counterparty ID", value: counterpartyData.counterpartyId },
|
|
13976
|
-
{ label: "Type", value: counterpartyData.counterpartyType },
|
|
13977
|
-
{ label: "Status", value: counterpartyData.status },
|
|
13978
|
-
{ label: "Tax ID", value: counterpartyData.taxId },
|
|
13979
|
-
{ label: "Primary Contact", value: counterpartyData.primaryContact },
|
|
13980
|
-
{ label: "Contact Email", value: counterpartyData.contactEmail },
|
|
13981
|
-
{ label: "Contact Phone", value: counterpartyData.contactPhone },
|
|
13982
|
-
{ label: "Address", value: counterpartyData.address }
|
|
13983
|
-
]
|
|
13984
|
-
}
|
|
13985
|
-
] : [];
|
|
13986
|
-
const reviewData = [
|
|
13987
|
-
{
|
|
13988
|
-
title: "Transaction Summary",
|
|
13989
|
-
items: [
|
|
13990
|
-
{ label: "Transaction Type", value: TRANSACTION_TYPES.find((t) => t.value === transactionType)?.label || "-" },
|
|
13991
|
-
{ label: "Account Number", value: accountNumber || "-" },
|
|
13992
|
-
{ label: "Counterparty", value: counterpartyName || "-" },
|
|
13993
|
-
{ label: "Amount", value: amount ? `$${amount}` : "-" },
|
|
13994
|
-
{ label: "Description", value: form.watch("description") || "N/A" }
|
|
13995
|
-
]
|
|
13996
|
-
}
|
|
13997
|
-
];
|
|
13998
14589
|
return /* @__PURE__ */ jsx(
|
|
13999
|
-
|
|
14590
|
+
NewTransactionView,
|
|
14000
14591
|
{
|
|
14001
|
-
|
|
14002
|
-
|
|
14003
|
-
|
|
14004
|
-
|
|
14005
|
-
|
|
14006
|
-
|
|
14007
|
-
|
|
14008
|
-
|
|
14009
|
-
|
|
14010
|
-
|
|
14011
|
-
|
|
14012
|
-
|
|
14013
|
-
|
|
14014
|
-
|
|
14015
|
-
|
|
14016
|
-
|
|
14017
|
-
|
|
14018
|
-
|
|
14019
|
-
|
|
14020
|
-
|
|
14021
|
-
|
|
14022
|
-
|
|
14023
|
-
|
|
14024
|
-
|
|
14025
|
-
|
|
14026
|
-
|
|
14027
|
-
|
|
14028
|
-
|
|
14029
|
-
|
|
14030
|
-
|
|
14031
|
-
|
|
14032
|
-
/* Account Information (Read-only) */
|
|
14033
|
-
/* @__PURE__ */ jsx(
|
|
14034
|
-
FormCard,
|
|
14035
|
-
{
|
|
14036
|
-
title: "Account Information",
|
|
14037
|
-
variant: "subtle",
|
|
14038
|
-
headerActions: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
14039
|
-
/* @__PURE__ */ jsx(CheckCircle2, { className: "h-5 w-5 text-success" }),
|
|
14040
|
-
/* @__PURE__ */ jsxs(
|
|
14041
|
-
Button,
|
|
14042
|
-
{
|
|
14043
|
-
variant: "ghost",
|
|
14044
|
-
size: "sm",
|
|
14045
|
-
onClick: handleEditAccount,
|
|
14046
|
-
children: [
|
|
14047
|
-
/* @__PURE__ */ jsx(Edit, { className: "h-4 w-4 mr-1" }),
|
|
14048
|
-
"Edit"
|
|
14049
|
-
]
|
|
14050
|
-
}
|
|
14051
|
-
)
|
|
14052
|
-
] }),
|
|
14053
|
-
children: /* @__PURE__ */ jsx(DataGrid, { data: accountDataGrid, columns: 2 })
|
|
14054
|
-
}
|
|
14055
|
-
)
|
|
14056
|
-
),
|
|
14057
|
-
/* @__PURE__ */ jsx(
|
|
14058
|
-
FormCard,
|
|
14059
|
-
{
|
|
14060
|
-
title: "Transaction Type",
|
|
14061
|
-
variant: "default",
|
|
14062
|
-
className: cn(!accountLookedUp && "opacity-50 pointer-events-none"),
|
|
14063
|
-
children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 lg:grid-cols-4 gap-3 lg:gap-4", children: TRANSACTION_TYPES.map((type) => {
|
|
14064
|
-
const Icon2 = type.icon;
|
|
14065
|
-
const isSelected = transactionType === type.value;
|
|
14066
|
-
return /* @__PURE__ */ jsxs(
|
|
14067
|
-
"button",
|
|
14068
|
-
{
|
|
14069
|
-
type: "button",
|
|
14070
|
-
onClick: () => form.setValue("transactionType", type.value),
|
|
14071
|
-
disabled: !accountLookedUp,
|
|
14072
|
-
className: cn(
|
|
14073
|
-
"flex flex-col items-center justify-center p-4 lg:p-3 rounded-lg border-2 transition-all",
|
|
14074
|
-
"hover:border-primary/50 hover:shadow-md",
|
|
14075
|
-
isSelected ? "border-primary bg-primary/5 shadow-sm" : "border-border bg-card"
|
|
14076
|
-
),
|
|
14077
|
-
children: [
|
|
14078
|
-
/* @__PURE__ */ jsx(Icon2, { className: cn(
|
|
14079
|
-
"h-6 w-6 lg:h-5 lg:w-5 mb-2",
|
|
14080
|
-
isSelected ? "text-primary" : "text-muted-foreground"
|
|
14081
|
-
) }),
|
|
14082
|
-
/* @__PURE__ */ jsx("span", { className: cn(
|
|
14083
|
-
"text-sm font-medium",
|
|
14084
|
-
isSelected ? "text-primary" : "text-foreground"
|
|
14085
|
-
), children: type.label })
|
|
14086
|
-
]
|
|
14087
|
-
},
|
|
14088
|
-
type.value
|
|
14089
|
-
);
|
|
14090
|
-
}) })
|
|
14091
|
-
}
|
|
14092
|
-
),
|
|
14093
|
-
!counterpartyLookedUp ? /* @__PURE__ */ jsx(
|
|
14094
|
-
FormCard,
|
|
14095
|
-
{
|
|
14096
|
-
title: "Counterparty Lookup",
|
|
14097
|
-
variant: "default",
|
|
14098
|
-
className: cn(!transactionType && "opacity-50 pointer-events-none"),
|
|
14099
|
-
children: /* @__PURE__ */ jsxs("div", { className: "flex gap-3 items-start w-full", children: [
|
|
14100
|
-
/* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
|
|
14101
|
-
FormInput,
|
|
14102
|
-
{
|
|
14103
|
-
name: "counterpartyName",
|
|
14104
|
-
placeholder: "Enter counterparty name",
|
|
14105
|
-
disabled: !transactionType
|
|
14106
|
-
}
|
|
14107
|
-
) }),
|
|
14108
|
-
/* @__PURE__ */ jsxs(
|
|
14109
|
-
Button,
|
|
14110
|
-
{
|
|
14111
|
-
onClick: handleCounterpartyLookup,
|
|
14112
|
-
disabled: !transactionType || !counterpartyName,
|
|
14113
|
-
className: "shrink-0 mt-0 w-48",
|
|
14114
|
-
children: [
|
|
14115
|
-
/* @__PURE__ */ jsx(Search, { className: "h-4 w-4 mr-2" }),
|
|
14116
|
-
"Lookup Counterparty"
|
|
14117
|
-
]
|
|
14118
|
-
}
|
|
14119
|
-
)
|
|
14120
|
-
] })
|
|
14121
|
-
}
|
|
14122
|
-
) : (
|
|
14123
|
-
/* Counterparty Information (Read-only) */
|
|
14124
|
-
/* @__PURE__ */ jsx(
|
|
14125
|
-
FormCard,
|
|
14126
|
-
{
|
|
14127
|
-
title: "Counterparty Information",
|
|
14128
|
-
variant: "subtle",
|
|
14129
|
-
headerActions: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
14130
|
-
/* @__PURE__ */ jsx(CheckCircle2, { className: "h-5 w-5 text-success" }),
|
|
14131
|
-
/* @__PURE__ */ jsxs(
|
|
14132
|
-
Button,
|
|
14133
|
-
{
|
|
14134
|
-
variant: "ghost",
|
|
14135
|
-
size: "sm",
|
|
14136
|
-
onClick: handleEditCounterparty,
|
|
14137
|
-
children: [
|
|
14138
|
-
/* @__PURE__ */ jsx(Edit, { className: "h-4 w-4 mr-1" }),
|
|
14139
|
-
"Edit"
|
|
14140
|
-
]
|
|
14141
|
-
}
|
|
14142
|
-
)
|
|
14143
|
-
] }),
|
|
14144
|
-
children: /* @__PURE__ */ jsx(DataGrid, { data: counterpartyDataGrid, columns: 2 })
|
|
14145
|
-
}
|
|
14146
|
-
)
|
|
14147
|
-
),
|
|
14148
|
-
/* @__PURE__ */ jsx(
|
|
14149
|
-
FormCard,
|
|
14150
|
-
{
|
|
14151
|
-
title: "Transaction Details",
|
|
14152
|
-
variant: "default",
|
|
14153
|
-
className: cn(!counterpartyLookedUp && "opacity-50 pointer-events-none"),
|
|
14154
|
-
children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
14155
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-[1fr_auto] gap-4", children: [
|
|
14156
|
-
/* @__PURE__ */ jsx(
|
|
14157
|
-
FormInput,
|
|
14158
|
-
{
|
|
14159
|
-
name: "amount",
|
|
14160
|
-
label: "Amount",
|
|
14161
|
-
placeholder: "0.00",
|
|
14162
|
-
type: "number",
|
|
14163
|
-
disabled: !counterpartyLookedUp
|
|
14164
|
-
}
|
|
14165
|
-
),
|
|
14166
|
-
/* @__PURE__ */ jsx(
|
|
14167
|
-
FormSelect,
|
|
14168
|
-
{
|
|
14169
|
-
name: "currency",
|
|
14170
|
-
label: "Currency",
|
|
14171
|
-
options: CURRENCY_OPTIONS,
|
|
14172
|
-
disabled: !counterpartyLookedUp,
|
|
14173
|
-
className: "w-48"
|
|
14174
|
-
}
|
|
14175
|
-
)
|
|
14176
|
-
] }),
|
|
14177
|
-
/* @__PURE__ */ jsx(
|
|
14178
|
-
FormInput,
|
|
14179
|
-
{
|
|
14180
|
-
name: "description",
|
|
14181
|
-
label: "Description (Optional)",
|
|
14182
|
-
placeholder: "Enter transaction description",
|
|
14183
|
-
disabled: !counterpartyLookedUp
|
|
14184
|
-
}
|
|
14185
|
-
)
|
|
14186
|
-
] })
|
|
14187
|
-
}
|
|
14188
|
-
),
|
|
14189
|
-
/* @__PURE__ */ jsx(
|
|
14190
|
-
FormCard,
|
|
14191
|
-
{
|
|
14192
|
-
title: "Review & Submit",
|
|
14193
|
-
variant: "default",
|
|
14194
|
-
children: /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
14195
|
-
/* @__PURE__ */ jsx(DataGrid, { data: reviewData, columns: 2 }),
|
|
14196
|
-
/* @__PURE__ */ jsx("div", { className: "bg-muted/30 rounded-lg p-4 border border-border/50", children: /* @__PURE__ */ jsx(
|
|
14197
|
-
Controller,
|
|
14198
|
-
{
|
|
14199
|
-
name: "certifyInformation",
|
|
14200
|
-
control: form.control,
|
|
14201
|
-
render: ({ field }) => /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
14202
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
|
|
14203
|
-
/* @__PURE__ */ jsx(
|
|
14204
|
-
Checkbox,
|
|
14205
|
-
{
|
|
14206
|
-
id: "certifyInformation",
|
|
14207
|
-
checked: field.value,
|
|
14208
|
-
onCheckedChange: field.onChange
|
|
14209
|
-
}
|
|
14210
|
-
),
|
|
14211
|
-
/* @__PURE__ */ jsx(
|
|
14212
|
-
"label",
|
|
14213
|
-
{
|
|
14214
|
-
htmlFor: "certifyInformation",
|
|
14215
|
-
className: "text-sm font-medium leading-relaxed cursor-pointer select-none",
|
|
14216
|
-
children: "I certify that all information entered is correct and accurate to the best of my knowledge"
|
|
14217
|
-
}
|
|
14218
|
-
)
|
|
14219
|
-
] }),
|
|
14220
|
-
form.formState.errors.certifyInformation && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive ml-7", children: form.formState.errors.certifyInformation.message })
|
|
14221
|
-
] })
|
|
14222
|
-
}
|
|
14223
|
-
) }),
|
|
14224
|
-
/* @__PURE__ */ jsxs("div", { className: "flex gap-3 justify-end pt-4 border-t border-border", children: [
|
|
14225
|
-
/* @__PURE__ */ jsx(
|
|
14226
|
-
Button,
|
|
14227
|
-
{
|
|
14228
|
-
type: "button",
|
|
14229
|
-
variant: "outline",
|
|
14230
|
-
onClick: handleCancel,
|
|
14231
|
-
className: "w-32",
|
|
14232
|
-
children: "Cancel"
|
|
14233
|
-
}
|
|
14234
|
-
),
|
|
14235
|
-
/* @__PURE__ */ jsxs(
|
|
14236
|
-
Button,
|
|
14237
|
-
{
|
|
14238
|
-
type: "button",
|
|
14239
|
-
onClick: handleSubmit,
|
|
14240
|
-
className: "w-48",
|
|
14241
|
-
disabled: !transactionType || !accountNumber || !counterpartyName || !amount || !form.watch("certifyInformation"),
|
|
14242
|
-
children: [
|
|
14243
|
-
/* @__PURE__ */ jsx(CheckCircle2, { className: "h-4 w-4 mr-2" }),
|
|
14244
|
-
"Submit Transaction"
|
|
14245
|
-
]
|
|
14246
|
-
}
|
|
14247
|
-
)
|
|
14248
|
-
] })
|
|
14249
|
-
] })
|
|
14250
|
-
}
|
|
14251
|
-
)
|
|
14252
|
-
] }) }),
|
|
14253
|
-
/* @__PURE__ */ jsx(Dialog, { open: confirmationOpen, onOpenChange: setConfirmationOpen, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-md", children: [
|
|
14254
|
-
/* @__PURE__ */ jsxs(DialogHeader, { children: [
|
|
14255
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 mb-2", children: [
|
|
14256
|
-
submissionStatus === "success" ? /* @__PURE__ */ jsx("div", { className: "h-12 w-12 rounded-full bg-success/10 flex items-center justify-center", children: /* @__PURE__ */ jsx(CheckCircle2, { className: "h-6 w-6 text-success" }) }) : /* @__PURE__ */ jsx("div", { className: "h-12 w-12 rounded-full bg-destructive/10 flex items-center justify-center", children: /* @__PURE__ */ jsx(XCircle, { className: "h-6 w-6 text-destructive" }) }),
|
|
14257
|
-
/* @__PURE__ */ jsx(DialogTitle, { className: "text-xl", children: submissionStatus === "success" ? "Transaction Successful" : "Transaction Failed" })
|
|
14258
|
-
] }),
|
|
14259
|
-
/* @__PURE__ */ jsx(DialogDescription, { className: "text-left", children: submissionStatus === "success" ? /* @__PURE__ */ jsxs("div", { className: "space-y-4 pt-2", children: [
|
|
14260
|
-
/* @__PURE__ */ jsx("p", { className: "text-foreground", children: "Your transaction has been successfully submitted and is being processed." }),
|
|
14261
|
-
/* @__PURE__ */ jsxs("div", { className: "bg-muted/50 rounded-lg p-4 space-y-2", children: [
|
|
14262
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm", children: [
|
|
14263
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Transaction ID:" }),
|
|
14264
|
-
/* @__PURE__ */ jsx("span", { className: "font-mono font-medium", children: transactionId })
|
|
14265
|
-
] }),
|
|
14266
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm", children: [
|
|
14267
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Amount:" }),
|
|
14268
|
-
/* @__PURE__ */ jsxs("span", { className: "font-medium", children: [
|
|
14269
|
-
"$",
|
|
14270
|
-
amount
|
|
14271
|
-
] })
|
|
14272
|
-
] }),
|
|
14273
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm", children: [
|
|
14274
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Type:" }),
|
|
14275
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium", children: TRANSACTION_TYPES.find((t) => t.value === transactionType)?.label })
|
|
14276
|
-
] }),
|
|
14277
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm", children: [
|
|
14278
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Counterparty:" }),
|
|
14279
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium", children: counterpartyName })
|
|
14280
|
-
] })
|
|
14281
|
-
] }),
|
|
14282
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 p-3 bg-blue-500/10 border border-blue-500/20 rounded-lg", children: [
|
|
14283
|
-
/* @__PURE__ */ jsx(AlertCircle, { className: "h-5 w-5 text-blue-500 mt-0.5 flex-shrink-0" }),
|
|
14284
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-blue-700 dark:text-blue-300", children: "You will receive a confirmation email once the transaction is completed." })
|
|
14285
|
-
] })
|
|
14286
|
-
] }) : /* @__PURE__ */ jsxs("div", { className: "space-y-4 pt-2", children: [
|
|
14287
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 p-4 bg-destructive/10 border border-destructive/20 rounded-lg", children: [
|
|
14288
|
-
/* @__PURE__ */ jsx(XCircle, { className: "h-5 w-5 text-destructive mt-0.5 flex-shrink-0" }),
|
|
14289
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
14290
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-destructive", children: "Error Processing Transaction" }),
|
|
14291
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: errorMessage })
|
|
14292
|
-
] })
|
|
14293
|
-
] }),
|
|
14294
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Please review the error message above and try again. If the problem persists, contact support." })
|
|
14295
|
-
] }) })
|
|
14296
|
-
] }),
|
|
14297
|
-
/* @__PURE__ */ jsxs(DialogFooter, { className: "sm:justify-end gap-2", children: [
|
|
14298
|
-
submissionStatus === "error" && /* @__PURE__ */ jsx(
|
|
14299
|
-
Button,
|
|
14300
|
-
{
|
|
14301
|
-
type: "button",
|
|
14302
|
-
variant: "outline",
|
|
14303
|
-
onClick: () => setConfirmationOpen(false),
|
|
14304
|
-
children: "Try Again"
|
|
14305
|
-
}
|
|
14306
|
-
),
|
|
14307
|
-
/* @__PURE__ */ jsx(
|
|
14308
|
-
Button,
|
|
14309
|
-
{
|
|
14310
|
-
type: "button",
|
|
14311
|
-
onClick: handleConfirmationClose,
|
|
14312
|
-
variant: submissionStatus === "success" ? "default" : "outline",
|
|
14313
|
-
children: submissionStatus === "success" ? "View Transactions" : "Close"
|
|
14314
|
-
}
|
|
14315
|
-
)
|
|
14316
|
-
] })
|
|
14317
|
-
] }) })
|
|
14318
|
-
] })
|
|
14592
|
+
form,
|
|
14593
|
+
accountLookedUp,
|
|
14594
|
+
accountData,
|
|
14595
|
+
counterpartyLookedUp,
|
|
14596
|
+
counterpartyData,
|
|
14597
|
+
confirmationOpen,
|
|
14598
|
+
submissionStatus,
|
|
14599
|
+
errorMessage,
|
|
14600
|
+
transactionId,
|
|
14601
|
+
isAccountLoading,
|
|
14602
|
+
isCounterpartyLoading,
|
|
14603
|
+
isSubmitting,
|
|
14604
|
+
onAccountLookup: handleAccountLookup,
|
|
14605
|
+
onEditAccount: handleEditAccount,
|
|
14606
|
+
counterpartySearchResults,
|
|
14607
|
+
isCounterpartySearching,
|
|
14608
|
+
showCounterpartyDropdown,
|
|
14609
|
+
onCounterpartySearchChange: handleCounterpartySearchChange,
|
|
14610
|
+
onCounterpartySelect: handleCounterpartySelect,
|
|
14611
|
+
onCounterpartyDropdownClose: () => setShowCounterpartyDropdown(false),
|
|
14612
|
+
onEditCounterparty: handleEditCounterparty,
|
|
14613
|
+
onTransactionTypeChange: handleTransactionTypeChange,
|
|
14614
|
+
onSubmit: handleSubmit,
|
|
14615
|
+
onCancel: handleCancel,
|
|
14616
|
+
onConfirmationClose: handleConfirmationClose,
|
|
14617
|
+
onConfirmationOpenChange: setConfirmationOpen,
|
|
14618
|
+
receiverAccountLookedUp,
|
|
14619
|
+
receiverAccountData,
|
|
14620
|
+
isReceiverAccountLoading,
|
|
14621
|
+
onReceiverAccountLookup: handleReceiverAccountLookup,
|
|
14622
|
+
onEditReceiverAccount: handleEditReceiverAccount
|
|
14319
14623
|
}
|
|
14320
14624
|
);
|
|
14321
14625
|
}
|
|
@@ -16348,6 +16652,6 @@ function ReconExceptions() {
|
|
|
16348
16652
|
] }) });
|
|
16349
16653
|
}
|
|
16350
16654
|
|
|
16351
|
-
export { ACHBankCard, ACHBasicInfoCard, ACHDetailsSection, ACHTransferSection, AccountCard, AccountDetail_default as AccountDetail, Accounts_default as Accounts, AddressForm, AlertDetail_default as AlertDetail, AlertDetailRouter, AlertDocuments, AlertHeaderControls, AlertNotes, AlertTimeline, Alerts_default as Alerts, AppSidebar, Badge, BankAddressCard, BankingDetailsCard, BasicInfoCard, BasicInfoSection, BeneficiaryAddress, BeneficiaryCard, BeneficiaryDomesticWire, Breadcrumb, BusinessDetail_default as BusinessDetail, BusinessDetailView, BusinessFiltersSheet, BusinessProfileCard, BusinessStatusCard, BusinessTypeBadge, Businesses_default as Businesses, Button, CIPStatusBadge, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Cases_default as Cases, Checkbox, ContactInfoCard, Container, ContextSection, Counterparties_default as Counterparties, CounterpartiesView, CounterpartyBasicInfo, CounterpartyDetail_default as CounterpartyDetail, CounterpartyDetailView, CounterpartyProfileCard, CounterpartyRecordsCard, CounterpartyTypeBadge, Create_default as CreateBusiness, CreateBusinessView, Create_default2 as CreateCounterparty, CreateCounterpartyView, Create_default3 as CreateIndividual, CreateVelocityLimit, Dashboard_default as Dashboard, DashboardDemo, DataGrid, DataTable, DetailPageLayout, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, EditableFormCard, EditableInfoField, EnhancedInput, EnhancedSelect, EnhancedTextarea, EntityCard, FormCard, FormField, FormInput, FormProvider, FormSection, FormSelect, IndividualDetail_default as IndividualDetail, Individuals_default as Individuals, InfoField, IntermediaryCard, IntermediaryFI, IntermediaryFIAddress, JsonViewer, Label, ListPage, MainLayout, MetricCard, NewTransaction, NotFound_default as NotFound, OFACAlertView, OriginatorCard, OriginatorFI, OriginatorFIAddress, PageLayout, PatternLibrary, PaymentInformationSection, Popover, PopoverContent, PopoverTrigger, ReceiverCard, ReconExceptions, ReconUpload, ResolveAlertDialog, ResponsiveGrid, ScrollArea, ScrollBar, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Stack, Statement, StatementHeader, StatementView, StatusBadge, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Toast, ToastAction, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TransactionDetail_default as TransactionDetail, TransactionHistory_default as TransactionHistory, TransactionTypeBadge, UIKit, UIKitShowcase, VelocityLimitDetail, VelocityLimits, WireDetailsSection, WireTransferSection, badgeVariants, buttonVariants, cardVariants, downloadCSV, generateStatementCSV, inputVariants, reducer, textareaVariants, toast, useAlertDetail, useCounterpartyEntity, useEditState, useFormWithEditState, useIsMobile, useSidebar, useToast };
|
|
16655
|
+
export { ACHBankCard, ACHBasicInfoCard, ACHDetailsSection, ACHTransferSection, ADJUSTMENT_DIRECTION_OPTIONS, ADJUSTMENT_TYPE_OPTIONS, AccountCard, AccountDetail_default as AccountDetail, Accounts_default as Accounts, AddressForm, AlertDetail_default as AlertDetail, AlertDetailRouter, AlertDocuments, AlertHeaderControls, AlertNotes, AlertTimeline, Alerts_default as Alerts, AppSidebar, Badge, BankAddressCard, BankingDetailsCard, BasicInfoCard, BasicInfoSection, BeneficiaryAddress, BeneficiaryCard, BeneficiaryDomesticWire, Breadcrumb, BusinessDetail_default as BusinessDetail, BusinessDetailView, BusinessFiltersSheet, BusinessProfileCard, BusinessStatusCard, BusinessTypeBadge, Businesses_default as Businesses, Button, CIPStatusBadge, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Cases_default as Cases, Checkbox, ContactInfoCard, Container, ContextSection, Counterparties_default as Counterparties, CounterpartiesView, CounterpartyBasicInfo, CounterpartyDetail_default as CounterpartyDetail, CounterpartyDetailView, CounterpartyProfileCard, CounterpartyRecordsCard, CounterpartyTypeBadge, Create_default as CreateBusiness, CreateBusinessView, Create_default2 as CreateCounterparty, CreateCounterpartyView, Create_default3 as CreateIndividual, CreateVelocityLimit, Dashboard_default as Dashboard, DashboardDemo, DataGrid, DataTable, DetailPageLayout, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, EditableFormCard, EditableInfoField, EnhancedInput, EnhancedSelect, EnhancedTextarea, EntityCard, FormCard, FormField, FormInput, FormProvider, FormSection, FormSelect, IndividualDetail_default as IndividualDetail, Individuals_default as Individuals, InfoField, IntermediaryCard, IntermediaryFI, IntermediaryFIAddress, JsonViewer, Label, ListPage, MainLayout, MetricCard, NewTransaction, NewTransactionView, NotFound_default as NotFound, OFACAlertView, OriginatorCard, OriginatorFI, OriginatorFIAddress, PageLayout, PatternLibrary, PaymentInformationSection, Popover, PopoverContent, PopoverTrigger, ReceiverCard, ReconExceptions, ReconUpload, ResolveAlertDialog, ResponsiveGrid, ScrollArea, ScrollBar, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Stack, Statement, StatementHeader, StatementView, StatusBadge, TRANSACTION_TYPES, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Toast, ToastAction, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TransactionDetail_default as TransactionDetail, TransactionHistory_default as TransactionHistory, TransactionTypeBadge, UIKit, UIKitShowcase, VelocityLimitDetail, VelocityLimits, WireDetailsSection, WireTransferSection, badgeVariants, buttonVariants, cardVariants, downloadCSV, generateStatementCSV, inputVariants, newTransactionSchema, reducer, textareaVariants, toast, useAlertDetail, useCounterpartyEntity, useEditState, useFormWithEditState, useIsMobile, useSidebar, useToast };
|
|
16352
16656
|
//# sourceMappingURL=index.js.map
|
|
16353
16657
|
//# sourceMappingURL=index.js.map
|