@developer.notchatbot/webchat 1.3.0 → 1.4.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.
- package/dist/config/endpoints.d.ts +5 -5
- package/dist/convex/_generated/api.d.ts +24 -0
- package/dist/utils/conversation.d.ts +0 -7
- package/dist/utils/convex.d.ts +28 -0
- package/dist/utils/device.d.ts +10 -0
- package/dist/utils/messaging.d.ts +2 -0
- package/dist/webchat-bundle.min.js +6529 -12029
- package/dist/webchat-bundle.min.umd.cjs +54 -81
- package/package.json +53 -53
- package/dist/utils/ably.d.ts +0 -29
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export interface EndpointConfig {
|
|
2
2
|
baseUrl: string;
|
|
3
3
|
chatEndpoint: string;
|
|
4
|
-
conversationEndpoint: string;
|
|
5
4
|
uploadEndpoint: string;
|
|
6
5
|
rateEndpoint: string;
|
|
6
|
+
realtimeUrl: string;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Detecta si estamos en ambiente de desarrollo
|
|
@@ -17,10 +17,6 @@ export declare function getEndpointConfig(): EndpointConfig;
|
|
|
17
17
|
* Obtiene el endpoint de chat
|
|
18
18
|
*/
|
|
19
19
|
export declare function getChatEndpoint(): string;
|
|
20
|
-
/**
|
|
21
|
-
* Obtiene el endpoint de conversación
|
|
22
|
-
*/
|
|
23
|
-
export declare function getConversationEndpoint(): string;
|
|
24
20
|
/**
|
|
25
21
|
* Obtiene el endpoint de upload
|
|
26
22
|
*/
|
|
@@ -33,3 +29,7 @@ export declare function getRateEndpoint(): string;
|
|
|
33
29
|
* Obtiene la URL base según el ambiente
|
|
34
30
|
*/
|
|
35
31
|
export declare function getBaseUrl(): string;
|
|
32
|
+
/**
|
|
33
|
+
* Obtiene la URL del servicio de tiempo real según el ambiente
|
|
34
|
+
*/
|
|
35
|
+
export declare function getRealtimeEndpoint(): string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Webchat API stub for client-side usage
|
|
3
|
+
*
|
|
4
|
+
* This file provides the API references for Convex queries.
|
|
5
|
+
* The actual query paths are resolved at runtime by the Convex client.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* API object with webchat queries
|
|
9
|
+
* The query names map to the Convex backend functions
|
|
10
|
+
*/
|
|
11
|
+
export declare const api: {
|
|
12
|
+
readonly webchat: {
|
|
13
|
+
readonly get: {
|
|
14
|
+
readonly getConversationWithMessages: any;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export declare const internal: {
|
|
19
|
+
readonly webchat: {
|
|
20
|
+
readonly get: {
|
|
21
|
+
readonly getConversationWithMessages: any;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import { Message } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Fetches conversation history from the API
|
|
4
|
-
* @param conversationId The conversation ID to fetch history for
|
|
5
|
-
* @param apiKey The API key for authentication
|
|
6
|
-
* @returns Promise that resolves to conversation data or null if failed
|
|
7
|
-
*/
|
|
8
|
-
export declare const fetchConversationHistory: (conversationId: string, apiKey: string) => Promise<any>;
|
|
9
2
|
/**
|
|
10
3
|
* Transforms API messages to WebChat message format
|
|
11
4
|
* @param apiMessages Array of messages from the API
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ConvexReactClient } from 'convex/react';
|
|
2
|
+
import { Message } from '../types';
|
|
3
|
+
export interface ConvexConnectionData {
|
|
4
|
+
client: ConvexReactClient;
|
|
5
|
+
unsubscribe: (() => void) | null;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Initializes Convex connection for real-time subscriptions
|
|
9
|
+
* @param realtimeEndpoint Realtime service deployment URL
|
|
10
|
+
* @param chatbotUid Chatbot UID (API Key)
|
|
11
|
+
* @param conversationId Conversation ID
|
|
12
|
+
* @param onMessage Callback for new messages
|
|
13
|
+
* @param onChatbotToggle Callback for chatbot activation changes
|
|
14
|
+
* @returns Promise that resolves to Convex connection data
|
|
15
|
+
*/
|
|
16
|
+
export declare const initializeConvexConnection: (realtimeEndpoint: string, _chatbotUid: string, conversationId: string, onMessage: (message: Message) => void, onChatbotToggle?: (chatbotActivated: boolean) => void) => Promise<ConvexConnectionData>;
|
|
17
|
+
/**
|
|
18
|
+
* Fetches initial conversation data with messages from Convex
|
|
19
|
+
* @param realtimeEndpoint Realtime service deployment URL
|
|
20
|
+
* @param conversationId Conversation ID
|
|
21
|
+
* @returns Promise that resolves to conversation data with messages
|
|
22
|
+
*/
|
|
23
|
+
export declare const fetchConversationFromConvex: (realtimeEndpoint: string, conversationId: string) => Promise<any>;
|
|
24
|
+
/**
|
|
25
|
+
* Closes Convex connection safely
|
|
26
|
+
* @param connectionData Convex connection data to close
|
|
27
|
+
*/
|
|
28
|
+
export declare const closeConvexConnection: (connectionData: ConvexConnectionData | null) => void;
|
package/dist/utils/device.d.ts
CHANGED
|
@@ -17,3 +17,13 @@ export declare const getDeviceType: () => "mobile" | "desktop";
|
|
|
17
17
|
* @returns Cleanup function to remove the listener
|
|
18
18
|
*/
|
|
19
19
|
export declare const onDeviceTypeChange: (callback: (deviceType: "mobile" | "desktop") => void) => (() => void);
|
|
20
|
+
/**
|
|
21
|
+
* Gets the browser's language preference
|
|
22
|
+
* @returns Browser language code (e.g., 'en-US', 'es-ES')
|
|
23
|
+
*/
|
|
24
|
+
export declare const getBrowserLanguage: () => string;
|
|
25
|
+
/**
|
|
26
|
+
* Gets the browser's region/location information based on timezone and locale
|
|
27
|
+
* @returns Region string in format "Country/City" (e.g., "US/New_York", "AR/Buenos_Aires")
|
|
28
|
+
*/
|
|
29
|
+
export declare const getBrowserRegion: () => string;
|