@nameless26/widget 0.1.2 → 0.1.4
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/EmailGate.d.ts +10 -0
- package/dist/MarkdownMessage.d.ts +3 -0
- package/dist/embed.iife.js +30 -255
- package/dist/index.cjs.js +22 -13
- package/dist/index.es.js +7828 -412
- package/dist/session.d.ts +4 -0
- package/dist/types.d.ts +15 -2
- package/dist/useChat.d.ts +1 -3
- package/package.json +1 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function getOrCreateSessionId(agentId: string): string;
|
|
2
|
+
export declare function readStoredToken(agentId: string): string | null;
|
|
3
|
+
export declare function storeToken(agentId: string, token: string, expiresAt: string): void;
|
|
4
|
+
export declare function clearStoredToken(agentId: string): void;
|
package/dist/types.d.ts
CHANGED
|
@@ -5,9 +5,12 @@ export interface ChatMessage {
|
|
|
5
5
|
}
|
|
6
6
|
export interface UseChatOptions {
|
|
7
7
|
agentId: string;
|
|
8
|
+
accessType?: string;
|
|
9
|
+
widgetToken: string | null;
|
|
10
|
+
sessionId: string | null;
|
|
8
11
|
baseUrl?: string;
|
|
9
12
|
agentCoreUrl?: string;
|
|
10
|
-
|
|
13
|
+
onSessionExpired?: () => void;
|
|
11
14
|
}
|
|
12
15
|
export type SseEvent = {
|
|
13
16
|
type: "start";
|
|
@@ -40,6 +43,16 @@ export interface ChatPanelProps {
|
|
|
40
43
|
primaryColor: string;
|
|
41
44
|
welcomeMessage: string;
|
|
42
45
|
onSend: (text: string) => void;
|
|
43
|
-
onReset: () => void;
|
|
44
46
|
onClose: () => void;
|
|
45
47
|
}
|
|
48
|
+
export interface WidgetConfig {
|
|
49
|
+
primaryColor?: string;
|
|
50
|
+
position?: 'bottom-right' | 'bottom-left';
|
|
51
|
+
welcomeMessage?: string;
|
|
52
|
+
agentName?: string;
|
|
53
|
+
}
|
|
54
|
+
export interface AgentConfig {
|
|
55
|
+
name: string;
|
|
56
|
+
accessType: "public" | "private";
|
|
57
|
+
widgetConfig: WidgetConfig;
|
|
58
|
+
}
|
package/dist/useChat.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { ChatMessage, UseChatOptions } from './types';
|
|
2
|
-
export declare function useChat({ agentId, baseUrl: BASE_URL, agentCoreUrl
|
|
2
|
+
export declare function useChat({ agentId, accessType, sessionId, widgetToken, baseUrl: BASE_URL, agentCoreUrl }: UseChatOptions): {
|
|
3
3
|
messages: ChatMessage[];
|
|
4
4
|
isLoading: boolean;
|
|
5
|
-
historyLoading: boolean;
|
|
6
5
|
error: string | null;
|
|
7
6
|
conversationId: string | null;
|
|
8
7
|
send: (text: string) => Promise<void>;
|
|
9
|
-
reset: () => void;
|
|
10
8
|
cancel: () => void;
|
|
11
9
|
};
|