braid-ui 1.0.6 → 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.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,7 +5778,10 @@ var StatementView = ({
5615
5778
  onEdit,
5616
5779
  onDownloadCSV,
5617
5780
  onPrintPDF,
5618
- isGenerateDisabled
5781
+ onRetryFetch,
5782
+ shouldShowRetry,
5783
+ isGenerateDisabled,
5784
+ isLoading
5619
5785
  }) => {
5620
5786
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "container mx-auto p-6 space-y-6", children: [
5621
5787
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
@@ -5636,24 +5802,34 @@ var StatementView = ({
5636
5802
  onValueChange: onStatementTypeChange
5637
5803
  }
5638
5804
  ),
5805
+ statementType === "program" && programsError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-full", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 p-3 bg-destructive/10 border border-destructive/20 rounded-md text-sm text-destructive", children: [
5806
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircle, { className: "h-4 w-4" }),
5807
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: programsError })
5808
+ ] }) }),
5809
+ statementType === "product" && productsError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-full", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 p-3 bg-destructive/10 border border-destructive/20 rounded-md text-sm text-destructive", children: [
5810
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircle, { className: "h-4 w-4" }),
5811
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: productsError })
5812
+ ] }) }),
5639
5813
  statementType === "program" && /* @__PURE__ */ jsxRuntime.jsx(
5640
5814
  EnhancedSelect,
5641
5815
  {
5642
5816
  label: "Program Name",
5643
- placeholder: "Select program",
5817
+ placeholder: programsLoading ? "Loading programs..." : "Select program",
5644
5818
  options: programs,
5645
5819
  value: selectedProgram,
5646
- onValueChange: onProgramChange
5820
+ onValueChange: onProgramChange,
5821
+ disabled: programsLoading || !!programsError
5647
5822
  }
5648
5823
  ),
5649
5824
  statementType === "product" && /* @__PURE__ */ jsxRuntime.jsx(
5650
5825
  EnhancedSelect,
5651
5826
  {
5652
5827
  label: "Product Name",
5653
- placeholder: "Select product",
5828
+ placeholder: productsLoading ? "Loading products..." : "Select product",
5654
5829
  options: products,
5655
5830
  value: selectedProduct,
5656
- onValueChange: onProductChange
5831
+ onValueChange: onProductChange,
5832
+ disabled: productsLoading || !!productsError
5657
5833
  }
5658
5834
  ),
5659
5835
  statementType === "account" && /* @__PURE__ */ jsxRuntime.jsx(
@@ -5667,67 +5843,52 @@ var StatementView = ({
5667
5843
  ),
5668
5844
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
5669
5845
  /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Start Date" }),
5670
- /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
5671
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
5672
- Button,
5673
- {
5674
- variant: "outline",
5675
- className: cn(
5676
- "justify-start text-left font-normal",
5677
- !startDate && "text-muted-foreground"
5678
- ),
5679
- children: [
5680
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarIcon, { className: "mr-2 h-4 w-4" }),
5681
- startDate ? dateFns.format(startDate, "MM/dd/yyyy") : "Select date"
5682
- ]
5683
- }
5684
- ) }),
5685
- /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(
5686
- Calendar,
5687
- {
5688
- mode: "single",
5689
- selected: startDate,
5690
- onSelect: onStartDateChange,
5691
- initialFocus: true
5692
- }
5693
- ) })
5694
- ] })
5846
+ /* @__PURE__ */ jsxRuntime.jsx(
5847
+ DatePicker,
5848
+ {
5849
+ date: startDate,
5850
+ onDateChange: onStartDateChange,
5851
+ placeholder: "Select start date",
5852
+ buttonClassName: "w-full"
5853
+ }
5854
+ )
5695
5855
  ] }),
5696
5856
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
5697
5857
  /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "End Date" }),
5698
- /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
5699
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
5700
- Button,
5701
- {
5702
- variant: "outline",
5703
- className: cn(
5704
- "justify-start text-left font-normal",
5705
- !endDate && "text-muted-foreground"
5706
- ),
5707
- children: [
5708
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarIcon, { className: "mr-2 h-4 w-4" }),
5709
- endDate ? dateFns.format(endDate, "MM/dd/yyyy") : "Select date"
5710
- ]
5711
- }
5712
- ) }),
5713
- /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(
5714
- Calendar,
5715
- {
5716
- mode: "single",
5717
- selected: endDate,
5718
- onSelect: onEndDateChange,
5719
- initialFocus: true
5720
- }
5721
- ) })
5722
- ] })
5858
+ /* @__PURE__ */ jsxRuntime.jsx(
5859
+ DatePicker,
5860
+ {
5861
+ date: endDate,
5862
+ onDateChange: onEndDateChange,
5863
+ placeholder: "Select end date",
5864
+ buttonClassName: "w-full"
5865
+ }
5866
+ )
5723
5867
  ] })
5724
5868
  ] }),
5725
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(
5869
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end", children: shouldShowRetry ? /* @__PURE__ */ jsxRuntime.jsxs(
5870
+ Button,
5871
+ {
5872
+ onClick: onRetryFetch,
5873
+ variant: "outline",
5874
+ disabled: programsLoading || productsLoading,
5875
+ children: [
5876
+ (programsLoading || productsLoading) && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 animate-spin" }),
5877
+ programsLoading || productsLoading ? "Retrying..." : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5878
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RefreshCw, { className: "h-4 w-4" }),
5879
+ "Retry"
5880
+ ] })
5881
+ ]
5882
+ }
5883
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(
5726
5884
  Button,
5727
5885
  {
5728
5886
  onClick: onGenerateStatement,
5729
- disabled: isGenerateDisabled,
5730
- children: "Generate Statement"
5887
+ disabled: isGenerateDisabled || isLoading,
5888
+ children: [
5889
+ isLoading && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 animate-spin" }),
5890
+ isLoading ? "Generating..." : "Generate Statement"
5891
+ ]
5731
5892
  }
5732
5893
  ) })
5733
5894
  ] })
@@ -7920,61 +8081,29 @@ var Businesses = () => {
7920
8081
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
7921
8082
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
7922
8083
  /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Created Date Start" }),
7923
- /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
7924
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
7925
- Button,
7926
- {
7927
- variant: "outline",
7928
- className: cn(
7929
- "w-full justify-start text-left font-normal",
7930
- !filters.createdDateStart && "text-muted-foreground"
7931
- ),
7932
- children: [
7933
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Calendar, { className: "mr-2 h-4 w-4" }),
7934
- filters.createdDateStart ? dateFns.format(filters.createdDateStart, "MM/dd/yyyy") : /* @__PURE__ */ jsxRuntime.jsx("span", { children: "MM/DD/YYYY" })
7935
- ]
7936
- }
7937
- ) }),
7938
- /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-auto p-0 bg-background z-50", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(
7939
- Calendar,
7940
- {
7941
- mode: "single",
7942
- selected: filters.createdDateStart,
7943
- onSelect: (date) => handleFilterChange("createdDateStart", date),
7944
- initialFocus: true,
7945
- className: "pointer-events-auto"
7946
- }
7947
- ) })
7948
- ] })
8084
+ /* @__PURE__ */ jsxRuntime.jsx(
8085
+ DatePicker,
8086
+ {
8087
+ date: filters.createdDateStart,
8088
+ onDateChange: (date) => handleFilterChange("createdDateStart", date),
8089
+ placeholder: "MM/DD/YYYY",
8090
+ buttonClassName: "w-full",
8091
+ className: "bg-background z-50"
8092
+ }
8093
+ )
7949
8094
  ] }),
7950
8095
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
7951
8096
  /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Created Date End" }),
7952
- /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
7953
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
7954
- Button,
7955
- {
7956
- variant: "outline",
7957
- className: cn(
7958
- "w-full justify-start text-left font-normal",
7959
- !filters.createdDateEnd && "text-muted-foreground"
7960
- ),
7961
- children: [
7962
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Calendar, { className: "mr-2 h-4 w-4" }),
7963
- filters.createdDateEnd ? dateFns.format(filters.createdDateEnd, "MM/dd/yyyy") : /* @__PURE__ */ jsxRuntime.jsx("span", { children: "MM/DD/YYYY" })
7964
- ]
7965
- }
7966
- ) }),
7967
- /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-auto p-0 bg-background z-50", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(
7968
- Calendar,
7969
- {
7970
- mode: "single",
7971
- selected: filters.createdDateEnd,
7972
- onSelect: (date) => handleFilterChange("createdDateEnd", date),
7973
- initialFocus: true,
7974
- className: "pointer-events-auto"
7975
- }
7976
- ) })
7977
- ] })
8097
+ /* @__PURE__ */ jsxRuntime.jsx(
8098
+ DatePicker,
8099
+ {
8100
+ date: filters.createdDateEnd,
8101
+ onDateChange: (date) => handleFilterChange("createdDateEnd", date),
8102
+ placeholder: "MM/DD/YYYY",
8103
+ buttonClassName: "w-full",
8104
+ className: "bg-background z-50"
8105
+ }
8106
+ )
7978
8107
  ] })
7979
8108
  ] })
7980
8109
  ] }),
@@ -8569,86 +8698,118 @@ var NotFound = () => {
8569
8698
  ] }) });
8570
8699
  };
8571
8700
  var NotFound_default = NotFound;
8572
-
8573
- // src/lib/mock-data/statement-data.ts
8574
- var mockStatementHeader = {
8575
- account: "1234567890",
8576
- productId: "PROD-001",
8577
- programId: "PROG-001",
8578
- startDate: "01/01/2024 00:00:00",
8579
- endDate: "01/31/2024 23:59:59",
8580
- startingBalance: "$125,450.00",
8581
- endingBalance: "$158,320.50"
8582
- };
8583
- var mockStatementTransactions = [
8584
- { transactionType: "ACH Credit", direction: "CREDIT", amount: 45e3, count: 12 },
8585
- { transactionType: "ACH Debit", direction: "DEBIT", amount: 23500, count: 8 },
8586
- { transactionType: "Wire Transfer In", direction: "CREDIT", amount: 15e3, count: 3 },
8587
- { transactionType: "Wire Transfer Out", direction: "DEBIT", amount: 8200, count: 2 },
8588
- { transactionType: "Card Purchase", direction: "DEBIT", amount: 5430.5, count: 45 },
8589
- { transactionType: "Direct Deposit", direction: "CREDIT", amount: 12500, count: 5 },
8590
- { transactionType: "ATM Withdrawal", direction: "DEBIT", amount: 3200, count: 16 },
8591
- { transactionType: "Check Deposit", direction: "CREDIT", amount: 8900, count: 4 },
8592
- { transactionType: "Bill Payment", direction: "DEBIT", amount: 6780, count: 18 },
8593
- { transactionType: "Transfer In", direction: "CREDIT", amount: 5200, count: 7 },
8594
- { transactionType: "Transfer Out", direction: "DEBIT", amount: 4350, count: 6 },
8595
- { transactionType: "Fee", direction: "DEBIT", amount: 125, count: 3 },
8596
- { transactionType: "Interest", direction: "CREDIT", amount: 85.5, count: 1 },
8597
- { transactionType: "Refund", direction: "CREDIT", amount: 450, count: 2 }
8598
- ];
8599
- var mockPrograms = [
8600
- { value: "PROG-001", label: "Consumer Banking Program" },
8601
- { value: "PROG-002", label: "Business Banking Program" },
8602
- { value: "PROG-003", label: "Premium Rewards Program" }
8603
- ];
8604
- var mockProducts = [
8605
- { value: "PROD-001", label: "Checking Account" },
8606
- { value: "PROD-002", label: "Savings Account" },
8607
- { value: "PROD-003", label: "Money Market Account" },
8608
- { value: "PROD-004", label: "Business Checking" }
8609
- ];
8610
8701
  function Statement() {
8611
- const [statementType, setStatementType] = React15.useState("");
8702
+ const [statementType, setStatementType] = React15.useState("root");
8612
8703
  const [selectedProgram, setSelectedProgram] = React15.useState("");
8613
8704
  const [selectedProduct, setSelectedProduct] = React15.useState("");
8614
8705
  const [accountNumber, setAccountNumber] = React15.useState("");
8615
- const [startDate, setStartDate] = React15.useState();
8616
- const [endDate, setEndDate] = React15.useState();
8706
+ const [startDate, setStartDate] = React15.useState(() => {
8707
+ const now = /* @__PURE__ */ new Date();
8708
+ return new Date(now.getFullYear(), now.getMonth(), 1);
8709
+ });
8710
+ const [endDate, setEndDate] = React15.useState(/* @__PURE__ */ new Date());
8617
8711
  const [statementGenerated, setStatementGenerated] = React15.useState(false);
8618
- const [programs] = React15.useState(mockPrograms);
8619
- const [products] = React15.useState(mockProducts);
8712
+ const [isLoading, setIsLoading] = React15.useState(false);
8713
+ const [programs, setPrograms] = React15.useState([]);
8714
+ const [products, setProducts] = React15.useState([]);
8715
+ const [programsLoading, setProgramsLoading] = React15.useState(false);
8716
+ const [productsLoading, setProductsLoading] = React15.useState(false);
8717
+ const [programsError, setProgramsError] = React15.useState(null);
8718
+ const [productsError, setProductsError] = React15.useState(null);
8620
8719
  const [statementHeader, setStatementHeader] = React15.useState(null);
8621
8720
  const [statementTransactions, setStatementTransactions] = React15.useState([]);
8721
+ const fetchPrograms = async () => {
8722
+ setProgramsLoading(true);
8723
+ setProgramsError(null);
8724
+ try {
8725
+ await new Promise((resolve) => setTimeout(resolve, 1e3));
8726
+ setPrograms(mockPrograms);
8727
+ } catch (error) {
8728
+ const errorMessage = error instanceof Error ? error.message : "Failed to load programs";
8729
+ setProgramsError(errorMessage);
8730
+ setPrograms([]);
8731
+ toast({
8732
+ title: "Error loading programs",
8733
+ description: errorMessage,
8734
+ variant: "destructive"
8735
+ });
8736
+ } finally {
8737
+ setProgramsLoading(false);
8738
+ }
8739
+ };
8740
+ const fetchProducts = async () => {
8741
+ setProductsLoading(true);
8742
+ setProductsError(null);
8743
+ try {
8744
+ await new Promise((resolve) => setTimeout(resolve, 1e3));
8745
+ setProducts(mockProducts);
8746
+ } catch (error) {
8747
+ const errorMessage = error instanceof Error ? error.message : "Failed to load products";
8748
+ setProductsError(errorMessage);
8749
+ setProducts([]);
8750
+ toast({
8751
+ title: "Error loading products",
8752
+ description: errorMessage,
8753
+ variant: "destructive"
8754
+ });
8755
+ } finally {
8756
+ setProductsLoading(false);
8757
+ }
8758
+ };
8759
+ React15.useEffect(() => {
8760
+ fetchPrograms();
8761
+ fetchProducts();
8762
+ }, []);
8622
8763
  const handleStatementTypeChange = (value) => {
8623
8764
  setStatementType(value);
8624
8765
  setSelectedProgram("");
8625
8766
  setSelectedProduct("");
8626
8767
  setAccountNumber("");
8627
8768
  };
8628
- const handleGenerateStatement = () => {
8769
+ const handleGenerateStatement = async () => {
8629
8770
  if (!statementType || !startDate || !endDate) return;
8630
8771
  if (statementType === "program" && !selectedProgram) return;
8631
8772
  if (statementType === "product" && !selectedProduct) return;
8632
8773
  if (statementType === "account" && !accountNumber) return;
8633
- console.log("Generating statement with:", {
8634
- statementType,
8635
- selectedProgram,
8636
- selectedProduct,
8637
- accountNumber,
8638
- startDate,
8639
- endDate
8640
- });
8641
- setStatementHeader(mockStatementHeader);
8642
- setStatementTransactions(mockStatementTransactions);
8643
- setStatementGenerated(true);
8774
+ setIsLoading(true);
8775
+ try {
8776
+ console.log("Generating statement with:", {
8777
+ statementType,
8778
+ selectedProgram,
8779
+ selectedProduct,
8780
+ accountNumber,
8781
+ startDate,
8782
+ endDate
8783
+ });
8784
+ await new Promise((resolve) => setTimeout(resolve, 1e3));
8785
+ setStatementHeader(mockStatementHeader);
8786
+ setStatementTransactions(mockStatementTransactions);
8787
+ setStatementGenerated(true);
8788
+ } finally {
8789
+ setIsLoading(false);
8790
+ }
8644
8791
  };
8645
8792
  const isGenerateDisabled = () => {
8646
8793
  if (!statementType || !startDate || !endDate) return true;
8794
+ if (statementType === "program" && (programsError || programsLoading)) return true;
8795
+ if (statementType === "product" && (productsError || productsLoading)) return true;
8647
8796
  if (statementType === "program" && !selectedProgram) return true;
8648
8797
  if (statementType === "product" && !selectedProduct) return true;
8649
8798
  if (statementType === "account" && !accountNumber) return true;
8650
8799
  return false;
8651
8800
  };
8801
+ const handleRetryFetch = () => {
8802
+ if (statementType === "program" && programsError) {
8803
+ fetchPrograms();
8804
+ } else if (statementType === "product" && productsError) {
8805
+ fetchProducts();
8806
+ }
8807
+ };
8808
+ const shouldShowRetry = () => {
8809
+ if (statementType === "program" && programsError) return true;
8810
+ if (statementType === "product" && productsError) return true;
8811
+ return false;
8812
+ };
8652
8813
  const handleDownloadCSV = () => {
8653
8814
  console.log("Downloading CSV...");
8654
8815
  };
@@ -8672,6 +8833,10 @@ function Statement() {
8672
8833
  products,
8673
8834
  statementHeader,
8674
8835
  statementTransactions,
8836
+ programsLoading,
8837
+ productsLoading,
8838
+ programsError,
8839
+ productsError,
8675
8840
  onStatementTypeChange: handleStatementTypeChange,
8676
8841
  onProgramChange: setSelectedProgram,
8677
8842
  onProductChange: setSelectedProduct,
@@ -8682,7 +8847,10 @@ function Statement() {
8682
8847
  onEdit: handleEdit,
8683
8848
  onDownloadCSV: handleDownloadCSV,
8684
8849
  onPrintPDF: handlePrintPDF,
8685
- isGenerateDisabled: isGenerateDisabled()
8850
+ onRetryFetch: handleRetryFetch,
8851
+ shouldShowRetry: shouldShowRetry(),
8852
+ isGenerateDisabled: isGenerateDisabled(),
8853
+ isLoading
8686
8854
  }
8687
8855
  );
8688
8856
  }
@@ -9240,121 +9408,57 @@ var TransactionHistory = () => {
9240
9408
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9241
9409
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
9242
9410
  /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Creation Date Start" }),
9243
- /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
9244
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
9245
- Button,
9246
- {
9247
- variant: "outline",
9248
- className: cn(
9249
- "w-full justify-start text-left font-normal",
9250
- !filters.creationDateStart && "text-muted-foreground"
9251
- ),
9252
- children: [
9253
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Calendar, { className: "mr-2 h-4 w-4" }),
9254
- filters.creationDateStart ? dateFns.format(filters.creationDateStart, "MM/dd/yyyy") : /* @__PURE__ */ jsxRuntime.jsx("span", { children: "MM/DD/YYYY" })
9255
- ]
9256
- }
9257
- ) }),
9258
- /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-auto p-0 bg-background z-50", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(
9259
- Calendar,
9260
- {
9261
- mode: "single",
9262
- selected: filters.creationDateStart,
9263
- onSelect: (date) => handleFilterChange("creationDateStart", date),
9264
- initialFocus: true,
9265
- className: "pointer-events-auto"
9266
- }
9267
- ) })
9268
- ] })
9411
+ /* @__PURE__ */ jsxRuntime.jsx(
9412
+ DatePicker,
9413
+ {
9414
+ date: filters.creationDateStart,
9415
+ onDateChange: (date) => handleFilterChange("creationDateStart", date),
9416
+ placeholder: "MM/DD/YYYY",
9417
+ buttonClassName: "w-full",
9418
+ className: "bg-background z-50"
9419
+ }
9420
+ )
9269
9421
  ] }),
9270
9422
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
9271
9423
  /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Creation Date End" }),
9272
- /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
9273
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
9274
- Button,
9275
- {
9276
- variant: "outline",
9277
- className: cn(
9278
- "w-full justify-start text-left font-normal",
9279
- !filters.creationDateEnd && "text-muted-foreground"
9280
- ),
9281
- children: [
9282
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Calendar, { className: "mr-2 h-4 w-4" }),
9283
- filters.creationDateEnd ? dateFns.format(filters.creationDateEnd, "MM/dd/yyyy") : /* @__PURE__ */ jsxRuntime.jsx("span", { children: "MM/DD/YYYY" })
9284
- ]
9285
- }
9286
- ) }),
9287
- /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-auto p-0 bg-background z-50", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(
9288
- Calendar,
9289
- {
9290
- mode: "single",
9291
- selected: filters.creationDateEnd,
9292
- onSelect: (date) => handleFilterChange("creationDateEnd", date),
9293
- initialFocus: true,
9294
- className: "pointer-events-auto"
9295
- }
9296
- ) })
9297
- ] })
9424
+ /* @__PURE__ */ jsxRuntime.jsx(
9425
+ DatePicker,
9426
+ {
9427
+ date: filters.creationDateEnd,
9428
+ onDateChange: (date) => handleFilterChange("creationDateEnd", date),
9429
+ placeholder: "MM/DD/YYYY",
9430
+ buttonClassName: "w-full",
9431
+ className: "bg-background z-50"
9432
+ }
9433
+ )
9298
9434
  ] })
9299
9435
  ] }),
9300
9436
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9301
9437
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
9302
9438
  /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Post Date Start" }),
9303
- /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
9304
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
9305
- Button,
9306
- {
9307
- variant: "outline",
9308
- className: cn(
9309
- "w-full justify-start text-left font-normal",
9310
- !filters.postDateStart && "text-muted-foreground"
9311
- ),
9312
- children: [
9313
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Calendar, { className: "mr-2 h-4 w-4" }),
9314
- filters.postDateStart ? dateFns.format(filters.postDateStart, "MM/dd/yyyy") : /* @__PURE__ */ jsxRuntime.jsx("span", { children: "MM/DD/YYYY" })
9315
- ]
9316
- }
9317
- ) }),
9318
- /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-auto p-0 bg-background z-50", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(
9319
- Calendar,
9320
- {
9321
- mode: "single",
9322
- selected: filters.postDateStart,
9323
- onSelect: (date) => handleFilterChange("postDateStart", date),
9324
- initialFocus: true,
9325
- className: "pointer-events-auto"
9326
- }
9327
- ) })
9328
- ] })
9439
+ /* @__PURE__ */ jsxRuntime.jsx(
9440
+ DatePicker,
9441
+ {
9442
+ date: filters.postDateStart,
9443
+ onDateChange: (date) => handleFilterChange("postDateStart", date),
9444
+ placeholder: "MM/DD/YYYY",
9445
+ buttonClassName: "w-full",
9446
+ className: "bg-background z-50"
9447
+ }
9448
+ )
9329
9449
  ] }),
9330
9450
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
9331
9451
  /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Post Date End" }),
9332
- /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
9333
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
9334
- Button,
9335
- {
9336
- variant: "outline",
9337
- className: cn(
9338
- "w-full justify-start text-left font-normal",
9339
- !filters.postDateEnd && "text-muted-foreground"
9340
- ),
9341
- children: [
9342
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Calendar, { className: "mr-2 h-4 w-4" }),
9343
- filters.postDateEnd ? dateFns.format(filters.postDateEnd, "MM/dd/yyyy") : /* @__PURE__ */ jsxRuntime.jsx("span", { children: "MM/DD/YYYY" })
9344
- ]
9345
- }
9346
- ) }),
9347
- /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-auto p-0 bg-background z-50", align: "start", children: /* @__PURE__ */ jsxRuntime.jsx(
9348
- Calendar,
9349
- {
9350
- mode: "single",
9351
- selected: filters.postDateEnd,
9352
- onSelect: (date) => handleFilterChange("postDateEnd", date),
9353
- initialFocus: true,
9354
- className: "pointer-events-auto"
9355
- }
9356
- ) })
9357
- ] })
9452
+ /* @__PURE__ */ jsxRuntime.jsx(
9453
+ DatePicker,
9454
+ {
9455
+ date: filters.postDateEnd,
9456
+ onDateChange: (date) => handleFilterChange("postDateEnd", date),
9457
+ placeholder: "MM/DD/YYYY",
9458
+ buttonClassName: "w-full",
9459
+ className: "bg-background z-50"
9460
+ }
9461
+ )
9358
9462
  ] })
9359
9463
  ] })
9360
9464
  ] }),