@asgard-js/react 0.0.3 → 0.0.5
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 +85 -4
- package/dist/components/chatbot/chatbot-body.d.ts.map +1 -1
- package/dist/components/chatbot/chatbot-footer/chatbot-footer.d.ts.map +1 -0
- package/dist/components/chatbot/chatbot-footer/index.d.ts +2 -0
- package/dist/components/chatbot/chatbot-footer/index.d.ts.map +1 -0
- package/dist/components/chatbot/chatbot-footer/speech-input-button.d.ts +9 -0
- package/dist/components/chatbot/chatbot-footer/speech-input-button.d.ts.map +1 -0
- package/dist/components/chatbot/chatbot-header.d.ts +2 -0
- package/dist/components/chatbot/chatbot-header.d.ts.map +1 -1
- package/dist/components/chatbot/chatbot.d.ts +6 -3
- package/dist/components/chatbot/chatbot.d.ts.map +1 -1
- package/dist/components/chatbot/profile-icon.d.ts.map +1 -1
- package/dist/components/conversation-message-renderer/conversation-message-renderer.d.ts +1 -1
- package/dist/components/conversation-message-renderer/conversation-message-renderer.d.ts.map +1 -1
- package/dist/components/templates/avatar/avatar.d.ts +5 -1
- package/dist/components/templates/avatar/avatar.d.ts.map +1 -1
- package/dist/components/templates/bot-typing-box/bot-typing-box.d.ts +2 -2
- package/dist/components/templates/bot-typing-box/bot-typing-box.d.ts.map +1 -1
- package/dist/components/templates/bot-typing-box/bot-typing-placeholder.d.ts +8 -0
- package/dist/components/templates/bot-typing-box/bot-typing-placeholder.d.ts.map +1 -0
- package/dist/components/templates/bot-typing-box/index.d.ts +1 -0
- package/dist/components/templates/bot-typing-box/index.d.ts.map +1 -1
- package/dist/components/templates/button-template/button-template.d.ts +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 +1 -1
- package/dist/components/templates/carousel-template/carousel-template.d.ts.map +1 -1
- package/dist/components/templates/hint-template/hint-template.d.ts +1 -1
- package/dist/components/templates/hint-template/hint-template.d.ts.map +1 -1
- package/dist/components/templates/text-template/text-template.d.ts +1 -1
- package/dist/components/templates/text-template/text-template.d.ts.map +1 -1
- package/dist/context/asgard-service-context.d.ts +8 -3
- package/dist/context/asgard-service-context.d.ts.map +1 -1
- package/dist/context/asgard-theme-context.d.ts +17 -0
- package/dist/context/asgard-theme-context.d.ts.map +1 -0
- package/dist/hooks/use-channel.d.ts +9 -8
- package/dist/hooks/use-channel.d.ts.map +1 -1
- package/dist/index.js +580 -411
- package/dist/style.css +1 -1
- package/dist/utils/deep-merge.d.ts +3 -0
- package/dist/utils/deep-merge.d.ts.map +1 -0
- package/package.json +5 -1
- package/dist/components/chatbot/chatbot-footer.d.ts.map +0 -1
- /package/dist/components/chatbot/{chatbot-footer.d.ts → chatbot-footer/chatbot-footer.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,7 +1,88 @@
|
|
|
1
|
-
#
|
|
1
|
+
# AsgardJs React
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This package provides React components and hooks for integrating with the Asgard AI platform, allowing you to build interactive chat interfaces.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
To install the React package, use the following command:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
yarn add asgardjs-react
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Here's a basic example of how to use the React components:
|
|
16
|
+
|
|
17
|
+
```javascript
|
|
18
|
+
import React from 'react';
|
|
19
|
+
import { Chatbot } from 'asgardjs-react';
|
|
20
|
+
|
|
21
|
+
const App = () => {
|
|
22
|
+
return (
|
|
23
|
+
<Chatbot
|
|
24
|
+
title="Asgard AI Chatbot"
|
|
25
|
+
config={{
|
|
26
|
+
apiKey: 'your-api-key',
|
|
27
|
+
endpoint: 'https://api.asgard-ai.com',
|
|
28
|
+
}}
|
|
29
|
+
customChannelId="your-channel-id"
|
|
30
|
+
initMessages={[]}
|
|
31
|
+
fullScreen={false}
|
|
32
|
+
avatar="https://example.com/avatar.png"
|
|
33
|
+
botTypingPlaceholder="Bot is typing..."
|
|
34
|
+
options={{ showDebugMessage: true }}
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default App;
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Chatbot Component Props
|
|
43
|
+
|
|
44
|
+
- **title**: `string` - The title of the chatbot.
|
|
45
|
+
- **config**: `ClientConfig` - Configuration object for the Asgard service client.
|
|
46
|
+
- **customChannelId**: `string` - Custom channel identifier.
|
|
47
|
+
- **initMessages**: `ConversationMessage[]` - Initial messages to display in the chat.
|
|
48
|
+
- **fullScreen**: `boolean` - Whether the chatbot should be displayed in full screen.
|
|
49
|
+
- **avatar**: `string` - URL of the avatar image for the chatbot.
|
|
50
|
+
- **botTypingPlaceholder**: `string` - Placeholder text to show when the bot is typing.
|
|
51
|
+
- **options**: `object` - Additional options, such as `showDebugMessage`.
|
|
52
|
+
|
|
53
|
+
## Development
|
|
54
|
+
|
|
55
|
+
To start developing the React package, follow these steps:
|
|
56
|
+
|
|
57
|
+
1. Clone the repository and navigate to the `packages/react` directory.
|
|
58
|
+
2. Install dependencies:
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
yarn install
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
3. Build the package:
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
yarn build
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
4. Run tests to ensure everything is working:
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
yarn test
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
5. Start the development server:
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
yarn start
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Contributing
|
|
83
|
+
|
|
84
|
+
We welcome contributions! Please read our [contributing guide](../../CONTRIBUTING.md) to get started.
|
|
85
|
+
|
|
86
|
+
## License
|
|
87
|
+
|
|
88
|
+
This project is licensed under the MIT License - see the [LICENSE](../../LICENSE) file for details.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatbot-body.d.ts","sourceRoot":"","sources":["../../../src/components/chatbot/chatbot-body.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"chatbot-body.d.ts","sourceRoot":"","sources":["../../../src/components/chatbot/chatbot-body.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAsB,MAAM,OAAO,CAAC;AAOtD,wBAAgB,WAAW,IAAI,SAAS,CAiCvC"}
|
|
@@ -0,0 +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,CAiGzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/chatbot/chatbot-footer/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Dispatch, ReactNode, SetStateAction } from 'react';
|
|
2
|
+
|
|
3
|
+
interface SpeechInputButtonProps {
|
|
4
|
+
setValue: Dispatch<SetStateAction<string>>;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function SpeechInputButton(props: SpeechInputButtonProps): ReactNode;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=speech-input-button.d.ts.map
|
|
@@ -0,0 +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,EAMf,MAAM,OAAO,CAAC;AAIf,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,SAAS,CA6G1E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatbot-header.d.ts","sourceRoot":"","sources":["../../../src/components/chatbot/chatbot-header.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"chatbot-header.d.ts","sourceRoot":"","sources":["../../../src/components/chatbot/chatbot-header.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,SAAS,EAAwB,MAAM,OAAO,CAAC;AAQ3E,UAAU,kBAAkB;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,SAAS,CAuDlE"}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
+
import { AsgardThemeContextValue } from '../../context/asgard-theme-context';
|
|
1
2
|
import { ClientConfig, ConversationMessage } from '@asgard-js/core';
|
|
2
3
|
import { ReactNode } from 'react';
|
|
3
4
|
|
|
4
5
|
interface ChatbotProps {
|
|
5
6
|
title: string;
|
|
7
|
+
theme?: Partial<AsgardThemeContextValue>;
|
|
6
8
|
config: ClientConfig;
|
|
7
9
|
customChannelId: string;
|
|
8
10
|
initMessages?: ConversationMessage[];
|
|
11
|
+
debugMode?: boolean;
|
|
9
12
|
fullScreen?: boolean;
|
|
10
13
|
avatar?: string;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
botTypingPlaceholder?: string;
|
|
15
|
+
onReset?: () => void;
|
|
16
|
+
onClose?: () => void;
|
|
14
17
|
}
|
|
15
18
|
export declare function Chatbot(props: ChatbotProps): ReactNode;
|
|
16
19
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatbot.d.ts","sourceRoot":"","sources":["../../../src/components/chatbot/chatbot.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"chatbot.d.ts","sourceRoot":"","sources":["../../../src/components/chatbot/chatbot.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEpE,OAAO,EAEL,uBAAuB,EACxB,MAAM,kCAAkC,CAAC;AAO1C,UAAU,YAAY;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,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,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,CAmCtD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile-icon.d.ts","sourceRoot":"","sources":["../../../src/components/chatbot/profile-icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"profile-icon.d.ts","sourceRoot":"","sources":["../../../src/components/chatbot/profile-icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,UAAU,gBAAgB;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,SAAS,CAkB9D"}
|
|
@@ -2,7 +2,7 @@ import { ConversationMessage } from '@asgard-js/core';
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
interface ConversationMessageRendererProps {
|
|
5
|
-
|
|
5
|
+
message: ConversationMessage;
|
|
6
6
|
}
|
|
7
7
|
export declare function ConversationMessageRenderer(props: ConversationMessageRendererProps): ReactNode;
|
|
8
8
|
export {};
|
package/dist/components/conversation-message-renderer/conversation-message-renderer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation-message-renderer.d.ts","sourceRoot":"","sources":["../../../src/components/conversation-message-renderer/conversation-message-renderer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAuB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"conversation-message-renderer.d.ts","sourceRoot":"","sources":["../../../src/components/conversation-message-renderer/conversation-message-renderer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAuB,MAAM,iBAAiB,CAAC;AAS3E,UAAU,gCAAgC;IACxC,OAAO,EAAE,mBAAmB,CAAC;CAC9B;AAED,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,gCAAgC,GACtC,SAAS,CA4BX"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface AvatarProps {
|
|
4
|
+
avatar?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const Avatar: import('react').MemoExoticComponent<(props: AvatarProps) => ReactNode>;
|
|
7
|
+
export {};
|
|
4
8
|
//# sourceMappingURL=avatar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/avatar/avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/avatar/avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,SAAS,EAAE,MAAM,OAAO,CAAC;AAIxC,UAAU,WAAW;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,MAAM,8CAAgB,WAAW,KAAG,SAAS,CAYxD,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ConversationBotMessage } from '@asgard-js/core';
|
|
2
1
|
import { ReactNode } from 'react';
|
|
3
2
|
|
|
4
3
|
interface BotTypingBoxProps {
|
|
5
|
-
|
|
4
|
+
isTyping: boolean;
|
|
5
|
+
typingText: string | null;
|
|
6
6
|
}
|
|
7
7
|
export declare function BotTypingBox(props: BotTypingBoxProps): ReactNode;
|
|
8
8
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bot-typing-box.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/bot-typing-box/bot-typing-box.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAe,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"bot-typing-box.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/bot-typing-box/bot-typing-box.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAe,MAAM,OAAO,CAAC;AAS/C,UAAU,iBAAiB;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CA+BhE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bot-typing-placeholder.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/bot-typing-box/bot-typing-placeholder.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAW,MAAM,OAAO,CAAC;AAI3C,UAAU,yBAAyB;IACjC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,yBAAyB,GAC/B,SAAS,CAiBX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/bot-typing-box/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/bot-typing-box/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { ConversationBotMessage } from '@asgard-js/core';
|
|
3
3
|
|
|
4
4
|
interface ButtonTemplateProps {
|
|
5
|
-
|
|
5
|
+
message: ConversationBotMessage;
|
|
6
6
|
}
|
|
7
7
|
export declare function ButtonTemplate(props: ButtonTemplateProps): ReactNode;
|
|
8
8
|
export {};
|
|
@@ -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;AAMlC,UAAU,mBAAmB;IAC3B,OAAO,EAAE,sBAAsB,CAAC;CACjC;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,SAAS,CAkBpE"}
|
|
@@ -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;AAGzB,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;AAGzB,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,CAsEhD"}
|
|
@@ -2,7 +2,7 @@ import { ConversationBotMessage } from '@asgard-js/core';
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
interface CarouselTemplateProps {
|
|
5
|
-
|
|
5
|
+
message: ConversationBotMessage;
|
|
6
6
|
}
|
|
7
7
|
export declare function CarouselTemplate(props: CarouselTemplateProps): ReactNode;
|
|
8
8
|
export {};
|
|
@@ -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;AAIzB,UAAU,qBAAqB;IAC7B,OAAO,EAAE,sBAAsB,CAAC;CACjC;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,SAAS,CAkBxE"}
|
|
@@ -2,7 +2,7 @@ import { ConversationMessage } from '@asgard-js/core';
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
interface HintTemplateProps {
|
|
5
|
-
|
|
5
|
+
message: ConversationMessage;
|
|
6
6
|
}
|
|
7
7
|
export declare function HintTemplate(props: HintTemplateProps): ReactNode;
|
|
8
8
|
export {};
|
|
@@ -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;AAGlC,OAAO,EAAE,mBAAmB,EAAuB,MAAM,iBAAiB,CAAC;AAE3E,UAAU,iBAAiB;IACzB,
|
|
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;AAGlC,OAAO,EAAE,mBAAmB,EAAuB,MAAM,iBAAiB,CAAC;AAE3E,UAAU,iBAAiB;IACzB,OAAO,EAAE,mBAAmB,CAAC;CAC9B;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAehE"}
|
|
@@ -2,7 +2,7 @@ import { ConversationMessage } from '@asgard-js/core';
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
interface TextTemplateProps {
|
|
5
|
-
|
|
5
|
+
message: ConversationMessage;
|
|
6
6
|
}
|
|
7
7
|
export declare function TextTemplate(props: TextTemplateProps): ReactNode;
|
|
8
8
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-template.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/text-template/text-template.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"text-template.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/text-template/text-template.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAOtD,UAAU,iBAAiB;IACzB,OAAO,EAAE,mBAAmB,CAAC;CAC9B;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CA6BhE"}
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
import { UseChannelReturn } from '../hooks';
|
|
2
2
|
import { DetailedHTMLProps, HTMLAttributes, ReactNode, RefObject } from 'react';
|
|
3
|
-
import { AsgardServiceClient, ClientConfig,
|
|
3
|
+
import { AsgardServiceClient, ClientConfig, ConversationMessage } from '@asgard-js/core';
|
|
4
4
|
|
|
5
5
|
interface AsgardServiceContextType {
|
|
6
6
|
avatar?: string;
|
|
7
7
|
client: AsgardServiceClient | null;
|
|
8
|
+
isOpen: boolean;
|
|
9
|
+
isResetting: boolean;
|
|
8
10
|
isConnecting: boolean;
|
|
9
11
|
messages: Map<string, ConversationMessage> | null;
|
|
10
|
-
typingMessages: Map<string, ConversationBotMessage> | null;
|
|
11
12
|
messageBoxBottomRef: RefObject<HTMLDivElement>;
|
|
12
|
-
sendMessage
|
|
13
|
+
sendMessage?: UseChannelReturn['sendMessage'];
|
|
14
|
+
resetChannel?: UseChannelReturn['resetChannel'];
|
|
15
|
+
closeChannel?: UseChannelReturn['closeChannel'];
|
|
16
|
+
botTypingPlaceholder?: string;
|
|
13
17
|
}
|
|
14
18
|
export declare const AsgardServiceContext: import('react').Context<AsgardServiceContextType>;
|
|
15
19
|
interface AsgardServiceContextProviderProps extends DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
|
|
16
20
|
children: ReactNode;
|
|
17
21
|
avatar?: string;
|
|
18
22
|
config: ClientConfig;
|
|
23
|
+
botTypingPlaceholder?: string;
|
|
19
24
|
customChannelId: string;
|
|
20
25
|
customMessageId?: string;
|
|
21
26
|
delayTime?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asgard-service-context.d.ts","sourceRoot":"","sources":["../../src/context/asgard-service-context.tsx"],"names":[],"mappings":"
|
|
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,iBAAiB,EACjB,cAAc,EACd,SAAS,EACT,SAAS,EAIV,MAAM,OAAO,CAAC;AACf,OAAO,EAGL,gBAAgB,EACjB,MAAM,WAAW,CAAC;AAGnB,UAAU,wBAAwB;IAChC,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,mDAS/B,CAAC;AAEH,UAAU,iCACR,SAAQ,iBAAiB,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC;IACzE,QAAQ,EAAE,SAAS,CAAC;IACpB,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,OAAO,CAAC,EAAE;QAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IACzC,YAAY,CAAC,EAAE,mBAAmB,EAAE,CAAC;CACtC;AAED,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,iCAAiC,GACvC,SAAS,CAsEX;AAED,wBAAgB,gBAAgB,IAAI,wBAAwB,CAE3D"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CSSProperties, PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface AsgardThemeContextValue {
|
|
4
|
+
chatbot: Pick<CSSProperties, 'width' | 'height' | 'maxWidth' | 'minWidth' | 'maxHeight' | 'minHeight' | 'backgroundColor' | 'borderColor' | 'borderRadius'> & {
|
|
5
|
+
contentMaxWidth?: CSSProperties['maxWidth'];
|
|
6
|
+
};
|
|
7
|
+
botMessage: Pick<CSSProperties, 'color' | 'backgroundColor'>;
|
|
8
|
+
userMessage: Pick<CSSProperties, 'color' | 'backgroundColor'>;
|
|
9
|
+
}
|
|
10
|
+
export declare const defaultAsgardThemeContextValue: AsgardThemeContextValue;
|
|
11
|
+
export declare const AsgardThemeContext: import('react').Context<AsgardThemeContextValue>;
|
|
12
|
+
export declare function AsgardThemeContextProvider(props: PropsWithChildren<{
|
|
13
|
+
fullScreen?: boolean;
|
|
14
|
+
theme?: Partial<AsgardThemeContextValue>;
|
|
15
|
+
}>): ReactNode;
|
|
16
|
+
export declare function useAsgardThemeContext(): AsgardThemeContextValue;
|
|
17
|
+
//# sourceMappingURL=asgard-theme-context.d.ts.map
|
|
@@ -0,0 +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,EAGV,MAAM,OAAO,CAAC;AAGf,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;KAC7C,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;CAC/D;AAED,eAAO,MAAM,8BAA8B,EAAE,uBAiB5C,CAAC;AAEF,eAAO,MAAM,kBAAkB,kDAE9B,CAAC;AAEF,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,iBAAiB,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAC;CAC1C,CAAC,GACD,SAAS,CAyBX;AAED,wBAAgB,qBAAqB,IAAI,uBAAuB,CAE/D"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { AsgardServiceClient,
|
|
1
|
+
import { AsgardServiceClient, Conversation, ConversationMessage } from '@asgard-js/core';
|
|
2
2
|
|
|
3
3
|
interface UseChannelProps {
|
|
4
4
|
client: AsgardServiceClient | null;
|
|
5
5
|
customChannelId: string;
|
|
6
|
+
customMessageId?: string;
|
|
6
7
|
initMessages?: ConversationMessage[];
|
|
7
|
-
|
|
8
|
-
showDebugMessage?: boolean;
|
|
9
|
-
};
|
|
10
|
-
onResetChannelInit?: (event: SseResponse<EventType.INIT>) => void;
|
|
8
|
+
showDebugMessage?: boolean;
|
|
11
9
|
}
|
|
12
10
|
export interface UseChannelReturn {
|
|
11
|
+
isOpen: boolean;
|
|
12
|
+
isResetting: boolean;
|
|
13
13
|
isConnecting: boolean;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
conversation: Conversation | null;
|
|
15
|
+
sendMessage?: (text: string) => void;
|
|
16
|
+
resetChannel?: () => void;
|
|
17
|
+
closeChannel?: () => void;
|
|
17
18
|
}
|
|
18
19
|
export declare function useChannel(props: UseChannelProps): UseChannelReturn;
|
|
19
20
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-channel.d.ts","sourceRoot":"","sources":["../../src/hooks/use-channel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,
|
|
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,EACpB,MAAM,iBAAiB,CAAC;AAGzB,UAAU,eAAe;IACvB,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,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;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,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,gBAAgB,CA6GnE"}
|