@asgard-js/react 0.0.43-canary.19 → 0.0.43-canary.20
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/package.json
CHANGED
|
@@ -23,7 +23,7 @@ import { ChatbotBody } from './chatbot-body';
|
|
|
23
23
|
import { ChatbotFooter } from './chatbot-footer';
|
|
24
24
|
import { ChatbotContainer } from './chatbot-container/chatbot-container';
|
|
25
25
|
|
|
26
|
-
type AuthState = 'loading' | 'needApiKey' | 'authenticated' | 'error';
|
|
26
|
+
type AuthState = 'loading' | 'needApiKey' | 'authenticated' | 'error' | 'invalidApiKey';
|
|
27
27
|
|
|
28
28
|
interface ChatbotProps extends AsgardTemplateContextValue {
|
|
29
29
|
className?: string;
|
|
@@ -123,6 +123,24 @@ export const Chatbot = forwardRef(function Chatbot(
|
|
|
123
123
|
</div>
|
|
124
124
|
);
|
|
125
125
|
|
|
126
|
+
case 'invalidApiKey':
|
|
127
|
+
return (
|
|
128
|
+
<div style={{
|
|
129
|
+
display: 'flex',
|
|
130
|
+
alignItems: 'center',
|
|
131
|
+
justifyContent: 'center',
|
|
132
|
+
flex: 1,
|
|
133
|
+
padding: '20px'
|
|
134
|
+
}}>
|
|
135
|
+
<ApiKeyInput
|
|
136
|
+
title={title}
|
|
137
|
+
onSubmit={onApiKeySubmit || (() => {})}
|
|
138
|
+
placeholder="Enter your key"
|
|
139
|
+
error="Please check if the key is correct."
|
|
140
|
+
/>
|
|
141
|
+
</div>
|
|
142
|
+
);
|
|
143
|
+
|
|
126
144
|
case 'error':
|
|
127
145
|
return (
|
|
128
146
|
<div style={{
|
|
@@ -159,7 +177,7 @@ export const Chatbot = forwardRef(function Chatbot(
|
|
|
159
177
|
};
|
|
160
178
|
|
|
161
179
|
// Don't initialize SSE connection when explicitly needing API key or in error state
|
|
162
|
-
if (authState !== 'needApiKey' && authState !== 'error') {
|
|
180
|
+
if (authState !== 'needApiKey' && authState !== 'error' && authState !== 'invalidApiKey') {
|
|
163
181
|
return (
|
|
164
182
|
<AsgardAppInitializationContextProvider
|
|
165
183
|
enabled={enableLoadConfigFromService}
|