@wealthx/shadcn 1.5.39 → 1.5.41

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.
Files changed (30) hide show
  1. package/.turbo/turbo-build.log +118 -118
  2. package/CHANGELOG.md +12 -0
  3. package/dist/{chunk-MGIDYXOP.mjs → chunk-DWNLBUDC.mjs} +459 -67
  4. package/dist/{chunk-EFHPSKVF.mjs → chunk-EGM4DARZ.mjs} +110 -1
  5. package/dist/{chunk-R7M657QL.mjs → chunk-GIQGZFP6.mjs} +138 -46
  6. package/dist/{chunk-B5PSUONN.mjs → chunk-TF5TOVIM.mjs} +1 -1
  7. package/dist/{chunk-RRROLESJ.mjs → chunk-XHZONBL4.mjs} +1 -1
  8. package/dist/components/ui/ai-assistant-drawer.js +101 -0
  9. package/dist/components/ui/ai-assistant-drawer.mjs +2 -2
  10. package/dist/components/ui/ai-conversations/index.js +101 -0
  11. package/dist/components/ui/ai-conversations/index.mjs +2 -2
  12. package/dist/components/ui/chat-input-area.js +101 -0
  13. package/dist/components/ui/chat-input-area.mjs +1 -1
  14. package/dist/components/ui/policy-ai/index.js +818 -261
  15. package/dist/components/ui/policy-ai/index.mjs +11 -2
  16. package/dist/components/ui/support-agent/index.js +233 -45
  17. package/dist/components/ui/support-agent/index.mjs +2 -2
  18. package/dist/index.js +3521 -3330
  19. package/dist/index.mjs +5 -5
  20. package/dist/styles.css +1 -1
  21. package/package.json +1 -1
  22. package/src/components/ui/chat-input-area.tsx +181 -2
  23. package/src/components/ui/policy-ai/index.tsx +12 -0
  24. package/src/components/ui/policy-ai/policy-ai-context-sidebar.tsx +231 -0
  25. package/src/components/ui/policy-ai/policy-ai-history-panel.tsx +175 -0
  26. package/src/components/ui/policy-ai/policy-ai-page.tsx +243 -0
  27. package/src/components/ui/policy-ai/policy-ai-panel.tsx +64 -57
  28. package/src/components/ui/policy-ai/policy-ai-responses.tsx +8 -12
  29. package/src/components/ui/support-agent/support-agent-panel.tsx +170 -48
  30. package/src/styles/styles-css.ts +1 -1
@@ -1,3 +1,6 @@
1
+ import {
2
+ PageTopBar
3
+ } from "./chunk-MZI77ZMX.mjs";
1
4
  import {
2
5
  Progress
3
6
  } from "./chunk-FL7DEYUA.mjs";
@@ -10,14 +13,24 @@ import {
10
13
  TooltipProvider,
11
14
  TooltipTrigger
12
15
  } from "./chunk-3S6KVFF5.mjs";
16
+ import {
17
+ Card
18
+ } from "./chunk-3VDET466.mjs";
13
19
  import {
14
20
  Tabs,
15
21
  TabsList,
16
22
  TabsTrigger
17
23
  } from "./chunk-WE4YKBDE.mjs";
24
+ import {
25
+ Avatar,
26
+ AvatarFallback
27
+ } from "./chunk-H6NQTIF4.mjs";
28
+ import {
29
+ Separator
30
+ } from "./chunk-2GIYVERS.mjs";
18
31
  import {
19
32
  ChatInputArea
20
- } from "./chunk-EFHPSKVF.mjs";
33
+ } from "./chunk-EGM4DARZ.mjs";
21
34
  import {
22
35
  Badge
23
36
  } from "./chunk-X6RC5UWB.mjs";
@@ -154,14 +167,7 @@ import * as React2 from "react";
154
167
  import { Building2, Info } from "lucide-react";
155
168
  import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
156
169
  function BankAvatar({ name }) {
157
- return /* @__PURE__ */ jsx2(
158
- "span",
159
- {
160
- "aria-hidden": "true",
161
- className: "shrink-0 inline-flex items-center justify-center size-7 bg-muted text-muted-foreground text-xs font-semibold border border-border",
162
- children: name.charAt(0).toUpperCase()
163
- }
164
- );
170
+ return /* @__PURE__ */ jsx2(Avatar, { "aria-hidden": "true", className: "size-7 shrink-0", children: /* @__PURE__ */ jsx2(AvatarFallback, { children: name.charAt(0).toUpperCase() }) });
165
171
  }
166
172
  function QueryContextInfo({ label }) {
167
173
  return /* @__PURE__ */ jsx2(TooltipProvider, { children: /* @__PURE__ */ jsxs2(Tooltip, { children: [
@@ -195,10 +201,10 @@ function CitationBadge({ citation }) {
195
201
  ) }) }),
196
202
  /* @__PURE__ */ jsx2(PopoverContent, { className: "w-72 p-3", sideOffset: 6, children: /* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-2", children: [
197
203
  /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-1.5 flex-wrap", children: [
198
- /* @__PURE__ */ jsx2("span", { className: "text-xs font-semibold text-foreground", children: citation.bankName }),
204
+ /* @__PURE__ */ jsx2("span", { className: "text-sm font-semibold text-foreground", children: citation.bankName }),
199
205
  /* @__PURE__ */ jsx2(Badge, { variant: "secondary", className: "text-xs px-1.5 py-0", children: citation.category })
200
206
  ] }),
201
- /* @__PURE__ */ jsx2("p", { className: "text-xs text-muted-foreground leading-relaxed", children: citation.excerpt })
207
+ /* @__PURE__ */ jsx2("p", { className: "text-sm text-muted-foreground", children: citation.excerpt })
202
208
  ] }) })
203
209
  ] });
204
210
  }
@@ -213,7 +219,7 @@ function AnswerWithCitations({
213
219
  if (match) {
214
220
  const citation = citationMap.get(parseInt(match[1], 10));
215
221
  if (citation) return /* @__PURE__ */ jsx2(CitationBadge, { citation }, i);
216
- return /* @__PURE__ */ jsx2("span", { className: "text-xs text-muted-foreground", children: part }, i);
222
+ return /* @__PURE__ */ jsx2("span", { className: "text-caption text-muted-foreground", children: part }, i);
217
223
  }
218
224
  return /* @__PURE__ */ jsx2(React2.Fragment, { children: part }, i);
219
225
  }) });
@@ -348,7 +354,7 @@ function PolicyComparisonTable({
348
354
  /* @__PURE__ */ jsx2(BankAvatar, { name: bank.bankName }),
349
355
  /* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-0.5 min-w-0", children: [
350
356
  /* @__PURE__ */ jsx2("span", { className: "text-sm font-medium text-foreground leading-snug", children: bank.bankName }),
351
- bank.details && /* @__PURE__ */ jsx2("span", { className: "text-xs text-muted-foreground leading-snug", children: bank.details })
357
+ bank.details && /* @__PURE__ */ jsx2("span", { className: "text-caption text-muted-foreground", children: bank.details })
352
358
  ] })
353
359
  ] }) }),
354
360
  categories.map((cat) => /* @__PURE__ */ jsx2(
@@ -606,7 +612,7 @@ function PolicyAIFAB({
606
612
  ] });
607
613
  }
608
614
  function PolicyAIPanel({
609
- open,
615
+ open = true,
610
616
  onClose,
611
617
  messages = [],
612
618
  suggestedQuestions,
@@ -709,44 +715,47 @@ function PolicyAIPanel({
709
715
  ] })
710
716
  ] }),
711
717
  (!minimised || inline) && /* @__PURE__ */ jsxs3(Fragment3, { children: [
712
- /* @__PURE__ */ jsx3("div", { className: cn(!inline && "flex-1 overflow-y-auto min-h-0"), children: isLoading ? /* @__PURE__ */ jsx3("div", { className: "flex flex-col justify-center h-full py-8", children: /* @__PURE__ */ jsx3(PolicyAIThinkingSteps, { steps: resolvedThinkingSteps }) }) : !isChatMode ? (
718
+ /* @__PURE__ */ jsx3("div", { className: "flex-1 overflow-y-auto min-h-0", children: isLoading ? /* @__PURE__ */ jsx3("div", { className: "flex flex-col justify-center h-full py-8", children: /* @__PURE__ */ jsx3(PolicyAIThinkingSteps, { steps: resolvedThinkingSteps }) }) : !isChatMode ? (
713
719
  /* Home state — suggested questions by policy type */
714
- /* @__PURE__ */ jsxs3("div", { className: "flex flex-col", children: [
715
- /* @__PURE__ */ jsx3("div", { className: "px-3 pt-3 pb-2", children: /* @__PURE__ */ jsx3("p", { className: "text-xs text-muted-foreground leading-relaxed", children: "Ask me about lending policies across 40+ Australian banks \u2014 income, LVR, security types, serviceability, and more." }) }),
716
- /* @__PURE__ */ jsx3("div", { className: "border-b border-border px-3 pt-1", children: /* @__PURE__ */ jsx3(
717
- Tabs,
718
- {
719
- value: activeTab,
720
- onValueChange: (v) => setActiveTab(v),
721
- children: /* @__PURE__ */ jsx3(
722
- TabsList,
720
+ /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-3 px-3 py-3", children: [
721
+ /* @__PURE__ */ jsx3("p", { className: "text-sm text-muted-foreground", children: "Ask me about lending policies across 40+ Australian banks \u2014 income, LVR, security types, serviceability, and more." }),
722
+ /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-1.5", children: [
723
+ /* @__PURE__ */ jsx3("p", { className: "text-overline text-muted-foreground", children: "Suggested" }),
724
+ /* @__PURE__ */ jsxs3(Card, { className: "gap-0 py-0 shadow-none overflow-hidden", children: [
725
+ /* @__PURE__ */ jsx3("div", { className: "border-b border-border px-3 pt-2", children: /* @__PURE__ */ jsx3(
726
+ Tabs,
723
727
  {
724
- variant: "line",
725
- className: "justify-start h-8 gap-0 -mb-px overflow-x-auto",
726
- children: Object.keys(DEFAULT_SUGGESTED).map(
727
- (type) => /* @__PURE__ */ jsx3(
728
- TabsTrigger,
729
- {
730
- value: type,
731
- className: "text-xs px-2 h-7 shrink-0",
732
- children: type
733
- },
734
- type
735
- )
728
+ value: activeTab,
729
+ onValueChange: (v) => setActiveTab(v),
730
+ children: /* @__PURE__ */ jsx3(
731
+ TabsList,
732
+ {
733
+ variant: "line",
734
+ className: "justify-start h-8 gap-0 -mb-px overflow-x-auto",
735
+ children: Object.keys(DEFAULT_SUGGESTED).map((type) => /* @__PURE__ */ jsx3(
736
+ TabsTrigger,
737
+ {
738
+ value: type,
739
+ className: "px-2 h-7 shrink-0",
740
+ children: type
741
+ },
742
+ type
743
+ ))
744
+ }
736
745
  )
737
746
  }
738
- )
739
- }
740
- ) }),
741
- /* @__PURE__ */ jsx3("div", { className: "flex flex-col px-3 py-2 gap-1", children: ((_a = (suggestedQuestions != null ? suggestedQuestions : DEFAULT_SUGGESTED)[activeTab]) != null ? _a : []).map((q) => /* @__PURE__ */ jsx3(
742
- "button",
743
- {
744
- onClick: () => setInputValue(q),
745
- className: "w-full text-left text-xs text-foreground px-3 py-2 border border-border hover:bg-muted/60 transition-colors leading-relaxed",
746
- children: q
747
- },
748
- q
749
- )) })
747
+ ) }),
748
+ /* @__PURE__ */ jsx3("div", { className: "divide-y divide-border", children: ((_a = (suggestedQuestions != null ? suggestedQuestions : DEFAULT_SUGGESTED)[activeTab]) != null ? _a : []).map((q) => /* @__PURE__ */ jsx3(
749
+ "button",
750
+ {
751
+ onClick: () => setInputValue(q),
752
+ className: "w-full text-left text-sm text-foreground px-3 py-2.5 hover:bg-muted/60 transition-colors",
753
+ children: q
754
+ },
755
+ q
756
+ )) })
757
+ ] })
758
+ ] })
750
759
  ] })
751
760
  ) : (
752
761
  /* Chat state — messages + structured response cards */
@@ -774,26 +783,406 @@ function PolicyAIPanel({
774
783
  /* @__PURE__ */ jsx3("div", { ref: messagesEndRef })
775
784
  ] })
776
785
  ) }),
777
- !isLoading && /* @__PURE__ */ jsx3(
778
- "div",
786
+ !isLoading && /* @__PURE__ */ jsx3("div", { className: "shrink-0 border-t border-border px-3 py-3 bg-card", children: /* @__PURE__ */ jsx3(
787
+ ChatInputArea,
779
788
  {
780
- className: cn(
781
- "border-t border-border px-3 py-3 bg-card",
782
- inline ? "sticky bottom-0 z-10" : "shrink-0"
783
- ),
784
- children: /* @__PURE__ */ jsx3(
785
- ChatInputArea,
789
+ value: inputValue,
790
+ onChange: setInputValue,
791
+ onSend: handleSend,
792
+ onAttachFile,
793
+ onAttachImage,
794
+ disabled: isStreaming,
795
+ placeholder: "Ask about lending policies\u2026",
796
+ autoFocus: !minimised,
797
+ showMarkdownToolbar: true
798
+ }
799
+ ) })
800
+ ] })
801
+ ]
802
+ }
803
+ );
804
+ }
805
+
806
+ // src/components/ui/policy-ai/policy-ai-history-panel.tsx
807
+ import { BrainCircuit as BrainCircuit2, MessageSquarePlus, Search } from "lucide-react";
808
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
809
+ function PolicyAIHistoryItem({
810
+ conv,
811
+ isActive,
812
+ onClick
813
+ }) {
814
+ return /* @__PURE__ */ jsx4(
815
+ "button",
816
+ {
817
+ type: "button",
818
+ onClick,
819
+ className: cn(
820
+ "w-full flex items-start gap-3 px-3 py-3 text-left transition-colors",
821
+ "border-b border-border last:border-b-0",
822
+ isActive ? "bg-muted" : "hover:bg-muted/40"
823
+ ),
824
+ children: /* @__PURE__ */ jsx4("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsxs4("div", { className: "flex items-start justify-between gap-2", children: [
825
+ /* @__PURE__ */ jsx4(
826
+ "span",
827
+ {
828
+ className: cn(
829
+ "text-sm leading-snug line-clamp-2 min-w-0",
830
+ isActive ? "font-semibold text-foreground" : "text-foreground"
831
+ ),
832
+ children: conv.title
833
+ }
834
+ ),
835
+ conv.timestamp && /* @__PURE__ */ jsx4("span", { className: "shrink-0 text-caption text-muted-foreground whitespace-nowrap", children: conv.timestamp })
836
+ ] }) })
837
+ }
838
+ );
839
+ }
840
+ function PolicyAIHistoryPanel({
841
+ conversations,
842
+ activeId,
843
+ onSelect,
844
+ onNewChat,
845
+ searchQuery = "",
846
+ onSearchChange,
847
+ className
848
+ }) {
849
+ const filtered = searchQuery ? conversations.filter(
850
+ (c) => c.title.toLowerCase().includes(searchQuery.toLowerCase())
851
+ ) : conversations;
852
+ return /* @__PURE__ */ jsxs4(
853
+ "div",
854
+ {
855
+ "data-slot": "policy-ai-history-panel",
856
+ className: cn(
857
+ "flex flex-col h-full border-r border-border bg-background shrink-0",
858
+ className
859
+ ),
860
+ children: [
861
+ /* @__PURE__ */ jsxs4("div", { className: "shrink-0 flex flex-col", children: [
862
+ /* @__PURE__ */ jsx4("div", { className: "flex items-center gap-2 border-b border-border px-3 py-2.5", children: /* @__PURE__ */ jsxs4(
863
+ Button,
864
+ {
865
+ size: "sm",
866
+ className: "w-full justify-start gap-2",
867
+ onClick: onNewChat,
868
+ children: [
869
+ /* @__PURE__ */ jsx4(
870
+ MessageSquarePlus,
871
+ {
872
+ className: "size-3.5 shrink-0",
873
+ "aria-hidden": "true"
874
+ }
875
+ ),
876
+ "New Chat"
877
+ ]
878
+ }
879
+ ) }),
880
+ /* @__PURE__ */ jsx4("div", { className: "flex items-center border-b border-border px-3 py-2.5", children: /* @__PURE__ */ jsxs4("div", { className: "relative flex-1", children: [
881
+ /* @__PURE__ */ jsx4(
882
+ Search,
883
+ {
884
+ className: "absolute left-2.5 top-1/2 -translate-y-1/2 size-3.5 text-muted-foreground pointer-events-none",
885
+ "aria-hidden": "true"
886
+ }
887
+ ),
888
+ /* @__PURE__ */ jsx4(
889
+ Input,
890
+ {
891
+ value: searchQuery,
892
+ onChange: (e) => onSearchChange == null ? void 0 : onSearchChange(e.target.value),
893
+ placeholder: "Search conversations...",
894
+ className: "h-8 pl-8 text-sm",
895
+ "aria-label": "Search conversations"
896
+ }
897
+ )
898
+ ] }) })
899
+ ] }),
900
+ /* @__PURE__ */ jsx4("div", { className: "flex-1 overflow-y-auto min-h-0", tabIndex: 0, children: filtered.length === 0 ? /* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center justify-center gap-2 p-8 text-muted-foreground", children: [
901
+ /* @__PURE__ */ jsx4(BrainCircuit2, { className: "size-8 opacity-30", "aria-hidden": "true" }),
902
+ /* @__PURE__ */ jsx4("p", { className: "text-sm", children: searchQuery ? "No conversations found." : "No recent sessions." }),
903
+ searchQuery && /* @__PURE__ */ jsx4(
904
+ Button,
905
+ {
906
+ variant: "outline",
907
+ size: "sm",
908
+ onClick: () => onSearchChange == null ? void 0 : onSearchChange(""),
909
+ children: "Clear search"
910
+ }
911
+ )
912
+ ] }) : filtered.map((conv) => /* @__PURE__ */ jsx4(
913
+ PolicyAIHistoryItem,
914
+ {
915
+ conv,
916
+ isActive: conv.id === activeId,
917
+ onClick: () => onSelect == null ? void 0 : onSelect(conv.id)
918
+ },
919
+ conv.id
920
+ )) })
921
+ ]
922
+ }
923
+ );
924
+ }
925
+
926
+ // src/components/ui/policy-ai/policy-ai-context-sidebar.tsx
927
+ import { BrainCircuit as BrainCircuit3, Database, Layers } from "lucide-react";
928
+ import { Fragment as Fragment4, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
929
+ var QUERY_TYPE_DESCRIPTIONS = {
930
+ single_bank: "Answered from a single bank's policy documents.",
931
+ cross_bank_comparison: "Compared across all indexed banks simultaneously.",
932
+ threshold_filter: "Filtered banks against a specific threshold or limit.",
933
+ ranking: "Ranked banks using TOPSIS multi-criteria scoring.",
934
+ scenario_match: "Matched your scenario against all bank lending criteria.",
935
+ general: "General policy question answered from the knowledge base."
936
+ };
937
+ var QUERY_TYPE_LABELS2 = {
938
+ single_bank: "Single bank",
939
+ cross_bank_comparison: "Cross-bank",
940
+ threshold_filter: "Threshold filter",
941
+ ranking: "Ranked list",
942
+ scenario_match: "Scenario match",
943
+ general: "General"
944
+ };
945
+ function SidebarSection({
946
+ title,
947
+ children,
948
+ className
949
+ }) {
950
+ return /* @__PURE__ */ jsxs5("div", { className: cn("flex flex-col gap-2", className), children: [
951
+ /* @__PURE__ */ jsx5("p", { className: "text-overline text-muted-foreground px-3", children: title }),
952
+ children
953
+ ] });
954
+ }
955
+ function StatRow({
956
+ icon: Icon,
957
+ children
958
+ }) {
959
+ return /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2.5", children: [
960
+ /* @__PURE__ */ jsx5(
961
+ Icon,
962
+ {
963
+ className: "size-3.5 text-muted-foreground shrink-0",
964
+ "aria-hidden": "true"
965
+ }
966
+ ),
967
+ children
968
+ ] });
969
+ }
970
+ function PolicyAIContextSidebar({
971
+ lastQueryContext,
972
+ suggestedFollowUps,
973
+ onFollowUpClick,
974
+ bankCount = 42,
975
+ categoryCount = 86,
976
+ lastUpdated = "June 2026",
977
+ className
978
+ }) {
979
+ return /* @__PURE__ */ jsx5(
980
+ "div",
981
+ {
982
+ "data-slot": "policy-ai-context-sidebar",
983
+ className: cn(
984
+ "flex flex-col h-full border-l border-border bg-card shrink-0 overflow-y-auto",
985
+ className
986
+ ),
987
+ children: /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-5 px-0 py-4", children: [
988
+ /* @__PURE__ */ jsx5(SidebarSection, { title: "Coverage", children: /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-1.5 px-3", children: [
989
+ /* @__PURE__ */ jsx5(StatRow, { icon: BrainCircuit3, children: /* @__PURE__ */ jsxs5("span", { className: "text-sm text-foreground", children: [
990
+ /* @__PURE__ */ jsx5("span", { className: "font-semibold", children: bankCount }),
991
+ " banks indexed"
992
+ ] }) }),
993
+ /* @__PURE__ */ jsx5(StatRow, { icon: Layers, children: /* @__PURE__ */ jsxs5("span", { className: "text-sm text-foreground", children: [
994
+ /* @__PURE__ */ jsx5("span", { className: "font-semibold", children: categoryCount }),
995
+ " policy categories"
996
+ ] }) }),
997
+ /* @__PURE__ */ jsx5(StatRow, { icon: Database, children: /* @__PURE__ */ jsxs5("span", { className: "text-caption text-muted-foreground", children: [
998
+ "Updated ",
999
+ lastUpdated
1000
+ ] }) })
1001
+ ] }) }),
1002
+ lastQueryContext && /* @__PURE__ */ jsxs5(Fragment4, { children: [
1003
+ /* @__PURE__ */ jsx5(Separator, {}),
1004
+ /* @__PURE__ */ jsx5(SidebarSection, { title: "Last Query", children: /* @__PURE__ */ jsxs5(Card, { className: "gap-0 py-0 shadow-none overflow-hidden mx-3", children: [
1005
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between gap-2 px-3 py-2 border-b border-border bg-muted/30", children: [
1006
+ /* @__PURE__ */ jsx5("span", { className: "text-sm font-semibold text-foreground", children: lastQueryContext.policyType }),
1007
+ /* @__PURE__ */ jsx5(Badge, { variant: "outline", className: "text-xs shrink-0", children: QUERY_TYPE_LABELS2[lastQueryContext.queryType] })
1008
+ ] }),
1009
+ /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2 px-3 py-2.5", children: [
1010
+ lastQueryContext.bankName && /* @__PURE__ */ jsx5("p", { className: "text-sm font-semibold text-foreground leading-none", children: lastQueryContext.bankName }),
1011
+ lastQueryContext.categories.length > 0 && /* @__PURE__ */ jsx5("div", { className: "flex flex-wrap gap-1", children: lastQueryContext.categories.map((cat) => /* @__PURE__ */ jsx5(
1012
+ Badge,
786
1013
  {
787
- value: inputValue,
788
- onChange: setInputValue,
789
- onSend: handleSend,
790
- onAttachFile,
791
- onAttachImage,
792
- disabled: isStreaming,
793
- placeholder: "Ask about lending policies\u2026",
794
- autoFocus: !minimised
795
- }
796
- )
1014
+ variant: "secondary",
1015
+ className: "text-xs font-normal",
1016
+ children: cat
1017
+ },
1018
+ cat
1019
+ )) })
1020
+ ] }),
1021
+ /* @__PURE__ */ jsx5("div", { className: "border-t border-border px-3 py-2", children: /* @__PURE__ */ jsx5("p", { className: "text-caption text-muted-foreground leading-snug", children: QUERY_TYPE_DESCRIPTIONS[lastQueryContext.queryType] }) })
1022
+ ] }) })
1023
+ ] }),
1024
+ !!(suggestedFollowUps == null ? void 0 : suggestedFollowUps.length) && /* @__PURE__ */ jsxs5(Fragment4, { children: [
1025
+ /* @__PURE__ */ jsx5(Separator, {}),
1026
+ /* @__PURE__ */ jsx5(SidebarSection, { title: "Follow-ups", children: /* @__PURE__ */ jsx5("div", { className: "flex flex-col gap-1 px-3", children: suggestedFollowUps.map((q) => /* @__PURE__ */ jsx5(
1027
+ Button,
1028
+ {
1029
+ variant: "outline",
1030
+ size: "sm",
1031
+ className: "w-full justify-start h-auto py-1.5 text-muted-foreground font-normal leading-snug whitespace-normal text-left",
1032
+ onClick: () => onFollowUpClick == null ? void 0 : onFollowUpClick(q),
1033
+ children: q
1034
+ },
1035
+ q
1036
+ )) }) })
1037
+ ] })
1038
+ ] })
1039
+ }
1040
+ );
1041
+ }
1042
+
1043
+ // src/components/ui/policy-ai/policy-ai-page.tsx
1044
+ import * as React4 from "react";
1045
+ import { PanelRight } from "lucide-react";
1046
+ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1047
+ function deriveFollowUps(context) {
1048
+ var _a;
1049
+ if (!context) return [];
1050
+ const { queryType, policyType, bankName } = context;
1051
+ if (queryType === "cross_bank_comparison") {
1052
+ return [
1053
+ `Which of these banks is best overall for ${(_a = context.categories[0]) != null ? _a : policyType}?`,
1054
+ bankName ? `Does ${bankName} have any exceptions?` : "Which bank has the most flexible policy?",
1055
+ "Show me the ranked list of lenders."
1056
+ ];
1057
+ }
1058
+ if (queryType === "ranking") {
1059
+ return [
1060
+ `What are the full details for the #1 ranked bank?`,
1061
+ `Which banks in the list accept cases under 80% LVR?`,
1062
+ `Compare the top 3 banks side by side.`
1063
+ ];
1064
+ }
1065
+ if (queryType === "single_bank") {
1066
+ return [
1067
+ `How does ${bankName != null ? bankName : "this bank"} compare to other lenders?`,
1068
+ `What documentation does ${bankName != null ? bankName : "this bank"} require?`,
1069
+ `Which banks have a better policy than ${bankName != null ? bankName : "this bank"}?`
1070
+ ];
1071
+ }
1072
+ if (queryType === "threshold_filter") {
1073
+ return [
1074
+ `What is the maximum LVR across all filtered banks?`,
1075
+ `Are any of these banks on a specialist product?`,
1076
+ `Rank the filtered banks best to worst.`
1077
+ ];
1078
+ }
1079
+ return [];
1080
+ }
1081
+ function PolicyAIPage({
1082
+ // Chat
1083
+ messages = [],
1084
+ suggestedQuestions,
1085
+ isStreaming = false,
1086
+ isLoading = false,
1087
+ thinkingSteps,
1088
+ onSendMessage,
1089
+ onAttachFile,
1090
+ onAttachImage,
1091
+ onReset,
1092
+ // History
1093
+ conversations = [],
1094
+ activeConversationId,
1095
+ onSelectConversation,
1096
+ onNewChat,
1097
+ // Context
1098
+ defaultShowContextPanel = true,
1099
+ bankCount = 42,
1100
+ categoryCount = 86,
1101
+ lastUpdated = "June 2026",
1102
+ onAskSupport,
1103
+ className
1104
+ }) {
1105
+ const [showContextPanel, setShowContextPanel] = React4.useState(
1106
+ defaultShowContextPanel
1107
+ );
1108
+ const [historySearch, setHistorySearch] = React4.useState("");
1109
+ const lastQueryContext = React4.useMemo(() => {
1110
+ for (let i = messages.length - 1; i >= 0; i--) {
1111
+ const m = messages[i];
1112
+ if (m.role === "assistant" && m.queryContext) return m.queryContext;
1113
+ }
1114
+ return void 0;
1115
+ }, [messages]);
1116
+ const followUps = deriveFollowUps(lastQueryContext);
1117
+ const handleNewChat = () => {
1118
+ onReset == null ? void 0 : onReset();
1119
+ onNewChat == null ? void 0 : onNewChat();
1120
+ };
1121
+ const panelToggleLabel = showContextPanel ? "Hide context panel" : "Show context panel";
1122
+ return /* @__PURE__ */ jsxs6(
1123
+ "div",
1124
+ {
1125
+ "data-slot": "policy-ai-page",
1126
+ className: cn("flex flex-col h-full bg-background", className),
1127
+ children: [
1128
+ /* @__PURE__ */ jsx6(
1129
+ PageTopBar,
1130
+ {
1131
+ title: "Policy AI",
1132
+ actions: /* @__PURE__ */ jsx6(
1133
+ Button,
1134
+ {
1135
+ variant: "ghost",
1136
+ size: "icon-sm",
1137
+ onClick: () => setShowContextPanel((v) => !v),
1138
+ "aria-label": panelToggleLabel,
1139
+ "aria-pressed": showContextPanel,
1140
+ title: panelToggleLabel,
1141
+ children: /* @__PURE__ */ jsx6(PanelRight, { className: "size-4", "aria-hidden": "true" })
1142
+ }
1143
+ ),
1144
+ onAskSupport
1145
+ }
1146
+ ),
1147
+ /* @__PURE__ */ jsxs6("div", { className: "flex flex-1 min-h-0 overflow-hidden", children: [
1148
+ /* @__PURE__ */ jsx6(
1149
+ PolicyAIHistoryPanel,
1150
+ {
1151
+ conversations,
1152
+ activeId: activeConversationId,
1153
+ onSelect: onSelectConversation,
1154
+ onNewChat: handleNewChat,
1155
+ searchQuery: historySearch,
1156
+ onSearchChange: setHistorySearch,
1157
+ className: "w-[260px]"
1158
+ }
1159
+ ),
1160
+ /* @__PURE__ */ jsx6("div", { className: "flex-1 flex flex-col min-w-0 min-h-0", children: /* @__PURE__ */ jsx6(
1161
+ PolicyAIPanel,
1162
+ {
1163
+ inline: true,
1164
+ messages,
1165
+ suggestedQuestions,
1166
+ isStreaming,
1167
+ isLoading,
1168
+ thinkingSteps,
1169
+ onSendMessage,
1170
+ onAttachFile,
1171
+ onAttachImage,
1172
+ onReset,
1173
+ className: "flex-1 min-h-0"
1174
+ }
1175
+ ) }),
1176
+ showContextPanel && messages.length > 0 && /* @__PURE__ */ jsx6(
1177
+ PolicyAIContextSidebar,
1178
+ {
1179
+ lastQueryContext,
1180
+ suggestedFollowUps: followUps,
1181
+ onFollowUpClick: onSendMessage,
1182
+ bankCount,
1183
+ categoryCount,
1184
+ lastUpdated,
1185
+ className: "w-[280px]"
797
1186
  }
798
1187
  )
799
1188
  ] })
@@ -810,5 +1199,8 @@ export {
810
1199
  PolicyComparisonTable,
811
1200
  PolicyRankedList,
812
1201
  PolicyAIFAB,
813
- PolicyAIPanel
1202
+ PolicyAIPanel,
1203
+ PolicyAIHistoryPanel,
1204
+ PolicyAIContextSidebar,
1205
+ PolicyAIPage
814
1206
  };