@developer.notchatbot/webchat 1.0.8 → 1.0.9

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,4 @@
1
+ import { default as React } from 'react';
2
+ import { EmbedChatProps } from '../../types';
3
+ declare const EmbedChat: React.FC<EmbedChatProps>;
4
+ export default EmbedChat;
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { EmbedChatFooterProps } from '../../types';
3
+ declare const EmbedChatFooter: React.FC<EmbedChatFooterProps>;
4
+ export default EmbedChatFooter;
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { EmbedChatHeaderProps } from '../../types';
3
+ declare const EmbedChatHeader: React.FC<EmbedChatHeaderProps>;
4
+ export default EmbedChatHeader;
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { EmbedChatWindowProps } from '../../types';
3
+ declare const EmbedChatWindow: React.FC<EmbedChatWindowProps>;
4
+ export default EmbedChatWindow;
@@ -2,7 +2,7 @@ export declare const COMPANY_CONFIG: {
2
2
  readonly apiKey: "";
3
3
  readonly primaryColor: "#111111";
4
4
  readonly avatar: "";
5
- readonly title: "ChatBot - NotChatBot";
5
+ readonly title: "NotChatBot";
6
6
  readonly placeholder: "Escribe tu mensaje...";
7
7
  readonly initialMessage: "¡Hola! ¿En qué puedo ayudarte?";
8
8
  readonly position: "bottom-right";
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
- import { WebChatAPI } from './types';
1
+ import { WebChatAPI, EmbedChatAPI } from './types';
2
2
  declare const WebChat: WebChatAPI;
3
- export default WebChat;
3
+ declare const EmbedChatAPI: EmbedChatAPI;
4
+ export { WebChat, EmbedChatAPI };
package/dist/types.d.ts CHANGED
@@ -11,7 +11,6 @@ export interface WebChatConfig {
11
11
  avatar?: string;
12
12
  apiKey?: string;
13
13
  position?: 'bottom-right' | 'bottom-left';
14
- conversationId?: string;
15
14
  initialMessage?: string;
16
15
  closeButtonIcon?: 'default' | 'text' | 'custom';
17
16
  closeButtonText?: string;
@@ -21,12 +20,57 @@ export interface WebChatConfig {
21
20
  mobile?: WebChatPositionConfig;
22
21
  desktop?: WebChatPositionConfig;
23
22
  }
23
+ export interface EmbedChatConfig {
24
+ elementId: string;
25
+ title?: string;
26
+ placeholder?: string;
27
+ primaryColor?: string;
28
+ avatar?: string;
29
+ apiKey?: string;
30
+ initialMessage?: string;
31
+ footerText?: string;
32
+ width?: string | number;
33
+ height?: string | number;
34
+ maxWidth?: string | number;
35
+ maxHeight?: string | number;
36
+ minWidth?: string | number;
37
+ minHeight?: string | number;
38
+ showHeader?: boolean;
39
+ showFooter?: boolean;
40
+ borderRadius?: string | number;
41
+ border?: string;
42
+ boxShadow?: string;
43
+ }
44
+ export interface EmbedChatProps {
45
+ config: EmbedChatConfig;
46
+ }
47
+ export interface EmbedChatWindowProps {
48
+ config: EmbedChatConfig;
49
+ messages: Message[];
50
+ onSendMessage: (message: string) => void;
51
+ isLoading?: boolean;
52
+ isAiTyping?: boolean;
53
+ }
54
+ export interface EmbedChatHeaderProps {
55
+ title: string;
56
+ primaryColor?: string;
57
+ avatar?: string;
58
+ }
59
+ export interface EmbedChatFooterProps {
60
+ footerText?: string;
61
+ primaryColor?: string;
62
+ }
63
+ export interface EmbedChatInstance {
64
+ destroy: () => void;
65
+ updateConfig: (newConfig: Partial<EmbedChatConfig>) => void;
66
+ }
24
67
  export interface Message {
25
68
  id: string;
26
69
  text: string;
27
70
  sender: 'user' | 'bot';
28
71
  timestamp: Date | string;
29
72
  conversationId?: string;
73
+ type: string;
30
74
  }
31
75
  export interface ChatBotProps {
32
76
  config: WebChatConfig;
@@ -89,3 +133,6 @@ export interface WebChatInstance {
89
133
  export interface WebChatAPI {
90
134
  initialize: (config?: Partial<WebChatConfig>) => WebChatInstance | null;
91
135
  }
136
+ export interface EmbedChatAPI {
137
+ initialize: (config: EmbedChatConfig) => EmbedChatInstance | null;
138
+ }
@@ -23,12 +23,12 @@ export declare const createFallbackMessage: () => Message;
23
23
  * @param conversationId Conversation ID
24
24
  * @param messages Array of messages
25
25
  * @param config Chat configuration
26
- * @param userIP User's IP address
26
+ * @param sessionId User's session identifier
27
27
  * @returns API payload
28
28
  */
29
29
  export declare const buildMessagePayload: (conversationId: string, messages: Message[], config: {
30
30
  apiKey: string;
31
- }, userIP: string) => SendMessagePayload;
31
+ }, sessionId: string) => SendMessagePayload;
32
32
  /**
33
33
  * Sends messages to the chat API
34
34
  * @param payload Message payload
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Fetches the user's IP address from an external service
3
- * @returns Promise that resolves to the user's IP address or a fallback identifier
2
+ * Generates a unique session identifier without making network requests
3
+ * @returns Promise that resolves to a unique session identifier
4
4
  */
5
- export declare const getUserIP: () => Promise<string>;
5
+ export declare const getSessionId: () => Promise<string>;