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.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
  }) => {
@@ -5637,24 +5802,34 @@ var StatementView = ({
5637
5802
  onValueChange: onStatementTypeChange
5638
5803
  }
5639
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
+ ] }) }),
5640
5813
  statementType === "program" && /* @__PURE__ */ jsxRuntime.jsx(
5641
5814
  EnhancedSelect,
5642
5815
  {
5643
5816
  label: "Program Name",
5644
- placeholder: "Select program",
5817
+ placeholder: programsLoading ? "Loading programs..." : "Select program",
5645
5818
  options: programs,
5646
5819
  value: selectedProgram,
5647
- onValueChange: onProgramChange
5820
+ onValueChange: onProgramChange,
5821
+ disabled: programsLoading || !!programsError
5648
5822
  }
5649
5823
  ),
5650
5824
  statementType === "product" && /* @__PURE__ */ jsxRuntime.jsx(
5651
5825
  EnhancedSelect,
5652
5826
  {
5653
5827
  label: "Product Name",
5654
- placeholder: "Select product",
5828
+ placeholder: productsLoading ? "Loading products..." : "Select product",
5655
5829
  options: products,
5656
5830
  value: selectedProduct,
5657
- onValueChange: onProductChange
5831
+ onValueChange: onProductChange,
5832
+ disabled: productsLoading || !!productsError
5658
5833
  }
5659
5834
  ),
5660
5835
  statementType === "account" && /* @__PURE__ */ jsxRuntime.jsx(
@@ -5668,62 +5843,44 @@ var StatementView = ({
5668
5843
  ),
5669
5844
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
5670
5845
  /* @__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
- ] })
5846
+ /* @__PURE__ */ jsxRuntime.jsx(
5847
+ DatePicker,
5848
+ {
5849
+ date: startDate,
5850
+ onDateChange: onStartDateChange,
5851
+ placeholder: "Select start date",
5852
+ buttonClassName: "w-full"
5853
+ }
5854
+ )
5696
5855
  ] }),
5697
5856
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
5698
5857
  /* @__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
- ] })
5858
+ /* @__PURE__ */ jsxRuntime.jsx(
5859
+ DatePicker,
5860
+ {
5861
+ date: endDate,
5862
+ onDateChange: onEndDateChange,
5863
+ placeholder: "Select end date",
5864
+ buttonClassName: "w-full"
5865
+ }
5866
+ )
5724
5867
  ] })
5725
5868
  ] }),
5726
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsxs(
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(
5727
5884
  Button,
5728
5885
  {
5729
5886
  onClick: onGenerateStatement,
@@ -7924,61 +8081,29 @@ var Businesses = () => {
7924
8081
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
7925
8082
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
7926
8083
  /* @__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
- ] })
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
+ )
7953
8094
  ] }),
7954
8095
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
7955
8096
  /* @__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
- ] })
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
+ )
7982
8107
  ] })
7983
8108
  ] })
7984
8109
  ] }),
@@ -8573,57 +8698,68 @@ var NotFound = () => {
8573
8698
  ] }) });
8574
8699
  };
8575
8700
  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
8701
  function Statement() {
8615
- const [statementType, setStatementType] = React15.useState("");
8702
+ const [statementType, setStatementType] = React15.useState("root");
8616
8703
  const [selectedProgram, setSelectedProgram] = React15.useState("");
8617
8704
  const [selectedProduct, setSelectedProduct] = React15.useState("");
8618
8705
  const [accountNumber, setAccountNumber] = React15.useState("");
8619
- const [startDate, setStartDate] = React15.useState();
8620
- 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());
8621
8711
  const [statementGenerated, setStatementGenerated] = React15.useState(false);
8622
8712
  const [isLoading, setIsLoading] = React15.useState(false);
8623
- const [programs] = React15.useState(mockPrograms);
8624
- const [products] = React15.useState(mockProducts);
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);
8625
8719
  const [statementHeader, setStatementHeader] = React15.useState(null);
8626
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
+ }, []);
8627
8763
  const handleStatementTypeChange = (value) => {
8628
8764
  setStatementType(value);
8629
8765
  setSelectedProgram("");
@@ -8655,11 +8791,25 @@ function Statement() {
8655
8791
  };
8656
8792
  const isGenerateDisabled = () => {
8657
8793
  if (!statementType || !startDate || !endDate) return true;
8794
+ if (statementType === "program" && (programsError || programsLoading)) return true;
8795
+ if (statementType === "product" && (productsError || productsLoading)) return true;
8658
8796
  if (statementType === "program" && !selectedProgram) return true;
8659
8797
  if (statementType === "product" && !selectedProduct) return true;
8660
8798
  if (statementType === "account" && !accountNumber) return true;
8661
8799
  return false;
8662
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
+ };
8663
8813
  const handleDownloadCSV = () => {
8664
8814
  console.log("Downloading CSV...");
8665
8815
  };
@@ -8683,6 +8833,10 @@ function Statement() {
8683
8833
  products,
8684
8834
  statementHeader,
8685
8835
  statementTransactions,
8836
+ programsLoading,
8837
+ productsLoading,
8838
+ programsError,
8839
+ productsError,
8686
8840
  onStatementTypeChange: handleStatementTypeChange,
8687
8841
  onProgramChange: setSelectedProgram,
8688
8842
  onProductChange: setSelectedProduct,
@@ -8693,6 +8847,8 @@ function Statement() {
8693
8847
  onEdit: handleEdit,
8694
8848
  onDownloadCSV: handleDownloadCSV,
8695
8849
  onPrintPDF: handlePrintPDF,
8850
+ onRetryFetch: handleRetryFetch,
8851
+ shouldShowRetry: shouldShowRetry(),
8696
8852
  isGenerateDisabled: isGenerateDisabled(),
8697
8853
  isLoading
8698
8854
  }
@@ -9252,121 +9408,57 @@ var TransactionHistory = () => {
9252
9408
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9253
9409
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
9254
9410
  /* @__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
- ] })
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
+ )
9281
9421
  ] }),
9282
9422
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
9283
9423
  /* @__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
- ] })
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
+ )
9310
9434
  ] })
9311
9435
  ] }),
9312
9436
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9313
9437
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
9314
9438
  /* @__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
- ] })
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
+ )
9341
9449
  ] }),
9342
9450
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
9343
9451
  /* @__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
- ] })
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
+ )
9370
9462
  ] })
9371
9463
  ] })
9372
9464
  ] }),