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.cjs
CHANGED
|
@@ -8376,6 +8376,489 @@ var WireDetailsSection = ({ data }) => {
|
|
|
8376
8376
|
) })
|
|
8377
8377
|
] });
|
|
8378
8378
|
};
|
|
8379
|
+
var Checkbox = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
8380
|
+
CheckboxPrimitive__namespace.Root,
|
|
8381
|
+
{
|
|
8382
|
+
ref,
|
|
8383
|
+
className: cn(
|
|
8384
|
+
"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",
|
|
8385
|
+
className
|
|
8386
|
+
),
|
|
8387
|
+
...props,
|
|
8388
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8389
|
+
CheckboxPrimitive__namespace.Indicator,
|
|
8390
|
+
{
|
|
8391
|
+
className: cn("flex items-center justify-center text-current"),
|
|
8392
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-4 w-4" })
|
|
8393
|
+
}
|
|
8394
|
+
)
|
|
8395
|
+
}
|
|
8396
|
+
));
|
|
8397
|
+
Checkbox.displayName = CheckboxPrimitive__namespace.Root.displayName;
|
|
8398
|
+
var TRANSACTION_TYPES = [
|
|
8399
|
+
{ value: "transfer", label: "Transfer", icon: lucideReact.ArrowLeftRight },
|
|
8400
|
+
{ value: "adjustment", label: "Adjustment", icon: lucideReact.Settings },
|
|
8401
|
+
{ value: "ach", label: "ACH", icon: lucideReact.Building2 },
|
|
8402
|
+
{ value: "wire", label: "Wire", icon: lucideReact.Zap }
|
|
8403
|
+
];
|
|
8404
|
+
var ADJUSTMENT_DIRECTION_OPTIONS = [
|
|
8405
|
+
{ value: "debit", label: "Debit" },
|
|
8406
|
+
{ value: "credit", label: "Credit" }
|
|
8407
|
+
];
|
|
8408
|
+
var ADJUSTMENT_TYPE_OPTIONS = [
|
|
8409
|
+
{ value: "collection", label: "Collection" },
|
|
8410
|
+
{ value: "transaction_reversal", label: "Transaction Reversal" },
|
|
8411
|
+
{ value: "transaction_adjustment", label: "Transaction Adjustment" }
|
|
8412
|
+
];
|
|
8413
|
+
var NewTransactionView = ({
|
|
8414
|
+
form,
|
|
8415
|
+
accountLookedUp,
|
|
8416
|
+
accountData,
|
|
8417
|
+
counterpartyLookedUp,
|
|
8418
|
+
counterpartyData,
|
|
8419
|
+
confirmationOpen,
|
|
8420
|
+
submissionStatus,
|
|
8421
|
+
errorMessage,
|
|
8422
|
+
transactionId,
|
|
8423
|
+
isAccountLoading,
|
|
8424
|
+
isCounterpartyLoading,
|
|
8425
|
+
isSubmitting,
|
|
8426
|
+
counterpartySearchResults,
|
|
8427
|
+
isCounterpartySearching,
|
|
8428
|
+
showCounterpartyDropdown,
|
|
8429
|
+
onAccountLookup,
|
|
8430
|
+
onEditAccount,
|
|
8431
|
+
onEditCounterparty,
|
|
8432
|
+
onTransactionTypeChange,
|
|
8433
|
+
onSubmit,
|
|
8434
|
+
onCancel,
|
|
8435
|
+
onConfirmationClose,
|
|
8436
|
+
onConfirmationOpenChange,
|
|
8437
|
+
onCounterpartySearchChange,
|
|
8438
|
+
onCounterpartySelect,
|
|
8439
|
+
onCounterpartyDropdownClose,
|
|
8440
|
+
receiverAccountLookedUp,
|
|
8441
|
+
receiverAccountData,
|
|
8442
|
+
isReceiverAccountLoading,
|
|
8443
|
+
onReceiverAccountLookup,
|
|
8444
|
+
onEditReceiverAccount
|
|
8445
|
+
}) => {
|
|
8446
|
+
const transactionType = form.watch("transactionType");
|
|
8447
|
+
const accountNumber = form.watch("accountNumber");
|
|
8448
|
+
const counterpartyName = form.watch("counterpartyName");
|
|
8449
|
+
const amount = form.watch("amount");
|
|
8450
|
+
const receiverAccountNumber = form.watch("receiverAccountNumber");
|
|
8451
|
+
const adjustmentDirection = form.watch("adjustmentDirection");
|
|
8452
|
+
const adjustmentType = form.watch("adjustmentType");
|
|
8453
|
+
const requiresCounterparty = ["ach", "wire"].includes(transactionType);
|
|
8454
|
+
const isTransfer = transactionType === "transfer";
|
|
8455
|
+
const isAdjustment = transactionType === "adjustment";
|
|
8456
|
+
const accountDataGrid = accountData ? [
|
|
8457
|
+
{
|
|
8458
|
+
title: "Account Information",
|
|
8459
|
+
items: [
|
|
8460
|
+
{ label: "Account Number", value: accountData.accountNumber },
|
|
8461
|
+
{ label: "Account Name", value: accountData.accountName },
|
|
8462
|
+
{ label: "Account Type", value: accountData.accountType },
|
|
8463
|
+
{ label: "Balance", value: accountData.balance },
|
|
8464
|
+
{ label: "Customer Name", value: accountData.customerName },
|
|
8465
|
+
{ label: "Customer ID", value: accountData.customerId }
|
|
8466
|
+
]
|
|
8467
|
+
}
|
|
8468
|
+
] : [];
|
|
8469
|
+
const counterpartyDataGrid = counterpartyData ? [
|
|
8470
|
+
{
|
|
8471
|
+
title: "Counterparty Information",
|
|
8472
|
+
items: [
|
|
8473
|
+
{ label: "Counterparty Name", value: counterpartyData.counterpartyName },
|
|
8474
|
+
{ label: "Counterparty ID", value: counterpartyData.counterpartyId },
|
|
8475
|
+
{ label: "Instrument Type", value: counterpartyData.paymentInstrumentType?.toUpperCase() || "-" },
|
|
8476
|
+
{ label: "Contact Email", value: counterpartyData.contactEmail },
|
|
8477
|
+
{ label: "Contact Phone", value: counterpartyData.contactPhone }
|
|
8478
|
+
]
|
|
8479
|
+
}
|
|
8480
|
+
] : [];
|
|
8481
|
+
const receiverAccountDataGrid = receiverAccountData ? [
|
|
8482
|
+
{
|
|
8483
|
+
title: "Receiver Account Information",
|
|
8484
|
+
items: [
|
|
8485
|
+
{ label: "Account Number", value: receiverAccountData.accountNumber },
|
|
8486
|
+
{ label: "Account Name", value: receiverAccountData.accountName },
|
|
8487
|
+
{ label: "Account Type", value: receiverAccountData.accountType },
|
|
8488
|
+
{ label: "Customer Name", value: receiverAccountData.customerName },
|
|
8489
|
+
{ label: "Customer ID", value: receiverAccountData.customerId }
|
|
8490
|
+
]
|
|
8491
|
+
}
|
|
8492
|
+
] : [];
|
|
8493
|
+
const reviewItems = [
|
|
8494
|
+
{ label: "Transaction Type", value: TRANSACTION_TYPES.find((t) => t.value === transactionType)?.label || "-" },
|
|
8495
|
+
{ label: "Account Number", value: accountNumber || "-" },
|
|
8496
|
+
...isAdjustment ? [
|
|
8497
|
+
{ label: "Direction", value: adjustmentDirection === "debit" ? "Debit" : adjustmentDirection === "credit" ? "Credit" : "-" },
|
|
8498
|
+
{ label: "Adjustment Type", value: ADJUSTMENT_TYPE_OPTIONS.find((t) => t.value === adjustmentType)?.label || "-" }
|
|
8499
|
+
] : [],
|
|
8500
|
+
...isTransfer ? [{ label: "Receiver Account", value: receiverAccountNumber || "-" }] : [],
|
|
8501
|
+
...requiresCounterparty ? [{ label: "Counterparty", value: counterpartyName || "-" }] : [],
|
|
8502
|
+
{ label: "Amount", value: amount ? `$${amount}` : "-" },
|
|
8503
|
+
{ label: "Description", value: form.watch("description") || "N/A" }
|
|
8504
|
+
];
|
|
8505
|
+
const reviewData = [
|
|
8506
|
+
{
|
|
8507
|
+
title: "Transaction Summary",
|
|
8508
|
+
items: reviewItems
|
|
8509
|
+
}
|
|
8510
|
+
];
|
|
8511
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PageLayout, { title: "New Transaction", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-w-4xl mx-auto space-y-6", children: [
|
|
8512
|
+
/* @__PURE__ */ jsxRuntime.jsx(FormProvider, { form, children: /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: (e) => e.preventDefault(), children: [
|
|
8513
|
+
!accountLookedUp ? /* @__PURE__ */ jsxRuntime.jsx(FormCard, { title: "Account Lookup", variant: "default", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3 items-start w-full", children: [
|
|
8514
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8515
|
+
FormInput,
|
|
8516
|
+
{
|
|
8517
|
+
name: "accountNumber",
|
|
8518
|
+
placeholder: "Enter account number"
|
|
8519
|
+
}
|
|
8520
|
+
) }),
|
|
8521
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8522
|
+
Button,
|
|
8523
|
+
{
|
|
8524
|
+
onClick: onAccountLookup,
|
|
8525
|
+
disabled: !accountNumber || isAccountLoading,
|
|
8526
|
+
className: "shrink-0 mt-0 w-48",
|
|
8527
|
+
children: isAccountLoading ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
8528
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 mr-2 animate-spin" }),
|
|
8529
|
+
"Looking up..."
|
|
8530
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
8531
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "h-4 w-4 mr-2" }),
|
|
8532
|
+
"Lookup Account"
|
|
8533
|
+
] })
|
|
8534
|
+
}
|
|
8535
|
+
)
|
|
8536
|
+
] }) }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
8537
|
+
FormCard,
|
|
8538
|
+
{
|
|
8539
|
+
title: "Account Information",
|
|
8540
|
+
variant: "subtle",
|
|
8541
|
+
headerActions: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8542
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle2, { className: "h-5 w-5 text-success" }),
|
|
8543
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "ghost", size: "sm", onClick: onEditAccount, children: [
|
|
8544
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Edit, { className: "h-4 w-4 mr-1" }),
|
|
8545
|
+
"Edit"
|
|
8546
|
+
] })
|
|
8547
|
+
] }),
|
|
8548
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(DataGrid, { data: accountDataGrid, columns: 2 })
|
|
8549
|
+
}
|
|
8550
|
+
),
|
|
8551
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8552
|
+
FormCard,
|
|
8553
|
+
{
|
|
8554
|
+
title: "Transaction Type",
|
|
8555
|
+
variant: "default",
|
|
8556
|
+
className: cn(!accountLookedUp && "opacity-50 pointer-events-none"),
|
|
8557
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-2 lg:grid-cols-4 gap-3 lg:gap-4", children: TRANSACTION_TYPES.map((type) => {
|
|
8558
|
+
const Icon2 = type.icon;
|
|
8559
|
+
const isSelected = transactionType === type.value;
|
|
8560
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8561
|
+
"button",
|
|
8562
|
+
{
|
|
8563
|
+
type: "button",
|
|
8564
|
+
onClick: () => onTransactionTypeChange(type.value),
|
|
8565
|
+
disabled: !accountLookedUp,
|
|
8566
|
+
className: cn(
|
|
8567
|
+
"flex flex-col items-center justify-center p-4 lg:p-3 rounded-lg border-2 transition-all",
|
|
8568
|
+
"hover:border-primary/50 hover:shadow-md",
|
|
8569
|
+
isSelected ? "border-primary bg-primary/5 shadow-sm" : "border-border bg-card"
|
|
8570
|
+
),
|
|
8571
|
+
children: [
|
|
8572
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: cn(
|
|
8573
|
+
"h-6 w-6 lg:h-5 lg:w-5 mb-2",
|
|
8574
|
+
isSelected ? "text-primary" : "text-muted-foreground"
|
|
8575
|
+
) }),
|
|
8576
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(
|
|
8577
|
+
"text-sm font-medium",
|
|
8578
|
+
isSelected ? "text-primary" : "text-foreground"
|
|
8579
|
+
), children: type.label })
|
|
8580
|
+
]
|
|
8581
|
+
},
|
|
8582
|
+
type.value
|
|
8583
|
+
);
|
|
8584
|
+
}) })
|
|
8585
|
+
}
|
|
8586
|
+
),
|
|
8587
|
+
requiresCounterparty && (!counterpartyLookedUp ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8588
|
+
FormCard,
|
|
8589
|
+
{
|
|
8590
|
+
title: "Counterparty Search",
|
|
8591
|
+
variant: "default",
|
|
8592
|
+
className: cn(!transactionType && "opacity-50 pointer-events-none"),
|
|
8593
|
+
children: [
|
|
8594
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
8595
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
8596
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8597
|
+
"input",
|
|
8598
|
+
{
|
|
8599
|
+
type: "text",
|
|
8600
|
+
placeholder: "Start typing to search counterparties...",
|
|
8601
|
+
value: counterpartyName,
|
|
8602
|
+
onChange: (e) => onCounterpartySearchChange(e.target.value),
|
|
8603
|
+
disabled: !transactionType,
|
|
8604
|
+
className: cn(
|
|
8605
|
+
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",
|
|
8606
|
+
"ring-offset-background placeholder:text-muted-foreground",
|
|
8607
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
8608
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
8609
|
+
isCounterpartySearching && "pr-10"
|
|
8610
|
+
)
|
|
8611
|
+
}
|
|
8612
|
+
),
|
|
8613
|
+
isCounterpartySearching && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute right-3 top-1/2 -translate-y-1/2", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 animate-spin text-muted-foreground" }) })
|
|
8614
|
+
] }),
|
|
8615
|
+
showCounterpartyDropdown && counterpartySearchResults.length > 0 && /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsxs(
|
|
8616
|
+
"button",
|
|
8617
|
+
{
|
|
8618
|
+
type: "button",
|
|
8619
|
+
onClick: () => onCounterpartySelect(result),
|
|
8620
|
+
className: "w-full px-3 py-2 text-left hover:bg-accent transition-colors",
|
|
8621
|
+
children: [
|
|
8622
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-medium text-sm", children: result.name }),
|
|
8623
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-muted-foreground", children: result.id })
|
|
8624
|
+
]
|
|
8625
|
+
},
|
|
8626
|
+
result.id
|
|
8627
|
+
)) }),
|
|
8628
|
+
showCounterpartyDropdown && counterpartySearchResults.length === 0 && !isCounterpartySearching && counterpartyName.length >= 2 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute z-50 w-full mt-1 bg-popover border border-border rounded-md shadow-lg p-3", children: /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-muted-foreground", children: [
|
|
8629
|
+
'No counterparties found matching "',
|
|
8630
|
+
counterpartyName,
|
|
8631
|
+
'"'
|
|
8632
|
+
] }) })
|
|
8633
|
+
] }),
|
|
8634
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-2", children: "Type at least 2 characters to search" })
|
|
8635
|
+
]
|
|
8636
|
+
}
|
|
8637
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
8638
|
+
FormCard,
|
|
8639
|
+
{
|
|
8640
|
+
title: "Counterparty Information",
|
|
8641
|
+
variant: "subtle",
|
|
8642
|
+
headerActions: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8643
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle2, { className: "h-5 w-5 text-success" }),
|
|
8644
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "ghost", size: "sm", onClick: onEditCounterparty, children: [
|
|
8645
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Edit, { className: "h-4 w-4 mr-1" }),
|
|
8646
|
+
"Edit"
|
|
8647
|
+
] })
|
|
8648
|
+
] }),
|
|
8649
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(DataGrid, { data: counterpartyDataGrid, columns: 2 })
|
|
8650
|
+
}
|
|
8651
|
+
)),
|
|
8652
|
+
isTransfer && (!receiverAccountLookedUp ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
8653
|
+
FormCard,
|
|
8654
|
+
{
|
|
8655
|
+
title: "Receiver Account",
|
|
8656
|
+
variant: "default",
|
|
8657
|
+
className: cn(!transactionType && "opacity-50 pointer-events-none"),
|
|
8658
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3 items-start w-full", children: [
|
|
8659
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8660
|
+
FormInput,
|
|
8661
|
+
{
|
|
8662
|
+
name: "receiverAccountNumber",
|
|
8663
|
+
placeholder: "Enter receiver account number",
|
|
8664
|
+
disabled: !transactionType
|
|
8665
|
+
}
|
|
8666
|
+
) }),
|
|
8667
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8668
|
+
Button,
|
|
8669
|
+
{
|
|
8670
|
+
onClick: onReceiverAccountLookup,
|
|
8671
|
+
disabled: !receiverAccountNumber || isReceiverAccountLoading,
|
|
8672
|
+
className: "shrink-0 mt-0 w-48",
|
|
8673
|
+
children: isReceiverAccountLoading ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
8674
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 mr-2 animate-spin" }),
|
|
8675
|
+
"Looking up..."
|
|
8676
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
8677
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "h-4 w-4 mr-2" }),
|
|
8678
|
+
"Lookup Receiver"
|
|
8679
|
+
] })
|
|
8680
|
+
}
|
|
8681
|
+
)
|
|
8682
|
+
] })
|
|
8683
|
+
}
|
|
8684
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
8685
|
+
FormCard,
|
|
8686
|
+
{
|
|
8687
|
+
title: "Receiver Account Information",
|
|
8688
|
+
variant: "subtle",
|
|
8689
|
+
headerActions: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
8690
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle2, { className: "h-5 w-5 text-success" }),
|
|
8691
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "ghost", size: "sm", onClick: onEditReceiverAccount, children: [
|
|
8692
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Edit, { className: "h-4 w-4 mr-1" }),
|
|
8693
|
+
"Edit"
|
|
8694
|
+
] })
|
|
8695
|
+
] }),
|
|
8696
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(DataGrid, { data: receiverAccountDataGrid, columns: 2 })
|
|
8697
|
+
}
|
|
8698
|
+
)),
|
|
8699
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8700
|
+
FormCard,
|
|
8701
|
+
{
|
|
8702
|
+
title: "Transaction Details",
|
|
8703
|
+
variant: "default",
|
|
8704
|
+
className: cn(
|
|
8705
|
+
requiresCounterparty ? !counterpartyLookedUp && "opacity-50 pointer-events-none" : isTransfer ? !receiverAccountLookedUp && "opacity-50 pointer-events-none" : !transactionType && "opacity-50 pointer-events-none"
|
|
8706
|
+
),
|
|
8707
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
|
|
8708
|
+
isAdjustment && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
8709
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8710
|
+
FormSelect,
|
|
8711
|
+
{
|
|
8712
|
+
name: "adjustmentDirection",
|
|
8713
|
+
label: "Direction",
|
|
8714
|
+
placeholder: "Select direction",
|
|
8715
|
+
options: ADJUSTMENT_DIRECTION_OPTIONS,
|
|
8716
|
+
disabled: !transactionType
|
|
8717
|
+
}
|
|
8718
|
+
),
|
|
8719
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8720
|
+
FormSelect,
|
|
8721
|
+
{
|
|
8722
|
+
name: "adjustmentType",
|
|
8723
|
+
label: "Adjustment Type",
|
|
8724
|
+
placeholder: "Select type",
|
|
8725
|
+
options: ADJUSTMENT_TYPE_OPTIONS,
|
|
8726
|
+
disabled: !transactionType
|
|
8727
|
+
}
|
|
8728
|
+
)
|
|
8729
|
+
] }),
|
|
8730
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8731
|
+
FormInput,
|
|
8732
|
+
{
|
|
8733
|
+
name: "amount",
|
|
8734
|
+
label: "Amount",
|
|
8735
|
+
placeholder: "0.00",
|
|
8736
|
+
type: "number",
|
|
8737
|
+
disabled: requiresCounterparty ? !counterpartyLookedUp : isTransfer ? !receiverAccountLookedUp : !transactionType
|
|
8738
|
+
}
|
|
8739
|
+
),
|
|
8740
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8741
|
+
FormInput,
|
|
8742
|
+
{
|
|
8743
|
+
name: "description",
|
|
8744
|
+
label: "Description (Optional)",
|
|
8745
|
+
placeholder: "Enter transaction description",
|
|
8746
|
+
disabled: requiresCounterparty ? !counterpartyLookedUp : isTransfer ? !receiverAccountLookedUp : !transactionType
|
|
8747
|
+
}
|
|
8748
|
+
)
|
|
8749
|
+
] })
|
|
8750
|
+
}
|
|
8751
|
+
),
|
|
8752
|
+
/* @__PURE__ */ jsxRuntime.jsx(FormCard, { title: "Review & Submit", variant: "default", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6", children: [
|
|
8753
|
+
/* @__PURE__ */ jsxRuntime.jsx(DataGrid, { data: reviewData, columns: 2 }),
|
|
8754
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-muted/30 rounded-lg p-4 border border-border/50", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8755
|
+
reactHookForm.Controller,
|
|
8756
|
+
{
|
|
8757
|
+
name: "certifyInformation",
|
|
8758
|
+
control: form.control,
|
|
8759
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
8760
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3", children: [
|
|
8761
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8762
|
+
Checkbox,
|
|
8763
|
+
{
|
|
8764
|
+
id: "certifyInformation",
|
|
8765
|
+
checked: field.value,
|
|
8766
|
+
onCheckedChange: field.onChange
|
|
8767
|
+
}
|
|
8768
|
+
),
|
|
8769
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8770
|
+
"label",
|
|
8771
|
+
{
|
|
8772
|
+
htmlFor: "certifyInformation",
|
|
8773
|
+
className: "text-sm font-medium leading-relaxed cursor-pointer select-none",
|
|
8774
|
+
children: "I certify that all information entered is correct and accurate to the best of my knowledge"
|
|
8775
|
+
}
|
|
8776
|
+
)
|
|
8777
|
+
] }),
|
|
8778
|
+
form.formState.errors.certifyInformation && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-destructive ml-7", children: form.formState.errors.certifyInformation.message })
|
|
8779
|
+
] })
|
|
8780
|
+
}
|
|
8781
|
+
) }),
|
|
8782
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3 justify-end pt-4 border-t border-border", children: [
|
|
8783
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { type: "button", variant: "outline", onClick: onCancel, className: "w-32", children: "Cancel" }),
|
|
8784
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8785
|
+
Button,
|
|
8786
|
+
{
|
|
8787
|
+
type: "button",
|
|
8788
|
+
onClick: onSubmit,
|
|
8789
|
+
className: "w-48",
|
|
8790
|
+
disabled: !transactionType || !accountNumber || requiresCounterparty && !counterpartyName || isTransfer && !receiverAccountLookedUp || isAdjustment && (!adjustmentDirection || !adjustmentType) || !amount || !form.watch("certifyInformation") || isSubmitting,
|
|
8791
|
+
children: isSubmitting ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
8792
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 mr-2 animate-spin" }),
|
|
8793
|
+
"Submitting..."
|
|
8794
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
8795
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle2, { className: "h-4 w-4 mr-2" }),
|
|
8796
|
+
"Submit Transaction"
|
|
8797
|
+
] })
|
|
8798
|
+
}
|
|
8799
|
+
)
|
|
8800
|
+
] })
|
|
8801
|
+
] }) })
|
|
8802
|
+
] }) }),
|
|
8803
|
+
/* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: confirmationOpen, onOpenChange: onConfirmationOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "sm:max-w-md", children: [
|
|
8804
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { children: [
|
|
8805
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 mb-2", children: [
|
|
8806
|
+
submissionStatus === "success" ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-12 w-12 rounded-full bg-success/10 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle2, { className: "h-6 w-6 text-success" }) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-12 w-12 rounded-full bg-destructive/10 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XCircle, { className: "h-6 w-6 text-destructive" }) }),
|
|
8807
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { className: "text-xl", children: submissionStatus === "success" ? "Transaction Successful" : "Transaction Failed" })
|
|
8808
|
+
] }),
|
|
8809
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogDescription, { className: "text-left", children: submissionStatus === "success" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 pt-2", children: [
|
|
8810
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-foreground", children: "Your transaction has been successfully submitted and is being processed." }),
|
|
8811
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-muted/50 rounded-lg p-4 space-y-2", children: [
|
|
8812
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between text-sm", children: [
|
|
8813
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Transaction ID:" }),
|
|
8814
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono font-medium", children: transactionId })
|
|
8815
|
+
] }),
|
|
8816
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between text-sm", children: [
|
|
8817
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Amount:" }),
|
|
8818
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-medium", children: [
|
|
8819
|
+
"$",
|
|
8820
|
+
amount
|
|
8821
|
+
] })
|
|
8822
|
+
] }),
|
|
8823
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between text-sm", children: [
|
|
8824
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Type:" }),
|
|
8825
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: TRANSACTION_TYPES.find((t) => t.value === transactionType)?.label })
|
|
8826
|
+
] }),
|
|
8827
|
+
requiresCounterparty && counterpartyName && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between text-sm", children: [
|
|
8828
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Counterparty:" }),
|
|
8829
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: counterpartyName })
|
|
8830
|
+
] })
|
|
8831
|
+
] }),
|
|
8832
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2 p-3 bg-blue-500/10 border border-blue-500/20 rounded-lg", children: [
|
|
8833
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircle, { className: "h-5 w-5 text-blue-500 mt-0.5 flex-shrink-0" }),
|
|
8834
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-blue-700 dark:text-blue-300", children: "You will receive a confirmation email once the transaction is completed." })
|
|
8835
|
+
] })
|
|
8836
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 pt-2", children: [
|
|
8837
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2 p-4 bg-destructive/10 border border-destructive/20 rounded-lg", children: [
|
|
8838
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.XCircle, { className: "h-5 w-5 text-destructive mt-0.5 flex-shrink-0" }),
|
|
8839
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
|
|
8840
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-destructive", children: "Error Processing Transaction" }),
|
|
8841
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: errorMessage })
|
|
8842
|
+
] })
|
|
8843
|
+
] }),
|
|
8844
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "Please review the error message above and try again. If the problem persists, contact support." })
|
|
8845
|
+
] }) })
|
|
8846
|
+
] }),
|
|
8847
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DialogFooter, { className: "sm:justify-end gap-2", children: [
|
|
8848
|
+
submissionStatus === "error" && /* @__PURE__ */ jsxRuntime.jsx(Button, { type: "button", variant: "outline", onClick: () => onConfirmationOpenChange(false), children: "Try Again" }),
|
|
8849
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8850
|
+
Button,
|
|
8851
|
+
{
|
|
8852
|
+
type: "button",
|
|
8853
|
+
onClick: onConfirmationClose,
|
|
8854
|
+
variant: submissionStatus === "success" ? "default" : "outline",
|
|
8855
|
+
children: submissionStatus === "success" ? "View Transactions" : "Close"
|
|
8856
|
+
}
|
|
8857
|
+
)
|
|
8858
|
+
] })
|
|
8859
|
+
] }) })
|
|
8860
|
+
] }) });
|
|
8861
|
+
};
|
|
8379
8862
|
var typeIcons = {
|
|
8380
8863
|
checking: lucideReact.CreditCard,
|
|
8381
8864
|
savings: lucideReact.Building,
|
|
@@ -8450,25 +8933,6 @@ var BusinessTypeBadge = ({ type, className }) => {
|
|
|
8450
8933
|
config.label
|
|
8451
8934
|
] });
|
|
8452
8935
|
};
|
|
8453
|
-
var Checkbox = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
8454
|
-
CheckboxPrimitive__namespace.Root,
|
|
8455
|
-
{
|
|
8456
|
-
ref,
|
|
8457
|
-
className: cn(
|
|
8458
|
-
"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",
|
|
8459
|
-
className
|
|
8460
|
-
),
|
|
8461
|
-
...props,
|
|
8462
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8463
|
-
CheckboxPrimitive__namespace.Indicator,
|
|
8464
|
-
{
|
|
8465
|
-
className: cn("flex items-center justify-center text-current"),
|
|
8466
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-4 w-4" })
|
|
8467
|
-
}
|
|
8468
|
-
)
|
|
8469
|
-
}
|
|
8470
|
-
));
|
|
8471
|
-
Checkbox.displayName = CheckboxPrimitive__namespace.Root.displayName;
|
|
8472
8936
|
var DetailPageLayout = ({
|
|
8473
8937
|
title,
|
|
8474
8938
|
description,
|
|
@@ -13842,30 +14306,43 @@ var TransactionHistory_default = TransactionHistory;
|
|
|
13842
14306
|
var newTransactionSchema = zod.z.object({
|
|
13843
14307
|
transactionType: zod.z.string().min(1, "Transaction type is required"),
|
|
13844
14308
|
accountNumber: zod.z.string().min(1, "Account number is required"),
|
|
13845
|
-
counterpartyName: zod.z.string().
|
|
14309
|
+
counterpartyName: zod.z.string().optional(),
|
|
13846
14310
|
amount: zod.z.string().min(1, "Amount is required"),
|
|
13847
|
-
currency: zod.z.string().min(1, "Currency is required"),
|
|
13848
14311
|
description: zod.z.string().optional(),
|
|
13849
14312
|
certifyInformation: zod.z.boolean().refine((val) => val === true, {
|
|
13850
14313
|
message: "You must certify the information is correct"
|
|
13851
|
-
})
|
|
14314
|
+
}),
|
|
14315
|
+
// Adjustment-specific fields
|
|
14316
|
+
adjustmentDirection: zod.z.string().optional(),
|
|
14317
|
+
adjustmentType: zod.z.string().optional(),
|
|
14318
|
+
// Transfer-specific fields
|
|
14319
|
+
receiverAccountNumber: zod.z.string().optional()
|
|
14320
|
+
}).refine((data) => {
|
|
14321
|
+
const requiresCounterparty = ["ach", "wire"].includes(data.transactionType);
|
|
14322
|
+
if (requiresCounterparty && !data.counterpartyName) {
|
|
14323
|
+
return false;
|
|
14324
|
+
}
|
|
14325
|
+
return true;
|
|
14326
|
+
}, {
|
|
14327
|
+
message: "Counterparty is required for ACH and Wire transactions",
|
|
14328
|
+
path: ["counterpartyName"]
|
|
14329
|
+
}).refine((data) => {
|
|
14330
|
+
if (data.transactionType === "adjustment") {
|
|
14331
|
+
if (!data.adjustmentDirection || !data.adjustmentType) return false;
|
|
14332
|
+
}
|
|
14333
|
+
return true;
|
|
14334
|
+
}, {
|
|
14335
|
+
message: "Direction and Type are required for Adjustment transactions",
|
|
14336
|
+
path: ["adjustmentDirection"]
|
|
14337
|
+
}).refine((data) => {
|
|
14338
|
+
if (data.transactionType === "transfer") {
|
|
14339
|
+
if (!data.receiverAccountNumber) return false;
|
|
14340
|
+
}
|
|
14341
|
+
return true;
|
|
14342
|
+
}, {
|
|
14343
|
+
message: "Receiver account number is required for Transfer transactions",
|
|
14344
|
+
path: ["receiverAccountNumber"]
|
|
13852
14345
|
});
|
|
13853
|
-
var TRANSACTION_TYPES = [
|
|
13854
|
-
{ value: "transfer", label: "Transfer", icon: lucideReact.ArrowLeftRight },
|
|
13855
|
-
{ value: "adjustment", label: "Adjustment", icon: lucideReact.Settings },
|
|
13856
|
-
{ value: "ach", label: "ACH", icon: lucideReact.Building2 },
|
|
13857
|
-
{ value: "wire", label: "Wire", icon: lucideReact.Zap }
|
|
13858
|
-
];
|
|
13859
|
-
var CURRENCY_OPTIONS = [
|
|
13860
|
-
{ value: "USD", label: "USD - US Dollar" },
|
|
13861
|
-
{ value: "EUR", label: "EUR - Euro" },
|
|
13862
|
-
{ value: "GBP", label: "GBP - British Pound" },
|
|
13863
|
-
{ value: "JPY", label: "JPY - Japanese Yen" },
|
|
13864
|
-
{ value: "CAD", label: "CAD - Canadian Dollar" },
|
|
13865
|
-
{ value: "AUD", label: "AUD - Australian Dollar" },
|
|
13866
|
-
{ value: "CHF", label: "CHF - Swiss Franc" },
|
|
13867
|
-
{ value: "CNY", label: "CNY - Chinese Yuan" }
|
|
13868
|
-
];
|
|
13869
14346
|
var mockAccountData = {
|
|
13870
14347
|
accountNumber: "****1234",
|
|
13871
14348
|
accountName: "Business Checking",
|
|
@@ -13875,27 +14352,25 @@ var mockAccountData = {
|
|
|
13875
14352
|
customerId: "CUST-001",
|
|
13876
14353
|
customerType: "Business"
|
|
13877
14354
|
};
|
|
13878
|
-
var mockCounterpartyData = {
|
|
13879
|
-
counterpartyName: "Global Tech Solutions Inc.",
|
|
13880
|
-
counterpartyId: "CP-5678",
|
|
13881
|
-
counterpartyType: "Business",
|
|
13882
|
-
status: "Active",
|
|
13883
|
-
taxId: "98-7654321",
|
|
13884
|
-
primaryContact: "Sarah Johnson",
|
|
13885
|
-
contactEmail: "sarah.johnson@globaltech.com",
|
|
13886
|
-
contactPhone: "+1 (555) 987-6543",
|
|
13887
|
-
address: "456 Innovation Drive, San Francisco, CA 94105"
|
|
13888
|
-
};
|
|
13889
14355
|
function NewTransaction() {
|
|
13890
14356
|
const navigate = reactRouterDom.useNavigate();
|
|
13891
14357
|
const [accountLookedUp, setAccountLookedUp] = React15.useState(false);
|
|
13892
14358
|
const [accountData, setAccountData] = React15.useState(null);
|
|
13893
14359
|
const [counterpartyLookedUp, setCounterpartyLookedUp] = React15.useState(false);
|
|
13894
14360
|
const [counterpartyData, setCounterpartyData] = React15.useState(null);
|
|
14361
|
+
const [counterpartySearchResults, setCounterpartySearchResults] = React15.useState([]);
|
|
14362
|
+
const [isCounterpartySearching, setIsCounterpartySearching] = React15.useState(false);
|
|
14363
|
+
const [showCounterpartyDropdown, setShowCounterpartyDropdown] = React15.useState(false);
|
|
13895
14364
|
const [confirmationOpen, setConfirmationOpen] = React15.useState(false);
|
|
13896
14365
|
const [submissionStatus, setSubmissionStatus] = React15.useState(null);
|
|
13897
14366
|
const [errorMessage, setErrorMessage] = React15.useState("");
|
|
13898
14367
|
const [transactionId, setTransactionId] = React15.useState("");
|
|
14368
|
+
const [isAccountLoading, setIsAccountLoading] = React15.useState(false);
|
|
14369
|
+
const [isCounterpartyLoading, setIsCounterpartyLoading] = React15.useState(false);
|
|
14370
|
+
const [isSubmitting, setIsSubmitting] = React15.useState(false);
|
|
14371
|
+
const [receiverAccountLookedUp, setReceiverAccountLookedUp] = React15.useState(false);
|
|
14372
|
+
const [receiverAccountData, setReceiverAccountData] = React15.useState(null);
|
|
14373
|
+
const [isReceiverAccountLoading, setIsReceiverAccountLoading] = React15.useState(false);
|
|
13899
14374
|
const form = reactHookForm.useForm({
|
|
13900
14375
|
resolver: zod$1.zodResolver(newTransactionSchema),
|
|
13901
14376
|
defaultValues: {
|
|
@@ -13903,34 +14378,131 @@ function NewTransaction() {
|
|
|
13903
14378
|
accountNumber: "",
|
|
13904
14379
|
counterpartyName: "",
|
|
13905
14380
|
amount: "",
|
|
13906
|
-
currency: "USD",
|
|
13907
14381
|
description: "",
|
|
13908
|
-
certifyInformation: false
|
|
14382
|
+
certifyInformation: false,
|
|
14383
|
+
adjustmentDirection: "",
|
|
14384
|
+
adjustmentType: "",
|
|
14385
|
+
receiverAccountNumber: ""
|
|
13909
14386
|
}
|
|
13910
14387
|
});
|
|
13911
|
-
const
|
|
13912
|
-
const accountNumber = form.watch("accountNumber");
|
|
13913
|
-
const counterpartyName = form.watch("counterpartyName");
|
|
13914
|
-
const amount = form.watch("amount");
|
|
13915
|
-
const handleAccountLookup = () => {
|
|
14388
|
+
const handleAccountLookup = async () => {
|
|
13916
14389
|
const accNum = form.getValues("accountNumber");
|
|
13917
14390
|
if (!accNum) {
|
|
13918
14391
|
sonner.toast.error("Please enter an account number");
|
|
13919
14392
|
return;
|
|
13920
14393
|
}
|
|
13921
|
-
|
|
13922
|
-
|
|
13923
|
-
|
|
14394
|
+
setIsAccountLoading(true);
|
|
14395
|
+
try {
|
|
14396
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
14397
|
+
setAccountData(mockAccountData);
|
|
14398
|
+
setAccountLookedUp(true);
|
|
14399
|
+
sonner.toast.success("Account found");
|
|
14400
|
+
} catch (error) {
|
|
14401
|
+
sonner.toast.error("Failed to lookup account");
|
|
14402
|
+
} finally {
|
|
14403
|
+
setIsAccountLoading(false);
|
|
14404
|
+
}
|
|
13924
14405
|
};
|
|
13925
|
-
const
|
|
13926
|
-
|
|
13927
|
-
|
|
13928
|
-
|
|
13929
|
-
|
|
14406
|
+
const mockSearchResults = [
|
|
14407
|
+
{ id: "CP-5678", name: "Global Tech Solutions Inc.", type: "Business", paymentInstrumentType: "wire" },
|
|
14408
|
+
{ id: "CP-1234", name: "Global Industries LLC", type: "Business", paymentInstrumentType: "ach" },
|
|
14409
|
+
{ id: "CP-9012", name: "GlobalCorp Partners", type: "Business", paymentInstrumentType: "both" },
|
|
14410
|
+
{ id: "CP-3456", name: "Acme Corporation", type: "Business", paymentInstrumentType: "wire" },
|
|
14411
|
+
{ id: "CP-7890", name: "Tech Innovations Ltd", type: "Business", paymentInstrumentType: "ach" }
|
|
14412
|
+
];
|
|
14413
|
+
const isCounterpartyCompatible = (instrumentType, transactionType) => {
|
|
14414
|
+
if (instrumentType === "both") return true;
|
|
14415
|
+
if (transactionType === "ach" && instrumentType === "ach") return true;
|
|
14416
|
+
if (transactionType === "wire" && instrumentType === "wire") return true;
|
|
14417
|
+
return false;
|
|
14418
|
+
};
|
|
14419
|
+
const debouncedSearch = React15.useMemo(
|
|
14420
|
+
() => lodash.debounce(async (query, txType) => {
|
|
14421
|
+
if (query.length < 2) {
|
|
14422
|
+
setCounterpartySearchResults([]);
|
|
14423
|
+
setShowCounterpartyDropdown(false);
|
|
14424
|
+
return;
|
|
14425
|
+
}
|
|
14426
|
+
setIsCounterpartySearching(true);
|
|
14427
|
+
try {
|
|
14428
|
+
await new Promise((resolve) => setTimeout(resolve, 350));
|
|
14429
|
+
let results = mockSearchResults.filter(
|
|
14430
|
+
(cp) => cp.name.toLowerCase().includes(query.toLowerCase())
|
|
14431
|
+
);
|
|
14432
|
+
if (txType === "ach") {
|
|
14433
|
+
results = results.filter(
|
|
14434
|
+
(cp) => cp.paymentInstrumentType === "ach" || cp.paymentInstrumentType === "both"
|
|
14435
|
+
);
|
|
14436
|
+
} else if (txType === "wire") {
|
|
14437
|
+
results = results.filter(
|
|
14438
|
+
(cp) => cp.paymentInstrumentType === "wire" || cp.paymentInstrumentType === "both"
|
|
14439
|
+
);
|
|
14440
|
+
}
|
|
14441
|
+
setCounterpartySearchResults(results);
|
|
14442
|
+
setShowCounterpartyDropdown(true);
|
|
14443
|
+
} finally {
|
|
14444
|
+
setIsCounterpartySearching(false);
|
|
14445
|
+
}
|
|
14446
|
+
}, 350),
|
|
14447
|
+
[]
|
|
14448
|
+
);
|
|
14449
|
+
React15.useEffect(() => {
|
|
14450
|
+
return () => {
|
|
14451
|
+
debouncedSearch.cancel();
|
|
14452
|
+
};
|
|
14453
|
+
}, [debouncedSearch]);
|
|
14454
|
+
const handleCounterpartySearchChange = (value) => {
|
|
14455
|
+
form.setValue("counterpartyName", value);
|
|
14456
|
+
if (counterpartyLookedUp) {
|
|
14457
|
+
setCounterpartyLookedUp(false);
|
|
14458
|
+
setCounterpartyData(null);
|
|
14459
|
+
}
|
|
14460
|
+
debouncedSearch(value, form.getValues("transactionType"));
|
|
14461
|
+
};
|
|
14462
|
+
const handleTransactionTypeChange = (newType) => {
|
|
14463
|
+
form.setValue("transactionType", newType);
|
|
14464
|
+
if (counterpartyData && counterpartyLookedUp) {
|
|
14465
|
+
const requiresCounterparty = ["ach", "wire"].includes(newType);
|
|
14466
|
+
if (requiresCounterparty) {
|
|
14467
|
+
const isCompatible = isCounterpartyCompatible(
|
|
14468
|
+
counterpartyData.paymentInstrumentType,
|
|
14469
|
+
newType
|
|
14470
|
+
);
|
|
14471
|
+
if (!isCompatible) {
|
|
14472
|
+
setCounterpartyLookedUp(false);
|
|
14473
|
+
setCounterpartyData(null);
|
|
14474
|
+
setCounterpartySearchResults([]);
|
|
14475
|
+
form.setValue("counterpartyName", "");
|
|
14476
|
+
const typeLabel = newType === "ach" ? "ACH" : "Wire";
|
|
14477
|
+
sonner.toast.warning(
|
|
14478
|
+
`${counterpartyData.counterpartyName} doesn't support ${typeLabel} transactions. Please select a different counterparty.`
|
|
14479
|
+
);
|
|
14480
|
+
}
|
|
14481
|
+
}
|
|
13930
14482
|
}
|
|
13931
|
-
|
|
13932
|
-
|
|
13933
|
-
|
|
14483
|
+
};
|
|
14484
|
+
const handleCounterpartySelect = (result) => {
|
|
14485
|
+
form.setValue("counterpartyName", result.name);
|
|
14486
|
+
setShowCounterpartyDropdown(false);
|
|
14487
|
+
setCounterpartySearchResults([]);
|
|
14488
|
+
setIsCounterpartyLoading(true);
|
|
14489
|
+
setTimeout(() => {
|
|
14490
|
+
setCounterpartyData({
|
|
14491
|
+
counterpartyName: result.name,
|
|
14492
|
+
counterpartyId: result.id,
|
|
14493
|
+
counterpartyType: result.type,
|
|
14494
|
+
status: "Active",
|
|
14495
|
+
taxId: "XX-XXXXXXX",
|
|
14496
|
+
primaryContact: "Contact Name",
|
|
14497
|
+
contactEmail: "contact@example.com",
|
|
14498
|
+
contactPhone: "+1 (555) 123-4567",
|
|
14499
|
+
address: "123 Business Ave, City, ST 12345",
|
|
14500
|
+
paymentInstrumentType: result.paymentInstrumentType
|
|
14501
|
+
});
|
|
14502
|
+
setCounterpartyLookedUp(true);
|
|
14503
|
+
setIsCounterpartyLoading(false);
|
|
14504
|
+
sonner.toast.success("Counterparty selected");
|
|
14505
|
+
}, 500);
|
|
13934
14506
|
};
|
|
13935
14507
|
const handleEditAccount = () => {
|
|
13936
14508
|
setAccountLookedUp(false);
|
|
@@ -13941,40 +14513,100 @@ function NewTransaction() {
|
|
|
13941
14513
|
form.setValue("counterpartyName", "");
|
|
13942
14514
|
form.setValue("amount", "");
|
|
13943
14515
|
form.setValue("description", "");
|
|
14516
|
+
form.setValue("adjustmentDirection", "");
|
|
14517
|
+
form.setValue("adjustmentType", "");
|
|
14518
|
+
setReceiverAccountLookedUp(false);
|
|
14519
|
+
setReceiverAccountData(null);
|
|
14520
|
+
form.setValue("receiverAccountNumber", "");
|
|
14521
|
+
};
|
|
14522
|
+
const handleReceiverAccountLookup = async () => {
|
|
14523
|
+
const receiverNum = form.getValues("receiverAccountNumber");
|
|
14524
|
+
if (!receiverNum) {
|
|
14525
|
+
sonner.toast.error("Please enter a receiver account number");
|
|
14526
|
+
return;
|
|
14527
|
+
}
|
|
14528
|
+
setIsReceiverAccountLoading(true);
|
|
14529
|
+
try {
|
|
14530
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
14531
|
+
setReceiverAccountData({
|
|
14532
|
+
accountNumber: "****" + receiverNum.slice(-4),
|
|
14533
|
+
accountName: "Receiver Account",
|
|
14534
|
+
accountType: "Checking",
|
|
14535
|
+
balance: "$45,230.00",
|
|
14536
|
+
customerName: "Receiver Corp",
|
|
14537
|
+
customerId: "CUST-RCV-001",
|
|
14538
|
+
customerType: "Business"
|
|
14539
|
+
});
|
|
14540
|
+
setReceiverAccountLookedUp(true);
|
|
14541
|
+
sonner.toast.success("Receiver account found");
|
|
14542
|
+
} catch (error) {
|
|
14543
|
+
sonner.toast.error("Failed to lookup receiver account");
|
|
14544
|
+
} finally {
|
|
14545
|
+
setIsReceiverAccountLoading(false);
|
|
14546
|
+
}
|
|
14547
|
+
};
|
|
14548
|
+
const handleEditReceiverAccount = () => {
|
|
14549
|
+
setReceiverAccountLookedUp(false);
|
|
14550
|
+
setReceiverAccountData(null);
|
|
14551
|
+
form.setValue("receiverAccountNumber", "");
|
|
13944
14552
|
};
|
|
13945
14553
|
const handleEditCounterparty = () => {
|
|
13946
14554
|
setCounterpartyLookedUp(false);
|
|
13947
14555
|
setCounterpartyData(null);
|
|
14556
|
+
setCounterpartySearchResults([]);
|
|
14557
|
+
setShowCounterpartyDropdown(false);
|
|
14558
|
+
form.setValue("counterpartyName", "");
|
|
13948
14559
|
form.setValue("amount", "");
|
|
13949
14560
|
form.setValue("description", "");
|
|
13950
14561
|
};
|
|
13951
|
-
const handleSubmit = () => {
|
|
14562
|
+
const handleSubmit = async () => {
|
|
13952
14563
|
const data = form.getValues();
|
|
13953
|
-
|
|
14564
|
+
const requiresCounterparty = ["ach", "wire"].includes(data.transactionType);
|
|
14565
|
+
if (!data.transactionType || !data.accountNumber || !data.amount) {
|
|
13954
14566
|
sonner.toast.error("Please complete all required fields");
|
|
13955
14567
|
return;
|
|
13956
14568
|
}
|
|
13957
|
-
if (!
|
|
13958
|
-
sonner.toast.error("Please lookup
|
|
14569
|
+
if (requiresCounterparty && (!data.counterpartyName || !counterpartyLookedUp)) {
|
|
14570
|
+
sonner.toast.error("Please lookup counterparty for this transaction type");
|
|
13959
14571
|
return;
|
|
13960
14572
|
}
|
|
13961
|
-
|
|
13962
|
-
|
|
13963
|
-
|
|
13964
|
-
|
|
13965
|
-
|
|
13966
|
-
|
|
13967
|
-
"
|
|
13968
|
-
|
|
13969
|
-
|
|
13970
|
-
|
|
13971
|
-
|
|
13972
|
-
|
|
13973
|
-
|
|
13974
|
-
|
|
13975
|
-
|
|
13976
|
-
|
|
14573
|
+
if (!accountLookedUp) {
|
|
14574
|
+
sonner.toast.error("Please lookup account");
|
|
14575
|
+
return;
|
|
14576
|
+
}
|
|
14577
|
+
if (data.transactionType === "adjustment") {
|
|
14578
|
+
if (!data.adjustmentDirection || !data.adjustmentType) {
|
|
14579
|
+
sonner.toast.error("Please select direction and type for adjustment");
|
|
14580
|
+
return;
|
|
14581
|
+
}
|
|
14582
|
+
}
|
|
14583
|
+
if (data.transactionType === "transfer") {
|
|
14584
|
+
if (!data.receiverAccountNumber || !receiverAccountLookedUp) {
|
|
14585
|
+
sonner.toast.error("Please lookup receiver account for transfer");
|
|
14586
|
+
return;
|
|
14587
|
+
}
|
|
14588
|
+
}
|
|
14589
|
+
setIsSubmitting(true);
|
|
14590
|
+
try {
|
|
14591
|
+
await new Promise((resolve) => setTimeout(resolve, 1500));
|
|
14592
|
+
const hasError = Math.random() > 0.7;
|
|
14593
|
+
if (hasError) {
|
|
14594
|
+
const errorScenarios = [
|
|
14595
|
+
"Insufficient funds. Current balance: $125,450.00, Required: $" + parseFloat(data.amount).toFixed(2),
|
|
14596
|
+
"Transaction limit exceeded. Daily limit: $50,000.00",
|
|
14597
|
+
"Counterparty account is temporarily unavailable. Please try again later.",
|
|
14598
|
+
"Invalid routing number for the selected transaction type."
|
|
14599
|
+
];
|
|
14600
|
+
setSubmissionStatus("error");
|
|
14601
|
+
setErrorMessage(errorScenarios[Math.floor(Math.random() * errorScenarios.length)]);
|
|
14602
|
+
} else {
|
|
14603
|
+
const txId = "TXN-" + Math.random().toString(36).substr(2, 9).toUpperCase();
|
|
14604
|
+
setTransactionId(txId);
|
|
14605
|
+
setSubmissionStatus("success");
|
|
14606
|
+
}
|
|
13977
14607
|
setConfirmationOpen(true);
|
|
14608
|
+
} finally {
|
|
14609
|
+
setIsSubmitting(false);
|
|
13978
14610
|
}
|
|
13979
14611
|
};
|
|
13980
14612
|
const handleConfirmationClose = () => {
|
|
@@ -13986,368 +14618,40 @@ function NewTransaction() {
|
|
|
13986
14618
|
const handleCancel = () => {
|
|
13987
14619
|
navigate("/dashboard");
|
|
13988
14620
|
};
|
|
13989
|
-
const accountDataGrid = accountData ? [
|
|
13990
|
-
{
|
|
13991
|
-
title: "Account Information",
|
|
13992
|
-
items: [
|
|
13993
|
-
{ label: "Account Number", value: accountData.accountNumber },
|
|
13994
|
-
{ label: "Account Name", value: accountData.accountName },
|
|
13995
|
-
{ label: "Account Type", value: accountData.accountType },
|
|
13996
|
-
{ label: "Balance", value: accountData.balance },
|
|
13997
|
-
{ label: "Customer Name", value: accountData.customerName },
|
|
13998
|
-
{ label: "Customer ID", value: accountData.customerId }
|
|
13999
|
-
]
|
|
14000
|
-
}
|
|
14001
|
-
] : [];
|
|
14002
|
-
const counterpartyDataGrid = counterpartyData ? [
|
|
14003
|
-
{
|
|
14004
|
-
title: "Counterparty Information",
|
|
14005
|
-
items: [
|
|
14006
|
-
{ label: "Counterparty Name", value: counterpartyData.counterpartyName },
|
|
14007
|
-
{ label: "Counterparty ID", value: counterpartyData.counterpartyId },
|
|
14008
|
-
{ label: "Type", value: counterpartyData.counterpartyType },
|
|
14009
|
-
{ label: "Status", value: counterpartyData.status },
|
|
14010
|
-
{ label: "Tax ID", value: counterpartyData.taxId },
|
|
14011
|
-
{ label: "Primary Contact", value: counterpartyData.primaryContact },
|
|
14012
|
-
{ label: "Contact Email", value: counterpartyData.contactEmail },
|
|
14013
|
-
{ label: "Contact Phone", value: counterpartyData.contactPhone },
|
|
14014
|
-
{ label: "Address", value: counterpartyData.address }
|
|
14015
|
-
]
|
|
14016
|
-
}
|
|
14017
|
-
] : [];
|
|
14018
|
-
const reviewData = [
|
|
14019
|
-
{
|
|
14020
|
-
title: "Transaction Summary",
|
|
14021
|
-
items: [
|
|
14022
|
-
{ label: "Transaction Type", value: TRANSACTION_TYPES.find((t) => t.value === transactionType)?.label || "-" },
|
|
14023
|
-
{ label: "Account Number", value: accountNumber || "-" },
|
|
14024
|
-
{ label: "Counterparty", value: counterpartyName || "-" },
|
|
14025
|
-
{ label: "Amount", value: amount ? `$${amount}` : "-" },
|
|
14026
|
-
{ label: "Description", value: form.watch("description") || "N/A" }
|
|
14027
|
-
]
|
|
14028
|
-
}
|
|
14029
|
-
];
|
|
14030
14621
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14031
|
-
|
|
14622
|
+
NewTransactionView,
|
|
14032
14623
|
{
|
|
14033
|
-
|
|
14034
|
-
|
|
14035
|
-
|
|
14036
|
-
|
|
14037
|
-
|
|
14038
|
-
|
|
14039
|
-
|
|
14040
|
-
|
|
14041
|
-
|
|
14042
|
-
|
|
14043
|
-
|
|
14044
|
-
|
|
14045
|
-
|
|
14046
|
-
|
|
14047
|
-
|
|
14048
|
-
|
|
14049
|
-
|
|
14050
|
-
|
|
14051
|
-
|
|
14052
|
-
|
|
14053
|
-
|
|
14054
|
-
|
|
14055
|
-
|
|
14056
|
-
|
|
14057
|
-
|
|
14058
|
-
|
|
14059
|
-
|
|
14060
|
-
|
|
14061
|
-
|
|
14062
|
-
|
|
14063
|
-
|
|
14064
|
-
/* Account Information (Read-only) */
|
|
14065
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14066
|
-
FormCard,
|
|
14067
|
-
{
|
|
14068
|
-
title: "Account Information",
|
|
14069
|
-
variant: "subtle",
|
|
14070
|
-
headerActions: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
14071
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle2, { className: "h-5 w-5 text-success" }),
|
|
14072
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
14073
|
-
Button,
|
|
14074
|
-
{
|
|
14075
|
-
variant: "ghost",
|
|
14076
|
-
size: "sm",
|
|
14077
|
-
onClick: handleEditAccount,
|
|
14078
|
-
children: [
|
|
14079
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Edit, { className: "h-4 w-4 mr-1" }),
|
|
14080
|
-
"Edit"
|
|
14081
|
-
]
|
|
14082
|
-
}
|
|
14083
|
-
)
|
|
14084
|
-
] }),
|
|
14085
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(DataGrid, { data: accountDataGrid, columns: 2 })
|
|
14086
|
-
}
|
|
14087
|
-
)
|
|
14088
|
-
),
|
|
14089
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14090
|
-
FormCard,
|
|
14091
|
-
{
|
|
14092
|
-
title: "Transaction Type",
|
|
14093
|
-
variant: "default",
|
|
14094
|
-
className: cn(!accountLookedUp && "opacity-50 pointer-events-none"),
|
|
14095
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-2 lg:grid-cols-4 gap-3 lg:gap-4", children: TRANSACTION_TYPES.map((type) => {
|
|
14096
|
-
const Icon2 = type.icon;
|
|
14097
|
-
const isSelected = transactionType === type.value;
|
|
14098
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
14099
|
-
"button",
|
|
14100
|
-
{
|
|
14101
|
-
type: "button",
|
|
14102
|
-
onClick: () => form.setValue("transactionType", type.value),
|
|
14103
|
-
disabled: !accountLookedUp,
|
|
14104
|
-
className: cn(
|
|
14105
|
-
"flex flex-col items-center justify-center p-4 lg:p-3 rounded-lg border-2 transition-all",
|
|
14106
|
-
"hover:border-primary/50 hover:shadow-md",
|
|
14107
|
-
isSelected ? "border-primary bg-primary/5 shadow-sm" : "border-border bg-card"
|
|
14108
|
-
),
|
|
14109
|
-
children: [
|
|
14110
|
-
/* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: cn(
|
|
14111
|
-
"h-6 w-6 lg:h-5 lg:w-5 mb-2",
|
|
14112
|
-
isSelected ? "text-primary" : "text-muted-foreground"
|
|
14113
|
-
) }),
|
|
14114
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(
|
|
14115
|
-
"text-sm font-medium",
|
|
14116
|
-
isSelected ? "text-primary" : "text-foreground"
|
|
14117
|
-
), children: type.label })
|
|
14118
|
-
]
|
|
14119
|
-
},
|
|
14120
|
-
type.value
|
|
14121
|
-
);
|
|
14122
|
-
}) })
|
|
14123
|
-
}
|
|
14124
|
-
),
|
|
14125
|
-
!counterpartyLookedUp ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
14126
|
-
FormCard,
|
|
14127
|
-
{
|
|
14128
|
-
title: "Counterparty Lookup",
|
|
14129
|
-
variant: "default",
|
|
14130
|
-
className: cn(!transactionType && "opacity-50 pointer-events-none"),
|
|
14131
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3 items-start w-full", children: [
|
|
14132
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
14133
|
-
FormInput,
|
|
14134
|
-
{
|
|
14135
|
-
name: "counterpartyName",
|
|
14136
|
-
placeholder: "Enter counterparty name",
|
|
14137
|
-
disabled: !transactionType
|
|
14138
|
-
}
|
|
14139
|
-
) }),
|
|
14140
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
14141
|
-
Button,
|
|
14142
|
-
{
|
|
14143
|
-
onClick: handleCounterpartyLookup,
|
|
14144
|
-
disabled: !transactionType || !counterpartyName,
|
|
14145
|
-
className: "shrink-0 mt-0 w-48",
|
|
14146
|
-
children: [
|
|
14147
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "h-4 w-4 mr-2" }),
|
|
14148
|
-
"Lookup Counterparty"
|
|
14149
|
-
]
|
|
14150
|
-
}
|
|
14151
|
-
)
|
|
14152
|
-
] })
|
|
14153
|
-
}
|
|
14154
|
-
) : (
|
|
14155
|
-
/* Counterparty Information (Read-only) */
|
|
14156
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14157
|
-
FormCard,
|
|
14158
|
-
{
|
|
14159
|
-
title: "Counterparty Information",
|
|
14160
|
-
variant: "subtle",
|
|
14161
|
-
headerActions: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
14162
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle2, { className: "h-5 w-5 text-success" }),
|
|
14163
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
14164
|
-
Button,
|
|
14165
|
-
{
|
|
14166
|
-
variant: "ghost",
|
|
14167
|
-
size: "sm",
|
|
14168
|
-
onClick: handleEditCounterparty,
|
|
14169
|
-
children: [
|
|
14170
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Edit, { className: "h-4 w-4 mr-1" }),
|
|
14171
|
-
"Edit"
|
|
14172
|
-
]
|
|
14173
|
-
}
|
|
14174
|
-
)
|
|
14175
|
-
] }),
|
|
14176
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(DataGrid, { data: counterpartyDataGrid, columns: 2 })
|
|
14177
|
-
}
|
|
14178
|
-
)
|
|
14179
|
-
),
|
|
14180
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14181
|
-
FormCard,
|
|
14182
|
-
{
|
|
14183
|
-
title: "Transaction Details",
|
|
14184
|
-
variant: "default",
|
|
14185
|
-
className: cn(!counterpartyLookedUp && "opacity-50 pointer-events-none"),
|
|
14186
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
|
|
14187
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-[1fr_auto] gap-4", children: [
|
|
14188
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14189
|
-
FormInput,
|
|
14190
|
-
{
|
|
14191
|
-
name: "amount",
|
|
14192
|
-
label: "Amount",
|
|
14193
|
-
placeholder: "0.00",
|
|
14194
|
-
type: "number",
|
|
14195
|
-
disabled: !counterpartyLookedUp
|
|
14196
|
-
}
|
|
14197
|
-
),
|
|
14198
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14199
|
-
FormSelect,
|
|
14200
|
-
{
|
|
14201
|
-
name: "currency",
|
|
14202
|
-
label: "Currency",
|
|
14203
|
-
options: CURRENCY_OPTIONS,
|
|
14204
|
-
disabled: !counterpartyLookedUp,
|
|
14205
|
-
className: "w-48"
|
|
14206
|
-
}
|
|
14207
|
-
)
|
|
14208
|
-
] }),
|
|
14209
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14210
|
-
FormInput,
|
|
14211
|
-
{
|
|
14212
|
-
name: "description",
|
|
14213
|
-
label: "Description (Optional)",
|
|
14214
|
-
placeholder: "Enter transaction description",
|
|
14215
|
-
disabled: !counterpartyLookedUp
|
|
14216
|
-
}
|
|
14217
|
-
)
|
|
14218
|
-
] })
|
|
14219
|
-
}
|
|
14220
|
-
),
|
|
14221
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14222
|
-
FormCard,
|
|
14223
|
-
{
|
|
14224
|
-
title: "Review & Submit",
|
|
14225
|
-
variant: "default",
|
|
14226
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6", children: [
|
|
14227
|
-
/* @__PURE__ */ jsxRuntime.jsx(DataGrid, { data: reviewData, columns: 2 }),
|
|
14228
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-muted/30 rounded-lg p-4 border border-border/50", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
14229
|
-
reactHookForm.Controller,
|
|
14230
|
-
{
|
|
14231
|
-
name: "certifyInformation",
|
|
14232
|
-
control: form.control,
|
|
14233
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
14234
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3", children: [
|
|
14235
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14236
|
-
Checkbox,
|
|
14237
|
-
{
|
|
14238
|
-
id: "certifyInformation",
|
|
14239
|
-
checked: field.value,
|
|
14240
|
-
onCheckedChange: field.onChange
|
|
14241
|
-
}
|
|
14242
|
-
),
|
|
14243
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14244
|
-
"label",
|
|
14245
|
-
{
|
|
14246
|
-
htmlFor: "certifyInformation",
|
|
14247
|
-
className: "text-sm font-medium leading-relaxed cursor-pointer select-none",
|
|
14248
|
-
children: "I certify that all information entered is correct and accurate to the best of my knowledge"
|
|
14249
|
-
}
|
|
14250
|
-
)
|
|
14251
|
-
] }),
|
|
14252
|
-
form.formState.errors.certifyInformation && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-destructive ml-7", children: form.formState.errors.certifyInformation.message })
|
|
14253
|
-
] })
|
|
14254
|
-
}
|
|
14255
|
-
) }),
|
|
14256
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3 justify-end pt-4 border-t border-border", children: [
|
|
14257
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14258
|
-
Button,
|
|
14259
|
-
{
|
|
14260
|
-
type: "button",
|
|
14261
|
-
variant: "outline",
|
|
14262
|
-
onClick: handleCancel,
|
|
14263
|
-
className: "w-32",
|
|
14264
|
-
children: "Cancel"
|
|
14265
|
-
}
|
|
14266
|
-
),
|
|
14267
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
14268
|
-
Button,
|
|
14269
|
-
{
|
|
14270
|
-
type: "button",
|
|
14271
|
-
onClick: handleSubmit,
|
|
14272
|
-
className: "w-48",
|
|
14273
|
-
disabled: !transactionType || !accountNumber || !counterpartyName || !amount || !form.watch("certifyInformation"),
|
|
14274
|
-
children: [
|
|
14275
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle2, { className: "h-4 w-4 mr-2" }),
|
|
14276
|
-
"Submit Transaction"
|
|
14277
|
-
]
|
|
14278
|
-
}
|
|
14279
|
-
)
|
|
14280
|
-
] })
|
|
14281
|
-
] })
|
|
14282
|
-
}
|
|
14283
|
-
)
|
|
14284
|
-
] }) }),
|
|
14285
|
-
/* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: confirmationOpen, onOpenChange: setConfirmationOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "sm:max-w-md", children: [
|
|
14286
|
-
/* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { children: [
|
|
14287
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 mb-2", children: [
|
|
14288
|
-
submissionStatus === "success" ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-12 w-12 rounded-full bg-success/10 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle2, { className: "h-6 w-6 text-success" }) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-12 w-12 rounded-full bg-destructive/10 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XCircle, { className: "h-6 w-6 text-destructive" }) }),
|
|
14289
|
-
/* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { className: "text-xl", children: submissionStatus === "success" ? "Transaction Successful" : "Transaction Failed" })
|
|
14290
|
-
] }),
|
|
14291
|
-
/* @__PURE__ */ jsxRuntime.jsx(DialogDescription, { className: "text-left", children: submissionStatus === "success" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 pt-2", children: [
|
|
14292
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-foreground", children: "Your transaction has been successfully submitted and is being processed." }),
|
|
14293
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-muted/50 rounded-lg p-4 space-y-2", children: [
|
|
14294
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between text-sm", children: [
|
|
14295
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Transaction ID:" }),
|
|
14296
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono font-medium", children: transactionId })
|
|
14297
|
-
] }),
|
|
14298
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between text-sm", children: [
|
|
14299
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Amount:" }),
|
|
14300
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-medium", children: [
|
|
14301
|
-
"$",
|
|
14302
|
-
amount
|
|
14303
|
-
] })
|
|
14304
|
-
] }),
|
|
14305
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between text-sm", children: [
|
|
14306
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Type:" }),
|
|
14307
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: TRANSACTION_TYPES.find((t) => t.value === transactionType)?.label })
|
|
14308
|
-
] }),
|
|
14309
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between text-sm", children: [
|
|
14310
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Counterparty:" }),
|
|
14311
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: counterpartyName })
|
|
14312
|
-
] })
|
|
14313
|
-
] }),
|
|
14314
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2 p-3 bg-blue-500/10 border border-blue-500/20 rounded-lg", children: [
|
|
14315
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircle, { className: "h-5 w-5 text-blue-500 mt-0.5 flex-shrink-0" }),
|
|
14316
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-blue-700 dark:text-blue-300", children: "You will receive a confirmation email once the transaction is completed." })
|
|
14317
|
-
] })
|
|
14318
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 pt-2", children: [
|
|
14319
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2 p-4 bg-destructive/10 border border-destructive/20 rounded-lg", children: [
|
|
14320
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.XCircle, { className: "h-5 w-5 text-destructive mt-0.5 flex-shrink-0" }),
|
|
14321
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
|
|
14322
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-destructive", children: "Error Processing Transaction" }),
|
|
14323
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: errorMessage })
|
|
14324
|
-
] })
|
|
14325
|
-
] }),
|
|
14326
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "Please review the error message above and try again. If the problem persists, contact support." })
|
|
14327
|
-
] }) })
|
|
14328
|
-
] }),
|
|
14329
|
-
/* @__PURE__ */ jsxRuntime.jsxs(DialogFooter, { className: "sm:justify-end gap-2", children: [
|
|
14330
|
-
submissionStatus === "error" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
14331
|
-
Button,
|
|
14332
|
-
{
|
|
14333
|
-
type: "button",
|
|
14334
|
-
variant: "outline",
|
|
14335
|
-
onClick: () => setConfirmationOpen(false),
|
|
14336
|
-
children: "Try Again"
|
|
14337
|
-
}
|
|
14338
|
-
),
|
|
14339
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14340
|
-
Button,
|
|
14341
|
-
{
|
|
14342
|
-
type: "button",
|
|
14343
|
-
onClick: handleConfirmationClose,
|
|
14344
|
-
variant: submissionStatus === "success" ? "default" : "outline",
|
|
14345
|
-
children: submissionStatus === "success" ? "View Transactions" : "Close"
|
|
14346
|
-
}
|
|
14347
|
-
)
|
|
14348
|
-
] })
|
|
14349
|
-
] }) })
|
|
14350
|
-
] })
|
|
14624
|
+
form,
|
|
14625
|
+
accountLookedUp,
|
|
14626
|
+
accountData,
|
|
14627
|
+
counterpartyLookedUp,
|
|
14628
|
+
counterpartyData,
|
|
14629
|
+
confirmationOpen,
|
|
14630
|
+
submissionStatus,
|
|
14631
|
+
errorMessage,
|
|
14632
|
+
transactionId,
|
|
14633
|
+
isAccountLoading,
|
|
14634
|
+
isCounterpartyLoading,
|
|
14635
|
+
isSubmitting,
|
|
14636
|
+
onAccountLookup: handleAccountLookup,
|
|
14637
|
+
onEditAccount: handleEditAccount,
|
|
14638
|
+
counterpartySearchResults,
|
|
14639
|
+
isCounterpartySearching,
|
|
14640
|
+
showCounterpartyDropdown,
|
|
14641
|
+
onCounterpartySearchChange: handleCounterpartySearchChange,
|
|
14642
|
+
onCounterpartySelect: handleCounterpartySelect,
|
|
14643
|
+
onCounterpartyDropdownClose: () => setShowCounterpartyDropdown(false),
|
|
14644
|
+
onEditCounterparty: handleEditCounterparty,
|
|
14645
|
+
onTransactionTypeChange: handleTransactionTypeChange,
|
|
14646
|
+
onSubmit: handleSubmit,
|
|
14647
|
+
onCancel: handleCancel,
|
|
14648
|
+
onConfirmationClose: handleConfirmationClose,
|
|
14649
|
+
onConfirmationOpenChange: setConfirmationOpen,
|
|
14650
|
+
receiverAccountLookedUp,
|
|
14651
|
+
receiverAccountData,
|
|
14652
|
+
isReceiverAccountLoading,
|
|
14653
|
+
onReceiverAccountLookup: handleReceiverAccountLookup,
|
|
14654
|
+
onEditReceiverAccount: handleEditReceiverAccount
|
|
14351
14655
|
}
|
|
14352
14656
|
);
|
|
14353
14657
|
}
|
|
@@ -16384,6 +16688,8 @@ exports.ACHBankCard = ACHBankCard;
|
|
|
16384
16688
|
exports.ACHBasicInfoCard = ACHBasicInfoCard;
|
|
16385
16689
|
exports.ACHDetailsSection = ACHDetailsSection;
|
|
16386
16690
|
exports.ACHTransferSection = ACHTransferSection;
|
|
16691
|
+
exports.ADJUSTMENT_DIRECTION_OPTIONS = ADJUSTMENT_DIRECTION_OPTIONS;
|
|
16692
|
+
exports.ADJUSTMENT_TYPE_OPTIONS = ADJUSTMENT_TYPE_OPTIONS;
|
|
16387
16693
|
exports.AccountCard = AccountCard;
|
|
16388
16694
|
exports.AccountDetail = AccountDetail_default;
|
|
16389
16695
|
exports.Accounts = Accounts_default;
|
|
@@ -16485,6 +16791,7 @@ exports.ListPage = ListPage;
|
|
|
16485
16791
|
exports.MainLayout = MainLayout;
|
|
16486
16792
|
exports.MetricCard = MetricCard;
|
|
16487
16793
|
exports.NewTransaction = NewTransaction;
|
|
16794
|
+
exports.NewTransactionView = NewTransactionView;
|
|
16488
16795
|
exports.NotFound = NotFound_default;
|
|
16489
16796
|
exports.OFACAlertView = OFACAlertView;
|
|
16490
16797
|
exports.OriginatorCard = OriginatorCard;
|
|
@@ -16542,6 +16849,7 @@ exports.Statement = Statement;
|
|
|
16542
16849
|
exports.StatementHeader = StatementHeader;
|
|
16543
16850
|
exports.StatementView = StatementView;
|
|
16544
16851
|
exports.StatusBadge = StatusBadge;
|
|
16852
|
+
exports.TRANSACTION_TYPES = TRANSACTION_TYPES;
|
|
16545
16853
|
exports.Table = Table;
|
|
16546
16854
|
exports.TableBody = TableBody;
|
|
16547
16855
|
exports.TableCaption = TableCaption;
|
|
@@ -16581,6 +16889,7 @@ exports.cardVariants = cardVariants;
|
|
|
16581
16889
|
exports.downloadCSV = downloadCSV;
|
|
16582
16890
|
exports.generateStatementCSV = generateStatementCSV;
|
|
16583
16891
|
exports.inputVariants = inputVariants;
|
|
16892
|
+
exports.newTransactionSchema = newTransactionSchema;
|
|
16584
16893
|
exports.reducer = reducer;
|
|
16585
16894
|
exports.textareaVariants = textareaVariants;
|
|
16586
16895
|
exports.toast = toast;
|