braid-ui 1.0.7 → 1.0.8

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.js CHANGED
@@ -4,7 +4,7 @@ import { cva } from 'class-variance-authority';
4
4
  import { clsx } from 'clsx';
5
5
  import { twMerge } from 'tailwind-merge';
6
6
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
7
- import { ChevronDown, ChevronUp, Check, X, PanelLeft, Edit, Home, Globe, CreditCard, Building, MoreVertical, Minus, TrendingDown, TrendingUp, ChevronRight, Eye, Trash2, Plus, MessageSquare, Upload, FileText, Download, Copy, LayoutDashboard, Bell, Briefcase, FileCheck, Receipt, ArrowLeftRight, Users, Building2, Zap, Shield, AlertCircle, RefreshCw, Landmark, Search, Repeat, Box, Settings, BarChart3, Key, Heart, User, AlertTriangle, XCircle, CheckCircle, Clock, CalendarIcon, Loader2, ArrowDownRight, ArrowUpRight, Filter, ChevronLeft, Calendar as Calendar$1, CheckCircle2, StickyNote, FileUp, Circle, UserPlus, ChevronsUpDown, FileJson } from 'lucide-react';
7
+ import { ChevronDown, ChevronUp, Check, X, PanelLeft, Edit, Home, Globe, CreditCard, Building, MoreVertical, Minus, TrendingDown, TrendingUp, ChevronRight, Eye, Trash2, Plus, MessageSquare, Upload, FileText, Download, Copy, LayoutDashboard, Bell, Briefcase, FileCheck, Receipt, ArrowLeftRight, Users, Building2, Zap, Shield, AlertCircle, RefreshCw, Landmark, Search, Repeat, Box, Settings, BarChart3, Key, Heart, User, AlertTriangle, XCircle, CheckCircle, Clock, Loader2, ArrowDownRight, ArrowUpRight, Filter, ChevronLeft, CheckCircle2, StickyNote, FileUp, RotateCcw, Send, PlayCircle, Circle, UserPlus, ChevronsUpDown, CalendarIcon, FileJson } from 'lucide-react';
8
8
  import { createPortal } from 'react-dom';
9
9
  import { Slot } from '@radix-ui/react-slot';
10
10
  import * as SelectPrimitive from '@radix-ui/react-select';
@@ -290,6 +290,12 @@ var AlertTimeline = ({ events }) => {
290
290
  if (action.includes("Alert Approved")) return /* @__PURE__ */ jsx(CheckCircle, { className: "h-4 w-4" });
291
291
  if (action.includes("Alert Declined")) return /* @__PURE__ */ jsx(XCircle, { className: "h-4 w-4" });
292
292
  if (action.includes("RFI Status change")) return /* @__PURE__ */ jsx(RefreshCw, { className: "h-4 w-4" });
293
+ if (action.includes("Manual Review")) return /* @__PURE__ */ jsx(Eye, { className: "h-4 w-4" });
294
+ if (action.includes("Returned")) return /* @__PURE__ */ jsx(RotateCcw, { className: "h-4 w-4" });
295
+ if (action.includes("Cancelled")) return /* @__PURE__ */ jsx(XCircle, { className: "h-4 w-4" });
296
+ if (action.includes("Sent")) return /* @__PURE__ */ jsx(Send, { className: "h-4 w-4" });
297
+ if (action.includes("Submitted")) return /* @__PURE__ */ jsx(FileUp, { className: "h-4 w-4" });
298
+ if (action.includes("Initiated")) return /* @__PURE__ */ jsx(PlayCircle, { className: "h-4 w-4" });
293
299
  if (action.includes("Created")) return /* @__PURE__ */ jsx(Circle, { className: "h-4 w-4" });
294
300
  if (action.includes("Assigned")) return /* @__PURE__ */ jsx(UserPlus, { className: "h-4 w-4" });
295
301
  if (action.includes("Updated") || action.includes("Modified")) return /* @__PURE__ */ jsx(Edit, { className: "h-4 w-4" });
@@ -303,6 +309,12 @@ var AlertTimeline = ({ events }) => {
303
309
  if (action?.includes("Alert Approved")) return "text-success";
304
310
  if (action?.includes("Alert Declined")) return "text-destructive";
305
311
  if (action?.includes("RFI Status change")) return "text-warning";
312
+ if (action?.includes("Manual Review")) return "text-warning";
313
+ if (action?.includes("Returned")) return "text-warning";
314
+ if (action?.includes("Cancelled")) return "text-destructive";
315
+ if (action?.includes("Sent")) return "text-success";
316
+ if (action?.includes("Submitted")) return "text-blue-500";
317
+ if (action?.includes("Initiated")) return "text-blue-500";
306
318
  switch (status) {
307
319
  case "Unassigned":
308
320
  return "text-destructive";
@@ -5312,7 +5324,100 @@ var ListPage = React15.forwardRef(
5312
5324
  }
5313
5325
  );
5314
5326
  ListPage.displayName = "ListPage";
5327
+
5328
+ // src/lib/mock-data/statement-data.ts
5329
+ var calculateBalanceChange = (startingBalance, endingBalance) => {
5330
+ const parseCurrency = (str) => {
5331
+ return parseFloat(str.replace(/[$,]/g, ""));
5332
+ };
5333
+ const start = parseCurrency(startingBalance);
5334
+ const end = parseCurrency(endingBalance);
5335
+ const change = end - start;
5336
+ const isPositive = change >= 0;
5337
+ const prefix = isPositive ? "+" : "";
5338
+ return {
5339
+ amount: change,
5340
+ formatted: `${prefix}$${Math.abs(change).toLocaleString("en-US", {
5341
+ minimumFractionDigits: 2,
5342
+ maximumFractionDigits: 2
5343
+ })}`,
5344
+ isPositive
5345
+ };
5346
+ };
5347
+ var mockStatementHeader = {
5348
+ account: "1234567890",
5349
+ productId: "PROD-001",
5350
+ programId: "PROG-001",
5351
+ startDate: "01/01/2024 00:00:00",
5352
+ endDate: "01/31/2024 23:59:59",
5353
+ startingBalance: "$125,450.00",
5354
+ endingBalance: "$158,320.50"
5355
+ };
5356
+ var mockStatementTransactions = [
5357
+ { transactionType: "ACH Credit", direction: "CREDIT", amount: 45e3, count: 12 },
5358
+ { transactionType: "ACH Debit", direction: "DEBIT", amount: 23500, count: 8 },
5359
+ { transactionType: "Wire Transfer In", direction: "CREDIT", amount: 15e3, count: 3 },
5360
+ { transactionType: "Wire Transfer Out", direction: "DEBIT", amount: 8200, count: 2 },
5361
+ { transactionType: "Card Purchase", direction: "DEBIT", amount: 5430.5, count: 45 },
5362
+ { transactionType: "Direct Deposit", direction: "CREDIT", amount: 12500, count: 5 },
5363
+ { transactionType: "ATM Withdrawal", direction: "DEBIT", amount: 3200, count: 16 },
5364
+ { transactionType: "Check Deposit", direction: "CREDIT", amount: 8900, count: 4 },
5365
+ { transactionType: "Bill Payment", direction: "DEBIT", amount: 6780, count: 18 },
5366
+ { transactionType: "Transfer In", direction: "CREDIT", amount: 5200, count: 7 },
5367
+ { transactionType: "Transfer Out", direction: "DEBIT", amount: 4350, count: 6 },
5368
+ { transactionType: "Fee", direction: "DEBIT", amount: 125, count: 3 },
5369
+ { transactionType: "Interest", direction: "CREDIT", amount: 85.5, count: 1 },
5370
+ { transactionType: "Refund", direction: "CREDIT", amount: 450, count: 2 }
5371
+ ];
5372
+ var mockPrograms = [
5373
+ { value: "PROG-001", label: "Consumer Banking Program" },
5374
+ { value: "PROG-002", label: "Business Banking Program" },
5375
+ { value: "PROG-003", label: "Premium Rewards Program" },
5376
+ { value: "PROG-004", label: "Premium Rewards Program 1" },
5377
+ { value: "PROG-005", label: "Premium Rewards Program 2" },
5378
+ { value: "PROG-006", label: "Premium Rewards Program 3" },
5379
+ { value: "PROG-007", label: "Premium Rewards Program 4" },
5380
+ { value: "PROG-008", label: "Premium Rewards Program 5" },
5381
+ { value: "PROG-009", label: "Premium Rewards Program 6" },
5382
+ { value: "PROG-0010", label: "Consumer Banking Program" },
5383
+ { value: "PROG-0011", label: "Business Banking Program" },
5384
+ { value: "PROG-0013", label: "Premium Rewards Program" },
5385
+ { value: "PROG-0041", label: "Premium Rewards Program 1" },
5386
+ { value: "PROG-0051", label: "Premium Rewards Program 2" },
5387
+ { value: "PROG-0061", label: "Premium Rewards Program 3" },
5388
+ { value: "PROG-0071", label: "Premium Rewards Program 4" },
5389
+ { value: "PROG-0081", label: "Premium Rewards Program 5" },
5390
+ { value: "PROG-0091", label: "Premium Rewards Program 6" },
5391
+ { value: "PROG-0014", label: "Consumer Banking Program" },
5392
+ { value: "PROG-0024", label: "Business Banking Program" },
5393
+ { value: "PROG-0034", label: "Premium Rewards Program" },
5394
+ { value: "PROG-0044", label: "Premium Rewards Program 1" },
5395
+ { value: "PROG-0054", label: "Premium Rewards Program 2" },
5396
+ { value: "PROG-0064", label: "Premium Rewards Program 3" },
5397
+ { value: "PROG-0074", label: "Premium Rewards Program 4" },
5398
+ { value: "PROG-0084", label: "Premium Rewards Program 5" },
5399
+ { value: "PROG-0094", label: "Premium Rewards Program 6" },
5400
+ { value: "PROG-00104", label: "Consumer Banking Program" },
5401
+ { value: "PROG-00114", label: "Business Banking Program" },
5402
+ { value: "PROG-00134", label: "Premium Rewards Program" },
5403
+ { value: "PROG-00414", label: "Premium Rewards Program 1" },
5404
+ { value: "PROG-00514", label: "Premium Rewards Program 2" },
5405
+ { value: "PROG-00614", label: "Premium Rewards Program 3" },
5406
+ { value: "PROG-00714", label: "Premium Rewards Program 4" },
5407
+ { value: "PROG-00814", label: "Premium Rewards Program 5" },
5408
+ { value: "PROG-00914", label: "Premium Rewards Program 6" }
5409
+ ];
5410
+ var mockProducts = [
5411
+ { value: "PROD-001", label: "Checking Account" },
5412
+ { value: "PROD-002", label: "Savings Account" },
5413
+ { value: "PROD-003", label: "Money Market Account" },
5414
+ { value: "PROD-004", label: "Business Checking" }
5415
+ ];
5315
5416
  var StatementHeader = ({ data, onEdit }) => {
5417
+ const hasValue = (value) => {
5418
+ return value !== void 0 && value !== null && value.trim() !== "";
5419
+ };
5420
+ const balanceChange = data.startingBalance && data.endingBalance ? calculateBalanceChange(data.startingBalance, data.endingBalance) : null;
5316
5421
  return /* @__PURE__ */ jsxs(Card, { children: [
5317
5422
  /* @__PURE__ */ jsxs(CardHeader, { direction: "row", children: [
5318
5423
  /* @__PURE__ */ jsx(CardTitle, { size: "md", children: "Statement Summary" }),
@@ -5322,7 +5427,7 @@ var StatementHeader = ({ data, onEdit }) => {
5322
5427
  ] })
5323
5428
  ] }),
5324
5429
  /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6", children: [
5325
- /* @__PURE__ */ jsx(
5430
+ hasValue(data.account) && /* @__PURE__ */ jsx(
5326
5431
  InfoField,
5327
5432
  {
5328
5433
  label: "Account",
@@ -5330,7 +5435,7 @@ var StatementHeader = ({ data, onEdit }) => {
5330
5435
  layout: "horizontal"
5331
5436
  }
5332
5437
  ),
5333
- /* @__PURE__ */ jsx(
5438
+ hasValue(data.productId) && /* @__PURE__ */ jsx(
5334
5439
  InfoField,
5335
5440
  {
5336
5441
  label: "Product ID",
@@ -5338,7 +5443,7 @@ var StatementHeader = ({ data, onEdit }) => {
5338
5443
  layout: "horizontal"
5339
5444
  }
5340
5445
  ),
5341
- /* @__PURE__ */ jsx(
5446
+ hasValue(data.programId) && /* @__PURE__ */ jsx(
5342
5447
  InfoField,
5343
5448
  {
5344
5449
  label: "Program ID",
@@ -5346,7 +5451,7 @@ var StatementHeader = ({ data, onEdit }) => {
5346
5451
  layout: "horizontal"
5347
5452
  }
5348
5453
  ),
5349
- /* @__PURE__ */ jsx(
5454
+ hasValue(data.startDate) && /* @__PURE__ */ jsx(
5350
5455
  InfoField,
5351
5456
  {
5352
5457
  label: "Start Date",
@@ -5354,7 +5459,7 @@ var StatementHeader = ({ data, onEdit }) => {
5354
5459
  layout: "horizontal"
5355
5460
  }
5356
5461
  ),
5357
- /* @__PURE__ */ jsx(
5462
+ hasValue(data.endDate) && /* @__PURE__ */ jsx(
5358
5463
  InfoField,
5359
5464
  {
5360
5465
  label: "End Date",
@@ -5362,7 +5467,7 @@ var StatementHeader = ({ data, onEdit }) => {
5362
5467
  layout: "horizontal"
5363
5468
  }
5364
5469
  ),
5365
- /* @__PURE__ */ jsx(
5470
+ hasValue(data.startingBalance) && /* @__PURE__ */ jsx(
5366
5471
  InfoField,
5367
5472
  {
5368
5473
  label: "Starting Balance",
@@ -5370,13 +5475,21 @@ var StatementHeader = ({ data, onEdit }) => {
5370
5475
  layout: "horizontal"
5371
5476
  }
5372
5477
  ),
5373
- /* @__PURE__ */ jsx(
5478
+ hasValue(data.endingBalance) && /* @__PURE__ */ jsx(
5374
5479
  InfoField,
5375
5480
  {
5376
5481
  label: "Ending Balance",
5377
5482
  value: data.endingBalance,
5378
5483
  layout: "horizontal"
5379
5484
  }
5485
+ ),
5486
+ balanceChange && /* @__PURE__ */ jsx(
5487
+ InfoField,
5488
+ {
5489
+ label: "Balance Change",
5490
+ value: /* @__PURE__ */ jsx("span", { className: balanceChange.isPositive ? "text-green-600 font-medium" : "text-red-600 font-medium", children: balanceChange.formatted }),
5491
+ layout: "horizontal"
5492
+ }
5380
5493
  )
5381
5494
  ] }) })
5382
5495
  ] });
@@ -5437,6 +5550,52 @@ var PopoverContent = React15.forwardRef(({ className, align = "center", sideOffs
5437
5550
  }
5438
5551
  ) }));
5439
5552
  PopoverContent.displayName = PopoverPrimitive.Content.displayName;
5553
+ function DatePicker({
5554
+ date,
5555
+ onDateChange,
5556
+ placeholder = "Pick a date",
5557
+ disabled = false,
5558
+ className,
5559
+ buttonClassName,
5560
+ calendarClassName,
5561
+ align = "start",
5562
+ disabledDates
5563
+ }) {
5564
+ const [open, setOpen] = React15.useState(false);
5565
+ const handleSelect = (selectedDate) => {
5566
+ onDateChange?.(selectedDate);
5567
+ setOpen(false);
5568
+ };
5569
+ return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
5570
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
5571
+ Button,
5572
+ {
5573
+ variant: "outline",
5574
+ disabled,
5575
+ className: cn(
5576
+ "justify-start text-left font-normal",
5577
+ !date && "text-muted-foreground",
5578
+ buttonClassName
5579
+ ),
5580
+ children: [
5581
+ /* @__PURE__ */ jsx(CalendarIcon, { className: "mr-2 h-4 w-4" }),
5582
+ date ? format(date, "MM/dd/yyyy") : placeholder
5583
+ ]
5584
+ }
5585
+ ) }),
5586
+ /* @__PURE__ */ jsx(PopoverContent, { className: cn("w-auto p-0", className), align, children: /* @__PURE__ */ jsx(
5587
+ Calendar,
5588
+ {
5589
+ mode: "single",
5590
+ selected: date,
5591
+ onSelect: handleSelect,
5592
+ disabled: disabledDates,
5593
+ initialFocus: true,
5594
+ className: cn("pointer-events-auto", calendarClassName)
5595
+ }
5596
+ ) })
5597
+ ] });
5598
+ }
5440
5599
  function DataTable({
5441
5600
  columns: columns2,
5442
5601
  data,
@@ -5573,6 +5732,10 @@ var StatementView = ({
5573
5732
  products,
5574
5733
  statementHeader,
5575
5734
  statementTransactions,
5735
+ programsLoading,
5736
+ productsLoading,
5737
+ programsError,
5738
+ productsError,
5576
5739
  onStatementTypeChange,
5577
5740
  onProgramChange,
5578
5741
  onProductChange,
@@ -5583,6 +5746,8 @@ var StatementView = ({
5583
5746
  onEdit,
5584
5747
  onDownloadCSV,
5585
5748
  onPrintPDF,
5749
+ onRetryFetch,
5750
+ shouldShowRetry,
5586
5751
  isGenerateDisabled,
5587
5752
  isLoading
5588
5753
  }) => {
@@ -5605,24 +5770,34 @@ var StatementView = ({
5605
5770
  onValueChange: onStatementTypeChange
5606
5771
  }
5607
5772
  ),
5773
+ statementType === "program" && programsError && /* @__PURE__ */ jsx("div", { className: "col-span-full", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 p-3 bg-destructive/10 border border-destructive/20 rounded-md text-sm text-destructive", children: [
5774
+ /* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4" }),
5775
+ /* @__PURE__ */ jsx("span", { children: programsError })
5776
+ ] }) }),
5777
+ statementType === "product" && productsError && /* @__PURE__ */ jsx("div", { className: "col-span-full", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 p-3 bg-destructive/10 border border-destructive/20 rounded-md text-sm text-destructive", children: [
5778
+ /* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4" }),
5779
+ /* @__PURE__ */ jsx("span", { children: productsError })
5780
+ ] }) }),
5608
5781
  statementType === "program" && /* @__PURE__ */ jsx(
5609
5782
  EnhancedSelect,
5610
5783
  {
5611
5784
  label: "Program Name",
5612
- placeholder: "Select program",
5785
+ placeholder: programsLoading ? "Loading programs..." : "Select program",
5613
5786
  options: programs,
5614
5787
  value: selectedProgram,
5615
- onValueChange: onProgramChange
5788
+ onValueChange: onProgramChange,
5789
+ disabled: programsLoading || !!programsError
5616
5790
  }
5617
5791
  ),
5618
5792
  statementType === "product" && /* @__PURE__ */ jsx(
5619
5793
  EnhancedSelect,
5620
5794
  {
5621
5795
  label: "Product Name",
5622
- placeholder: "Select product",
5796
+ placeholder: productsLoading ? "Loading products..." : "Select product",
5623
5797
  options: products,
5624
5798
  value: selectedProduct,
5625
- onValueChange: onProductChange
5799
+ onValueChange: onProductChange,
5800
+ disabled: productsLoading || !!productsError
5626
5801
  }
5627
5802
  ),
5628
5803
  statementType === "account" && /* @__PURE__ */ jsx(
@@ -5636,62 +5811,44 @@ var StatementView = ({
5636
5811
  ),
5637
5812
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
5638
5813
  /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Start Date" }),
5639
- /* @__PURE__ */ jsxs(Popover, { children: [
5640
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
5641
- Button,
5642
- {
5643
- variant: "outline",
5644
- className: cn(
5645
- "justify-start text-left font-normal",
5646
- !startDate && "text-muted-foreground"
5647
- ),
5648
- children: [
5649
- /* @__PURE__ */ jsx(CalendarIcon, { className: "mr-2 h-4 w-4" }),
5650
- startDate ? format(startDate, "MM/dd/yyyy") : "Select date"
5651
- ]
5652
- }
5653
- ) }),
5654
- /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsx(
5655
- Calendar,
5656
- {
5657
- mode: "single",
5658
- selected: startDate,
5659
- onSelect: onStartDateChange,
5660
- initialFocus: true
5661
- }
5662
- ) })
5663
- ] })
5814
+ /* @__PURE__ */ jsx(
5815
+ DatePicker,
5816
+ {
5817
+ date: startDate,
5818
+ onDateChange: onStartDateChange,
5819
+ placeholder: "Select start date",
5820
+ buttonClassName: "w-full"
5821
+ }
5822
+ )
5664
5823
  ] }),
5665
5824
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
5666
5825
  /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "End Date" }),
5667
- /* @__PURE__ */ jsxs(Popover, { children: [
5668
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
5669
- Button,
5670
- {
5671
- variant: "outline",
5672
- className: cn(
5673
- "justify-start text-left font-normal",
5674
- !endDate && "text-muted-foreground"
5675
- ),
5676
- children: [
5677
- /* @__PURE__ */ jsx(CalendarIcon, { className: "mr-2 h-4 w-4" }),
5678
- endDate ? format(endDate, "MM/dd/yyyy") : "Select date"
5679
- ]
5680
- }
5681
- ) }),
5682
- /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsx(
5683
- Calendar,
5684
- {
5685
- mode: "single",
5686
- selected: endDate,
5687
- onSelect: onEndDateChange,
5688
- initialFocus: true
5689
- }
5690
- ) })
5691
- ] })
5826
+ /* @__PURE__ */ jsx(
5827
+ DatePicker,
5828
+ {
5829
+ date: endDate,
5830
+ onDateChange: onEndDateChange,
5831
+ placeholder: "Select end date",
5832
+ buttonClassName: "w-full"
5833
+ }
5834
+ )
5692
5835
  ] })
5693
5836
  ] }),
5694
- /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxs(
5837
+ /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: shouldShowRetry ? /* @__PURE__ */ jsxs(
5838
+ Button,
5839
+ {
5840
+ onClick: onRetryFetch,
5841
+ variant: "outline",
5842
+ disabled: programsLoading || productsLoading,
5843
+ children: [
5844
+ (programsLoading || productsLoading) && /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }),
5845
+ programsLoading || productsLoading ? "Retrying..." : /* @__PURE__ */ jsxs(Fragment, { children: [
5846
+ /* @__PURE__ */ jsx(RefreshCw, { className: "h-4 w-4" }),
5847
+ "Retry"
5848
+ ] })
5849
+ ]
5850
+ }
5851
+ ) : /* @__PURE__ */ jsxs(
5695
5852
  Button,
5696
5853
  {
5697
5854
  onClick: onGenerateStatement,
@@ -7892,61 +8049,29 @@ var Businesses = () => {
7892
8049
  /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
7893
8050
  /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
7894
8051
  /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Created Date Start" }),
7895
- /* @__PURE__ */ jsxs(Popover, { children: [
7896
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
7897
- Button,
7898
- {
7899
- variant: "outline",
7900
- className: cn(
7901
- "w-full justify-start text-left font-normal",
7902
- !filters.createdDateStart && "text-muted-foreground"
7903
- ),
7904
- children: [
7905
- /* @__PURE__ */ jsx(Calendar$1, { className: "mr-2 h-4 w-4" }),
7906
- filters.createdDateStart ? format(filters.createdDateStart, "MM/dd/yyyy") : /* @__PURE__ */ jsx("span", { children: "MM/DD/YYYY" })
7907
- ]
7908
- }
7909
- ) }),
7910
- /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0 bg-background z-50", align: "start", children: /* @__PURE__ */ jsx(
7911
- Calendar,
7912
- {
7913
- mode: "single",
7914
- selected: filters.createdDateStart,
7915
- onSelect: (date) => handleFilterChange("createdDateStart", date),
7916
- initialFocus: true,
7917
- className: "pointer-events-auto"
7918
- }
7919
- ) })
7920
- ] })
8052
+ /* @__PURE__ */ jsx(
8053
+ DatePicker,
8054
+ {
8055
+ date: filters.createdDateStart,
8056
+ onDateChange: (date) => handleFilterChange("createdDateStart", date),
8057
+ placeholder: "MM/DD/YYYY",
8058
+ buttonClassName: "w-full",
8059
+ className: "bg-background z-50"
8060
+ }
8061
+ )
7921
8062
  ] }),
7922
8063
  /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
7923
8064
  /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Created Date End" }),
7924
- /* @__PURE__ */ jsxs(Popover, { children: [
7925
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
7926
- Button,
7927
- {
7928
- variant: "outline",
7929
- className: cn(
7930
- "w-full justify-start text-left font-normal",
7931
- !filters.createdDateEnd && "text-muted-foreground"
7932
- ),
7933
- children: [
7934
- /* @__PURE__ */ jsx(Calendar$1, { className: "mr-2 h-4 w-4" }),
7935
- filters.createdDateEnd ? format(filters.createdDateEnd, "MM/dd/yyyy") : /* @__PURE__ */ jsx("span", { children: "MM/DD/YYYY" })
7936
- ]
7937
- }
7938
- ) }),
7939
- /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0 bg-background z-50", align: "start", children: /* @__PURE__ */ jsx(
7940
- Calendar,
7941
- {
7942
- mode: "single",
7943
- selected: filters.createdDateEnd,
7944
- onSelect: (date) => handleFilterChange("createdDateEnd", date),
7945
- initialFocus: true,
7946
- className: "pointer-events-auto"
7947
- }
7948
- ) })
7949
- ] })
8065
+ /* @__PURE__ */ jsx(
8066
+ DatePicker,
8067
+ {
8068
+ date: filters.createdDateEnd,
8069
+ onDateChange: (date) => handleFilterChange("createdDateEnd", date),
8070
+ placeholder: "MM/DD/YYYY",
8071
+ buttonClassName: "w-full",
8072
+ className: "bg-background z-50"
8073
+ }
8074
+ )
7950
8075
  ] })
7951
8076
  ] })
7952
8077
  ] }),
@@ -8541,57 +8666,68 @@ var NotFound = () => {
8541
8666
  ] }) });
8542
8667
  };
8543
8668
  var NotFound_default = NotFound;
8544
-
8545
- // src/lib/mock-data/statement-data.ts
8546
- var mockStatementHeader = {
8547
- account: "1234567890",
8548
- productId: "PROD-001",
8549
- programId: "PROG-001",
8550
- startDate: "01/01/2024 00:00:00",
8551
- endDate: "01/31/2024 23:59:59",
8552
- startingBalance: "$125,450.00",
8553
- endingBalance: "$158,320.50"
8554
- };
8555
- var mockStatementTransactions = [
8556
- { transactionType: "ACH Credit", direction: "CREDIT", amount: 45e3, count: 12 },
8557
- { transactionType: "ACH Debit", direction: "DEBIT", amount: 23500, count: 8 },
8558
- { transactionType: "Wire Transfer In", direction: "CREDIT", amount: 15e3, count: 3 },
8559
- { transactionType: "Wire Transfer Out", direction: "DEBIT", amount: 8200, count: 2 },
8560
- { transactionType: "Card Purchase", direction: "DEBIT", amount: 5430.5, count: 45 },
8561
- { transactionType: "Direct Deposit", direction: "CREDIT", amount: 12500, count: 5 },
8562
- { transactionType: "ATM Withdrawal", direction: "DEBIT", amount: 3200, count: 16 },
8563
- { transactionType: "Check Deposit", direction: "CREDIT", amount: 8900, count: 4 },
8564
- { transactionType: "Bill Payment", direction: "DEBIT", amount: 6780, count: 18 },
8565
- { transactionType: "Transfer In", direction: "CREDIT", amount: 5200, count: 7 },
8566
- { transactionType: "Transfer Out", direction: "DEBIT", amount: 4350, count: 6 },
8567
- { transactionType: "Fee", direction: "DEBIT", amount: 125, count: 3 },
8568
- { transactionType: "Interest", direction: "CREDIT", amount: 85.5, count: 1 },
8569
- { transactionType: "Refund", direction: "CREDIT", amount: 450, count: 2 }
8570
- ];
8571
- var mockPrograms = [
8572
- { value: "PROG-001", label: "Consumer Banking Program" },
8573
- { value: "PROG-002", label: "Business Banking Program" },
8574
- { value: "PROG-003", label: "Premium Rewards Program" }
8575
- ];
8576
- var mockProducts = [
8577
- { value: "PROD-001", label: "Checking Account" },
8578
- { value: "PROD-002", label: "Savings Account" },
8579
- { value: "PROD-003", label: "Money Market Account" },
8580
- { value: "PROD-004", label: "Business Checking" }
8581
- ];
8582
8669
  function Statement() {
8583
- const [statementType, setStatementType] = useState("");
8670
+ const [statementType, setStatementType] = useState("root");
8584
8671
  const [selectedProgram, setSelectedProgram] = useState("");
8585
8672
  const [selectedProduct, setSelectedProduct] = useState("");
8586
8673
  const [accountNumber, setAccountNumber] = useState("");
8587
- const [startDate, setStartDate] = useState();
8588
- const [endDate, setEndDate] = useState();
8674
+ const [startDate, setStartDate] = useState(() => {
8675
+ const now = /* @__PURE__ */ new Date();
8676
+ return new Date(now.getFullYear(), now.getMonth(), 1);
8677
+ });
8678
+ const [endDate, setEndDate] = useState(/* @__PURE__ */ new Date());
8589
8679
  const [statementGenerated, setStatementGenerated] = useState(false);
8590
8680
  const [isLoading, setIsLoading] = useState(false);
8591
- const [programs] = useState(mockPrograms);
8592
- const [products] = useState(mockProducts);
8681
+ const [programs, setPrograms] = useState([]);
8682
+ const [products, setProducts] = useState([]);
8683
+ const [programsLoading, setProgramsLoading] = useState(false);
8684
+ const [productsLoading, setProductsLoading] = useState(false);
8685
+ const [programsError, setProgramsError] = useState(null);
8686
+ const [productsError, setProductsError] = useState(null);
8593
8687
  const [statementHeader, setStatementHeader] = useState(null);
8594
8688
  const [statementTransactions, setStatementTransactions] = useState([]);
8689
+ const fetchPrograms = async () => {
8690
+ setProgramsLoading(true);
8691
+ setProgramsError(null);
8692
+ try {
8693
+ await new Promise((resolve) => setTimeout(resolve, 1e3));
8694
+ setPrograms(mockPrograms);
8695
+ } catch (error) {
8696
+ const errorMessage = error instanceof Error ? error.message : "Failed to load programs";
8697
+ setProgramsError(errorMessage);
8698
+ setPrograms([]);
8699
+ toast({
8700
+ title: "Error loading programs",
8701
+ description: errorMessage,
8702
+ variant: "destructive"
8703
+ });
8704
+ } finally {
8705
+ setProgramsLoading(false);
8706
+ }
8707
+ };
8708
+ const fetchProducts = async () => {
8709
+ setProductsLoading(true);
8710
+ setProductsError(null);
8711
+ try {
8712
+ await new Promise((resolve) => setTimeout(resolve, 1e3));
8713
+ setProducts(mockProducts);
8714
+ } catch (error) {
8715
+ const errorMessage = error instanceof Error ? error.message : "Failed to load products";
8716
+ setProductsError(errorMessage);
8717
+ setProducts([]);
8718
+ toast({
8719
+ title: "Error loading products",
8720
+ description: errorMessage,
8721
+ variant: "destructive"
8722
+ });
8723
+ } finally {
8724
+ setProductsLoading(false);
8725
+ }
8726
+ };
8727
+ useEffect(() => {
8728
+ fetchPrograms();
8729
+ fetchProducts();
8730
+ }, []);
8595
8731
  const handleStatementTypeChange = (value) => {
8596
8732
  setStatementType(value);
8597
8733
  setSelectedProgram("");
@@ -8623,11 +8759,25 @@ function Statement() {
8623
8759
  };
8624
8760
  const isGenerateDisabled = () => {
8625
8761
  if (!statementType || !startDate || !endDate) return true;
8762
+ if (statementType === "program" && (programsError || programsLoading)) return true;
8763
+ if (statementType === "product" && (productsError || productsLoading)) return true;
8626
8764
  if (statementType === "program" && !selectedProgram) return true;
8627
8765
  if (statementType === "product" && !selectedProduct) return true;
8628
8766
  if (statementType === "account" && !accountNumber) return true;
8629
8767
  return false;
8630
8768
  };
8769
+ const handleRetryFetch = () => {
8770
+ if (statementType === "program" && programsError) {
8771
+ fetchPrograms();
8772
+ } else if (statementType === "product" && productsError) {
8773
+ fetchProducts();
8774
+ }
8775
+ };
8776
+ const shouldShowRetry = () => {
8777
+ if (statementType === "program" && programsError) return true;
8778
+ if (statementType === "product" && productsError) return true;
8779
+ return false;
8780
+ };
8631
8781
  const handleDownloadCSV = () => {
8632
8782
  console.log("Downloading CSV...");
8633
8783
  };
@@ -8651,6 +8801,10 @@ function Statement() {
8651
8801
  products,
8652
8802
  statementHeader,
8653
8803
  statementTransactions,
8804
+ programsLoading,
8805
+ productsLoading,
8806
+ programsError,
8807
+ productsError,
8654
8808
  onStatementTypeChange: handleStatementTypeChange,
8655
8809
  onProgramChange: setSelectedProgram,
8656
8810
  onProductChange: setSelectedProduct,
@@ -8661,6 +8815,8 @@ function Statement() {
8661
8815
  onEdit: handleEdit,
8662
8816
  onDownloadCSV: handleDownloadCSV,
8663
8817
  onPrintPDF: handlePrintPDF,
8818
+ onRetryFetch: handleRetryFetch,
8819
+ shouldShowRetry: shouldShowRetry(),
8664
8820
  isGenerateDisabled: isGenerateDisabled(),
8665
8821
  isLoading
8666
8822
  }
@@ -9220,121 +9376,57 @@ var TransactionHistory = () => {
9220
9376
  /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9221
9377
  /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
9222
9378
  /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Creation Date Start" }),
9223
- /* @__PURE__ */ jsxs(Popover, { children: [
9224
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
9225
- Button,
9226
- {
9227
- variant: "outline",
9228
- className: cn(
9229
- "w-full justify-start text-left font-normal",
9230
- !filters.creationDateStart && "text-muted-foreground"
9231
- ),
9232
- children: [
9233
- /* @__PURE__ */ jsx(Calendar$1, { className: "mr-2 h-4 w-4" }),
9234
- filters.creationDateStart ? format(filters.creationDateStart, "MM/dd/yyyy") : /* @__PURE__ */ jsx("span", { children: "MM/DD/YYYY" })
9235
- ]
9236
- }
9237
- ) }),
9238
- /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0 bg-background z-50", align: "start", children: /* @__PURE__ */ jsx(
9239
- Calendar,
9240
- {
9241
- mode: "single",
9242
- selected: filters.creationDateStart,
9243
- onSelect: (date) => handleFilterChange("creationDateStart", date),
9244
- initialFocus: true,
9245
- className: "pointer-events-auto"
9246
- }
9247
- ) })
9248
- ] })
9379
+ /* @__PURE__ */ jsx(
9380
+ DatePicker,
9381
+ {
9382
+ date: filters.creationDateStart,
9383
+ onDateChange: (date) => handleFilterChange("creationDateStart", date),
9384
+ placeholder: "MM/DD/YYYY",
9385
+ buttonClassName: "w-full",
9386
+ className: "bg-background z-50"
9387
+ }
9388
+ )
9249
9389
  ] }),
9250
9390
  /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
9251
9391
  /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Creation Date End" }),
9252
- /* @__PURE__ */ jsxs(Popover, { children: [
9253
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
9254
- Button,
9255
- {
9256
- variant: "outline",
9257
- className: cn(
9258
- "w-full justify-start text-left font-normal",
9259
- !filters.creationDateEnd && "text-muted-foreground"
9260
- ),
9261
- children: [
9262
- /* @__PURE__ */ jsx(Calendar$1, { className: "mr-2 h-4 w-4" }),
9263
- filters.creationDateEnd ? format(filters.creationDateEnd, "MM/dd/yyyy") : /* @__PURE__ */ jsx("span", { children: "MM/DD/YYYY" })
9264
- ]
9265
- }
9266
- ) }),
9267
- /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0 bg-background z-50", align: "start", children: /* @__PURE__ */ jsx(
9268
- Calendar,
9269
- {
9270
- mode: "single",
9271
- selected: filters.creationDateEnd,
9272
- onSelect: (date) => handleFilterChange("creationDateEnd", date),
9273
- initialFocus: true,
9274
- className: "pointer-events-auto"
9275
- }
9276
- ) })
9277
- ] })
9392
+ /* @__PURE__ */ jsx(
9393
+ DatePicker,
9394
+ {
9395
+ date: filters.creationDateEnd,
9396
+ onDateChange: (date) => handleFilterChange("creationDateEnd", date),
9397
+ placeholder: "MM/DD/YYYY",
9398
+ buttonClassName: "w-full",
9399
+ className: "bg-background z-50"
9400
+ }
9401
+ )
9278
9402
  ] })
9279
9403
  ] }),
9280
9404
  /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9281
9405
  /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
9282
9406
  /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Post Date Start" }),
9283
- /* @__PURE__ */ jsxs(Popover, { children: [
9284
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
9285
- Button,
9286
- {
9287
- variant: "outline",
9288
- className: cn(
9289
- "w-full justify-start text-left font-normal",
9290
- !filters.postDateStart && "text-muted-foreground"
9291
- ),
9292
- children: [
9293
- /* @__PURE__ */ jsx(Calendar$1, { className: "mr-2 h-4 w-4" }),
9294
- filters.postDateStart ? format(filters.postDateStart, "MM/dd/yyyy") : /* @__PURE__ */ jsx("span", { children: "MM/DD/YYYY" })
9295
- ]
9296
- }
9297
- ) }),
9298
- /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0 bg-background z-50", align: "start", children: /* @__PURE__ */ jsx(
9299
- Calendar,
9300
- {
9301
- mode: "single",
9302
- selected: filters.postDateStart,
9303
- onSelect: (date) => handleFilterChange("postDateStart", date),
9304
- initialFocus: true,
9305
- className: "pointer-events-auto"
9306
- }
9307
- ) })
9308
- ] })
9407
+ /* @__PURE__ */ jsx(
9408
+ DatePicker,
9409
+ {
9410
+ date: filters.postDateStart,
9411
+ onDateChange: (date) => handleFilterChange("postDateStart", date),
9412
+ placeholder: "MM/DD/YYYY",
9413
+ buttonClassName: "w-full",
9414
+ className: "bg-background z-50"
9415
+ }
9416
+ )
9309
9417
  ] }),
9310
9418
  /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
9311
9419
  /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Post Date End" }),
9312
- /* @__PURE__ */ jsxs(Popover, { children: [
9313
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
9314
- Button,
9315
- {
9316
- variant: "outline",
9317
- className: cn(
9318
- "w-full justify-start text-left font-normal",
9319
- !filters.postDateEnd && "text-muted-foreground"
9320
- ),
9321
- children: [
9322
- /* @__PURE__ */ jsx(Calendar$1, { className: "mr-2 h-4 w-4" }),
9323
- filters.postDateEnd ? format(filters.postDateEnd, "MM/dd/yyyy") : /* @__PURE__ */ jsx("span", { children: "MM/DD/YYYY" })
9324
- ]
9325
- }
9326
- ) }),
9327
- /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0 bg-background z-50", align: "start", children: /* @__PURE__ */ jsx(
9328
- Calendar,
9329
- {
9330
- mode: "single",
9331
- selected: filters.postDateEnd,
9332
- onSelect: (date) => handleFilterChange("postDateEnd", date),
9333
- initialFocus: true,
9334
- className: "pointer-events-auto"
9335
- }
9336
- ) })
9337
- ] })
9420
+ /* @__PURE__ */ jsx(
9421
+ DatePicker,
9422
+ {
9423
+ date: filters.postDateEnd,
9424
+ onDateChange: (date) => handleFilterChange("postDateEnd", date),
9425
+ placeholder: "MM/DD/YYYY",
9426
+ buttonClassName: "w-full",
9427
+ className: "bg-background z-50"
9428
+ }
9429
+ )
9338
9430
  ] })
9339
9431
  ] })
9340
9432
  ] }),