braid-ui 1.0.49 → 1.0.51
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 +743 -329
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +112 -14
- package/dist/index.d.ts +112 -14
- package/dist/index.js +743 -330
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -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';
|
|
@@ -1247,7 +1247,7 @@ var DialogOverlay = React15.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
1247
1247
|
}
|
|
1248
1248
|
));
|
|
1249
1249
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
1250
|
-
var DialogContent = React15.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
|
|
1250
|
+
var DialogContent = React15.forwardRef(({ className, children, hideCloseButton, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
|
|
1251
1251
|
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
1252
1252
|
/* @__PURE__ */ jsxs(
|
|
1253
1253
|
DialogPrimitive.Content,
|
|
@@ -1260,7 +1260,7 @@ var DialogContent = React15.forwardRef(({ className, children, ...props }, ref)
|
|
|
1260
1260
|
...props,
|
|
1261
1261
|
children: [
|
|
1262
1262
|
children,
|
|
1263
|
-
/* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
|
|
1263
|
+
!hideCloseButton && /* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
|
|
1264
1264
|
/* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
|
|
1265
1265
|
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
1266
1266
|
] })
|
|
@@ -3067,7 +3067,7 @@ function AppSidebar() {
|
|
|
3067
3067
|
] });
|
|
3068
3068
|
}
|
|
3069
3069
|
var MainLayout = ({ children }) => {
|
|
3070
|
-
return /* @__PURE__ */ jsx("div", { className: "flex
|
|
3070
|
+
return /* @__PURE__ */ jsx("div", { className: "flex h-screen w-full overflow-hidden", children: /* @__PURE__ */ jsx("main", { className: "flex-1 overflow-hidden", children }) });
|
|
3071
3071
|
};
|
|
3072
3072
|
var useEditState = ({ initialEditing = false, onToggleEdit, onSave, onCancel }) => {
|
|
3073
3073
|
const [localEditing, setLocalEditing] = useState(initialEditing);
|
|
@@ -8225,7 +8225,7 @@ var StatementView = ({
|
|
|
8225
8225
|
] });
|
|
8226
8226
|
};
|
|
8227
8227
|
var ACHDetailsSection = ({ data }) => {
|
|
8228
|
-
const
|
|
8228
|
+
const formatCurrency3 = (value) => {
|
|
8229
8229
|
return new Intl.NumberFormat("en-US", {
|
|
8230
8230
|
style: "currency",
|
|
8231
8231
|
currency: "USD",
|
|
@@ -8261,7 +8261,7 @@ var ACHDetailsSection = ({ data }) => {
|
|
|
8261
8261
|
layout: "horizontal"
|
|
8262
8262
|
}
|
|
8263
8263
|
),
|
|
8264
|
-
/* @__PURE__ */ jsx(InfoField, { label: "Amount", value:
|
|
8264
|
+
/* @__PURE__ */ jsx(InfoField, { label: "Amount", value: formatCurrency3(data.amount), layout: "horizontal" }),
|
|
8265
8265
|
/* @__PURE__ */ jsx(InfoField, { label: "SEC Code", value: data.secCode, layout: "horizontal" }),
|
|
8266
8266
|
/* @__PURE__ */ jsx(InfoField, { label: "Company Entry Description", value: data.companyEntryDescription, layout: "horizontal" }),
|
|
8267
8267
|
data.companyDiscretionaryData && /* @__PURE__ */ jsx(InfoField, { label: "Company Discretionary Data", value: data.companyDiscretionaryData, layout: "horizontal" }),
|
|
@@ -8344,6 +8344,37 @@ var WireDetailsSection = ({ data }) => {
|
|
|
8344
8344
|
) })
|
|
8345
8345
|
] });
|
|
8346
8346
|
};
|
|
8347
|
+
var formatCurrency = (value) => {
|
|
8348
|
+
const numValue = typeof value === "string" ? parseFloat(value) : value;
|
|
8349
|
+
if (isNaN(numValue)) return "";
|
|
8350
|
+
return new Intl.NumberFormat("en-US", {
|
|
8351
|
+
style: "currency",
|
|
8352
|
+
currency: "USD",
|
|
8353
|
+
minimumFractionDigits: 2
|
|
8354
|
+
}).format(numValue);
|
|
8355
|
+
};
|
|
8356
|
+
var CurrencyInput = ({ value, onChange, ...props }) => {
|
|
8357
|
+
const [isFocused, setIsFocused] = React15.useState(false);
|
|
8358
|
+
const displayValue = value ? isFocused ? value : formatCurrency(value) : "";
|
|
8359
|
+
const handleChange = (e) => {
|
|
8360
|
+
const rawValue = e.target.value.replace(/[^0-9.]/g, "");
|
|
8361
|
+
const parts = rawValue.split(".");
|
|
8362
|
+
const sanitized = parts[0] + (parts.length > 1 ? "." + parts[1]?.slice(0, 2) : "");
|
|
8363
|
+
onChange(sanitized);
|
|
8364
|
+
};
|
|
8365
|
+
return /* @__PURE__ */ jsx(
|
|
8366
|
+
EnhancedInput,
|
|
8367
|
+
{
|
|
8368
|
+
...props,
|
|
8369
|
+
value: displayValue,
|
|
8370
|
+
onChange: handleChange,
|
|
8371
|
+
onFocus: () => setIsFocused(true),
|
|
8372
|
+
onBlur: () => setIsFocused(false),
|
|
8373
|
+
inputMode: "decimal",
|
|
8374
|
+
placeholder: props.placeholder || "$0.00"
|
|
8375
|
+
}
|
|
8376
|
+
);
|
|
8377
|
+
};
|
|
8347
8378
|
var Checkbox = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
8348
8379
|
CheckboxPrimitive.Root,
|
|
8349
8380
|
{
|
|
@@ -8363,21 +8394,29 @@ var Checkbox = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
8363
8394
|
}
|
|
8364
8395
|
));
|
|
8365
8396
|
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
8397
|
+
var formatCurrency2 = (value) => {
|
|
8398
|
+
const numValue = typeof value === "string" ? parseFloat(value) : value;
|
|
8399
|
+
if (isNaN(numValue)) return "-";
|
|
8400
|
+
return new Intl.NumberFormat("en-US", {
|
|
8401
|
+
style: "currency",
|
|
8402
|
+
currency: "USD",
|
|
8403
|
+
minimumFractionDigits: 2
|
|
8404
|
+
}).format(numValue);
|
|
8405
|
+
};
|
|
8366
8406
|
var TRANSACTION_TYPES = [
|
|
8367
8407
|
{ value: "transfer", label: "Transfer", icon: ArrowLeftRight },
|
|
8368
8408
|
{ value: "adjustment", label: "Adjustment", icon: Settings },
|
|
8369
8409
|
{ value: "ach", label: "ACH", icon: Building2 },
|
|
8370
8410
|
{ value: "wire", label: "Wire", icon: Zap }
|
|
8371
8411
|
];
|
|
8372
|
-
var
|
|
8373
|
-
{ value: "
|
|
8374
|
-
{ value: "
|
|
8375
|
-
|
|
8376
|
-
|
|
8377
|
-
{ value: "
|
|
8378
|
-
{ value: "
|
|
8379
|
-
{ value: "
|
|
8380
|
-
{ value: "CNY", label: "CNY - Chinese Yuan" }
|
|
8412
|
+
var ADJUSTMENT_DIRECTION_OPTIONS = [
|
|
8413
|
+
{ value: "debit", label: "Debit" },
|
|
8414
|
+
{ value: "credit", label: "Credit" }
|
|
8415
|
+
];
|
|
8416
|
+
var ADJUSTMENT_TYPE_OPTIONS = [
|
|
8417
|
+
{ value: "collection", label: "Collection" },
|
|
8418
|
+
{ value: "transaction_reversal", label: "Transaction Reversal" },
|
|
8419
|
+
{ value: "transaction_adjustment", label: "Transaction Adjustment" }
|
|
8381
8420
|
];
|
|
8382
8421
|
var NewTransactionView = ({
|
|
8383
8422
|
form,
|
|
@@ -8389,19 +8428,41 @@ var NewTransactionView = ({
|
|
|
8389
8428
|
submissionStatus,
|
|
8390
8429
|
errorMessage,
|
|
8391
8430
|
transactionId,
|
|
8431
|
+
isAccountLoading,
|
|
8432
|
+
isCounterpartyLoading,
|
|
8433
|
+
isSubmitting,
|
|
8434
|
+
counterpartySearchResults,
|
|
8435
|
+
isCounterpartySearching,
|
|
8436
|
+
showCounterpartyDropdown,
|
|
8392
8437
|
onAccountLookup,
|
|
8393
|
-
onCounterpartyLookup,
|
|
8394
8438
|
onEditAccount,
|
|
8395
8439
|
onEditCounterparty,
|
|
8440
|
+
onTransactionTypeChange,
|
|
8396
8441
|
onSubmit,
|
|
8397
8442
|
onCancel,
|
|
8398
8443
|
onConfirmationClose,
|
|
8399
|
-
onConfirmationOpenChange
|
|
8444
|
+
onConfirmationOpenChange,
|
|
8445
|
+
onNewTransaction,
|
|
8446
|
+
onCounterpartySearchChange,
|
|
8447
|
+
onCounterpartySelect,
|
|
8448
|
+
onCounterpartyDropdownClose,
|
|
8449
|
+
receiverAccountLookedUp,
|
|
8450
|
+
receiverAccountData,
|
|
8451
|
+
isReceiverAccountLoading,
|
|
8452
|
+
onReceiverAccountLookup,
|
|
8453
|
+
onEditReceiverAccount,
|
|
8454
|
+
isReviewReady
|
|
8400
8455
|
}) => {
|
|
8401
8456
|
const transactionType = form.watch("transactionType");
|
|
8402
8457
|
const accountNumber = form.watch("accountNumber");
|
|
8403
8458
|
const counterpartyName = form.watch("counterpartyName");
|
|
8404
8459
|
const amount = form.watch("amount");
|
|
8460
|
+
const receiverAccountNumber = form.watch("receiverAccountNumber");
|
|
8461
|
+
const adjustmentDirection = form.watch("adjustmentDirection");
|
|
8462
|
+
const adjustmentType = form.watch("adjustmentType");
|
|
8463
|
+
const requiresCounterparty = ["ach", "wire"].includes(transactionType);
|
|
8464
|
+
const isTransfer = transactionType === "transfer";
|
|
8465
|
+
const isAdjustment = transactionType === "adjustment";
|
|
8405
8466
|
const accountDataGrid = accountData ? [
|
|
8406
8467
|
{
|
|
8407
8468
|
title: "Account Information",
|
|
@@ -8421,292 +8482,401 @@ var NewTransactionView = ({
|
|
|
8421
8482
|
items: [
|
|
8422
8483
|
{ label: "Counterparty Name", value: counterpartyData.counterpartyName },
|
|
8423
8484
|
{ label: "Counterparty ID", value: counterpartyData.counterpartyId },
|
|
8424
|
-
{ label: "Type", value: counterpartyData.
|
|
8425
|
-
{ label: "Status", value: counterpartyData.status },
|
|
8426
|
-
{ label: "Tax ID", value: counterpartyData.taxId },
|
|
8427
|
-
{ label: "Primary Contact", value: counterpartyData.primaryContact },
|
|
8485
|
+
{ label: "Instrument Type", value: counterpartyData.paymentInstrumentType?.toUpperCase() || "-" },
|
|
8428
8486
|
{ label: "Contact Email", value: counterpartyData.contactEmail },
|
|
8429
|
-
{ label: "Contact Phone", value: counterpartyData.contactPhone }
|
|
8430
|
-
{ label: "Address", value: counterpartyData.address }
|
|
8487
|
+
{ label: "Contact Phone", value: counterpartyData.contactPhone }
|
|
8431
8488
|
]
|
|
8432
8489
|
}
|
|
8433
8490
|
] : [];
|
|
8434
|
-
const
|
|
8491
|
+
const receiverAccountDataGrid = receiverAccountData ? [
|
|
8435
8492
|
{
|
|
8436
|
-
title: "
|
|
8493
|
+
title: "Receiver Account Information",
|
|
8437
8494
|
items: [
|
|
8438
|
-
{ label: "
|
|
8439
|
-
{ label: "Account
|
|
8440
|
-
{ label: "
|
|
8441
|
-
{ label: "
|
|
8442
|
-
{ label: "
|
|
8495
|
+
{ label: "Account Number", value: receiverAccountData.accountNumber },
|
|
8496
|
+
{ label: "Account Name", value: receiverAccountData.accountName },
|
|
8497
|
+
{ label: "Account Type", value: receiverAccountData.accountType },
|
|
8498
|
+
{ label: "Customer Name", value: receiverAccountData.customerName },
|
|
8499
|
+
{ label: "Customer ID", value: receiverAccountData.customerId }
|
|
8443
8500
|
]
|
|
8444
8501
|
}
|
|
8502
|
+
] : [];
|
|
8503
|
+
const reviewItems = [
|
|
8504
|
+
{ label: "Transaction Type", value: TRANSACTION_TYPES.find((t) => t.value === transactionType)?.label || "-" },
|
|
8505
|
+
{ label: "Account Number", value: accountNumber || "-" },
|
|
8506
|
+
...isAdjustment ? [
|
|
8507
|
+
{ label: "Direction", value: adjustmentDirection === "debit" ? "Debit" : adjustmentDirection === "credit" ? "Credit" : "-" },
|
|
8508
|
+
{ label: "Adjustment Type", value: ADJUSTMENT_TYPE_OPTIONS.find((t) => t.value === adjustmentType)?.label || "-" }
|
|
8509
|
+
] : [],
|
|
8510
|
+
...isTransfer ? [{ label: "Receiver Account", value: receiverAccountNumber || "-" }] : [],
|
|
8511
|
+
...requiresCounterparty ? [{ label: "Counterparty", value: counterpartyName || "-" }] : [],
|
|
8512
|
+
{ label: "Amount", value: amount ? formatCurrency2(amount) : "-" },
|
|
8513
|
+
{ label: "Description", value: form.watch("description") || "N/A" }
|
|
8445
8514
|
];
|
|
8446
|
-
|
|
8447
|
-
|
|
8448
|
-
|
|
8449
|
-
|
|
8450
|
-
|
|
8515
|
+
const reviewData = [
|
|
8516
|
+
{
|
|
8517
|
+
title: "Transaction Summary",
|
|
8518
|
+
items: reviewItems
|
|
8519
|
+
}
|
|
8520
|
+
];
|
|
8521
|
+
return /* @__PURE__ */ jsxs("div", { className: "container mx-auto p-6 space-y-6", children: [
|
|
8522
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("h1", { className: "text-3xl font-bold tracking-tight", children: "New Transaction" }) }),
|
|
8523
|
+
/* @__PURE__ */ jsxs("div", { className: "max-w-4xl space-y-6", children: [
|
|
8524
|
+
/* @__PURE__ */ jsx(FormProvider, { form, children: /* @__PURE__ */ jsxs("form", { onSubmit: (e) => e.preventDefault(), children: [
|
|
8525
|
+
!accountLookedUp ? /* @__PURE__ */ jsx(FormCard, { title: "Account Lookup", variant: "default", children: /* @__PURE__ */ jsxs("div", { className: "flex gap-3 items-start w-full", children: [
|
|
8526
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
|
|
8527
|
+
FormInput,
|
|
8528
|
+
{
|
|
8529
|
+
name: "accountNumber",
|
|
8530
|
+
placeholder: "Enter account number"
|
|
8531
|
+
}
|
|
8532
|
+
) }),
|
|
8533
|
+
/* @__PURE__ */ jsx(
|
|
8534
|
+
Button,
|
|
8535
|
+
{
|
|
8536
|
+
onClick: onAccountLookup,
|
|
8537
|
+
disabled: !accountNumber || isAccountLoading,
|
|
8538
|
+
className: "shrink-0 mt-0 w-48",
|
|
8539
|
+
children: isAccountLoading ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8540
|
+
/* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 mr-2 animate-spin" }),
|
|
8541
|
+
"Looking up..."
|
|
8542
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8543
|
+
/* @__PURE__ */ jsx(Search, { className: "h-4 w-4 mr-2" }),
|
|
8544
|
+
"Lookup Account"
|
|
8545
|
+
] })
|
|
8546
|
+
}
|
|
8547
|
+
)
|
|
8548
|
+
] }) }) : /* @__PURE__ */ jsx(
|
|
8549
|
+
FormCard,
|
|
8451
8550
|
{
|
|
8452
|
-
|
|
8453
|
-
|
|
8551
|
+
title: "Account Information",
|
|
8552
|
+
variant: "subtle",
|
|
8553
|
+
headerActions: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8554
|
+
/* @__PURE__ */ jsx(CheckCircle2, { className: "h-5 w-5 text-success" }),
|
|
8555
|
+
/* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: onEditAccount, children: [
|
|
8556
|
+
/* @__PURE__ */ jsx(Edit, { className: "h-4 w-4 mr-1" }),
|
|
8557
|
+
"Edit"
|
|
8558
|
+
] })
|
|
8559
|
+
] }),
|
|
8560
|
+
children: /* @__PURE__ */ jsx(DataGrid, { data: accountDataGrid, columns: 2 })
|
|
8454
8561
|
}
|
|
8455
|
-
)
|
|
8456
|
-
/* @__PURE__ */
|
|
8457
|
-
|
|
8562
|
+
),
|
|
8563
|
+
/* @__PURE__ */ jsx(
|
|
8564
|
+
FormCard,
|
|
8565
|
+
{
|
|
8566
|
+
title: "Transaction Type",
|
|
8567
|
+
variant: "default",
|
|
8568
|
+
className: cn(!accountLookedUp && "opacity-50 pointer-events-none"),
|
|
8569
|
+
children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 lg:grid-cols-4 gap-3 lg:gap-4", children: TRANSACTION_TYPES.map((type) => {
|
|
8570
|
+
const Icon2 = type.icon;
|
|
8571
|
+
const isSelected = transactionType === type.value;
|
|
8572
|
+
return /* @__PURE__ */ jsxs(
|
|
8573
|
+
"button",
|
|
8574
|
+
{
|
|
8575
|
+
type: "button",
|
|
8576
|
+
onClick: () => onTransactionTypeChange(type.value),
|
|
8577
|
+
disabled: !accountLookedUp,
|
|
8578
|
+
className: cn(
|
|
8579
|
+
"flex flex-col items-center justify-center p-4 lg:p-3 rounded-lg border-2 transition-all",
|
|
8580
|
+
"hover:border-primary/50 hover:shadow-md",
|
|
8581
|
+
isSelected ? "border-primary bg-primary/5 shadow-sm" : "border-border bg-card"
|
|
8582
|
+
),
|
|
8583
|
+
children: [
|
|
8584
|
+
/* @__PURE__ */ jsx(Icon2, { className: cn(
|
|
8585
|
+
"h-6 w-6 lg:h-5 lg:w-5 mb-2",
|
|
8586
|
+
isSelected ? "text-primary" : "text-muted-foreground"
|
|
8587
|
+
) }),
|
|
8588
|
+
/* @__PURE__ */ jsx("span", { className: cn(
|
|
8589
|
+
"text-sm font-medium",
|
|
8590
|
+
isSelected ? "text-primary" : "text-foreground"
|
|
8591
|
+
), children: type.label })
|
|
8592
|
+
]
|
|
8593
|
+
},
|
|
8594
|
+
type.value
|
|
8595
|
+
);
|
|
8596
|
+
}) })
|
|
8597
|
+
}
|
|
8598
|
+
),
|
|
8599
|
+
requiresCounterparty && (!counterpartyLookedUp ? /* @__PURE__ */ jsxs(
|
|
8600
|
+
FormCard,
|
|
8458
8601
|
{
|
|
8459
|
-
|
|
8460
|
-
|
|
8461
|
-
className: "
|
|
8602
|
+
title: "Counterparty Search",
|
|
8603
|
+
variant: "default",
|
|
8604
|
+
className: cn(!transactionType && "opacity-50 pointer-events-none"),
|
|
8462
8605
|
children: [
|
|
8463
|
-
/* @__PURE__ */
|
|
8464
|
-
|
|
8606
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
8607
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
8608
|
+
/* @__PURE__ */ jsx(
|
|
8609
|
+
"input",
|
|
8610
|
+
{
|
|
8611
|
+
type: "text",
|
|
8612
|
+
placeholder: "Start typing to search counterparties...",
|
|
8613
|
+
value: counterpartyName,
|
|
8614
|
+
onChange: (e) => onCounterpartySearchChange(e.target.value),
|
|
8615
|
+
disabled: !transactionType,
|
|
8616
|
+
className: cn(
|
|
8617
|
+
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",
|
|
8618
|
+
"ring-offset-background placeholder:text-muted-foreground",
|
|
8619
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
8620
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
8621
|
+
isCounterpartySearching && "pr-10"
|
|
8622
|
+
)
|
|
8623
|
+
}
|
|
8624
|
+
),
|
|
8625
|
+
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" }) })
|
|
8626
|
+
] }),
|
|
8627
|
+
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(
|
|
8628
|
+
"button",
|
|
8629
|
+
{
|
|
8630
|
+
type: "button",
|
|
8631
|
+
onClick: () => onCounterpartySelect(result),
|
|
8632
|
+
className: "w-full px-3 py-2 text-left hover:bg-accent transition-colors",
|
|
8633
|
+
children: [
|
|
8634
|
+
/* @__PURE__ */ jsx("div", { className: "font-medium text-sm", children: result.name }),
|
|
8635
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground", children: result.id })
|
|
8636
|
+
]
|
|
8637
|
+
},
|
|
8638
|
+
result.id
|
|
8639
|
+
)) }),
|
|
8640
|
+
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: [
|
|
8641
|
+
'No counterparties found matching "',
|
|
8642
|
+
counterpartyName,
|
|
8643
|
+
'"'
|
|
8644
|
+
] }) })
|
|
8645
|
+
] }),
|
|
8646
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-2", children: "Type at least 2 characters to search" })
|
|
8465
8647
|
]
|
|
8466
8648
|
}
|
|
8467
|
-
)
|
|
8468
|
-
|
|
8469
|
-
|
|
8470
|
-
|
|
8471
|
-
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
|
|
8476
|
-
|
|
8477
|
-
|
|
8478
|
-
] })
|
|
8479
|
-
|
|
8480
|
-
|
|
8481
|
-
|
|
8482
|
-
|
|
8483
|
-
|
|
8484
|
-
|
|
8485
|
-
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
|
|
8489
|
-
|
|
8490
|
-
const Icon2 = type.icon;
|
|
8491
|
-
const isSelected = transactionType === type.value;
|
|
8492
|
-
return /* @__PURE__ */ jsxs(
|
|
8493
|
-
"button",
|
|
8494
|
-
{
|
|
8495
|
-
type: "button",
|
|
8496
|
-
onClick: () => form.setValue("transactionType", type.value),
|
|
8497
|
-
disabled: !accountLookedUp,
|
|
8498
|
-
className: cn(
|
|
8499
|
-
"flex flex-col items-center justify-center p-4 lg:p-3 rounded-lg border-2 transition-all",
|
|
8500
|
-
"hover:border-primary/50 hover:shadow-md",
|
|
8501
|
-
isSelected ? "border-primary bg-primary/5 shadow-sm" : "border-border bg-card"
|
|
8502
|
-
),
|
|
8503
|
-
children: [
|
|
8504
|
-
/* @__PURE__ */ jsx(Icon2, { className: cn(
|
|
8505
|
-
"h-6 w-6 lg:h-5 lg:w-5 mb-2",
|
|
8506
|
-
isSelected ? "text-primary" : "text-muted-foreground"
|
|
8507
|
-
) }),
|
|
8508
|
-
/* @__PURE__ */ jsx("span", { className: cn(
|
|
8509
|
-
"text-sm font-medium",
|
|
8510
|
-
isSelected ? "text-primary" : "text-foreground"
|
|
8511
|
-
), children: type.label })
|
|
8512
|
-
]
|
|
8513
|
-
},
|
|
8514
|
-
type.value
|
|
8515
|
-
);
|
|
8516
|
-
}) })
|
|
8517
|
-
}
|
|
8518
|
-
),
|
|
8519
|
-
!counterpartyLookedUp ? /* @__PURE__ */ jsx(
|
|
8520
|
-
FormCard,
|
|
8521
|
-
{
|
|
8522
|
-
title: "Counterparty Lookup",
|
|
8523
|
-
variant: "default",
|
|
8524
|
-
className: cn(!transactionType && "opacity-50 pointer-events-none"),
|
|
8525
|
-
children: /* @__PURE__ */ jsxs("div", { className: "flex gap-3 items-start w-full", children: [
|
|
8526
|
-
/* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
|
|
8527
|
-
FormInput,
|
|
8528
|
-
{
|
|
8529
|
-
name: "counterpartyName",
|
|
8530
|
-
placeholder: "Enter counterparty name",
|
|
8531
|
-
disabled: !transactionType
|
|
8532
|
-
}
|
|
8533
|
-
) }),
|
|
8534
|
-
/* @__PURE__ */ jsxs(
|
|
8535
|
-
Button,
|
|
8536
|
-
{
|
|
8537
|
-
onClick: onCounterpartyLookup,
|
|
8538
|
-
disabled: !transactionType || !counterpartyName,
|
|
8539
|
-
className: "shrink-0 mt-0 w-48",
|
|
8540
|
-
children: [
|
|
8541
|
-
/* @__PURE__ */ jsx(Search, { className: "h-4 w-4 mr-2" }),
|
|
8542
|
-
"Lookup Counterparty"
|
|
8543
|
-
]
|
|
8544
|
-
}
|
|
8545
|
-
)
|
|
8546
|
-
] })
|
|
8547
|
-
}
|
|
8548
|
-
) : /* @__PURE__ */ jsx(
|
|
8549
|
-
FormCard,
|
|
8550
|
-
{
|
|
8551
|
-
title: "Counterparty Information",
|
|
8552
|
-
variant: "subtle",
|
|
8553
|
-
headerActions: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8554
|
-
/* @__PURE__ */ jsx(CheckCircle2, { className: "h-5 w-5 text-success" }),
|
|
8555
|
-
/* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: onEditCounterparty, children: [
|
|
8556
|
-
/* @__PURE__ */ jsx(Edit, { className: "h-4 w-4 mr-1" }),
|
|
8557
|
-
"Edit"
|
|
8558
|
-
] })
|
|
8559
|
-
] }),
|
|
8560
|
-
children: /* @__PURE__ */ jsx(DataGrid, { data: counterpartyDataGrid, columns: 2 })
|
|
8561
|
-
}
|
|
8562
|
-
),
|
|
8563
|
-
/* @__PURE__ */ jsx(
|
|
8564
|
-
FormCard,
|
|
8565
|
-
{
|
|
8566
|
-
title: "Transaction Details",
|
|
8567
|
-
variant: "default",
|
|
8568
|
-
className: cn(!counterpartyLookedUp && "opacity-50 pointer-events-none"),
|
|
8569
|
-
children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
8570
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-[1fr_auto] gap-4", children: [
|
|
8571
|
-
/* @__PURE__ */ jsx(
|
|
8649
|
+
) : /* @__PURE__ */ jsx(
|
|
8650
|
+
FormCard,
|
|
8651
|
+
{
|
|
8652
|
+
title: "Counterparty Information",
|
|
8653
|
+
variant: "subtle",
|
|
8654
|
+
headerActions: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8655
|
+
/* @__PURE__ */ jsx(CheckCircle2, { className: "h-5 w-5 text-success" }),
|
|
8656
|
+
/* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: onEditCounterparty, children: [
|
|
8657
|
+
/* @__PURE__ */ jsx(Edit, { className: "h-4 w-4 mr-1" }),
|
|
8658
|
+
"Edit"
|
|
8659
|
+
] })
|
|
8660
|
+
] }),
|
|
8661
|
+
children: /* @__PURE__ */ jsx(DataGrid, { data: counterpartyDataGrid, columns: 2 })
|
|
8662
|
+
}
|
|
8663
|
+
)),
|
|
8664
|
+
isTransfer && (!receiverAccountLookedUp ? /* @__PURE__ */ jsx(
|
|
8665
|
+
FormCard,
|
|
8666
|
+
{
|
|
8667
|
+
title: "Receiver Account",
|
|
8668
|
+
variant: "default",
|
|
8669
|
+
className: cn(!transactionType && "opacity-50 pointer-events-none"),
|
|
8670
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex gap-3 items-start w-full", children: [
|
|
8671
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
|
|
8572
8672
|
FormInput,
|
|
8573
8673
|
{
|
|
8574
|
-
name: "
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
type: "number",
|
|
8578
|
-
disabled: !counterpartyLookedUp
|
|
8674
|
+
name: "receiverAccountNumber",
|
|
8675
|
+
placeholder: "Enter receiver account number",
|
|
8676
|
+
disabled: !transactionType
|
|
8579
8677
|
}
|
|
8580
|
-
),
|
|
8678
|
+
) }),
|
|
8581
8679
|
/* @__PURE__ */ jsx(
|
|
8582
|
-
|
|
8680
|
+
Button,
|
|
8583
8681
|
{
|
|
8584
|
-
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
|
|
8682
|
+
onClick: onReceiverAccountLookup,
|
|
8683
|
+
disabled: !receiverAccountNumber || isReceiverAccountLoading,
|
|
8684
|
+
className: "shrink-0 mt-0 w-48",
|
|
8685
|
+
children: isReceiverAccountLoading ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8686
|
+
/* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 mr-2 animate-spin" }),
|
|
8687
|
+
"Looking up..."
|
|
8688
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8689
|
+
/* @__PURE__ */ jsx(Search, { className: "h-4 w-4 mr-2" }),
|
|
8690
|
+
"Lookup Receiver"
|
|
8691
|
+
] })
|
|
8589
8692
|
}
|
|
8590
8693
|
)
|
|
8694
|
+
] })
|
|
8695
|
+
}
|
|
8696
|
+
) : /* @__PURE__ */ jsx(
|
|
8697
|
+
FormCard,
|
|
8698
|
+
{
|
|
8699
|
+
title: "Receiver Account Information",
|
|
8700
|
+
variant: "subtle",
|
|
8701
|
+
headerActions: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8702
|
+
/* @__PURE__ */ jsx(CheckCircle2, { className: "h-5 w-5 text-success" }),
|
|
8703
|
+
/* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: onEditReceiverAccount, children: [
|
|
8704
|
+
/* @__PURE__ */ jsx(Edit, { className: "h-4 w-4 mr-1" }),
|
|
8705
|
+
"Edit"
|
|
8706
|
+
] })
|
|
8591
8707
|
] }),
|
|
8592
|
-
/* @__PURE__ */ jsx(
|
|
8593
|
-
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
|
|
8597
|
-
placeholder: "Enter transaction description",
|
|
8598
|
-
disabled: !counterpartyLookedUp
|
|
8599
|
-
}
|
|
8600
|
-
)
|
|
8601
|
-
] })
|
|
8602
|
-
}
|
|
8603
|
-
),
|
|
8604
|
-
/* @__PURE__ */ jsx(FormCard, { title: "Review & Submit", variant: "default", children: /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
8605
|
-
/* @__PURE__ */ jsx(DataGrid, { data: reviewData, columns: 2 }),
|
|
8606
|
-
/* @__PURE__ */ jsx("div", { className: "bg-muted/30 rounded-lg p-4 border border-border/50", children: /* @__PURE__ */ jsx(
|
|
8607
|
-
Controller,
|
|
8708
|
+
children: /* @__PURE__ */ jsx(DataGrid, { data: receiverAccountDataGrid, columns: 2 })
|
|
8709
|
+
}
|
|
8710
|
+
)),
|
|
8711
|
+
/* @__PURE__ */ jsx(
|
|
8712
|
+
FormCard,
|
|
8608
8713
|
{
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
|
|
8714
|
+
title: "Transaction Details",
|
|
8715
|
+
variant: "default",
|
|
8716
|
+
className: cn(
|
|
8717
|
+
requiresCounterparty ? !counterpartyLookedUp && "opacity-50 pointer-events-none" : isTransfer ? !receiverAccountLookedUp && "opacity-50 pointer-events-none" : !transactionType && "opacity-50 pointer-events-none"
|
|
8718
|
+
),
|
|
8719
|
+
children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
8720
|
+
isAdjustment && /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
8613
8721
|
/* @__PURE__ */ jsx(
|
|
8614
|
-
|
|
8722
|
+
FormSelect,
|
|
8615
8723
|
{
|
|
8616
|
-
|
|
8617
|
-
|
|
8618
|
-
|
|
8724
|
+
name: "adjustmentDirection",
|
|
8725
|
+
label: "Direction",
|
|
8726
|
+
placeholder: "Select direction",
|
|
8727
|
+
options: ADJUSTMENT_DIRECTION_OPTIONS,
|
|
8728
|
+
disabled: !transactionType
|
|
8619
8729
|
}
|
|
8620
8730
|
),
|
|
8621
8731
|
/* @__PURE__ */ jsx(
|
|
8622
|
-
|
|
8732
|
+
FormSelect,
|
|
8623
8733
|
{
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
|
|
8734
|
+
name: "adjustmentType",
|
|
8735
|
+
label: "Adjustment Type",
|
|
8736
|
+
placeholder: "Select type",
|
|
8737
|
+
options: ADJUSTMENT_TYPE_OPTIONS,
|
|
8738
|
+
disabled: !transactionType
|
|
8627
8739
|
}
|
|
8628
8740
|
)
|
|
8629
8741
|
] }),
|
|
8630
|
-
|
|
8742
|
+
/* @__PURE__ */ jsx(
|
|
8743
|
+
Controller,
|
|
8744
|
+
{
|
|
8745
|
+
name: "amount",
|
|
8746
|
+
control: form.control,
|
|
8747
|
+
render: ({ field }) => /* @__PURE__ */ jsx(
|
|
8748
|
+
CurrencyInput,
|
|
8749
|
+
{
|
|
8750
|
+
label: "Amount",
|
|
8751
|
+
value: field.value,
|
|
8752
|
+
onChange: field.onChange,
|
|
8753
|
+
disabled: requiresCounterparty ? !counterpartyLookedUp : isTransfer ? !receiverAccountLookedUp : !transactionType,
|
|
8754
|
+
error: form.formState.errors.amount?.message
|
|
8755
|
+
}
|
|
8756
|
+
)
|
|
8757
|
+
}
|
|
8758
|
+
),
|
|
8759
|
+
/* @__PURE__ */ jsx(
|
|
8760
|
+
FormInput,
|
|
8761
|
+
{
|
|
8762
|
+
name: "description",
|
|
8763
|
+
label: "Description (Optional)",
|
|
8764
|
+
placeholder: "Enter transaction description",
|
|
8765
|
+
disabled: requiresCounterparty ? !counterpartyLookedUp : isTransfer ? !receiverAccountLookedUp : !transactionType
|
|
8766
|
+
}
|
|
8767
|
+
)
|
|
8631
8768
|
] })
|
|
8632
8769
|
}
|
|
8633
|
-
)
|
|
8634
|
-
/* @__PURE__ */
|
|
8635
|
-
/* @__PURE__ */ jsx(
|
|
8636
|
-
/* @__PURE__ */
|
|
8770
|
+
),
|
|
8771
|
+
/* @__PURE__ */ jsx(FormCard, { title: "Review & Submit", variant: "default", className: cn(!isReviewReady && "opacity-50 pointer-events-none"), children: /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
8772
|
+
/* @__PURE__ */ jsx(DataGrid, { data: reviewData, columns: 2 }),
|
|
8773
|
+
/* @__PURE__ */ jsx("div", { className: "bg-muted/30 rounded-lg p-4 border border-border/50", children: /* @__PURE__ */ jsx(
|
|
8774
|
+
Controller,
|
|
8775
|
+
{
|
|
8776
|
+
name: "certifyInformation",
|
|
8777
|
+
control: form.control,
|
|
8778
|
+
render: ({ field }) => /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
8779
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
|
|
8780
|
+
/* @__PURE__ */ jsx(
|
|
8781
|
+
Checkbox,
|
|
8782
|
+
{
|
|
8783
|
+
id: "certifyInformation",
|
|
8784
|
+
checked: field.value,
|
|
8785
|
+
onCheckedChange: field.onChange
|
|
8786
|
+
}
|
|
8787
|
+
),
|
|
8788
|
+
/* @__PURE__ */ jsx(
|
|
8789
|
+
"label",
|
|
8790
|
+
{
|
|
8791
|
+
htmlFor: "certifyInformation",
|
|
8792
|
+
className: "text-sm font-medium leading-relaxed cursor-pointer select-none",
|
|
8793
|
+
children: "I certify that all information entered is correct and accurate to the best of my knowledge"
|
|
8794
|
+
}
|
|
8795
|
+
)
|
|
8796
|
+
] }),
|
|
8797
|
+
form.formState.errors.certifyInformation && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive ml-7", children: form.formState.errors.certifyInformation.message })
|
|
8798
|
+
] })
|
|
8799
|
+
}
|
|
8800
|
+
) }),
|
|
8801
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-3 justify-end pt-4 border-t border-border", children: [
|
|
8802
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", onClick: onCancel, className: "w-32", children: "Cancel" }),
|
|
8803
|
+
/* @__PURE__ */ jsx(
|
|
8804
|
+
Button,
|
|
8805
|
+
{
|
|
8806
|
+
type: "button",
|
|
8807
|
+
onClick: onSubmit,
|
|
8808
|
+
className: "w-48",
|
|
8809
|
+
disabled: !transactionType || !accountNumber || requiresCounterparty && !counterpartyName || isTransfer && !receiverAccountLookedUp || isAdjustment && (!adjustmentDirection || !adjustmentType) || !amount || !form.watch("certifyInformation") || isSubmitting,
|
|
8810
|
+
children: isSubmitting ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8811
|
+
/* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 mr-2 animate-spin" }),
|
|
8812
|
+
"Submitting..."
|
|
8813
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8814
|
+
/* @__PURE__ */ jsx(CheckCircle2, { className: "h-4 w-4 mr-2" }),
|
|
8815
|
+
"Submit Transaction"
|
|
8816
|
+
] })
|
|
8817
|
+
}
|
|
8818
|
+
)
|
|
8819
|
+
] })
|
|
8820
|
+
] }) })
|
|
8821
|
+
] }) }),
|
|
8822
|
+
/* @__PURE__ */ jsx(Dialog, { open: confirmationOpen, onOpenChange: () => {
|
|
8823
|
+
}, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-md", hideCloseButton: true, children: [
|
|
8824
|
+
/* @__PURE__ */ jsxs(DialogHeader, { children: [
|
|
8825
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 mb-2", children: [
|
|
8826
|
+
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" }) }),
|
|
8827
|
+
/* @__PURE__ */ jsx(DialogTitle, { className: "text-xl", children: submissionStatus === "success" ? "Transaction Successful" : "Transaction Failed" })
|
|
8828
|
+
] }),
|
|
8829
|
+
/* @__PURE__ */ jsx(DialogDescription, { className: "text-left", children: submissionStatus === "success" ? /* @__PURE__ */ jsxs("div", { className: "space-y-4 pt-2", children: [
|
|
8830
|
+
/* @__PURE__ */ jsx("p", { className: "text-foreground", children: "Your transaction has been successfully submitted and is being processed." }),
|
|
8831
|
+
/* @__PURE__ */ jsxs("div", { className: "bg-muted/50 rounded-lg p-4 space-y-2", children: [
|
|
8832
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm", children: [
|
|
8833
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Transaction ID:" }),
|
|
8834
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono font-medium", children: transactionId })
|
|
8835
|
+
] }),
|
|
8836
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm", children: [
|
|
8837
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Amount:" }),
|
|
8838
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: formatCurrency2(amount) })
|
|
8839
|
+
] }),
|
|
8840
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm", children: [
|
|
8841
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Type:" }),
|
|
8842
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: TRANSACTION_TYPES.find((t) => t.value === transactionType)?.label })
|
|
8843
|
+
] }),
|
|
8844
|
+
requiresCounterparty && counterpartyName && /* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm", children: [
|
|
8845
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Counterparty:" }),
|
|
8846
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: counterpartyName })
|
|
8847
|
+
] })
|
|
8848
|
+
] }),
|
|
8849
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 p-3 bg-blue-500/10 border border-blue-500/20 rounded-lg", children: [
|
|
8850
|
+
/* @__PURE__ */ jsx(AlertCircle, { className: "h-5 w-5 text-blue-500 mt-0.5 flex-shrink-0" }),
|
|
8851
|
+
/* @__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." })
|
|
8852
|
+
] })
|
|
8853
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "space-y-4 pt-2", children: [
|
|
8854
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 p-4 bg-destructive/10 border border-destructive/20 rounded-lg", children: [
|
|
8855
|
+
/* @__PURE__ */ jsx(XCircle, { className: "h-5 w-5 text-destructive mt-0.5 flex-shrink-0" }),
|
|
8856
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
8857
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-destructive", children: "Error Processing Transaction" }),
|
|
8858
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: errorMessage })
|
|
8859
|
+
] })
|
|
8860
|
+
] }),
|
|
8861
|
+
/* @__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." })
|
|
8862
|
+
] }) })
|
|
8863
|
+
] }),
|
|
8864
|
+
/* @__PURE__ */ jsxs(DialogFooter, { className: "sm:justify-end gap-2", children: [
|
|
8865
|
+
submissionStatus === "error" && /* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", onClick: () => onConfirmationOpenChange(false), children: "Edit" }),
|
|
8866
|
+
submissionStatus === "success" && /* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", onClick: onNewTransaction, children: "New Transaction" }),
|
|
8867
|
+
/* @__PURE__ */ jsx(
|
|
8637
8868
|
Button,
|
|
8638
8869
|
{
|
|
8639
8870
|
type: "button",
|
|
8640
|
-
onClick:
|
|
8641
|
-
|
|
8642
|
-
|
|
8643
|
-
children: [
|
|
8644
|
-
/* @__PURE__ */ jsx(CheckCircle2, { className: "h-4 w-4 mr-2" }),
|
|
8645
|
-
"Submit Transaction"
|
|
8646
|
-
]
|
|
8871
|
+
onClick: onConfirmationClose,
|
|
8872
|
+
variant: submissionStatus === "success" ? "default" : "outline",
|
|
8873
|
+
children: submissionStatus === "success" ? "View Transaction" : "Close"
|
|
8647
8874
|
}
|
|
8648
8875
|
)
|
|
8649
8876
|
] })
|
|
8650
8877
|
] }) })
|
|
8651
|
-
] })
|
|
8652
|
-
|
|
8653
|
-
/* @__PURE__ */ jsxs(DialogHeader, { children: [
|
|
8654
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 mb-2", children: [
|
|
8655
|
-
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" }) }),
|
|
8656
|
-
/* @__PURE__ */ jsx(DialogTitle, { className: "text-xl", children: submissionStatus === "success" ? "Transaction Successful" : "Transaction Failed" })
|
|
8657
|
-
] }),
|
|
8658
|
-
/* @__PURE__ */ jsx(DialogDescription, { className: "text-left", children: submissionStatus === "success" ? /* @__PURE__ */ jsxs("div", { className: "space-y-4 pt-2", children: [
|
|
8659
|
-
/* @__PURE__ */ jsx("p", { className: "text-foreground", children: "Your transaction has been successfully submitted and is being processed." }),
|
|
8660
|
-
/* @__PURE__ */ jsxs("div", { className: "bg-muted/50 rounded-lg p-4 space-y-2", children: [
|
|
8661
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm", children: [
|
|
8662
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Transaction ID:" }),
|
|
8663
|
-
/* @__PURE__ */ jsx("span", { className: "font-mono font-medium", children: transactionId })
|
|
8664
|
-
] }),
|
|
8665
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm", children: [
|
|
8666
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Amount:" }),
|
|
8667
|
-
/* @__PURE__ */ jsxs("span", { className: "font-medium", children: [
|
|
8668
|
-
"$",
|
|
8669
|
-
amount
|
|
8670
|
-
] })
|
|
8671
|
-
] }),
|
|
8672
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm", children: [
|
|
8673
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Type:" }),
|
|
8674
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium", children: TRANSACTION_TYPES.find((t) => t.value === transactionType)?.label })
|
|
8675
|
-
] }),
|
|
8676
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm", children: [
|
|
8677
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Counterparty:" }),
|
|
8678
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium", children: counterpartyName })
|
|
8679
|
-
] })
|
|
8680
|
-
] }),
|
|
8681
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 p-3 bg-blue-500/10 border border-blue-500/20 rounded-lg", children: [
|
|
8682
|
-
/* @__PURE__ */ jsx(AlertCircle, { className: "h-5 w-5 text-blue-500 mt-0.5 flex-shrink-0" }),
|
|
8683
|
-
/* @__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." })
|
|
8684
|
-
] })
|
|
8685
|
-
] }) : /* @__PURE__ */ jsxs("div", { className: "space-y-4 pt-2", children: [
|
|
8686
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 p-4 bg-destructive/10 border border-destructive/20 rounded-lg", children: [
|
|
8687
|
-
/* @__PURE__ */ jsx(XCircle, { className: "h-5 w-5 text-destructive mt-0.5 flex-shrink-0" }),
|
|
8688
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
8689
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-destructive", children: "Error Processing Transaction" }),
|
|
8690
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: errorMessage })
|
|
8691
|
-
] })
|
|
8692
|
-
] }),
|
|
8693
|
-
/* @__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." })
|
|
8694
|
-
] }) })
|
|
8695
|
-
] }),
|
|
8696
|
-
/* @__PURE__ */ jsxs(DialogFooter, { className: "sm:justify-end gap-2", children: [
|
|
8697
|
-
submissionStatus === "error" && /* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", onClick: () => onConfirmationOpenChange(false), children: "Try Again" }),
|
|
8698
|
-
/* @__PURE__ */ jsx(
|
|
8699
|
-
Button,
|
|
8700
|
-
{
|
|
8701
|
-
type: "button",
|
|
8702
|
-
onClick: onConfirmationClose,
|
|
8703
|
-
variant: submissionStatus === "success" ? "default" : "outline",
|
|
8704
|
-
children: submissionStatus === "success" ? "View Transactions" : "Close"
|
|
8705
|
-
}
|
|
8706
|
-
)
|
|
8707
|
-
] })
|
|
8708
|
-
] }) })
|
|
8709
|
-
] }) });
|
|
8878
|
+
] })
|
|
8879
|
+
] });
|
|
8710
8880
|
};
|
|
8711
8881
|
var typeIcons = {
|
|
8712
8882
|
checking: CreditCard,
|
|
@@ -13795,7 +13965,7 @@ var TransactionHistory = () => {
|
|
|
13795
13965
|
setRowsPerPage(value);
|
|
13796
13966
|
setCurrentPage(1);
|
|
13797
13967
|
};
|
|
13798
|
-
const
|
|
13968
|
+
const formatCurrency3 = (value) => {
|
|
13799
13969
|
const formatted = new Intl.NumberFormat("en-US", {
|
|
13800
13970
|
style: "currency",
|
|
13801
13971
|
currency: "USD",
|
|
@@ -13972,23 +14142,19 @@ var TransactionHistory = () => {
|
|
|
13972
14142
|
),
|
|
13973
14143
|
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
13974
14144
|
/* @__PURE__ */ jsx(
|
|
13975
|
-
|
|
14145
|
+
CurrencyInput,
|
|
13976
14146
|
{
|
|
13977
14147
|
label: "Min Amount",
|
|
13978
|
-
type: "number",
|
|
13979
14148
|
value: filters.minAmount,
|
|
13980
|
-
onChange: (
|
|
13981
|
-
placeholder: "0.00"
|
|
14149
|
+
onChange: (value) => handleFilterChange("minAmount", value)
|
|
13982
14150
|
}
|
|
13983
14151
|
),
|
|
13984
14152
|
/* @__PURE__ */ jsx(
|
|
13985
|
-
|
|
14153
|
+
CurrencyInput,
|
|
13986
14154
|
{
|
|
13987
14155
|
label: "Max Amount",
|
|
13988
|
-
type: "number",
|
|
13989
14156
|
value: filters.maxAmount,
|
|
13990
|
-
onChange: (
|
|
13991
|
-
placeholder: "0.00"
|
|
14157
|
+
onChange: (value) => handleFilterChange("maxAmount", value)
|
|
13992
14158
|
}
|
|
13993
14159
|
)
|
|
13994
14160
|
] }),
|
|
@@ -14088,7 +14254,7 @@ var TransactionHistory = () => {
|
|
|
14088
14254
|
children: [
|
|
14089
14255
|
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-xs", children: transaction.created }),
|
|
14090
14256
|
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-xs", children: transaction.accountNumber }),
|
|
14091
|
-
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-xs text-right", children: /* @__PURE__ */ jsx("span", { className: transaction.amount < 0 ? "text-destructive" : "", children:
|
|
14257
|
+
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-xs text-right", children: /* @__PURE__ */ jsx("span", { className: transaction.amount < 0 ? "text-destructive" : "", children: formatCurrency3(transaction.amount) }) }),
|
|
14092
14258
|
/* @__PURE__ */ jsx("td", { className: "px-3 py-2", children: /* @__PURE__ */ jsx(Button, { variant: "link", className: "h-auto p-0 font-normal text-xs", children: transaction.customer }) }),
|
|
14093
14259
|
/* @__PURE__ */ jsx("td", { className: "px-3 py-2", children: /* @__PURE__ */ jsx(Button, { variant: "link", className: "h-auto p-0 font-normal text-xs", children: transaction.counterparty }) }),
|
|
14094
14260
|
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-xs truncate", children: transaction.description }),
|
|
@@ -14155,13 +14321,42 @@ var TransactionHistory_default = TransactionHistory;
|
|
|
14155
14321
|
var newTransactionSchema = z.object({
|
|
14156
14322
|
transactionType: z.string().min(1, "Transaction type is required"),
|
|
14157
14323
|
accountNumber: z.string().min(1, "Account number is required"),
|
|
14158
|
-
counterpartyName: z.string().
|
|
14324
|
+
counterpartyName: z.string().optional(),
|
|
14159
14325
|
amount: z.string().min(1, "Amount is required"),
|
|
14160
|
-
currency: z.string().min(1, "Currency is required"),
|
|
14161
14326
|
description: z.string().optional(),
|
|
14162
14327
|
certifyInformation: z.boolean().refine((val) => val === true, {
|
|
14163
14328
|
message: "You must certify the information is correct"
|
|
14164
|
-
})
|
|
14329
|
+
}),
|
|
14330
|
+
// Adjustment-specific fields
|
|
14331
|
+
adjustmentDirection: z.string().optional(),
|
|
14332
|
+
adjustmentType: z.string().optional(),
|
|
14333
|
+
// Transfer-specific fields
|
|
14334
|
+
receiverAccountNumber: z.string().optional()
|
|
14335
|
+
}).refine((data) => {
|
|
14336
|
+
const requiresCounterparty = ["ach", "wire"].includes(data.transactionType);
|
|
14337
|
+
if (requiresCounterparty && !data.counterpartyName) {
|
|
14338
|
+
return false;
|
|
14339
|
+
}
|
|
14340
|
+
return true;
|
|
14341
|
+
}, {
|
|
14342
|
+
message: "Counterparty is required for ACH and Wire transactions",
|
|
14343
|
+
path: ["counterpartyName"]
|
|
14344
|
+
}).refine((data) => {
|
|
14345
|
+
if (data.transactionType === "adjustment") {
|
|
14346
|
+
if (!data.adjustmentDirection || !data.adjustmentType) return false;
|
|
14347
|
+
}
|
|
14348
|
+
return true;
|
|
14349
|
+
}, {
|
|
14350
|
+
message: "Direction and Type are required for Adjustment transactions",
|
|
14351
|
+
path: ["adjustmentDirection"]
|
|
14352
|
+
}).refine((data) => {
|
|
14353
|
+
if (data.transactionType === "transfer") {
|
|
14354
|
+
if (!data.receiverAccountNumber) return false;
|
|
14355
|
+
}
|
|
14356
|
+
return true;
|
|
14357
|
+
}, {
|
|
14358
|
+
message: "Receiver account number is required for Transfer transactions",
|
|
14359
|
+
path: ["receiverAccountNumber"]
|
|
14165
14360
|
});
|
|
14166
14361
|
var mockAccountData = {
|
|
14167
14362
|
accountNumber: "****1234",
|
|
@@ -14172,27 +14367,25 @@ var mockAccountData = {
|
|
|
14172
14367
|
customerId: "CUST-001",
|
|
14173
14368
|
customerType: "Business"
|
|
14174
14369
|
};
|
|
14175
|
-
var mockCounterpartyData = {
|
|
14176
|
-
counterpartyName: "Global Tech Solutions Inc.",
|
|
14177
|
-
counterpartyId: "CP-5678",
|
|
14178
|
-
counterpartyType: "Business",
|
|
14179
|
-
status: "Active",
|
|
14180
|
-
taxId: "98-7654321",
|
|
14181
|
-
primaryContact: "Sarah Johnson",
|
|
14182
|
-
contactEmail: "sarah.johnson@globaltech.com",
|
|
14183
|
-
contactPhone: "+1 (555) 987-6543",
|
|
14184
|
-
address: "456 Innovation Drive, San Francisco, CA 94105"
|
|
14185
|
-
};
|
|
14186
14370
|
function NewTransaction() {
|
|
14187
14371
|
const navigate = useNavigate();
|
|
14188
14372
|
const [accountLookedUp, setAccountLookedUp] = useState(false);
|
|
14189
14373
|
const [accountData, setAccountData] = useState(null);
|
|
14190
14374
|
const [counterpartyLookedUp, setCounterpartyLookedUp] = useState(false);
|
|
14191
14375
|
const [counterpartyData, setCounterpartyData] = useState(null);
|
|
14376
|
+
const [counterpartySearchResults, setCounterpartySearchResults] = useState([]);
|
|
14377
|
+
const [isCounterpartySearching, setIsCounterpartySearching] = useState(false);
|
|
14378
|
+
const [showCounterpartyDropdown, setShowCounterpartyDropdown] = useState(false);
|
|
14192
14379
|
const [confirmationOpen, setConfirmationOpen] = useState(false);
|
|
14193
14380
|
const [submissionStatus, setSubmissionStatus] = useState(null);
|
|
14194
14381
|
const [errorMessage, setErrorMessage] = useState("");
|
|
14195
14382
|
const [transactionId, setTransactionId] = useState("");
|
|
14383
|
+
const [isAccountLoading, setIsAccountLoading] = useState(false);
|
|
14384
|
+
const [isCounterpartyLoading, setIsCounterpartyLoading] = useState(false);
|
|
14385
|
+
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
14386
|
+
const [receiverAccountLookedUp, setReceiverAccountLookedUp] = useState(false);
|
|
14387
|
+
const [receiverAccountData, setReceiverAccountData] = useState(null);
|
|
14388
|
+
const [isReceiverAccountLoading, setIsReceiverAccountLoading] = useState(false);
|
|
14196
14389
|
const form = useForm({
|
|
14197
14390
|
resolver: zodResolver(newTransactionSchema),
|
|
14198
14391
|
defaultValues: {
|
|
@@ -14200,30 +14393,131 @@ function NewTransaction() {
|
|
|
14200
14393
|
accountNumber: "",
|
|
14201
14394
|
counterpartyName: "",
|
|
14202
14395
|
amount: "",
|
|
14203
|
-
currency: "USD",
|
|
14204
14396
|
description: "",
|
|
14205
|
-
certifyInformation: false
|
|
14397
|
+
certifyInformation: false,
|
|
14398
|
+
adjustmentDirection: "",
|
|
14399
|
+
adjustmentType: "",
|
|
14400
|
+
receiverAccountNumber: ""
|
|
14206
14401
|
}
|
|
14207
14402
|
});
|
|
14208
|
-
const handleAccountLookup = () => {
|
|
14403
|
+
const handleAccountLookup = async () => {
|
|
14209
14404
|
const accNum = form.getValues("accountNumber");
|
|
14210
14405
|
if (!accNum) {
|
|
14211
14406
|
toast$1.error("Please enter an account number");
|
|
14212
14407
|
return;
|
|
14213
14408
|
}
|
|
14214
|
-
|
|
14215
|
-
|
|
14216
|
-
|
|
14409
|
+
setIsAccountLoading(true);
|
|
14410
|
+
try {
|
|
14411
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
14412
|
+
setAccountData(mockAccountData);
|
|
14413
|
+
setAccountLookedUp(true);
|
|
14414
|
+
toast$1.success("Account found");
|
|
14415
|
+
} catch (error) {
|
|
14416
|
+
toast$1.error("Failed to lookup account");
|
|
14417
|
+
} finally {
|
|
14418
|
+
setIsAccountLoading(false);
|
|
14419
|
+
}
|
|
14217
14420
|
};
|
|
14218
|
-
const
|
|
14219
|
-
|
|
14220
|
-
|
|
14221
|
-
|
|
14222
|
-
|
|
14421
|
+
const mockSearchResults = [
|
|
14422
|
+
{ id: "CP-5678", name: "Global Tech Solutions Inc.", type: "Business", paymentInstrumentType: "wire" },
|
|
14423
|
+
{ id: "CP-1234", name: "Global Industries LLC", type: "Business", paymentInstrumentType: "ach" },
|
|
14424
|
+
{ id: "CP-9012", name: "GlobalCorp Partners", type: "Business", paymentInstrumentType: "both" },
|
|
14425
|
+
{ id: "CP-3456", name: "Acme Corporation", type: "Business", paymentInstrumentType: "wire" },
|
|
14426
|
+
{ id: "CP-7890", name: "Tech Innovations Ltd", type: "Business", paymentInstrumentType: "ach" }
|
|
14427
|
+
];
|
|
14428
|
+
const isCounterpartyCompatible = (instrumentType, transactionType) => {
|
|
14429
|
+
if (instrumentType === "both") return true;
|
|
14430
|
+
if (transactionType === "ach" && instrumentType === "ach") return true;
|
|
14431
|
+
if (transactionType === "wire" && instrumentType === "wire") return true;
|
|
14432
|
+
return false;
|
|
14433
|
+
};
|
|
14434
|
+
const debouncedSearch = useMemo(
|
|
14435
|
+
() => debounce(async (query, txType) => {
|
|
14436
|
+
if (query.length < 2) {
|
|
14437
|
+
setCounterpartySearchResults([]);
|
|
14438
|
+
setShowCounterpartyDropdown(false);
|
|
14439
|
+
return;
|
|
14440
|
+
}
|
|
14441
|
+
setIsCounterpartySearching(true);
|
|
14442
|
+
try {
|
|
14443
|
+
await new Promise((resolve) => setTimeout(resolve, 350));
|
|
14444
|
+
let results = mockSearchResults.filter(
|
|
14445
|
+
(cp) => cp.name.toLowerCase().includes(query.toLowerCase())
|
|
14446
|
+
);
|
|
14447
|
+
if (txType === "ach") {
|
|
14448
|
+
results = results.filter(
|
|
14449
|
+
(cp) => cp.paymentInstrumentType === "ach" || cp.paymentInstrumentType === "both"
|
|
14450
|
+
);
|
|
14451
|
+
} else if (txType === "wire") {
|
|
14452
|
+
results = results.filter(
|
|
14453
|
+
(cp) => cp.paymentInstrumentType === "wire" || cp.paymentInstrumentType === "both"
|
|
14454
|
+
);
|
|
14455
|
+
}
|
|
14456
|
+
setCounterpartySearchResults(results);
|
|
14457
|
+
setShowCounterpartyDropdown(true);
|
|
14458
|
+
} finally {
|
|
14459
|
+
setIsCounterpartySearching(false);
|
|
14460
|
+
}
|
|
14461
|
+
}, 350),
|
|
14462
|
+
[]
|
|
14463
|
+
);
|
|
14464
|
+
useEffect(() => {
|
|
14465
|
+
return () => {
|
|
14466
|
+
debouncedSearch.cancel();
|
|
14467
|
+
};
|
|
14468
|
+
}, [debouncedSearch]);
|
|
14469
|
+
const handleCounterpartySearchChange = (value) => {
|
|
14470
|
+
form.setValue("counterpartyName", value);
|
|
14471
|
+
if (counterpartyLookedUp) {
|
|
14472
|
+
setCounterpartyLookedUp(false);
|
|
14473
|
+
setCounterpartyData(null);
|
|
14223
14474
|
}
|
|
14224
|
-
|
|
14225
|
-
|
|
14226
|
-
|
|
14475
|
+
debouncedSearch(value, form.getValues("transactionType"));
|
|
14476
|
+
};
|
|
14477
|
+
const handleTransactionTypeChange = (newType) => {
|
|
14478
|
+
form.setValue("transactionType", newType);
|
|
14479
|
+
if (counterpartyData && counterpartyLookedUp) {
|
|
14480
|
+
const requiresCounterparty = ["ach", "wire"].includes(newType);
|
|
14481
|
+
if (requiresCounterparty) {
|
|
14482
|
+
const isCompatible = isCounterpartyCompatible(
|
|
14483
|
+
counterpartyData.paymentInstrumentType,
|
|
14484
|
+
newType
|
|
14485
|
+
);
|
|
14486
|
+
if (!isCompatible) {
|
|
14487
|
+
setCounterpartyLookedUp(false);
|
|
14488
|
+
setCounterpartyData(null);
|
|
14489
|
+
setCounterpartySearchResults([]);
|
|
14490
|
+
form.setValue("counterpartyName", "");
|
|
14491
|
+
const typeLabel = newType === "ach" ? "ACH" : "Wire";
|
|
14492
|
+
toast$1.warning(
|
|
14493
|
+
`${counterpartyData.counterpartyName} doesn't support ${typeLabel} transactions. Please select a different counterparty.`
|
|
14494
|
+
);
|
|
14495
|
+
}
|
|
14496
|
+
}
|
|
14497
|
+
}
|
|
14498
|
+
};
|
|
14499
|
+
const handleCounterpartySelect = (result) => {
|
|
14500
|
+
form.setValue("counterpartyName", result.name);
|
|
14501
|
+
setShowCounterpartyDropdown(false);
|
|
14502
|
+
setCounterpartySearchResults([]);
|
|
14503
|
+
setIsCounterpartyLoading(true);
|
|
14504
|
+
setTimeout(() => {
|
|
14505
|
+
setCounterpartyData({
|
|
14506
|
+
counterpartyName: result.name,
|
|
14507
|
+
counterpartyId: result.id,
|
|
14508
|
+
counterpartyType: result.type,
|
|
14509
|
+
status: "Active",
|
|
14510
|
+
taxId: "XX-XXXXXXX",
|
|
14511
|
+
primaryContact: "Contact Name",
|
|
14512
|
+
contactEmail: "contact@example.com",
|
|
14513
|
+
contactPhone: "+1 (555) 123-4567",
|
|
14514
|
+
address: "123 Business Ave, City, ST 12345",
|
|
14515
|
+
paymentInstrumentType: result.paymentInstrumentType
|
|
14516
|
+
});
|
|
14517
|
+
setCounterpartyLookedUp(true);
|
|
14518
|
+
setIsCounterpartyLoading(false);
|
|
14519
|
+
toast$1.success("Counterparty selected");
|
|
14520
|
+
}, 500);
|
|
14227
14521
|
};
|
|
14228
14522
|
const handleEditAccount = () => {
|
|
14229
14523
|
setAccountLookedUp(false);
|
|
@@ -14234,50 +14528,153 @@ function NewTransaction() {
|
|
|
14234
14528
|
form.setValue("counterpartyName", "");
|
|
14235
14529
|
form.setValue("amount", "");
|
|
14236
14530
|
form.setValue("description", "");
|
|
14531
|
+
form.setValue("adjustmentDirection", "");
|
|
14532
|
+
form.setValue("adjustmentType", "");
|
|
14533
|
+
setReceiverAccountLookedUp(false);
|
|
14534
|
+
setReceiverAccountData(null);
|
|
14535
|
+
form.setValue("receiverAccountNumber", "");
|
|
14536
|
+
};
|
|
14537
|
+
const handleReceiverAccountLookup = async () => {
|
|
14538
|
+
const receiverNum = form.getValues("receiverAccountNumber");
|
|
14539
|
+
if (!receiverNum) {
|
|
14540
|
+
toast$1.error("Please enter a receiver account number");
|
|
14541
|
+
return;
|
|
14542
|
+
}
|
|
14543
|
+
setIsReceiverAccountLoading(true);
|
|
14544
|
+
try {
|
|
14545
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
14546
|
+
setReceiverAccountData({
|
|
14547
|
+
accountNumber: "****" + receiverNum.slice(-4),
|
|
14548
|
+
accountName: "Receiver Account",
|
|
14549
|
+
accountType: "Checking",
|
|
14550
|
+
balance: "$45,230.00",
|
|
14551
|
+
customerName: "Receiver Corp",
|
|
14552
|
+
customerId: "CUST-RCV-001",
|
|
14553
|
+
customerType: "Business"
|
|
14554
|
+
});
|
|
14555
|
+
setReceiverAccountLookedUp(true);
|
|
14556
|
+
toast$1.success("Receiver account found");
|
|
14557
|
+
} catch (error) {
|
|
14558
|
+
toast$1.error("Failed to lookup receiver account");
|
|
14559
|
+
} finally {
|
|
14560
|
+
setIsReceiverAccountLoading(false);
|
|
14561
|
+
}
|
|
14562
|
+
};
|
|
14563
|
+
const handleEditReceiverAccount = () => {
|
|
14564
|
+
setReceiverAccountLookedUp(false);
|
|
14565
|
+
setReceiverAccountData(null);
|
|
14566
|
+
form.setValue("receiverAccountNumber", "");
|
|
14237
14567
|
};
|
|
14238
14568
|
const handleEditCounterparty = () => {
|
|
14239
14569
|
setCounterpartyLookedUp(false);
|
|
14240
14570
|
setCounterpartyData(null);
|
|
14571
|
+
setCounterpartySearchResults([]);
|
|
14572
|
+
setShowCounterpartyDropdown(false);
|
|
14573
|
+
form.setValue("counterpartyName", "");
|
|
14241
14574
|
form.setValue("amount", "");
|
|
14242
14575
|
form.setValue("description", "");
|
|
14243
14576
|
};
|
|
14244
|
-
const handleSubmit = () => {
|
|
14577
|
+
const handleSubmit = async () => {
|
|
14245
14578
|
const data = form.getValues();
|
|
14246
|
-
|
|
14579
|
+
const requiresCounterparty = ["ach", "wire"].includes(data.transactionType);
|
|
14580
|
+
if (!data.transactionType || !data.accountNumber || !data.amount) {
|
|
14247
14581
|
toast$1.error("Please complete all required fields");
|
|
14248
14582
|
return;
|
|
14249
14583
|
}
|
|
14250
|
-
if (!
|
|
14251
|
-
toast$1.error("Please lookup
|
|
14584
|
+
if (requiresCounterparty && (!data.counterpartyName || !counterpartyLookedUp)) {
|
|
14585
|
+
toast$1.error("Please lookup counterparty for this transaction type");
|
|
14252
14586
|
return;
|
|
14253
14587
|
}
|
|
14254
|
-
|
|
14255
|
-
|
|
14256
|
-
|
|
14257
|
-
|
|
14258
|
-
|
|
14259
|
-
|
|
14260
|
-
"
|
|
14261
|
-
|
|
14262
|
-
|
|
14263
|
-
|
|
14264
|
-
|
|
14265
|
-
|
|
14266
|
-
|
|
14267
|
-
|
|
14268
|
-
|
|
14588
|
+
if (!accountLookedUp) {
|
|
14589
|
+
toast$1.error("Please lookup account");
|
|
14590
|
+
return;
|
|
14591
|
+
}
|
|
14592
|
+
if (data.transactionType === "adjustment") {
|
|
14593
|
+
if (!data.adjustmentDirection || !data.adjustmentType) {
|
|
14594
|
+
toast$1.error("Please select direction and type for adjustment");
|
|
14595
|
+
return;
|
|
14596
|
+
}
|
|
14597
|
+
}
|
|
14598
|
+
if (data.transactionType === "transfer") {
|
|
14599
|
+
if (!data.receiverAccountNumber || !receiverAccountLookedUp) {
|
|
14600
|
+
toast$1.error("Please lookup receiver account for transfer");
|
|
14601
|
+
return;
|
|
14602
|
+
}
|
|
14603
|
+
}
|
|
14604
|
+
setIsSubmitting(true);
|
|
14605
|
+
try {
|
|
14606
|
+
await new Promise((resolve) => setTimeout(resolve, 1500));
|
|
14607
|
+
const hasError = Math.random() > 0.7;
|
|
14608
|
+
if (hasError) {
|
|
14609
|
+
const errorScenarios = [
|
|
14610
|
+
"Insufficient funds. Current balance: $125,450.00, Required: $" + parseFloat(data.amount).toFixed(2),
|
|
14611
|
+
"Transaction limit exceeded. Daily limit: $50,000.00",
|
|
14612
|
+
"Counterparty account is temporarily unavailable. Please try again later.",
|
|
14613
|
+
"Invalid routing number for the selected transaction type."
|
|
14614
|
+
];
|
|
14615
|
+
setSubmissionStatus("error");
|
|
14616
|
+
setErrorMessage(errorScenarios[Math.floor(Math.random() * errorScenarios.length)]);
|
|
14617
|
+
} else {
|
|
14618
|
+
const txId = "TXN-" + Math.random().toString(36).substr(2, 9).toUpperCase();
|
|
14619
|
+
setTransactionId(txId);
|
|
14620
|
+
setSubmissionStatus("success");
|
|
14621
|
+
}
|
|
14269
14622
|
setConfirmationOpen(true);
|
|
14623
|
+
} finally {
|
|
14624
|
+
setIsSubmitting(false);
|
|
14270
14625
|
}
|
|
14271
14626
|
};
|
|
14627
|
+
const resetForm = () => {
|
|
14628
|
+
form.reset({
|
|
14629
|
+
transactionType: "",
|
|
14630
|
+
accountNumber: "",
|
|
14631
|
+
counterpartyName: "",
|
|
14632
|
+
amount: "",
|
|
14633
|
+
description: "",
|
|
14634
|
+
certifyInformation: false,
|
|
14635
|
+
adjustmentDirection: "",
|
|
14636
|
+
adjustmentType: "",
|
|
14637
|
+
receiverAccountNumber: ""
|
|
14638
|
+
});
|
|
14639
|
+
setAccountLookedUp(false);
|
|
14640
|
+
setAccountData(null);
|
|
14641
|
+
setCounterpartyLookedUp(false);
|
|
14642
|
+
setCounterpartyData(null);
|
|
14643
|
+
setCounterpartySearchResults([]);
|
|
14644
|
+
setShowCounterpartyDropdown(false);
|
|
14645
|
+
setReceiverAccountLookedUp(false);
|
|
14646
|
+
setReceiverAccountData(null);
|
|
14647
|
+
setSubmissionStatus(null);
|
|
14648
|
+
setErrorMessage("");
|
|
14649
|
+
setTransactionId("");
|
|
14650
|
+
};
|
|
14272
14651
|
const handleConfirmationClose = () => {
|
|
14273
14652
|
setConfirmationOpen(false);
|
|
14274
14653
|
if (submissionStatus === "success") {
|
|
14275
|
-
navigate(
|
|
14654
|
+
navigate(`/transactions/${transactionId}`);
|
|
14276
14655
|
}
|
|
14277
14656
|
};
|
|
14657
|
+
const handleNewTransaction = () => {
|
|
14658
|
+
setConfirmationOpen(false);
|
|
14659
|
+
resetForm();
|
|
14660
|
+
};
|
|
14278
14661
|
const handleCancel = () => {
|
|
14279
14662
|
navigate("/dashboard");
|
|
14280
14663
|
};
|
|
14664
|
+
const isReviewReady = useMemo(() => {
|
|
14665
|
+
const data = form.watch();
|
|
14666
|
+
const requiresCounterparty = ["ach", "wire"].includes(data.transactionType);
|
|
14667
|
+
if (!data.transactionType || !data.accountNumber || !data.amount) return false;
|
|
14668
|
+
if (requiresCounterparty && (!data.counterpartyName || !counterpartyLookedUp)) return false;
|
|
14669
|
+
if (!accountLookedUp) return false;
|
|
14670
|
+
if (data.transactionType === "adjustment") {
|
|
14671
|
+
if (!data.adjustmentDirection || !data.adjustmentType) return false;
|
|
14672
|
+
}
|
|
14673
|
+
if (data.transactionType === "transfer") {
|
|
14674
|
+
if (!data.receiverAccountNumber || !receiverAccountLookedUp) return false;
|
|
14675
|
+
}
|
|
14676
|
+
return true;
|
|
14677
|
+
}, [form.watch(), accountLookedUp, counterpartyLookedUp, receiverAccountLookedUp]);
|
|
14281
14678
|
return /* @__PURE__ */ jsx(
|
|
14282
14679
|
NewTransactionView,
|
|
14283
14680
|
{
|
|
@@ -14290,14 +14687,30 @@ function NewTransaction() {
|
|
|
14290
14687
|
submissionStatus,
|
|
14291
14688
|
errorMessage,
|
|
14292
14689
|
transactionId,
|
|
14690
|
+
isAccountLoading,
|
|
14691
|
+
isCounterpartyLoading,
|
|
14692
|
+
isSubmitting,
|
|
14293
14693
|
onAccountLookup: handleAccountLookup,
|
|
14294
|
-
onCounterpartyLookup: handleCounterpartyLookup,
|
|
14295
14694
|
onEditAccount: handleEditAccount,
|
|
14695
|
+
counterpartySearchResults,
|
|
14696
|
+
isCounterpartySearching,
|
|
14697
|
+
showCounterpartyDropdown,
|
|
14698
|
+
onCounterpartySearchChange: handleCounterpartySearchChange,
|
|
14699
|
+
onCounterpartySelect: handleCounterpartySelect,
|
|
14700
|
+
onCounterpartyDropdownClose: () => setShowCounterpartyDropdown(false),
|
|
14296
14701
|
onEditCounterparty: handleEditCounterparty,
|
|
14702
|
+
onTransactionTypeChange: handleTransactionTypeChange,
|
|
14297
14703
|
onSubmit: handleSubmit,
|
|
14298
14704
|
onCancel: handleCancel,
|
|
14299
14705
|
onConfirmationClose: handleConfirmationClose,
|
|
14300
|
-
onConfirmationOpenChange: setConfirmationOpen
|
|
14706
|
+
onConfirmationOpenChange: setConfirmationOpen,
|
|
14707
|
+
onNewTransaction: handleNewTransaction,
|
|
14708
|
+
receiverAccountLookedUp,
|
|
14709
|
+
receiverAccountData,
|
|
14710
|
+
isReceiverAccountLoading,
|
|
14711
|
+
onReceiverAccountLookup: handleReceiverAccountLookup,
|
|
14712
|
+
onEditReceiverAccount: handleEditReceiverAccount,
|
|
14713
|
+
isReviewReady
|
|
14301
14714
|
}
|
|
14302
14715
|
);
|
|
14303
14716
|
}
|
|
@@ -14348,7 +14761,7 @@ var TransactionDetail = () => {
|
|
|
14348
14761
|
return "outline";
|
|
14349
14762
|
}
|
|
14350
14763
|
};
|
|
14351
|
-
const
|
|
14764
|
+
const formatCurrency3 = (value) => {
|
|
14352
14765
|
return new Intl.NumberFormat("en-US", {
|
|
14353
14766
|
style: "currency",
|
|
14354
14767
|
currency: "USD",
|
|
@@ -14364,7 +14777,7 @@ var TransactionDetail = () => {
|
|
|
14364
14777
|
/* @__PURE__ */ jsx("span", { className: cn(
|
|
14365
14778
|
"font-semibold",
|
|
14366
14779
|
transaction.amount < 0 ? "text-destructive" : "text-success"
|
|
14367
|
-
), children:
|
|
14780
|
+
), children: formatCurrency3(transaction.amount) }),
|
|
14368
14781
|
/* @__PURE__ */ jsx(
|
|
14369
14782
|
TransactionTypeBadge,
|
|
14370
14783
|
{
|
|
@@ -14986,11 +15399,11 @@ function CreateVelocityLimit() {
|
|
|
14986
15399
|
case "round_number":
|
|
14987
15400
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
14988
15401
|
/* @__PURE__ */ jsx(
|
|
14989
|
-
|
|
15402
|
+
CurrencyInput,
|
|
14990
15403
|
{
|
|
14991
15404
|
label: "Amount Threshold",
|
|
14992
|
-
|
|
14993
|
-
onChange: (
|
|
15405
|
+
value: formData.amountThreshold || "",
|
|
15406
|
+
onChange: (value) => handleFieldChange("amountThreshold", value)
|
|
14994
15407
|
}
|
|
14995
15408
|
),
|
|
14996
15409
|
/* @__PURE__ */ jsx(
|
|
@@ -15103,11 +15516,11 @@ function CreateVelocityLimit() {
|
|
|
15103
15516
|
}
|
|
15104
15517
|
),
|
|
15105
15518
|
/* @__PURE__ */ jsx(
|
|
15106
|
-
|
|
15519
|
+
CurrencyInput,
|
|
15107
15520
|
{
|
|
15108
15521
|
label: "Max Transaction Amount",
|
|
15109
|
-
|
|
15110
|
-
onChange: (
|
|
15522
|
+
value: formData.maxAmount || "",
|
|
15523
|
+
onChange: (value) => handleFieldChange("maxAmount", value)
|
|
15111
15524
|
}
|
|
15112
15525
|
),
|
|
15113
15526
|
formData.aggregationLevel !== "transaction" && /* @__PURE__ */ jsx(
|
|
@@ -16330,6 +16743,6 @@ function ReconExceptions() {
|
|
|
16330
16743
|
] }) });
|
|
16331
16744
|
}
|
|
16332
16745
|
|
|
16333
|
-
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,
|
|
16746
|
+
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 };
|
|
16334
16747
|
//# sourceMappingURL=index.js.map
|
|
16335
16748
|
//# sourceMappingURL=index.js.map
|