@wealthx/shadcn 1.5.24 → 1.5.26
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 +195 -195
- package/CHANGELOG.md +12 -0
- package/dist/{chunk-FGHM34AV.mjs → chunk-2CHH5QOA.mjs} +1 -1
- package/dist/{chunk-G6RCC2SF.mjs → chunk-36IN7YRM.mjs} +4 -4
- package/dist/{chunk-RYGZRDP6.mjs → chunk-6URIFQ63.mjs} +480 -422
- package/dist/{chunk-RGHKARAK.mjs → chunk-7PTRHNUV.mjs} +1 -1
- package/dist/{chunk-66NM4AX2.mjs → chunk-AAZSLTER.mjs} +11 -11
- package/dist/{chunk-OFQFD2E2.mjs → chunk-C35JMOII.mjs} +1 -1
- package/dist/{chunk-YV7XF32X.mjs → chunk-DSVKEVX6.mjs} +1 -1
- package/dist/{chunk-6HTE24TP.mjs → chunk-EVUY67CY.mjs} +5 -5
- package/dist/{chunk-5G2M45CA.mjs → chunk-FYZBGWYR.mjs} +1 -1
- package/dist/{chunk-RVDBYV2B.mjs → chunk-HONTZFLO.mjs} +1 -1
- package/dist/chunk-HSL23TOM.mjs +443 -0
- package/dist/{chunk-JGUC3KCA.mjs → chunk-HSXMTFIM.mjs} +9 -9
- package/dist/{chunk-2VTOF7PW.mjs → chunk-I433SC7S.mjs} +3 -3
- package/dist/{chunk-ONYADWSO.mjs → chunk-KGVVK6OS.mjs} +7 -7
- package/dist/{chunk-3HFOSFOM.mjs → chunk-KI57CBJR.mjs} +11 -11
- package/dist/{chunk-IT3QJF3D.mjs → chunk-LBXIYS34.mjs} +4 -4
- package/dist/{chunk-K35TFQUB.mjs → chunk-LSSIWLYU.mjs} +1 -1
- package/dist/{chunk-RJHE3V4M.mjs → chunk-M32QNCD3.mjs} +8 -8
- package/dist/{chunk-AADJ5IT6.mjs → chunk-MD66TGX7.mjs} +7 -7
- package/dist/{chunk-ZSMQZ3VN.mjs → chunk-NGKTJRFN.mjs} +7 -7
- package/dist/{chunk-A43XIVO6.mjs → chunk-OG2VM34K.mjs} +4 -4
- package/dist/{chunk-BWG7AX6X.mjs → chunk-OKIWXOJL.mjs} +5 -5
- package/dist/{chunk-4UCRTTVL.mjs → chunk-RNLIZRAK.mjs} +1 -1
- package/dist/{chunk-WIDZVCH3.mjs → chunk-S7SBLNX4.mjs} +7 -7
- package/dist/{chunk-2SDEURIQ.mjs → chunk-SYJ6LVJ6.mjs} +7 -7
- package/dist/{chunk-OIETBBXQ.mjs → chunk-T5FRVEJQ.mjs} +1 -1
- package/dist/{chunk-ETT5JAXF.mjs → chunk-T5HU4S4X.mjs} +2 -2
- package/dist/{chunk-DK55HZPN.mjs → chunk-ULQ53FRJ.mjs} +10 -10
- package/dist/{chunk-NTIFG5A7.mjs → chunk-USIRKDYQ.mjs} +4 -4
- package/dist/{chunk-QJ3RSZF4.mjs → chunk-VVURVETY.mjs} +4 -4
- package/dist/{chunk-NXZ2F4JA.mjs → chunk-ZA37ZWZW.mjs} +5 -5
- package/dist/components/ui/about-you-form.mjs +4 -4
- package/dist/components/ui/add-column-modal.js +1 -1
- package/dist/components/ui/add-column-modal.mjs +2 -2
- package/dist/components/ui/add-lead-modal.js +1 -1
- package/dist/components/ui/add-lead-modal.mjs +2 -2
- package/dist/components/ui/advisor-card.mjs +2 -2
- package/dist/components/ui/ai-assistant-drawer.mjs +2 -2
- package/dist/components/ui/{ai-builder.js → ai-builder/index.js} +288 -187
- package/dist/components/ui/ai-builder/index.mjs +26 -0
- package/dist/components/ui/{ai-conversations.js → ai-conversations/index.js} +819 -764
- package/dist/components/ui/ai-conversations/index.mjs +42 -0
- package/dist/components/ui/appointment-action-dialogs.js +1 -1
- package/dist/components/ui/appointment-action-dialogs.mjs +3 -3
- package/dist/components/ui/appointment-availability-settings.js +1 -1
- package/dist/components/ui/appointment-availability-settings.mjs +5 -5
- package/dist/components/ui/appointment-book-dialog.js +1 -1
- package/dist/components/ui/appointment-book-dialog.mjs +6 -6
- package/dist/components/ui/appointment-calendar-view.mjs +2 -2
- package/dist/components/ui/appointment-detail-sheet.js +1 -1
- package/dist/components/ui/appointment-detail-sheet.mjs +6 -6
- package/dist/components/ui/appointment-upcoming-card.js +1 -1
- package/dist/components/ui/appointment-upcoming-card.mjs +4 -4
- package/dist/components/ui/assets-liabilities-side-card.mjs +6 -6
- package/dist/components/ui/backoffice-signup-steps.mjs +4 -4
- package/dist/components/ui/bank-statement-generate-dialog.js +1 -1
- package/dist/components/ui/bank-statement-generate-dialog.mjs +7 -7
- package/dist/components/ui/bank-statement-pdf-viewer.mjs +2 -2
- package/dist/components/ui/cash-balance-line-chart.mjs +2 -2
- package/dist/components/ui/category-edit-dialog.js +1 -1
- package/dist/components/ui/category-edit-dialog.mjs +2 -2
- package/dist/components/ui/chat-widget.mjs +1 -1
- package/dist/components/ui/contact-alert-dialog/index.js +1 -1
- package/dist/components/ui/contact-alert-dialog/index.mjs +3 -3
- package/dist/components/ui/create-contact-modal.js +1 -1
- package/dist/components/ui/create-contact-modal.mjs +4 -4
- package/dist/components/ui/csv-import-modal.js +1 -1
- package/dist/components/ui/csv-import-modal.mjs +2 -2
- package/dist/components/ui/dashboard-expense-categories.mjs +3 -3
- package/dist/components/ui/dashboard-transactions-table.js +1 -1
- package/dist/components/ui/dashboard-transactions-table.mjs +5 -5
- package/dist/components/ui/date-picker.mjs +2 -2
- package/dist/components/ui/dialog.js +1 -1
- package/dist/components/ui/dialog.mjs +1 -1
- package/dist/components/ui/document-checklist-template.mjs +2 -2
- package/dist/components/ui/expense-detail-item.mjs +4 -4
- package/dist/components/ui/expense-work-details.mjs +4 -4
- package/dist/components/ui/file-preview-dialog.js +1 -1
- package/dist/components/ui/file-preview-dialog.mjs +3 -3
- package/dist/components/ui/financial-drawers.mjs +2 -2
- package/dist/components/ui/form-primitives.mjs +2 -2
- package/dist/components/ui/frontend-signup-steps.mjs +5 -5
- package/dist/components/ui/income-sources-card.mjs +3 -3
- package/dist/components/ui/income-work-details.mjs +4 -4
- package/dist/components/ui/kanban-column.mjs +6 -6
- package/dist/components/ui/opportunity-card.mjs +3 -3
- package/dist/components/ui/opportunity-edit-modals.js +1 -1
- package/dist/components/ui/opportunity-edit-modals.mjs +7 -7
- package/dist/components/ui/opportunity-summary-tab.js +1 -1
- package/dist/components/ui/opportunity-summary-tab.mjs +9 -9
- package/dist/components/ui/pipeline-board.mjs +8 -8
- package/dist/components/ui/pipeline-dialogs.js +1 -1
- package/dist/components/ui/pipeline-dialogs.mjs +6 -6
- package/dist/components/ui/pipeline-primitives.mjs +2 -2
- package/dist/components/ui/property-report-dialog.js +1 -1
- package/dist/components/ui/property-report-dialog.mjs +5 -5
- package/dist/components/ui/resource-center/index.js +1 -1
- package/dist/components/ui/resource-center/index.mjs +2 -2
- package/dist/components/ui/review-alerts-dialog.js +1 -1
- package/dist/components/ui/review-alerts-dialog.mjs +2 -2
- package/dist/components/ui/savings-goal-modal.js +1 -1
- package/dist/components/ui/savings-goal-modal.mjs +5 -5
- package/dist/components/ui/share-details-dialog.js +1 -1
- package/dist/components/ui/share-details-dialog.mjs +3 -3
- package/dist/components/ui/signup-form-primitives.mjs +1 -1
- package/dist/components/ui/stage-timeline.mjs +3 -3
- package/dist/components/ui/transactions-income-expense-bar-chart.mjs +2 -2
- package/dist/index.js +5491 -5376
- package/dist/index.mjs +243 -243
- package/dist/styles.css +1 -1
- package/package.json +7 -7
- package/src/components/index.tsx +2 -0
- package/src/components/ui/ai-builder/agent-card.tsx +181 -0
- package/src/components/ui/ai-builder/index.tsx +21 -0
- package/src/components/ui/ai-builder/integration-card.tsx +144 -0
- package/src/components/ui/ai-builder/service-config-modal.tsx +283 -0
- package/src/components/ui/ai-builder/types.ts +34 -0
- package/src/components/ui/ai-conversations/helpers.tsx +31 -0
- package/src/components/ui/ai-conversations/index.tsx +468 -0
- package/src/components/ui/ai-conversations/lead-panel.tsx +517 -0
- package/src/components/ui/ai-conversations/list.tsx +335 -0
- package/src/components/ui/ai-conversations/thread.tsx +919 -0
- package/src/components/ui/ai-conversations/types.ts +83 -0
- package/src/components/ui/dialog.tsx +1 -1
- package/src/styles/styles-css.ts +1 -1
- package/tsup.config.ts +2 -2
- package/dist/chunk-INGYBZGU.mjs +0 -394
- package/dist/components/ui/ai-builder.mjs +0 -25
- package/dist/components/ui/ai-conversations.mjs +0 -42
- package/src/components/ui/ai-builder.tsx +0 -558
- package/src/components/ui/ai-conversations.tsx +0 -2270
- package/dist/{chunk-PSBQ4I3M.mjs → chunk-53ZB2JWT.mjs} +6 -6
- package/dist/{chunk-G2W754UJ.mjs → chunk-6UKOJLXO.mjs} +3 -3
- package/dist/{chunk-H5NI6ZIU.mjs → chunk-734FOOJC.mjs} +3 -3
- package/dist/{chunk-S6AYZJYO.mjs → chunk-CZ6IEOM5.mjs} +3 -3
- package/dist/{chunk-57QES5LX.mjs → chunk-JHS2T6JZ.mjs} +3 -3
- package/dist/{chunk-EXI64H46.mjs → chunk-L6LE4OIM.mjs} +3 -3
- package/dist/{chunk-ET4MTPIY.mjs → chunk-LDC6V6DJ.mjs} +3 -3
- package/dist/{chunk-DCKT635J.mjs → chunk-LHQACMZY.mjs} +3 -3
- package/dist/{chunk-3S4XQTAL.mjs → chunk-SO4RB3XB.mjs} +9 -9
- package/dist/{chunk-V23CBULF.mjs → chunk-SZLAPJKD.mjs} +3 -3
- package/dist/{chunk-UMF6LLQK.mjs → chunk-TRM3KIHT.mjs} +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wealthx/shadcn",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.26",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -302,9 +302,9 @@
|
|
|
302
302
|
"require": "./dist/components/ui/accordion.js"
|
|
303
303
|
},
|
|
304
304
|
"./ai-builder": {
|
|
305
|
-
"types": "./src/components/ui/ai-builder.tsx",
|
|
306
|
-
"import": "./dist/components/ui/ai-builder.mjs",
|
|
307
|
-
"require": "./dist/components/ui/ai-builder.js"
|
|
305
|
+
"types": "./src/components/ui/ai-builder/index.tsx",
|
|
306
|
+
"import": "./dist/components/ui/ai-builder/index.mjs",
|
|
307
|
+
"require": "./dist/components/ui/ai-builder/index.js"
|
|
308
308
|
},
|
|
309
309
|
"./empty": {
|
|
310
310
|
"types": "./src/components/ui/empty.tsx",
|
|
@@ -557,9 +557,9 @@
|
|
|
557
557
|
"require": "./dist/components/ui/ai-assistant-drawer.js"
|
|
558
558
|
},
|
|
559
559
|
"./ai-conversations": {
|
|
560
|
-
"types": "./src/components/ui/ai-conversations.tsx",
|
|
561
|
-
"import": "./dist/components/ui/ai-conversations.mjs",
|
|
562
|
-
"require": "./dist/components/ui/ai-conversations.js"
|
|
560
|
+
"types": "./src/components/ui/ai-conversations/index.tsx",
|
|
561
|
+
"import": "./dist/components/ui/ai-conversations/index.mjs",
|
|
562
|
+
"require": "./dist/components/ui/ai-conversations/index.js"
|
|
563
563
|
},
|
|
564
564
|
"./chat-widget-primitives": {
|
|
565
565
|
"types": "./src/components/ui/chat-widget-primitives.tsx",
|
package/src/components/index.tsx
CHANGED
|
@@ -20,6 +20,7 @@ export {
|
|
|
20
20
|
} from "./ui/ai-builder";
|
|
21
21
|
export type {
|
|
22
22
|
AiBuilderAgentItem,
|
|
23
|
+
AiBuilderEmailCategories,
|
|
23
24
|
AiBuilderServiceType,
|
|
24
25
|
AiBuilderServiceData,
|
|
25
26
|
AgentCardProps,
|
|
@@ -56,6 +57,7 @@ export type {
|
|
|
56
57
|
AiConvMessage,
|
|
57
58
|
AiConvDataField,
|
|
58
59
|
AiConvAppointmentData,
|
|
60
|
+
AiConvEmailPayload,
|
|
59
61
|
ConversationStatusChipProps,
|
|
60
62
|
ConversationListItemProps,
|
|
61
63
|
ConversationListProps,
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MoreHorizontal } from "lucide-react";
|
|
3
|
+
import { Badge } from "@/components/ui/badge";
|
|
4
|
+
import { Button } from "@/components/ui/button";
|
|
5
|
+
import { Card } from "@/components/ui/card";
|
|
6
|
+
import {
|
|
7
|
+
Dialog,
|
|
8
|
+
DialogContent,
|
|
9
|
+
DialogDescription,
|
|
10
|
+
DialogHeader,
|
|
11
|
+
DialogTitle,
|
|
12
|
+
} from "@/components/ui/dialog";
|
|
13
|
+
import { Switch } from "@/components/ui/switch";
|
|
14
|
+
import { cn } from "@/lib/utils";
|
|
15
|
+
import type { AiBuilderAgentItem } from "./types";
|
|
16
|
+
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// AgentCard
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
export type AgentCardProps = {
|
|
22
|
+
agent: AiBuilderAgentItem;
|
|
23
|
+
onToggle: (agentId: string, enabled: boolean) => void;
|
|
24
|
+
onMenuClick: (agentId: string) => void;
|
|
25
|
+
className?: string;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const AGENT_FEATURES = [
|
|
29
|
+
{
|
|
30
|
+
title: "Lead Capture",
|
|
31
|
+
description:
|
|
32
|
+
"Automatically collect and qualify leads from website visitors.",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
title: "Initial Engagement",
|
|
36
|
+
description:
|
|
37
|
+
"Instantly respond to inquiries with personalised mortgage guidance.",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
title: "Smart Follow-Up",
|
|
41
|
+
description:
|
|
42
|
+
"Re-engage cold leads with timely, context-aware follow-up messages.",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
title: "Appointment Scheduling",
|
|
46
|
+
description:
|
|
47
|
+
"Book qualified leads directly into advisor calendars without manual coordination.",
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
title: "Performance Tracking",
|
|
51
|
+
description:
|
|
52
|
+
"Monitor agent activity, response rates, and conversion metrics.",
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
export function AgentCard({
|
|
57
|
+
agent,
|
|
58
|
+
onToggle,
|
|
59
|
+
onMenuClick,
|
|
60
|
+
className,
|
|
61
|
+
}: AgentCardProps) {
|
|
62
|
+
const { id, title, description, tags, isEnabled, infoBadge, isComingSoon } =
|
|
63
|
+
agent;
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<Card
|
|
67
|
+
className={cn(
|
|
68
|
+
"flex flex-col gap-3 p-4 transition-opacity",
|
|
69
|
+
isComingSoon && "opacity-60",
|
|
70
|
+
className,
|
|
71
|
+
)}
|
|
72
|
+
>
|
|
73
|
+
<div className="flex items-start justify-between gap-2">
|
|
74
|
+
<div className="flex flex-1 items-center gap-2 min-w-0">
|
|
75
|
+
<span
|
|
76
|
+
className={cn(
|
|
77
|
+
"mt-0.5 size-2 shrink-0 rounded-full",
|
|
78
|
+
isEnabled && !isComingSoon
|
|
79
|
+
? "bg-success"
|
|
80
|
+
: "bg-muted-foreground/40",
|
|
81
|
+
)}
|
|
82
|
+
/>
|
|
83
|
+
<span className="truncate text-sm font-semibold leading-tight">
|
|
84
|
+
{title}
|
|
85
|
+
</span>
|
|
86
|
+
{isComingSoon && (
|
|
87
|
+
<Badge variant="outline" className="shrink-0 text-xs">
|
|
88
|
+
Coming Soon
|
|
89
|
+
</Badge>
|
|
90
|
+
)}
|
|
91
|
+
</div>
|
|
92
|
+
<div className="flex shrink-0 items-center gap-1">
|
|
93
|
+
<Switch
|
|
94
|
+
checked={isEnabled}
|
|
95
|
+
disabled={isComingSoon}
|
|
96
|
+
onCheckedChange={(checked) => onToggle(id, checked)}
|
|
97
|
+
aria-label={`Toggle ${title}`}
|
|
98
|
+
/>
|
|
99
|
+
<Button
|
|
100
|
+
variant="ghost"
|
|
101
|
+
size="icon"
|
|
102
|
+
className="h-7 w-7"
|
|
103
|
+
onClick={() => onMenuClick(id)}
|
|
104
|
+
aria-label={`View details for ${title}`}
|
|
105
|
+
>
|
|
106
|
+
<MoreHorizontal className="h-4 w-4" />
|
|
107
|
+
</Button>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
<p className="text-muted-foreground text-xs leading-relaxed flex-1">
|
|
112
|
+
{description}
|
|
113
|
+
</p>
|
|
114
|
+
|
|
115
|
+
<div className="flex flex-col gap-2">
|
|
116
|
+
{infoBadge && (
|
|
117
|
+
<p className="bg-info/10 text-info px-2 py-1 text-xs">{infoBadge}</p>
|
|
118
|
+
)}
|
|
119
|
+
{tags.length > 0 && (
|
|
120
|
+
<div className="flex flex-wrap gap-1">
|
|
121
|
+
{tags.map((tag) => (
|
|
122
|
+
<Badge key={tag} variant="secondary" className="text-xs">
|
|
123
|
+
{tag}
|
|
124
|
+
</Badge>
|
|
125
|
+
))}
|
|
126
|
+
</div>
|
|
127
|
+
)}
|
|
128
|
+
</div>
|
|
129
|
+
</Card>
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// ---------------------------------------------------------------------------
|
|
134
|
+
// AgentMenuModal
|
|
135
|
+
// ---------------------------------------------------------------------------
|
|
136
|
+
|
|
137
|
+
export type AgentMenuModalProps = {
|
|
138
|
+
open: boolean;
|
|
139
|
+
onOpenChange: (open: boolean) => void;
|
|
140
|
+
agentTitle: string;
|
|
141
|
+
description?: string;
|
|
142
|
+
features?: Array<{ title: string; description: string }>;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export function AgentMenuModal({
|
|
146
|
+
open,
|
|
147
|
+
onOpenChange,
|
|
148
|
+
agentTitle,
|
|
149
|
+
description = "AI-powered lead management that works around the clock to grow your mortgage business.",
|
|
150
|
+
features = AGENT_FEATURES,
|
|
151
|
+
}: AgentMenuModalProps) {
|
|
152
|
+
return (
|
|
153
|
+
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
154
|
+
<DialogContent className="max-w-lg">
|
|
155
|
+
<DialogHeader>
|
|
156
|
+
<DialogTitle>{agentTitle}</DialogTitle>
|
|
157
|
+
<DialogDescription>{description}</DialogDescription>
|
|
158
|
+
</DialogHeader>
|
|
159
|
+
|
|
160
|
+
<div className="flex flex-col gap-3 py-2">
|
|
161
|
+
{features.map((feature, index) => (
|
|
162
|
+
<div key={feature.title} className="flex gap-3">
|
|
163
|
+
<Badge
|
|
164
|
+
variant="default"
|
|
165
|
+
className="h-6 w-6 shrink-0 p-0 text-xs font-bold"
|
|
166
|
+
>
|
|
167
|
+
{index + 1}
|
|
168
|
+
</Badge>
|
|
169
|
+
<div className="flex flex-col gap-0.5">
|
|
170
|
+
<p className="text-sm font-semibold">{feature.title}</p>
|
|
171
|
+
<p className="text-muted-foreground text-xs leading-relaxed">
|
|
172
|
+
{feature.description}
|
|
173
|
+
</p>
|
|
174
|
+
</div>
|
|
175
|
+
</div>
|
|
176
|
+
))}
|
|
177
|
+
</div>
|
|
178
|
+
</DialogContent>
|
|
179
|
+
</Dialog>
|
|
180
|
+
);
|
|
181
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
AiBuilderAgentItem,
|
|
3
|
+
AiBuilderEmailCategories,
|
|
4
|
+
AiBuilderServiceData,
|
|
5
|
+
AiBuilderServiceType,
|
|
6
|
+
} from "./types";
|
|
7
|
+
|
|
8
|
+
export { AgentCard, AgentMenuModal } from "./agent-card";
|
|
9
|
+
export type { AgentCardProps, AgentMenuModalProps } from "./agent-card";
|
|
10
|
+
|
|
11
|
+
export {
|
|
12
|
+
IntegrationInstructionCard,
|
|
13
|
+
IntegrationServiceCard,
|
|
14
|
+
} from "./integration-card";
|
|
15
|
+
export type {
|
|
16
|
+
IntegrationInstructionCardProps,
|
|
17
|
+
IntegrationServiceCardProps,
|
|
18
|
+
} from "./integration-card";
|
|
19
|
+
|
|
20
|
+
export { ServiceConfigurationModal } from "./service-config-modal";
|
|
21
|
+
export type { ServiceConfigurationModalProps } from "./service-config-modal";
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { Check, CheckCircle2, Copy, Settings, User } from "lucide-react";
|
|
3
|
+
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
|
|
4
|
+
import { Badge } from "@/components/ui/badge";
|
|
5
|
+
import { Button } from "@/components/ui/button";
|
|
6
|
+
import { Card } from "@/components/ui/card";
|
|
7
|
+
import { cn } from "@/lib/utils";
|
|
8
|
+
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
// IntegrationServiceCard
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
|
|
13
|
+
export type IntegrationServiceCardProps = {
|
|
14
|
+
title: string;
|
|
15
|
+
imageUrl?: string;
|
|
16
|
+
iconNode?: React.ReactNode;
|
|
17
|
+
description: string;
|
|
18
|
+
isConnected: boolean;
|
|
19
|
+
onCardClick: () => void;
|
|
20
|
+
onSettingsClick: () => void;
|
|
21
|
+
className?: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export function IntegrationServiceCard({
|
|
25
|
+
title,
|
|
26
|
+
imageUrl,
|
|
27
|
+
iconNode,
|
|
28
|
+
description,
|
|
29
|
+
isConnected,
|
|
30
|
+
onCardClick,
|
|
31
|
+
onSettingsClick,
|
|
32
|
+
className,
|
|
33
|
+
}: IntegrationServiceCardProps) {
|
|
34
|
+
return (
|
|
35
|
+
<Card
|
|
36
|
+
className={cn(
|
|
37
|
+
"flex flex-col gap-3 p-4",
|
|
38
|
+
!isConnected && "cursor-pointer transition-colors hover:bg-accent/50",
|
|
39
|
+
className,
|
|
40
|
+
)}
|
|
41
|
+
onClick={!isConnected ? onCardClick : undefined}
|
|
42
|
+
>
|
|
43
|
+
<div className="flex items-start gap-3">
|
|
44
|
+
<Avatar className="h-10 w-10 shrink-0">
|
|
45
|
+
{imageUrl && <AvatarImage src={imageUrl} alt={title} />}
|
|
46
|
+
<AvatarFallback className={iconNode ? "bg-transparent p-0.5" : ""}>
|
|
47
|
+
{iconNode ?? <User className="h-5 w-5" />}
|
|
48
|
+
</AvatarFallback>
|
|
49
|
+
</Avatar>
|
|
50
|
+
|
|
51
|
+
<div className="flex min-w-0 flex-1 flex-col gap-0.5">
|
|
52
|
+
<div className="flex items-center gap-2">
|
|
53
|
+
<span className="text-base font-semibold">{title}</span>
|
|
54
|
+
{isConnected && (
|
|
55
|
+
<Badge variant="success" className="gap-1 text-xs">
|
|
56
|
+
<CheckCircle2 className="h-3 w-3" />
|
|
57
|
+
Connected
|
|
58
|
+
</Badge>
|
|
59
|
+
)}
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
{isConnected && (
|
|
64
|
+
<Button
|
|
65
|
+
variant="ghost"
|
|
66
|
+
size="icon"
|
|
67
|
+
className="h-7 w-7 shrink-0"
|
|
68
|
+
onClick={(e) => {
|
|
69
|
+
e.stopPropagation();
|
|
70
|
+
onSettingsClick();
|
|
71
|
+
}}
|
|
72
|
+
aria-label={`Settings for ${title}`}
|
|
73
|
+
>
|
|
74
|
+
<Settings className="h-4 w-4" />
|
|
75
|
+
</Button>
|
|
76
|
+
)}
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
<p className="text-sm leading-relaxed text-muted-foreground">
|
|
80
|
+
{description}
|
|
81
|
+
</p>
|
|
82
|
+
</Card>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// ---------------------------------------------------------------------------
|
|
87
|
+
// IntegrationInstructionCard
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
|
|
90
|
+
export type IntegrationInstructionCardProps = {
|
|
91
|
+
title: string;
|
|
92
|
+
codeBlock: string;
|
|
93
|
+
onCopy?: () => void;
|
|
94
|
+
className?: string;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export function IntegrationInstructionCard({
|
|
98
|
+
title,
|
|
99
|
+
codeBlock,
|
|
100
|
+
onCopy,
|
|
101
|
+
className,
|
|
102
|
+
}: IntegrationInstructionCardProps) {
|
|
103
|
+
const [copied, setCopied] = useState(false);
|
|
104
|
+
|
|
105
|
+
const handleCopy = async () => {
|
|
106
|
+
try {
|
|
107
|
+
await navigator.clipboard.writeText(codeBlock);
|
|
108
|
+
setCopied(true);
|
|
109
|
+
onCopy?.();
|
|
110
|
+
setTimeout(() => setCopied(false), 2000);
|
|
111
|
+
} catch {
|
|
112
|
+
// clipboard unavailable (non-HTTPS or permissions denied)
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
<Card className={cn("flex flex-col gap-3 p-4", className)}>
|
|
118
|
+
<div className="flex items-center justify-between gap-2">
|
|
119
|
+
<h3 className="text-sm font-semibold">{title}</h3>
|
|
120
|
+
<Button
|
|
121
|
+
variant="outline"
|
|
122
|
+
size="sm"
|
|
123
|
+
className="h-7 gap-1.5 text-xs"
|
|
124
|
+
onClick={handleCopy}
|
|
125
|
+
>
|
|
126
|
+
{copied ? (
|
|
127
|
+
<>
|
|
128
|
+
<Check className="h-3 w-3" />
|
|
129
|
+
Copied
|
|
130
|
+
</>
|
|
131
|
+
) : (
|
|
132
|
+
<>
|
|
133
|
+
<Copy className="h-3 w-3" />
|
|
134
|
+
Copy
|
|
135
|
+
</>
|
|
136
|
+
)}
|
|
137
|
+
</Button>
|
|
138
|
+
</div>
|
|
139
|
+
<pre className="bg-muted overflow-x-auto p-3 text-xs leading-relaxed">
|
|
140
|
+
<code>{codeBlock}</code>
|
|
141
|
+
</pre>
|
|
142
|
+
</Card>
|
|
143
|
+
);
|
|
144
|
+
}
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Check, CheckCircle2, Clock, Mail, Shield, User } from "lucide-react";
|
|
3
|
+
import { Button } from "@/components/ui/button";
|
|
4
|
+
import { Card, CardContent } from "@/components/ui/card";
|
|
5
|
+
import { Checkbox } from "@/components/ui/checkbox";
|
|
6
|
+
import {
|
|
7
|
+
Dialog,
|
|
8
|
+
DialogContent,
|
|
9
|
+
DialogDescription,
|
|
10
|
+
DialogFooter,
|
|
11
|
+
DialogHeader,
|
|
12
|
+
DialogTitle,
|
|
13
|
+
} from "@/components/ui/dialog";
|
|
14
|
+
import { Switch } from "@/components/ui/switch";
|
|
15
|
+
import type { AiBuilderServiceData } from "./types";
|
|
16
|
+
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// ServiceConfigurationModal
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
export type ServiceConfigurationModalProps = {
|
|
22
|
+
open: boolean;
|
|
23
|
+
onOpenChange: (open: boolean) => void;
|
|
24
|
+
serviceTitle: string;
|
|
25
|
+
isConnected: boolean;
|
|
26
|
+
serviceData?: AiBuilderServiceData;
|
|
27
|
+
/** Brand icon node shown in the not-connected centered layout */
|
|
28
|
+
iconNode?: React.ReactNode;
|
|
29
|
+
/** Permissions shown in the not-connected state */
|
|
30
|
+
connectPermissions?: string[];
|
|
31
|
+
/** Subtitle shown below the service name in the not-connected state */
|
|
32
|
+
connectDescription?: string;
|
|
33
|
+
onConnect: () => void;
|
|
34
|
+
onDisconnect: () => void;
|
|
35
|
+
onReconnect: () => void;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export function ServiceConfigurationModal({
|
|
39
|
+
open,
|
|
40
|
+
onOpenChange,
|
|
41
|
+
serviceTitle,
|
|
42
|
+
isConnected,
|
|
43
|
+
serviceData,
|
|
44
|
+
iconNode,
|
|
45
|
+
connectPermissions,
|
|
46
|
+
connectDescription = "Link your account to enable automated workflows with WealthX.",
|
|
47
|
+
onConnect,
|
|
48
|
+
onDisconnect,
|
|
49
|
+
onReconnect,
|
|
50
|
+
}: ServiceConfigurationModalProps) {
|
|
51
|
+
return (
|
|
52
|
+
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
53
|
+
<DialogContent className="max-w-md">
|
|
54
|
+
{isConnected ? (
|
|
55
|
+
<>
|
|
56
|
+
<DialogHeader>
|
|
57
|
+
<DialogTitle>{serviceTitle}</DialogTitle>
|
|
58
|
+
<DialogDescription>
|
|
59
|
+
Manage your integration settings.
|
|
60
|
+
</DialogDescription>
|
|
61
|
+
</DialogHeader>
|
|
62
|
+
|
|
63
|
+
<div className="flex flex-col gap-4 py-2">
|
|
64
|
+
<div className="flex items-center gap-2 px-3 py-2 text-xs font-medium bg-success/10 text-success">
|
|
65
|
+
<CheckCircle2 className="h-3.5 w-3.5 shrink-0" />
|
|
66
|
+
Active — integration is running
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
{serviceData && (
|
|
70
|
+
<>
|
|
71
|
+
<div className="flex flex-col gap-2">
|
|
72
|
+
<p className="text-overline text-muted-foreground">
|
|
73
|
+
Account Information
|
|
74
|
+
</p>
|
|
75
|
+
<Card className="py-0">
|
|
76
|
+
<CardContent className="flex flex-col gap-3 p-3">
|
|
77
|
+
<div className="flex items-center gap-2 text-sm">
|
|
78
|
+
<User className="text-muted-foreground h-4 w-4 shrink-0" />
|
|
79
|
+
<span className="text-muted-foreground">
|
|
80
|
+
{serviceData.accountIdentifierLabel}:
|
|
81
|
+
</span>
|
|
82
|
+
<span className="font-medium">
|
|
83
|
+
{serviceData.accountIdentifier}
|
|
84
|
+
</span>
|
|
85
|
+
</div>
|
|
86
|
+
<div className="flex items-center gap-2 text-sm">
|
|
87
|
+
<Clock className="text-muted-foreground h-4 w-4 shrink-0" />
|
|
88
|
+
<span className="text-muted-foreground">
|
|
89
|
+
Connected on:
|
|
90
|
+
</span>
|
|
91
|
+
<span className="font-medium">
|
|
92
|
+
{serviceData.connectedOn}
|
|
93
|
+
</span>
|
|
94
|
+
</div>
|
|
95
|
+
<div className="flex items-center gap-2 text-sm">
|
|
96
|
+
<Clock className="text-muted-foreground h-4 w-4 shrink-0" />
|
|
97
|
+
<span className="text-muted-foreground">
|
|
98
|
+
Last synced:
|
|
99
|
+
</span>
|
|
100
|
+
<span className="font-medium">
|
|
101
|
+
{serviceData.lastSynced}
|
|
102
|
+
</span>
|
|
103
|
+
</div>
|
|
104
|
+
</CardContent>
|
|
105
|
+
</Card>
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
<div className="flex flex-col gap-2">
|
|
109
|
+
<p className="text-overline text-muted-foreground">
|
|
110
|
+
Granted Permissions
|
|
111
|
+
</p>
|
|
112
|
+
<Card className="py-0">
|
|
113
|
+
<CardContent className="flex flex-col gap-2 p-3">
|
|
114
|
+
{serviceData.permissions.map((permission) => (
|
|
115
|
+
<div
|
|
116
|
+
key={permission}
|
|
117
|
+
className="flex items-center gap-2 text-sm"
|
|
118
|
+
>
|
|
119
|
+
<Shield className="text-success h-4 w-4 shrink-0" />
|
|
120
|
+
<span>{permission}</span>
|
|
121
|
+
</div>
|
|
122
|
+
))}
|
|
123
|
+
</CardContent>
|
|
124
|
+
</Card>
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
<div className="flex flex-col gap-2">
|
|
128
|
+
<p className="text-overline text-muted-foreground">
|
|
129
|
+
Sync Settings
|
|
130
|
+
</p>
|
|
131
|
+
<Card className="py-0">
|
|
132
|
+
<CardContent className="flex items-center justify-between gap-3 p-3">
|
|
133
|
+
<div className="flex flex-col gap-0.5">
|
|
134
|
+
<p className="text-sm font-medium">
|
|
135
|
+
{serviceData.syncLabel}
|
|
136
|
+
</p>
|
|
137
|
+
<p className="text-muted-foreground text-sm">
|
|
138
|
+
{serviceData.syncDescription}
|
|
139
|
+
</p>
|
|
140
|
+
</div>
|
|
141
|
+
<Switch
|
|
142
|
+
checked={serviceData.syncEnabled}
|
|
143
|
+
onCheckedChange={serviceData.onSyncToggle}
|
|
144
|
+
aria-label={serviceData.syncLabel}
|
|
145
|
+
/>
|
|
146
|
+
</CardContent>
|
|
147
|
+
</Card>
|
|
148
|
+
</div>
|
|
149
|
+
|
|
150
|
+
{serviceData.emailCategories && (
|
|
151
|
+
<div className="flex flex-col gap-2">
|
|
152
|
+
<div>
|
|
153
|
+
<p className="text-overline text-muted-foreground">
|
|
154
|
+
Email Filters
|
|
155
|
+
</p>
|
|
156
|
+
<p className="text-muted-foreground text-sm mt-0.5">
|
|
157
|
+
Choose which inbox categories to sync into WealthX.
|
|
158
|
+
</p>
|
|
159
|
+
</div>
|
|
160
|
+
<Card className="py-0">
|
|
161
|
+
<CardContent className="flex flex-col gap-3 p-3">
|
|
162
|
+
{serviceData.emailCategories.available.map(
|
|
163
|
+
(category) => {
|
|
164
|
+
const checked =
|
|
165
|
+
serviceData.emailCategories!.selected.includes(
|
|
166
|
+
category,
|
|
167
|
+
);
|
|
168
|
+
return (
|
|
169
|
+
<div
|
|
170
|
+
key={category}
|
|
171
|
+
className="flex items-center gap-2"
|
|
172
|
+
>
|
|
173
|
+
<Checkbox
|
|
174
|
+
id={`email-cat-${category}`}
|
|
175
|
+
checked={checked}
|
|
176
|
+
onCheckedChange={(v) => {
|
|
177
|
+
const next = v
|
|
178
|
+
? [
|
|
179
|
+
...serviceData.emailCategories!
|
|
180
|
+
.selected,
|
|
181
|
+
category,
|
|
182
|
+
]
|
|
183
|
+
: serviceData.emailCategories!.selected.filter(
|
|
184
|
+
(c) => c !== category,
|
|
185
|
+
);
|
|
186
|
+
serviceData.emailCategories!.onChange(
|
|
187
|
+
next,
|
|
188
|
+
);
|
|
189
|
+
}}
|
|
190
|
+
/>
|
|
191
|
+
<label
|
|
192
|
+
htmlFor={`email-cat-${category}`}
|
|
193
|
+
className="text-sm cursor-pointer select-none"
|
|
194
|
+
>
|
|
195
|
+
{category}
|
|
196
|
+
</label>
|
|
197
|
+
</div>
|
|
198
|
+
);
|
|
199
|
+
},
|
|
200
|
+
)}
|
|
201
|
+
</CardContent>
|
|
202
|
+
</Card>
|
|
203
|
+
</div>
|
|
204
|
+
)}
|
|
205
|
+
</>
|
|
206
|
+
)}
|
|
207
|
+
</div>
|
|
208
|
+
|
|
209
|
+
<DialogFooter>
|
|
210
|
+
<Button
|
|
211
|
+
variant="destructive"
|
|
212
|
+
size="sm"
|
|
213
|
+
onClick={onDisconnect}
|
|
214
|
+
className="mr-auto"
|
|
215
|
+
>
|
|
216
|
+
Disconnect
|
|
217
|
+
</Button>
|
|
218
|
+
<Button
|
|
219
|
+
variant="outline-secondary"
|
|
220
|
+
size="sm"
|
|
221
|
+
onClick={() => onOpenChange(false)}
|
|
222
|
+
>
|
|
223
|
+
Cancel
|
|
224
|
+
</Button>
|
|
225
|
+
<Button size="sm" onClick={onReconnect}>
|
|
226
|
+
Reconnect
|
|
227
|
+
</Button>
|
|
228
|
+
</DialogFooter>
|
|
229
|
+
</>
|
|
230
|
+
) : (
|
|
231
|
+
<>
|
|
232
|
+
<div className="flex flex-col gap-4 py-2">
|
|
233
|
+
<div className="flex items-center gap-3">
|
|
234
|
+
<div className="flex h-10 w-10 shrink-0 items-center justify-center bg-muted">
|
|
235
|
+
{iconNode ?? (
|
|
236
|
+
<Mail className="h-5 w-5 text-muted-foreground" />
|
|
237
|
+
)}
|
|
238
|
+
</div>
|
|
239
|
+
<div className="flex flex-col gap-0.5">
|
|
240
|
+
<p className="text-sm font-semibold">
|
|
241
|
+
Connect {serviceTitle}
|
|
242
|
+
</p>
|
|
243
|
+
<p className="text-muted-foreground text-xs">
|
|
244
|
+
{connectDescription}
|
|
245
|
+
</p>
|
|
246
|
+
</div>
|
|
247
|
+
</div>
|
|
248
|
+
|
|
249
|
+
{connectPermissions && connectPermissions.length > 0 && (
|
|
250
|
+
<div className="flex flex-col gap-2 border border-border px-4 py-3">
|
|
251
|
+
<p className="text-overline text-muted-foreground">
|
|
252
|
+
Permissions requested
|
|
253
|
+
</p>
|
|
254
|
+
{connectPermissions.map((perm) => (
|
|
255
|
+
<div key={perm} className="flex items-center gap-2">
|
|
256
|
+
<Check className="h-3.5 w-3.5 shrink-0 text-success" />
|
|
257
|
+
<span className="text-sm text-muted-foreground">
|
|
258
|
+
{perm}
|
|
259
|
+
</span>
|
|
260
|
+
</div>
|
|
261
|
+
))}
|
|
262
|
+
</div>
|
|
263
|
+
)}
|
|
264
|
+
</div>
|
|
265
|
+
|
|
266
|
+
<DialogFooter>
|
|
267
|
+
<Button
|
|
268
|
+
variant="outline-secondary"
|
|
269
|
+
size="sm"
|
|
270
|
+
onClick={() => onOpenChange(false)}
|
|
271
|
+
>
|
|
272
|
+
Cancel
|
|
273
|
+
</Button>
|
|
274
|
+
<Button size="sm" onClick={onConnect}>
|
|
275
|
+
Connect
|
|
276
|
+
</Button>
|
|
277
|
+
</DialogFooter>
|
|
278
|
+
</>
|
|
279
|
+
)}
|
|
280
|
+
</DialogContent>
|
|
281
|
+
</Dialog>
|
|
282
|
+
);
|
|
283
|
+
}
|