braid-ui 1.0.7 → 1.0.9

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
@@ -322,6 +322,12 @@ var AlertTimeline = ({ events }) => {
322
322
  if (action.includes("Alert Approved")) return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle, { className: "h-4 w-4" });
323
323
  if (action.includes("Alert Declined")) return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XCircle, { className: "h-4 w-4" });
324
324
  if (action.includes("RFI Status change")) return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RefreshCw, { className: "h-4 w-4" });
325
+ if (action.includes("Manual Review")) return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Eye, { className: "h-4 w-4" });
326
+ if (action.includes("Returned")) return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RotateCcw, { className: "h-4 w-4" });
327
+ if (action.includes("Cancelled")) return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XCircle, { className: "h-4 w-4" });
328
+ if (action.includes("Sent")) return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Send, { className: "h-4 w-4" });
329
+ if (action.includes("Submitted")) return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileUp, { className: "h-4 w-4" });
330
+ if (action.includes("Initiated")) return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PlayCircle, { className: "h-4 w-4" });
325
331
  if (action.includes("Created")) return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Circle, { className: "h-4 w-4" });
326
332
  if (action.includes("Assigned")) return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.UserPlus, { className: "h-4 w-4" });
327
333
  if (action.includes("Updated") || action.includes("Modified")) return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Edit, { className: "h-4 w-4" });
@@ -335,6 +341,12 @@ var AlertTimeline = ({ events }) => {
335
341
  if (action?.includes("Alert Approved")) return "text-success";
336
342
  if (action?.includes("Alert Declined")) return "text-destructive";
337
343
  if (action?.includes("RFI Status change")) return "text-warning";
344
+ if (action?.includes("Manual Review")) return "text-warning";
345
+ if (action?.includes("Returned")) return "text-warning";
346
+ if (action?.includes("Cancelled")) return "text-destructive";
347
+ if (action?.includes("Sent")) return "text-success";
348
+ if (action?.includes("Submitted")) return "text-blue-500";
349
+ if (action?.includes("Initiated")) return "text-blue-500";
338
350
  switch (status) {
339
351
  case "Unassigned":
340
352
  return "text-destructive";
@@ -5344,7 +5356,100 @@ var ListPage = React15__namespace.forwardRef(
5344
5356
  }
5345
5357
  );
5346
5358
  ListPage.displayName = "ListPage";
5359
+
5360
+ // src/lib/mock-data/statement-data.ts
5361
+ var calculateBalanceChange = (startingBalance, endingBalance) => {
5362
+ const parseCurrency = (str) => {
5363
+ return parseFloat(str.replace(/[$,]/g, ""));
5364
+ };
5365
+ const start = parseCurrency(startingBalance);
5366
+ const end = parseCurrency(endingBalance);
5367
+ const change = end - start;
5368
+ const isPositive = change >= 0;
5369
+ const prefix = isPositive ? "+" : "";
5370
+ return {
5371
+ amount: change,
5372
+ formatted: `${prefix}$${Math.abs(change).toLocaleString("en-US", {
5373
+ minimumFractionDigits: 2,
5374
+ maximumFractionDigits: 2
5375
+ })}`,
5376
+ isPositive
5377
+ };
5378
+ };
5379
+ var mockStatementHeader = {
5380
+ account: "1234567890",
5381
+ productId: "PROD-001",
5382
+ programId: "PROG-001",
5383
+ startDate: "01/01/2024 00:00:00",
5384
+ endDate: "01/31/2024 23:59:59",
5385
+ startingBalance: "$125,450.00",
5386
+ endingBalance: "$158,320.50"
5387
+ };
5388
+ var mockStatementTransactions = [
5389
+ { transactionType: "ACH Credit", direction: "CREDIT", amount: 45e3, count: 12 },
5390
+ { transactionType: "ACH Debit", direction: "DEBIT", amount: 23500, count: 8 },
5391
+ { transactionType: "Wire Transfer In", direction: "CREDIT", amount: 15e3, count: 3 },
5392
+ { transactionType: "Wire Transfer Out", direction: "DEBIT", amount: 8200, count: 2 },
5393
+ { transactionType: "Card Purchase", direction: "DEBIT", amount: 5430.5, count: 45 },
5394
+ { transactionType: "Direct Deposit", direction: "CREDIT", amount: 12500, count: 5 },
5395
+ { transactionType: "ATM Withdrawal", direction: "DEBIT", amount: 3200, count: 16 },
5396
+ { transactionType: "Check Deposit", direction: "CREDIT", amount: 8900, count: 4 },
5397
+ { transactionType: "Bill Payment", direction: "DEBIT", amount: 6780, count: 18 },
5398
+ { transactionType: "Transfer In", direction: "CREDIT", amount: 5200, count: 7 },
5399
+ { transactionType: "Transfer Out", direction: "DEBIT", amount: 4350, count: 6 },
5400
+ { transactionType: "Fee", direction: "DEBIT", amount: 125, count: 3 },
5401
+ { transactionType: "Interest", direction: "CREDIT", amount: 85.5, count: 1 },
5402
+ { transactionType: "Refund", direction: "CREDIT", amount: 450, count: 2 }
5403
+ ];
5404
+ var mockPrograms = [
5405
+ { value: "PROG-001", label: "Consumer Banking Program" },
5406
+ { value: "PROG-002", label: "Business Banking Program" },
5407
+ { value: "PROG-003", label: "Premium Rewards Program" },
5408
+ { value: "PROG-004", label: "Premium Rewards Program 1" },
5409
+ { value: "PROG-005", label: "Premium Rewards Program 2" },
5410
+ { value: "PROG-006", label: "Premium Rewards Program 3" },
5411
+ { value: "PROG-007", label: "Premium Rewards Program 4" },
5412
+ { value: "PROG-008", label: "Premium Rewards Program 5" },
5413
+ { value: "PROG-009", label: "Premium Rewards Program 6" },
5414
+ { value: "PROG-0010", label: "Consumer Banking Program" },
5415
+ { value: "PROG-0011", label: "Business Banking Program" },
5416
+ { value: "PROG-0013", label: "Premium Rewards Program" },
5417
+ { value: "PROG-0041", label: "Premium Rewards Program 1" },
5418
+ { value: "PROG-0051", label: "Premium Rewards Program 2" },
5419
+ { value: "PROG-0061", label: "Premium Rewards Program 3" },
5420
+ { value: "PROG-0071", label: "Premium Rewards Program 4" },
5421
+ { value: "PROG-0081", label: "Premium Rewards Program 5" },
5422
+ { value: "PROG-0091", label: "Premium Rewards Program 6" },
5423
+ { value: "PROG-0014", label: "Consumer Banking Program" },
5424
+ { value: "PROG-0024", label: "Business Banking Program" },
5425
+ { value: "PROG-0034", label: "Premium Rewards Program" },
5426
+ { value: "PROG-0044", label: "Premium Rewards Program 1" },
5427
+ { value: "PROG-0054", label: "Premium Rewards Program 2" },
5428
+ { value: "PROG-0064", label: "Premium Rewards Program 3" },
5429
+ { value: "PROG-0074", label: "Premium Rewards Program 4" },
5430
+ { value: "PROG-0084", label: "Premium Rewards Program 5" },
5431
+ { value: "PROG-0094", label: "Premium Rewards Program 6" },
5432
+ { value: "PROG-00104", label: "Consumer Banking Program" },
5433
+ { value: "PROG-00114", label: "Business Banking Program" },
5434
+ { value: "PROG-00134", label: "Premium Rewards Program" },
5435
+ { value: "PROG-00414", label: "Premium Rewards Program 1" },
5436
+ { value: "PROG-00514", label: "Premium Rewards Program 2" },
5437
+ { value: "PROG-00614", label: "Premium Rewards Program 3" },
5438
+ { value: "PROG-00714", label: "Premium Rewards Program 4" },
5439
+ { value: "PROG-00814", label: "Premium Rewards Program 5" },
5440
+ { value: "PROG-00914", label: "Premium Rewards Program 6" }
5441
+ ];
5442
+ var mockProducts = [
5443
+ { value: "PROD-001", label: "Checking Account" },
5444
+ { value: "PROD-002", label: "Savings Account" },
5445
+ { value: "PROD-003", label: "Money Market Account" },
5446
+ { value: "PROD-004", label: "Business Checking" }
5447
+ ];
5347
5448
  var StatementHeader = ({ data, onEdit }) => {
5449
+ const hasValue = (value) => {
5450
+ return value !== void 0 && value !== null && value.trim() !== "";
5451
+ };
5452
+ const balanceChange = data.startingBalance && data.endingBalance ? calculateBalanceChange(data.startingBalance, data.endingBalance) : null;
5348
5453
  return /* @__PURE__ */ jsxRuntime.jsxs(Card, { children: [
5349
5454
  /* @__PURE__ */ jsxRuntime.jsxs(CardHeader, { direction: "row", children: [
5350
5455
  /* @__PURE__ */ jsxRuntime.jsx(CardTitle, { size: "md", children: "Statement Summary" }),
@@ -5354,7 +5459,7 @@ var StatementHeader = ({ data, onEdit }) => {
5354
5459
  ] })
5355
5460
  ] }),
5356
5461
  /* @__PURE__ */ jsxRuntime.jsx(CardContent, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6", children: [
5357
- /* @__PURE__ */ jsxRuntime.jsx(
5462
+ hasValue(data.account) && /* @__PURE__ */ jsxRuntime.jsx(
5358
5463
  InfoField,
5359
5464
  {
5360
5465
  label: "Account",
@@ -5362,7 +5467,7 @@ var StatementHeader = ({ data, onEdit }) => {
5362
5467
  layout: "horizontal"
5363
5468
  }
5364
5469
  ),
5365
- /* @__PURE__ */ jsxRuntime.jsx(
5470
+ hasValue(data.productId) && /* @__PURE__ */ jsxRuntime.jsx(
5366
5471
  InfoField,
5367
5472
  {
5368
5473
  label: "Product ID",
@@ -5370,7 +5475,7 @@ var StatementHeader = ({ data, onEdit }) => {
5370
5475
  layout: "horizontal"
5371
5476
  }
5372
5477
  ),
5373
- /* @__PURE__ */ jsxRuntime.jsx(
5478
+ hasValue(data.programId) && /* @__PURE__ */ jsxRuntime.jsx(
5374
5479
  InfoField,
5375
5480
  {
5376
5481
  label: "Program ID",
@@ -5378,7 +5483,7 @@ var StatementHeader = ({ data, onEdit }) => {
5378
5483
  layout: "horizontal"
5379
5484
  }
5380
5485
  ),
5381
- /* @__PURE__ */ jsxRuntime.jsx(
5486
+ hasValue(data.startDate) && /* @__PURE__ */ jsxRuntime.jsx(
5382
5487
  InfoField,
5383
5488
  {
5384
5489
  label: "Start Date",
@@ -5386,7 +5491,7 @@ var StatementHeader = ({ data, onEdit }) => {
5386
5491
  layout: "horizontal"
5387
5492
  }
5388
5493
  ),
5389
- /* @__PURE__ */ jsxRuntime.jsx(
5494
+ hasValue(data.endDate) && /* @__PURE__ */ jsxRuntime.jsx(
5390
5495
  InfoField,
5391
5496
  {
5392
5497
  label: "End Date",
@@ -5394,7 +5499,7 @@ var StatementHeader = ({ data, onEdit }) => {
5394
5499
  layout: "horizontal"
5395
5500
  }
5396
5501
  ),
5397
- /* @__PURE__ */ jsxRuntime.jsx(
5502
+ hasValue(data.startingBalance) && /* @__PURE__ */ jsxRuntime.jsx(
5398
5503
  InfoField,
5399
5504
  {
5400
5505
  label: "Starting Balance",
@@ -5402,13 +5507,21 @@ var StatementHeader = ({ data, onEdit }) => {
5402
5507
  layout: "horizontal"
5403
5508
  }
5404
5509
  ),
5405
- /* @__PURE__ */ jsxRuntime.jsx(
5510
+ hasValue(data.endingBalance) && /* @__PURE__ */ jsxRuntime.jsx(
5406
5511
  InfoField,
5407
5512
  {
5408
5513
  label: "Ending Balance",
5409
5514
  value: data.endingBalance,
5410
5515
  layout: "horizontal"
5411
5516
  }
5517
+ ),
5518
+ balanceChange && /* @__PURE__ */ jsxRuntime.jsx(
5519
+ InfoField,
5520
+ {
5521
+ label: "Balance Change",
5522
+ value: /* @__PURE__ */ jsxRuntime.jsx("span", { className: balanceChange.isPositive ? "text-green-600 font-medium" : "text-red-600 font-medium", children: balanceChange.formatted }),
5523
+ layout: "horizontal"
5524
+ }
5412
5525
  )
5413
5526
  ] }) })
5414
5527
  ] });
@@ -5469,6 +5582,52 @@ var PopoverContent = React15__namespace.forwardRef(({ className, align = "center
5469
5582
  }
5470
5583
  ) }));
5471
5584
  PopoverContent.displayName = PopoverPrimitive__namespace.Content.displayName;
5585
+ function DatePicker({
5586
+ date,
5587
+ onDateChange,
5588
+ placeholder = "Pick a date",
5589
+ disabled = false,
5590
+ className,
5591
+ buttonClassName,
5592
+ calendarClassName,
5593
+ align = "start",
5594
+ disabledDates
5595
+ }) {
5596
+ const [open, setOpen] = React15__namespace.useState(false);
5597
+ const handleSelect = (selectedDate) => {
5598
+ onDateChange?.(selectedDate);
5599
+ setOpen(false);
5600
+ };
5601
+ return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open, onOpenChange: setOpen, children: [
5602
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
5603
+ Button,
5604
+ {
5605
+ variant: "outline",
5606
+ disabled,
5607
+ className: cn(
5608
+ "justify-start text-left font-normal",
5609
+ !date && "text-muted-foreground",
5610
+ buttonClassName
5611
+ ),
5612
+ children: [
5613
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarIcon, { className: "mr-2 h-4 w-4" }),
5614
+ date ? dateFns.format(date, "MM/dd/yyyy") : placeholder
5615
+ ]
5616
+ }
5617
+ ) }),
5618
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: cn("w-auto p-0", className), align, children: /* @__PURE__ */ jsxRuntime.jsx(
5619
+ Calendar,
5620
+ {
5621
+ mode: "single",
5622
+ selected: date,
5623
+ onSelect: handleSelect,
5624
+ disabled: disabledDates,
5625
+ initialFocus: true,
5626
+ className: cn("pointer-events-auto", calendarClassName)
5627
+ }
5628
+ ) })
5629
+ ] });
5630
+ }
5472
5631
  function DataTable({
5473
5632
  columns: columns2,
5474
5633
  data,
@@ -5605,6 +5764,10 @@ var StatementView = ({
5605
5764
  products,
5606
5765
  statementHeader,
5607
5766
  statementTransactions,
5767
+ programsLoading,
5768
+ productsLoading,
5769
+ programsError,
5770
+ productsError,
5608
5771
  onStatementTypeChange,
5609
5772
  onProgramChange,
5610
5773
  onProductChange,
@@ -5615,6 +5778,8 @@ var StatementView = ({
5615
5778
  onEdit,
5616
5779
  onDownloadCSV,
5617
5780
  onPrintPDF,
5781
+ onRetryFetch,
5782
+ shouldShowRetry,
5618
5783
  isGenerateDisabled,
5619
5784
  isLoading
5620
5785
  }) => {
@@ -5626,6 +5791,50 @@ var StatementView = ({
5626
5791
  !statementGenerated && /* @__PURE__ */ jsxRuntime.jsxs(Card, { children: [
5627
5792
  /* @__PURE__ */ jsxRuntime.jsx(CardHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(CardTitle, { size: "md", children: "Statement Parameters" }) }),
5628
5793
  /* @__PURE__ */ jsxRuntime.jsxs(CardContent, { className: "space-y-4", children: [
5794
+ statementType === "program" && programsError && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2 p-4 bg-destructive/10 border border-destructive/20 rounded-md", children: [
5795
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
5796
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircle, { className: "h-5 w-5 text-destructive flex-shrink-0" }),
5797
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
5798
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-destructive", children: "Failed to load programs" }),
5799
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-destructive/80 mt-0.5", children: programsError })
5800
+ ] })
5801
+ ] }),
5802
+ /* @__PURE__ */ jsxRuntime.jsxs(
5803
+ Button,
5804
+ {
5805
+ onClick: onRetryFetch,
5806
+ variant: "outline",
5807
+ size: "sm",
5808
+ disabled: programsLoading,
5809
+ children: [
5810
+ programsLoading ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RefreshCw, { className: "h-4 w-4" }),
5811
+ "Retry"
5812
+ ]
5813
+ }
5814
+ )
5815
+ ] }),
5816
+ statementType === "product" && productsError && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2 p-4 bg-destructive/10 border border-destructive/20 rounded-md", children: [
5817
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
5818
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircle, { className: "h-5 w-5 text-destructive flex-shrink-0" }),
5819
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
5820
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-destructive", children: "Failed to load products" }),
5821
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-destructive/80 mt-0.5", children: productsError })
5822
+ ] })
5823
+ ] }),
5824
+ /* @__PURE__ */ jsxRuntime.jsxs(
5825
+ Button,
5826
+ {
5827
+ onClick: onRetryFetch,
5828
+ variant: "outline",
5829
+ size: "sm",
5830
+ disabled: productsLoading,
5831
+ children: [
5832
+ productsLoading ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RefreshCw, { className: "h-4 w-4" }),
5833
+ "Retry"
5834
+ ]
5835
+ }
5836
+ )
5837
+ ] }),
5629
5838
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4", children: [
5630
5839
  /* @__PURE__ */ jsxRuntime.jsx(
5631
5840
  EnhancedSelect,
@@ -5641,20 +5850,22 @@ var StatementView = ({
5641
5850
  EnhancedSelect,
5642
5851
  {
5643
5852
  label: "Program Name",
5644
- placeholder: "Select program",
5853
+ placeholder: programsLoading ? "Loading programs..." : "Select program",
5645
5854
  options: programs,
5646
5855
  value: selectedProgram,
5647
- onValueChange: onProgramChange
5856
+ onValueChange: onProgramChange,
5857
+ disabled: programsLoading || !!programsError
5648
5858
  }
5649
5859
  ),
5650
5860
  statementType === "product" && /* @__PURE__ */ jsxRuntime.jsx(
5651
5861
  EnhancedSelect,
5652
5862
  {
5653
5863
  label: "Product Name",
5654
- placeholder: "Select product",
5864
+ placeholder: productsLoading ? "Loading products..." : "Select product",
5655
5865
  options: products,
5656
5866
  value: selectedProduct,
5657
- onValueChange: onProductChange
5867
+ onValueChange: onProductChange,
5868
+ disabled: productsLoading || !!productsError
5658
5869
  }
5659
5870
  ),
5660
5871
  statementType === "account" && /* @__PURE__ */ jsxRuntime.jsx(
@@ -5668,59 +5879,27 @@ var StatementView = ({
5668
5879
  ),
5669
5880
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
5670
5881
  /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Start Date" }),
5671
- /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
5672
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
5673
- Button,
5674
- {
5675
- variant: "outline",
5676
- className: cn(
5677
- "justify-start text-left font-normal",
5678
- !startDate && "text-muted-foreground"
5679
- ),
5680
- children: [
5681
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarIcon, { className: "mr-2 h-4 w-4" }),
5682
- startDate ? dateFns.format(startDate, "MM/dd/yyyy") : "Select date"
5683
- ]
5684
- }
5685
- ) }),
5686
- /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(
5687
- Calendar,
5688
- {
5689
- mode: "single",
5690
- selected: startDate,
5691
- onSelect: onStartDateChange,
5692
- initialFocus: true
5693
- }
5694
- ) })
5695
- ] })
5882
+ /* @__PURE__ */ jsxRuntime.jsx(
5883
+ DatePicker,
5884
+ {
5885
+ date: startDate,
5886
+ onDateChange: onStartDateChange,
5887
+ placeholder: "Select start date",
5888
+ buttonClassName: "w-full"
5889
+ }
5890
+ )
5696
5891
  ] }),
5697
5892
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
5698
5893
  /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "End Date" }),
5699
- /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
5700
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
5701
- Button,
5702
- {
5703
- variant: "outline",
5704
- className: cn(
5705
- "justify-start text-left font-normal",
5706
- !endDate && "text-muted-foreground"
5707
- ),
5708
- children: [
5709
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarIcon, { className: "mr-2 h-4 w-4" }),
5710
- endDate ? dateFns.format(endDate, "MM/dd/yyyy") : "Select date"
5711
- ]
5712
- }
5713
- ) }),
5714
- /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(
5715
- Calendar,
5716
- {
5717
- mode: "single",
5718
- selected: endDate,
5719
- onSelect: onEndDateChange,
5720
- initialFocus: true
5721
- }
5722
- ) })
5723
- ] })
5894
+ /* @__PURE__ */ jsxRuntime.jsx(
5895
+ DatePicker,
5896
+ {
5897
+ date: endDate,
5898
+ onDateChange: onEndDateChange,
5899
+ placeholder: "Select end date",
5900
+ buttonClassName: "w-full"
5901
+ }
5902
+ )
5724
5903
  ] })
5725
5904
  ] }),
5726
5905
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsxs(
@@ -7924,61 +8103,29 @@ var Businesses = () => {
7924
8103
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
7925
8104
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
7926
8105
  /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Created Date Start" }),
7927
- /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
7928
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
7929
- Button,
7930
- {
7931
- variant: "outline",
7932
- className: cn(
7933
- "w-full justify-start text-left font-normal",
7934
- !filters.createdDateStart && "text-muted-foreground"
7935
- ),
7936
- children: [
7937
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Calendar, { className: "mr-2 h-4 w-4" }),
7938
- filters.createdDateStart ? dateFns.format(filters.createdDateStart, "MM/dd/yyyy") : /* @__PURE__ */ jsxRuntime.jsx("span", { children: "MM/DD/YYYY" })
7939
- ]
7940
- }
7941
- ) }),
7942
- /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-auto p-0 bg-background z-50", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(
7943
- Calendar,
7944
- {
7945
- mode: "single",
7946
- selected: filters.createdDateStart,
7947
- onSelect: (date) => handleFilterChange("createdDateStart", date),
7948
- initialFocus: true,
7949
- className: "pointer-events-auto"
7950
- }
7951
- ) })
7952
- ] })
8106
+ /* @__PURE__ */ jsxRuntime.jsx(
8107
+ DatePicker,
8108
+ {
8109
+ date: filters.createdDateStart,
8110
+ onDateChange: (date) => handleFilterChange("createdDateStart", date),
8111
+ placeholder: "MM/DD/YYYY",
8112
+ buttonClassName: "w-full",
8113
+ className: "bg-background z-50"
8114
+ }
8115
+ )
7953
8116
  ] }),
7954
8117
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
7955
8118
  /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Created Date End" }),
7956
- /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
7957
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
7958
- Button,
7959
- {
7960
- variant: "outline",
7961
- className: cn(
7962
- "w-full justify-start text-left font-normal",
7963
- !filters.createdDateEnd && "text-muted-foreground"
7964
- ),
7965
- children: [
7966
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Calendar, { className: "mr-2 h-4 w-4" }),
7967
- filters.createdDateEnd ? dateFns.format(filters.createdDateEnd, "MM/dd/yyyy") : /* @__PURE__ */ jsxRuntime.jsx("span", { children: "MM/DD/YYYY" })
7968
- ]
7969
- }
7970
- ) }),
7971
- /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-auto p-0 bg-background z-50", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(
7972
- Calendar,
7973
- {
7974
- mode: "single",
7975
- selected: filters.createdDateEnd,
7976
- onSelect: (date) => handleFilterChange("createdDateEnd", date),
7977
- initialFocus: true,
7978
- className: "pointer-events-auto"
7979
- }
7980
- ) })
7981
- ] })
8119
+ /* @__PURE__ */ jsxRuntime.jsx(
8120
+ DatePicker,
8121
+ {
8122
+ date: filters.createdDateEnd,
8123
+ onDateChange: (date) => handleFilterChange("createdDateEnd", date),
8124
+ placeholder: "MM/DD/YYYY",
8125
+ buttonClassName: "w-full",
8126
+ className: "bg-background z-50"
8127
+ }
8128
+ )
7982
8129
  ] })
7983
8130
  ] })
7984
8131
  ] }),
@@ -8573,57 +8720,68 @@ var NotFound = () => {
8573
8720
  ] }) });
8574
8721
  };
8575
8722
  var NotFound_default = NotFound;
8576
-
8577
- // src/lib/mock-data/statement-data.ts
8578
- var mockStatementHeader = {
8579
- account: "1234567890",
8580
- productId: "PROD-001",
8581
- programId: "PROG-001",
8582
- startDate: "01/01/2024 00:00:00",
8583
- endDate: "01/31/2024 23:59:59",
8584
- startingBalance: "$125,450.00",
8585
- endingBalance: "$158,320.50"
8586
- };
8587
- var mockStatementTransactions = [
8588
- { transactionType: "ACH Credit", direction: "CREDIT", amount: 45e3, count: 12 },
8589
- { transactionType: "ACH Debit", direction: "DEBIT", amount: 23500, count: 8 },
8590
- { transactionType: "Wire Transfer In", direction: "CREDIT", amount: 15e3, count: 3 },
8591
- { transactionType: "Wire Transfer Out", direction: "DEBIT", amount: 8200, count: 2 },
8592
- { transactionType: "Card Purchase", direction: "DEBIT", amount: 5430.5, count: 45 },
8593
- { transactionType: "Direct Deposit", direction: "CREDIT", amount: 12500, count: 5 },
8594
- { transactionType: "ATM Withdrawal", direction: "DEBIT", amount: 3200, count: 16 },
8595
- { transactionType: "Check Deposit", direction: "CREDIT", amount: 8900, count: 4 },
8596
- { transactionType: "Bill Payment", direction: "DEBIT", amount: 6780, count: 18 },
8597
- { transactionType: "Transfer In", direction: "CREDIT", amount: 5200, count: 7 },
8598
- { transactionType: "Transfer Out", direction: "DEBIT", amount: 4350, count: 6 },
8599
- { transactionType: "Fee", direction: "DEBIT", amount: 125, count: 3 },
8600
- { transactionType: "Interest", direction: "CREDIT", amount: 85.5, count: 1 },
8601
- { transactionType: "Refund", direction: "CREDIT", amount: 450, count: 2 }
8602
- ];
8603
- var mockPrograms = [
8604
- { value: "PROG-001", label: "Consumer Banking Program" },
8605
- { value: "PROG-002", label: "Business Banking Program" },
8606
- { value: "PROG-003", label: "Premium Rewards Program" }
8607
- ];
8608
- var mockProducts = [
8609
- { value: "PROD-001", label: "Checking Account" },
8610
- { value: "PROD-002", label: "Savings Account" },
8611
- { value: "PROD-003", label: "Money Market Account" },
8612
- { value: "PROD-004", label: "Business Checking" }
8613
- ];
8614
8723
  function Statement() {
8615
- const [statementType, setStatementType] = React15.useState("");
8724
+ const [statementType, setStatementType] = React15.useState("root");
8616
8725
  const [selectedProgram, setSelectedProgram] = React15.useState("");
8617
8726
  const [selectedProduct, setSelectedProduct] = React15.useState("");
8618
8727
  const [accountNumber, setAccountNumber] = React15.useState("");
8619
- const [startDate, setStartDate] = React15.useState();
8620
- const [endDate, setEndDate] = React15.useState();
8728
+ const [startDate, setStartDate] = React15.useState(() => {
8729
+ const now = /* @__PURE__ */ new Date();
8730
+ return new Date(now.getFullYear(), now.getMonth(), 1);
8731
+ });
8732
+ const [endDate, setEndDate] = React15.useState(/* @__PURE__ */ new Date());
8621
8733
  const [statementGenerated, setStatementGenerated] = React15.useState(false);
8622
8734
  const [isLoading, setIsLoading] = React15.useState(false);
8623
- const [programs] = React15.useState(mockPrograms);
8624
- const [products] = React15.useState(mockProducts);
8735
+ const [programs, setPrograms] = React15.useState([]);
8736
+ const [products, setProducts] = React15.useState([]);
8737
+ const [programsLoading, setProgramsLoading] = React15.useState(false);
8738
+ const [productsLoading, setProductsLoading] = React15.useState(false);
8739
+ const [programsError, setProgramsError] = React15.useState(null);
8740
+ const [productsError, setProductsError] = React15.useState(null);
8625
8741
  const [statementHeader, setStatementHeader] = React15.useState(null);
8626
8742
  const [statementTransactions, setStatementTransactions] = React15.useState([]);
8743
+ const fetchPrograms = async () => {
8744
+ setProgramsLoading(true);
8745
+ setProgramsError(null);
8746
+ try {
8747
+ await new Promise((resolve) => setTimeout(resolve, 1e3));
8748
+ setPrograms(mockPrograms);
8749
+ } catch (error) {
8750
+ const errorMessage = error instanceof Error ? error.message : "Failed to load programs";
8751
+ setProgramsError(errorMessage);
8752
+ setPrograms([]);
8753
+ toast({
8754
+ title: "Error loading programs",
8755
+ description: errorMessage,
8756
+ variant: "destructive"
8757
+ });
8758
+ } finally {
8759
+ setProgramsLoading(false);
8760
+ }
8761
+ };
8762
+ const fetchProducts = async () => {
8763
+ setProductsLoading(true);
8764
+ setProductsError(null);
8765
+ try {
8766
+ await new Promise((resolve) => setTimeout(resolve, 1e3));
8767
+ setProducts(mockProducts);
8768
+ } catch (error) {
8769
+ const errorMessage = error instanceof Error ? error.message : "Failed to load products";
8770
+ setProductsError(errorMessage);
8771
+ setProducts([]);
8772
+ toast({
8773
+ title: "Error loading products",
8774
+ description: errorMessage,
8775
+ variant: "destructive"
8776
+ });
8777
+ } finally {
8778
+ setProductsLoading(false);
8779
+ }
8780
+ };
8781
+ React15.useEffect(() => {
8782
+ fetchPrograms();
8783
+ fetchProducts();
8784
+ }, []);
8627
8785
  const handleStatementTypeChange = (value) => {
8628
8786
  setStatementType(value);
8629
8787
  setSelectedProgram("");
@@ -8655,11 +8813,25 @@ function Statement() {
8655
8813
  };
8656
8814
  const isGenerateDisabled = () => {
8657
8815
  if (!statementType || !startDate || !endDate) return true;
8816
+ if (statementType === "program" && (programsError || programsLoading)) return true;
8817
+ if (statementType === "product" && (productsError || productsLoading)) return true;
8658
8818
  if (statementType === "program" && !selectedProgram) return true;
8659
8819
  if (statementType === "product" && !selectedProduct) return true;
8660
8820
  if (statementType === "account" && !accountNumber) return true;
8661
8821
  return false;
8662
8822
  };
8823
+ const handleRetryFetch = () => {
8824
+ if (statementType === "program" && programsError) {
8825
+ fetchPrograms();
8826
+ } else if (statementType === "product" && productsError) {
8827
+ fetchProducts();
8828
+ }
8829
+ };
8830
+ const shouldShowRetry = () => {
8831
+ if (statementType === "program" && programsError) return true;
8832
+ if (statementType === "product" && productsError) return true;
8833
+ return false;
8834
+ };
8663
8835
  const handleDownloadCSV = () => {
8664
8836
  console.log("Downloading CSV...");
8665
8837
  };
@@ -8683,6 +8855,10 @@ function Statement() {
8683
8855
  products,
8684
8856
  statementHeader,
8685
8857
  statementTransactions,
8858
+ programsLoading,
8859
+ productsLoading,
8860
+ programsError,
8861
+ productsError,
8686
8862
  onStatementTypeChange: handleStatementTypeChange,
8687
8863
  onProgramChange: setSelectedProgram,
8688
8864
  onProductChange: setSelectedProduct,
@@ -8693,6 +8869,8 @@ function Statement() {
8693
8869
  onEdit: handleEdit,
8694
8870
  onDownloadCSV: handleDownloadCSV,
8695
8871
  onPrintPDF: handlePrintPDF,
8872
+ onRetryFetch: handleRetryFetch,
8873
+ shouldShowRetry: shouldShowRetry(),
8696
8874
  isGenerateDisabled: isGenerateDisabled(),
8697
8875
  isLoading
8698
8876
  }
@@ -9252,121 +9430,57 @@ var TransactionHistory = () => {
9252
9430
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9253
9431
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
9254
9432
  /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Creation Date Start" }),
9255
- /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
9256
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
9257
- Button,
9258
- {
9259
- variant: "outline",
9260
- className: cn(
9261
- "w-full justify-start text-left font-normal",
9262
- !filters.creationDateStart && "text-muted-foreground"
9263
- ),
9264
- children: [
9265
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Calendar, { className: "mr-2 h-4 w-4" }),
9266
- filters.creationDateStart ? dateFns.format(filters.creationDateStart, "MM/dd/yyyy") : /* @__PURE__ */ jsxRuntime.jsx("span", { children: "MM/DD/YYYY" })
9267
- ]
9268
- }
9269
- ) }),
9270
- /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-auto p-0 bg-background z-50", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(
9271
- Calendar,
9272
- {
9273
- mode: "single",
9274
- selected: filters.creationDateStart,
9275
- onSelect: (date) => handleFilterChange("creationDateStart", date),
9276
- initialFocus: true,
9277
- className: "pointer-events-auto"
9278
- }
9279
- ) })
9280
- ] })
9433
+ /* @__PURE__ */ jsxRuntime.jsx(
9434
+ DatePicker,
9435
+ {
9436
+ date: filters.creationDateStart,
9437
+ onDateChange: (date) => handleFilterChange("creationDateStart", date),
9438
+ placeholder: "MM/DD/YYYY",
9439
+ buttonClassName: "w-full",
9440
+ className: "bg-background z-50"
9441
+ }
9442
+ )
9281
9443
  ] }),
9282
9444
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
9283
9445
  /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Creation Date End" }),
9284
- /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
9285
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
9286
- Button,
9287
- {
9288
- variant: "outline",
9289
- className: cn(
9290
- "w-full justify-start text-left font-normal",
9291
- !filters.creationDateEnd && "text-muted-foreground"
9292
- ),
9293
- children: [
9294
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Calendar, { className: "mr-2 h-4 w-4" }),
9295
- filters.creationDateEnd ? dateFns.format(filters.creationDateEnd, "MM/dd/yyyy") : /* @__PURE__ */ jsxRuntime.jsx("span", { children: "MM/DD/YYYY" })
9296
- ]
9297
- }
9298
- ) }),
9299
- /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-auto p-0 bg-background z-50", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(
9300
- Calendar,
9301
- {
9302
- mode: "single",
9303
- selected: filters.creationDateEnd,
9304
- onSelect: (date) => handleFilterChange("creationDateEnd", date),
9305
- initialFocus: true,
9306
- className: "pointer-events-auto"
9307
- }
9308
- ) })
9309
- ] })
9446
+ /* @__PURE__ */ jsxRuntime.jsx(
9447
+ DatePicker,
9448
+ {
9449
+ date: filters.creationDateEnd,
9450
+ onDateChange: (date) => handleFilterChange("creationDateEnd", date),
9451
+ placeholder: "MM/DD/YYYY",
9452
+ buttonClassName: "w-full",
9453
+ className: "bg-background z-50"
9454
+ }
9455
+ )
9310
9456
  ] })
9311
9457
  ] }),
9312
9458
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9313
9459
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
9314
9460
  /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Post Date Start" }),
9315
- /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
9316
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
9317
- Button,
9318
- {
9319
- variant: "outline",
9320
- className: cn(
9321
- "w-full justify-start text-left font-normal",
9322
- !filters.postDateStart && "text-muted-foreground"
9323
- ),
9324
- children: [
9325
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Calendar, { className: "mr-2 h-4 w-4" }),
9326
- filters.postDateStart ? dateFns.format(filters.postDateStart, "MM/dd/yyyy") : /* @__PURE__ */ jsxRuntime.jsx("span", { children: "MM/DD/YYYY" })
9327
- ]
9328
- }
9329
- ) }),
9330
- /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-auto p-0 bg-background z-50", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(
9331
- Calendar,
9332
- {
9333
- mode: "single",
9334
- selected: filters.postDateStart,
9335
- onSelect: (date) => handleFilterChange("postDateStart", date),
9336
- initialFocus: true,
9337
- className: "pointer-events-auto"
9338
- }
9339
- ) })
9340
- ] })
9461
+ /* @__PURE__ */ jsxRuntime.jsx(
9462
+ DatePicker,
9463
+ {
9464
+ date: filters.postDateStart,
9465
+ onDateChange: (date) => handleFilterChange("postDateStart", date),
9466
+ placeholder: "MM/DD/YYYY",
9467
+ buttonClassName: "w-full",
9468
+ className: "bg-background z-50"
9469
+ }
9470
+ )
9341
9471
  ] }),
9342
9472
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
9343
9473
  /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Post Date End" }),
9344
- /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
9345
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
9346
- Button,
9347
- {
9348
- variant: "outline",
9349
- className: cn(
9350
- "w-full justify-start text-left font-normal",
9351
- !filters.postDateEnd && "text-muted-foreground"
9352
- ),
9353
- children: [
9354
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Calendar, { className: "mr-2 h-4 w-4" }),
9355
- filters.postDateEnd ? dateFns.format(filters.postDateEnd, "MM/dd/yyyy") : /* @__PURE__ */ jsxRuntime.jsx("span", { children: "MM/DD/YYYY" })
9356
- ]
9357
- }
9358
- ) }),
9359
- /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-auto p-0 bg-background z-50", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(
9360
- Calendar,
9361
- {
9362
- mode: "single",
9363
- selected: filters.postDateEnd,
9364
- onSelect: (date) => handleFilterChange("postDateEnd", date),
9365
- initialFocus: true,
9366
- className: "pointer-events-auto"
9367
- }
9368
- ) })
9369
- ] })
9474
+ /* @__PURE__ */ jsxRuntime.jsx(
9475
+ DatePicker,
9476
+ {
9477
+ date: filters.postDateEnd,
9478
+ onDateChange: (date) => handleFilterChange("postDateEnd", date),
9479
+ placeholder: "MM/DD/YYYY",
9480
+ buttonClassName: "w-full",
9481
+ className: "bg-background z-50"
9482
+ }
9483
+ )
9370
9484
  ] })
9371
9485
  ] })
9372
9486
  ] }),