braid-ui 1.0.62 → 1.0.64

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/index.cjs CHANGED
@@ -65,6 +65,14 @@ var ToastPrimitives__namespace = /*#__PURE__*/_interopNamespace(ToastPrimitives)
65
65
  function cn(...inputs) {
66
66
  return tailwindMerge.twMerge(clsx.clsx(inputs));
67
67
  }
68
+ function formatCurrency(value, currency = "USD") {
69
+ return new Intl.NumberFormat("en-US", {
70
+ style: "currency",
71
+ currency,
72
+ minimumFractionDigits: 2,
73
+ maximumFractionDigits: 2
74
+ }).format(value);
75
+ }
68
76
  var cardVariants = classVarianceAuthority.cva(
69
77
  "rounded-lg border bg-card text-card-foreground transition-all duration-200",
70
78
  {
@@ -310,7 +318,12 @@ var badgeVariants = classVarianceAuthority.cva(
310
318
  "alert-ofac": "border-red-200 bg-red-50 text-red-700 hover:bg-red-100 dark:border-red-800 dark:bg-red-950 dark:text-red-300 font-medium",
311
319
  "alert-dual": "border-emerald-200 bg-emerald-50 text-emerald-700 hover:bg-emerald-100 dark:border-emerald-800 dark:bg-emerald-950 dark:text-emerald-300 font-medium",
312
320
  "alert-monitoring": "border-amber-200 bg-amber-50 text-amber-700 hover:bg-amber-100 dark:border-amber-800 dark:bg-amber-950 dark:text-amber-300 font-medium",
313
- "alert-error": "border-rose-200 bg-rose-50 text-rose-700 hover:bg-rose-100 dark:border-rose-800 dark:bg-rose-950 dark:text-rose-300 font-medium"
321
+ "alert-error": "border-rose-200 bg-rose-50 text-rose-700 hover:bg-rose-100 dark:border-rose-800 dark:bg-rose-950 dark:text-rose-300 font-medium",
322
+ // Account type variants
323
+ checking: "border-blue-200 bg-blue-50 text-blue-700 hover:bg-blue-100 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-300",
324
+ savings: "border-emerald-200 bg-emerald-50 text-emerald-700 hover:bg-emerald-100 dark:border-emerald-800 dark:bg-emerald-950 dark:text-emerald-300",
325
+ "zero-balance": "border-slate-200 bg-slate-50 text-slate-700 hover:bg-slate-100 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-300",
326
+ funding: "border-violet-200 bg-violet-50 text-violet-700 hover:bg-violet-100 dark:border-violet-800 dark:bg-violet-950 dark:text-violet-300"
314
327
  }
315
328
  },
316
329
  defaultVariants: {
@@ -8060,7 +8073,7 @@ var columns = [
8060
8073
  title: "Amount",
8061
8074
  sortable: true,
8062
8075
  align: "right",
8063
- render: (value) => `$${value.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`
8076
+ render: (value) => formatCurrency(value)
8064
8077
  },
8065
8078
  {
8066
8079
  key: "count",
@@ -8257,7 +8270,7 @@ var StatementView = ({
8257
8270
  ] });
8258
8271
  };
8259
8272
  var ACHDetailsSection = ({ data }) => {
8260
- const formatCurrency4 = (value) => {
8273
+ const formatCurrency5 = (value) => {
8261
8274
  return new Intl.NumberFormat("en-US", {
8262
8275
  style: "currency",
8263
8276
  currency: "USD",
@@ -8293,7 +8306,7 @@ var ACHDetailsSection = ({ data }) => {
8293
8306
  layout: "horizontal"
8294
8307
  }
8295
8308
  ),
8296
- /* @__PURE__ */ jsxRuntime.jsx(InfoField, { label: "Amount", value: formatCurrency4(data.amount), layout: "horizontal" }),
8309
+ /* @__PURE__ */ jsxRuntime.jsx(InfoField, { label: "Amount", value: formatCurrency5(data.amount), layout: "horizontal" }),
8297
8310
  /* @__PURE__ */ jsxRuntime.jsx(InfoField, { label: "SEC Code", value: data.secCode, layout: "horizontal" }),
8298
8311
  /* @__PURE__ */ jsxRuntime.jsx(InfoField, { label: "Company Entry Description", value: data.companyEntryDescription, layout: "horizontal" }),
8299
8312
  data.companyDiscretionaryData && /* @__PURE__ */ jsxRuntime.jsx(InfoField, { label: "Company Discretionary Data", value: data.companyDiscretionaryData, layout: "horizontal" }),
@@ -8376,7 +8389,7 @@ var WireDetailsSection = ({ data }) => {
8376
8389
  ) })
8377
8390
  ] });
8378
8391
  };
8379
- var formatCurrency = (value) => {
8392
+ var formatCurrency2 = (value) => {
8380
8393
  const numValue = typeof value === "string" ? parseFloat(value) : value;
8381
8394
  if (isNaN(numValue)) return "";
8382
8395
  return new Intl.NumberFormat("en-US", {
@@ -8387,7 +8400,7 @@ var formatCurrency = (value) => {
8387
8400
  };
8388
8401
  var CurrencyInput = ({ value, onChange, ...props }) => {
8389
8402
  const [isFocused, setIsFocused] = React15__namespace.useState(false);
8390
- const displayValue = value ? isFocused ? value : formatCurrency(value) : "";
8403
+ const displayValue = value ? isFocused ? value : formatCurrency2(value) : "";
8391
8404
  const handleChange = (e) => {
8392
8405
  const rawValue = e.target.value.replace(/[^0-9.]/g, "");
8393
8406
  const parts = rawValue.split(".");
@@ -8426,7 +8439,7 @@ var Checkbox = React15__namespace.forwardRef(({ className, ...props }, ref) => /
8426
8439
  }
8427
8440
  ));
8428
8441
  Checkbox.displayName = CheckboxPrimitive__namespace.Root.displayName;
8429
- var formatCurrency2 = (value) => {
8442
+ var formatCurrency3 = (value) => {
8430
8443
  const numValue = typeof value === "string" ? parseFloat(value) : value;
8431
8444
  if (isNaN(numValue)) return "-";
8432
8445
  return new Intl.NumberFormat("en-US", {
@@ -8538,7 +8551,7 @@ var NewTransactionView = ({
8538
8551
  ] : [],
8539
8552
  ...isTransfer ? [{ label: "Receiver Account", value: receiverAccountNumber || "-" }] : [],
8540
8553
  ...requiresCounterparty ? [{ label: "Counterparty", value: counterpartyName || "-" }] : [],
8541
- { label: "Amount", value: amount ? formatCurrency2(amount) : "-" },
8554
+ { label: "Amount", value: amount ? formatCurrency3(amount) : "-" },
8542
8555
  { label: "Description", value: form.watch("description") || "N/A" }
8543
8556
  ];
8544
8557
  const reviewData = [
@@ -8904,7 +8917,7 @@ var NewTransactionView = ({
8904
8917
  ] }),
8905
8918
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between text-sm", children: [
8906
8919
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Amount:" }),
8907
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: formatCurrency2(amount) })
8920
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: formatCurrency3(amount) })
8908
8921
  ] }),
8909
8922
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between text-sm", children: [
8910
8923
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Description:" }),
@@ -8935,12 +8948,129 @@ var NewTransactionView = ({
8935
8948
  ] }) })
8936
8949
  ] });
8937
8950
  };
8951
+ var EnhancedMultiSelect = ({
8952
+ label,
8953
+ value = [],
8954
+ onValueChange,
8955
+ options,
8956
+ placeholder = "Select options",
8957
+ className,
8958
+ disabled = false
8959
+ }) => {
8960
+ const [open, setOpen] = React15__namespace.useState(false);
8961
+ const handleSelect = (optionValue) => {
8962
+ if (value.includes(optionValue)) {
8963
+ onValueChange(value.filter((v) => v !== optionValue));
8964
+ } else {
8965
+ onValueChange([...value, optionValue]);
8966
+ }
8967
+ };
8968
+ const handleRemove = (optionValue, e) => {
8969
+ e.stopPropagation();
8970
+ onValueChange(value.filter((v) => v !== optionValue));
8971
+ };
8972
+ const selectedLabels = value.map((v) => options.find((opt) => opt.value === v)?.label).filter(Boolean);
8973
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("space-y-2", className), children: [
8974
+ label && /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", children: label }),
8975
+ /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open, onOpenChange: setOpen, children: [
8976
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
8977
+ Button,
8978
+ {
8979
+ variant: "outline",
8980
+ role: "combobox",
8981
+ "aria-expanded": open,
8982
+ disabled,
8983
+ className: "w-full justify-between font-normal h-auto min-h-10",
8984
+ children: [
8985
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1 flex-1 text-left", children: selectedLabels.length > 0 ? selectedLabels.map((label2, index) => /* @__PURE__ */ jsxRuntime.jsxs(
8986
+ Badge,
8987
+ {
8988
+ variant: "secondary",
8989
+ className: "text-xs",
8990
+ children: [
8991
+ label2,
8992
+ /* @__PURE__ */ jsxRuntime.jsx(
8993
+ lucideReact.X,
8994
+ {
8995
+ className: "ml-1 h-3 w-3 cursor-pointer",
8996
+ onClick: (e) => handleRemove(value[index], e)
8997
+ }
8998
+ )
8999
+ ]
9000
+ },
9001
+ value[index]
9002
+ )) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: placeholder }) }),
9003
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
9004
+ ]
9005
+ }
9006
+ ) }),
9007
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-full min-w-[200px] p-0", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-h-60 overflow-auto p-1", children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsxs(
9008
+ "div",
9009
+ {
9010
+ className: cn(
9011
+ "flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm cursor-pointer hover:bg-accent hover:text-accent-foreground",
9012
+ value.includes(option.value) && "bg-accent"
9013
+ ),
9014
+ onClick: () => handleSelect(option.value),
9015
+ children: [
9016
+ /* @__PURE__ */ jsxRuntime.jsx(
9017
+ "div",
9018
+ {
9019
+ className: cn(
9020
+ "flex h-4 w-4 items-center justify-center rounded-sm border border-primary",
9021
+ value.includes(option.value) ? "bg-primary text-primary-foreground" : "opacity-50"
9022
+ ),
9023
+ children: value.includes(option.value) && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-3 w-3" })
9024
+ }
9025
+ ),
9026
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: option.label })
9027
+ ]
9028
+ },
9029
+ option.value
9030
+ )) }) })
9031
+ ] })
9032
+ ] });
9033
+ };
9034
+ var defaultFilters = {
9035
+ originalFileName: "",
9036
+ requesterIpAddress: "",
9037
+ requesterUsername: "",
9038
+ showAchNoc: false,
9039
+ excludeWire: false,
9040
+ excludeAch: false,
9041
+ wireFileHandle: "",
9042
+ direction: "",
9043
+ counterpartyId: "",
9044
+ customerId: "",
9045
+ settlementFileName: "",
9046
+ isInbound: false,
9047
+ accountNumber: "",
9048
+ processingStatus: [],
9049
+ beginDate: void 0,
9050
+ endDate: void 0,
9051
+ postDateStart: void 0,
9052
+ postDateEnd: void 0,
9053
+ maxAmount: "",
9054
+ minAmount: "",
9055
+ productId: "",
9056
+ paymentId: "",
9057
+ transactionStatus: [],
9058
+ transactionType: []
9059
+ };
8938
9060
  var TransactionHistoryFiltersSheet = ({
8939
9061
  filters,
9062
+ filterOptions: filterOptions2 = {},
8940
9063
  onFilterChange,
8941
9064
  onResetFilters,
8942
9065
  onApplyFilters
8943
9066
  }) => {
9067
+ const {
9068
+ transactionTypes = [],
9069
+ transactionStatuses = [],
9070
+ processingStatuses = [],
9071
+ directions = [],
9072
+ products = []
9073
+ } = filterOptions2;
8944
9074
  const [localFilters, setLocalFilters] = React15.useState(filters);
8945
9075
  const [open, setOpen] = React15.useState(false);
8946
9076
  React15.useEffect(() => {
@@ -8949,6 +9079,10 @@ var TransactionHistoryFiltersSheet = ({
8949
9079
  const handleLocalFilterChange = (field, value) => {
8950
9080
  setLocalFilters((prev) => ({ ...prev, [field]: value }));
8951
9081
  };
9082
+ const handleDateChange = (field, date) => {
9083
+ const isoString = date ? date.toISOString() : void 0;
9084
+ handleLocalFilterChange(field, isoString);
9085
+ };
8952
9086
  const handleApplyFilters = () => {
8953
9087
  Object.entries(localFilters).forEach(([key, value]) => {
8954
9088
  onFilterChange(key, value);
@@ -8957,32 +9091,15 @@ var TransactionHistoryFiltersSheet = ({
8957
9091
  setOpen(false);
8958
9092
  };
8959
9093
  const handleResetFilters = () => {
8960
- const resetFilters = {
8961
- accountNumber: "",
8962
- product: "",
8963
- customerId: "",
8964
- counterpartyId: "",
8965
- settlementFileName: "",
8966
- originalFileName: "",
8967
- requesterIpAddress: "",
8968
- requesterUsername: "",
8969
- wireFileHandle: "",
8970
- paymentId: "",
8971
- transactionType: "",
8972
- transactionStatus: "",
8973
- processingStatus: "",
8974
- direction: "",
8975
- minAmount: "",
8976
- maxAmount: "",
8977
- creationDateStart: void 0,
8978
- creationDateEnd: void 0,
8979
- postDateStart: void 0,
8980
- postDateEnd: void 0
8981
- };
8982
- setLocalFilters(resetFilters);
9094
+ setLocalFilters(defaultFilters);
8983
9095
  onResetFilters();
8984
9096
  setOpen(false);
8985
9097
  };
9098
+ const parseDate = (dateStr) => {
9099
+ if (!dateStr) return void 0;
9100
+ const date = new Date(dateStr);
9101
+ return isNaN(date.getTime()) ? void 0 : date;
9102
+ };
8986
9103
  return /* @__PURE__ */ jsxRuntime.jsxs(Sheet, { open, onOpenChange: setOpen, children: [
8987
9104
  /* @__PURE__ */ jsxRuntime.jsx(SheetTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "outline", className: "gap-2", children: [
8988
9105
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Filter, { className: "h-4 w-4" }),
@@ -8991,12 +9108,61 @@ var TransactionHistoryFiltersSheet = ({
8991
9108
  /* @__PURE__ */ jsxRuntime.jsxs(SheetContent, { side: "right", className: "w-full sm:max-w-xl overflow-y-auto", children: [
8992
9109
  /* @__PURE__ */ jsxRuntime.jsx(SheetHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(SheetTitle, { children: "Transaction Filters" }) }),
8993
9110
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6 py-6", children: [
9111
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
9112
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-sm font-medium text-muted-foreground", children: "Options" }),
9113
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9114
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
9115
+ /* @__PURE__ */ jsxRuntime.jsx(
9116
+ Checkbox,
9117
+ {
9118
+ id: "showAchNoc",
9119
+ checked: localFilters.showAchNoc || false,
9120
+ onCheckedChange: (checked) => handleLocalFilterChange("showAchNoc", checked === true)
9121
+ }
9122
+ ),
9123
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "showAchNoc", className: "text-sm font-normal", children: "Show ACH NOC" })
9124
+ ] }),
9125
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
9126
+ /* @__PURE__ */ jsxRuntime.jsx(
9127
+ Checkbox,
9128
+ {
9129
+ id: "isInbound",
9130
+ checked: localFilters.isInbound || false,
9131
+ onCheckedChange: (checked) => handleLocalFilterChange("isInbound", checked === true)
9132
+ }
9133
+ ),
9134
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "isInbound", className: "text-sm font-normal", children: "Is Inbound" })
9135
+ ] }),
9136
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
9137
+ /* @__PURE__ */ jsxRuntime.jsx(
9138
+ Checkbox,
9139
+ {
9140
+ id: "excludeWire",
9141
+ checked: localFilters.excludeWire || false,
9142
+ onCheckedChange: (checked) => handleLocalFilterChange("excludeWire", checked === true)
9143
+ }
9144
+ ),
9145
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "excludeWire", className: "text-sm font-normal", children: "Exclude Wire" })
9146
+ ] }),
9147
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
9148
+ /* @__PURE__ */ jsxRuntime.jsx(
9149
+ Checkbox,
9150
+ {
9151
+ id: "excludeAch",
9152
+ checked: localFilters.excludeAch || false,
9153
+ onCheckedChange: (checked) => handleLocalFilterChange("excludeAch", checked === true)
9154
+ }
9155
+ ),
9156
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "excludeAch", className: "text-sm font-normal", children: "Exclude ACH" })
9157
+ ] })
9158
+ ] })
9159
+ ] }),
8994
9160
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
8995
9161
  /* @__PURE__ */ jsxRuntime.jsx(
8996
9162
  EnhancedInput,
8997
9163
  {
8998
9164
  label: "Account Number",
8999
- value: localFilters.accountNumber,
9165
+ value: localFilters.accountNumber || "",
9000
9166
  onChange: (e) => handleLocalFilterChange("accountNumber", e.target.value),
9001
9167
  placeholder: "Enter account number"
9002
9168
  }
@@ -9004,15 +9170,11 @@ var TransactionHistoryFiltersSheet = ({
9004
9170
  /* @__PURE__ */ jsxRuntime.jsx(
9005
9171
  EnhancedSelect,
9006
9172
  {
9007
- label: "Product",
9008
- value: localFilters.product,
9009
- onValueChange: (value) => handleLocalFilterChange("product", value),
9173
+ label: "Product ID",
9174
+ value: localFilters.productId || "",
9175
+ onValueChange: (value) => handleLocalFilterChange("productId", value),
9010
9176
  placeholder: "Select product",
9011
- options: [
9012
- { value: "wire", label: "Wire" },
9013
- { value: "ach", label: "ACH" },
9014
- { value: "check", label: "Check" }
9015
- ]
9177
+ options: products
9016
9178
  }
9017
9179
  )
9018
9180
  ] }),
@@ -9021,7 +9183,7 @@ var TransactionHistoryFiltersSheet = ({
9021
9183
  EnhancedInput,
9022
9184
  {
9023
9185
  label: "Customer ID",
9024
- value: localFilters.customerId,
9186
+ value: localFilters.customerId || "",
9025
9187
  onChange: (e) => handleLocalFilterChange("customerId", e.target.value),
9026
9188
  placeholder: "Enter customer ID"
9027
9189
  }
@@ -9030,7 +9192,7 @@ var TransactionHistoryFiltersSheet = ({
9030
9192
  EnhancedInput,
9031
9193
  {
9032
9194
  label: "Counterparty ID",
9033
- value: localFilters.counterpartyId,
9195
+ value: localFilters.counterpartyId || "",
9034
9196
  onChange: (e) => handleLocalFilterChange("counterpartyId", e.target.value),
9035
9197
  placeholder: "Enter counterparty ID"
9036
9198
  }
@@ -9040,7 +9202,7 @@ var TransactionHistoryFiltersSheet = ({
9040
9202
  EnhancedInput,
9041
9203
  {
9042
9204
  label: "Settlement File Name",
9043
- value: localFilters.settlementFileName,
9205
+ value: localFilters.settlementFileName || "",
9044
9206
  onChange: (e) => handleLocalFilterChange("settlementFileName", e.target.value),
9045
9207
  placeholder: "Enter settlement file name"
9046
9208
  }
@@ -9049,7 +9211,7 @@ var TransactionHistoryFiltersSheet = ({
9049
9211
  EnhancedInput,
9050
9212
  {
9051
9213
  label: "Original File Name",
9052
- value: localFilters.originalFileName,
9214
+ value: localFilters.originalFileName || "",
9053
9215
  onChange: (e) => handleLocalFilterChange("originalFileName", e.target.value),
9054
9216
  placeholder: "Enter original file name"
9055
9217
  }
@@ -9058,7 +9220,7 @@ var TransactionHistoryFiltersSheet = ({
9058
9220
  EnhancedInput,
9059
9221
  {
9060
9222
  label: "Requester IP Address",
9061
- value: localFilters.requesterIpAddress,
9223
+ value: localFilters.requesterIpAddress || "",
9062
9224
  onChange: (e) => handleLocalFilterChange("requesterIpAddress", e.target.value),
9063
9225
  placeholder: "Enter IP address"
9064
9226
  }
@@ -9067,7 +9229,7 @@ var TransactionHistoryFiltersSheet = ({
9067
9229
  EnhancedInput,
9068
9230
  {
9069
9231
  label: "Requester Username",
9070
- value: localFilters.requesterUsername,
9232
+ value: localFilters.requesterUsername || "",
9071
9233
  onChange: (e) => handleLocalFilterChange("requesterUsername", e.target.value),
9072
9234
  placeholder: "Enter username"
9073
9235
  }
@@ -9076,7 +9238,7 @@ var TransactionHistoryFiltersSheet = ({
9076
9238
  EnhancedInput,
9077
9239
  {
9078
9240
  label: "Wire File Handle",
9079
- value: localFilters.wireFileHandle,
9241
+ value: localFilters.wireFileHandle || "",
9080
9242
  onChange: (e) => handleLocalFilterChange("wireFileHandle", e.target.value),
9081
9243
  placeholder: "Enter wire file handle"
9082
9244
  }
@@ -9085,66 +9247,49 @@ var TransactionHistoryFiltersSheet = ({
9085
9247
  EnhancedInput,
9086
9248
  {
9087
9249
  label: "Payment ID",
9088
- value: localFilters.paymentId,
9250
+ value: localFilters.paymentId || "",
9089
9251
  onChange: (e) => handleLocalFilterChange("paymentId", e.target.value),
9090
9252
  placeholder: "Enter payment ID"
9091
9253
  }
9092
9254
  ),
9093
9255
  /* @__PURE__ */ jsxRuntime.jsx(
9094
- EnhancedSelect,
9256
+ EnhancedMultiSelect,
9095
9257
  {
9096
9258
  label: "Transaction Type",
9097
- value: localFilters.transactionType,
9259
+ value: localFilters.transactionType || [],
9098
9260
  onValueChange: (value) => handleLocalFilterChange("transactionType", value),
9099
- placeholder: "Select transaction type",
9100
- options: [
9101
- { value: "ach_credit", label: "ACH Credit" },
9102
- { value: "ach_debit", label: "ACH Debit" },
9103
- { value: "wire_domestic", label: "Wire Domestic" },
9104
- { value: "wire_international", label: "Wire International" }
9105
- ]
9261
+ placeholder: "Select transaction types",
9262
+ options: transactionTypes
9106
9263
  }
9107
9264
  ),
9108
9265
  /* @__PURE__ */ jsxRuntime.jsx(
9109
- EnhancedSelect,
9266
+ EnhancedMultiSelect,
9110
9267
  {
9111
9268
  label: "Transaction Status",
9112
- value: localFilters.transactionStatus,
9269
+ value: localFilters.transactionStatus || [],
9113
9270
  onValueChange: (value) => handleLocalFilterChange("transactionStatus", value),
9114
- placeholder: "Select transaction status",
9115
- options: [
9116
- { value: "PENDING", label: "Pending" },
9117
- { value: "POSTED", label: "Posted" },
9118
- { value: "FAILED", label: "Failed" },
9119
- { value: "CANCELLED", label: "Cancelled" }
9120
- ]
9271
+ placeholder: "Select transaction statuses",
9272
+ options: transactionStatuses
9121
9273
  }
9122
9274
  ),
9123
9275
  /* @__PURE__ */ jsxRuntime.jsx(
9124
- EnhancedSelect,
9276
+ EnhancedMultiSelect,
9125
9277
  {
9126
9278
  label: "Processing Status",
9127
- value: localFilters.processingStatus,
9279
+ value: localFilters.processingStatus || [],
9128
9280
  onValueChange: (value) => handleLocalFilterChange("processingStatus", value),
9129
- placeholder: "Select processing status",
9130
- options: [
9131
- { value: "processing", label: "Processing" },
9132
- { value: "completed", label: "Completed" },
9133
- { value: "error", label: "Error" }
9134
- ]
9281
+ placeholder: "Select processing statuses",
9282
+ options: processingStatuses
9135
9283
  }
9136
9284
  ),
9137
9285
  /* @__PURE__ */ jsxRuntime.jsx(
9138
9286
  EnhancedSelect,
9139
9287
  {
9140
9288
  label: "Direction",
9141
- value: localFilters.direction,
9289
+ value: localFilters.direction || "",
9142
9290
  onValueChange: (value) => handleLocalFilterChange("direction", value),
9143
9291
  placeholder: "Select direction",
9144
- options: [
9145
- { value: "credit", label: "Credit" },
9146
- { value: "debit", label: "Debit" }
9147
- ]
9292
+ options: directions
9148
9293
  }
9149
9294
  ),
9150
9295
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
@@ -9152,7 +9297,7 @@ var TransactionHistoryFiltersSheet = ({
9152
9297
  CurrencyInput,
9153
9298
  {
9154
9299
  label: "Min Amount",
9155
- value: localFilters.minAmount,
9300
+ value: localFilters.minAmount || "",
9156
9301
  onChange: (value) => handleLocalFilterChange("minAmount", value)
9157
9302
  }
9158
9303
  ),
@@ -9160,19 +9305,19 @@ var TransactionHistoryFiltersSheet = ({
9160
9305
  CurrencyInput,
9161
9306
  {
9162
9307
  label: "Max Amount",
9163
- value: localFilters.maxAmount,
9308
+ value: localFilters.maxAmount || "",
9164
9309
  onChange: (value) => handleLocalFilterChange("maxAmount", value)
9165
9310
  }
9166
9311
  )
9167
9312
  ] }),
9168
9313
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9169
9314
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
9170
- /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Creation Date Start" }),
9315
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Begin Date" }),
9171
9316
  /* @__PURE__ */ jsxRuntime.jsx(
9172
9317
  DatePicker,
9173
9318
  {
9174
- date: localFilters.creationDateStart,
9175
- onDateChange: (date) => handleLocalFilterChange("creationDateStart", date),
9319
+ date: parseDate(localFilters.beginDate),
9320
+ onDateChange: (date) => handleDateChange("beginDate", date),
9176
9321
  placeholder: "MM/DD/YYYY",
9177
9322
  buttonClassName: "w-full",
9178
9323
  className: "bg-background z-50"
@@ -9180,12 +9325,12 @@ var TransactionHistoryFiltersSheet = ({
9180
9325
  )
9181
9326
  ] }),
9182
9327
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
9183
- /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Creation Date End" }),
9328
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "End Date" }),
9184
9329
  /* @__PURE__ */ jsxRuntime.jsx(
9185
9330
  DatePicker,
9186
9331
  {
9187
- date: localFilters.creationDateEnd,
9188
- onDateChange: (date) => handleLocalFilterChange("creationDateEnd", date),
9332
+ date: parseDate(localFilters.endDate),
9333
+ onDateChange: (date) => handleDateChange("endDate", date),
9189
9334
  placeholder: "MM/DD/YYYY",
9190
9335
  buttonClassName: "w-full",
9191
9336
  className: "bg-background z-50"
@@ -9199,8 +9344,8 @@ var TransactionHistoryFiltersSheet = ({
9199
9344
  /* @__PURE__ */ jsxRuntime.jsx(
9200
9345
  DatePicker,
9201
9346
  {
9202
- date: localFilters.postDateStart,
9203
- onDateChange: (date) => handleLocalFilterChange("postDateStart", date),
9347
+ date: parseDate(localFilters.postDateStart),
9348
+ onDateChange: (date) => handleDateChange("postDateStart", date),
9204
9349
  placeholder: "MM/DD/YYYY",
9205
9350
  buttonClassName: "w-full",
9206
9351
  className: "bg-background z-50"
@@ -9212,8 +9357,8 @@ var TransactionHistoryFiltersSheet = ({
9212
9357
  /* @__PURE__ */ jsxRuntime.jsx(
9213
9358
  DatePicker,
9214
9359
  {
9215
- date: localFilters.postDateEnd,
9216
- onDateChange: (date) => handleLocalFilterChange("postDateEnd", date),
9360
+ date: parseDate(localFilters.postDateEnd),
9361
+ onDateChange: (date) => handleDateChange("postDateEnd", date),
9217
9362
  placeholder: "MM/DD/YYYY",
9218
9363
  buttonClassName: "w-full",
9219
9364
  className: "bg-background z-50"
@@ -9232,10 +9377,38 @@ var TransactionHistoryFiltersSheet = ({
9232
9377
  var TransactionHistoryView = ({
9233
9378
  table,
9234
9379
  filters,
9380
+ filterOptions: filterOptions2,
9235
9381
  onFilterChange,
9236
9382
  onResetFilters,
9237
- onApplyFilters
9383
+ onApplyFilters,
9384
+ isLoading,
9385
+ error,
9386
+ onRetry
9238
9387
  }) => {
9388
+ const renderContent = () => {
9389
+ if (isLoading) {
9390
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-3", children: [
9391
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-8 w-8 animate-spin text-muted-foreground" }),
9392
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "Loading transactions..." })
9393
+ ] }) });
9394
+ }
9395
+ if (error) {
9396
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-4 max-w-md text-center", children: [
9397
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 p-4 bg-destructive/10 border border-destructive/20 rounded-lg", children: [
9398
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircle, { className: "h-5 w-5 text-destructive flex-shrink-0" }),
9399
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1 text-left", children: [
9400
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-destructive", children: "Failed to load transactions" }),
9401
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: error })
9402
+ ] })
9403
+ ] }),
9404
+ onRetry && /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "outline", onClick: onRetry, children: [
9405
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RefreshCw, { className: "h-4 w-4 mr-2" }),
9406
+ "Retry"
9407
+ ] })
9408
+ ] }) });
9409
+ }
9410
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 mt-4 pb-6 overflow-auto", children: table });
9411
+ };
9239
9412
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col h-screen bg-gradient-subtle", children: [
9240
9413
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-none border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "container mx-auto px-4 py-4 max-w-none", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
9241
9414
  /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-3xl font-bold text-foreground", children: "Transaction History" }),
@@ -9243,13 +9416,14 @@ var TransactionHistoryView = ({
9243
9416
  TransactionHistoryFiltersSheet,
9244
9417
  {
9245
9418
  filters,
9419
+ filterOptions: filterOptions2,
9246
9420
  onFilterChange,
9247
9421
  onResetFilters,
9248
9422
  onApplyFilters
9249
9423
  }
9250
9424
  )
9251
9425
  ] }) }) }),
9252
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "container mx-auto px-4 h-full max-w-none flex flex-col", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 mt-4 overflow-auto", children: table }) }) })
9426
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "container mx-auto px-4 h-full max-w-none flex flex-col", children: renderContent() }) })
9253
9427
  ] });
9254
9428
  };
9255
9429
  var TransactionTypeBadge = ({
@@ -9295,7 +9469,7 @@ var getProcessingStatusVariant = (status) => {
9295
9469
  return "outline";
9296
9470
  }
9297
9471
  };
9298
- var formatCurrency3 = (value) => {
9472
+ var formatCurrency4 = (value) => {
9299
9473
  return new Intl.NumberFormat("en-US", {
9300
9474
  style: "currency",
9301
9475
  currency: "USD",
@@ -9315,8 +9489,35 @@ var TransactionDetailView = ({
9315
9489
  onCustomerClick,
9316
9490
  onCounterpartyClick,
9317
9491
  onOFACClick,
9318
- onProductClick
9492
+ onProductClick,
9493
+ isLoading,
9494
+ error,
9495
+ onRetry
9319
9496
  }) => {
9497
+ if (isLoading) {
9498
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-3", children: [
9499
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-8 w-8 animate-spin text-muted-foreground" }),
9500
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "Loading transaction..." })
9501
+ ] }) });
9502
+ }
9503
+ if (error) {
9504
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-4 max-w-md text-center", children: [
9505
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 p-4 bg-destructive/10 border border-destructive/20 rounded-lg", children: [
9506
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircle, { className: "h-5 w-5 text-destructive flex-shrink-0" }),
9507
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1 text-left", children: [
9508
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-destructive", children: "Failed to load transaction" }),
9509
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: error })
9510
+ ] })
9511
+ ] }),
9512
+ onRetry && /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "outline", onClick: onRetry, children: [
9513
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RefreshCw, { className: "h-4 w-4 mr-2" }),
9514
+ "Retry"
9515
+ ] })
9516
+ ] }) });
9517
+ }
9518
+ if (!transaction) {
9519
+ return null;
9520
+ }
9320
9521
  return /* @__PURE__ */ jsxRuntime.jsx(
9321
9522
  PageLayout,
9322
9523
  {
@@ -9324,7 +9525,7 @@ var TransactionDetailView = ({
9324
9525
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(
9325
9526
  "font-semibold",
9326
9527
  transaction.amount < 0 ? "text-destructive" : "text-success"
9327
- ), children: formatCurrency3(transaction.amount) }),
9528
+ ), children: formatCurrency4(transaction.amount) }),
9328
9529
  /* @__PURE__ */ jsxRuntime.jsx(
9329
9530
  TransactionTypeBadge,
9330
9531
  {
@@ -9455,109 +9656,284 @@ var TransactionDetailView = ({
9455
9656
  }
9456
9657
  );
9457
9658
  };
9458
- var typeIcons = {
9459
- checking: lucideReact.CreditCard,
9460
- savings: lucideReact.Building,
9461
- credit: lucideReact.CreditCard,
9462
- investment: lucideReact.Globe
9463
- };
9464
- var typeLabels = {
9465
- checking: "Checking",
9466
- savings: "Savings",
9467
- credit: "Credit",
9468
- investment: "Investment"
9469
- };
9470
- var AccountCard = React15__namespace.forwardRef(
9471
- ({ account, showBalance = true, className }, ref) => {
9472
- const TypeIcon = typeIcons[account.type];
9473
- const accountData = [
9474
- { label: "Account Number", value: account.number },
9475
- { label: "Type", value: typeLabels[account.type] },
9476
- ...account.routingNumber ? [{ label: "Routing Number", value: account.routingNumber }] : [],
9477
- ...account.institution ? [{ label: "Institution", value: account.institution }] : [],
9478
- ...account.country ? [{ label: "Country", value: account.country }] : []
9479
- ];
9480
- return /* @__PURE__ */ jsxRuntime.jsxs(Card, { ref, className: cn("", className), children: [
9481
- /* @__PURE__ */ jsxRuntime.jsx(CardHeader, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
9482
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-3", children: [
9483
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center w-10 h-10 rounded-lg bg-primary/10", children: /* @__PURE__ */ jsxRuntime.jsx(TypeIcon, { className: "w-5 h-5 text-primary" }) }),
9484
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
9485
- /* @__PURE__ */ jsxRuntime.jsx(CardTitle, { className: "text-lg", children: account.name }),
9486
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2 mt-1", children: [
9487
- /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: account.status, children: account.status }),
9488
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: typeLabels[account.type] })
9489
- ] })
9490
- ] })
9491
- ] }),
9492
- showBalance && account.balance && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-right", children: [
9493
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-2xl font-bold text-foreground", children: account.balance }),
9494
- account.currency && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-muted-foreground", children: account.currency })
9495
- ] })
9496
- ] }) }),
9497
- /* @__PURE__ */ jsxRuntime.jsx(CardContent, { children: /* @__PURE__ */ jsxRuntime.jsx(DataGrid, { data: accountData, columns: 2, gap: "sm" }) })
9498
- ] });
9499
- }
9500
- );
9501
- AccountCard.displayName = "AccountCard";
9502
- var typeConfig3 = {
9503
- corporation: {
9504
- variant: "corporation",
9505
- label: "Corporation",
9506
- icon: lucideReact.Building
9507
- },
9508
- llc: {
9509
- variant: "llc",
9510
- label: "LLC",
9511
- icon: lucideReact.Briefcase
9512
- },
9513
- partnership: {
9514
- variant: "partnership",
9515
- label: "Partnership",
9516
- icon: lucideReact.Users
9517
- },
9518
- sole_proprietorship: {
9519
- variant: "sole_proprietorship",
9520
- label: "Sole Proprietorship",
9521
- icon: lucideReact.User
9522
- }
9523
- };
9524
- var BusinessTypeBadge = ({ type, className }) => {
9525
- const config = typeConfig3[type];
9526
- const Icon2 = config.icon;
9527
- return /* @__PURE__ */ jsxRuntime.jsxs(Badge, { variant: config.variant, className, children: [
9528
- /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "w-3 h-3 mr-1" }),
9529
- config.label
9530
- ] });
9531
- };
9532
- var DetailPageLayout = ({
9533
- title,
9534
- description,
9535
- cards,
9536
- actions,
9537
- initialEditingState = {},
9538
- headerContent
9659
+ var cancelTransactionSchema = zod.z.object({
9660
+ reason: zod.z.string().min(1, "Reason is required").max(500, "Reason must be less than 500 characters")
9661
+ });
9662
+ var returnTransactionSchema = zod.z.object({
9663
+ reasonCode: zod.z.string().min(1, "Reason code is required")
9664
+ });
9665
+ var CancelTransactionDialog = ({
9666
+ transactionId,
9667
+ open,
9668
+ onOpenChange,
9669
+ onCancel
9539
9670
  }) => {
9540
- const [editingCards, setEditingCards] = React15.useState(
9541
- initialEditingState
9542
- );
9543
- const toggleEdit = (cardKey) => {
9544
- setEditingCards((prev) => ({
9545
- ...prev,
9546
- [cardKey]: !prev[cardKey]
9547
- }));
9671
+ const { toast: toast6 } = useToast();
9672
+ const {
9673
+ register,
9674
+ handleSubmit,
9675
+ formState: { errors, isSubmitting },
9676
+ reset
9677
+ } = useFormWithEditState({
9678
+ schema: cancelTransactionSchema,
9679
+ defaultValues: {
9680
+ reason: ""
9681
+ }
9682
+ });
9683
+ const onSubmit = async (data) => {
9684
+ try {
9685
+ await onCancel(data);
9686
+ toast6({
9687
+ title: "Transaction Cancelled",
9688
+ description: `Transaction ${transactionId} has been cancelled successfully.`
9689
+ });
9690
+ reset();
9691
+ onOpenChange(false);
9692
+ } catch (error) {
9693
+ toast6({
9694
+ title: "Error",
9695
+ description: "Failed to cancel the transaction. Please try again.",
9696
+ variant: "destructive"
9697
+ });
9698
+ }
9548
9699
  };
9549
- Object.values(editingCards).some(Boolean);
9550
- const isSingleCard = cards.length === 1;
9551
- const gridClasses2 = isSingleCard ? "space-y-4 mb-6 lg:space-y-6" : "grid gap-4 mb-6 grid-cols-1 lg:grid-cols-2 lg:gap-6";
9552
- return /* @__PURE__ */ jsxRuntime.jsx(
9553
- PageLayout,
9554
- {
9555
- title,
9556
- description,
9557
- headerContent,
9558
- actions: actions?.map((action) => ({
9559
- label: action.label,
9560
- variant: action.variant || "default",
9700
+ const handleClose = () => {
9701
+ reset();
9702
+ onOpenChange(false);
9703
+ };
9704
+ return /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "sm:max-w-md", children: [
9705
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { children: [
9706
+ /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: "Cancel Transaction" }),
9707
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogDescription, { children: [
9708
+ "Please provide a reason for cancelling transaction ",
9709
+ transactionId,
9710
+ "."
9711
+ ] })
9712
+ ] }),
9713
+ /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit(onSubmit), className: "space-y-4", children: [
9714
+ /* @__PURE__ */ jsxRuntime.jsx(
9715
+ EnhancedTextarea,
9716
+ {
9717
+ label: "Cancellation Reason",
9718
+ placeholder: "Enter the reason for cancellation...",
9719
+ error: errors.reason?.message,
9720
+ ...register("reason")
9721
+ }
9722
+ ),
9723
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogFooter, { className: "gap-2 sm:gap-0", children: [
9724
+ /* @__PURE__ */ jsxRuntime.jsx(
9725
+ Button,
9726
+ {
9727
+ type: "button",
9728
+ variant: "outline",
9729
+ onClick: handleClose,
9730
+ disabled: isSubmitting,
9731
+ children: "Close"
9732
+ }
9733
+ ),
9734
+ /* @__PURE__ */ jsxRuntime.jsx(
9735
+ Button,
9736
+ {
9737
+ type: "submit",
9738
+ variant: "destructive",
9739
+ disabled: isSubmitting,
9740
+ children: isSubmitting ? "Cancelling..." : "Cancel Transaction"
9741
+ }
9742
+ )
9743
+ ] })
9744
+ ] })
9745
+ ] }) });
9746
+ };
9747
+ function ReturnTransactionDialog({
9748
+ transactionId,
9749
+ open,
9750
+ onOpenChange,
9751
+ onReturn,
9752
+ reasonCodes
9753
+ }) {
9754
+ const {
9755
+ watch,
9756
+ setValue,
9757
+ handleSave,
9758
+ handleCancel,
9759
+ isLoading,
9760
+ formState: { errors }
9761
+ } = useFormWithEditState({
9762
+ schema: returnTransactionSchema,
9763
+ initialEditing: true,
9764
+ onSave: async (data) => {
9765
+ try {
9766
+ await onReturn(data);
9767
+ toast({
9768
+ title: "Transaction returned",
9769
+ description: `Transaction #${transactionId} has been returned successfully.`
9770
+ });
9771
+ onOpenChange(false);
9772
+ } catch (error) {
9773
+ toast({
9774
+ title: "Error",
9775
+ description: "Failed to return transaction. Please try again.",
9776
+ variant: "destructive"
9777
+ });
9778
+ throw error;
9779
+ }
9780
+ },
9781
+ onCancel: () => {
9782
+ onOpenChange(false);
9783
+ }
9784
+ });
9785
+ const reasonCode = watch("reasonCode");
9786
+ const selectOptions = reasonCodes.map((code) => ({
9787
+ value: code.value,
9788
+ label: code.label
9789
+ }));
9790
+ return /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "sm:max-w-[425px]", children: [
9791
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { children: [
9792
+ /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: "Return Transaction" }),
9793
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogDescription, { children: [
9794
+ "Select a reason code to return transaction #",
9795
+ transactionId,
9796
+ "."
9797
+ ] })
9798
+ ] }),
9799
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
9800
+ EnhancedSelect,
9801
+ {
9802
+ label: "Reason Code",
9803
+ placeholder: "Select a reason code",
9804
+ options: selectOptions,
9805
+ value: reasonCode || "",
9806
+ onValueChange: (value) => setValue("reasonCode", value),
9807
+ error: errors.reasonCode?.message
9808
+ }
9809
+ ) }),
9810
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogFooter, { children: [
9811
+ /* @__PURE__ */ jsxRuntime.jsx(
9812
+ Button,
9813
+ {
9814
+ type: "button",
9815
+ variant: "outline",
9816
+ onClick: handleCancel,
9817
+ disabled: isLoading,
9818
+ children: "Cancel"
9819
+ }
9820
+ ),
9821
+ /* @__PURE__ */ jsxRuntime.jsx(
9822
+ Button,
9823
+ {
9824
+ type: "button",
9825
+ variant: "destructive",
9826
+ onClick: handleSave,
9827
+ disabled: isLoading || !reasonCode,
9828
+ children: isLoading ? "Returning..." : "Return Transaction"
9829
+ }
9830
+ )
9831
+ ] })
9832
+ ] }) });
9833
+ }
9834
+ var typeIcons = {
9835
+ checking: lucideReact.CreditCard,
9836
+ savings: lucideReact.Building,
9837
+ credit: lucideReact.CreditCard,
9838
+ investment: lucideReact.Globe
9839
+ };
9840
+ var typeLabels = {
9841
+ checking: "Checking",
9842
+ savings: "Savings",
9843
+ credit: "Credit",
9844
+ investment: "Investment"
9845
+ };
9846
+ var AccountCard = React15__namespace.forwardRef(
9847
+ ({ account, showBalance = true, className }, ref) => {
9848
+ const TypeIcon = typeIcons[account.type];
9849
+ const accountData = [
9850
+ { label: "Account Number", value: account.number },
9851
+ { label: "Type", value: typeLabels[account.type] },
9852
+ ...account.routingNumber ? [{ label: "Routing Number", value: account.routingNumber }] : [],
9853
+ ...account.institution ? [{ label: "Institution", value: account.institution }] : [],
9854
+ ...account.country ? [{ label: "Country", value: account.country }] : []
9855
+ ];
9856
+ return /* @__PURE__ */ jsxRuntime.jsxs(Card, { ref, className: cn("", className), children: [
9857
+ /* @__PURE__ */ jsxRuntime.jsx(CardHeader, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
9858
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-3", children: [
9859
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center w-10 h-10 rounded-lg bg-primary/10", children: /* @__PURE__ */ jsxRuntime.jsx(TypeIcon, { className: "w-5 h-5 text-primary" }) }),
9860
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
9861
+ /* @__PURE__ */ jsxRuntime.jsx(CardTitle, { className: "text-lg", children: account.name }),
9862
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2 mt-1", children: [
9863
+ /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: account.status, children: account.status }),
9864
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: typeLabels[account.type] })
9865
+ ] })
9866
+ ] })
9867
+ ] }),
9868
+ showBalance && account.balance && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-right", children: [
9869
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-2xl font-bold text-foreground", children: account.balance }),
9870
+ account.currency && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-muted-foreground", children: account.currency })
9871
+ ] })
9872
+ ] }) }),
9873
+ /* @__PURE__ */ jsxRuntime.jsx(CardContent, { children: /* @__PURE__ */ jsxRuntime.jsx(DataGrid, { data: accountData, columns: 2, gap: "sm" }) })
9874
+ ] });
9875
+ }
9876
+ );
9877
+ AccountCard.displayName = "AccountCard";
9878
+ var typeConfig3 = {
9879
+ corporation: {
9880
+ variant: "corporation",
9881
+ label: "Corporation",
9882
+ icon: lucideReact.Building
9883
+ },
9884
+ llc: {
9885
+ variant: "llc",
9886
+ label: "LLC",
9887
+ icon: lucideReact.Briefcase
9888
+ },
9889
+ partnership: {
9890
+ variant: "partnership",
9891
+ label: "Partnership",
9892
+ icon: lucideReact.Users
9893
+ },
9894
+ sole_proprietorship: {
9895
+ variant: "sole_proprietorship",
9896
+ label: "Sole Proprietorship",
9897
+ icon: lucideReact.User
9898
+ }
9899
+ };
9900
+ var BusinessTypeBadge = ({ type, className }) => {
9901
+ const config = typeConfig3[type];
9902
+ const Icon2 = config.icon;
9903
+ return /* @__PURE__ */ jsxRuntime.jsxs(Badge, { variant: config.variant, className, children: [
9904
+ /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "w-3 h-3 mr-1" }),
9905
+ config.label
9906
+ ] });
9907
+ };
9908
+ var DetailPageLayout = ({
9909
+ title,
9910
+ description,
9911
+ cards,
9912
+ actions,
9913
+ initialEditingState = {},
9914
+ headerContent
9915
+ }) => {
9916
+ const [editingCards, setEditingCards] = React15.useState(
9917
+ initialEditingState
9918
+ );
9919
+ const toggleEdit = (cardKey) => {
9920
+ setEditingCards((prev) => ({
9921
+ ...prev,
9922
+ [cardKey]: !prev[cardKey]
9923
+ }));
9924
+ };
9925
+ Object.values(editingCards).some(Boolean);
9926
+ const isSingleCard = cards.length === 1;
9927
+ const gridClasses2 = isSingleCard ? "space-y-4 mb-6 lg:space-y-6" : "grid gap-4 mb-6 grid-cols-1 lg:grid-cols-2 lg:gap-6";
9928
+ return /* @__PURE__ */ jsxRuntime.jsx(
9929
+ PageLayout,
9930
+ {
9931
+ title,
9932
+ description,
9933
+ headerContent,
9934
+ actions: actions?.map((action) => ({
9935
+ label: action.label,
9936
+ variant: action.variant || "default",
9561
9937
  onClick: action.onClick || (() => {
9562
9938
  })
9563
9939
  })),
@@ -10724,6 +11100,36 @@ var useCounterpartyEntity = (counterparties) => {
10724
11100
  }, [counterparties]);
10725
11101
  return { counterparties: enrichedCounterparties, loading };
10726
11102
  };
11103
+ var typeConfig4 = {
11104
+ checking: {
11105
+ variant: "checking",
11106
+ label: "Checking",
11107
+ icon: lucideReact.Wallet
11108
+ },
11109
+ savings: {
11110
+ variant: "savings",
11111
+ label: "Savings",
11112
+ icon: lucideReact.PiggyBank
11113
+ },
11114
+ "zero-balance": {
11115
+ variant: "zero-balance",
11116
+ label: "Zero Balance",
11117
+ icon: lucideReact.CircleDollarSign
11118
+ },
11119
+ funding: {
11120
+ variant: "funding",
11121
+ label: "Funding",
11122
+ icon: lucideReact.Landmark
11123
+ }
11124
+ };
11125
+ var AccountTypeBadge = ({ type, className }) => {
11126
+ const config = typeConfig4[type] || typeConfig4.checking;
11127
+ const Icon2 = config.icon;
11128
+ return /* @__PURE__ */ jsxRuntime.jsxs(Badge, { variant: config.variant, className, children: [
11129
+ /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "w-3 h-3 mr-1" }),
11130
+ config.label
11131
+ ] });
11132
+ };
10727
11133
 
10728
11134
  // src/lib/mock-data/business-account-data.ts
10729
11135
  var mockBusinessAccounts = [
@@ -10733,8 +11139,12 @@ var mockBusinessAccounts = [
10733
11139
  number: "1234567890",
10734
11140
  type: "checking",
10735
11141
  status: "active",
10736
- balance: "$125,450.00",
10737
- availableBalance: "$123,450.00",
11142
+ settledBalance: 127450,
11143
+ pendingCredits: 0,
11144
+ pendingDebits: 2e3,
11145
+ fundsOnHold: 0,
11146
+ accountBalance: 125450,
11147
+ availableBalance: 123450,
10738
11148
  currency: "USD",
10739
11149
  institution: "Chase Bank",
10740
11150
  routingNumber: "021000021",
@@ -10751,8 +11161,12 @@ var mockBusinessAccounts = [
10751
11161
  number: "9876544567",
10752
11162
  type: "savings",
10753
11163
  status: "active",
10754
- balance: "$45,230.00",
10755
- availableBalance: "$45,230.00",
11164
+ settledBalance: 45230,
11165
+ pendingCredits: 0,
11166
+ pendingDebits: 0,
11167
+ fundsOnHold: 0,
11168
+ accountBalance: 45230,
11169
+ availableBalance: 45230,
10756
11170
  currency: "USD",
10757
11171
  institution: "Chase Bank",
10758
11172
  routingNumber: "021000021",
@@ -10769,8 +11183,12 @@ var mockBusinessAccounts = [
10769
11183
  number: "5555551234",
10770
11184
  type: "checking",
10771
11185
  status: "active",
10772
- balance: "$78,900.00",
10773
- availableBalance: "$75,900.00",
11186
+ settledBalance: 8e4,
11187
+ pendingCredits: 1900,
11188
+ pendingDebits: 3e3,
11189
+ fundsOnHold: 0,
11190
+ accountBalance: 78900,
11191
+ availableBalance: 75900,
10774
11192
  currency: "USD",
10775
11193
  institution: "Wells Fargo",
10776
11194
  routingNumber: "121000248",
@@ -10785,10 +11203,14 @@ var mockBusinessAccounts = [
10785
11203
  id: "acc-004",
10786
11204
  name: "Merchant Services Account",
10787
11205
  number: "4444445678",
10788
- type: "checking",
11206
+ type: "funding",
10789
11207
  status: "active",
10790
- balance: "$234,567.89",
10791
- availableBalance: "$230,000.00",
11208
+ settledBalance: 23e4,
11209
+ pendingCredits: 4567.89,
11210
+ pendingDebits: 0,
11211
+ fundsOnHold: 4567.89,
11212
+ accountBalance: 234567.89,
11213
+ availableBalance: 23e4,
10792
11214
  currency: "USD",
10793
11215
  institution: "Bank of America",
10794
11216
  routingNumber: "026009593",
@@ -10805,8 +11227,12 @@ var mockBusinessAccounts = [
10805
11227
  number: "7777779012",
10806
11228
  type: "savings",
10807
11229
  status: "active",
10808
- balance: "$500,000.00",
10809
- availableBalance: "$500,000.00",
11230
+ settledBalance: 5e5,
11231
+ pendingCredits: 0,
11232
+ pendingDebits: 0,
11233
+ fundsOnHold: 0,
11234
+ accountBalance: 5e5,
11235
+ availableBalance: 5e5,
10810
11236
  currency: "USD",
10811
11237
  institution: "Citibank",
10812
11238
  routingNumber: "021000089",
@@ -10821,10 +11247,14 @@ var mockBusinessAccounts = [
10821
11247
  id: "acc-006",
10822
11248
  name: "Operating Account",
10823
11249
  number: "3333333456",
10824
- type: "checking",
11250
+ type: "zero-balance",
10825
11251
  status: "inactive",
10826
- balance: "$0.00",
10827
- availableBalance: "$0.00",
11252
+ settledBalance: 0,
11253
+ pendingCredits: 0,
11254
+ pendingDebits: 0,
11255
+ fundsOnHold: 0,
11256
+ accountBalance: 0,
11257
+ availableBalance: 0,
10828
11258
  currency: "USD",
10829
11259
  institution: "Wells Fargo",
10830
11260
  routingNumber: "121000248",
@@ -10892,6 +11322,12 @@ var Accounts = () => {
10892
11322
  title: "Account Number",
10893
11323
  sortable: true
10894
11324
  },
11325
+ {
11326
+ key: "type",
11327
+ title: "Type",
11328
+ sortable: true,
11329
+ render: (value, row) => /* @__PURE__ */ jsxRuntime.jsx(AccountTypeBadge, { type: row.type })
11330
+ },
10895
11331
  {
10896
11332
  key: "name",
10897
11333
  title: "Account Name",
@@ -10915,16 +11351,18 @@ var Accounts = () => {
10915
11351
  }
10916
11352
  },
10917
11353
  {
10918
- key: "balance",
11354
+ key: "accountBalance",
10919
11355
  title: "Account Balance",
10920
11356
  sortable: true,
10921
- align: "right"
11357
+ align: "right",
11358
+ render: (value) => formatCurrency(value)
10922
11359
  },
10923
11360
  {
10924
11361
  key: "availableBalance",
10925
11362
  title: "Available Balance",
10926
11363
  sortable: true,
10927
- align: "right"
11364
+ align: "right",
11365
+ render: (value) => formatCurrency(value)
10928
11366
  },
10929
11367
  {
10930
11368
  key: "status",
@@ -10936,11 +11374,6 @@ var Accounts = () => {
10936
11374
  key: "created",
10937
11375
  title: "Create Date",
10938
11376
  sortable: true
10939
- },
10940
- {
10941
- key: "modified",
10942
- title: "Modify Date",
10943
- sortable: true
10944
11377
  }
10945
11378
  ];
10946
11379
  const startIndex = (currentPage - 1) * pageSize;
@@ -11100,7 +11533,8 @@ var AccountDetail = () => {
11100
11533
  PageLayout,
11101
11534
  {
11102
11535
  title: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
11103
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: account.name }),
11536
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: account.number }),
11537
+ /* @__PURE__ */ jsxRuntime.jsx(AccountTypeBadge, { type: account.type }),
11104
11538
  /* @__PURE__ */ jsxRuntime.jsx(
11105
11539
  EditableInfoField,
11106
11540
  {
@@ -11144,7 +11578,7 @@ var AccountDetail = () => {
11144
11578
  /* @__PURE__ */ jsxRuntime.jsx(
11145
11579
  EditableFormCard,
11146
11580
  {
11147
- title: "Account Information",
11581
+ title: account.name,
11148
11582
  variant: "subtle",
11149
11583
  isEditing: form.isEditing,
11150
11584
  onToggleEdit: form.handleToggleEdit,
@@ -11152,20 +11586,42 @@ var AccountDetail = () => {
11152
11586
  onCancel: form.handleCancel,
11153
11587
  viewContent: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11154
11588
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-6 p-6 rounded-lg bg-gradient-to-br from-primary/10 via-primary/5 to-background border border-primary/20", children: [
11155
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mb-4", children: [
11156
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Wallet, { className: "h-4 w-4 text-primary" }),
11157
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: account.number }),
11158
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "\u2022" }),
11159
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground capitalize", children: account.type })
11160
- ] }),
11161
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-end gap-8", children: [
11589
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-end gap-8 mb-6", children: [
11162
11590
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11163
11591
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-medium text-muted-foreground mb-1", children: "Account Balance" }),
11164
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-3xl font-bold text-foreground tracking-tight", children: account.balance })
11592
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-3xl font-bold text-foreground tracking-tight", children: formatCurrency(account.accountBalance) })
11165
11593
  ] }),
11166
11594
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11167
11595
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-medium text-muted-foreground mb-1", children: "Available Balance" }),
11168
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-3xl font-bold text-foreground tracking-tight", children: account.balance })
11596
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-3xl font-bold text-foreground tracking-tight", children: formatCurrency(account.availableBalance) })
11597
+ ] })
11598
+ ] }),
11599
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t border-border/50 mb-4" }),
11600
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-4", children: [
11601
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11602
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Settled Balance" }),
11603
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-lg font-semibold", children: formatCurrency(account.settledBalance) })
11604
+ ] }),
11605
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11606
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Pending Credits" }),
11607
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-lg font-semibold text-success", children: [
11608
+ "+",
11609
+ formatCurrency(account.pendingCredits)
11610
+ ] })
11611
+ ] }),
11612
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11613
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Pending Debits" }),
11614
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-lg font-semibold text-destructive", children: [
11615
+ "-",
11616
+ formatCurrency(account.pendingDebits)
11617
+ ] })
11618
+ ] }),
11619
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11620
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Funds on Hold" }),
11621
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: cn(
11622
+ "text-lg font-semibold",
11623
+ account.fundsOnHold > 0 && "text-warning"
11624
+ ), children: formatCurrency(account.fundsOnHold) })
11169
11625
  ] })
11170
11626
  ] })
11171
11627
  ] }),
@@ -11237,20 +11693,42 @@ var AccountDetail = () => {
11237
11693
  ] }),
11238
11694
  editContent: /* @__PURE__ */ jsxRuntime.jsx(FormProvider, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11239
11695
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-6 p-6 rounded-lg bg-gradient-to-br from-primary/10 via-primary/5 to-background border border-primary/20", children: [
11240
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mb-4", children: [
11241
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Wallet, { className: "h-4 w-4 text-primary" }),
11242
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: account.number }),
11243
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "\u2022" }),
11244
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground capitalize", children: account.type })
11245
- ] }),
11246
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-end gap-8", children: [
11696
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-end gap-8 mb-6", children: [
11247
11697
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11248
11698
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-medium text-muted-foreground mb-1", children: "Account Balance" }),
11249
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-3xl font-bold text-foreground tracking-tight", children: account.balance })
11699
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-3xl font-bold text-foreground tracking-tight", children: formatCurrency(account.accountBalance) })
11250
11700
  ] }),
11251
11701
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11252
11702
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-medium text-muted-foreground mb-1", children: "Available Balance" }),
11253
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-3xl font-bold text-foreground tracking-tight", children: account.balance })
11703
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-3xl font-bold text-foreground tracking-tight", children: formatCurrency(account.availableBalance) })
11704
+ ] })
11705
+ ] }),
11706
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t border-border/50 mb-4" }),
11707
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-4", children: [
11708
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11709
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Settled Balance" }),
11710
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-lg font-semibold", children: formatCurrency(account.settledBalance) })
11711
+ ] }),
11712
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11713
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Pending Credits" }),
11714
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-lg font-semibold text-success", children: [
11715
+ "+",
11716
+ formatCurrency(account.pendingCredits)
11717
+ ] })
11718
+ ] }),
11719
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11720
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Pending Debits" }),
11721
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-lg font-semibold text-destructive", children: [
11722
+ "-",
11723
+ formatCurrency(account.pendingDebits)
11724
+ ] })
11725
+ ] }),
11726
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11727
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Funds on Hold" }),
11728
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: cn(
11729
+ "text-lg font-semibold",
11730
+ account.fundsOnHold > 0 && "text-warning"
11731
+ ), children: formatCurrency(account.fundsOnHold) })
11254
11732
  ] })
11255
11733
  ] })
11256
11734
  ] }),
@@ -14418,6 +14896,266 @@ var mockTransactions = [
14418
14896
  processingStatus: "MANUAL_REVIEW",
14419
14897
  updated: "2025-09-30 16:10",
14420
14898
  isInbound: false
14899
+ },
14900
+ {
14901
+ id: "9",
14902
+ created: "2025-09-30 14:20",
14903
+ accountNumber: "112233445566",
14904
+ amount: 15e3,
14905
+ customer: "Sunrise Ventures LLC",
14906
+ counterparty: "Michael Chen",
14907
+ description: "Investment Deposit",
14908
+ transactionType: "ACH Credit",
14909
+ status: "POSTED",
14910
+ processingStatus: "CONFIRMED",
14911
+ updated: "2025-09-30 14:45",
14912
+ isInbound: true,
14913
+ achDetails: {
14914
+ secCode: "CCD",
14915
+ traceNumber: "091000019876543",
14916
+ companyName: "Sunrise Ventures LLC",
14917
+ companyId: "1234567890",
14918
+ effectiveDate: "2025-09-30"
14919
+ }
14920
+ },
14921
+ {
14922
+ id: "10",
14923
+ created: "2025-09-30 12:30",
14924
+ accountNumber: "998877665544",
14925
+ amount: -8500,
14926
+ customer: "Metro Services Inc",
14927
+ counterparty: "Jennifer Lopez",
14928
+ description: "Utility Payment",
14929
+ transactionType: "ACH Debit",
14930
+ status: "PENDING",
14931
+ processingStatus: "SUBMITTED",
14932
+ updated: "2025-09-30 12:45",
14933
+ isInbound: false,
14934
+ achDetails: {
14935
+ secCode: "PPD",
14936
+ traceNumber: "091000019876544",
14937
+ companyName: "Metro Services Inc",
14938
+ companyId: "9876543210",
14939
+ effectiveDate: "2025-10-01"
14940
+ }
14941
+ },
14942
+ {
14943
+ id: "11",
14944
+ created: "2025-09-30 11:00",
14945
+ accountNumber: "445566778899",
14946
+ amount: 25e4,
14947
+ customer: "Global Partners AG",
14948
+ counterparty: "Robert Fischer",
14949
+ description: "International Transfer - EUR",
14950
+ transactionType: "Wire International Credit",
14951
+ status: "POSTED",
14952
+ processingStatus: "CONFIRMED",
14953
+ updated: "2025-09-30 11:30",
14954
+ isInbound: true,
14955
+ wireDetails: {
14956
+ beneficiaryName: "Acme Holdings Ltd",
14957
+ beneficiaryAccountNumber: "****7890",
14958
+ beneficiaryBankName: "Deutsche Bank",
14959
+ beneficiaryBankSwift: "DEUTDEFF",
14960
+ originatorName: "Global Partners AG",
14961
+ originatorAccountNumber: "****4321",
14962
+ originatorBankName: "UBS Switzerland",
14963
+ originatorBankSwift: "UBSWCHZH",
14964
+ imad: "20250930MMQFMP030000987",
14965
+ omad: "20250930MMQFMP030000988"
14966
+ }
14967
+ },
14968
+ {
14969
+ id: "12",
14970
+ created: "2025-09-30 09:45",
14971
+ accountNumber: "778899001122",
14972
+ amount: -175e3,
14973
+ customer: "Tokyo Industries Co",
14974
+ counterparty: "Amanda White",
14975
+ description: "Supplier Payment - JPY",
14976
+ transactionType: "Wire International Debit",
14977
+ status: "PENDING",
14978
+ processingStatus: "MANUAL_REVIEW",
14979
+ updated: "2025-09-30 10:00",
14980
+ isInbound: false,
14981
+ wireDetails: {
14982
+ beneficiaryName: "Tokyo Industries Co Ltd",
14983
+ beneficiaryAccountNumber: "****2468",
14984
+ beneficiaryBankName: "MUFG Bank",
14985
+ beneficiaryBankSwift: "BOABORJP",
14986
+ originatorName: "US Tech Corp",
14987
+ originatorAccountNumber: "****1357",
14988
+ originatorBankName: "Chase Bank",
14989
+ originatorBankSwift: "CHASUS33",
14990
+ imad: "20250930MMQFMP030000989",
14991
+ omad: "20250930MMQFMP030000990"
14992
+ }
14993
+ },
14994
+ {
14995
+ id: "13",
14996
+ created: "2025-09-30 08:20",
14997
+ accountNumber: "334455667788",
14998
+ amount: -2500,
14999
+ customer: "Quick Loans LLC",
15000
+ counterparty: "David Brown",
15001
+ description: "Returned Payment - Insufficient Funds",
15002
+ transactionType: "ACH Return",
15003
+ status: "FAILED",
15004
+ processingStatus: "CONFIRMED",
15005
+ updated: "2025-09-30 08:45",
15006
+ isInbound: false,
15007
+ achDetails: {
15008
+ secCode: "PPD",
15009
+ traceNumber: "091000019876545",
15010
+ companyName: "Quick Loans LLC",
15011
+ companyId: "5678901234",
15012
+ effectiveDate: "2025-09-30",
15013
+ returnCode: "R01",
15014
+ returnReason: "Insufficient Funds"
15015
+ }
15016
+ },
15017
+ {
15018
+ id: "14",
15019
+ created: "2025-09-29 16:30",
15020
+ accountNumber: "112244668800",
15021
+ amount: 5e4,
15022
+ customer: "National Corp",
15023
+ counterparty: "Lisa Martinez",
15024
+ description: "Quarterly Dividend Payment",
15025
+ transactionType: "Wire Domestic Credit",
15026
+ status: "POSTED",
15027
+ processingStatus: "CONFIRMED",
15028
+ updated: "2025-09-29 17:00",
15029
+ isInbound: true,
15030
+ wireDetails: {
15031
+ beneficiaryName: "Main Street Holdings",
15032
+ beneficiaryAccountNumber: "****9876",
15033
+ beneficiaryBankName: "Wells Fargo",
15034
+ beneficiaryBankSwift: "WFBIUS6S",
15035
+ originatorName: "National Corp",
15036
+ originatorAccountNumber: "****5432",
15037
+ originatorBankName: "Bank of America",
15038
+ originatorBankSwift: "BOFAUS3N",
15039
+ imad: "20250929MMQFMP030000991",
15040
+ omad: "20250929MMQFMP030000992"
15041
+ }
15042
+ },
15043
+ {
15044
+ id: "15",
15045
+ created: "2025-09-29 14:45",
15046
+ accountNumber: "556677889911",
15047
+ amount: -35e3,
15048
+ customer: "Sunset Holdings",
15049
+ counterparty: "James Wilson",
15050
+ description: "Real Estate Deposit - Cancelled",
15051
+ transactionType: "Wire Domestic Debit",
15052
+ status: "CANCELLED",
15053
+ processingStatus: "INITIATED",
15054
+ updated: "2025-09-29 15:00",
15055
+ isInbound: false
15056
+ },
15057
+ {
15058
+ id: "16",
15059
+ created: "2025-09-29 12:00",
15060
+ accountNumber: "998877665533",
15061
+ amount: 12750,
15062
+ customer: "Payroll Services Inc",
15063
+ counterparty: "Karen Davis",
15064
+ description: "Payroll Batch - Week 39",
15065
+ transactionType: "Ach Originator Credit",
15066
+ status: "POSTED",
15067
+ processingStatus: "CONFIRMED",
15068
+ updated: "2025-09-29 12:30",
15069
+ isInbound: true,
15070
+ achDetails: {
15071
+ secCode: "CCD",
15072
+ traceNumber: "091000019876546",
15073
+ companyName: "Payroll Services Inc",
15074
+ companyId: "3456789012",
15075
+ effectiveDate: "2025-09-29"
15076
+ }
15077
+ },
15078
+ {
15079
+ id: "17",
15080
+ created: "2025-09-29 10:15",
15081
+ accountNumber: "223344556688",
15082
+ amount: -6800,
15083
+ customer: "Utility Corp",
15084
+ counterparty: "Thomas Anderson",
15085
+ description: "Monthly Service Charge",
15086
+ transactionType: "Ach Originator Debit",
15087
+ status: "PENDING",
15088
+ processingStatus: "CUSTOMER_REVIEW",
15089
+ updated: "2025-09-29 10:30",
15090
+ isInbound: false,
15091
+ achDetails: {
15092
+ secCode: "PPD",
15093
+ traceNumber: "091000019876547",
15094
+ companyName: "Utility Corp",
15095
+ companyId: "7890123456",
15096
+ effectiveDate: "2025-09-30"
15097
+ }
15098
+ },
15099
+ {
15100
+ id: "18",
15101
+ created: "2025-09-29 08:30",
15102
+ accountNumber: "445566778800",
15103
+ amount: 5e5,
15104
+ customer: "European Trade Ltd",
15105
+ counterparty: "Christopher Lee",
15106
+ description: "Large Wire Transfer - EU Import",
15107
+ transactionType: "Wire International Credit",
15108
+ status: "PENDING",
15109
+ processingStatus: "SENT",
15110
+ updated: "2025-09-29 09:00",
15111
+ isInbound: true,
15112
+ wireDetails: {
15113
+ beneficiaryName: "American Import Co",
15114
+ beneficiaryAccountNumber: "****3698",
15115
+ beneficiaryBankName: "Citibank",
15116
+ beneficiaryBankSwift: "CITIUS33",
15117
+ originatorName: "European Trade Ltd",
15118
+ originatorAccountNumber: "****7412",
15119
+ originatorBankName: "Barclays UK",
15120
+ originatorBankSwift: "BABORJPJ",
15121
+ imad: "20250929MMQFMP030000993",
15122
+ omad: "20250929MMQFMP030000994"
15123
+ }
15124
+ },
15125
+ {
15126
+ id: "19",
15127
+ created: "2025-09-28 16:45",
15128
+ accountNumber: "667788990011",
15129
+ amount: 3200,
15130
+ customer: "Small Business LLC",
15131
+ counterparty: "Nancy Taylor",
15132
+ description: "Online Payment Receipt",
15133
+ transactionType: "ACH Credit",
15134
+ status: "POSTED",
15135
+ processingStatus: "CONFIRMED",
15136
+ updated: "2025-09-28 17:00",
15137
+ isInbound: true,
15138
+ achDetails: {
15139
+ secCode: "WEB",
15140
+ traceNumber: "091000019876548",
15141
+ companyName: "Small Business LLC",
15142
+ companyId: "2345678901",
15143
+ effectiveDate: "2025-09-28"
15144
+ }
15145
+ },
15146
+ {
15147
+ id: "20",
15148
+ created: "2025-09-28 14:20",
15149
+ accountNumber: "889900112233",
15150
+ amount: -45,
15151
+ customer: "Patricia Moore",
15152
+ counterparty: "Bank Services",
15153
+ description: "Wire Transfer Fee",
15154
+ transactionType: "Fee Wire Transaction",
15155
+ status: "POSTED",
15156
+ processingStatus: "CONFIRMED",
15157
+ updated: "2025-09-28 14:20",
15158
+ isInbound: false
14421
15159
  }
14422
15160
  ];
14423
15161
  var mockTransactionTimeline = [
@@ -14460,32 +15198,93 @@ var mockTransactionTimeline = [
14460
15198
  timestamp: "2025-10-01 00:19:45"
14461
15199
  }
14462
15200
  ];
15201
+ var defaultFilters2 = {
15202
+ originalFileName: "",
15203
+ requesterIpAddress: "",
15204
+ requesterUsername: "",
15205
+ showAchNoc: false,
15206
+ excludeWire: false,
15207
+ excludeAch: false,
15208
+ wireFileHandle: "",
15209
+ direction: "",
15210
+ counterpartyId: "",
15211
+ customerId: "",
15212
+ settlementFileName: "",
15213
+ isInbound: false,
15214
+ accountNumber: "",
15215
+ processingStatus: [],
15216
+ beginDate: void 0,
15217
+ endDate: void 0,
15218
+ postDateStart: void 0,
15219
+ postDateEnd: void 0,
15220
+ maxAmount: "",
15221
+ minAmount: "",
15222
+ productId: "",
15223
+ paymentId: "",
15224
+ transactionStatus: [],
15225
+ transactionType: []
15226
+ };
15227
+ var filterOptions = {
15228
+ transactionTypes: [
15229
+ { value: "ACH Credit", label: "ACH Credit" },
15230
+ { value: "ACH Debit", label: "ACH Debit" },
15231
+ { value: "ACH Return", label: "ACH Return" },
15232
+ { value: "Ach Originator Credit", label: "ACH Originator Credit" },
15233
+ { value: "Ach Originator Debit", label: "ACH Originator Debit" },
15234
+ { value: "Wire Domestic Credit", label: "Wire Domestic Credit" },
15235
+ { value: "Wire Domestic Debit", label: "Wire Domestic Debit" },
15236
+ { value: "Wire International Credit", label: "Wire International Credit" },
15237
+ { value: "Wire International Debit", label: "Wire International Debit" },
15238
+ { value: "Fee Ach Transaction", label: "ACH Fee" },
15239
+ { value: "Fee Wire Transaction", label: "Wire Fee" }
15240
+ ],
15241
+ transactionStatuses: [
15242
+ { value: "PENDING", label: "Pending" },
15243
+ { value: "POSTED", label: "Posted" },
15244
+ { value: "FAILED", label: "Failed" },
15245
+ { value: "CANCELLED", label: "Cancelled" }
15246
+ ],
15247
+ processingStatuses: [
15248
+ { value: "INITIATED", label: "Initiated" },
15249
+ { value: "SUBMITTED", label: "Submitted" },
15250
+ { value: "CUSTOMER_REVIEW", label: "Customer Review" },
15251
+ { value: "MANUAL_REVIEW", label: "Manual Review" },
15252
+ { value: "SENT", label: "Sent" },
15253
+ { value: "CONFIRMED", label: "Confirmed" }
15254
+ ],
15255
+ directions: [
15256
+ { value: "inbound", label: "Inbound" },
15257
+ { value: "outbound", label: "Outbound" }
15258
+ ],
15259
+ products: [
15260
+ { value: "ach", label: "ACH" },
15261
+ { value: "wire", label: "Wire" }
15262
+ ]
15263
+ };
14463
15264
  var TransactionHistory = () => {
14464
15265
  const navigate = reactRouterDom.useNavigate();
14465
15266
  const [sortBy, setSortBy] = React15.useState("created");
14466
15267
  const [sortDirection, setSortDirection] = React15.useState("desc");
14467
- const [filters, setFilters] = React15.useState({
14468
- accountNumber: "",
14469
- product: "",
14470
- customerId: "",
14471
- counterpartyId: "",
14472
- settlementFileName: "",
14473
- originalFileName: "",
14474
- requesterIpAddress: "",
14475
- requesterUsername: "",
14476
- wireFileHandle: "",
14477
- paymentId: "",
14478
- transactionType: "",
14479
- transactionStatus: "",
14480
- processingStatus: "",
14481
- direction: "",
14482
- minAmount: "",
14483
- maxAmount: "",
14484
- creationDateStart: void 0,
14485
- creationDateEnd: void 0,
14486
- postDateStart: void 0,
14487
- postDateEnd: void 0
14488
- });
15268
+ const [filters, setFilters] = React15.useState(defaultFilters2);
15269
+ const [isLoading, setIsLoading] = React15.useState(true);
15270
+ const [error, setError] = React15.useState(null);
15271
+ const loadTransactions = React15.useCallback(async () => {
15272
+ setIsLoading(true);
15273
+ setError(null);
15274
+ try {
15275
+ await new Promise((resolve) => setTimeout(resolve, 800));
15276
+ } catch (err) {
15277
+ setError(err instanceof Error ? err.message : "Failed to load transactions");
15278
+ } finally {
15279
+ setIsLoading(false);
15280
+ }
15281
+ }, []);
15282
+ React15.useEffect(() => {
15283
+ loadTransactions();
15284
+ }, [loadTransactions]);
15285
+ const handleRetry = React15.useCallback(() => {
15286
+ loadTransactions();
15287
+ }, [loadTransactions]);
14489
15288
  const filteredTransactions = React15.useMemo(() => {
14490
15289
  let filtered = [...mockTransactions];
14491
15290
  if (filters.accountNumber) {
@@ -14493,11 +15292,11 @@ var TransactionHistory = () => {
14493
15292
  (t) => t.accountNumber.toLowerCase().includes(filters.accountNumber.toLowerCase())
14494
15293
  );
14495
15294
  }
14496
- if (filters.transactionType) {
14497
- filtered = filtered.filter((t) => t.transactionType === filters.transactionType);
15295
+ if (filters.transactionType && filters.transactionType.length > 0) {
15296
+ filtered = filtered.filter((t) => filters.transactionType.includes(t.transactionType));
14498
15297
  }
14499
- if (filters.transactionStatus) {
14500
- filtered = filtered.filter((t) => t.status === filters.transactionStatus);
15298
+ if (filters.transactionStatus && filters.transactionStatus.length > 0) {
15299
+ filtered = filtered.filter((t) => filters.transactionStatus.includes(t.status));
14501
15300
  }
14502
15301
  if (filters.minAmount) {
14503
15302
  const minAmount = parseFloat(filters.minAmount.replace(/[^0-9.-]/g, ""));
@@ -14511,6 +15310,12 @@ var TransactionHistory = () => {
14511
15310
  filtered = filtered.filter((t) => t.amount <= maxAmount);
14512
15311
  }
14513
15312
  }
15313
+ if (filters.excludeWire) {
15314
+ filtered = filtered.filter((t) => !t.transactionType.toLowerCase().includes("wire"));
15315
+ }
15316
+ if (filters.excludeAch) {
15317
+ filtered = filtered.filter((t) => !t.transactionType.toLowerCase().includes("ach"));
15318
+ }
14514
15319
  return filtered;
14515
15320
  }, [filters]);
14516
15321
  const sortedTransactions = React15.useMemo(() => {
@@ -14527,28 +15332,7 @@ var TransactionHistory = () => {
14527
15332
  setFilters((prev) => ({ ...prev, [field]: value }));
14528
15333
  }, []);
14529
15334
  const handleResetFilters = React15.useCallback(() => {
14530
- setFilters({
14531
- accountNumber: "",
14532
- product: "",
14533
- customerId: "",
14534
- counterpartyId: "",
14535
- settlementFileName: "",
14536
- originalFileName: "",
14537
- requesterIpAddress: "",
14538
- requesterUsername: "",
14539
- wireFileHandle: "",
14540
- paymentId: "",
14541
- transactionType: "",
14542
- transactionStatus: "",
14543
- processingStatus: "",
14544
- direction: "",
14545
- minAmount: "",
14546
- maxAmount: "",
14547
- creationDateStart: void 0,
14548
- creationDateEnd: void 0,
14549
- postDateStart: void 0,
14550
- postDateEnd: void 0
14551
- });
15335
+ setFilters(defaultFilters2);
14552
15336
  }, []);
14553
15337
  const handleApplyFilters = React15.useCallback(() => {
14554
15338
  console.log("Applying filters:", filters);
@@ -14564,13 +15348,6 @@ var TransactionHistory = () => {
14564
15348
  const handleRowClick = React15.useCallback((transaction) => {
14565
15349
  navigate(`/transactions/${transaction.id}`);
14566
15350
  }, [navigate]);
14567
- const formatCurrency4 = (value) => {
14568
- return new Intl.NumberFormat("en-US", {
14569
- style: "currency",
14570
- currency: "USD",
14571
- minimumFractionDigits: 2
14572
- }).format(value);
14573
- };
14574
15351
  const columns3 = React15.useMemo(() => [
14575
15352
  {
14576
15353
  key: "created",
@@ -14587,7 +15364,7 @@ var TransactionHistory = () => {
14587
15364
  title: "Amount",
14588
15365
  sortable: true,
14589
15366
  align: "right",
14590
- render: (value) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: value < 0 ? "text-destructive" : "", children: formatCurrency4(value) })
15367
+ render: (value) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: value < 0 ? "text-destructive" : "", children: formatCurrency(value) })
14591
15368
  },
14592
15369
  {
14593
15370
  key: "customer",
@@ -14641,9 +15418,13 @@ var TransactionHistory = () => {
14641
15418
  {
14642
15419
  table,
14643
15420
  filters,
15421
+ filterOptions,
14644
15422
  onFilterChange: handleFilterChange,
14645
15423
  onResetFilters: handleResetFilters,
14646
- onApplyFilters: handleApplyFilters
15424
+ onApplyFilters: handleApplyFilters,
15425
+ isLoading,
15426
+ error,
15427
+ onRetry: handleRetry
14647
15428
  }
14648
15429
  );
14649
15430
  };
@@ -15127,181 +15908,6 @@ function NewTransaction() {
15127
15908
  }
15128
15909
  );
15129
15910
  }
15130
- var cancelTransactionSchema = zod.z.object({
15131
- reason: zod.z.string().min(1, "Reason is required").max(500, "Reason must be less than 500 characters")
15132
- });
15133
- var returnTransactionSchema = zod.z.object({
15134
- reasonCode: zod.z.string().min(1, "Reason code is required")
15135
- });
15136
- var CancelTransactionDialog = ({
15137
- transactionId,
15138
- open,
15139
- onOpenChange,
15140
- onCancel
15141
- }) => {
15142
- const { toast: toast6 } = useToast();
15143
- const {
15144
- register,
15145
- handleSubmit,
15146
- formState: { errors, isSubmitting },
15147
- reset
15148
- } = useFormWithEditState({
15149
- schema: cancelTransactionSchema,
15150
- defaultValues: {
15151
- reason: ""
15152
- }
15153
- });
15154
- const onSubmit = async (data) => {
15155
- try {
15156
- await onCancel(data);
15157
- toast6({
15158
- title: "Transaction Cancelled",
15159
- description: `Transaction ${transactionId} has been cancelled successfully.`
15160
- });
15161
- reset();
15162
- onOpenChange(false);
15163
- } catch (error) {
15164
- toast6({
15165
- title: "Error",
15166
- description: "Failed to cancel the transaction. Please try again.",
15167
- variant: "destructive"
15168
- });
15169
- }
15170
- };
15171
- const handleClose = () => {
15172
- reset();
15173
- onOpenChange(false);
15174
- };
15175
- return /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "sm:max-w-md", children: [
15176
- /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { children: [
15177
- /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: "Cancel Transaction" }),
15178
- /* @__PURE__ */ jsxRuntime.jsxs(DialogDescription, { children: [
15179
- "Please provide a reason for cancelling transaction ",
15180
- transactionId,
15181
- "."
15182
- ] })
15183
- ] }),
15184
- /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit(onSubmit), className: "space-y-4", children: [
15185
- /* @__PURE__ */ jsxRuntime.jsx(
15186
- EnhancedTextarea,
15187
- {
15188
- label: "Cancellation Reason",
15189
- placeholder: "Enter the reason for cancellation...",
15190
- error: errors.reason?.message,
15191
- ...register("reason")
15192
- }
15193
- ),
15194
- /* @__PURE__ */ jsxRuntime.jsxs(DialogFooter, { className: "gap-2 sm:gap-0", children: [
15195
- /* @__PURE__ */ jsxRuntime.jsx(
15196
- Button,
15197
- {
15198
- type: "button",
15199
- variant: "outline",
15200
- onClick: handleClose,
15201
- disabled: isSubmitting,
15202
- children: "Close"
15203
- }
15204
- ),
15205
- /* @__PURE__ */ jsxRuntime.jsx(
15206
- Button,
15207
- {
15208
- type: "submit",
15209
- variant: "destructive",
15210
- disabled: isSubmitting,
15211
- children: isSubmitting ? "Cancelling..." : "Cancel Transaction"
15212
- }
15213
- )
15214
- ] })
15215
- ] })
15216
- ] }) });
15217
- };
15218
- function ReturnTransactionDialog({
15219
- transactionId,
15220
- open,
15221
- onOpenChange,
15222
- onReturn,
15223
- reasonCodes
15224
- }) {
15225
- const {
15226
- watch,
15227
- setValue,
15228
- handleSave,
15229
- handleCancel,
15230
- isLoading,
15231
- formState: { errors }
15232
- } = useFormWithEditState({
15233
- schema: returnTransactionSchema,
15234
- initialEditing: true,
15235
- onSave: async (data) => {
15236
- try {
15237
- await onReturn(data);
15238
- toast({
15239
- title: "Transaction returned",
15240
- description: `Transaction #${transactionId} has been returned successfully.`
15241
- });
15242
- onOpenChange(false);
15243
- } catch (error) {
15244
- toast({
15245
- title: "Error",
15246
- description: "Failed to return transaction. Please try again.",
15247
- variant: "destructive"
15248
- });
15249
- throw error;
15250
- }
15251
- },
15252
- onCancel: () => {
15253
- onOpenChange(false);
15254
- }
15255
- });
15256
- const reasonCode = watch("reasonCode");
15257
- const selectOptions = reasonCodes.map((code) => ({
15258
- value: code.value,
15259
- label: code.label
15260
- }));
15261
- return /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "sm:max-w-[425px]", children: [
15262
- /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { children: [
15263
- /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: "Return Transaction" }),
15264
- /* @__PURE__ */ jsxRuntime.jsxs(DialogDescription, { children: [
15265
- "Select a reason code to return transaction #",
15266
- transactionId,
15267
- "."
15268
- ] })
15269
- ] }),
15270
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
15271
- EnhancedSelect,
15272
- {
15273
- label: "Reason Code",
15274
- placeholder: "Select a reason code",
15275
- options: selectOptions,
15276
- value: reasonCode || "",
15277
- onValueChange: (value) => setValue("reasonCode", value),
15278
- error: errors.reasonCode?.message
15279
- }
15280
- ) }),
15281
- /* @__PURE__ */ jsxRuntime.jsxs(DialogFooter, { children: [
15282
- /* @__PURE__ */ jsxRuntime.jsx(
15283
- Button,
15284
- {
15285
- type: "button",
15286
- variant: "outline",
15287
- onClick: handleCancel,
15288
- disabled: isLoading,
15289
- children: "Cancel"
15290
- }
15291
- ),
15292
- /* @__PURE__ */ jsxRuntime.jsx(
15293
- Button,
15294
- {
15295
- type: "button",
15296
- variant: "destructive",
15297
- onClick: handleSave,
15298
- disabled: isLoading || !reasonCode,
15299
- children: isLoading ? "Returning..." : "Return Transaction"
15300
- }
15301
- )
15302
- ] })
15303
- ] }) });
15304
- }
15305
15911
  var returnReasonCodes = [
15306
15912
  { value: "R01", label: "R01 - Insufficient Funds" },
15307
15913
  { value: "R02", label: "R02 - Account Closed" },
@@ -15319,10 +15925,28 @@ var TransactionDetail = () => {
15319
15925
  const navigate = reactRouterDom.useNavigate();
15320
15926
  const [isCancelDialogOpen, setIsCancelDialogOpen] = React15.useState(false);
15321
15927
  const [isReturnDialogOpen, setIsReturnDialogOpen] = React15.useState(false);
15322
- const transaction = React15.useMemo(
15323
- () => mockTransactions.find((t) => t.id === id),
15324
- [id]
15325
- );
15928
+ const [isLoading, setIsLoading] = React15.useState(true);
15929
+ const [error, setError] = React15.useState(null);
15930
+ const [transaction, setTransaction] = React15.useState(null);
15931
+ const loadTransaction = React15.useCallback(async () => {
15932
+ setIsLoading(true);
15933
+ setError(null);
15934
+ try {
15935
+ await new Promise((resolve) => setTimeout(resolve, 600));
15936
+ const found = mockTransactions.find((t) => t.id === id);
15937
+ setTransaction(found || null);
15938
+ } catch (err) {
15939
+ setError(err instanceof Error ? err.message : "Failed to load transaction");
15940
+ } finally {
15941
+ setIsLoading(false);
15942
+ }
15943
+ }, [id]);
15944
+ React15.useEffect(() => {
15945
+ loadTransaction();
15946
+ }, [loadTransaction]);
15947
+ const handleRetry = React15.useCallback(() => {
15948
+ loadTransaction();
15949
+ }, [loadTransaction]);
15326
15950
  const isWireTransfer = React15.useMemo(
15327
15951
  () => transaction?.transactionType.toLowerCase().includes("wire") ?? false,
15328
15952
  [transaction?.transactionType]
@@ -15372,7 +15996,7 @@ var TransactionDetail = () => {
15372
15996
  const handleProductClick = React15.useCallback((productId) => {
15373
15997
  console.log("Navigate to product:", productId);
15374
15998
  }, []);
15375
- if (!transaction) {
15999
+ if (!isLoading && !error && !transaction) {
15376
16000
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "container mx-auto px-4 py-8", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center", children: [
15377
16001
  /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-2xl font-bold mb-2", children: "Transaction Not Found" }),
15378
16002
  /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted-foreground mb-4", children: [
@@ -15399,28 +16023,33 @@ var TransactionDetail = () => {
15399
16023
  onCustomerClick: handleCustomerClick,
15400
16024
  onCounterpartyClick: handleCounterpartyClick,
15401
16025
  onOFACClick: handleOFACClick,
15402
- onProductClick: handleProductClick
16026
+ onProductClick: handleProductClick,
16027
+ isLoading,
16028
+ error,
16029
+ onRetry: handleRetry
15403
16030
  }
15404
16031
  ),
15405
- /* @__PURE__ */ jsxRuntime.jsx(
15406
- CancelTransactionDialog,
15407
- {
15408
- transactionId: transaction.id,
15409
- open: isCancelDialogOpen,
15410
- onOpenChange: setIsCancelDialogOpen,
15411
- onCancel: handleCancelTransaction
15412
- }
15413
- ),
15414
- /* @__PURE__ */ jsxRuntime.jsx(
15415
- ReturnTransactionDialog,
15416
- {
15417
- transactionId: transaction.id,
15418
- open: isReturnDialogOpen,
15419
- onOpenChange: setIsReturnDialogOpen,
15420
- onReturn: handleReturnTransaction,
15421
- reasonCodes: returnReasonCodes
15422
- }
15423
- )
16032
+ transaction && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
16033
+ /* @__PURE__ */ jsxRuntime.jsx(
16034
+ CancelTransactionDialog,
16035
+ {
16036
+ transactionId: transaction.id,
16037
+ open: isCancelDialogOpen,
16038
+ onOpenChange: setIsCancelDialogOpen,
16039
+ onCancel: handleCancelTransaction
16040
+ }
16041
+ ),
16042
+ /* @__PURE__ */ jsxRuntime.jsx(
16043
+ ReturnTransactionDialog,
16044
+ {
16045
+ transactionId: transaction.id,
16046
+ open: isReturnDialogOpen,
16047
+ onOpenChange: setIsReturnDialogOpen,
16048
+ onReturn: handleReturnTransaction,
16049
+ reasonCodes: returnReasonCodes
16050
+ }
16051
+ )
16052
+ ] })
15424
16053
  ] });
15425
16054
  };
15426
16055
  var TransactionDetail_default = TransactionDetail;
@@ -16305,7 +16934,7 @@ var VelocityLimitDetailsCard = ({
16305
16934
  InfoField,
16306
16935
  {
16307
16936
  label: "Max Amount",
16308
- value: `$${parseFloat(limit.maxAmount).toLocaleString()}`,
16937
+ value: formatCurrency(parseFloat(limit.maxAmount)),
16309
16938
  layout: "horizontal"
16310
16939
  }
16311
16940
  ),
@@ -16342,7 +16971,7 @@ var VelocityLimitDetailsCard = ({
16342
16971
  InfoField,
16343
16972
  {
16344
16973
  label: "Amount Threshold",
16345
- value: `$${parseFloat(limit.amountThreshold).toLocaleString()}`,
16974
+ value: formatCurrency(parseFloat(limit.amountThreshold)),
16346
16975
  layout: "horizontal"
16347
16976
  }
16348
16977
  ),
@@ -17341,6 +17970,7 @@ exports.Businesses = Businesses_default;
17341
17970
  exports.Button = Button;
17342
17971
  exports.CIPStatusBadge = CIPStatusBadge;
17343
17972
  exports.Calendar = Calendar;
17973
+ exports.CancelTransactionDialog = CancelTransactionDialog;
17344
17974
  exports.Card = Card;
17345
17975
  exports.CardContent = CardContent;
17346
17976
  exports.CardDescription = CardDescription;
@@ -17428,6 +18058,7 @@ exports.ReconExceptions = ReconExceptions;
17428
18058
  exports.ReconUpload = ReconUpload;
17429
18059
  exports.ResolveAlertDialog = ResolveAlertDialog;
17430
18060
  exports.ResponsiveGrid = ResponsiveGrid;
18061
+ exports.ReturnTransactionDialog = ReturnTransactionDialog;
17431
18062
  exports.ScrollArea = ScrollArea;
17432
18063
  exports.ScrollBar = ScrollBar;
17433
18064
  exports.Separator = Separator;