@schandlergarcia/sf-web-components 2.3.12 → 2.3.14
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/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.3.14] - 2026-04-14
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **demo:engine now installs complete working state** — Synced all working project files (appLayout, routes, CommandCenter, AgentPanel, hooks, api, config, styles) into the brands/engine/app/ backup so `--demo engine` installs the full working Partner Hub with correct nav bar, Engine theme, and AgentPanel chat.
|
|
12
|
+
- **apply-brand.mjs --demo now copies styles and all top-level components** — The `--demo` command previously excluded the styles directory and only copied AgentforceConversationClient. Now it copies `app/styles/` (including Engine theme global.css), all top-level component files (AgentPanel, Data360Widget, etc.), and writes a `.brand` marker for theme-aware resets.
|
|
13
|
+
- **Fixed broken appLayout.tsx in backup** — Removed placeholder `AgentforceConversationClient` with invalid agent ID from the Engine brand backup. Restored working nav bar with dynamic route-driven navigation.
|
|
14
|
+
|
|
15
|
+
## [2.3.13] - 2026-04-14
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- **Rewrote AgentPanel demo script to Partner Upsell story** — Replaced the penalties placeholder conversation with the full 3-prompt demo flow: (1) User asks about a canceled block booking at Summit Austin Convention Center, Eva surfaces cancellation details (TechCorp, 40 rooms, $24k lost revenue); (2) User asks what can be done, Eva pivots to SDR mode and presents a rich Engine Network Promotion offer card with $159/night rate, 8% commission, projected 70% fill / $12,287 net; (3) User accepts, Eva launches the promo and confirms with a PROMO-SUM-0519 confirmation. Increased typing delay cap to 5.5s for longer card-style messages.
|
|
19
|
+
|
|
8
20
|
## [2.3.12] - 2026-04-13
|
|
9
21
|
|
|
10
22
|
### Changed
|
|
@@ -1,13 +1,90 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Outlet, Link, useLocation } from "react-router";
|
|
1
|
+
import { Outlet, Link, useLocation, useMatches } from "react-router";
|
|
3
2
|
import { getAllRoutes } from "./router-utils";
|
|
4
3
|
import { useState } from "react";
|
|
5
4
|
|
|
6
5
|
export default function AppLayout() {
|
|
6
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
7
|
+
const location = useLocation();
|
|
8
|
+
const matches = useMatches();
|
|
9
|
+
|
|
10
|
+
const showNavBar = matches.some(
|
|
11
|
+
(m) => (m.handle as Record<string, unknown>)?.showNavBar === true,
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
const isActive = (path: string) => location.pathname === path;
|
|
15
|
+
|
|
16
|
+
const toggleMenu = () => setIsOpen(!isOpen);
|
|
17
|
+
|
|
18
|
+
const navigationRoutes: { path: string; label: string }[] = getAllRoutes()
|
|
19
|
+
.filter(
|
|
20
|
+
(route) =>
|
|
21
|
+
route.handle?.showInNavigation === true &&
|
|
22
|
+
route.fullPath !== undefined &&
|
|
23
|
+
route.handle?.label !== undefined,
|
|
24
|
+
)
|
|
25
|
+
.map(
|
|
26
|
+
(route) =>
|
|
27
|
+
({
|
|
28
|
+
path: route.fullPath,
|
|
29
|
+
label: route.handle?.label,
|
|
30
|
+
}) as { path: string; label: string },
|
|
31
|
+
);
|
|
32
|
+
|
|
7
33
|
return (
|
|
8
34
|
<>
|
|
35
|
+
{showNavBar && (
|
|
36
|
+
<nav className="bg-white border-b border-gray-200">
|
|
37
|
+
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
|
38
|
+
<div className="flex justify-between items-center h-16">
|
|
39
|
+
<Link to="/" className="text-xl font-semibold text-gray-900">
|
|
40
|
+
Partner Hub
|
|
41
|
+
</Link>
|
|
42
|
+
<button
|
|
43
|
+
onClick={toggleMenu}
|
|
44
|
+
className="p-2 rounded-md text-gray-700 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
45
|
+
aria-label="Toggle menu"
|
|
46
|
+
>
|
|
47
|
+
<div className="w-6 h-6 flex flex-col justify-center space-y-1.5">
|
|
48
|
+
<span
|
|
49
|
+
className={`block h-0.5 w-6 bg-current transition-all ${
|
|
50
|
+
isOpen ? "rotate-45 translate-y-2" : ""
|
|
51
|
+
}`}
|
|
52
|
+
/>
|
|
53
|
+
<span
|
|
54
|
+
className={`block h-0.5 w-6 bg-current transition-all ${isOpen ? "opacity-0" : ""}`}
|
|
55
|
+
/>
|
|
56
|
+
<span
|
|
57
|
+
className={`block h-0.5 w-6 bg-current transition-all ${
|
|
58
|
+
isOpen ? "-rotate-45 -translate-y-2" : ""
|
|
59
|
+
}`}
|
|
60
|
+
/>
|
|
61
|
+
</div>
|
|
62
|
+
</button>
|
|
63
|
+
</div>
|
|
64
|
+
{isOpen && (
|
|
65
|
+
<div className="pb-4">
|
|
66
|
+
<div className="flex flex-col space-y-2">
|
|
67
|
+
{navigationRoutes.map((item) => (
|
|
68
|
+
<Link
|
|
69
|
+
key={item.path}
|
|
70
|
+
to={item.path}
|
|
71
|
+
onClick={() => setIsOpen(false)}
|
|
72
|
+
className={`px-3 py-2 rounded-md text-sm font-medium transition-colors ${
|
|
73
|
+
isActive(item.path)
|
|
74
|
+
? "bg-blue-100 text-blue-700"
|
|
75
|
+
: "text-gray-700 hover:bg-gray-100"
|
|
76
|
+
}`}
|
|
77
|
+
>
|
|
78
|
+
{item.label}
|
|
79
|
+
</Link>
|
|
80
|
+
))}
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
)}
|
|
84
|
+
</div>
|
|
85
|
+
</nav>
|
|
86
|
+
)}
|
|
9
87
|
<Outlet />
|
|
10
|
-
<AgentforceConversationClient agentId="<USER_AGENT_ID_18_CHAR_0Xx...>" />
|
|
11
88
|
</>
|
|
12
89
|
);
|
|
13
90
|
}
|
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import React, { useState, useRef, useEffect, useCallback } from "react";
|
|
2
|
+
import { createPortal } from "react-dom";
|
|
3
|
+
import { SparklesIcon } from "@heroicons/react/24/solid";
|
|
4
|
+
import {
|
|
5
|
+
PaperAirplaneIcon,
|
|
6
|
+
ChevronDownIcon,
|
|
7
|
+
} from "@heroicons/react/24/outline";
|
|
8
|
+
|
|
9
|
+
interface Message {
|
|
10
|
+
id: string;
|
|
11
|
+
role: "user" | "agent";
|
|
12
|
+
text: string;
|
|
13
|
+
timestamp: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface ScriptStep {
|
|
17
|
+
role: "user" | "agent";
|
|
18
|
+
text: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const SCRIPT: ScriptStep[] = [
|
|
22
|
+
// --- Auto-play greeting ---
|
|
23
|
+
{
|
|
24
|
+
role: "agent",
|
|
25
|
+
text: "Hi Jamie! 👋 I'm Eva, your Engine partner assistant. How can I help you today?",
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
// --- Prompt 1: Ask about the canceled booking ---
|
|
29
|
+
{
|
|
30
|
+
role: "user",
|
|
31
|
+
text: "I just got an alert that a block booking was canceled at our Austin Convention Center for next week. What happened?",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
role: "agent",
|
|
35
|
+
text: "Let me pull up that reservation for you...",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
role: "agent",
|
|
39
|
+
text: "🔴 CANCELED BOOKING\n\n🏨 Summit Austin Convention Center\n🏢 Client: TechCorp Inc.\n\n📋 Details:\n• Original block: 40 rooms\n• Dates: May 19 – 21 (3 nights)\n• Room rate: $200/night\n• Lost revenue: $24,000\n\n📅 Canceled: Apr 11, 2026\n⚠️ Status: Within penalty window",
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
role: "agent",
|
|
43
|
+
text: "TechCorp canceled their 40-room block for May 19–21. The reason given was that their annual conference is moving to a virtual format this year. This was within the attrition penalty window, so a penalty may apply — but that still leaves 40 rooms open for next week.",
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
// --- Prompt 2: What can be done ---
|
|
47
|
+
{
|
|
48
|
+
role: "user",
|
|
49
|
+
text: "That's a lot of empty rooms. Is there anything we can do to fill them on short notice?",
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
role: "agent",
|
|
53
|
+
text: "Actually, yes — I have an idea. Let me put together an option for you.",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
role: "agent",
|
|
57
|
+
text: "⚡ ENGINE NETWORK PROMOTION\nFill your open rooms through Engine's network\n\n━━━━━━━━━━━━━━━━━━━━━━━━━\nSummit Austin Convention Center\n40 rooms · May 19–21 · 3 nights\n━━━━━━━━━━━━━━━━━━━━━━━━━\n\n💰 YOUR RATE\n$159/night (20% off rack rate)\n\n📡 ENGINE PROMOTES TO\n2,400+ corporate travel managers\n\n📉 COMMISSION\n12% standard → 8% promotional\nYou save $1,526 vs. standard bookings\n\n━━━━━━━━━━━━━━━━━━━━━━━━━\n📈 PROJECTED OUTCOME\n• Est. fill: 28 rooms (70%)\n• Revenue: $13,356\n• Net after commission: $12,287\n━━━━━━━━━━━━━━━━━━━━━━━━━",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
role: "agent",
|
|
61
|
+
text: "Here's the play: we run a targeted promotion across Engine's corporate travel network — 2,400+ travel managers get notified about discounted rates at Summit Austin for May 19–21.\n\nWe'd list the rooms at $159/night, and your commission drops from 12% to 8% for promo bookings. On a projected 70% fill, that's $12,287 net — versus $0 if the rooms sit empty.\n\nWant to launch it?",
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
// --- Prompt 3: Accept the offer ---
|
|
65
|
+
{
|
|
66
|
+
role: "user",
|
|
67
|
+
text: "That makes sense — empty rooms earn nothing. Let's launch it.",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
role: "agent",
|
|
71
|
+
text: "Launching your promotion now...",
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
role: "agent",
|
|
75
|
+
text: "✅ PROMOTION LIVE\n\n🆔 PROMO-SUM-0519\n🏨 Summit Austin Convention Center\n📅 May 19–21 (3 nights)\n💰 Rate: $159/night\n📉 Commission: 8% (promotional)\n📡 Distribution: Engine corporate travel network\n\nYour promotion is live and going out to 2,400+ travel managers now. I'll send you a fill-rate update in 48 hours.",
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
function typingDelay(text: string): number {
|
|
80
|
+
const base = 900;
|
|
81
|
+
const perChar = 10;
|
|
82
|
+
const jitter = Math.random() * 500;
|
|
83
|
+
return Math.min(base + text.length * perChar + jitter, 5500);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function now() {
|
|
87
|
+
return new Date().toLocaleTimeString([], { hour: "numeric", minute: "2-digit" });
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function TypingIndicator() {
|
|
91
|
+
return (
|
|
92
|
+
<div className="flex items-center gap-1 px-4 py-1.5">
|
|
93
|
+
<div className="flex items-end gap-3">
|
|
94
|
+
<div className="flex-shrink-0 h-7 w-7 rounded-full bg-[var(--color-dash-dark)] flex items-center justify-center">
|
|
95
|
+
<SparklesIcon className="h-3.5 w-3.5 text-white" />
|
|
96
|
+
</div>
|
|
97
|
+
<div className="bg-[var(--color-dash-surface)] dark:bg-[var(--color-dash-muted)]/20 rounded-2xl rounded-bl-md px-4 py-3">
|
|
98
|
+
<div className="flex items-center gap-1.5">
|
|
99
|
+
<span className="h-2 w-2 rounded-full bg-[var(--color-dash-label)] animate-bounce" style={{ animationDelay: "0ms" }} />
|
|
100
|
+
<span className="h-2 w-2 rounded-full bg-[var(--color-dash-label)] animate-bounce" style={{ animationDelay: "150ms" }} />
|
|
101
|
+
<span className="h-2 w-2 rounded-full bg-[var(--color-dash-label)] animate-bounce" style={{ animationDelay: "300ms" }} />
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function AgentMessage({ text, timestamp }: { text: string; timestamp: string }) {
|
|
110
|
+
return (
|
|
111
|
+
<div className="px-4 py-1.5">
|
|
112
|
+
<div className="flex items-end gap-3">
|
|
113
|
+
<div className="flex-shrink-0 h-7 w-7 rounded-full bg-[var(--color-dash-dark)] flex items-center justify-center">
|
|
114
|
+
<SparklesIcon className="h-3.5 w-3.5 text-white" />
|
|
115
|
+
</div>
|
|
116
|
+
<div className="max-w-[80%]">
|
|
117
|
+
<div className="bg-[var(--color-dash-surface)] dark:bg-[var(--color-dash-muted)]/20 rounded-2xl rounded-bl-md px-4 py-3 border border-[var(--color-dash-border)]/30 dark:border-[var(--color-dash-muted)]/30">
|
|
118
|
+
<p className="text-sm text-[var(--color-dash-text)] dark:text-white leading-relaxed whitespace-pre-wrap">
|
|
119
|
+
{text}
|
|
120
|
+
</p>
|
|
121
|
+
</div>
|
|
122
|
+
<p className="text-[10px] text-[var(--color-dash-label)] mt-1 ml-1">{timestamp}</p>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function UserMessage({ text, timestamp }: { text: string; timestamp: string }) {
|
|
130
|
+
return (
|
|
131
|
+
<div className="px-4 py-1.5">
|
|
132
|
+
<div className="flex items-end justify-end gap-3">
|
|
133
|
+
<div className="max-w-[80%]">
|
|
134
|
+
<div className="bg-[var(--color-dash-accent)] rounded-2xl rounded-br-md px-4 py-3">
|
|
135
|
+
<p className="text-sm text-white leading-relaxed">{text}</p>
|
|
136
|
+
</div>
|
|
137
|
+
<p className="text-[10px] text-[var(--color-dash-label)] mt-1 text-right mr-1">{timestamp}</p>
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export default function AgentPanel() {
|
|
145
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
146
|
+
const [messages, setMessages] = useState<Message[]>([]);
|
|
147
|
+
const [isTyping, setIsTyping] = useState(false);
|
|
148
|
+
const [inputValue, setInputValue] = useState("");
|
|
149
|
+
const [scriptIndex, setScriptIndex] = useState(0);
|
|
150
|
+
const [isAnimating, setIsAnimating] = useState(false);
|
|
151
|
+
const hasStartedRef = useRef(false);
|
|
152
|
+
const messagesEndRef = useRef<HTMLDivElement>(null);
|
|
153
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
154
|
+
|
|
155
|
+
useEffect(() => {
|
|
156
|
+
messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
|
|
157
|
+
}, [messages, isTyping]);
|
|
158
|
+
|
|
159
|
+
useEffect(() => {
|
|
160
|
+
if (isOpen) {
|
|
161
|
+
setTimeout(() => inputRef.current?.focus(), 300);
|
|
162
|
+
}
|
|
163
|
+
}, [isOpen]);
|
|
164
|
+
|
|
165
|
+
// Auto-play the first agent message when panel opens
|
|
166
|
+
useEffect(() => {
|
|
167
|
+
if (isOpen && !hasStartedRef.current && scriptIndex === 0) {
|
|
168
|
+
hasStartedRef.current = true;
|
|
169
|
+
playNextStep();
|
|
170
|
+
}
|
|
171
|
+
}, [isOpen]);
|
|
172
|
+
|
|
173
|
+
const playNextStep = useCallback(async () => {
|
|
174
|
+
if (scriptIndex >= SCRIPT.length || isAnimating) return;
|
|
175
|
+
|
|
176
|
+
const step = SCRIPT[scriptIndex];
|
|
177
|
+
setIsAnimating(true);
|
|
178
|
+
|
|
179
|
+
if (step.role === "agent") {
|
|
180
|
+
setIsTyping(true);
|
|
181
|
+
await delay(typingDelay(step.text));
|
|
182
|
+
setIsTyping(false);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const msg: Message = {
|
|
186
|
+
id: `msg-${Date.now()}`,
|
|
187
|
+
role: step.role,
|
|
188
|
+
text: step.text,
|
|
189
|
+
timestamp: now(),
|
|
190
|
+
};
|
|
191
|
+
setMessages((prev) => [...prev, msg]);
|
|
192
|
+
setScriptIndex((prev) => prev + 1);
|
|
193
|
+
setIsAnimating(false);
|
|
194
|
+
|
|
195
|
+
// If we just played a user message, auto-play all following agent messages
|
|
196
|
+
const nextIndex = scriptIndex + 1;
|
|
197
|
+
if (step.role === "user" && nextIndex < SCRIPT.length && SCRIPT[nextIndex].role === "agent") {
|
|
198
|
+
await delay(400);
|
|
199
|
+
await playAgentChain(nextIndex);
|
|
200
|
+
}
|
|
201
|
+
}, [scriptIndex, isAnimating]);
|
|
202
|
+
|
|
203
|
+
async function playAgentChain(startIndex: number) {
|
|
204
|
+
let idx = startIndex;
|
|
205
|
+
setIsAnimating(true);
|
|
206
|
+
while (idx < SCRIPT.length && SCRIPT[idx].role === "agent") {
|
|
207
|
+
const step = SCRIPT[idx];
|
|
208
|
+
setIsTyping(true);
|
|
209
|
+
await delay(typingDelay(step.text));
|
|
210
|
+
setIsTyping(false);
|
|
211
|
+
|
|
212
|
+
const msg: Message = {
|
|
213
|
+
id: `msg-${Date.now()}-${idx}`,
|
|
214
|
+
role: "agent",
|
|
215
|
+
text: step.text,
|
|
216
|
+
timestamp: now(),
|
|
217
|
+
};
|
|
218
|
+
setMessages((prev) => [...prev, msg]);
|
|
219
|
+
setScriptIndex(idx + 1);
|
|
220
|
+
idx++;
|
|
221
|
+
if (idx < SCRIPT.length && SCRIPT[idx].role === "agent") {
|
|
222
|
+
await delay(500);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
setIsAnimating(false);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// Right arrow key stages the next user message into the input
|
|
229
|
+
useEffect(() => {
|
|
230
|
+
function onKey(e: KeyboardEvent) {
|
|
231
|
+
if (e.key === "ArrowRight" && isOpen && !isAnimating && scriptIndex < SCRIPT.length) {
|
|
232
|
+
e.preventDefault();
|
|
233
|
+
const next = SCRIPT[scriptIndex];
|
|
234
|
+
if (next.role === "user") {
|
|
235
|
+
setInputValue(next.text);
|
|
236
|
+
inputRef.current?.focus();
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
document.addEventListener("keydown", onKey);
|
|
241
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
242
|
+
}, [isOpen, scriptIndex, isAnimating]);
|
|
243
|
+
|
|
244
|
+
function handleSend() {
|
|
245
|
+
const text = inputValue.trim();
|
|
246
|
+
if (!text) return;
|
|
247
|
+
setInputValue("");
|
|
248
|
+
|
|
249
|
+
// Check if this matches the next scripted user message
|
|
250
|
+
if (scriptIndex < SCRIPT.length && SCRIPT[scriptIndex].role === "user" && text === SCRIPT[scriptIndex].text) {
|
|
251
|
+
playNextStep();
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const userMsg: Message = {
|
|
256
|
+
id: `u-${Date.now()}`,
|
|
257
|
+
role: "user",
|
|
258
|
+
text,
|
|
259
|
+
timestamp: now(),
|
|
260
|
+
};
|
|
261
|
+
setMessages((prev) => [...prev, userMsg]);
|
|
262
|
+
|
|
263
|
+
setIsTyping(true);
|
|
264
|
+
setTimeout(() => {
|
|
265
|
+
setIsTyping(false);
|
|
266
|
+
const agentMsg: Message = {
|
|
267
|
+
id: `a-${Date.now()}`,
|
|
268
|
+
role: "agent",
|
|
269
|
+
text: "I'm looking into that for you — one moment please.",
|
|
270
|
+
timestamp: now(),
|
|
271
|
+
};
|
|
272
|
+
setMessages((prev) => [...prev, agentMsg]);
|
|
273
|
+
}, 1500);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
const scriptDone = scriptIndex >= SCRIPT.length;
|
|
277
|
+
|
|
278
|
+
const panel = isOpen
|
|
279
|
+
? createPortal(
|
|
280
|
+
<>
|
|
281
|
+
<div
|
|
282
|
+
className="fixed inset-0 z-[9998] bg-black/20 backdrop-blur-sm lg:hidden"
|
|
283
|
+
onClick={() => setIsOpen(false)}
|
|
284
|
+
/>
|
|
285
|
+
<div
|
|
286
|
+
className="fixed z-[9999] bottom-6 right-6 w-[380px] h-[520px] flex flex-col rounded-2xl shadow-2xl border border-[var(--color-dash-label)]/20 dark:border-[var(--color-dash-muted)]/30 overflow-hidden"
|
|
287
|
+
style={{
|
|
288
|
+
animation: "agent-panel-in 0.25s cubic-bezier(0.16, 1, 0.3, 1)",
|
|
289
|
+
}}
|
|
290
|
+
>
|
|
291
|
+
{/* Header */}
|
|
292
|
+
<div className="bg-[var(--color-dash-dark)] px-5 py-4 flex items-center justify-between flex-shrink-0">
|
|
293
|
+
<div className="flex items-center gap-3">
|
|
294
|
+
<div className="h-8 w-8 rounded-full bg-white/10 flex items-center justify-center">
|
|
295
|
+
<SparklesIcon className="h-4 w-4 text-white" />
|
|
296
|
+
</div>
|
|
297
|
+
<div>
|
|
298
|
+
<h3 className="text-sm font-semibold text-white">
|
|
299
|
+
Engine Virtual Agent
|
|
300
|
+
</h3>
|
|
301
|
+
<p className="text-xs text-white/60">Eva · Online</p>
|
|
302
|
+
</div>
|
|
303
|
+
</div>
|
|
304
|
+
<button
|
|
305
|
+
onClick={() => setIsOpen(false)}
|
|
306
|
+
className="rounded-lg p-1.5 text-white/60 hover:text-white hover:bg-white/10 transition-colors"
|
|
307
|
+
>
|
|
308
|
+
<ChevronDownIcon className="h-5 w-5" />
|
|
309
|
+
</button>
|
|
310
|
+
</div>
|
|
311
|
+
|
|
312
|
+
{/* Messages */}
|
|
313
|
+
<div className="flex-1 overflow-y-auto bg-white dark:bg-[var(--color-dash-text)] py-4">
|
|
314
|
+
{messages.length === 0 && !isTyping && (
|
|
315
|
+
<div className="flex flex-col items-center justify-center h-full gap-3 px-6 text-center">
|
|
316
|
+
<div className="h-12 w-12 rounded-full bg-[var(--color-dash-accent)]/10 flex items-center justify-center">
|
|
317
|
+
<SparklesIcon className="h-6 w-6 text-[var(--color-dash-accent)]" />
|
|
318
|
+
</div>
|
|
319
|
+
<p className="text-sm text-[var(--color-dash-muted)] dark:text-[var(--color-dash-label)]">
|
|
320
|
+
Eva is connecting...
|
|
321
|
+
</p>
|
|
322
|
+
</div>
|
|
323
|
+
)}
|
|
324
|
+
{messages.map((msg) =>
|
|
325
|
+
msg.role === "agent" ? (
|
|
326
|
+
<AgentMessage key={msg.id} text={msg.text} timestamp={msg.timestamp} />
|
|
327
|
+
) : (
|
|
328
|
+
<UserMessage key={msg.id} text={msg.text} timestamp={msg.timestamp} />
|
|
329
|
+
)
|
|
330
|
+
)}
|
|
331
|
+
{isTyping && <TypingIndicator />}
|
|
332
|
+
<div ref={messagesEndRef} />
|
|
333
|
+
</div>
|
|
334
|
+
|
|
335
|
+
{/* Input */}
|
|
336
|
+
<div className="flex-shrink-0 bg-white dark:bg-[var(--color-dash-text)] border-t border-[var(--color-dash-label)]/20 dark:border-[var(--color-dash-muted)]/30 px-4 py-3">
|
|
337
|
+
<form
|
|
338
|
+
onSubmit={(e) => {
|
|
339
|
+
e.preventDefault();
|
|
340
|
+
handleSend();
|
|
341
|
+
}}
|
|
342
|
+
className="flex items-center gap-2"
|
|
343
|
+
>
|
|
344
|
+
<input
|
|
345
|
+
ref={inputRef}
|
|
346
|
+
type="text"
|
|
347
|
+
value={inputValue}
|
|
348
|
+
onChange={(e) => setInputValue(e.target.value)}
|
|
349
|
+
placeholder="Type your message..."
|
|
350
|
+
className="flex-1 bg-[var(--color-dash-surface)] dark:bg-[var(--color-dash-muted)]/10 border border-[var(--color-dash-label)]/20 dark:border-[var(--color-dash-muted)]/30 rounded-xl px-4 py-2.5 text-sm text-[var(--color-dash-text)] dark:text-white placeholder:text-[var(--color-dash-label)] focus:outline-none focus:ring-2 focus:ring-[var(--color-dash-accent)]/30 focus:border-[var(--color-dash-accent)] transition-all"
|
|
351
|
+
/>
|
|
352
|
+
<button
|
|
353
|
+
type="submit"
|
|
354
|
+
disabled={!inputValue.trim()}
|
|
355
|
+
className="flex-shrink-0 h-10 w-10 rounded-xl bg-[var(--color-dash-accent)] hover:brightness-110 disabled:opacity-40 disabled:cursor-not-allowed flex items-center justify-center transition-all"
|
|
356
|
+
>
|
|
357
|
+
<PaperAirplaneIcon className="h-4 w-4 text-white" />
|
|
358
|
+
</button>
|
|
359
|
+
</form>
|
|
360
|
+
<p className="text-[10px] text-[var(--color-dash-label)] text-center mt-2">
|
|
361
|
+
Powered by Agentforce
|
|
362
|
+
</p>
|
|
363
|
+
</div>
|
|
364
|
+
</div>
|
|
365
|
+
</>,
|
|
366
|
+
document.body
|
|
367
|
+
)
|
|
368
|
+
: null;
|
|
369
|
+
|
|
370
|
+
return (
|
|
371
|
+
<>
|
|
372
|
+
{panel}
|
|
373
|
+
|
|
374
|
+
{!isOpen && (
|
|
375
|
+
<button
|
|
376
|
+
onClick={() => setIsOpen(true)}
|
|
377
|
+
className="fixed z-[9999] bottom-6 right-6 h-14 w-14 rounded-full bg-[var(--color-dash-dark)] hover:scale-110 shadow-xl hover:shadow-2xl flex items-center justify-center transition-all duration-200"
|
|
378
|
+
style={{
|
|
379
|
+
animation: "agent-bubble-in 0.3s cubic-bezier(0.16, 1, 0.3, 1)",
|
|
380
|
+
}}
|
|
381
|
+
>
|
|
382
|
+
<SparklesIcon className="h-6 w-6 text-white" />
|
|
383
|
+
</button>
|
|
384
|
+
)}
|
|
385
|
+
|
|
386
|
+
<style>{`
|
|
387
|
+
@keyframes agent-panel-in {
|
|
388
|
+
from { opacity: 0; transform: translateY(20px) scale(0.95); }
|
|
389
|
+
to { opacity: 1; transform: translateY(0) scale(1); }
|
|
390
|
+
}
|
|
391
|
+
@keyframes agent-bubble-in {
|
|
392
|
+
from { opacity: 0; transform: scale(0.5); }
|
|
393
|
+
to { opacity: 1; transform: scale(1); }
|
|
394
|
+
}
|
|
395
|
+
`}</style>
|
|
396
|
+
</>
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
function delay(ms: number) {
|
|
401
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
402
|
+
}
|
|
@@ -10,42 +10,6 @@
|
|
|
10
10
|
body {
|
|
11
11
|
@apply antialiased bg-white;
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
/* Smooth scrolling */
|
|
15
|
-
html {
|
|
16
|
-
scroll-behavior: smooth;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/* Custom animations */
|
|
20
|
-
@keyframes fade-in {
|
|
21
|
-
from {
|
|
22
|
-
opacity: 0;
|
|
23
|
-
transform: translateY(10px);
|
|
24
|
-
}
|
|
25
|
-
to {
|
|
26
|
-
opacity: 1;
|
|
27
|
-
transform: translateY(0);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
@keyframes slide-up {
|
|
32
|
-
from {
|
|
33
|
-
opacity: 0;
|
|
34
|
-
transform: translateY(20px);
|
|
35
|
-
}
|
|
36
|
-
to {
|
|
37
|
-
opacity: 1;
|
|
38
|
-
transform: translateY(0);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.animate-fade-in {
|
|
43
|
-
animation: fade-in 0.6s ease-out;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.animate-slide-up {
|
|
47
|
-
animation: slide-up 0.5s ease-out;
|
|
48
|
-
}
|
|
49
13
|
}
|
|
50
14
|
|
|
51
15
|
@import 'tw-animate-css';
|
|
@@ -128,6 +92,41 @@
|
|
|
128
92
|
}
|
|
129
93
|
|
|
130
94
|
:root {
|
|
95
|
+
--dash-text: #0D1117;
|
|
96
|
+
--dash-muted: #3d4047;
|
|
97
|
+
--dash-label: #8b8d91;
|
|
98
|
+
--dash-surface: #fef9ef;
|
|
99
|
+
--dash-border: #e2c97a;
|
|
100
|
+
--dash-accent: #FFB200;
|
|
101
|
+
--dash-success: #34d399;
|
|
102
|
+
--dash-info: #67e8f9;
|
|
103
|
+
--dash-warning: #FD4B23;
|
|
104
|
+
--dash-danger: #dc2626;
|
|
105
|
+
--dash-dark: #0D1117;
|
|
106
|
+
--dash-darker: #06090d;
|
|
107
|
+
--dash-chart-1: #FFB200;
|
|
108
|
+
--dash-chart-2: #1E9D6D;
|
|
109
|
+
--dash-chart-3: #7DCBD9;
|
|
110
|
+
--dash-chart-4: #FD4B23;
|
|
111
|
+
--dash-metric-size: 3.25rem;
|
|
112
|
+
--dash-metric-sub: 2.25rem;
|
|
113
|
+
--color-dash-text: var(--dash-text);
|
|
114
|
+
--color-dash-muted: var(--dash-muted);
|
|
115
|
+
--color-dash-label: var(--dash-label);
|
|
116
|
+
--color-dash-surface: var(--dash-surface);
|
|
117
|
+
--color-dash-border: var(--dash-border);
|
|
118
|
+
--color-dash-accent: var(--dash-accent);
|
|
119
|
+
--color-dash-success: var(--dash-success);
|
|
120
|
+
--color-dash-info: var(--dash-info);
|
|
121
|
+
--color-dash-warning: var(--dash-warning);
|
|
122
|
+
--color-dash-danger: var(--dash-danger);
|
|
123
|
+
--color-dash-dark: var(--dash-dark);
|
|
124
|
+
--color-dash-darker: var(--dash-darker);
|
|
125
|
+
--color-dash-chart-1: var(--dash-chart-1);
|
|
126
|
+
--color-dash-chart-2: var(--dash-chart-2);
|
|
127
|
+
--color-dash-chart-3: var(--dash-chart-3);
|
|
128
|
+
--color-dash-chart-4: var(--dash-chart-4);
|
|
129
|
+
|
|
131
130
|
--radius: 0.625rem;
|
|
132
131
|
--background: oklch(1 0 0);
|
|
133
132
|
--foreground: oklch(0.145 0 0);
|
package/package.json
CHANGED
package/scripts/apply-brand.mjs
CHANGED
|
@@ -141,9 +141,8 @@ if (isDemo) {
|
|
|
141
141
|
console.log(`\n🚀 Installing "${brandName}" demo app...\n`);
|
|
142
142
|
let installed = 0;
|
|
143
143
|
|
|
144
|
-
// Copy the full app directory tree into src/
|
|
145
|
-
|
|
146
|
-
const appSubdirs = ['pages', 'hooks', 'api', 'config', 'features', 'components/workspace', 'components/alerts', 'components/layouts'];
|
|
144
|
+
// Copy the full app directory tree into src/ (including styles for brand theming)
|
|
145
|
+
const appSubdirs = ['pages', 'hooks', 'api', 'config', 'features', 'styles', 'components/workspace', 'components/alerts', 'components/layouts'];
|
|
147
146
|
|
|
148
147
|
for (const sub of appSubdirs) {
|
|
149
148
|
const src = path.join(appDir, sub);
|
|
@@ -157,20 +156,20 @@ if (isDemo) {
|
|
|
157
156
|
}
|
|
158
157
|
}
|
|
159
158
|
|
|
160
|
-
// Copy
|
|
161
|
-
const agentClient = path.join(appDir, 'components/AgentforceConversationClient.tsx');
|
|
162
|
-
const agentClientInherit = path.join(appDir, 'components/__inherit_AgentforceConversationClient.tsx');
|
|
159
|
+
// Copy top-level component files to src/components/
|
|
163
160
|
const componentsDir = path.join(cwd, 'src/components');
|
|
164
161
|
if (!fs.existsSync(componentsDir)) fs.mkdirSync(componentsDir, { recursive: true });
|
|
165
162
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
163
|
+
const componentFiles = fs.readdirSync(path.join(appDir, 'components')).filter(f =>
|
|
164
|
+
f.endsWith('.tsx') || f.endsWith('.jsx') || f.endsWith('.ts') || f.endsWith('.js')
|
|
165
|
+
);
|
|
166
|
+
for (const file of componentFiles) {
|
|
167
|
+
const src = path.join(appDir, 'components', file);
|
|
168
|
+
if (fs.statSync(src).isFile()) {
|
|
169
|
+
fs.copyFileSync(src, path.join(componentsDir, file));
|
|
170
|
+
console.log(` ✓ Installed src/components/${file}`);
|
|
171
|
+
installed++;
|
|
172
|
+
}
|
|
174
173
|
}
|
|
175
174
|
|
|
176
175
|
// Copy root-level app files (routes, appLayout, etc.)
|
|
@@ -224,9 +223,23 @@ if (isDemo) {
|
|
|
224
223
|
installed++;
|
|
225
224
|
}
|
|
226
225
|
|
|
226
|
+
// If app/styles didn't exist, apply brand colors from the brand root global.css
|
|
227
|
+
const targetCSS = path.join(cwd, 'src/styles/global.css');
|
|
228
|
+
if (!fs.existsSync(path.join(appDir, 'styles'))) {
|
|
229
|
+
const brandCSS = path.join(brandDir, 'global.css');
|
|
230
|
+
if (fs.existsSync(brandCSS)) {
|
|
231
|
+
fs.mkdirSync(path.dirname(targetCSS), { recursive: true });
|
|
232
|
+
fs.copyFileSync(brandCSS, targetCSS);
|
|
233
|
+
console.log(' ✓ Brand theme applied (global.css)');
|
|
234
|
+
installed++;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// Write .brand marker
|
|
239
|
+
fs.writeFileSync(path.join(cwd, '.brand'), brandName + '\n', 'utf-8');
|
|
240
|
+
|
|
227
241
|
console.log(`\n✅ "${brandName}" demo app installed (${installed} files).`);
|
|
228
|
-
console.log(
|
|
229
|
-
console.log(` Run "npm run brand:${brandName}" to switch to ${brandName} colors.\n`);
|
|
242
|
+
console.log(` Brand colors applied. Run "npm run brand:reset" to revert to neutral.\n`);
|
|
230
243
|
process.exit(0);
|
|
231
244
|
}
|
|
232
245
|
|