@asgard-js/react 0.0.1 → 0.0.3

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.
Files changed (35) hide show
  1. package/dist/components/chatbot/chatbot-body.d.ts.map +1 -1
  2. package/dist/components/chatbot/chatbot-footer.d.ts.map +1 -1
  3. package/dist/components/chatbot/chatbot-header.d.ts +5 -1
  4. package/dist/components/chatbot/chatbot-header.d.ts.map +1 -1
  5. package/dist/components/chatbot/chatbot.d.ts +8 -3
  6. package/dist/components/chatbot/chatbot.d.ts.map +1 -1
  7. package/dist/components/chatbot/profile-icon.d.ts +8 -0
  8. package/dist/components/chatbot/profile-icon.d.ts.map +1 -0
  9. package/dist/components/conversation-message-renderer/conversation-message-renderer.d.ts +1 -1
  10. package/dist/components/conversation-message-renderer/conversation-message-renderer.d.ts.map +1 -1
  11. package/dist/components/templates/avatar/avatar.d.ts.map +1 -1
  12. package/dist/components/templates/bot-typing-box/bot-typing-box.d.ts +6 -1
  13. package/dist/components/templates/bot-typing-box/bot-typing-box.d.ts.map +1 -1
  14. package/dist/components/templates/button-template/button-template.d.ts +1 -1
  15. package/dist/components/templates/button-template/button-template.d.ts.map +1 -1
  16. package/dist/components/templates/carousel-template/carousel-template.d.ts +1 -1
  17. package/dist/components/templates/carousel-template/carousel-template.d.ts.map +1 -1
  18. package/dist/components/templates/hint-template/hint-template.d.ts +1 -1
  19. package/dist/components/templates/hint-template/hint-template.d.ts.map +1 -1
  20. package/dist/components/templates/quick-replies/quick-replies.d.ts.map +1 -1
  21. package/dist/components/templates/text-template/text-template.d.ts +1 -1
  22. package/dist/components/templates/text-template/text-template.d.ts.map +1 -1
  23. package/dist/context/asgard-service-context.d.ts +13 -5
  24. package/dist/context/asgard-service-context.d.ts.map +1 -1
  25. package/dist/hooks/index.d.ts +0 -1
  26. package/dist/hooks/index.d.ts.map +1 -1
  27. package/dist/hooks/use-channel.d.ts +10 -20
  28. package/dist/hooks/use-channel.d.ts.map +1 -1
  29. package/dist/index.js +391 -344
  30. package/dist/style.css +1 -1
  31. package/package.json +1 -1
  32. package/dist/components/message-box/message-box.d.ts +0 -9
  33. package/dist/components/message-box/message-box.d.ts.map +0 -1
  34. package/dist/hooks/use-chatbot-typing.d.ts +0 -11
  35. package/dist/hooks/use-chatbot-typing.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"chatbot-body.d.ts","sourceRoot":"","sources":["../../../src/components/chatbot/chatbot-body.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAM7C,wBAAgB,WAAW,IAAI,SAAS,CAmBvC"}
1
+ {"version":3,"file":"chatbot-body.d.ts","sourceRoot":"","sources":["../../../src/components/chatbot/chatbot-body.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAM7C,wBAAgB,WAAW,IAAI,SAAS,CA0BvC"}
@@ -1 +1 @@
1
- {"version":3,"file":"chatbot-footer.d.ts","sourceRoot":"","sources":["../../../src/components/chatbot/chatbot-footer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,SAAS,EAGV,MAAM,OAAO,CAAC;AAIf,wBAAgB,aAAa,IAAI,SAAS,CAkCzC"}
1
+ {"version":3,"file":"chatbot-footer.d.ts","sourceRoot":"","sources":["../../../src/components/chatbot/chatbot-footer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,SAAS,EAGV,MAAM,OAAO,CAAC;AAIf,wBAAgB,aAAa,IAAI,SAAS,CAiDzC"}
@@ -1,4 +1,8 @@
1
1
  import { ReactNode } from 'react';
2
2
 
3
- export declare function ChatbotHeader(): ReactNode;
3
+ interface ChatbotHeaderProps {
4
+ title: string;
5
+ }
6
+ export declare function ChatbotHeader(props: ChatbotHeaderProps): ReactNode;
7
+ export {};
4
8
  //# sourceMappingURL=chatbot-header.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chatbot-header.d.ts","sourceRoot":"","sources":["../../../src/components/chatbot/chatbot-header.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,wBAAgB,aAAa,IAAI,SAAS,CAEzC"}
1
+ {"version":3,"file":"chatbot-header.d.ts","sourceRoot":"","sources":["../../../src/components/chatbot/chatbot-header.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKlC,UAAU,kBAAkB;IAC1B,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,SAAS,CAgBlE"}
@@ -1,11 +1,16 @@
1
- import { ConversationMessage } from '../../hooks';
2
- import { ClientConfig } from '@asgard-js/core';
1
+ import { ClientConfig, ConversationMessage } from '@asgard-js/core';
3
2
  import { ReactNode } from 'react';
4
3
 
5
4
  interface ChatbotProps {
5
+ title: string;
6
6
  config: ClientConfig;
7
7
  customChannelId: string;
8
- initConversation?: ConversationMessage[];
8
+ initMessages?: ConversationMessage[];
9
+ fullScreen?: boolean;
10
+ avatar?: string;
11
+ options?: {
12
+ showDebugMessage?: boolean;
13
+ };
9
14
  }
10
15
  export declare function Chatbot(props: ChatbotProps): ReactNode;
11
16
  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,MAAM,iBAAiB,CAAC;AAM/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEhD,UAAU,YAAY;IACpB,MAAM,EAAE,YAAY,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,mBAAmB,EAAE,CAAC;CAC1C;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,CAetD"}
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;AAQpE,UAAU,YAAY;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,YAAY,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACrC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE;QAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CAC1C;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,CA4BtD"}
@@ -0,0 +1,8 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ interface ProfileIconProps {
4
+ avatar?: string;
5
+ }
6
+ export declare function ProfileIcon(props: ProfileIconProps): ReactNode;
7
+ export {};
8
+ //# sourceMappingURL=profile-icon.d.ts.map
@@ -0,0 +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;AAElC,UAAU,gBAAgB;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,SAAS,CA+C9D"}
@@ -1,4 +1,4 @@
1
- import { ConversationMessage } from '../../hooks';
1
+ import { ConversationMessage } from '@asgard-js/core';
2
2
  import { ReactNode } from 'react';
3
3
 
4
4
  interface ConversationMessageRendererProps {
@@ -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,EAAE,MAAM,WAAW,CAAC;AAShD,UAAU,gCAAgC;IACxC,mBAAmB,EAAE,mBAAmB,CAAC;CAC1C;AAED,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,gCAAgC,GACtC,SAAS,CAqBX"}
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;AAQ3E,UAAU,gCAAgC;IACxC,mBAAmB,EAAE,mBAAmB,CAAC;CAC1C;AAED,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,gCAAgC,GACtC,SAAS,CAqBX"}
@@ -1 +1 @@
1
- {"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/avatar/avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,wBAAgB,MAAM,IAAI,SAAS,CAqBlC"}
1
+ {"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/avatar/avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIlC,wBAAgB,MAAM,IAAI,SAAS,CA0BlC"}
@@ -1,4 +1,9 @@
1
+ import { ConversationBotMessage } from '@asgard-js/core';
1
2
  import { ReactNode } from 'react';
2
3
 
3
- export declare function BotTypingBox(): ReactNode;
4
+ interface BotTypingBoxProps {
5
+ typingMessage: ConversationBotMessage;
6
+ }
7
+ export declare function BotTypingBox(props: BotTypingBoxProps): ReactNode;
8
+ export {};
4
9
  //# sourceMappingURL=bot-typing-box.d.ts.map
@@ -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;AAQ/C,wBAAgB,YAAY,IAAI,SAAS,CA4BxC"}
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;AAO/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAGzD,UAAU,iBAAiB;IACzB,aAAa,EAAE,sBAAsB,CAAC;CACvC;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CA+BhE"}
@@ -1,5 +1,5 @@
1
- import { ConversationBotMessage } from '../../../hooks';
2
1
  import { ReactNode } from 'react';
2
+ import { ConversationBotMessage } from '@asgard-js/core';
3
3
 
4
4
  interface ButtonTemplateProps {
5
5
  conversationMessage: ConversationBotMessage;
@@ -1 +1 @@
1
- {"version":3,"file":"button-template.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/button-template/button-template.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAKnD,UAAU,mBAAmB;IAC3B,mBAAmB,EAAE,sBAAsB,CAAC;CAC7C;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,SAAS,CAiBpE"}
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;AAKlC,UAAU,mBAAmB;IAC3B,mBAAmB,EAAE,sBAAsB,CAAC;CAC7C;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,SAAS,CAiBpE"}
@@ -1,4 +1,4 @@
1
- import { ConversationBotMessage } from '../../../hooks';
1
+ import { ConversationBotMessage } from '@asgard-js/core';
2
2
  import { ReactNode } from 'react';
3
3
 
4
4
  interface CarouselTemplateProps {
@@ -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;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAQnD,UAAU,qBAAqB;IAC7B,mBAAmB,EAAE,sBAAsB,CAAC;CAC7C;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,SAAS,CAiBxE"}
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;AAGzB,UAAU,qBAAqB;IAC7B,mBAAmB,EAAE,sBAAsB,CAAC;CAC7C;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,SAAS,CAiBxE"}
@@ -1,4 +1,4 @@
1
- import { ConversationMessage } from '../../../hooks';
1
+ import { ConversationMessage } from '@asgard-js/core';
2
2
  import { ReactNode } from 'react';
3
3
 
4
4
  interface HintTemplateProps {
@@ -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;AAElC,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAIhD,UAAU,iBAAiB;IACzB,mBAAmB,EAAE,mBAAmB,CAAC;CAC1C;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAehE"}
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,mBAAmB,EAAE,mBAAmB,CAAC;CAC1C;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAehE"}
@@ -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;AAI/C,UAAU,iBAAiB;IACzB,YAAY,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAClC;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CA6BhE"}
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;AAI/C,UAAU,iBAAiB;IACzB,YAAY,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAClC;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CA8BhE"}
@@ -1,4 +1,4 @@
1
- import { ConversationMessage } from '../../../hooks';
1
+ import { ConversationMessage } from '@asgard-js/core';
2
2
  import { ReactNode } from 'react';
3
3
 
4
4
  interface TextTemplateProps {
@@ -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,WAAW,CAAC;AAMhD,UAAU,iBAAiB;IACzB,mBAAmB,EAAE,mBAAmB,CAAC;CAC1C;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CA2BhE"}
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;AAMtD,UAAU,iBAAiB;IACzB,mBAAmB,EAAE,mBAAmB,CAAC;CAC1C;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CA2BhE"}
@@ -1,20 +1,28 @@
1
- import { ConversationMessage, UseChannelReturn, UseChatbotTypingReturn } from '../hooks';
1
+ import { UseChannelReturn } from '../hooks';
2
2
  import { DetailedHTMLProps, HTMLAttributes, ReactNode, RefObject } from 'react';
3
- import { AsgardServiceClient, ClientConfig } from '@asgard-js/core';
3
+ import { AsgardServiceClient, ClientConfig, ConversationBotMessage, ConversationMessage } from '@asgard-js/core';
4
4
 
5
- interface AsgardServiceContextType extends Pick<UseChatbotTypingReturn, 'isTyping' | 'displayText'>, Pick<UseChannelReturn, 'conversation' | 'sendMessage'> {
5
+ interface AsgardServiceContextType {
6
+ avatar?: string;
6
7
  client: AsgardServiceClient | null;
8
+ isConnecting: boolean;
9
+ messages: Map<string, ConversationMessage> | null;
10
+ typingMessages: Map<string, ConversationBotMessage> | null;
7
11
  messageBoxBottomRef: RefObject<HTMLDivElement>;
8
- isConnectionProcessing: boolean;
12
+ sendMessage: UseChannelReturn['sendMessage'];
9
13
  }
10
14
  export declare const AsgardServiceContext: import('react').Context<AsgardServiceContextType>;
11
15
  interface AsgardServiceContextProviderProps extends DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
12
16
  children: ReactNode;
17
+ avatar?: string;
13
18
  config: ClientConfig;
14
19
  customChannelId: string;
15
20
  customMessageId?: string;
16
21
  delayTime?: number;
17
- initConversation?: ConversationMessage[];
22
+ options?: {
23
+ showDebugMessage?: boolean;
24
+ };
25
+ initMessages?: ConversationMessage[];
18
26
  }
19
27
  export declare function AsgardServiceContextProvider(props: AsgardServiceContextProviderProps): ReactNode;
20
28
  export declare function useAsgardContext(): AsgardServiceContextType;
@@ -1 +1 @@
1
- {"version":3,"file":"asgard-service-context.d.ts","sourceRoot":"","sources":["../../src/context/asgard-service-context.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAEL,iBAAiB,EACjB,cAAc,EACd,SAAS,EACT,SAAS,EAIV,MAAM,OAAO,CAAC;AACf,OAAO,EACL,mBAAmB,EAGnB,gBAAgB,EAEhB,sBAAsB,EACvB,MAAM,WAAW,CAAC;AAEnB,UAAU,wBACR,SAAQ,IAAI,CAAC,sBAAsB,EAAE,UAAU,GAAG,aAAa,CAAC,EAC9D,IAAI,CAAC,gBAAgB,EAAE,cAAc,GAAG,aAAa,CAAC;IACxD,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACnC,mBAAmB,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;IAC/C,sBAAsB,EAAE,OAAO,CAAC;CACjC;AAED,eAAO,MAAM,oBAAoB,mDAQ/B,CAAC;AAEH,UAAU,iCACR,SAAQ,iBAAiB,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC;IACzE,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,YAAY,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,mBAAmB,EAAE,CAAC;CAC1C;AAED,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,iCAAiC,GACvC,SAAS,CAqDX;AAED,wBAAgB,gBAAgB,IAAI,wBAAwB,CAE3D"}
1
+ {"version":3,"file":"asgard-service-context.d.ts","sourceRoot":"","sources":["../../src/context/asgard-service-context.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,sBAAsB,EACtB,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;AAEnB,UAAU,wBAAwB;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACnC,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,GAAG,IAAI,CAAC;IAClD,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,sBAAsB,CAAC,GAAG,IAAI,CAAC;IAC3D,mBAAmB,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;IAC/C,WAAW,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC;CAC9C;AAED,eAAO,MAAM,oBAAoB,mDAQ/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,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,CA0CX;AAED,wBAAgB,gBAAgB,IAAI,wBAAwB,CAE3D"}
@@ -1,5 +1,4 @@
1
1
  export * from './use-asgard-service-client';
2
2
  export * from './use-channel';
3
- export * from './use-chatbot-typing';
4
3
  export * from './use-debounce';
5
4
  //# 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,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,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"}
@@ -1,28 +1,18 @@
1
- import { UseChatbotTypingReturn } from './use-chatbot-typing';
2
- import { AsgardServiceClient, EventType, Message, SSEResponse } from '@asgard-js/core';
1
+ import { AsgardServiceClient, ConversationBotMessage, ConversationMessage, EventType, SseResponse } from '@asgard-js/core';
3
2
 
4
- export type ConversationUserMessage = {
5
- type: 'user';
6
- customMessageId?: string;
7
- text: string;
8
- time: Date;
9
- };
10
- export type ConversationBotMessage = {
11
- type: 'bot';
12
- eventType: EventType;
13
- message: Message;
14
- time: Date;
15
- };
16
- export type ConversationMessage = ConversationUserMessage | ConversationBotMessage;
17
- interface UseChannelProps extends Pick<UseChatbotTypingReturn, 'startTyping' | 'onTyping' | 'stopTyping'> {
3
+ interface UseChannelProps {
18
4
  client: AsgardServiceClient | null;
19
5
  customChannelId: string;
20
- initConversation?: ConversationMessage[];
21
- onResetChannelInit?: (event: SSEResponse<EventType.INIT>) => void;
6
+ initMessages?: ConversationMessage[];
7
+ options?: {
8
+ showDebugMessage?: boolean;
9
+ };
10
+ onResetChannelInit?: (event: SseResponse<EventType.INIT>) => void;
22
11
  }
23
12
  export interface UseChannelReturn {
24
- conversation: ConversationMessage[];
25
- isConnectionProcessing: boolean;
13
+ isConnecting: boolean;
14
+ messages: Map<string, ConversationMessage> | null;
15
+ typingMessages: Map<string, ConversationBotMessage> | null;
26
16
  sendMessage: (text: string, customMessageId?: string) => void;
27
17
  }
28
18
  export declare function useChannel(props: UseChannelProps): UseChannelReturn;
@@ -1 +1 @@
1
- {"version":3,"file":"use-channel.d.ts","sourceRoot":"","sources":["../../src/hooks/use-channel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,SAAS,EAET,OAAO,EACP,WAAW,EACZ,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,KAAK,CAAC;IACZ,SAAS,EAAE,SAAS,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,IAAI,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAC3B,uBAAuB,GACvB,sBAAsB,CAAC;AAE3B,UAAU,eACR,SAAQ,IAAI,CACV,sBAAsB,EACtB,aAAa,GAAG,UAAU,GAAG,YAAY,CAC1C;IACD,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACnC,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACzC,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;CACnE;AAED,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,mBAAmB,EAAE,CAAC;IACpC,sBAAsB,EAAE,OAAO,CAAC;IAChC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/D;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,gBAAgB,CA+GnE"}
1
+ {"version":3,"file":"use-channel.d.ts","sourceRoot":"","sources":["../../src/hooks/use-channel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EAEnB,sBAAsB,EACtB,mBAAmB,EACnB,SAAS,EACT,WAAW,EACZ,MAAM,iBAAiB,CAAC;AAGzB,UAAU,eAAe;IACvB,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACnC,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACrC,OAAO,CAAC,EAAE;QAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IACzC,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;CACnE;AAED,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,GAAG,IAAI,CAAC;IAClD,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,sBAAsB,CAAC,GAAG,IAAI,CAAC;IAC3D,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/D;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,gBAAgB,CA+EnE"}