@asgard-js/react 0.0.43-canary.1 → 0.0.43-canary.10

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asgard-js/react",
3
- "version": "0.0.43-canary.1",
3
+ "version": "0.0.43-canary.10",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -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
- background: #4845c7;
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,7 @@ 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();
29
31
 
30
32
  const handleSubmit = (e: FormEvent): void => {
31
33
  e.preventDefault();
@@ -51,8 +53,8 @@ export function ApiKeyInput({
51
53
  }}
52
54
  >
53
55
  <div className={styles.header}>
54
- <ProfileSvg className={styles.icon} />
55
- <h2 className={styles.title}>{title}</h2>
56
+ <ProfileIcon avatar={avatar} />
57
+ <h2 className={styles.title} style={chatbot?.header?.title?.style}>{title}</h2>
56
58
  </div>
57
59
 
58
60
  <form onSubmit={handleSubmit} className={styles.form}>
@@ -114,6 +116,10 @@ export function ApiKeyInput({
114
116
  className={clsx(styles.submitButton, {
115
117
  [styles.loading]: loading,
116
118
  })}
119
+ style={{
120
+ backgroundColor: chatbot?.primaryComponent?.mainColor,
121
+ color: chatbot?.primaryComponent?.secondaryColor,
122
+ }}
117
123
  >
118
124
  {loading ? 'Loading...' : 'Continue'}
119
125
  </button>
@@ -199,23 +199,35 @@ export const Chatbot = forwardRef(function Chatbot(
199
199
  );
200
200
  }
201
201
 
202
- // For non-authenticated states, render without AsgardServiceContextProvider
202
+ // For non-authenticated states, provide AsgardServiceContextProvider but without SSE connection
203
203
  return (
204
204
  <AsgardThemeContextProvider theme={theme}>
205
- <ChatbotContainer
206
- fullScreen={fullScreen}
207
- className={className}
208
- style={style}
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
- <ChatbotHeader
211
- title={title}
212
- onReset={onReset}
213
- onClose={onClose}
214
- customActions={customActions}
215
- maintainConnectionWhenClosed={maintainConnectionWhenClosed}
216
- />
217
- {renderContent()}
218
- </ChatbotContainer>
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
  });