@asgard-js/react 0.0.21 → 0.0.23
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 +73 -28
- package/dist/components/chatbot/chatbot-body/chatbot-body.d.ts.map +1 -1
- package/dist/components/chatbot/chatbot-container/chatbot-container.d.ts +3 -1
- 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-header/chatbot-header.d.ts +1 -0
- package/dist/components/chatbot/chatbot-header/chatbot-header.d.ts.map +1 -1
- package/dist/components/chatbot/chatbot.d.ts +10 -3
- package/dist/components/chatbot/chatbot.d.ts.map +1 -1
- package/dist/components/templates/avatar/avatar.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-content.d.ts.map +1 -1
- package/dist/components/templates/template-box/template-box.d.ts +2 -0
- package/dist/components/templates/template-box/template-box.d.ts.map +1 -1
- package/dist/components/templates/text-template/bot-typing-box.d.ts.map +1 -1
- package/dist/components/templates/text-template/text-template.d.ts.map +1 -1
- package/dist/components/templates/time/time.d.ts.map +1 -1
- package/dist/context/asgard-app-initialization-context.d.ts +1 -1
- package/dist/context/asgard-app-initialization-context.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/hooks/index.d.ts +1 -0
- package/dist/hooks/index.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/hooks/use-deep-compare-memo.d.ts +7 -0
- package/dist/hooks/use-deep-compare-memo.d.ts.map +1 -0
- package/dist/index.js +16059 -15048
- package/dist/utils/extractors.d.ts +2 -0
- package/dist/utils/extractors.d.ts.map +1 -0
- package/dist/utils/is.d.ts +8 -0
- package/dist/utils/is.d.ts.map +1 -0
- 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
|
|
|
@@ -63,6 +102,7 @@ export default App;
|
|
|
63
102
|
- `onExecutionError?`: `(error: ErrorEventData) => void` - Error handler for execution errors
|
|
64
103
|
- `transformSsePayload?`: `(payload: FetchSsePayload) => FetchSsePayload` - SSE payload transformer
|
|
65
104
|
- **enableLoadConfigFromService?**: `boolean` - Enable loading configuration from service
|
|
105
|
+
- **maintainConnectionWhenClosed?**: `boolean` - Maintain connection when chat is closed, defaults to `false`
|
|
66
106
|
- **loadingComponent?**: `ReactNode` - Custom loading component
|
|
67
107
|
- **asyncInitializers?**: `Record<string, () => Promise<unknown>>` - Asynchronous initializers for app initialization before rendering any component. Good for loading data or other async operations as the initial state. It only works when `enableLoadConfigFromService` is set to `true`.
|
|
68
108
|
- **customChannelId**: `string` - Custom channel identifier for the chat session
|
|
@@ -74,11 +114,15 @@ export default App;
|
|
|
74
114
|
- **theme**: `Partial<AsgardThemeContextValue>` - Custom theme configuration
|
|
75
115
|
- **onReset**: `() => void` - Callback function when chat is reset
|
|
76
116
|
- **onClose**: `() => void` - Callback function when chat is closed
|
|
117
|
+
- **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.
|
|
118
|
+
- **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
119
|
|
|
78
120
|
### Theme Configuration
|
|
121
|
+
|
|
79
122
|
The theme configuration can be obtained from the bot provider metadata of `annotations` field and `theme` props.
|
|
80
123
|
|
|
81
124
|
The priority of themes is as follows (high to low):
|
|
125
|
+
|
|
82
126
|
1. Theme from props
|
|
83
127
|
2. Theme from annotations from bot provider metadata
|
|
84
128
|
3. Default theme
|
|
@@ -228,7 +272,7 @@ const defaultTheme = {
|
|
|
228
272
|
style: {},
|
|
229
273
|
},
|
|
230
274
|
},
|
|
231
|
-
}
|
|
275
|
+
};
|
|
232
276
|
```
|
|
233
277
|
|
|
234
278
|
### Usage Example
|
|
@@ -269,6 +313,7 @@ To develop the React package locally, follow these steps:
|
|
|
269
313
|
1. Clone the repository and navigate to the project root directory.
|
|
270
314
|
|
|
271
315
|
2. Install dependencies:
|
|
316
|
+
|
|
272
317
|
```sh
|
|
273
318
|
yarn install
|
|
274
319
|
```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatbot-body.d.ts","sourceRoot":"","sources":["../../../../src/components/chatbot/chatbot-body/chatbot-body.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAsB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"chatbot-body.d.ts","sourceRoot":"","sources":["../../../../src/components/chatbot/chatbot-body/chatbot-body.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAsB,MAAM,OAAO,CAAC;AAQtD,wBAAgB,WAAW,IAAI,SAAS,CAoCvC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { PropsWithChildren, ReactNode } from 'react';
|
|
1
|
+
import { PropsWithChildren, ReactNode, CSSProperties } from 'react';
|
|
2
2
|
|
|
3
3
|
interface ChatbotContainerProps extends PropsWithChildren {
|
|
4
|
+
className?: string;
|
|
5
|
+
style?: CSSProperties;
|
|
4
6
|
fullScreen?: boolean;
|
|
5
7
|
}
|
|
6
8
|
export declare function ChatbotContainer(props: ChatbotContainerProps): ReactNode;
|
|
@@ -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;
|
|
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,aAAa,EAAE,MAAM,OAAO,CAAC;AAO5E,UAAU,qBAAsB,SAAQ,iBAAiB;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,SAAS,CAmCxE"}
|
|
@@ -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,CAgHzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatbot-header.d.ts","sourceRoot":"","sources":["../../../../src/components/chatbot/chatbot-header/chatbot-header.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,SAAS,EAAwB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"chatbot-header.d.ts","sourceRoot":"","sources":["../../../../src/components/chatbot/chatbot-header/chatbot-header.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,SAAS,EAAwB,MAAM,OAAO,CAAC;AAS3E,UAAU,kBAAkB;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,SAAS,EAAE,CAAC;IAC5B,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,SAAS,CAqElE"}
|
|
@@ -1,24 +1,31 @@
|
|
|
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
|
-
import { ReactNode } from 'react';
|
|
4
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
5
5
|
|
|
6
6
|
interface ChatbotProps extends AsgardTemplateContextValue {
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: CSSProperties;
|
|
7
9
|
title: string;
|
|
8
10
|
customActions?: ReactNode[];
|
|
9
11
|
theme?: Partial<AsgardThemeContextValue>;
|
|
10
12
|
config: ClientConfig;
|
|
11
13
|
customChannelId: string;
|
|
12
14
|
initMessages?: ConversationMessage[];
|
|
15
|
+
onSseMessage?: AsgardServiceContextProviderProps['onSseMessage'];
|
|
13
16
|
fullScreen?: boolean;
|
|
14
17
|
avatar?: string;
|
|
15
18
|
botTypingPlaceholder?: string;
|
|
16
19
|
enableLoadConfigFromService?: boolean;
|
|
20
|
+
maintainConnectionWhenClosed?: boolean;
|
|
17
21
|
asyncInitializers?: Record<string, () => Promise<unknown>>;
|
|
18
22
|
onReset?: () => void;
|
|
19
23
|
onClose?: () => void;
|
|
20
24
|
loadingComponent?: ReactNode;
|
|
21
25
|
}
|
|
22
|
-
export
|
|
26
|
+
export interface ChatbotRef {
|
|
27
|
+
serviceContext?: AsgardServiceContextValue;
|
|
28
|
+
}
|
|
29
|
+
export declare const Chatbot: import('react').ForwardRefExoticComponent<ChatbotProps & import('react').RefAttributes<ChatbotRef>>;
|
|
23
30
|
export {};
|
|
24
31
|
//# 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,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3E,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,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,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,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,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,qGAsElB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAKxC,UAAU,WAAW;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,MAAM,8CAAgB,WAAW,KAAG,SAAS,CAkBxD,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;AAOlC,UAAU,mBAAmB;IAC3B,OAAO,EAAE,sBAAsB,CAAC;CACjC;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,SAAS,
|
|
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,CAyBpE"}
|
|
@@ -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;
|
|
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;AAKzB,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;AAKzB,UAAU,qBAAqB;IAC7B,OAAO,EAAE,sBAAsB,CAAC;CACjC;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,SAAS,
|
|
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,CA0BxE"}
|
|
@@ -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;AASzD,UAAU,kBAAkB;IAC1B,OAAO,EAAE,sBAAsB,CAAC;CACjC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,SAAS,
|
|
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,CAmDlE"}
|
|
@@ -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;
|
|
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;AAIzB,UAAU,iBAAiB;IACzB,OAAO,EAAE,mBAAmB,CAAC;CAC9B;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAuDhE"}
|
|
@@ -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;AAMzD,UAAU,kBAAkB;IAC1B,OAAO,EAAE,sBAAsB,CAAC;CACjC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,SAAS,
|
|
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,CA2ClE"}
|
|
@@ -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;AAM/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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-box-content.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/template-box/template-box-content.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"template-box-content.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/template-box/template-box-content.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMlC,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,YAAY,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACnC;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,GAAG,SAAS,CAiB5E"}
|
|
@@ -4,11 +4,13 @@ type TemplateBoxProps = {
|
|
|
4
4
|
type: 'user';
|
|
5
5
|
direction: 'horizontal';
|
|
6
6
|
children: ReactNode;
|
|
7
|
+
className?: string;
|
|
7
8
|
style?: CSSProperties;
|
|
8
9
|
} | {
|
|
9
10
|
type: 'bot';
|
|
10
11
|
direction: 'horizontal' | 'vertical';
|
|
11
12
|
children: ReactNode;
|
|
13
|
+
className?: string;
|
|
12
14
|
style?: CSSProperties;
|
|
13
15
|
};
|
|
14
16
|
export declare function TemplateBox(props: TemplateBoxProps): ReactNode;
|
|
@@ -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,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,
|
|
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,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,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,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC;AAEN,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,SAAS,CA2B9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bot-typing-box.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/text-template/bot-typing-box.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAgC,MAAM,OAAO,CAAC;AAS/E,UAAU,iBAAiB;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"bot-typing-box.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/text-template/bot-typing-box.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAgC,MAAM,OAAO,CAAC;AAS/E,UAAU,iBAAiB;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAkEhE"}
|
|
@@ -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,CA0EhE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/time/time.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKlC,UAAU,SAAS;IACjB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/time/time.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKlC,UAAU,SAAS;IACjB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAUhD"}
|
|
@@ -24,7 +24,7 @@ export declare const AsgardAppInitializationContext: React.Context<AsgardAppInit
|
|
|
24
24
|
export interface AsgardAppInitializationContextProviderProps {
|
|
25
25
|
enabled: boolean;
|
|
26
26
|
config: ClientConfig;
|
|
27
|
-
asyncInitializers
|
|
27
|
+
asyncInitializers?: AsyncInitializers;
|
|
28
28
|
loadingComponent?: React.ReactNode;
|
|
29
29
|
}
|
|
30
30
|
export declare const AsgardAppInitializationContextProvider: (props: PropsWithChildren<AsgardAppInitializationContextProviderProps>) => ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asgard-app-initialization-context.d.ts","sourceRoot":"","sources":["../../src/context/asgard-app-initialization-context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"asgard-app-initialization-context.d.ts","sourceRoot":"","sources":["../../src/context/asgard-app-initialization-context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAKZ,iBAAiB,EACjB,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAM/C,KAAK,iBAAiB,GAAG;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CACvC,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE;QACX,KAAK,EAAE;YACL,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YACjC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YACpC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;SACtC,CAAC;KACH,CAAC;CACH;AAED,MAAM,WAAW,mCAAmC;IAClD,IAAI,EAAE;QACJ,WAAW,CAAC,EAAE,WAAW,CAAC;KAC3B,CAAC;IACF,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,8BAA8B,oDAKvC,CAAC;AAEL,MAAM,WAAW,2CAA2C;IAC1D,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,YAAY,CAAC;IACrB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACpC;AAED,eAAO,MAAM,sCAAsC,UAC1C,iBAAiB,CAAC,2CAA2C,CAAC,KACpE,SA4EF,CAAC;AAEF,eAAO,MAAM,iCAAiC,QACxC,mCACwC,CAAC"}
|
|
@@ -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"}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -7,5 +7,6 @@ export * from './use-on-screen-keyboard-scroll-fix';
|
|
|
7
7
|
export * from './use-prevent-over-scrolling';
|
|
8
8
|
export * from './use-update-vh';
|
|
9
9
|
export * from './use-resize-observer';
|
|
10
|
+
export * from './use-deep-compare-memo';
|
|
10
11
|
export * from '../components/templates/text-template/use-markdown-renderer';
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kCAAkC,CAAC;AACjD,cAAc,qCAAqC,CAAC;AACpD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,8DAA8D,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kCAAkC,CAAC;AACjD,cAAc,qCAAqC,CAAC;AACpD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,8DAA8D,CAAC"}
|
|
@@ -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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useDeepCompareMemo: React hook that only recomputes the value when deps deeply change.
|
|
3
|
+
* @param factory - function to create the value
|
|
4
|
+
* @param deps - dependency array (deep compared)
|
|
5
|
+
*/
|
|
6
|
+
export declare function useDeepCompareMemo<T>(factory: () => T, deps: unknown[]): T;
|
|
7
|
+
//# sourceMappingURL=use-deep-compare-memo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-deep-compare-memo.d.ts","sourceRoot":"","sources":["../../src/hooks/use-deep-compare-memo.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,CAU1E"}
|