@wealthx/shadcn 1.5.11 → 1.5.12
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/.turbo/turbo-build.log +67 -67
- package/CHANGELOG.md +6 -0
- package/dist/{chunk-O5CP6VP6.mjs → chunk-CPM6P63C.mjs} +56 -44
- package/dist/{chunk-ZMTCMP2G.mjs → chunk-EB626HVW.mjs} +70 -3
- package/dist/components/ui/ai-conversations.js +70 -3
- package/dist/components/ui/ai-conversations.mjs +1 -1
- package/dist/components/ui/bank-statement-generate-dialog.js +61 -46
- package/dist/components/ui/bank-statement-generate-dialog.mjs +1 -1
- package/dist/index.js +126 -44
- package/dist/index.mjs +2 -2
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/components/ui/ai-conversations.tsx +157 -23
- package/src/components/ui/bank-statement-generate-dialog.tsx +84 -61
- package/src/styles/styles-css.ts +1 -1
|
@@ -424,15 +424,19 @@ function ChatComposer({
|
|
|
424
424
|
mode,
|
|
425
425
|
channel: channelProp = "chat",
|
|
426
426
|
onChannelChange,
|
|
427
|
+
isEmailIntegrated = false,
|
|
427
428
|
contactEmail = "",
|
|
428
429
|
inputValue = "",
|
|
429
430
|
onInputChange,
|
|
430
431
|
onSend,
|
|
432
|
+
onSendEmail,
|
|
431
433
|
onTakeOver,
|
|
432
434
|
onLetAiHandle,
|
|
433
435
|
className
|
|
434
436
|
}) {
|
|
435
|
-
const [channel, setChannel] = React.useState(
|
|
437
|
+
const [channel, setChannel] = React.useState(
|
|
438
|
+
isEmailIntegrated ? channelProp : "chat"
|
|
439
|
+
);
|
|
436
440
|
const [emailTo, setEmailTo] = React.useState(contactEmail);
|
|
437
441
|
const [emailCc, setEmailCc] = React.useState("");
|
|
438
442
|
const [showCc, setShowCc] = React.useState(false);
|
|
@@ -482,7 +486,7 @@ function ChatComposer({
|
|
|
482
486
|
className
|
|
483
487
|
),
|
|
484
488
|
children: [
|
|
485
|
-
/* @__PURE__ */ jsx("div", { className: "border-b border-border px-3 py-2", children: /* @__PURE__ */ jsx(
|
|
489
|
+
isEmailIntegrated && /* @__PURE__ */ jsx("div", { className: "border-b border-border px-3 py-2", children: /* @__PURE__ */ jsx(
|
|
486
490
|
Tabs,
|
|
487
491
|
{
|
|
488
492
|
value: channel,
|
|
@@ -617,7 +621,12 @@ function ChatComposer({
|
|
|
617
621
|
Button,
|
|
618
622
|
{
|
|
619
623
|
size: "sm",
|
|
620
|
-
onClick: () =>
|
|
624
|
+
onClick: () => onSendEmail == null ? void 0 : onSendEmail({
|
|
625
|
+
content: inputValue,
|
|
626
|
+
to: emailTo,
|
|
627
|
+
cc: emailCc,
|
|
628
|
+
subject: emailSubject
|
|
629
|
+
}),
|
|
621
630
|
disabled: !inputValue.trim() || !emailTo.trim(),
|
|
622
631
|
children: [
|
|
623
632
|
/* @__PURE__ */ jsx(Send, { className: "mr-1.5 size-3.5" }),
|
|
@@ -672,9 +681,11 @@ function ChatThread({
|
|
|
672
681
|
isAiTyping = false,
|
|
673
682
|
channel,
|
|
674
683
|
onChannelChange,
|
|
684
|
+
isEmailIntegrated,
|
|
675
685
|
inputValue,
|
|
676
686
|
onInputChange,
|
|
677
687
|
onSend,
|
|
688
|
+
onSendEmail,
|
|
678
689
|
onTakeOver,
|
|
679
690
|
onLetAiHandle,
|
|
680
691
|
onReopen,
|
|
@@ -682,12 +693,53 @@ function ChatThread({
|
|
|
682
693
|
onUnmarkUrgent,
|
|
683
694
|
onArchive,
|
|
684
695
|
onAssignToAdvisor,
|
|
696
|
+
hasMoreMessages,
|
|
697
|
+
isLoadingMoreMessages,
|
|
698
|
+
onLoadMoreMessages,
|
|
685
699
|
onBack,
|
|
686
700
|
onShowLeadInfo,
|
|
687
701
|
className
|
|
688
702
|
}) {
|
|
689
703
|
const aiIsHandling = mode === "ai";
|
|
690
704
|
const isClosed = status === "closed";
|
|
705
|
+
const scrollRef = React.useRef(null);
|
|
706
|
+
const preLoadScrollHeightRef = React.useRef(null);
|
|
707
|
+
const handleScroll = (e) => {
|
|
708
|
+
if (!hasMoreMessages || isLoadingMoreMessages || !onLoadMoreMessages) {
|
|
709
|
+
return;
|
|
710
|
+
}
|
|
711
|
+
if (e.currentTarget.scrollTop <= 80) {
|
|
712
|
+
preLoadScrollHeightRef.current = e.currentTarget.scrollHeight;
|
|
713
|
+
onLoadMoreMessages();
|
|
714
|
+
}
|
|
715
|
+
};
|
|
716
|
+
const prevLastMessageIdRef = React.useRef(void 0);
|
|
717
|
+
const prevContactIdRef = React.useRef(contact.id);
|
|
718
|
+
React.useLayoutEffect(() => {
|
|
719
|
+
var _a, _b;
|
|
720
|
+
const el = scrollRef.current;
|
|
721
|
+
if (!el) return;
|
|
722
|
+
if (preLoadScrollHeightRef.current !== null) {
|
|
723
|
+
el.scrollTop = el.scrollHeight - preLoadScrollHeightRef.current;
|
|
724
|
+
preLoadScrollHeightRef.current = null;
|
|
725
|
+
prevLastMessageIdRef.current = (_a = messages[messages.length - 1]) == null ? void 0 : _a.id;
|
|
726
|
+
prevContactIdRef.current = contact.id;
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
729
|
+
const currentLastId = (_b = messages[messages.length - 1]) == null ? void 0 : _b.id;
|
|
730
|
+
const contactChanged = prevContactIdRef.current !== contact.id;
|
|
731
|
+
const tailChanged = prevLastMessageIdRef.current !== currentLastId;
|
|
732
|
+
if (contactChanged || tailChanged) {
|
|
733
|
+
el.scrollTop = el.scrollHeight;
|
|
734
|
+
}
|
|
735
|
+
prevLastMessageIdRef.current = currentLastId;
|
|
736
|
+
prevContactIdRef.current = contact.id;
|
|
737
|
+
}, [contact.id, messages]);
|
|
738
|
+
React.useLayoutEffect(() => {
|
|
739
|
+
if (!isAiTyping) return;
|
|
740
|
+
const el = scrollRef.current;
|
|
741
|
+
if (el) el.scrollTop = el.scrollHeight;
|
|
742
|
+
}, [isAiTyping]);
|
|
691
743
|
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col bg-background", className), children: [
|
|
692
744
|
/* @__PURE__ */ jsxs(
|
|
693
745
|
"div",
|
|
@@ -777,9 +829,12 @@ function ChatThread({
|
|
|
777
829
|
/* @__PURE__ */ jsxs(
|
|
778
830
|
"div",
|
|
779
831
|
{
|
|
832
|
+
ref: scrollRef,
|
|
833
|
+
onScroll: handleScroll,
|
|
780
834
|
className: "flex flex-1 flex-col gap-4 overflow-y-auto p-4",
|
|
781
835
|
tabIndex: 0,
|
|
782
836
|
children: [
|
|
837
|
+
isLoadingMoreMessages && /* @__PURE__ */ jsx("div", { className: "flex justify-center py-1 text-caption text-muted-foreground", children: "Loading older messages..." }),
|
|
783
838
|
messages.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col items-center justify-center gap-2 text-muted-foreground", children: [
|
|
784
839
|
/* @__PURE__ */ jsx(MessageSquare, { className: "size-8 opacity-30" }),
|
|
785
840
|
/* @__PURE__ */ jsx("p", { className: "text-sm", children: "No messages yet" })
|
|
@@ -817,10 +872,12 @@ function ChatThread({
|
|
|
817
872
|
mode,
|
|
818
873
|
channel,
|
|
819
874
|
onChannelChange,
|
|
875
|
+
isEmailIntegrated,
|
|
820
876
|
contactEmail: contact.email,
|
|
821
877
|
inputValue,
|
|
822
878
|
onInputChange,
|
|
823
879
|
onSend,
|
|
880
|
+
onSendEmail,
|
|
824
881
|
onTakeOver,
|
|
825
882
|
onLetAiHandle
|
|
826
883
|
}
|
|
@@ -1171,11 +1228,15 @@ function ConversationsPage({
|
|
|
1171
1228
|
onChannelFilterChange,
|
|
1172
1229
|
channel,
|
|
1173
1230
|
onChannelChange,
|
|
1231
|
+
isEmailIntegrated,
|
|
1174
1232
|
inputValue,
|
|
1175
1233
|
internalNotes,
|
|
1176
1234
|
showLeadPanel = true,
|
|
1177
1235
|
hasMore,
|
|
1178
1236
|
isLoadingMore,
|
|
1237
|
+
hasMoreMessages,
|
|
1238
|
+
isLoadingMoreMessages,
|
|
1239
|
+
onLoadMoreMessages,
|
|
1179
1240
|
isAiTyping,
|
|
1180
1241
|
notesSaveStatus,
|
|
1181
1242
|
onSelectConversation,
|
|
@@ -1184,6 +1245,7 @@ function ConversationsPage({
|
|
|
1184
1245
|
onFilterChange,
|
|
1185
1246
|
onInputChange,
|
|
1186
1247
|
onSend,
|
|
1248
|
+
onSendEmail,
|
|
1187
1249
|
onTakeOver,
|
|
1188
1250
|
onLetAiHandle,
|
|
1189
1251
|
onReopen,
|
|
@@ -1252,9 +1314,11 @@ function ConversationsPage({
|
|
|
1252
1314
|
isAiTyping,
|
|
1253
1315
|
channel,
|
|
1254
1316
|
onChannelChange,
|
|
1317
|
+
isEmailIntegrated,
|
|
1255
1318
|
inputValue,
|
|
1256
1319
|
onInputChange,
|
|
1257
1320
|
onSend,
|
|
1321
|
+
onSendEmail,
|
|
1258
1322
|
onTakeOver,
|
|
1259
1323
|
onLetAiHandle,
|
|
1260
1324
|
onReopen,
|
|
@@ -1262,6 +1326,9 @@ function ConversationsPage({
|
|
|
1262
1326
|
onUnmarkUrgent,
|
|
1263
1327
|
onArchive,
|
|
1264
1328
|
onAssignToAdvisor,
|
|
1329
|
+
hasMoreMessages,
|
|
1330
|
+
isLoadingMoreMessages,
|
|
1331
|
+
onLoadMoreMessages,
|
|
1265
1332
|
onBack: () => setMobilePanel("list"),
|
|
1266
1333
|
onShowLeadInfo: () => setMobilePanel("lead"),
|
|
1267
1334
|
className: cn(
|
|
@@ -1244,15 +1244,19 @@ function ChatComposer({
|
|
|
1244
1244
|
mode,
|
|
1245
1245
|
channel: channelProp = "chat",
|
|
1246
1246
|
onChannelChange,
|
|
1247
|
+
isEmailIntegrated = false,
|
|
1247
1248
|
contactEmail = "",
|
|
1248
1249
|
inputValue = "",
|
|
1249
1250
|
onInputChange,
|
|
1250
1251
|
onSend,
|
|
1252
|
+
onSendEmail,
|
|
1251
1253
|
onTakeOver,
|
|
1252
1254
|
onLetAiHandle,
|
|
1253
1255
|
className
|
|
1254
1256
|
}) {
|
|
1255
|
-
const [channel, setChannel] = import_react3.default.useState(
|
|
1257
|
+
const [channel, setChannel] = import_react3.default.useState(
|
|
1258
|
+
isEmailIntegrated ? channelProp : "chat"
|
|
1259
|
+
);
|
|
1256
1260
|
const [emailTo, setEmailTo] = import_react3.default.useState(contactEmail);
|
|
1257
1261
|
const [emailCc, setEmailCc] = import_react3.default.useState("");
|
|
1258
1262
|
const [showCc, setShowCc] = import_react3.default.useState(false);
|
|
@@ -1302,7 +1306,7 @@ function ChatComposer({
|
|
|
1302
1306
|
className
|
|
1303
1307
|
),
|
|
1304
1308
|
children: [
|
|
1305
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "border-b border-border px-3 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1309
|
+
isEmailIntegrated && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "border-b border-border px-3 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1306
1310
|
Tabs,
|
|
1307
1311
|
{
|
|
1308
1312
|
value: channel,
|
|
@@ -1437,7 +1441,12 @@ function ChatComposer({
|
|
|
1437
1441
|
Button,
|
|
1438
1442
|
{
|
|
1439
1443
|
size: "sm",
|
|
1440
|
-
onClick: () =>
|
|
1444
|
+
onClick: () => onSendEmail == null ? void 0 : onSendEmail({
|
|
1445
|
+
content: inputValue,
|
|
1446
|
+
to: emailTo,
|
|
1447
|
+
cc: emailCc,
|
|
1448
|
+
subject: emailSubject
|
|
1449
|
+
}),
|
|
1441
1450
|
disabled: !inputValue.trim() || !emailTo.trim(),
|
|
1442
1451
|
children: [
|
|
1443
1452
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react4.Send, { className: "mr-1.5 size-3.5" }),
|
|
@@ -1492,9 +1501,11 @@ function ChatThread({
|
|
|
1492
1501
|
isAiTyping = false,
|
|
1493
1502
|
channel,
|
|
1494
1503
|
onChannelChange,
|
|
1504
|
+
isEmailIntegrated,
|
|
1495
1505
|
inputValue,
|
|
1496
1506
|
onInputChange,
|
|
1497
1507
|
onSend,
|
|
1508
|
+
onSendEmail,
|
|
1498
1509
|
onTakeOver,
|
|
1499
1510
|
onLetAiHandle,
|
|
1500
1511
|
onReopen,
|
|
@@ -1502,12 +1513,53 @@ function ChatThread({
|
|
|
1502
1513
|
onUnmarkUrgent,
|
|
1503
1514
|
onArchive,
|
|
1504
1515
|
onAssignToAdvisor,
|
|
1516
|
+
hasMoreMessages,
|
|
1517
|
+
isLoadingMoreMessages,
|
|
1518
|
+
onLoadMoreMessages,
|
|
1505
1519
|
onBack,
|
|
1506
1520
|
onShowLeadInfo,
|
|
1507
1521
|
className
|
|
1508
1522
|
}) {
|
|
1509
1523
|
const aiIsHandling = mode === "ai";
|
|
1510
1524
|
const isClosed = status === "closed";
|
|
1525
|
+
const scrollRef = import_react3.default.useRef(null);
|
|
1526
|
+
const preLoadScrollHeightRef = import_react3.default.useRef(null);
|
|
1527
|
+
const handleScroll = (e) => {
|
|
1528
|
+
if (!hasMoreMessages || isLoadingMoreMessages || !onLoadMoreMessages) {
|
|
1529
|
+
return;
|
|
1530
|
+
}
|
|
1531
|
+
if (e.currentTarget.scrollTop <= 80) {
|
|
1532
|
+
preLoadScrollHeightRef.current = e.currentTarget.scrollHeight;
|
|
1533
|
+
onLoadMoreMessages();
|
|
1534
|
+
}
|
|
1535
|
+
};
|
|
1536
|
+
const prevLastMessageIdRef = import_react3.default.useRef(void 0);
|
|
1537
|
+
const prevContactIdRef = import_react3.default.useRef(contact.id);
|
|
1538
|
+
import_react3.default.useLayoutEffect(() => {
|
|
1539
|
+
var _a, _b;
|
|
1540
|
+
const el = scrollRef.current;
|
|
1541
|
+
if (!el) return;
|
|
1542
|
+
if (preLoadScrollHeightRef.current !== null) {
|
|
1543
|
+
el.scrollTop = el.scrollHeight - preLoadScrollHeightRef.current;
|
|
1544
|
+
preLoadScrollHeightRef.current = null;
|
|
1545
|
+
prevLastMessageIdRef.current = (_a = messages[messages.length - 1]) == null ? void 0 : _a.id;
|
|
1546
|
+
prevContactIdRef.current = contact.id;
|
|
1547
|
+
return;
|
|
1548
|
+
}
|
|
1549
|
+
const currentLastId = (_b = messages[messages.length - 1]) == null ? void 0 : _b.id;
|
|
1550
|
+
const contactChanged = prevContactIdRef.current !== contact.id;
|
|
1551
|
+
const tailChanged = prevLastMessageIdRef.current !== currentLastId;
|
|
1552
|
+
if (contactChanged || tailChanged) {
|
|
1553
|
+
el.scrollTop = el.scrollHeight;
|
|
1554
|
+
}
|
|
1555
|
+
prevLastMessageIdRef.current = currentLastId;
|
|
1556
|
+
prevContactIdRef.current = contact.id;
|
|
1557
|
+
}, [contact.id, messages]);
|
|
1558
|
+
import_react3.default.useLayoutEffect(() => {
|
|
1559
|
+
if (!isAiTyping) return;
|
|
1560
|
+
const el = scrollRef.current;
|
|
1561
|
+
if (el) el.scrollTop = el.scrollHeight;
|
|
1562
|
+
}, [isAiTyping]);
|
|
1511
1563
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: cn("flex flex-col bg-background", className), children: [
|
|
1512
1564
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1513
1565
|
"div",
|
|
@@ -1597,9 +1649,12 @@ function ChatThread({
|
|
|
1597
1649
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1598
1650
|
"div",
|
|
1599
1651
|
{
|
|
1652
|
+
ref: scrollRef,
|
|
1653
|
+
onScroll: handleScroll,
|
|
1600
1654
|
className: "flex flex-1 flex-col gap-4 overflow-y-auto p-4",
|
|
1601
1655
|
tabIndex: 0,
|
|
1602
1656
|
children: [
|
|
1657
|
+
isLoadingMoreMessages && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex justify-center py-1 text-caption text-muted-foreground", children: "Loading older messages..." }),
|
|
1603
1658
|
messages.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-1 flex-col items-center justify-center gap-2 text-muted-foreground", children: [
|
|
1604
1659
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react4.MessageSquare, { className: "size-8 opacity-30" }),
|
|
1605
1660
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-sm", children: "No messages yet" })
|
|
@@ -1637,10 +1692,12 @@ function ChatThread({
|
|
|
1637
1692
|
mode,
|
|
1638
1693
|
channel,
|
|
1639
1694
|
onChannelChange,
|
|
1695
|
+
isEmailIntegrated,
|
|
1640
1696
|
contactEmail: contact.email,
|
|
1641
1697
|
inputValue,
|
|
1642
1698
|
onInputChange,
|
|
1643
1699
|
onSend,
|
|
1700
|
+
onSendEmail,
|
|
1644
1701
|
onTakeOver,
|
|
1645
1702
|
onLetAiHandle
|
|
1646
1703
|
}
|
|
@@ -1991,11 +2048,15 @@ function ConversationsPage({
|
|
|
1991
2048
|
onChannelFilterChange,
|
|
1992
2049
|
channel,
|
|
1993
2050
|
onChannelChange,
|
|
2051
|
+
isEmailIntegrated,
|
|
1994
2052
|
inputValue,
|
|
1995
2053
|
internalNotes,
|
|
1996
2054
|
showLeadPanel = true,
|
|
1997
2055
|
hasMore,
|
|
1998
2056
|
isLoadingMore,
|
|
2057
|
+
hasMoreMessages,
|
|
2058
|
+
isLoadingMoreMessages,
|
|
2059
|
+
onLoadMoreMessages,
|
|
1999
2060
|
isAiTyping,
|
|
2000
2061
|
notesSaveStatus,
|
|
2001
2062
|
onSelectConversation,
|
|
@@ -2004,6 +2065,7 @@ function ConversationsPage({
|
|
|
2004
2065
|
onFilterChange,
|
|
2005
2066
|
onInputChange,
|
|
2006
2067
|
onSend,
|
|
2068
|
+
onSendEmail,
|
|
2007
2069
|
onTakeOver,
|
|
2008
2070
|
onLetAiHandle,
|
|
2009
2071
|
onReopen,
|
|
@@ -2072,9 +2134,11 @@ function ConversationsPage({
|
|
|
2072
2134
|
isAiTyping,
|
|
2073
2135
|
channel,
|
|
2074
2136
|
onChannelChange,
|
|
2137
|
+
isEmailIntegrated,
|
|
2075
2138
|
inputValue,
|
|
2076
2139
|
onInputChange,
|
|
2077
2140
|
onSend,
|
|
2141
|
+
onSendEmail,
|
|
2078
2142
|
onTakeOver,
|
|
2079
2143
|
onLetAiHandle,
|
|
2080
2144
|
onReopen,
|
|
@@ -2082,6 +2146,9 @@ function ConversationsPage({
|
|
|
2082
2146
|
onUnmarkUrgent,
|
|
2083
2147
|
onArchive,
|
|
2084
2148
|
onAssignToAdvisor,
|
|
2149
|
+
hasMoreMessages,
|
|
2150
|
+
isLoadingMoreMessages,
|
|
2151
|
+
onLoadMoreMessages,
|
|
2085
2152
|
onBack: () => setMobilePanel("list"),
|
|
2086
2153
|
onShowLeadInfo: () => setMobilePanel("lead"),
|
|
2087
2154
|
className: cn(
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
ConversationStatusChip,
|
|
10
10
|
ConversationsPage,
|
|
11
11
|
LeadInfoPanel
|
|
12
|
-
} from "../../chunk-
|
|
12
|
+
} from "../../chunk-EB626HVW.mjs";
|
|
13
13
|
import "../../chunk-3S6KVFF5.mjs";
|
|
14
14
|
import "../../chunk-WE4YKBDE.mjs";
|
|
15
15
|
import "../../chunk-H5DTKPJ2.mjs";
|
|
@@ -65,6 +65,11 @@ module.exports = __toCommonJS(bank_statement_generate_dialog_exports);
|
|
|
65
65
|
var import_react5 = require("react");
|
|
66
66
|
var import_date_fns3 = require("date-fns");
|
|
67
67
|
|
|
68
|
+
// src/components/ui/button.tsx
|
|
69
|
+
var import_react = require("react");
|
|
70
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
71
|
+
var import_lucide_react = require("lucide-react");
|
|
72
|
+
|
|
68
73
|
// src/lib/utils.ts
|
|
69
74
|
var import_clsx = require("clsx");
|
|
70
75
|
var import_tailwind_merge = require("tailwind-merge");
|
|
@@ -104,11 +109,6 @@ function cn(...inputs) {
|
|
|
104
109
|
return twMerge((0, import_clsx.clsx)(inputs));
|
|
105
110
|
}
|
|
106
111
|
|
|
107
|
-
// src/components/ui/button.tsx
|
|
108
|
-
var import_react = require("react");
|
|
109
|
-
var import_class_variance_authority = require("class-variance-authority");
|
|
110
|
-
var import_lucide_react = require("lucide-react");
|
|
111
|
-
|
|
112
112
|
// src/lib/slot.tsx
|
|
113
113
|
var React = __toESM(require("react"));
|
|
114
114
|
function mergeRefs(...refs) {
|
|
@@ -1278,6 +1278,10 @@ function ToggleGroupItem(_a) {
|
|
|
1278
1278
|
|
|
1279
1279
|
// src/components/ui/bank-statement-generate-dialog.tsx
|
|
1280
1280
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1281
|
+
var APPLICANT_TYPE_LABELS = {
|
|
1282
|
+
primary: "Main applicant",
|
|
1283
|
+
secondary: "Co-applicant"
|
|
1284
|
+
};
|
|
1281
1285
|
function toIsoDate(date) {
|
|
1282
1286
|
return date.toISOString().slice(0, 10);
|
|
1283
1287
|
}
|
|
@@ -1301,8 +1305,10 @@ function BankStatementGenerateDialog({
|
|
|
1301
1305
|
}) {
|
|
1302
1306
|
const [statementName, setStatementName] = (0, import_react5.useState)("Bank Statement 1");
|
|
1303
1307
|
const [rangePreset, setRangePreset] = (0, import_react5.useState)(90);
|
|
1304
|
-
const [fromDate, setFromDate] = (0, import_react5.useState)(
|
|
1305
|
-
|
|
1308
|
+
const [fromDate, setFromDate] = (0, import_react5.useState)(
|
|
1309
|
+
() => presetToDateRange(90).from
|
|
1310
|
+
);
|
|
1311
|
+
const [toDate, setToDate] = (0, import_react5.useState)(() => presetToDateRange(90).to);
|
|
1306
1312
|
const [applicantType, setApplicantType] = (0, import_react5.useState)("");
|
|
1307
1313
|
const [selectedAccountIds, setSelectedAccountIds] = (0, import_react5.useState)([]);
|
|
1308
1314
|
(0, import_react5.useEffect)(() => {
|
|
@@ -1331,6 +1337,11 @@ function BankStatementGenerateDialog({
|
|
|
1331
1337
|
setToDate(to);
|
|
1332
1338
|
}
|
|
1333
1339
|
};
|
|
1340
|
+
const handlePresetChange = (val) => {
|
|
1341
|
+
if (val.length === 0) return;
|
|
1342
|
+
const raw = val[0];
|
|
1343
|
+
applyPreset(raw === "custom" ? "custom" : Number(raw));
|
|
1344
|
+
};
|
|
1334
1345
|
const areAllSelected = bankAccounts.length > 0 && selectedAccountIds.length === bankAccounts.length;
|
|
1335
1346
|
const isSomeSelected = selectedAccountIds.length > 0 && !areAllSelected;
|
|
1336
1347
|
const handleToggleAccount = (id) => {
|
|
@@ -1366,7 +1377,8 @@ function BankStatementGenerateDialog({
|
|
|
1366
1377
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Dialog, { open, onOpenChange: (o) => !o && onClose(), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1367
1378
|
DialogContent,
|
|
1368
1379
|
{
|
|
1369
|
-
|
|
1380
|
+
size: "3xl",
|
|
1381
|
+
className,
|
|
1370
1382
|
"data-slot": "bank-statement-generate-dialog",
|
|
1371
1383
|
children: [
|
|
1372
1384
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DialogTitle, { children: "Generate Bank Statement" }) }),
|
|
@@ -1390,15 +1402,7 @@ function BankStatementGenerateDialog({
|
|
|
1390
1402
|
type: "single",
|
|
1391
1403
|
variant: "outline",
|
|
1392
1404
|
value: [String(rangePreset)],
|
|
1393
|
-
onValueChange:
|
|
1394
|
-
if (val.length === 0) return;
|
|
1395
|
-
const raw = val[0];
|
|
1396
|
-
if (raw === "custom") {
|
|
1397
|
-
applyPreset("custom");
|
|
1398
|
-
} else {
|
|
1399
|
-
applyPreset(Number(raw));
|
|
1400
|
-
}
|
|
1401
|
-
},
|
|
1405
|
+
onValueChange: handlePresetChange,
|
|
1402
1406
|
className: "w-full",
|
|
1403
1407
|
children: [
|
|
1404
1408
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToggleGroupItem, { value: "90", className: "flex-1", children: "3 Months" }),
|
|
@@ -1434,11 +1438,12 @@ function BankStatementGenerateDialog({
|
|
|
1434
1438
|
{
|
|
1435
1439
|
value: applicantType,
|
|
1436
1440
|
onValueChange: (v) => handleApplicantTypeChange(v),
|
|
1441
|
+
items: APPLICANT_TYPE_LABELS,
|
|
1437
1442
|
children: [
|
|
1438
1443
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SelectValue, { placeholder: "Applicant Type" }) }),
|
|
1439
1444
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(SelectContent, { children: [
|
|
1440
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SelectItem, { value: "primary", children:
|
|
1441
|
-
hasCoApplicant && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SelectItem, { value: "secondary", children:
|
|
1445
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SelectItem, { value: "primary", children: APPLICANT_TYPE_LABELS.primary }),
|
|
1446
|
+
hasCoApplicant && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SelectItem, { value: "secondary", children: APPLICANT_TYPE_LABELS.secondary })
|
|
1442
1447
|
] })
|
|
1443
1448
|
]
|
|
1444
1449
|
}
|
|
@@ -1464,33 +1469,43 @@ function BankStatementGenerateDialog({
|
|
|
1464
1469
|
] }) }),
|
|
1465
1470
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TableBody, { children: bankAccounts.map((account) => {
|
|
1466
1471
|
var _a, _b;
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1472
|
+
const isSelected = selectedAccountIds.includes(
|
|
1473
|
+
account.id
|
|
1474
|
+
);
|
|
1475
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1476
|
+
TableRow,
|
|
1477
|
+
{
|
|
1478
|
+
"data-state": isSelected ? "selected" : void 0,
|
|
1479
|
+
children: [
|
|
1480
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1481
|
+
Checkbox,
|
|
1482
|
+
{
|
|
1483
|
+
checked: isSelected,
|
|
1484
|
+
onCheckedChange: () => handleToggleAccount(account.id),
|
|
1485
|
+
"aria-label": `Select ${account.name}`
|
|
1486
|
+
}
|
|
1487
|
+
) }),
|
|
1488
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1489
|
+
account.institutionLogo && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1490
|
+
"img",
|
|
1491
|
+
{
|
|
1492
|
+
src: account.institutionLogo,
|
|
1493
|
+
alt: (_a = account.institutionName) != null ? _a : "",
|
|
1494
|
+
className: "size-8 object-cover"
|
|
1495
|
+
}
|
|
1496
|
+
),
|
|
1497
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-body-medium font-semibold", children: account.name || account.institutionName || "\u2014" })
|
|
1498
|
+
] }) }),
|
|
1499
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-body-medium", children: (_b = account.accountNo) != null ? _b : "\u2014" }) }),
|
|
1500
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-body-medium", children: periodLabel }) }),
|
|
1501
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-body-medium", children: account.lastUpdated ? (0, import_date_fns3.format)(
|
|
1502
|
+
(0, import_date_fns3.parseISO)(account.lastUpdated),
|
|
1503
|
+
"dd MMM yyyy"
|
|
1504
|
+
) : "\u2014" }) })
|
|
1505
|
+
]
|
|
1506
|
+
},
|
|
1507
|
+
account.id
|
|
1508
|
+
);
|
|
1494
1509
|
}) })
|
|
1495
1510
|
] })
|
|
1496
1511
|
] })
|