@asgard-js/react 0.0.43-canary.1 → 0.0.43-canary.11
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/components/chatbot/api-key-input/api-key-input.d.ts.map +1 -1
- package/dist/components/chatbot/chatbot.d.ts.map +1 -1
- package/dist/index.js +4706 -4685
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/chatbot/api-key-input/api-key-input.module.scss +2 -2
- package/src/components/chatbot/api-key-input/api-key-input.tsx +10 -3
- package/src/components/chatbot/chatbot.tsx +26 -14
package/package.json
CHANGED
|
@@ -120,9 +120,9 @@
|
|
|
120
120
|
.submitButton {
|
|
121
121
|
width: 100%;
|
|
122
122
|
height: 42px;
|
|
123
|
-
background: #5856d6;
|
|
124
123
|
border: none;
|
|
125
124
|
border-radius: 6px;
|
|
125
|
+
background-color: #5856d6;
|
|
126
126
|
color: white;
|
|
127
127
|
font-size: 14px;
|
|
128
128
|
font-weight: 500;
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
outline: none;
|
|
132
132
|
|
|
133
133
|
&:hover:not(:disabled) {
|
|
134
|
-
|
|
134
|
+
opacity: 0.9;
|
|
135
135
|
transform: translateY(-1px);
|
|
136
136
|
}
|
|
137
137
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useState, FormEvent, ChangeEvent } from 'react';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import ProfileSvg from '../../../icons/profile.svg?react';
|
|
4
3
|
import { useAsgardThemeContext } from '../../../context/asgard-theme-context';
|
|
4
|
+
import { useAsgardContext } from '../../../context/asgard-service-context';
|
|
5
|
+
import { ProfileIcon } from '../profile-icon';
|
|
5
6
|
import styles from './api-key-input.module.scss';
|
|
6
7
|
|
|
7
8
|
export interface ApiKeyInputProps {
|
|
@@ -26,6 +27,8 @@ export function ApiKeyInput({
|
|
|
26
27
|
const [apiKey, setApiKey] = useState('');
|
|
27
28
|
const [showPassword, setShowPassword] = useState(false);
|
|
28
29
|
const { chatbot } = useAsgardThemeContext();
|
|
30
|
+
const { avatar } = useAsgardContext();
|
|
31
|
+
console.log('chatbot', chatbot);
|
|
29
32
|
|
|
30
33
|
const handleSubmit = (e: FormEvent): void => {
|
|
31
34
|
e.preventDefault();
|
|
@@ -51,8 +54,8 @@ export function ApiKeyInput({
|
|
|
51
54
|
}}
|
|
52
55
|
>
|
|
53
56
|
<div className={styles.header}>
|
|
54
|
-
<
|
|
55
|
-
<h2 className={styles.title}>{title}</h2>
|
|
57
|
+
<ProfileIcon avatar={avatar} />
|
|
58
|
+
<h2 className={styles.title} style={chatbot?.header?.title?.style}>{title}</h2>
|
|
56
59
|
</div>
|
|
57
60
|
|
|
58
61
|
<form onSubmit={handleSubmit} className={styles.form}>
|
|
@@ -114,6 +117,10 @@ export function ApiKeyInput({
|
|
|
114
117
|
className={clsx(styles.submitButton, {
|
|
115
118
|
[styles.loading]: loading,
|
|
116
119
|
})}
|
|
120
|
+
style={{
|
|
121
|
+
backgroundColor: chatbot?.primaryComponent?.mainColor,
|
|
122
|
+
color: chatbot?.primaryComponent?.secondaryColor,
|
|
123
|
+
}}
|
|
117
124
|
>
|
|
118
125
|
{loading ? 'Loading...' : 'Continue'}
|
|
119
126
|
</button>
|
|
@@ -199,23 +199,35 @@ export const Chatbot = forwardRef(function Chatbot(
|
|
|
199
199
|
);
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
// For non-authenticated states,
|
|
202
|
+
// For non-authenticated states, provide AsgardServiceContextProvider but without SSE connection
|
|
203
203
|
return (
|
|
204
204
|
<AsgardThemeContextProvider theme={theme}>
|
|
205
|
-
<
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
205
|
+
<AsgardServiceContextProvider
|
|
206
|
+
parentRef={ref}
|
|
207
|
+
avatar={avatar}
|
|
208
|
+
config={config}
|
|
209
|
+
customChannelId={customChannelId}
|
|
210
|
+
initMessages={initMessages}
|
|
211
|
+
onSseMessage={onSseMessage}
|
|
212
|
+
onAuthError={onAuthError}
|
|
213
|
+
botTypingPlaceholder={botTypingPlaceholder}
|
|
214
|
+
inputPlaceholder={inputPlaceholder}
|
|
209
215
|
>
|
|
210
|
-
<
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
216
|
+
<ChatbotContainer
|
|
217
|
+
fullScreen={fullScreen}
|
|
218
|
+
className={className}
|
|
219
|
+
style={style}
|
|
220
|
+
>
|
|
221
|
+
<ChatbotHeader
|
|
222
|
+
title={title}
|
|
223
|
+
onReset={onReset}
|
|
224
|
+
onClose={onClose}
|
|
225
|
+
customActions={customActions}
|
|
226
|
+
maintainConnectionWhenClosed={maintainConnectionWhenClosed}
|
|
227
|
+
/>
|
|
228
|
+
{renderContent()}
|
|
229
|
+
</ChatbotContainer>
|
|
230
|
+
</AsgardServiceContextProvider>
|
|
219
231
|
</AsgardThemeContextProvider>
|
|
220
232
|
);
|
|
221
233
|
});
|