@cossistant/next 0.0.1
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/_virtual/rolldown_runtime.js +27 -0
- package/avatar.d.ts +16 -0
- package/avatar.d.ts.map +1 -0
- package/bubble.d.ts +20 -0
- package/bubble.d.ts.map +1 -0
- package/button.d.ts +16 -0
- package/button.d.ts.map +1 -0
- package/config.d.ts +22 -0
- package/config.d.ts.map +1 -0
- package/conversation-timeline.d.ts +59 -0
- package/conversation-timeline.d.ts.map +1 -0
- package/fallback.d.ts +18 -0
- package/fallback.d.ts.map +1 -0
- package/hooks/index.d.ts +23 -0
- package/hooks/index.js +5 -0
- package/identify-visitor.d.ts +2 -0
- package/identify-visitor.js +8 -0
- package/identify-visitor2.d.ts +18 -0
- package/identify-visitor2.d.ts.map +1 -0
- package/image.d.ts +20 -0
- package/image.d.ts.map +1 -0
- package/index.d.ts +46 -0
- package/index.js +36 -0
- package/index.js.map +1 -0
- package/index2.d.ts +37 -0
- package/index2.d.ts.map +1 -0
- package/keys.d.ts +199 -0
- package/keys.d.ts.map +1 -0
- package/multimodal-input.d.ts +40 -0
- package/multimodal-input.d.ts.map +1 -0
- package/package.json +114 -0
- package/primitives/index.d.ts +13 -0
- package/primitives/index.js +8 -0
- package/provider.d.ts +2 -0
- package/provider.js +8 -0
- package/provider2.d.ts +93 -0
- package/provider2.d.ts.map +1 -0
- package/provider3.d.ts +56 -0
- package/provider3.d.ts.map +1 -0
- package/realtime/index.d.ts +6 -0
- package/realtime/index.js +8 -0
- package/seen-store.d.ts +17 -0
- package/seen-store.d.ts.map +1 -0
- package/support/index.d.ts +5 -0
- package/support/index.js +6 -0
- package/support-config.d.ts +2 -0
- package/support-config.js +8 -0
- package/support-config2.d.ts +18 -0
- package/support-config2.d.ts.map +1 -0
- package/support-provider.d.ts +17 -0
- package/support-provider.d.ts.map +1 -0
- package/support-store.d.ts +6 -0
- package/support-store.d.ts.map +1 -0
- package/timeline-item-group.d.ts +110 -0
- package/timeline-item-group.d.ts.map +1 -0
- package/timeline-item.d.ts +54 -0
- package/timeline-item.d.ts.map +1 -0
- package/typing-indicator.d.ts +24 -0
- package/typing-indicator.d.ts.map +1 -0
- package/typing-store.d.ts +25 -0
- package/typing-store.d.ts.map +1 -0
- package/use-client-query.d.ts +23 -0
- package/use-client-query.d.ts.map +1 -0
- package/use-composer-refocus.d.ts +20 -0
- package/use-composer-refocus.d.ts.map +1 -0
- package/use-conversation-auto-seen.d.ts +52 -0
- package/use-conversation-auto-seen.d.ts.map +1 -0
- package/use-conversation-history-page.d.ts +84 -0
- package/use-conversation-history-page.d.ts.map +1 -0
- package/use-conversation-lifecycle.d.ts +80 -0
- package/use-conversation-lifecycle.d.ts.map +1 -0
- package/use-conversation-page.d.ts +80 -0
- package/use-conversation-page.d.ts.map +1 -0
- package/use-conversation-seen.d.ts +15 -0
- package/use-conversation-seen.d.ts.map +1 -0
- package/use-conversation-timeline-items.d.ts +19 -0
- package/use-conversation-timeline-items.d.ts.map +1 -0
- package/use-conversation-typing.d.ts +11 -0
- package/use-conversation-typing.d.ts.map +1 -0
- package/use-conversation.d.ts +16 -0
- package/use-conversation.d.ts.map +1 -0
- package/use-conversations.d.ts +18 -0
- package/use-conversations.d.ts.map +1 -0
- package/use-create-conversation.d.ts +26 -0
- package/use-create-conversation.d.ts.map +1 -0
- package/use-default-messages.d.ts +16 -0
- package/use-default-messages.d.ts.map +1 -0
- package/use-grouped-messages.d.ts +51 -0
- package/use-grouped-messages.d.ts.map +1 -0
- package/use-home-page.d.ts +80 -0
- package/use-home-page.d.ts.map +1 -0
- package/use-message-composer.d.ts +86 -0
- package/use-message-composer.d.ts.map +1 -0
- package/use-multimodal-input.d.ts +40 -0
- package/use-multimodal-input.d.ts.map +1 -0
- package/use-realtime-support.d.ts +23 -0
- package/use-realtime-support.d.ts.map +1 -0
- package/use-realtime.d.ts +28 -0
- package/use-realtime.d.ts.map +1 -0
- package/use-rest-client.d.ts +15 -0
- package/use-rest-client.d.ts.map +1 -0
- package/use-send-message.d.ts +31 -0
- package/use-send-message.d.ts.map +1 -0
- package/use-visitor.d.ts +26 -0
- package/use-visitor.d.ts.map +1 -0
- package/use-window-visibility-focus.d.ts +9 -0
- package/use-window-visibility-focus.d.ts.map +1 -0
- package/websocket.d.ts +21 -0
- package/websocket.d.ts.map +1 -0
- package/window.d.ts +23 -0
- package/window.d.ts.map +1 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
//#region ../react/src/hooks/use-home-page.d.ts
|
|
2
|
+
type UseHomePageOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* Whether to enable conversations fetching.
|
|
5
|
+
* Default: true
|
|
6
|
+
*/
|
|
7
|
+
enabled?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Callback when user wants to start a new conversation.
|
|
10
|
+
*/
|
|
11
|
+
onStartConversation?: (initialMessage?: string) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Callback when user wants to open an existing conversation.
|
|
14
|
+
*/
|
|
15
|
+
onOpenConversation?: (conversationId: string) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Callback when user wants to view conversation history.
|
|
18
|
+
*/
|
|
19
|
+
onOpenConversationHistory?: () => void;
|
|
20
|
+
};
|
|
21
|
+
type UseHomePageReturn = {
|
|
22
|
+
conversations: Conversation[];
|
|
23
|
+
isLoading: boolean;
|
|
24
|
+
error: Error | null;
|
|
25
|
+
lastOpenConversation: Conversation | undefined;
|
|
26
|
+
availableConversationsCount: number;
|
|
27
|
+
hasConversations: boolean;
|
|
28
|
+
startConversation: (initialMessage?: string) => void;
|
|
29
|
+
openConversation: (conversationId: string) => void;
|
|
30
|
+
openConversationHistory: () => void;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Main hook for the home page of the support widget.
|
|
34
|
+
*
|
|
35
|
+
* This hook:
|
|
36
|
+
* - Fetches and manages conversations list
|
|
37
|
+
* - Derives useful state (last open conversation, conversation counts)
|
|
38
|
+
* - Provides navigation actions for the home page
|
|
39
|
+
*
|
|
40
|
+
* It encapsulates all home page logic, making the component
|
|
41
|
+
* purely presentational.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* export function HomePage() {
|
|
46
|
+
* const home = useHomePage({
|
|
47
|
+
* onStartConversation: (msg) => {
|
|
48
|
+
* navigate('conversation', { conversationId: PENDING_CONVERSATION_ID, initialMessage: msg });
|
|
49
|
+
* },
|
|
50
|
+
* onOpenConversation: (id) => {
|
|
51
|
+
* navigate('conversation', { conversationId: id });
|
|
52
|
+
* },
|
|
53
|
+
* onOpenConversationHistory: () => {
|
|
54
|
+
* navigate('conversation-history');
|
|
55
|
+
* },
|
|
56
|
+
* });
|
|
57
|
+
*
|
|
58
|
+
* return (
|
|
59
|
+
* <>
|
|
60
|
+
* <h1>How can we help?</h1>
|
|
61
|
+
*
|
|
62
|
+
* {home.lastOpenConversation && (
|
|
63
|
+
* <ConversationCard
|
|
64
|
+
* conversation={home.lastOpenConversation}
|
|
65
|
+
* onClick={() => home.openConversation(home.lastOpenConversation.id)}
|
|
66
|
+
* />
|
|
67
|
+
* )}
|
|
68
|
+
*
|
|
69
|
+
* <Button onClick={() => home.startConversation()}>
|
|
70
|
+
* Ask a question
|
|
71
|
+
* </Button>
|
|
72
|
+
* </>
|
|
73
|
+
* );
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
declare function useHomePage(options?: UseHomePageOptions): UseHomePageReturn;
|
|
78
|
+
//#endregion
|
|
79
|
+
export { UseHomePageOptions, UseHomePageReturn, useHomePage };
|
|
80
|
+
//# sourceMappingURL=use-home-page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-home-page.d.ts","names":[],"sources":["../../react/src/hooks/use-home-page.ts"],"sourcesContent":[],"mappings":";AAKY,KAAA,kBAAA,GAAkB;EAuBlB;;;;SAOW,CAAA,EAAA,OAAA;EAAY;AAuDnC;;qBACU,CAAA,EAAA,CAAA,cAAA,CAAA,EAAA,MAAA,EAAA,GAAA,IAAA;;;;;;;;;;KA/DE,iBAAA;iBAEI;;SAER;wBAGe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuDP,WAAA,WACN,qBACP"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { UseMultimodalInputOptions } from "./use-multimodal-input.js";
|
|
2
|
+
|
|
3
|
+
//#region ../react/src/hooks/use-message-composer.d.ts
|
|
4
|
+
type UseMessageComposerOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* The Cossistant client instance.
|
|
7
|
+
*/
|
|
8
|
+
client: CossistantClient;
|
|
9
|
+
/**
|
|
10
|
+
* Current conversation ID. Can be null if no real conversation exists yet.
|
|
11
|
+
* Pass null when showing default timeline items before user sends first message.
|
|
12
|
+
*/
|
|
13
|
+
conversationId: string | null;
|
|
14
|
+
/**
|
|
15
|
+
* Default timeline items to include when creating a new conversation.
|
|
16
|
+
*/
|
|
17
|
+
defaultTimelineItems?: TimelineItem[];
|
|
18
|
+
/**
|
|
19
|
+
* Visitor ID to associate with messages.
|
|
20
|
+
*/
|
|
21
|
+
visitorId?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Callback when a message is successfully sent.
|
|
24
|
+
* @param conversationId - The conversation ID (may be newly created)
|
|
25
|
+
* @param messageId - The sent message ID
|
|
26
|
+
*/
|
|
27
|
+
onMessageSent?: (conversationId: string, messageId: string) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Callback when message sending fails.
|
|
30
|
+
*/
|
|
31
|
+
onError?: (error: Error) => void;
|
|
32
|
+
/**
|
|
33
|
+
* File upload options (max size, allowed types, etc.)
|
|
34
|
+
*/
|
|
35
|
+
fileOptions?: Pick<UseMultimodalInputOptions, "maxFileSize" | "maxFiles" | "allowedFileTypes">;
|
|
36
|
+
};
|
|
37
|
+
type UseMessageComposerReturn = {
|
|
38
|
+
message: string;
|
|
39
|
+
files: File[];
|
|
40
|
+
error: Error | null;
|
|
41
|
+
isSubmitting: boolean;
|
|
42
|
+
canSubmit: boolean;
|
|
43
|
+
setMessage: (message: string) => void;
|
|
44
|
+
addFiles: (files: File[]) => void;
|
|
45
|
+
removeFile: (index: number) => void;
|
|
46
|
+
clearFiles: () => void;
|
|
47
|
+
submit: () => void;
|
|
48
|
+
reset: () => void;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Combines message input, typing indicators, and message sending into
|
|
52
|
+
* a single, cohesive hook for building message composers.
|
|
53
|
+
*
|
|
54
|
+
* This hook:
|
|
55
|
+
* - Manages text input and file attachments via useMultimodalInput
|
|
56
|
+
* - Sends typing indicators while user is composing
|
|
57
|
+
* - Handles message submission with proper error handling
|
|
58
|
+
* - Automatically resets input after successful send
|
|
59
|
+
* - Works with both pending and real conversations
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```tsx
|
|
63
|
+
* const composer = useMessageComposer({
|
|
64
|
+
* client,
|
|
65
|
+
* conversationId: realConversationId, // null if pending
|
|
66
|
+
* defaultMessages,
|
|
67
|
+
* visitorId: visitor?.id,
|
|
68
|
+
* onMessageSent: (convId) => {
|
|
69
|
+
* // Update conversation ID if it was created
|
|
70
|
+
* },
|
|
71
|
+
* });
|
|
72
|
+
*
|
|
73
|
+
* return (
|
|
74
|
+
* <MessageInput
|
|
75
|
+
* value={composer.message}
|
|
76
|
+
* onChange={composer.setMessage}
|
|
77
|
+
* onSubmit={composer.submit}
|
|
78
|
+
* disabled={composer.isSubmitting}
|
|
79
|
+
* />
|
|
80
|
+
* );
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
declare function useMessageComposer(options: UseMessageComposerOptions): UseMessageComposerReturn;
|
|
84
|
+
//#endregion
|
|
85
|
+
export { UseMessageComposerOptions, UseMessageComposerReturn, useMessageComposer };
|
|
86
|
+
//# sourceMappingURL=use-message-composer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-message-composer.d.ts","names":[],"sources":["../../react/src/hooks/use-message-composer.ts"],"sourcesContent":[],"mappings":";;;AAUY,KAAA,yBAAA,GAAyB;EAAA;;;QAgClB,EA5BV,gBA4BU;;;;AAWnB;EAAoC,cAAA,EAAA,MAAA,GAAA,IAAA;;;;EAYb,oBAAA,CAAA,EAxCC,YAwCD,EAAA;EAwCP;;;WAEb,CAAA,EAAA,MAAA;EAAwB;;;;;;;;;oBAjER;;;;gBAKJ,KACb;;KAKU,wBAAA;;SAGJ;SACA;;;;oBAQW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwCH,kBAAA,UACN,4BACP"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//#region ../react/src/hooks/private/use-multimodal-input.d.ts
|
|
2
|
+
type UseMultimodalInputOptions = {
|
|
3
|
+
onSubmit?: (data: {
|
|
4
|
+
message: string;
|
|
5
|
+
files: File[];
|
|
6
|
+
}) => void | Promise<void>;
|
|
7
|
+
onError?: (error: Error) => void;
|
|
8
|
+
maxFileSize?: number;
|
|
9
|
+
maxFiles?: number;
|
|
10
|
+
allowedFileTypes?: string[];
|
|
11
|
+
};
|
|
12
|
+
type UseMultimodalInputReturn = {
|
|
13
|
+
message: string;
|
|
14
|
+
files: File[];
|
|
15
|
+
isSubmitting: boolean;
|
|
16
|
+
error: Error | null;
|
|
17
|
+
setMessage: (message: string) => void;
|
|
18
|
+
addFiles: (files: File[]) => void;
|
|
19
|
+
removeFile: (index: number) => void;
|
|
20
|
+
clearFiles: () => void;
|
|
21
|
+
submit: () => Promise<void>;
|
|
22
|
+
reset: () => void;
|
|
23
|
+
isValid: boolean;
|
|
24
|
+
canSubmit: boolean;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Manages message text, file attachments and validation for the multimodal
|
|
28
|
+
* composer component. Provides ergonomic helpers for submit flows and error
|
|
29
|
+
* reporting.
|
|
30
|
+
*/
|
|
31
|
+
declare const useMultimodalInput: ({
|
|
32
|
+
onSubmit,
|
|
33
|
+
onError,
|
|
34
|
+
maxFileSize,
|
|
35
|
+
maxFiles,
|
|
36
|
+
allowedFileTypes
|
|
37
|
+
}?: UseMultimodalInputOptions) => UseMultimodalInputReturn;
|
|
38
|
+
//#endregion
|
|
39
|
+
export { UseMultimodalInputOptions, UseMultimodalInputReturn, useMultimodalInput };
|
|
40
|
+
//# sourceMappingURL=use-multimodal-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-multimodal-input.d.ts","names":[],"sources":["../../react/src/hooks/private/use-multimodal-input.ts"],"sourcesContent":[],"mappings":";KAEY,yBAAA;EAAA,QAAA,CAAA,EAAA,CAAA,IAAA,EAAA;IAAyB,OAAA,EAAA,MAAA;IACQ,KAAA,EAAA,IAAA,EAAA;KAAoB,GAAA,IAAA,GAAA,OAAA,CAAA,IAAA,CAAA;SAC9C,CAAA,EAAA,CAAA,KAAA,EAAA,KAAA,EAAA,GAAA,IAAA;EAAK,WAAA,CAAA,EAAA,MAAA;EAMZ,QAAA,CAAA,EAAA,MAAA;EAAwB,gBAAA,CAAA,EAAA,MAAA,EAAA;;AAK5B,KALI,wBAAA,GAKJ;SAIW,EAAA,MAAA;OAGJ,EATP,IASO,EAAA;EAAO,YAAA,EAAA,OAAA;EAaT,KAAA,EApBL,KAoBK,GAAA,IAAA;EA4JZ,UAAA,EAAA,CAAA,OAAA,EAAA,MAAA,EAAA,GAAA,IAAA;UA5JkC,EAAA,CAAA,KAAA,EAhBhB,IAgBgB,EAAA,EAAA,GAAA,IAAA;YAAA,EAAA,CAAA,KAAA,EAAA,MAAA,EAAA,GAAA,IAAA;YAAA,EAAA,GAAA,GAAA,IAAA;QAAA,EAAA,GAAA,GAbpB,OAaoB,CAAA,IAAA,CAAA;OAAA,EAAA,GAAA,GAAA,IAAA;SAMhC,EAAA,OAAA;WAAiC,EAAA,OAAA;CAsJnC;;;;;;cA5JY;;;;;;IAMV,8BAAiC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region ../react/src/hooks/use-realtime-support.d.ts
|
|
2
|
+
type UseRealtimeSupportOptions = {
|
|
3
|
+
onEvent?: (event: AnyRealtimeEvent) => void;
|
|
4
|
+
};
|
|
5
|
+
type UseRealtimeSupportResult = {
|
|
6
|
+
isConnected: boolean;
|
|
7
|
+
isConnecting: boolean;
|
|
8
|
+
error: Error | null;
|
|
9
|
+
send: (event: AnyRealtimeEvent) => void;
|
|
10
|
+
lastEvent: AnyRealtimeEvent | null;
|
|
11
|
+
/** @deprecated Use `lastEvent` instead. */
|
|
12
|
+
lastMessage: AnyRealtimeEvent | null;
|
|
13
|
+
subscribe: (handler: (event: AnyRealtimeEvent) => void) => () => void;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Subscribes to websocket updates pushed by the provider-level
|
|
17
|
+
* `WebSocketProvider`. Delegates low-level connection state while optionally
|
|
18
|
+
* invoking the consumer supplied `onEvent` handler for every realtime event.
|
|
19
|
+
*/
|
|
20
|
+
declare function useRealtimeSupport(options?: UseRealtimeSupportOptions): UseRealtimeSupportResult;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { UseRealtimeSupportOptions, UseRealtimeSupportResult, useRealtimeSupport };
|
|
23
|
+
//# sourceMappingURL=use-realtime-support.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-realtime-support.d.ts","names":[],"sources":["../../react/src/hooks/use-realtime-support.ts"],"sourcesContent":[],"mappings":";AAIY,KAAA,yBAAA,GAAyB;EAIzB,OAAA,CAAA,EAAA,CAAA,KAAA,EAHO,gBAGiB,EAAA,GAAA,IAAA;CAAA;AAG5B,KAHI,wBAAA,GAGJ;aACO,EAAA,OAAA;cACH,EAAA,OAAA;OAEE,EAJN,KAIM,GAAA,IAAA;MACgB,EAAA,CAAA,KAAA,EAJf,gBAIe,EAAA,GAAA,IAAA;EAAgB,SAAA,EAHlC,gBAGkC,GAAA,IAAA;EAQ9B;EAAkB,WAAA,EATpB,gBASoB,GAAA,IAAA;WACxB,EAAA,CAAA,OAAA,EAAA,CAAA,KAAA,EAToB,gBASpB,EAAA,GAAA,IAAA,EAAA,GAAA,GAAA,GAAA,IAAA;;;;;;;iBADM,kBAAA,WACN,4BACP"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { RealtimeContextValue } from "./provider3.js";
|
|
2
|
+
|
|
3
|
+
//#region ../react/src/realtime/use-realtime.d.ts
|
|
4
|
+
type RealtimeHandlerContext<TContext> = TContext;
|
|
5
|
+
type RealtimeEventMeta<TType extends RealtimeEventType, TContext> = {
|
|
6
|
+
event: RealtimeEvent<TType>;
|
|
7
|
+
context: RealtimeHandlerContext<TContext>;
|
|
8
|
+
};
|
|
9
|
+
type RealtimeEventHandler<TType extends RealtimeEventType, TContext> = (data: RealtimeEventData<TType>, meta: RealtimeEventMeta<TType, TContext>) => void | Promise<void>;
|
|
10
|
+
type RealtimeEventHandlerEntry<TType extends RealtimeEventType, TContext> = RealtimeEventHandler<TType, TContext> | RealtimeEventHandler<TType, TContext>[];
|
|
11
|
+
type RealtimeEventHandlersMap<TContext> = Partial<{ [TType in RealtimeEventType]: RealtimeEventHandlerEntry<TType, TContext> }>;
|
|
12
|
+
type UseRealtimeOptions<TContext, THandlers extends RealtimeEventHandlersMap<TContext>> = {
|
|
13
|
+
events: THandlers;
|
|
14
|
+
websiteId?: string | null;
|
|
15
|
+
visitorId?: string | null;
|
|
16
|
+
context?: TContext;
|
|
17
|
+
onEventError?: (error: unknown, event: RealtimeEvent<RealtimeEventType>) => void;
|
|
18
|
+
};
|
|
19
|
+
declare function useRealtime<TContext = void, THandlers extends RealtimeEventHandlersMap<TContext> = RealtimeEventHandlersMap<TContext>>({
|
|
20
|
+
events,
|
|
21
|
+
websiteId,
|
|
22
|
+
visitorId,
|
|
23
|
+
context,
|
|
24
|
+
onEventError
|
|
25
|
+
}: UseRealtimeOptions<TContext, THandlers>): RealtimeContextValue;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { RealtimeEventHandler, RealtimeEventHandlerEntry, RealtimeEventHandlersMap, RealtimeEventMeta, useRealtime };
|
|
28
|
+
//# sourceMappingURL=use-realtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-realtime.d.ts","names":[],"sources":["../../react/src/realtime/use-realtime.ts"],"sourcesContent":[],"mappings":";;;KAUY,mCAAmC;KAEnC,gCAAgC;EAFhC,KAAA,EAGJ,aAHI,CAGU,KAHY,CAAA;EAEtB,OAAA,EAEF,sBAFmB,CAEI,QAFJ,CAAA;CAAA;AAAe,KAKhC,oBALgC,CAAA,cAKG,iBALH,EAAA,QAAA,CAAA,GAAA,CAAA,IAAA,EAMrC,iBANqC,CAMnB,KANmB,CAAA,EAAA,IAAA,EAOrC,iBAPqC,CAOnB,KAPmB,EAOZ,QAPY,CAAA,EAAA,GAAA,IAAA,GAQhC,OARgC,CAAA,IAAA,CAAA;AACtB,KASV,yBATU,CAAA,cAUP,iBAVO,EAAA,QAAA,CAAA,GAanB,oBAbmB,CAaE,KAbF,EAaS,QAbT,CAAA,GAcnB,oBAdmB,CAcE,KAdF,EAcS,QAdT,CAAA,EAAA;AAAd,KAgBI,wBAhBJ,CAAA,QAAA,CAAA,GAgByC,OAhBzC,CAAA,YAiBG,iBAhBsB,GAgBF,yBAhBE,CAgBwB,KAhBxB,EAgB+B,QAhB/B,CAAA;KAmB5B,kBAnB2B,CAAA,QAAA,EAAA,kBAqBb,wBArBa,CAqBY,QArBZ,CAAA,CAAA,GAAA;EAGpB,MAAA,EAoBH,SApBG;EAAoB,SAAA,CAAA,EAAA,MAAA,GAAA,IAAA;WAAe,CAAA,EAAA,MAAA,GAAA,IAAA;SACtB,CAAA,EAsBd,QAtBc;cAAlB,CAAA,EAAA,CAAA,KAAA,EAAA,OAAA,EAAA,KAAA,EAyBE,aAzBF,CAyBgB,iBAzBhB,CAAA,EAAA,GAAA,IAAA;;AACyB,iBA4BhB,WA5BgB,CAAA,WAAA,IAAA,EAAA,kBA+B9B,wBA/B8B,CA+BL,QA/BK,CAAA,GA+BO,wBA/BP,CA+BgC,QA/BhC,CAAA,CAAA,CAAA;EAAA,MAAA;EAAA,SAAA;EAAA,SAAA;EAAA,OAAA;EAAA;AAAA,CAAA,EAsC7B,kBAtC6B,CAsCV,QAtCU,EAsCA,SAtCA,CAAA,CAAA,EAsCX,oBAtCW"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region ../react/src/hooks/private/use-rest-client.d.ts
|
|
2
|
+
type UseClientResult = {
|
|
3
|
+
client: CossistantClient;
|
|
4
|
+
error: Error | null;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Creates a memoised `CossistantClient` instance using the provided endpoints
|
|
8
|
+
* and public key. When no key is passed the hook falls back to environment
|
|
9
|
+
* variables and surfaces missing configuration errors through the returned
|
|
10
|
+
* `error` field.
|
|
11
|
+
*/
|
|
12
|
+
declare function useClient(publicKey: string | undefined, apiUrl?: string, wsUrl?: string): UseClientResult;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { UseClientResult, useClient };
|
|
15
|
+
//# sourceMappingURL=use-rest-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-rest-client.d.ts","names":[],"sources":["../../react/src/hooks/private/use-rest-client.ts"],"sourcesContent":[],"mappings":";AAMY,KAAA,eAAA,GAAe;EAAA,MAAA,EAClB,gBADkB;OAClB,EACD,KADC,GAAA,IAAA;;;AAUT;;;;;iBAAgB,SAAA,kEAIb"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region ../react/src/hooks/use-send-message.d.ts
|
|
2
|
+
|
|
3
|
+
type SendMessageOptions = {
|
|
4
|
+
conversationId?: string | null;
|
|
5
|
+
message: string;
|
|
6
|
+
files?: File[];
|
|
7
|
+
defaultTimelineItems?: TimelineItem[];
|
|
8
|
+
visitorId?: string;
|
|
9
|
+
onSuccess?: (conversationId: string, messageId: string) => void;
|
|
10
|
+
onError?: (error: Error) => void;
|
|
11
|
+
};
|
|
12
|
+
type SendMessageResult = {
|
|
13
|
+
conversationId: string;
|
|
14
|
+
messageId: string;
|
|
15
|
+
conversation?: CreateConversationResponseBody["conversation"];
|
|
16
|
+
initialTimelineItems?: CreateConversationResponseBody["initialTimelineItems"];
|
|
17
|
+
};
|
|
18
|
+
type UseSendMessageResult = {
|
|
19
|
+
mutate: (options: SendMessageOptions) => void;
|
|
20
|
+
mutateAsync: (options: SendMessageOptions) => Promise<SendMessageResult | null>;
|
|
21
|
+
isPending: boolean;
|
|
22
|
+
error: Error | null;
|
|
23
|
+
reset: () => void;
|
|
24
|
+
};
|
|
25
|
+
type UseSendMessageOptions = {
|
|
26
|
+
client?: CossistantClient;
|
|
27
|
+
};
|
|
28
|
+
declare function useSendMessage(options?: UseSendMessageOptions): UseSendMessageResult;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { SendMessageOptions, SendMessageResult, UseSendMessageOptions, UseSendMessageResult, useSendMessage };
|
|
31
|
+
//# sourceMappingURL=use-send-message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-send-message.d.ts","names":[],"sources":["../../react/src/hooks/use-send-message.ts"],"sourcesContent":[],"mappings":";;AAWS,KAHG,kBAAA,GAGH;gBACe,CAAA,EAAA,MAAA,GAAA,IAAA;SAGL,EAAA,MAAA;EAAK,KAAA,CAAA,EAJf,IAIe,EAAA;EAGZ,oBAAiB,CAAA,EANL,YAMK,EAAA;EAAA,SAAA,CAAA,EAAA,MAAA;WAGb,CAAA,EAAA,CAAA,cAAA,EAAA,MAAA,EAAA,SAAA,EAAA,MAAA,EAAA,GAAA,IAAA;SACQ,CAAA,EAAA,CAAA,KAAA,EAPL,KAOK,EAAA,GAAA,IAAA;CAA8B;AAG1C,KAPA,iBAAA,GAOoB;EAAA,cAAA,EAAA,MAAA;WACb,EAAA,MAAA;cAER,CAAA,EAPK,8BAOL,CAAA,cAAA,CAAA;sBACG,CAAA,EAPU,8BAOV,CAAA,sBAAA,CAAA;;AAEN,KANI,oBAAA,GAMJ;EAAK,MAAA,EAAA,CAAA,OAAA,EALM,kBAKN,EAAA,GAAA,IAAA;EAID,WAAA,EAAA,CAAA,OAAA,EAPD,kBAQD,EAAA,GAPJ,OAOoB,CAPZ,iBAOY,GAAA,IAAA,CAAA;EAsCV,SAAA,EAAA,OAAc;EAAA,KAAA,EA3CtB,KA2CsB,GAAA,IAAA;OACpB,EAAA,GAAA,GAAA,IAAA;;AACa,KAzCX,qBAAA,GAyCW;WAxCb;;iBAsCM,cAAA,WACN,wBACP"}
|
package/use-visitor.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//#region ../react/src/hooks/use-visitor.d.ts
|
|
2
|
+
type UseVisitorReturn = {
|
|
3
|
+
visitor: PublicVisitor | null;
|
|
4
|
+
setVisitorMetadata: (metadata: VisitorMetadata) => Promise<VisitorResponse | null>;
|
|
5
|
+
identify: (params: {
|
|
6
|
+
externalId?: string;
|
|
7
|
+
email?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
image?: string;
|
|
10
|
+
metadata?: Record<string, unknown>;
|
|
11
|
+
}) => Promise<{
|
|
12
|
+
contactId: string;
|
|
13
|
+
visitorId: string;
|
|
14
|
+
} | null>;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Exposes the current visitor plus helpers to identify and update metadata.
|
|
18
|
+
*
|
|
19
|
+
* Note: Metadata is stored on contacts, not visitors. When you call
|
|
20
|
+
* setVisitorMetadata, it will update the contact metadata if the visitor
|
|
21
|
+
* has been identified. If not, you must call identify() first.
|
|
22
|
+
*/
|
|
23
|
+
declare function useVisitor(): UseVisitorReturn;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { UseVisitorReturn, useVisitor };
|
|
26
|
+
//# sourceMappingURL=use-visitor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-visitor.d.ts","names":[],"sources":["../../react/src/hooks/use-visitor.ts"],"sourcesContent":[],"mappings":";AAQY,KAAA,gBAAA,GAAgB;EAAA,OAAA,EAClB,aADkB,GAAA,IAAA;oBAClB,EAAA,CAAA,QAAA,EAEE,eAFF,EAAA,GAGJ,OAHI,CAGI,eAHJ,GAAA,IAAA,CAAA;UAEE,EAAA,CAAA,MAAA,EAAA;IACE,UAAA,CAAA,EAAA,MAAA;IAAR,KAAA,CAAA,EAAA,MAAA;IAMO,IAAA,CAAA,EAAA,MAAA;IACN,KAAA,CAAA,EAAA,MAAA;IAAO,QAAA,CAAA,EADD,MACC,CAAA,MAAA,EAAA,OAAA,CAAA;EAsBE,CAAA,EAAA,GAtBT,OAsBmB,CAAA;;;;;;;;;;;;iBAAV,UAAA,CAAA,GAAc"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region ../react/src/hooks/use-window-visibility-focus.d.ts
|
|
2
|
+
type WindowVisibilityFocusState = {
|
|
3
|
+
isPageVisible: boolean;
|
|
4
|
+
hasWindowFocus: boolean;
|
|
5
|
+
};
|
|
6
|
+
declare function useWindowVisibilityFocus(): WindowVisibilityFocusState;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { WindowVisibilityFocusState, useWindowVisibilityFocus };
|
|
9
|
+
//# sourceMappingURL=use-window-visibility-focus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-window-visibility-focus.d.ts","names":[],"sources":["../../react/src/hooks/use-window-visibility-focus.ts"],"sourcesContent":[],"mappings":";KAEY,0BAAA;EAAA,aAAA,EAAA,OAAA;EAkBI,cAAA,EAAA,OAAA;;iBAAA,wBAAA,CAAA,GAA4B"}
|
package/websocket.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { RealtimeContextValue } from "./provider3.js";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
//#region ../react/src/support/context/websocket.d.ts
|
|
5
|
+
type WebSocketContextValue = RealtimeContextValue;
|
|
6
|
+
type WebSocketProviderProps = {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
publicKey?: string;
|
|
9
|
+
websiteId?: string;
|
|
10
|
+
visitorId?: string;
|
|
11
|
+
wsUrl?: string;
|
|
12
|
+
autoConnect?: boolean;
|
|
13
|
+
onConnect?: () => void;
|
|
14
|
+
onDisconnect?: () => void;
|
|
15
|
+
onError?: (error: Error) => void;
|
|
16
|
+
};
|
|
17
|
+
declare const WebSocketProvider: React.FC<WebSocketProviderProps>;
|
|
18
|
+
declare const useWebSocket: () => WebSocketContextValue;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { type WebSocketContextValue, WebSocketProvider, useWebSocket };
|
|
21
|
+
//# sourceMappingURL=websocket.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"websocket.d.ts","names":[],"sources":["../../react/src/support/context/websocket.tsx"],"sourcesContent":[],"mappings":";;;;KAYK,qBAAA,GAAwB;KAExB,sBAAA;EAFA,QAAA,EAGM,KAAA,CAAM,SAHS;EAErB,SAAA,CAAA,EAAA,MAAA;EAAsB,SAAA,CAAA,EAAA,MAAA;WACV,CAAA,EAAA,MAAA;OAQE,CAAA,EAAA,MAAA;EAAK,WAAA,CAAA,EAAA,OAAA;EAyIX,SAAA,CAAA,EAAA,GAAA,GAAA,IAyBZ;EAAA,YAAA,CAAA,EAAA,GAAA,GAAA,IAAA;SAzBwC,CAAA,EAAA,CAAA,KAAA,EAzItB,KAyIsB,EAAA,GAAA,IAAA;;AAAD,cAA3B,iBAA2B,EAAR,KAAA,CAAM,EAAE,CAAC,sBAAD,CAAA;AA2B3B,cAAA,YAAmB,EAAA,GAAA,GAAA,qBAM/B"}
|
package/window.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
|
|
3
|
+
//#region ../react/src/primitives/window.d.ts
|
|
4
|
+
type WindowRenderProps = {
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
close: () => void;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Host container for the support experience. Handles responsive mode, escape
|
|
10
|
+
* key dismissal and propagates render props so callers can take over the
|
|
11
|
+
* layout.
|
|
12
|
+
*/
|
|
13
|
+
declare const SupportWindow: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
14
|
+
isOpen?: boolean;
|
|
15
|
+
onOpenChange?: (open: boolean) => void;
|
|
16
|
+
children?: React$1.ReactNode | ((props: WindowRenderProps) => React$1.ReactNode);
|
|
17
|
+
asChild?: boolean;
|
|
18
|
+
closeOnEscape?: boolean;
|
|
19
|
+
id?: string;
|
|
20
|
+
} & React$1.RefAttributes<HTMLDivElement>>;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { SupportWindow };
|
|
23
|
+
//# sourceMappingURL=window.d.ts.map
|
package/window.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"window.d.ts","names":[],"sources":["../../react/src/primitives/window.tsx"],"sourcesContent":[],"mappings":";;;KAIY,iBAAA;;EAAA,KAAA,EAAA,GAAA,GAAA,IAAA;AAsBZ,CAAA;;;;;;cAAa,eAAa,OAAA,CAAA,0BAAA,KAAA,OAAA,CAAA,eAAA;;;aAXd,OAAA,CAAM,qBAAqB,sBAAsB,OAAA,CAAM"}
|