@afncdelacru/brady-chat 0.3.6 → 0.4.1
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 +1389 -1389
- package/dist/index.mjs +1357 -1357
- package/package.json +2 -2
- package/src/lib/EnhancedBradyChat.tsx +22 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@afncdelacru/brady-chat",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Brady AI chat sidebar component and context for AFN recruiting experiences.",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -32,6 +32,6 @@
|
|
|
32
32
|
"afn"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@afncdelacru/brady-chat": "^0.
|
|
35
|
+
"@afncdelacru/brady-chat": "^0.4.1"
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -26,9 +26,14 @@ export interface EnhancedBradyChatProps {
|
|
|
26
26
|
* Typically you pass something like `/bradyIcon.png` from your app's public assets.
|
|
27
27
|
*/
|
|
28
28
|
avatarSrc: string;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* If set, will set the input value and send it automatically as a user message.
|
|
32
|
+
*/
|
|
33
|
+
autoUserText?: string;
|
|
29
34
|
}
|
|
30
35
|
|
|
31
|
-
export function EnhancedBradyChat({ modeVariant = 'loan-officer', avatarSrc }: EnhancedBradyChatProps) {
|
|
36
|
+
export function EnhancedBradyChat({ modeVariant = 'loan-officer', avatarSrc, autoUserText }: EnhancedBradyChatProps) {
|
|
32
37
|
|
|
33
38
|
const [bradyHealthy, setBradyHealthy] = useState(true);
|
|
34
39
|
const {
|
|
@@ -49,6 +54,22 @@ export function EnhancedBradyChat({ modeVariant = 'loan-officer', avatarSrc }: E
|
|
|
49
54
|
setIsHidden,
|
|
50
55
|
} = useBradyChat();
|
|
51
56
|
const [inputValue, setInputValue] = useState('');
|
|
57
|
+
const [autoUserTextSent, setAutoUserTextSent] = useState(false);
|
|
58
|
+
// Auto-send user text if provided
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (autoUserText && !autoUserTextSent) {
|
|
61
|
+
setInputValue(autoUserText);
|
|
62
|
+
setAutoUserTextSent(true);
|
|
63
|
+
}
|
|
64
|
+
}, [autoUserText, autoUserTextSent]);
|
|
65
|
+
|
|
66
|
+
// When inputValue is set by autoUserText, trigger send
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
if (autoUserTextSent && inputValue === autoUserText && inputValue.trim()) {
|
|
69
|
+
handleSend();
|
|
70
|
+
}
|
|
71
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
72
|
+
}, [inputValue, autoUserTextSent]);
|
|
52
73
|
const [showForm, setShowForm] = useState(false);
|
|
53
74
|
const [inputDisabled, setInputDisabled] = useState(false);
|
|
54
75
|
const [showModePrompts, setShowModePrompts] = useState(false);
|