@asgard-js/react 0.0.20 → 0.0.22
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/README.md +190 -48
- package/dist/components/chatbot/chatbot-container/chatbot-container.d.ts.map +1 -1
- package/dist/components/chatbot/chatbot-footer/chatbot-footer.d.ts.map +1 -1
- package/dist/components/chatbot/chatbot-footer/speech-input-button.d.ts +2 -1
- package/dist/components/chatbot/chatbot-footer/speech-input-button.d.ts.map +1 -1
- package/dist/components/chatbot/chatbot.d.ts +6 -2
- package/dist/components/chatbot/chatbot.d.ts.map +1 -1
- package/dist/components/templates/button-template/button-template.d.ts.map +1 -1
- package/dist/components/templates/button-template/card.d.ts.map +1 -1
- package/dist/components/templates/carousel-template/carousel-template.d.ts.map +1 -1
- package/dist/components/templates/chart-template/chart-template.d.ts.map +1 -1
- package/dist/components/templates/hint-template/hint-template.d.ts.map +1 -1
- package/dist/components/templates/image-template/image-template.d.ts.map +1 -1
- package/dist/components/templates/quick-replies/quick-replies.d.ts.map +1 -1
- package/dist/components/templates/template-box/template-box.d.ts +3 -1
- package/dist/components/templates/template-box/template-box.d.ts.map +1 -1
- package/dist/components/templates/text-template/text-template.d.ts.map +1 -1
- package/dist/context/asgard-service-context.d.ts +7 -4
- package/dist/context/asgard-service-context.d.ts.map +1 -1
- package/dist/context/asgard-template-context.d.ts +11 -3
- package/dist/context/asgard-template-context.d.ts.map +1 -1
- package/dist/context/asgard-theme-context.d.ts +88 -0
- package/dist/context/asgard-theme-context.d.ts.map +1 -1
- package/dist/hooks/use-channel.d.ts +5 -3
- package/dist/hooks/use-channel.d.ts.map +1 -1
- package/dist/index.js +6022 -5866
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,38 +15,77 @@ yarn add @asgard-js/core @asgard-js/react
|
|
|
15
15
|
Here's a basic example of how to use the React components:
|
|
16
16
|
|
|
17
17
|
```javascript
|
|
18
|
-
import React from 'react';
|
|
18
|
+
import React, { useRef } from 'react';
|
|
19
19
|
import { Chatbot } from '@asgard-js/react';
|
|
20
20
|
|
|
21
|
+
const chatbotRef = useRef(null);
|
|
22
|
+
|
|
21
23
|
const App = () => {
|
|
22
24
|
return (
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
<div style={{ width: '800px', position: 'relative' }}>
|
|
26
|
+
<button
|
|
27
|
+
style={{
|
|
28
|
+
position: 'absolute',
|
|
29
|
+
top: '80px',
|
|
30
|
+
right: '50%',
|
|
31
|
+
transform: 'translateX(50%)',
|
|
32
|
+
zIndex: 10,
|
|
33
|
+
border: '1px solid white',
|
|
34
|
+
borderRadius: '5px',
|
|
35
|
+
color: 'white',
|
|
36
|
+
backgroundColor: 'transparent',
|
|
37
|
+
cursor: 'pointer',
|
|
38
|
+
padding: '0.5rem 1rem',
|
|
39
|
+
}}
|
|
40
|
+
onClick={() =>
|
|
41
|
+
chatbotRef.current?.serviceContext?.sendMessage?.({ text: 'Hello' })
|
|
34
42
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
>
|
|
44
|
+
Send a message from outside of chatbot
|
|
45
|
+
</button>
|
|
46
|
+
<Chatbot
|
|
47
|
+
ref={chatbotRef}
|
|
48
|
+
title="Asgard AI Chatbot"
|
|
49
|
+
config={{
|
|
50
|
+
apiKey: 'your-api-key',
|
|
51
|
+
endpoint:
|
|
52
|
+
'https://api.asgard-ai.com/ns/{namespace}/bot-provider/{botProviderId}/message/sse',
|
|
53
|
+
botProviderEndpoint:
|
|
54
|
+
'https://api.asgard-ai.com/ns/{namespace}/bot-provider/{botProviderId}',
|
|
55
|
+
onExecutionError: (error) => {
|
|
56
|
+
console.error('Execution error:', error);
|
|
57
|
+
},
|
|
58
|
+
transformSsePayload: (payload) => {
|
|
59
|
+
return payload;
|
|
60
|
+
},
|
|
61
|
+
}}
|
|
62
|
+
enableLoadConfigFromService={true}
|
|
63
|
+
customChannelId="your-channel-id"
|
|
64
|
+
initMessages={[]}
|
|
65
|
+
debugMode={false}
|
|
66
|
+
fullScreen={false}
|
|
67
|
+
avatar="https://example.com/avatar.png"
|
|
68
|
+
botTypingPlaceholder="Bot is typing..."
|
|
69
|
+
onReset={() => {
|
|
70
|
+
console.log('Chat reset');
|
|
71
|
+
}}
|
|
72
|
+
onClose={() => {
|
|
73
|
+
console.log('Chat closed');
|
|
74
|
+
}}
|
|
75
|
+
onSseMessage={(response, ctx) => {
|
|
76
|
+
if (response.eventType === 'asgard.run.done') {
|
|
77
|
+
console.log('onSseMessage', response, ctx.conversation);
|
|
78
|
+
|
|
79
|
+
setTimeout(() => {
|
|
80
|
+
// delay some time to wait for the serviceContext to be available
|
|
81
|
+
chatbotRef.current?.serviceContext?.sendMessage?.({
|
|
82
|
+
text: 'Say hi after 5 seconds',
|
|
83
|
+
});
|
|
84
|
+
}, 5000);
|
|
85
|
+
}
|
|
86
|
+
}}
|
|
87
|
+
/>
|
|
88
|
+
</div>
|
|
50
89
|
);
|
|
51
90
|
};
|
|
52
91
|
|
|
@@ -74,37 +113,82 @@ export default App;
|
|
|
74
113
|
- **theme**: `Partial<AsgardThemeContextValue>` - Custom theme configuration
|
|
75
114
|
- **onReset**: `() => void` - Callback function when chat is reset
|
|
76
115
|
- **onClose**: `() => void` - Callback function when chat is closed
|
|
116
|
+
- **onSseMessage**: `(response: SseResponse, ctx: AsgardServiceContextValue) => void` - Callback function when SSE message is received. It would be helpful if using with the ref to provide some context and conversation data and do some proactively actions like sending messages to the bot.
|
|
117
|
+
- **ref**: `ForwardedRef<ChatbotRef>` - Forwarded ref to access the chatbot instance. It can be used to access the chatbot instance and do some actions like sending messages to the bot. ChatbotRef extends the ref of the chatbot instance and provides some additional methods like `serviceContext.sendMessage` to interact with the chatbot instance.
|
|
77
118
|
|
|
78
119
|
### Theme Configuration
|
|
120
|
+
|
|
79
121
|
The theme configuration can be obtained from the bot provider metadata of `annotations` field and `theme` props.
|
|
80
122
|
|
|
81
123
|
The priority of themes is as follows (high to low):
|
|
124
|
+
|
|
82
125
|
1. Theme from props
|
|
83
126
|
2. Theme from annotations from bot provider metadata
|
|
84
127
|
3. Default theme
|
|
85
128
|
|
|
86
129
|
```typescript
|
|
87
|
-
interface AsgardThemeContextValue {
|
|
88
|
-
chatbot:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
130
|
+
export interface AsgardThemeContextValue {
|
|
131
|
+
chatbot: Pick<
|
|
132
|
+
CSSProperties,
|
|
133
|
+
| 'width'
|
|
134
|
+
| 'height'
|
|
135
|
+
| 'maxWidth'
|
|
136
|
+
| 'minWidth'
|
|
137
|
+
| 'maxHeight'
|
|
138
|
+
| 'minHeight'
|
|
139
|
+
| 'backgroundColor'
|
|
140
|
+
| 'borderColor'
|
|
141
|
+
| 'borderRadius'
|
|
142
|
+
> & {
|
|
143
|
+
contentMaxWidth?: CSSProperties['maxWidth'];
|
|
144
|
+
style?: CSSProperties;
|
|
145
|
+
header?: Partial<{
|
|
146
|
+
style: CSSProperties;
|
|
147
|
+
title: {
|
|
148
|
+
style: CSSProperties;
|
|
149
|
+
};
|
|
150
|
+
}>;
|
|
151
|
+
body?: Partial<{
|
|
152
|
+
style: CSSProperties;
|
|
153
|
+
}>;
|
|
154
|
+
footer?: Partial<{
|
|
155
|
+
style: CSSProperties;
|
|
156
|
+
textArea: {
|
|
157
|
+
style: CSSProperties;
|
|
158
|
+
};
|
|
159
|
+
submitButton: {
|
|
160
|
+
style: CSSProperties;
|
|
161
|
+
};
|
|
162
|
+
speechInputButton: {
|
|
163
|
+
style: CSSProperties;
|
|
164
|
+
};
|
|
165
|
+
}>;
|
|
107
166
|
};
|
|
167
|
+
botMessage: Pick<CSSProperties, 'color' | 'backgroundColor'>;
|
|
168
|
+
userMessage: Pick<CSSProperties, 'color' | 'backgroundColor'>;
|
|
169
|
+
template?: Partial<{
|
|
170
|
+
/**
|
|
171
|
+
* first level for common/shared properties.
|
|
172
|
+
* Check MessageTemplate type for more details (packages/core/src/types/sse-response.ts).
|
|
173
|
+
*/
|
|
174
|
+
quickReplies?: Partial<{
|
|
175
|
+
style: CSSProperties;
|
|
176
|
+
button: {
|
|
177
|
+
style: CSSProperties;
|
|
178
|
+
};
|
|
179
|
+
}>;
|
|
180
|
+
TextMessageTemplate: Partial<{ style: CSSProperties }>;
|
|
181
|
+
HintMessageTemplate: Partial<{ style: CSSProperties }>;
|
|
182
|
+
ImageMessageTemplate: Partial<{ style: CSSProperties }>;
|
|
183
|
+
ChartMessageTemplate: Partial<{ style: CSSProperties }>;
|
|
184
|
+
ButtonMessageTemplate: Partial<{ style: CSSProperties }>;
|
|
185
|
+
CarouselMessageTemplate: Partial<{ style: CSSProperties }>;
|
|
186
|
+
|
|
187
|
+
// Didn't implement yet
|
|
188
|
+
VideoMessageTemplate: Partial<{ style: CSSProperties }>;
|
|
189
|
+
AudioMessageTemplate: Partial<{ style: CSSProperties }>;
|
|
190
|
+
LocationMessageTemplate: Partial<{ style: CSSProperties }>;
|
|
191
|
+
}>;
|
|
108
192
|
}
|
|
109
193
|
```
|
|
110
194
|
|
|
@@ -121,6 +205,28 @@ const defaultTheme = {
|
|
|
121
205
|
borderColor: 'var(--asg-color-border)',
|
|
122
206
|
borderRadius: 'var(--asg-radius-md)',
|
|
123
207
|
contentMaxWidth: '1200px',
|
|
208
|
+
style: {},
|
|
209
|
+
header: {
|
|
210
|
+
style: {},
|
|
211
|
+
title: {
|
|
212
|
+
style: {},
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
body: {
|
|
216
|
+
style: {},
|
|
217
|
+
},
|
|
218
|
+
footer: {
|
|
219
|
+
style: {},
|
|
220
|
+
textArea: {
|
|
221
|
+
style: {},
|
|
222
|
+
},
|
|
223
|
+
submitButton: {
|
|
224
|
+
style: {},
|
|
225
|
+
},
|
|
226
|
+
speechInputButton: {
|
|
227
|
+
style: {},
|
|
228
|
+
},
|
|
229
|
+
},
|
|
124
230
|
},
|
|
125
231
|
botMessage: {
|
|
126
232
|
color: 'var(--asg-color-text)',
|
|
@@ -130,7 +236,42 @@ const defaultTheme = {
|
|
|
130
236
|
color: 'var(--asg-color-text)',
|
|
131
237
|
backgroundColor: 'var(--asg-color-primary)',
|
|
132
238
|
},
|
|
133
|
-
|
|
239
|
+
template: {
|
|
240
|
+
quickReplies: {
|
|
241
|
+
style: {},
|
|
242
|
+
button: {
|
|
243
|
+
style: {},
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
TextMessageTemplate: {
|
|
247
|
+
style: {},
|
|
248
|
+
},
|
|
249
|
+
HintMessageTemplate: {
|
|
250
|
+
style: {},
|
|
251
|
+
},
|
|
252
|
+
ImageMessageTemplate: {
|
|
253
|
+
style: {},
|
|
254
|
+
},
|
|
255
|
+
VideoMessageTemplate: {
|
|
256
|
+
style: {},
|
|
257
|
+
},
|
|
258
|
+
AudioMessageTemplate: {
|
|
259
|
+
style: {},
|
|
260
|
+
},
|
|
261
|
+
LocationMessageTemplate: {
|
|
262
|
+
style: {},
|
|
263
|
+
},
|
|
264
|
+
ChartMessageTemplate: {
|
|
265
|
+
style: {},
|
|
266
|
+
},
|
|
267
|
+
ButtonMessageTemplate: {
|
|
268
|
+
style: {},
|
|
269
|
+
},
|
|
270
|
+
CarouselMessageTemplate: {
|
|
271
|
+
style: {},
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
};
|
|
134
275
|
```
|
|
135
276
|
|
|
136
277
|
### Usage Example
|
|
@@ -171,6 +312,7 @@ To develop the React package locally, follow these steps:
|
|
|
171
312
|
1. Clone the repository and navigate to the project root directory.
|
|
172
313
|
|
|
173
314
|
2. Install dependencies:
|
|
315
|
+
|
|
174
316
|
```sh
|
|
175
317
|
yarn install
|
|
176
318
|
```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatbot-container.d.ts","sourceRoot":"","sources":["../../../../src/components/chatbot/chatbot-container/chatbot-container.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAU,MAAM,OAAO,CAAC;AAM7D,UAAU,qBAAsB,SAAQ,iBAAiB;IACvD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"chatbot-container.d.ts","sourceRoot":"","sources":["../../../../src/components/chatbot/chatbot-container/chatbot-container.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAU,MAAM,OAAO,CAAC;AAM7D,UAAU,qBAAsB,SAAQ,iBAAiB;IACvD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,SAAS,CA+BxE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatbot-footer.d.ts","sourceRoot":"","sources":["../../../../src/components/chatbot/chatbot-footer/chatbot-footer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,SAAS,EAKV,MAAM,OAAO,CAAC;AAQf,wBAAgB,aAAa,IAAI,SAAS,
|
|
1
|
+
{"version":3,"file":"chatbot-footer.d.ts","sourceRoot":"","sources":["../../../../src/components/chatbot/chatbot-footer/chatbot-footer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,SAAS,EAKV,MAAM,OAAO,CAAC;AAQf,wBAAgB,aAAa,IAAI,SAAS,CA6GzC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Dispatch, ReactNode, SetStateAction } from 'react';
|
|
1
|
+
import { Dispatch, ReactNode, SetStateAction, CSSProperties } from 'react';
|
|
2
2
|
|
|
3
3
|
interface SpeechInputButtonProps {
|
|
4
4
|
setValue: Dispatch<SetStateAction<string>>;
|
|
5
5
|
className?: string;
|
|
6
|
+
style?: CSSProperties;
|
|
6
7
|
}
|
|
7
8
|
export declare function SpeechInputButton(props: SpeechInputButtonProps): ReactNode;
|
|
8
9
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"speech-input-button.d.ts","sourceRoot":"","sources":["../../../../src/components/chatbot/chatbot-footer/speech-input-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAER,SAAS,EACT,cAAc,
|
|
1
|
+
{"version":3,"file":"speech-input-button.d.ts","sourceRoot":"","sources":["../../../../src/components/chatbot/chatbot-footer/speech-input-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAER,SAAS,EACT,cAAc,EAMd,aAAa,EACd,MAAM,OAAO,CAAC;AAIf,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,SAAS,CA8G1E"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AsgardTemplateContextValue } from '../../context';
|
|
1
|
+
import { AsgardServiceContextValue, AsgardTemplateContextValue, AsgardServiceContextProviderProps } from '../../context';
|
|
2
2
|
import { AsgardThemeContextValue } from '../../context/asgard-theme-context';
|
|
3
3
|
import { ClientConfig, ConversationMessage } from '@asgard-js/core';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
@@ -10,6 +10,7 @@ interface ChatbotProps extends AsgardTemplateContextValue {
|
|
|
10
10
|
config: ClientConfig;
|
|
11
11
|
customChannelId: string;
|
|
12
12
|
initMessages?: ConversationMessage[];
|
|
13
|
+
onSseMessage?: AsgardServiceContextProviderProps['onSseMessage'];
|
|
13
14
|
fullScreen?: boolean;
|
|
14
15
|
avatar?: string;
|
|
15
16
|
botTypingPlaceholder?: string;
|
|
@@ -19,6 +20,9 @@ interface ChatbotProps extends AsgardTemplateContextValue {
|
|
|
19
20
|
onClose?: () => void;
|
|
20
21
|
loadingComponent?: ReactNode;
|
|
21
22
|
}
|
|
22
|
-
export
|
|
23
|
+
export interface ChatbotRef {
|
|
24
|
+
serviceContext?: AsgardServiceContextValue;
|
|
25
|
+
}
|
|
26
|
+
export declare const Chatbot: import('react').ForwardRefExoticComponent<ChatbotProps & import('react').RefAttributes<ChatbotRef>>;
|
|
23
27
|
export {};
|
|
24
28
|
//# sourceMappingURL=chatbot.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatbot.d.ts","sourceRoot":"","sources":["../../../src/components/chatbot/chatbot.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"chatbot.d.ts","sourceRoot":"","sources":["../../../src/components/chatbot/chatbot.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4B,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAEL,uBAAuB,EACxB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAEL,yBAAyB,EAEzB,0BAA0B,EAE1B,iCAAiC,EAClC,MAAM,aAAa,CAAC;AAMrB,UAAU,YAAa,SAAQ,0BAA0B;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,SAAS,EAAE,CAAC;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACzC,MAAM,EAAE,YAAY,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACrC,YAAY,CAAC,EAAE,iCAAiC,CAAC,cAAc,CAAC,CAAC;IACjE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3D,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,gBAAgB,CAAC,EAAE,SAAS,CAAC;CAC9B;AAED,MAAM,WAAW,UAAU;IACzB,cAAc,CAAC,EAAE,yBAAyB,CAAC;CAC5C;AAED,eAAO,MAAM,OAAO,qGA8DlB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-template.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/button-template/button-template.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAyB,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"button-template.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/button-template/button-template.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAyB,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOlC,UAAU,mBAAmB;IAC3B,OAAO,EAAE,sBAAsB,CAAC;CACjC;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,SAAS,CAwBpE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/button-template/card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,SAAS,EAAwB,MAAM,OAAO,CAAC;AAE3E,OAAO,EAEL,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,iBAAiB,CAAC;AAIzB,UAAU,SAAS;IACjB,QAAQ,EAAE,qBAAqB,GAAG,uBAAuB,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;CAC9E;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/button-template/card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,SAAS,EAAwB,MAAM,OAAO,CAAC;AAE3E,OAAO,EAEL,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,iBAAiB,CAAC;AAIzB,UAAU,SAAS;IACjB,QAAQ,EAAE,qBAAqB,GAAG,uBAAuB,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;CAC9E;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAoFhD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel-template.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/carousel-template/carousel-template.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKlC,OAAO,EAEL,sBAAsB,EACvB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"carousel-template.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/carousel-template/carousel-template.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKlC,OAAO,EAEL,sBAAsB,EACvB,MAAM,iBAAiB,CAAC;AAKzB,UAAU,qBAAqB;IAC7B,OAAO,EAAE,sBAAsB,CAAC;CACjC;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,SAAS,CAyBxE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-template.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/chart-template/chart-template.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAqB,MAAM,OAAO,CAAC;AAIrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"chart-template.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/chart-template/chart-template.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAqB,MAAM,OAAO,CAAC;AAIrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AASzD,UAAU,kBAAkB;IAC1B,OAAO,EAAE,sBAAsB,CAAC;CACjC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,SAAS,CAkDlE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hint-template.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/hint-template/hint-template.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAe,MAAM,OAAO,CAAC;AAG/C,OAAO,EAEL,mBAAmB,EAEpB,MAAM,iBAAiB,CAAC;AAGzB,UAAU,iBAAiB;IACzB,OAAO,EAAE,mBAAmB,CAAC;CAC9B;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"hint-template.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/hint-template/hint-template.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAe,MAAM,OAAO,CAAC;AAG/C,OAAO,EAEL,mBAAmB,EAEpB,MAAM,iBAAiB,CAAC;AAGzB,UAAU,iBAAiB;IACzB,OAAO,EAAE,mBAAmB,CAAC;CAC9B;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CA+ChE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-template.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/image-template/image-template.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAI5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"image-template.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/image-template/image-template.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAI5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAMzD,UAAU,kBAAkB;IAC1B,OAAO,EAAE,sBAAsB,CAAC;CACjC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,SAAS,CA0ClE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quick-replies.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/quick-replies/quick-replies.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAe,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"quick-replies.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/quick-replies/quick-replies.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAe,MAAM,OAAO,CAAC;AAK/C,UAAU,iBAAiB;IACzB,YAAY,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAClC;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAiChE"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
|
|
3
3
|
type TemplateBoxProps = {
|
|
4
4
|
type: 'user';
|
|
5
5
|
direction: 'horizontal';
|
|
6
6
|
children: ReactNode;
|
|
7
|
+
style?: CSSProperties;
|
|
7
8
|
} | {
|
|
8
9
|
type: 'bot';
|
|
9
10
|
direction: 'horizontal' | 'vertical';
|
|
10
11
|
children: ReactNode;
|
|
12
|
+
style?: CSSProperties;
|
|
11
13
|
};
|
|
12
14
|
export declare function TemplateBox(props: TemplateBoxProps): ReactNode;
|
|
13
15
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-box.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/template-box/template-box.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAW,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"template-box.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/template-box/template-box.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAW,MAAM,OAAO,CAAC;AAI1D,KAAK,gBAAgB,GACjB;IACE,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,YAAY,CAAC;IACxB,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,GACD;IACE,IAAI,EAAE,KAAK,CAAC;IACZ,SAAS,EAAE,YAAY,GAAG,UAAU,CAAC;IACrC,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC;AAEN,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,SAAS,CAwB9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-template.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/text-template/text-template.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAW,MAAM,OAAO,CAAC;AAE1D,OAAO,EAA0B,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAS9E,UAAU,iBAAiB;IACzB,OAAO,EAAE,mBAAmB,CAAC;CAC9B;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"text-template.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/text-template/text-template.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAW,MAAM,OAAO,CAAC;AAE1D,OAAO,EAA0B,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAS9E,UAAU,iBAAiB;IACzB,OAAO,EAAE,mBAAmB,CAAC;CAC9B;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAgEhE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UseChannelReturn } from '../hooks';
|
|
2
|
-
import {
|
|
1
|
+
import { UseChannelProps, UseChannelReturn } from '../hooks';
|
|
2
|
+
import { ForwardedRef, ReactNode, RefObject } from 'react';
|
|
3
3
|
import { AsgardServiceClient, ClientConfig, ConversationMessage } from '@asgard-js/core';
|
|
4
4
|
|
|
5
5
|
export interface AsgardServiceContextValue {
|
|
@@ -16,8 +16,11 @@ export interface AsgardServiceContextValue {
|
|
|
16
16
|
botTypingPlaceholder?: string;
|
|
17
17
|
}
|
|
18
18
|
export declare const AsgardServiceContext: import('react').Context<AsgardServiceContextValue>;
|
|
19
|
-
interface AsgardServiceContextProviderProps
|
|
19
|
+
export interface AsgardServiceContextProviderProps {
|
|
20
20
|
children: ReactNode;
|
|
21
|
+
parentRef?: ForwardedRef<Partial<{
|
|
22
|
+
serviceContext?: AsgardServiceContextValue;
|
|
23
|
+
}>>;
|
|
21
24
|
avatar?: string;
|
|
22
25
|
config: ClientConfig;
|
|
23
26
|
botTypingPlaceholder?: string;
|
|
@@ -25,8 +28,8 @@ interface AsgardServiceContextProviderProps extends DetailedHTMLProps<HTMLAttrib
|
|
|
25
28
|
customMessageId?: string;
|
|
26
29
|
delayTime?: number;
|
|
27
30
|
initMessages?: ConversationMessage[];
|
|
31
|
+
onSseMessage?: UseChannelProps['onSseMessage'];
|
|
28
32
|
}
|
|
29
33
|
export declare function AsgardServiceContextProvider(props: AsgardServiceContextProviderProps): ReactNode;
|
|
30
34
|
export declare function useAsgardContext(): AsgardServiceContextValue;
|
|
31
|
-
export {};
|
|
32
35
|
//# sourceMappingURL=asgard-service-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asgard-service-context.d.ts","sourceRoot":"","sources":["../../src/context/asgard-service-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEL,
|
|
1
|
+
{"version":3,"file":"asgard-service-context.d.ts","sourceRoot":"","sources":["../../src/context/asgard-service-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEL,YAAY,EACZ,SAAS,EACT,SAAS,EAKV,MAAM,OAAO,CAAC;AACf,OAAO,EAGL,eAAe,EACf,gBAAgB,EACjB,MAAM,WAAW,CAAC;AAEnB,MAAM,WAAW,yBAAyB;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACnC,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,GAAG,IAAI,CAAC;IAClD,mBAAmB,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;IAC/C,WAAW,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAC9C,YAAY,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;IAChD,YAAY,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;IAChD,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,eAAO,MAAM,oBAAoB,oDAS/B,CAAC;AAEH,MAAM,WAAW,iCAAiC;IAChD,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,YAAY,CACtB,OAAO,CAAC;QAAE,cAAc,CAAC,EAAE,yBAAyB,CAAA;KAAE,CAAC,CACxD,CAAC;IACF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,YAAY,CAAC;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACrC,YAAY,CAAC,EAAE,eAAe,CAAC,cAAc,CAAC,CAAC;CAChD;AAED,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,iCAAiC,GACvC,SAAS,CAsEX;AAED,wBAAgB,gBAAgB,IAAI,yBAAyB,CAE5D"}
|
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
import { ConversationErrorMessage } from '@asgard-js/core';
|
|
1
|
+
import { ConversationErrorMessage, FetchSsePayload } from '@asgard-js/core';
|
|
2
2
|
import { PropsWithChildren, ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
export interface AsgardTemplateContextValue {
|
|
5
5
|
onErrorClick?: (message: ConversationErrorMessage) => void;
|
|
6
6
|
errorMessageRenderer?: (message: ConversationErrorMessage) => ReactNode;
|
|
7
|
-
onTemplateBtnClick?: (payload:
|
|
7
|
+
onTemplateBtnClick?: (payload: Record<string, unknown>, { sse, }: {
|
|
8
|
+
sse: {
|
|
9
|
+
sendMessage: (payload: Pick<FetchSsePayload, 'text' | 'payload'>) => void;
|
|
10
|
+
};
|
|
11
|
+
}) => void;
|
|
8
12
|
}
|
|
9
13
|
export declare const AsgardTemplateContext: import('react').Context<AsgardTemplateContextValue>;
|
|
10
14
|
interface AsgardTemplateContextProviderProps extends PropsWithChildren {
|
|
11
15
|
onErrorClick?: (message: ConversationErrorMessage) => void;
|
|
12
16
|
errorMessageRenderer?: (message: ConversationErrorMessage) => ReactNode;
|
|
13
|
-
onTemplateBtnClick?: (payload:
|
|
17
|
+
onTemplateBtnClick?: (payload: Record<string, unknown>, { sse, }: {
|
|
18
|
+
sse: {
|
|
19
|
+
sendMessage: (payload: Pick<FetchSsePayload, 'text' | 'payload'>) => void;
|
|
20
|
+
};
|
|
21
|
+
}) => void;
|
|
14
22
|
}
|
|
15
23
|
export declare function AsgardTemplateContextProvider(props: AsgardTemplateContextProviderProps): ReactNode;
|
|
16
24
|
export declare function useAsgardTemplateContext(): AsgardTemplateContextValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asgard-template-context.d.ts","sourceRoot":"","sources":["../../src/context/asgard-template-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EACjB,SAAS,EAGV,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"asgard-template-context.d.ts","sourceRoot":"","sources":["../../src/context/asgard-template-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EACjB,SAAS,EAGV,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE5E,MAAM,WAAW,0BAA0B;IACzC,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,wBAAwB,KAAK,IAAI,CAAC;IAC3D,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,wBAAwB,KAAK,SAAS,CAAC;IACxE,kBAAkB,CAAC,EAAE,CACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,EACE,GAAG,GACJ,EAAE;QACD,GAAG,EAAE;YACH,WAAW,EAAE,CACX,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC,KAC/C,IAAI,CAAC;SACX,CAAC;KACH,KACE,IAAI,CAAC;CACX;AAED,eAAO,MAAM,qBAAqB,qDAIhC,CAAC;AAEH,UAAU,kCAAmC,SAAQ,iBAAiB;IACpE,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,wBAAwB,KAAK,IAAI,CAAC;IAC3D,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,wBAAwB,KAAK,SAAS,CAAC;IACxE,kBAAkB,CAAC,EAAE,CACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,EACE,GAAG,GACJ,EAAE;QACD,GAAG,EAAE;YACH,WAAW,EAAE,CACX,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC,KAC/C,IAAI,CAAC;SACX,CAAC;KACH,KACE,IAAI,CAAC;CACX;AAED,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,kCAAkC,GACxC,SAAS,CAcX;AAED,wBAAgB,wBAAwB,IAAI,0BAA0B,CAErE"}
|
|
@@ -3,9 +3,97 @@ import { CSSProperties, PropsWithChildren, ReactNode } from 'react';
|
|
|
3
3
|
export interface AsgardThemeContextValue {
|
|
4
4
|
chatbot: Pick<CSSProperties, 'width' | 'height' | 'maxWidth' | 'minWidth' | 'maxHeight' | 'minHeight' | 'backgroundColor' | 'borderColor' | 'borderRadius'> & {
|
|
5
5
|
contentMaxWidth?: CSSProperties['maxWidth'];
|
|
6
|
+
style?: CSSProperties;
|
|
7
|
+
header?: Partial<{
|
|
8
|
+
style: CSSProperties;
|
|
9
|
+
title: {
|
|
10
|
+
style: CSSProperties;
|
|
11
|
+
};
|
|
12
|
+
}>;
|
|
13
|
+
body?: Partial<{
|
|
14
|
+
style: CSSProperties;
|
|
15
|
+
}>;
|
|
16
|
+
footer?: Partial<{
|
|
17
|
+
style: CSSProperties;
|
|
18
|
+
textArea: {
|
|
19
|
+
style: CSSProperties;
|
|
20
|
+
};
|
|
21
|
+
submitButton: {
|
|
22
|
+
style: CSSProperties;
|
|
23
|
+
};
|
|
24
|
+
speechInputButton: {
|
|
25
|
+
style: CSSProperties;
|
|
26
|
+
};
|
|
27
|
+
}>;
|
|
6
28
|
};
|
|
7
29
|
botMessage: Pick<CSSProperties, 'color' | 'backgroundColor'>;
|
|
8
30
|
userMessage: Pick<CSSProperties, 'color' | 'backgroundColor'>;
|
|
31
|
+
template?: Partial<{
|
|
32
|
+
/**
|
|
33
|
+
* first level for common/shared properties.
|
|
34
|
+
* Check MessageTemplate type for more details (packages/core/src/types/sse-response.ts).
|
|
35
|
+
*/
|
|
36
|
+
quickReplies?: Partial<{
|
|
37
|
+
style: CSSProperties;
|
|
38
|
+
button: {
|
|
39
|
+
style: CSSProperties;
|
|
40
|
+
};
|
|
41
|
+
}>;
|
|
42
|
+
/**
|
|
43
|
+
* TBD: Fill the necessary properties based on the requirements.
|
|
44
|
+
*/
|
|
45
|
+
TextMessageTemplate: Partial<{
|
|
46
|
+
style: CSSProperties;
|
|
47
|
+
}>;
|
|
48
|
+
/**
|
|
49
|
+
* TBD: Fill the necessary properties based on the requirements.
|
|
50
|
+
*/
|
|
51
|
+
HintMessageTemplate: Partial<{
|
|
52
|
+
style: CSSProperties;
|
|
53
|
+
}>;
|
|
54
|
+
/**
|
|
55
|
+
* TBD: Fill the necessary properties based on the requirements.
|
|
56
|
+
*/
|
|
57
|
+
ImageMessageTemplate: Partial<{
|
|
58
|
+
style: CSSProperties;
|
|
59
|
+
}>;
|
|
60
|
+
/**
|
|
61
|
+
* TBD: Fill the necessary properties based on the requirements.
|
|
62
|
+
*/
|
|
63
|
+
VideoMessageTemplate: Partial<{
|
|
64
|
+
style: CSSProperties;
|
|
65
|
+
}>;
|
|
66
|
+
/**
|
|
67
|
+
* TBD: Fill the necessary properties based on the requirements.
|
|
68
|
+
*/
|
|
69
|
+
AudioMessageTemplate: Partial<{
|
|
70
|
+
style: CSSProperties;
|
|
71
|
+
}>;
|
|
72
|
+
/**
|
|
73
|
+
* TBD: Fill the necessary properties based on the requirements.
|
|
74
|
+
*/
|
|
75
|
+
LocationMessageTemplate: Partial<{
|
|
76
|
+
style: CSSProperties;
|
|
77
|
+
}>;
|
|
78
|
+
/**
|
|
79
|
+
* TBD: Fill the necessary properties based on the requirements.
|
|
80
|
+
*/
|
|
81
|
+
ChartMessageTemplate: Partial<{
|
|
82
|
+
style: CSSProperties;
|
|
83
|
+
}>;
|
|
84
|
+
/**
|
|
85
|
+
* TBD: Fill the necessary properties based on the requirements.
|
|
86
|
+
*/
|
|
87
|
+
ButtonMessageTemplate: Partial<{
|
|
88
|
+
style: CSSProperties;
|
|
89
|
+
}>;
|
|
90
|
+
/**
|
|
91
|
+
* TBD: Fill the necessary properties based on the requirements.
|
|
92
|
+
*/
|
|
93
|
+
CarouselMessageTemplate: Partial<{
|
|
94
|
+
style: CSSProperties;
|
|
95
|
+
}>;
|
|
96
|
+
}>;
|
|
9
97
|
}
|
|
10
98
|
export declare const defaultAsgardThemeContextValue: AsgardThemeContextValue;
|
|
11
99
|
export declare const AsgardThemeContext: import('react').Context<AsgardThemeContextValue>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asgard-theme-context.d.ts","sourceRoot":"","sources":["../../src/context/asgard-theme-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,iBAAiB,EACjB,SAAS,EAIV,MAAM,OAAO,CAAC;AAIf,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,IAAI,CACX,aAAa,EACX,OAAO,GACP,QAAQ,GACR,UAAU,GACV,UAAU,GACV,WAAW,GACX,WAAW,GACX,iBAAiB,GACjB,aAAa,GACb,cAAc,CACjB,GAAG;QACF,eAAe,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"asgard-theme-context.d.ts","sourceRoot":"","sources":["../../src/context/asgard-theme-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,iBAAiB,EACjB,SAAS,EAIV,MAAM,OAAO,CAAC;AAIf,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,IAAI,CACX,aAAa,EACX,OAAO,GACP,QAAQ,GACR,UAAU,GACV,UAAU,GACV,WAAW,GACX,WAAW,GACX,iBAAiB,GACjB,aAAa,GACb,cAAc,CACjB,GAAG;QACF,eAAe,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;QAC5C,KAAK,CAAC,EAAE,aAAa,CAAC;QACtB,MAAM,CAAC,EAAE,OAAO,CAAC;YACf,KAAK,EAAE,aAAa,CAAC;YACrB,KAAK,EAAE;gBACL,KAAK,EAAE,aAAa,CAAC;aACtB,CAAC;SACH,CAAC,CAAC;QACH,IAAI,CAAC,EAAE,OAAO,CAAC;YACb,KAAK,EAAE,aAAa,CAAC;SACtB,CAAC,CAAC;QACH,MAAM,CAAC,EAAE,OAAO,CAAC;YACf,KAAK,EAAE,aAAa,CAAC;YACrB,QAAQ,EAAE;gBACR,KAAK,EAAE,aAAa,CAAC;aACtB,CAAC;YACF,YAAY,EAAE;gBACZ,KAAK,EAAE,aAAa,CAAC;aACtB,CAAC;YACF,iBAAiB,EAAE;gBACjB,KAAK,EAAE,aAAa,CAAC;aACtB,CAAC;SACH,CAAC,CAAC;KACJ,CAAC;IACF,UAAU,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,GAAG,iBAAiB,CAAC,CAAC;IAC7D,WAAW,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,GAAG,iBAAiB,CAAC,CAAC;IAC9D,QAAQ,CAAC,EAAE,OAAO,CAAC;QACjB;;;WAGG;QACH,YAAY,CAAC,EAAE,OAAO,CAAC;YACrB,KAAK,EAAE,aAAa,CAAC;YACrB,MAAM,EAAE;gBACN,KAAK,EAAE,aAAa,CAAC;aACtB,CAAC;SACH,CAAC,CAAC;QACH;;WAEG;QACH,mBAAmB,EAAE,OAAO,CAAC;YAAE,KAAK,EAAE,aAAa,CAAA;SAAE,CAAC,CAAC;QACvD;;WAEG;QACH,mBAAmB,EAAE,OAAO,CAAC;YAAE,KAAK,EAAE,aAAa,CAAA;SAAE,CAAC,CAAC;QACvD;;WAEG;QACH,oBAAoB,EAAE,OAAO,CAAC;YAAE,KAAK,EAAE,aAAa,CAAA;SAAE,CAAC,CAAC;QACxD;;WAEG;QACH,oBAAoB,EAAE,OAAO,CAAC;YAAE,KAAK,EAAE,aAAa,CAAA;SAAE,CAAC,CAAC;QACxD;;WAEG;QACH,oBAAoB,EAAE,OAAO,CAAC;YAAE,KAAK,EAAE,aAAa,CAAA;SAAE,CAAC,CAAC;QACxD;;WAEG;QACH,uBAAuB,EAAE,OAAO,CAAC;YAAE,KAAK,EAAE,aAAa,CAAA;SAAE,CAAC,CAAC;QAC3D;;WAEG;QACH,oBAAoB,EAAE,OAAO,CAAC;YAAE,KAAK,EAAE,aAAa,CAAA;SAAE,CAAC,CAAC;QACxD;;WAEG;QACH,qBAAqB,EAAE,OAAO,CAAC;YAAE,KAAK,EAAE,aAAa,CAAA;SAAE,CAAC,CAAC;QACzD;;WAEG;QACH,uBAAuB,EAAE,OAAO,CAAC;YAAE,KAAK,EAAE,aAAa,CAAA;SAAE,CAAC,CAAC;KAC5D,CAAC,CAAC;CACJ;AAED,eAAO,MAAM,8BAA8B,EAAE,uBA0E5C,CAAC;AAEF,eAAO,MAAM,kBAAkB,kDAE9B,CAAC;AAEF,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,iBAAiB,CAAC;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAC;CAC1C,CAAC,GACD,SAAS,CAiCX;AAED,wBAAgB,qBAAqB,IAAI,uBAAuB,CAE/D"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { AsgardServiceClient, Conversation, ConversationMessage, FetchSsePayload } from '@asgard-js/core';
|
|
1
|
+
import { AsgardServiceClient, Conversation, ConversationMessage, EventType, FetchSsePayload, SseResponse } from '@asgard-js/core';
|
|
2
2
|
|
|
3
|
-
interface UseChannelProps {
|
|
3
|
+
export interface UseChannelProps {
|
|
4
4
|
defaultIsOpen?: boolean;
|
|
5
5
|
resetPayload?: Pick<FetchSsePayload, 'text' | 'payload'>;
|
|
6
6
|
client: AsgardServiceClient | null;
|
|
7
7
|
customChannelId: string;
|
|
8
8
|
customMessageId?: string;
|
|
9
9
|
initMessages?: ConversationMessage[];
|
|
10
|
+
onSseMessage?: (response: SseResponse<EventType>, context: {
|
|
11
|
+
conversation: Conversation | null;
|
|
12
|
+
}) => void;
|
|
10
13
|
}
|
|
11
14
|
export interface UseChannelReturn {
|
|
12
15
|
isOpen: boolean;
|
|
@@ -18,5 +21,4 @@ export interface UseChannelReturn {
|
|
|
18
21
|
closeChannel?: () => void;
|
|
19
22
|
}
|
|
20
23
|
export declare function useChannel(props: UseChannelProps): UseChannelReturn;
|
|
21
|
-
export {};
|
|
22
24
|
//# sourceMappingURL=use-channel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-channel.d.ts","sourceRoot":"","sources":["../../src/hooks/use-channel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EAGnB,YAAY,EACZ,mBAAmB,EACnB,eAAe,
|
|
1
|
+
{"version":3,"file":"use-channel.d.ts","sourceRoot":"","sources":["../../src/hooks/use-channel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EAGnB,YAAY,EACZ,mBAAmB,EACnB,SAAS,EACT,eAAe,EACf,WAAW,EACZ,MAAM,iBAAiB,CAAC;AAGzB,MAAM,WAAW,eAAe;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACzD,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACnC,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACrC,YAAY,CAAC,EAAE,CACb,QAAQ,EAAE,WAAW,CAAC,SAAS,CAAC,EAChC,OAAO,EAAE;QACP,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;KACnC,KACE,IAAI,CAAC;CACX;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC,KAAK,IAAI,CAAC;IAC3E,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC,KAAK,IAAI,CAAC;IAC5E,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,gBAAgB,CAoHnE"}
|