@developer.notchatbot/webchat 1.1.7 → 1.2.0

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.
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ interface ConversationRatingProps {
3
+ onRate?: (rating: number) => void;
4
+ conversationId?: string;
5
+ }
6
+ declare const ConversationRating: React.FC<ConversationRatingProps>;
7
+ export default ConversationRating;
@@ -2,6 +2,8 @@ export interface EndpointConfig {
2
2
  baseUrl: string;
3
3
  chatEndpoint: string;
4
4
  conversationEndpoint: string;
5
+ uploadEndpoint: string;
6
+ rateEndpoint: string;
5
7
  }
6
8
  /**
7
9
  * Detecta si estamos en ambiente de desarrollo
@@ -19,6 +21,14 @@ export declare function getChatEndpoint(): string;
19
21
  * Obtiene el endpoint de conversación
20
22
  */
21
23
  export declare function getConversationEndpoint(): string;
24
+ /**
25
+ * Obtiene el endpoint de upload
26
+ */
27
+ export declare function getUploadEndpoint(): string;
28
+ /**
29
+ * Obtiene el endpoint de rating
30
+ */
31
+ export declare function getRateEndpoint(): string;
22
32
  /**
23
33
  * Obtiene la URL base según el ambiente
24
34
  */
package/dist/types.d.ts CHANGED
@@ -56,15 +56,22 @@ export interface EmbedChatConfig {
56
56
  footerColor?: string;
57
57
  customCSS?: string;
58
58
  }
59
+ export interface FileWithBlobUrl {
60
+ url: string;
61
+ name: string;
62
+ type: string;
63
+ size?: number;
64
+ }
59
65
  export interface EmbedChatProps {
60
66
  config: EmbedChatConfig;
61
67
  }
62
68
  export interface EmbedChatWindowProps {
63
69
  config: EmbedChatConfig;
64
70
  messages: Message[];
65
- onSendMessage: (message: string) => void;
71
+ onSendMessage: (message: string, files?: FileWithBlobUrl[]) => void;
66
72
  isLoading?: boolean;
67
73
  isAiTyping?: boolean;
74
+ chatbotActivated?: boolean;
68
75
  }
69
76
  export interface EmbedChatHeaderProps {
70
77
  title: string;
@@ -89,6 +96,7 @@ export interface Message {
89
96
  timestamp: Date | string;
90
97
  conversationId?: string;
91
98
  type: string;
99
+ metaContent?: string;
92
100
  }
93
101
  export interface ChatBotProps {
94
102
  config: WebChatConfig;
@@ -108,13 +116,17 @@ export interface ChatWindowProps {
108
116
  onClose: () => void;
109
117
  config: WebChatConfig;
110
118
  messages: Message[];
111
- onSendMessage: (message: string) => void;
119
+ onSendMessage: (message: string, files?: FileWithBlobUrl[]) => void;
112
120
  isLoading?: boolean;
113
121
  isAiTyping?: boolean;
114
122
  position?: 'bottom-right' | 'bottom-left';
115
123
  marginBottom?: number;
116
124
  marginSide?: number;
117
125
  isMobile?: boolean;
126
+ chatbotActivated?: boolean;
127
+ isRated?: boolean;
128
+ onRatingChange?: (isRated: boolean) => void;
129
+ conversationId?: string;
118
130
  }
119
131
  export interface ChatHeaderProps {
120
132
  title: string;
@@ -131,6 +143,7 @@ export interface MessageListProps {
131
143
  avatar?: string;
132
144
  textColor?: string;
133
145
  bubbleUserColor?: string;
146
+ chatbotActivated?: boolean;
134
147
  }
135
148
  export interface MessageProps {
136
149
  message: Message;
@@ -139,11 +152,12 @@ export interface MessageProps {
139
152
  bubbleUserColor?: string;
140
153
  }
141
154
  export interface MessageInputProps {
142
- onSendMessage: (message: string) => void;
155
+ onSendMessage: (message: string, files?: FileWithBlobUrl[]) => void;
143
156
  placeholder?: string;
144
157
  primaryColor?: string;
145
158
  disabled?: boolean;
146
159
  input?: EmbedChatInputConfig;
160
+ apiKey?: string;
147
161
  }
148
162
  export interface TypingIndicatorProps {
149
163
  avatar?: string;
@@ -10,10 +10,11 @@ export interface AblyConnectionData {
10
10
  * @param chatbotUid Chatbot UID
11
11
  * @param conversationId Conversation ID
12
12
  * @param onMessage Callback for new messages
13
+ * @param onChatbotToggle Callback for chatbot activation changes
13
14
  * @param onConnectionChange Callback for connection status changes
14
15
  * @returns Promise that resolves to Ably connection data
15
16
  */
16
- export declare const initializeAblyConnection: (tokenDetails: any, chatbotUid: string, conversationId: string, onMessage: (message: Message) => void, onConnectionChange?: (status: string) => void) => Promise<AblyConnectionData>;
17
+ export declare const initializeAblyConnection: (tokenDetails: any, chatbotUid: string, conversationId: string, onMessage: (message: Message) => void, onChatbotToggle?: (chatbotActivated: boolean) => void, onConnectionChange?: (status: string) => void) => Promise<AblyConnectionData>;
17
18
  /**
18
19
  * Fetches Ably token from conversation endpoint
19
20
  * @param conversationId Conversation ID
@@ -0,0 +1,2 @@
1
+ export declare function encryptApiKey(apiKey: string): string;
2
+ export declare function decryptApiKey(encryptedKey: string): string;
@@ -12,6 +12,7 @@ export interface SendMessagePayload {
12
12
  messages: any[];
13
13
  };
14
14
  chatbotUid: string;
15
+ newMessages: any[];
15
16
  }
16
17
  /**
17
18
  * Creates a fallback bot message for error scenarios
@@ -21,12 +22,13 @@ export declare const createFallbackMessage: () => Message;
21
22
  /**
22
23
  * Builds the payload for sending messages to the API
23
24
  * @param conversationId Conversation ID
24
- * @param messages Array of messages
25
+ * @param messages Array of all messages
26
+ * @param newMessages Array of only new messages to be processed
25
27
  * @param config Chat configuration
26
28
  * @param sessionId User's session identifier
27
29
  * @returns API payload
28
30
  */
29
- export declare const buildMessagePayload: (conversationId: string, messages: Message[], config: {
31
+ export declare const buildMessagePayload: (conversationId: string, messages: Message[], newMessages: Message[], config: {
30
32
  apiKey: string;
31
33
  }, sessionId: string) => SendMessagePayload;
32
34
  /**