@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/dist/index.js CHANGED
@@ -2615,15 +2615,19 @@ function ChatComposer({
2615
2615
  mode,
2616
2616
  channel: channelProp = "chat",
2617
2617
  onChannelChange,
2618
+ isEmailIntegrated = false,
2618
2619
  contactEmail = "",
2619
2620
  inputValue = "",
2620
2621
  onInputChange,
2621
2622
  onSend,
2623
+ onSendEmail,
2622
2624
  onTakeOver,
2623
2625
  onLetAiHandle,
2624
2626
  className
2625
2627
  }) {
2626
- const [channel, setChannel] = import_react5.default.useState(channelProp);
2628
+ const [channel, setChannel] = import_react5.default.useState(
2629
+ isEmailIntegrated ? channelProp : "chat"
2630
+ );
2627
2631
  const [emailTo, setEmailTo] = import_react5.default.useState(contactEmail);
2628
2632
  const [emailCc, setEmailCc] = import_react5.default.useState("");
2629
2633
  const [showCc, setShowCc] = import_react5.default.useState(false);
@@ -2673,7 +2677,7 @@ function ChatComposer({
2673
2677
  className
2674
2678
  ),
2675
2679
  children: [
2676
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "border-b border-border px-3 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2680
+ isEmailIntegrated && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "border-b border-border px-3 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2677
2681
  Tabs,
2678
2682
  {
2679
2683
  value: channel,
@@ -2808,7 +2812,12 @@ function ChatComposer({
2808
2812
  Button,
2809
2813
  {
2810
2814
  size: "sm",
2811
- onClick: () => onSend == null ? void 0 : onSend(inputValue),
2815
+ onClick: () => onSendEmail == null ? void 0 : onSendEmail({
2816
+ content: inputValue,
2817
+ to: emailTo,
2818
+ cc: emailCc,
2819
+ subject: emailSubject
2820
+ }),
2812
2821
  disabled: !inputValue.trim() || !emailTo.trim(),
2813
2822
  children: [
2814
2823
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react6.Send, { className: "mr-1.5 size-3.5" }),
@@ -2863,9 +2872,11 @@ function ChatThread({
2863
2872
  isAiTyping = false,
2864
2873
  channel,
2865
2874
  onChannelChange,
2875
+ isEmailIntegrated,
2866
2876
  inputValue,
2867
2877
  onInputChange,
2868
2878
  onSend,
2879
+ onSendEmail,
2869
2880
  onTakeOver,
2870
2881
  onLetAiHandle,
2871
2882
  onReopen,
@@ -2873,12 +2884,53 @@ function ChatThread({
2873
2884
  onUnmarkUrgent,
2874
2885
  onArchive,
2875
2886
  onAssignToAdvisor,
2887
+ hasMoreMessages,
2888
+ isLoadingMoreMessages,
2889
+ onLoadMoreMessages,
2876
2890
  onBack,
2877
2891
  onShowLeadInfo,
2878
2892
  className
2879
2893
  }) {
2880
2894
  const aiIsHandling = mode === "ai";
2881
2895
  const isClosed = status === "closed";
2896
+ const scrollRef = import_react5.default.useRef(null);
2897
+ const preLoadScrollHeightRef = import_react5.default.useRef(null);
2898
+ const handleScroll = (e) => {
2899
+ if (!hasMoreMessages || isLoadingMoreMessages || !onLoadMoreMessages) {
2900
+ return;
2901
+ }
2902
+ if (e.currentTarget.scrollTop <= 80) {
2903
+ preLoadScrollHeightRef.current = e.currentTarget.scrollHeight;
2904
+ onLoadMoreMessages();
2905
+ }
2906
+ };
2907
+ const prevLastMessageIdRef = import_react5.default.useRef(void 0);
2908
+ const prevContactIdRef = import_react5.default.useRef(contact.id);
2909
+ import_react5.default.useLayoutEffect(() => {
2910
+ var _a, _b;
2911
+ const el = scrollRef.current;
2912
+ if (!el) return;
2913
+ if (preLoadScrollHeightRef.current !== null) {
2914
+ el.scrollTop = el.scrollHeight - preLoadScrollHeightRef.current;
2915
+ preLoadScrollHeightRef.current = null;
2916
+ prevLastMessageIdRef.current = (_a = messages[messages.length - 1]) == null ? void 0 : _a.id;
2917
+ prevContactIdRef.current = contact.id;
2918
+ return;
2919
+ }
2920
+ const currentLastId = (_b = messages[messages.length - 1]) == null ? void 0 : _b.id;
2921
+ const contactChanged = prevContactIdRef.current !== contact.id;
2922
+ const tailChanged = prevLastMessageIdRef.current !== currentLastId;
2923
+ if (contactChanged || tailChanged) {
2924
+ el.scrollTop = el.scrollHeight;
2925
+ }
2926
+ prevLastMessageIdRef.current = currentLastId;
2927
+ prevContactIdRef.current = contact.id;
2928
+ }, [contact.id, messages]);
2929
+ import_react5.default.useLayoutEffect(() => {
2930
+ if (!isAiTyping) return;
2931
+ const el = scrollRef.current;
2932
+ if (el) el.scrollTop = el.scrollHeight;
2933
+ }, [isAiTyping]);
2882
2934
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: cn("flex flex-col bg-background", className), children: [
2883
2935
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2884
2936
  "div",
@@ -2968,9 +3020,12 @@ function ChatThread({
2968
3020
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2969
3021
  "div",
2970
3022
  {
3023
+ ref: scrollRef,
3024
+ onScroll: handleScroll,
2971
3025
  className: "flex flex-1 flex-col gap-4 overflow-y-auto p-4",
2972
3026
  tabIndex: 0,
2973
3027
  children: [
3028
+ isLoadingMoreMessages && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex justify-center py-1 text-caption text-muted-foreground", children: "Loading older messages..." }),
2974
3029
  messages.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-1 flex-col items-center justify-center gap-2 text-muted-foreground", children: [
2975
3030
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react6.MessageSquare, { className: "size-8 opacity-30" }),
2976
3031
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-sm", children: "No messages yet" })
@@ -3008,10 +3063,12 @@ function ChatThread({
3008
3063
  mode,
3009
3064
  channel,
3010
3065
  onChannelChange,
3066
+ isEmailIntegrated,
3011
3067
  contactEmail: contact.email,
3012
3068
  inputValue,
3013
3069
  onInputChange,
3014
3070
  onSend,
3071
+ onSendEmail,
3015
3072
  onTakeOver,
3016
3073
  onLetAiHandle
3017
3074
  }
@@ -3362,11 +3419,15 @@ function ConversationsPage({
3362
3419
  onChannelFilterChange,
3363
3420
  channel,
3364
3421
  onChannelChange,
3422
+ isEmailIntegrated,
3365
3423
  inputValue,
3366
3424
  internalNotes,
3367
3425
  showLeadPanel = true,
3368
3426
  hasMore,
3369
3427
  isLoadingMore,
3428
+ hasMoreMessages,
3429
+ isLoadingMoreMessages,
3430
+ onLoadMoreMessages,
3370
3431
  isAiTyping,
3371
3432
  notesSaveStatus,
3372
3433
  onSelectConversation,
@@ -3375,6 +3436,7 @@ function ConversationsPage({
3375
3436
  onFilterChange,
3376
3437
  onInputChange,
3377
3438
  onSend,
3439
+ onSendEmail,
3378
3440
  onTakeOver,
3379
3441
  onLetAiHandle,
3380
3442
  onReopen,
@@ -3443,9 +3505,11 @@ function ConversationsPage({
3443
3505
  isAiTyping,
3444
3506
  channel,
3445
3507
  onChannelChange,
3508
+ isEmailIntegrated,
3446
3509
  inputValue,
3447
3510
  onInputChange,
3448
3511
  onSend,
3512
+ onSendEmail,
3449
3513
  onTakeOver,
3450
3514
  onLetAiHandle,
3451
3515
  onReopen,
@@ -3453,6 +3517,9 @@ function ConversationsPage({
3453
3517
  onUnmarkUrgent,
3454
3518
  onArchive,
3455
3519
  onAssignToAdvisor,
3520
+ hasMoreMessages,
3521
+ isLoadingMoreMessages,
3522
+ onLoadMoreMessages,
3456
3523
  onBack: () => setMobilePanel("list"),
3457
3524
  onShowLeadInfo: () => setMobilePanel("lead"),
3458
3525
  className: cn(
@@ -11991,6 +12058,10 @@ function BankStatementDocumentTable({
11991
12058
  var import_react21 = require("react");
11992
12059
  var import_date_fns3 = require("date-fns");
11993
12060
  var import_jsx_runtime61 = require("react/jsx-runtime");
12061
+ var APPLICANT_TYPE_LABELS = {
12062
+ primary: "Main applicant",
12063
+ secondary: "Co-applicant"
12064
+ };
11994
12065
  function toIsoDate(date) {
11995
12066
  return date.toISOString().slice(0, 10);
11996
12067
  }
@@ -12014,8 +12085,10 @@ function BankStatementGenerateDialog({
12014
12085
  }) {
12015
12086
  const [statementName, setStatementName] = (0, import_react21.useState)("Bank Statement 1");
12016
12087
  const [rangePreset, setRangePreset] = (0, import_react21.useState)(90);
12017
- const [fromDate, setFromDate] = (0, import_react21.useState)("");
12018
- const [toDate, setToDate] = (0, import_react21.useState)("");
12088
+ const [fromDate, setFromDate] = (0, import_react21.useState)(
12089
+ () => presetToDateRange(90).from
12090
+ );
12091
+ const [toDate, setToDate] = (0, import_react21.useState)(() => presetToDateRange(90).to);
12019
12092
  const [applicantType, setApplicantType] = (0, import_react21.useState)("");
12020
12093
  const [selectedAccountIds, setSelectedAccountIds] = (0, import_react21.useState)([]);
12021
12094
  (0, import_react21.useEffect)(() => {
@@ -12044,6 +12117,11 @@ function BankStatementGenerateDialog({
12044
12117
  setToDate(to);
12045
12118
  }
12046
12119
  };
12120
+ const handlePresetChange = (val) => {
12121
+ if (val.length === 0) return;
12122
+ const raw = val[0];
12123
+ applyPreset(raw === "custom" ? "custom" : Number(raw));
12124
+ };
12047
12125
  const areAllSelected = bankAccounts.length > 0 && selectedAccountIds.length === bankAccounts.length;
12048
12126
  const isSomeSelected = selectedAccountIds.length > 0 && !areAllSelected;
12049
12127
  const handleToggleAccount = (id) => {
@@ -12079,7 +12157,8 @@ function BankStatementGenerateDialog({
12079
12157
  return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Dialog, { open, onOpenChange: (o) => !o && onClose(), children: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
12080
12158
  DialogContent,
12081
12159
  {
12082
- className: cn("max-w-[700px]", className),
12160
+ size: "3xl",
12161
+ className,
12083
12162
  "data-slot": "bank-statement-generate-dialog",
12084
12163
  children: [
12085
12164
  /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(DialogTitle, { children: "Generate Bank Statement" }) }),
@@ -12103,15 +12182,7 @@ function BankStatementGenerateDialog({
12103
12182
  type: "single",
12104
12183
  variant: "outline",
12105
12184
  value: [String(rangePreset)],
12106
- onValueChange: (val) => {
12107
- if (val.length === 0) return;
12108
- const raw = val[0];
12109
- if (raw === "custom") {
12110
- applyPreset("custom");
12111
- } else {
12112
- applyPreset(Number(raw));
12113
- }
12114
- },
12185
+ onValueChange: handlePresetChange,
12115
12186
  className: "w-full",
12116
12187
  children: [
12117
12188
  /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ToggleGroupItem, { value: "90", className: "flex-1", children: "3 Months" }),
@@ -12147,11 +12218,12 @@ function BankStatementGenerateDialog({
12147
12218
  {
12148
12219
  value: applicantType,
12149
12220
  onValueChange: (v) => handleApplicantTypeChange(v),
12221
+ items: APPLICANT_TYPE_LABELS,
12150
12222
  children: [
12151
12223
  /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(SelectValue, { placeholder: "Applicant Type" }) }),
12152
12224
  /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(SelectContent, { children: [
12153
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(SelectItem, { value: "primary", children: "Main applicant" }),
12154
- hasCoApplicant && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(SelectItem, { value: "secondary", children: "Co-applicant" })
12225
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(SelectItem, { value: "primary", children: APPLICANT_TYPE_LABELS.primary }),
12226
+ hasCoApplicant && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(SelectItem, { value: "secondary", children: APPLICANT_TYPE_LABELS.secondary })
12155
12227
  ] })
12156
12228
  ]
12157
12229
  }
@@ -12177,33 +12249,43 @@ function BankStatementGenerateDialog({
12177
12249
  ] }) }),
12178
12250
  /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TableBody, { children: bankAccounts.map((account) => {
12179
12251
  var _a, _b;
12180
- return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(TableRow, { children: [
12181
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12182
- Checkbox,
12183
- {
12184
- checked: selectedAccountIds.includes(account.id),
12185
- onCheckedChange: () => handleToggleAccount(account.id),
12186
- "aria-label": `Select ${account.name}`
12187
- }
12188
- ) }),
12189
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "flex items-center gap-2", children: [
12190
- account.institutionLogo && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12191
- "img",
12192
- {
12193
- src: account.institutionLogo,
12194
- alt: (_a = account.institutionName) != null ? _a : "",
12195
- className: "size-8 rounded object-cover"
12196
- }
12197
- ),
12198
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "text-body-medium font-semibold", children: account.name || account.institutionName || "\u2014" })
12199
- ] }) }),
12200
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "text-body-medium", children: (_b = account.accountNo) != null ? _b : "\u2014" }) }),
12201
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "text-body-medium", children: periodLabel }) }),
12202
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "text-body-medium", children: account.lastUpdated ? (0, import_date_fns3.format)(
12203
- (0, import_date_fns3.parseISO)(account.lastUpdated),
12204
- "dd MMM yyyy"
12205
- ) : "\u2014" }) })
12206
- ] }, account.id);
12252
+ const isSelected = selectedAccountIds.includes(
12253
+ account.id
12254
+ );
12255
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
12256
+ TableRow,
12257
+ {
12258
+ "data-state": isSelected ? "selected" : void 0,
12259
+ children: [
12260
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12261
+ Checkbox,
12262
+ {
12263
+ checked: isSelected,
12264
+ onCheckedChange: () => handleToggleAccount(account.id),
12265
+ "aria-label": `Select ${account.name}`
12266
+ }
12267
+ ) }),
12268
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "flex items-center gap-2", children: [
12269
+ account.institutionLogo && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
12270
+ "img",
12271
+ {
12272
+ src: account.institutionLogo,
12273
+ alt: (_a = account.institutionName) != null ? _a : "",
12274
+ className: "size-8 object-cover"
12275
+ }
12276
+ ),
12277
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "text-body-medium font-semibold", children: account.name || account.institutionName || "\u2014" })
12278
+ ] }) }),
12279
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "text-body-medium", children: (_b = account.accountNo) != null ? _b : "\u2014" }) }),
12280
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "text-body-medium", children: periodLabel }) }),
12281
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "text-body-medium", children: account.lastUpdated ? (0, import_date_fns3.format)(
12282
+ (0, import_date_fns3.parseISO)(account.lastUpdated),
12283
+ "dd MMM yyyy"
12284
+ ) : "\u2014" }) })
12285
+ ]
12286
+ },
12287
+ account.id
12288
+ );
12207
12289
  }) })
12208
12290
  ] })
12209
12291
  ] })
package/dist/index.mjs CHANGED
@@ -315,7 +315,7 @@ import {
315
315
  } from "./chunk-TC43SMIN.mjs";
316
316
  import {
317
317
  BankStatementGenerateDialog
318
- } from "./chunk-O5CP6VP6.mjs";
318
+ } from "./chunk-CPM6P63C.mjs";
319
319
  import {
320
320
  Field,
321
321
  FieldContent,
@@ -515,7 +515,7 @@ import {
515
515
  ConversationStatusChip,
516
516
  ConversationsPage,
517
517
  LeadInfoPanel
518
- } from "./chunk-ZMTCMP2G.mjs";
518
+ } from "./chunk-EB626HVW.mjs";
519
519
  import {
520
520
  Tooltip,
521
521
  TooltipContent,