@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.
Files changed (111) hide show
  1. package/_virtual/rolldown_runtime.js +27 -0
  2. package/avatar.d.ts +16 -0
  3. package/avatar.d.ts.map +1 -0
  4. package/bubble.d.ts +20 -0
  5. package/bubble.d.ts.map +1 -0
  6. package/button.d.ts +16 -0
  7. package/button.d.ts.map +1 -0
  8. package/config.d.ts +22 -0
  9. package/config.d.ts.map +1 -0
  10. package/conversation-timeline.d.ts +59 -0
  11. package/conversation-timeline.d.ts.map +1 -0
  12. package/fallback.d.ts +18 -0
  13. package/fallback.d.ts.map +1 -0
  14. package/hooks/index.d.ts +23 -0
  15. package/hooks/index.js +5 -0
  16. package/identify-visitor.d.ts +2 -0
  17. package/identify-visitor.js +8 -0
  18. package/identify-visitor2.d.ts +18 -0
  19. package/identify-visitor2.d.ts.map +1 -0
  20. package/image.d.ts +20 -0
  21. package/image.d.ts.map +1 -0
  22. package/index.d.ts +46 -0
  23. package/index.js +36 -0
  24. package/index.js.map +1 -0
  25. package/index2.d.ts +37 -0
  26. package/index2.d.ts.map +1 -0
  27. package/keys.d.ts +199 -0
  28. package/keys.d.ts.map +1 -0
  29. package/multimodal-input.d.ts +40 -0
  30. package/multimodal-input.d.ts.map +1 -0
  31. package/package.json +114 -0
  32. package/primitives/index.d.ts +13 -0
  33. package/primitives/index.js +8 -0
  34. package/provider.d.ts +2 -0
  35. package/provider.js +8 -0
  36. package/provider2.d.ts +93 -0
  37. package/provider2.d.ts.map +1 -0
  38. package/provider3.d.ts +56 -0
  39. package/provider3.d.ts.map +1 -0
  40. package/realtime/index.d.ts +6 -0
  41. package/realtime/index.js +8 -0
  42. package/seen-store.d.ts +17 -0
  43. package/seen-store.d.ts.map +1 -0
  44. package/support/index.d.ts +5 -0
  45. package/support/index.js +6 -0
  46. package/support-config.d.ts +2 -0
  47. package/support-config.js +8 -0
  48. package/support-config2.d.ts +18 -0
  49. package/support-config2.d.ts.map +1 -0
  50. package/support-provider.d.ts +17 -0
  51. package/support-provider.d.ts.map +1 -0
  52. package/support-store.d.ts +6 -0
  53. package/support-store.d.ts.map +1 -0
  54. package/timeline-item-group.d.ts +110 -0
  55. package/timeline-item-group.d.ts.map +1 -0
  56. package/timeline-item.d.ts +54 -0
  57. package/timeline-item.d.ts.map +1 -0
  58. package/typing-indicator.d.ts +24 -0
  59. package/typing-indicator.d.ts.map +1 -0
  60. package/typing-store.d.ts +25 -0
  61. package/typing-store.d.ts.map +1 -0
  62. package/use-client-query.d.ts +23 -0
  63. package/use-client-query.d.ts.map +1 -0
  64. package/use-composer-refocus.d.ts +20 -0
  65. package/use-composer-refocus.d.ts.map +1 -0
  66. package/use-conversation-auto-seen.d.ts +52 -0
  67. package/use-conversation-auto-seen.d.ts.map +1 -0
  68. package/use-conversation-history-page.d.ts +84 -0
  69. package/use-conversation-history-page.d.ts.map +1 -0
  70. package/use-conversation-lifecycle.d.ts +80 -0
  71. package/use-conversation-lifecycle.d.ts.map +1 -0
  72. package/use-conversation-page.d.ts +80 -0
  73. package/use-conversation-page.d.ts.map +1 -0
  74. package/use-conversation-seen.d.ts +15 -0
  75. package/use-conversation-seen.d.ts.map +1 -0
  76. package/use-conversation-timeline-items.d.ts +19 -0
  77. package/use-conversation-timeline-items.d.ts.map +1 -0
  78. package/use-conversation-typing.d.ts +11 -0
  79. package/use-conversation-typing.d.ts.map +1 -0
  80. package/use-conversation.d.ts +16 -0
  81. package/use-conversation.d.ts.map +1 -0
  82. package/use-conversations.d.ts +18 -0
  83. package/use-conversations.d.ts.map +1 -0
  84. package/use-create-conversation.d.ts +26 -0
  85. package/use-create-conversation.d.ts.map +1 -0
  86. package/use-default-messages.d.ts +16 -0
  87. package/use-default-messages.d.ts.map +1 -0
  88. package/use-grouped-messages.d.ts +51 -0
  89. package/use-grouped-messages.d.ts.map +1 -0
  90. package/use-home-page.d.ts +80 -0
  91. package/use-home-page.d.ts.map +1 -0
  92. package/use-message-composer.d.ts +86 -0
  93. package/use-message-composer.d.ts.map +1 -0
  94. package/use-multimodal-input.d.ts +40 -0
  95. package/use-multimodal-input.d.ts.map +1 -0
  96. package/use-realtime-support.d.ts +23 -0
  97. package/use-realtime-support.d.ts.map +1 -0
  98. package/use-realtime.d.ts +28 -0
  99. package/use-realtime.d.ts.map +1 -0
  100. package/use-rest-client.d.ts +15 -0
  101. package/use-rest-client.d.ts.map +1 -0
  102. package/use-send-message.d.ts +31 -0
  103. package/use-send-message.d.ts.map +1 -0
  104. package/use-visitor.d.ts +26 -0
  105. package/use-visitor.d.ts.map +1 -0
  106. package/use-window-visibility-focus.d.ts +9 -0
  107. package/use-window-visibility-focus.d.ts.map +1 -0
  108. package/websocket.d.ts +21 -0
  109. package/websocket.d.ts.map +1 -0
  110. package/window.d.ts +23 -0
  111. package/window.d.ts.map +1 -0
@@ -0,0 +1,24 @@
1
+ import * as React$1 from "react";
2
+ import "react/jsx-runtime";
3
+
4
+ //#region ../react/src/support/components/typing-indicator.d.ts
5
+ type TypingParticipantType = "visitor" | "team_member" | "ai";
6
+ type TypingParticipant = {
7
+ id: string;
8
+ type: TypingParticipantType;
9
+ };
10
+ type TypingIndicatorProps = React$1.HTMLAttributes<HTMLDivElement> & {
11
+ participants: TypingParticipant[];
12
+ availableAIAgents?: AvailableAIAgent[];
13
+ availableHumanAgents?: AvailableHumanAgent[];
14
+ withAvatars?: boolean;
15
+ };
16
+ declare const TypingIndicator: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & {
17
+ participants: TypingParticipant[];
18
+ availableAIAgents?: AvailableAIAgent[];
19
+ availableHumanAgents?: AvailableHumanAgent[];
20
+ withAvatars?: boolean;
21
+ } & React$1.RefAttributes<HTMLDivElement>>;
22
+ //#endregion
23
+ export { TypingIndicator, TypingIndicatorProps, TypingParticipant, TypingParticipantType };
24
+ //# sourceMappingURL=typing-indicator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typing-indicator.d.ts","names":[],"sources":["../../react/src/support/components/typing-indicator.tsx"],"sourcesContent":[],"mappings":";;;;KAKY,qBAAA;KAEA,iBAAA;EAFA,EAAA,EAAA,MAAA;EAEA,IAAA,EAEL,qBAFsB;AAK7B,CAAA;AAAgC,KAApB,oBAAA,GAAuB,OAAA,CAAM,cAAT,CAAwB,cAAxB,CAAA,GAAA;cAAwB,EACzC,iBADyC,EAAA;mBAAf,CAAA,EAEpB,gBAFoB,EAAA;sBAC1B,CAAA,EAES,mBAFT,EAAA;aACM,CAAA,EAAA,OAAA;;AAaR,cAAA,eAuDZ,EAvD2B,OAAA,CAAA,yBAuD3B,CAvD2B,OAAA,CAAA,cAuD3B,CAvD2B,cAuD3B,CAAA,GAAA;EAAA,YAAA,EArEc,iBAqEd,EAAA;mBAvD2B,CAAA,EAbP,gBAaO,EAAA;sBAAA,CAAA,EAZJ,mBAYI,EAAA;aAdb,CAAA,EAAA,OAAA;yBACM,eAAA,CAAA,CAAA"}
@@ -0,0 +1,25 @@
1
+ //#region ../react/src/realtime/typing-store.d.ts
2
+
3
+ declare function setTypingState(options: {
4
+ conversationId: string;
5
+ actorType: TypingActorType;
6
+ actorId: string;
7
+ isTyping: boolean;
8
+ preview?: string | null;
9
+ ttlMs?: number;
10
+ }): void;
11
+ declare function clearTypingState(options: {
12
+ conversationId: string;
13
+ actorType: TypingActorType;
14
+ actorId: string;
15
+ }): void;
16
+ declare function applyConversationTypingEvent(event: RealtimeEvent<"conversationTyping">, options?: {
17
+ ignoreVisitorId?: string | null;
18
+ ignoreUserId?: string | null;
19
+ ignoreAiAgentId?: string | null;
20
+ ttlMs?: number;
21
+ }): void;
22
+ declare function clearTypingFromTimelineItem(event: RealtimeEvent<"timelineItemCreated">): void;
23
+ //#endregion
24
+ export { applyConversationTypingEvent, clearTypingFromTimelineItem, clearTypingState, setTypingState };
25
+ //# sourceMappingURL=typing-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typing-store.d.ts","names":[],"sources":["../../react/src/realtime/typing-store.ts"],"sourcesContent":[],"mappings":";;iBAwDgB,cAAA;;aAEJ;;;;;;iBASI,gBAAA;;aAEJ;;;iBAMI,4BAAA,QACR;;;;;;iBAWQ,2BAAA,QACR"}
@@ -0,0 +1,23 @@
1
+ //#region ../react/src/hooks/private/use-client-query.d.ts
2
+ type QueryFn<TData, TArgs> = (client: CossistantClient, args?: TArgs | undefined) => Promise<TData>;
3
+ type UseClientQueryOptions<TData, TArgs> = {
4
+ client: CossistantClient;
5
+ queryFn: QueryFn<TData, TArgs>;
6
+ enabled?: boolean;
7
+ refetchInterval?: number | false;
8
+ refetchOnWindowFocus?: boolean;
9
+ refetchOnMount?: boolean;
10
+ initialData?: TData;
11
+ initialArgs?: TArgs;
12
+ dependencies?: readonly unknown[];
13
+ };
14
+ type UseClientQueryResult<TData, TArgs> = {
15
+ data: TData | undefined;
16
+ error: Error | null;
17
+ isLoading: boolean;
18
+ refetch: (args?: TArgs) => Promise<TData | undefined>;
19
+ };
20
+ declare function useClientQuery<TData, TArgs = void>(options: UseClientQueryOptions<TData, TArgs>): UseClientQueryResult<TData, TArgs>;
21
+ //#endregion
22
+ export { useClientQuery };
23
+ //# sourceMappingURL=use-client-query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-client-query.d.ts","names":[],"sources":["../../react/src/hooks/private/use-client-query.ts"],"sourcesContent":[],"mappings":";AAAyD,KAGpD,OAAA,CAAA,KAAO,EAAA,KAAA,CAAA,GAAA,CAAA,MAAA,EACH,gBADG,EAAA,IAAA,CAAA,EAEJ,KAFI,GAAA,SAAA,EAAA,GAGP,OAHO,CAGC,KAHD,CAAA;KAKP,qBALO,CAAA,KAAA,EAAA,KAAA,CAAA,GAAA;QACH,EAKA,gBALA;SACD,EAKE,OALF,CAKU,KALV,EAKiB,KALjB,CAAA;SACK,CAAA,EAAA,OAAA;iBAAR,CAAA,EAAA,MAAA,GAAA,KAAA;EAAO,oBAAA,CAAA,EAAA,OAAA;EAEP,cAAA,CAAA,EAAA,OAAqB;EAAA,WAAA,CAAA,EAOX,KAPW;aACjB,CAAA,EAOM,KAPN;cACS,CAAA,EAAA,SAAA,OAAA,EAAA;;KAUb,oBAVK,CAAA,KAAA,EAAA,KAAA,CAAA,GAAA;MAKK,EAMR,KANQ,GAAA,SAAA;OACA,EAMP,KANO,GAAA,IAAA;EAAK,SAAA,EAAA,OAAA;EAIf,OAAA,EAAA,CAAA,IAAA,CAAA,EAIa,KAJb,EAAoB,GAIG,OAJH,CAIW,KAJX,GAAA,SAAA,CAAA;CAAA;AAClB,iBAgBS,cAhBT,CAAA,KAAA,EAAA,QAAA,IAAA,CAAA,CAAA,OAAA,EAiBG,qBAjBH,CAiByB,KAjBzB,EAiBgC,KAjBhC,CAAA,CAAA,EAkBJ,oBAlBI,CAkBiB,KAlBjB,EAkBwB,KAlBxB,CAAA"}
@@ -0,0 +1,20 @@
1
+ import { MutableRefObject } from "react";
2
+
3
+ //#region ../react/src/hooks/use-composer-refocus.d.ts
4
+ type UseComposerRefocusOptions = {
5
+ disabled: boolean;
6
+ hasContent: boolean;
7
+ isSubmitting: boolean;
8
+ };
9
+ type UseComposerRefocusReturn = {
10
+ focusComposer: () => void;
11
+ inputRef: MutableRefObject<HTMLTextAreaElement | null>;
12
+ };
13
+ declare const useComposerRefocus: ({
14
+ disabled,
15
+ hasContent,
16
+ isSubmitting
17
+ }: UseComposerRefocusOptions) => UseComposerRefocusReturn;
18
+ //#endregion
19
+ export { UseComposerRefocusOptions, UseComposerRefocusReturn, useComposerRefocus };
20
+ //# sourceMappingURL=use-composer-refocus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-composer-refocus.d.ts","names":[],"sources":["../../react/src/hooks/use-composer-refocus.ts"],"sourcesContent":[],"mappings":";;;KAGY,yBAAA;;EAAA,UAAA,EAAA,OAAA;EAMA,YAAA,EAAA,OAAA;CAAwB;AAER,KAFhB,wBAAA,GAEgB;eAAjB,EAAA,GAAA,GAAA,IAAA;EAAgB,QAAA,EAAhB,gBAAgB,CAAC,mBAAD,GAAA,IAAA,CAAA;AAG3B,CAAA;AAmCC,cAnCY,kBAmCZ,EAAA,CAAA;EAAA,QAAA;EAAA,UAAA;EAAA;AAAA,CAAA,EA/BE,yBA+BF,EAAA,GA/B8B,wBA+B9B"}
@@ -0,0 +1,52 @@
1
+ //#region ../react/src/hooks/use-conversation-auto-seen.d.ts
2
+
3
+ declare const CONVERSATION_AUTO_SEEN_DELAY_MS = 2000;
4
+ type UseConversationAutoSeenOptions = {
5
+ /**
6
+ * The Cossistant client instance.
7
+ */
8
+ client: CossistantClient | null;
9
+ /**
10
+ * The real conversation ID. Pass null if no conversation exists yet.
11
+ */
12
+ conversationId: string | null;
13
+ /**
14
+ * Current visitor ID.
15
+ */
16
+ visitorId?: string;
17
+ /**
18
+ * The last timeline item in the conversation.
19
+ * Used to determine if we should mark as seen.
20
+ */
21
+ lastTimelineItem: TimelineItem | null;
22
+ /**
23
+ * Whether to enable auto-seen tracking.
24
+ * Default: true
25
+ */
26
+ enabled?: boolean;
27
+ };
28
+ /**
29
+ * Automatically marks timeline items as seen when:
30
+ * - A new timeline item arrives from someone else
31
+ * - The page is visible/focused
32
+ * - The visitor is the current user
33
+ *
34
+ * Also handles:
35
+ * - Fetching and hydrating initial seen data
36
+ * - Preventing duplicate API calls
37
+ * - Page visibility tracking
38
+ *
39
+ * @example
40
+ * ```tsx
41
+ * useConversationAutoSeen({
42
+ * client,
43
+ * conversationId: realConversationId,
44
+ * visitorId: visitor?.id,
45
+ * lastTimelineItem: items[items.length - 1] ?? null,
46
+ * });
47
+ * ```
48
+ */
49
+ declare function useConversationAutoSeen(options: UseConversationAutoSeenOptions): void;
50
+ //#endregion
51
+ export { CONVERSATION_AUTO_SEEN_DELAY_MS, UseConversationAutoSeenOptions, useConversationAutoSeen };
52
+ //# sourceMappingURL=use-conversation-auto-seen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-conversation-auto-seen.d.ts","names":[],"sources":["../../react/src/hooks/use-conversation-auto-seen.ts"],"sourcesContent":[],"mappings":";;AAWY,cAFC,+BAAA,GAE6B,IAAA;AAAA,KAA9B,8BAAA,GAA8B;;;;EAkD1B,MAAA,EA9CP,gBA8CO,GAAuB,IAAA;;;;;;;;;;;;;oBA9BpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8BH,uBAAA,UACN"}
@@ -0,0 +1,84 @@
1
+ //#region ../react/src/hooks/use-conversation-history-page.d.ts
2
+ type UseConversationHistoryPageOptions = {
3
+ /**
4
+ * Initial number of conversations to display.
5
+ * Default: 4
6
+ */
7
+ initialVisibleCount?: number;
8
+ /**
9
+ * Whether to enable conversations fetching.
10
+ * Default: true
11
+ */
12
+ enabled?: boolean;
13
+ /**
14
+ * Callback when user wants to open a conversation.
15
+ */
16
+ onOpenConversation?: (conversationId: string) => void;
17
+ /**
18
+ * Callback when user wants to start a new conversation.
19
+ */
20
+ onStartConversation?: (initialMessage?: string) => void;
21
+ };
22
+ type UseConversationHistoryPageReturn = {
23
+ conversations: Conversation[];
24
+ isLoading: boolean;
25
+ error: Error | null;
26
+ visibleConversations: Conversation[];
27
+ visibleCount: number;
28
+ hasMore: boolean;
29
+ remainingCount: number;
30
+ showMore: () => void;
31
+ showAll: () => void;
32
+ openConversation: (conversationId: string) => void;
33
+ startConversation: (initialMessage?: string) => void;
34
+ };
35
+ /**
36
+ * Main hook for the conversation history page.
37
+ *
38
+ * This hook:
39
+ * - Fetches all conversations
40
+ * - Manages pagination/visible count
41
+ * - Provides navigation actions
42
+ *
43
+ * It encapsulates all conversation history logic, making the component
44
+ * purely presentational.
45
+ *
46
+ * @example
47
+ * ```tsx
48
+ * export function ConversationHistoryPage() {
49
+ * const history = useConversationHistoryPage({
50
+ * initialVisibleCount: 4,
51
+ * onOpenConversation: (id) => {
52
+ * navigate('conversation', { conversationId: id });
53
+ * },
54
+ * onStartConversation: (msg) => {
55
+ * navigate('conversation', { conversationId: PENDING_CONVERSATION_ID, initialMessage: msg });
56
+ * },
57
+ * });
58
+ *
59
+ * return (
60
+ * <>
61
+ * <h1>Conversation History</h1>
62
+ *
63
+ * {history.hasMore && (
64
+ * <button onClick={history.showAll}>
65
+ * +{history.remainingCount} more
66
+ * </button>
67
+ * )}
68
+ *
69
+ * <ul>
70
+ * {history.visibleConversations.map(conv => (
71
+ * <li key={conv.id} onClick={() => history.openConversation(conv.id)}>
72
+ * {conv.title}
73
+ * </li>
74
+ * ))}
75
+ * </ul>
76
+ * </>
77
+ * );
78
+ * }
79
+ * ```
80
+ */
81
+ declare function useConversationHistoryPage(options?: UseConversationHistoryPageOptions): UseConversationHistoryPageReturn;
82
+ //#endregion
83
+ export { UseConversationHistoryPageOptions, UseConversationHistoryPageReturn, useConversationHistoryPage };
84
+ //# sourceMappingURL=use-conversation-history-page.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-conversation-history-page.d.ts","names":[],"sources":["../../react/src/hooks/use-conversation-history-page.ts"],"sourcesContent":[],"mappings":";AAIY,KAAA,iCAAA,GAAiC;EAwBjC;;;;qBAOW,CAAA,EAAA,MAAA;EAAY;AA0DnC;;;SAEG,CAAA,EAAA,OAAA;EAAgC;;;;;;;;;KAnEvB,gCAAA;iBAEI;;SAER;wBAGe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0DP,0BAAA,WACN,oCACP"}
@@ -0,0 +1,80 @@
1
+ //#region ../react/src/hooks/use-conversation-lifecycle.d.ts
2
+ type ConversationLifecycleState = {
3
+ /**
4
+ * The current conversation ID. Always a string, never null.
5
+ * Will be PENDING_CONVERSATION_ID if no real conversation exists yet.
6
+ */
7
+ conversationId: string;
8
+ /**
9
+ * Whether this is a pending (not yet created) conversation.
10
+ * True = showing default messages, no backend conversation yet.
11
+ * False = real conversation exists on backend.
12
+ */
13
+ isPending: boolean;
14
+ /**
15
+ * The real conversation ID if one exists, otherwise null.
16
+ * Use this when you need to pass to API calls that require an existing conversation.
17
+ */
18
+ realConversationId: string | null;
19
+ };
20
+ type UseConversationLifecycleOptions = {
21
+ /**
22
+ * Initial conversation ID from URL or navigation state.
23
+ * Can be PENDING_CONVERSATION_ID or a real conversation ID.
24
+ */
25
+ initialConversationId?: string;
26
+ /**
27
+ * Whether to automatically create a conversation on mount.
28
+ * If false, conversation will only be created when user sends first message.
29
+ * Default: false (lazy creation)
30
+ */
31
+ autoCreate?: boolean;
32
+ /**
33
+ * Visitor ID to associate with the conversation.
34
+ */
35
+ visitorId?: string;
36
+ /**
37
+ * Website ID to associate with the conversation.
38
+ */
39
+ websiteId?: string | null;
40
+ /**
41
+ * Callback when conversation is created.
42
+ */
43
+ onConversationCreated?: (conversationId: string) => void;
44
+ };
45
+ type UseConversationLifecycleReturn = ConversationLifecycleState & {
46
+ /**
47
+ * Update the conversation ID (e.g., after creation or navigation).
48
+ */
49
+ setConversationId: (conversationId: string) => void;
50
+ /**
51
+ * Check if this is a new/pending conversation.
52
+ */
53
+ isNewConversation: () => boolean;
54
+ };
55
+ /**
56
+ * Manages the lifecycle of a conversation, handling the transition from
57
+ * a pending state (showing default messages) to a real conversation
58
+ * (with backend persistence).
59
+ *
60
+ * This hook simplifies the logic of:
61
+ * - Starting with default/welcome messages
62
+ * - Creating the conversation only when user sends first message
63
+ * - Transitioning from pending → real conversation ID
64
+ *
65
+ * @example
66
+ * ```tsx
67
+ * const { conversationId, isPending, realConversationId } = useConversationLifecycle({
68
+ * initialConversationId: params.conversationId,
69
+ * visitorId: visitor?.id,
70
+ * });
71
+ *
72
+ * // conversationId is always a string (never null)
73
+ * // isPending tells you if it's a real conversation or not
74
+ * // realConversationId is null when isPending=true, otherwise it's the real ID
75
+ * ```
76
+ */
77
+ declare function useConversationLifecycle(options?: UseConversationLifecycleOptions): UseConversationLifecycleReturn;
78
+ //#endregion
79
+ export { ConversationLifecycleState, UseConversationLifecycleOptions, UseConversationLifecycleReturn, useConversationLifecycle };
80
+ //# sourceMappingURL=use-conversation-lifecycle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-conversation-lifecycle.d.ts","names":[],"sources":["../../react/src/hooks/use-conversation-lifecycle.ts"],"sourcesContent":[],"mappings":";KAGY,0BAAA;EAAA;AAqBZ;AA8BA;AAkCA;EAAwC,cAAA,EAAA,MAAA;;;;;;;;;;;;;KAhE5B,+BAAA;;;;;;;;;;;;;;;;;;;;;;;;;KA8BA,8BAAA,GAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkC7B,wBAAA,WACN,kCACP"}
@@ -0,0 +1,80 @@
1
+ //#region ../react/src/hooks/use-conversation-page.d.ts
2
+ type UseConversationPageOptions = {
3
+ /**
4
+ * Initial conversation ID (from URL params, navigation state, etc.)
5
+ * Can be PENDING_CONVERSATION_ID or a real ID.
6
+ */
7
+ conversationId: string;
8
+ /**
9
+ * Optional initial message to send when the conversation opens.
10
+ */
11
+ initialMessage?: string;
12
+ /**
13
+ * Callback when conversation ID changes (e.g., after creation).
14
+ * Use this to update navigation state or URL.
15
+ */
16
+ onConversationIdChange?: (conversationId: string) => void;
17
+ /**
18
+ * Optional timeline items to pass through (e.g., optimistic updates).
19
+ */
20
+ items?: TimelineItem[];
21
+ };
22
+ type UseConversationPageReturn = {
23
+ conversationId: string;
24
+ isPending: boolean;
25
+ items: TimelineItem[];
26
+ isLoading: boolean;
27
+ error: Error | null;
28
+ composer: {
29
+ message: string;
30
+ files: File[];
31
+ isSubmitting: boolean;
32
+ canSubmit: boolean;
33
+ setMessage: (message: string) => void;
34
+ addFiles: (files: File[]) => void;
35
+ removeFile: (index: number) => void;
36
+ submit: () => void;
37
+ };
38
+ hasItems: boolean;
39
+ lastTimelineItem: TimelineItem | null;
40
+ };
41
+ /**
42
+ * Main orchestrator hook for the conversation page.
43
+ *
44
+ * This hook combines all conversation-related logic:
45
+ * - Lifecycle management (pending → real conversation)
46
+ * - Message fetching and display
47
+ * - Message composition and sending
48
+ * - Automatic seen tracking
49
+ * - Default/welcome messages before conversation is created
50
+ *
51
+ * It provides a clean, simple API for building conversation UIs.
52
+ *
53
+ * @example
54
+ * ```tsx
55
+ * export function ConversationPage({ conversationId: initialId }) {
56
+ * const conversation = useConversationPage({
57
+ * conversationId: initialId,
58
+ * onConversationIdChange: (newId) => {
59
+ * // Update URL or navigation state
60
+ * navigate(`/conversation/${newId}`);
61
+ * },
62
+ * });
63
+ *
64
+ * return (
65
+ * <>
66
+ * <MessageList messages={conversation.messages} />
67
+ * <MessageInput
68
+ * value={conversation.composer.message}
69
+ * onChange={conversation.composer.setMessage}
70
+ * onSubmit={conversation.composer.submit}
71
+ * />
72
+ * </>
73
+ * );
74
+ * }
75
+ * ```
76
+ */
77
+ declare function useConversationPage(options: UseConversationPageOptions): UseConversationPageReturn;
78
+ //#endregion
79
+ export { UseConversationPageOptions, UseConversationPageReturn, useConversationPage };
80
+ //# sourceMappingURL=use-conversation-page.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-conversation-page.d.ts","names":[],"sources":["../../react/src/hooks/use-conversation-page.ts"],"sourcesContent":[],"mappings":";AASY,KAAA,0BAAA,GAA0B;EAwB1B;;;;gBAWH,EAAA,MAAA;;;;EAkDO,cAAA,CAAA,EAAA,MAAmB;EAAA;;;;;;;;UAhE1B;;KAGG,yBAAA;;;SAIJ;;SAEA;;;WAKC;;;;sBAIW;;;;;oBAOD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuCH,mBAAA,UACN,6BACP"}
@@ -0,0 +1,15 @@
1
+ //#region ../react/src/hooks/use-conversation-seen.d.ts
2
+ type UseConversationSeenOptions = {
3
+ initialData?: ConversationSeen[];
4
+ };
5
+ declare function useConversationSeen(conversationId: string | null | undefined, options?: UseConversationSeenOptions): ConversationSeen[];
6
+ /**
7
+ * Debounced version of useConversationSeen that delays updates by 500ms
8
+ * to prevent animation conflicts when messages are sent and immediately seen.
9
+ *
10
+ * Use this in UI components where smooth animations are critical.
11
+ */
12
+ declare function useDebouncedConversationSeen(conversationId: string | null | undefined, options?: UseConversationSeenOptions, delay?: number): ConversationSeen[];
13
+ //#endregion
14
+ export { useConversationSeen, useDebouncedConversationSeen };
15
+ //# sourceMappingURL=use-conversation-seen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-conversation-seen.d.ts","names":[],"sources":["../../react/src/hooks/use-conversation-seen.ts"],"sourcesContent":[],"mappings":";AAAkE,KAI7D,0BAAA,GAA0B;EAYf,WAAA,CAAA,EAXD,gBAWoB,EAAA;CAAA;AAEzB,iBAFM,mBAAA,CAEN,cAAA,EAAA,MAAA,GAAA,IAAA,GAAA,SAAA,EAAA,OAAA,CAAA,EAAA,0BAAA,CAAA,EACP,gBADO,EAAA;;;AAsDV;;;;AAImB,iBAJH,4BAAA,CAIG,cAAA,EAAA,MAAA,GAAA,IAAA,GAAA,SAAA,EAAA,OAAA,CAAA,EAFT,0BAES,EAAA,KAAA,CAAA,EAAA,MAAA,CAAA,EAAhB,gBAAgB,EAAA"}
@@ -0,0 +1,19 @@
1
+ //#region ../react/src/hooks/use-conversation-timeline-items.d.ts
2
+
3
+ type UseConversationTimelineItemsOptions = {
4
+ limit?: number;
5
+ cursor?: string | null;
6
+ enabled?: boolean;
7
+ refetchInterval?: number | false;
8
+ refetchOnWindowFocus?: boolean;
9
+ };
10
+ type UseConversationTimelineItemsResult = ConversationTimelineItemsState & {
11
+ isLoading: boolean;
12
+ error: Error | null;
13
+ refetch: (args?: Pick<GetConversationTimelineItemsRequest, "cursor" | "limit">) => Promise<GetConversationTimelineItemsResponse | undefined>;
14
+ fetchNextPage: () => Promise<GetConversationTimelineItemsResponse | undefined>;
15
+ };
16
+ declare function useConversationTimelineItems(conversationId: string | null | undefined, options?: UseConversationTimelineItemsOptions): UseConversationTimelineItemsResult;
17
+ //#endregion
18
+ export { UseConversationTimelineItemsOptions, UseConversationTimelineItemsResult, useConversationTimelineItems };
19
+ //# sourceMappingURL=use-conversation-timeline-items.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-conversation-timeline-items.d.ts","names":[],"sources":["../../react/src/hooks/use-conversation-timeline-items.ts"],"sourcesContent":[],"mappings":";;AA4BY,KARA,mCAAA,GAQkC;EAAA,KAAA,CAAA,EAAA,MAAA;QAC7C,CAAA,EAAA,MAAA,GAAA,IAAA;SAEQ,CAAA,EAAA,OAAA;iBAEM,CAAA,EAAA,MAAA,GAAA,KAAA;sBAAL,CAAA,EAAA,OAAA;;AACH,KANK,kCAAA,GACX,8BAKM,GAAA;WAEJ,EAAA,OAAA;OADoB,EAJd,KAIc,GAAA,IAAA;EAAO,OAAA,EAAA,CAAA,IAAA,CAAA,EAFpB,IAEoB,CAFf,mCAEe,EAAA,QAAA,GAAA,OAAA,CAAA,EAAA,GADvB,OACuB,CADf,oCACe,GAAA,SAAA,CAAA;EAKd,aAAA,EAAA,GAAA,GALO,OAKP,CAJb,oCAIyC,GAAA,SAAA,CAAA;CAAA;AAElC,iBAFM,4BAAA,CAEN,cAAA,EAAA,MAAA,GAAA,IAAA,GAAA,SAAA,EAAA,OAAA,CAAA,EAAA,mCAAA,CAAA,EACP,kCADO"}
@@ -0,0 +1,11 @@
1
+ //#region ../react/src/hooks/use-conversation-typing.d.ts
2
+ type ConversationTypingParticipant = TypingEntry;
3
+ type UseConversationTypingOptions = {
4
+ excludeVisitorId?: string | null;
5
+ excludeUserId?: string | null;
6
+ excludeAiAgentId?: string | null;
7
+ };
8
+ declare function useConversationTyping(conversationId: string | null | undefined, options?: UseConversationTypingOptions): ConversationTypingParticipant[];
9
+ //#endregion
10
+ export { ConversationTypingParticipant, useConversationTyping };
11
+ //# sourceMappingURL=use-conversation-typing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-conversation-typing.d.ts","names":[],"sources":["../../react/src/hooks/use-conversation-typing.ts"],"sourcesContent":[],"mappings":";AAIY,KAAA,6BAAA,GAAgC,WAAA;AAAY,KAEnD,4BAAA,GAA4B;EAyBjB,gBAAA,CAAA,EAAA,MAAqB,GAAA,IAAA;EAAA,aAAA,CAAA,EAAA,MAAA,GAAA,IAAA;kBAE3B,CAAA,EAAA,MAAA,GAAA,IAAA;;AACsB,iBAHhB,qBAAA,CAGgB,cAAA,EAAA,MAAA,GAAA,IAAA,GAAA,SAAA,EAAA,OAAA,CAAA,EADtB,4BACsB,CAAA,EAA7B,6BAA6B,EAAA"}
@@ -0,0 +1,16 @@
1
+ //#region ../react/src/hooks/use-conversation.d.ts
2
+ type UseConversationOptions = {
3
+ enabled?: boolean;
4
+ refetchInterval?: number | false;
5
+ refetchOnWindowFocus?: boolean;
6
+ };
7
+ type UseConversationResult = {
8
+ conversation: GetConversationResponse["conversation"] | null;
9
+ isLoading: boolean;
10
+ error: Error | null;
11
+ refetch: (args?: GetConversationRequest) => Promise<GetConversationResponse | undefined>;
12
+ };
13
+ declare function useConversation(conversationId: string | null, options?: UseConversationOptions): UseConversationResult;
14
+ //#endregion
15
+ export { UseConversationOptions, UseConversationResult, useConversation };
16
+ //# sourceMappingURL=use-conversation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-conversation.d.ts","names":[],"sources":["../../react/src/hooks/use-conversation.ts"],"sourcesContent":[],"mappings":";AAQY,KAAA,sBAAA,GAAsB;EAMtB,OAAA,CAAA,EAAA,OAAA;EAAqB,eAAA,CAAA,EAAA,MAAA,GAAA,KAAA;sBAClB,CAAA,EAAA,OAAA;;AAIN,KALG,qBAAA,GAKH;cACK,EALC,uBAKD,CAAA,cAAA,CAAA,GAAA,IAAA;WAAR,EAAA,OAAA;EAAO,KAAA,EAHL,KAGK,GAAA,IAAA;EAGG,OAAA,EAAA,CAAA,IAAe,CAAf,EAJP,sBAIsB,EAAA,GAHzB,OAGyB,CAHjB,uBAGiB,GAAA,SAAA,CAAA;CAAA;AAErB,iBAFM,eAAA,CAEN,cAAA,EAAA,MAAA,GAAA,IAAA,EAAA,OAAA,CAAA,EAAA,sBAAA,CAAA,EACP,qBADO"}
@@ -0,0 +1,18 @@
1
+ //#region ../react/src/hooks/use-conversations.d.ts
2
+
3
+ type UseConversationsOptions = Partial<Omit<ListConversationsRequest, "visitorId">> & {
4
+ enabled?: boolean;
5
+ refetchInterval?: number | false;
6
+ refetchOnWindowFocus?: boolean;
7
+ };
8
+ type UseConversationsResult = {
9
+ conversations: ListConversationsResponse["conversations"];
10
+ pagination: ConversationPagination | null;
11
+ isLoading: boolean;
12
+ error: Error | null;
13
+ refetch: (args?: Partial<ListConversationsRequest>) => Promise<ListConversationsResponse | undefined>;
14
+ };
15
+ declare function useConversations(options?: UseConversationsOptions): UseConversationsResult;
16
+ //#endregion
17
+ export { UseConversationsOptions, UseConversationsResult, useConversations };
18
+ //# sourceMappingURL=use-conversations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-conversations.d.ts","names":[],"sources":["../../react/src/hooks/use-conversations.ts"],"sourcesContent":[],"mappings":";;AA0CmC,KAAvB,uBAAA,GAA0B,OAAH,CAClC,IADkC,CAC7B,wBAD6B,EAAA,WAAA,CAAA,CAAA,GAAA;SAC7B,CAAA,EAAA,OAAA;iBAAL,CAAA,EAAA,MAAA,GAAA,KAAA;sBADqC,CAAA,EAAA,OAAA;CAAO;AAQjC,KAAA,sBAAA,GAAsB;EAAA,aAAA,EAClB,yBADkB,CAAA,eAAA,CAAA;YAClB,EACH,sBADG,GAAA,IAAA;WACH,EAAA,OAAA;OAEL,EAAA,KAAA,GAAA,IAAA;SAES,EAAA,CAAA,IAAA,CAAA,EAAR,OAAQ,CAAA,wBAAA,CAAA,EAAA,GACX,OADW,CACH,yBADG,GAAA,SAAA,CAAA;;AACH,iBAGE,gBAAA,CAHF,OAAA,CAAA,EAIJ,uBAJI,CAAA,EAKX,sBALW"}
@@ -0,0 +1,26 @@
1
+ //#region ../react/src/hooks/use-create-conversation.d.ts
2
+
3
+ type UseCreateConversationOptions = {
4
+ client?: CossistantClient;
5
+ onSuccess?: (data: CreateConversationResponseBody) => void;
6
+ onError?: (error: Error) => void;
7
+ };
8
+ type CreateConversationVariables = {
9
+ conversationId?: string;
10
+ defaultTimelineItems?: TimelineItem[];
11
+ visitorId?: string;
12
+ websiteId?: string | null;
13
+ status?: Conversation["status"];
14
+ title?: string | null;
15
+ };
16
+ type UseCreateConversationResult = {
17
+ mutate: (variables?: CreateConversationVariables) => void;
18
+ mutateAsync: (variables?: CreateConversationVariables) => Promise<CreateConversationResponseBody | null>;
19
+ isPending: boolean;
20
+ error: Error | null;
21
+ reset: () => void;
22
+ };
23
+ declare function useCreateConversation(options?: UseCreateConversationOptions): UseCreateConversationResult;
24
+ //#endregion
25
+ export { CreateConversationVariables, UseCreateConversationOptions, UseCreateConversationResult, useCreateConversation };
26
+ //# sourceMappingURL=use-create-conversation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-create-conversation.d.ts","names":[],"sources":["../../react/src/hooks/use-create-conversation.ts"],"sourcesContent":[],"mappings":";;AASoB,KAFR,4BAAA,GAEQ;QACD,CAAA,EAFT,gBAES;EAAK,SAAA,CAAA,EAAA,CAAA,IAAA,EADJ,8BACI,EAAA,GAAA,IAAA;EAGZ,OAAA,CAAA,EAAA,CAAA,KAAA,EAHO,KAGP,EAAA,GAAA,IAA2B;CAAA;AAEf,KAFZ,2BAAA,GAEY;gBAGd,CAAA,EAAA,MAAA;EAAY,oBAAA,CAAA,EAHE,YAGF,EAAA;EAIV,SAAA,CAAA,EAAA,MAAA;EAA2B,SAAA,CAAA,EAAA,MAAA,GAAA,IAAA;QACjB,CAAA,EALZ,YAKY,CAAA,QAAA,CAAA;OAER,CAAA,EAAA,MAAA,GAAA,IAAA;;AACR,KAJM,2BAAA,GAIN;QAEE,EAAA,CAAA,SAAA,CAAA,EALc,2BAKd,EAAA,GAAA,IAAA;EAAK,WAAA,EAAA,CAAA,SAAA,CAAA,EAHC,2BAGD,EAAA,GAFP,OAEO,CAFC,8BAED,GAAA,IAAA,CAAA;EAgBG,SAAA,EAAA,OAAA;EAAqB,KAAA,EAhB7B,KAgB6B,GAAA,IAAA;OAC3B,EAAA,GAAA,GAAA,IAAA;;AACoB,iBAFd,qBAAA,CAEc,OAAA,CAAA,EADpB,4BACoB,CAAA,EAA3B,2BAA2B"}
@@ -0,0 +1,16 @@
1
+ //#region ../react/src/hooks/private/use-default-messages.d.ts
2
+ type UseDefaultMessagesParams = {
3
+ conversationId: string;
4
+ };
5
+ /**
6
+ * Mirrors the provider-configured default messages into timeline items so
7
+ * that welcome content renders immediately while the backend conversation is
8
+ * still being created. Agent fallbacks are resolved against available humans
9
+ * and AI agents exposed by the provider context.
10
+ */
11
+ declare function useDefaultMessages({
12
+ conversationId
13
+ }: UseDefaultMessagesParams): TimelineItem[];
14
+ //#endregion
15
+ export { useDefaultMessages };
16
+ //# sourceMappingURL=use-default-messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-default-messages.d.ts","names":[],"sources":["../../react/src/hooks/private/use-default-messages.ts"],"sourcesContent":[],"mappings":";AAEwE,KAInE,wBAAA,GAAwB;EAUb,cAAA,EAAA,MAAkB;CAAA;;;;;;;iBAAlB,kBAAA;;GAEb,2BAA2B"}
@@ -0,0 +1,51 @@
1
+ //#region ../react/src/hooks/private/use-grouped-messages.d.ts
2
+
3
+ type GroupedMessage = {
4
+ type: "message_group";
5
+ senderId: string;
6
+ senderType: SenderType;
7
+ items: TimelineItem[];
8
+ firstMessageId: string;
9
+ lastMessageId: string;
10
+ firstMessageTime: Date;
11
+ lastMessageTime: Date;
12
+ };
13
+ type TimelineEventItem = {
14
+ type: "timeline_event";
15
+ item: TimelineItem;
16
+ timestamp: Date;
17
+ };
18
+ type ConversationItem = GroupedMessage | TimelineEventItem;
19
+ type UseGroupedMessagesOptions = {
20
+ items: TimelineItem[];
21
+ seenData?: ConversationSeen[];
22
+ currentViewerId?: string;
23
+ viewerType?: SenderType;
24
+ };
25
+ type UseGroupedMessagesProps = UseGroupedMessagesOptions;
26
+ /**
27
+ * Batches sequential timeline items from the same sender into groups and enriches
28
+ * them with read-receipt helpers so UIs can render conversation timelines with
29
+ * minimal effort. Seen data is normalised into quick lookup maps for unread
30
+ * indicators.
31
+ */
32
+ declare const useGroupedMessages: ({
33
+ items,
34
+ seenData,
35
+ currentViewerId,
36
+ viewerType
37
+ }: UseGroupedMessagesOptions) => {
38
+ items: (GroupedMessage | TimelineEventItem)[];
39
+ seenByMap: Map<string, Set<string>>;
40
+ lastReadMessageMap: Map<string, string>;
41
+ unreadCountMap: Map<string, number>;
42
+ isMessageSeenByViewer: (messageId: string) => boolean;
43
+ getMessageSeenBy: (messageId: string) => string[];
44
+ getLastReadMessageId: (userId: string) => string | undefined;
45
+ isLastReadMessage: (messageId: string, userId: string) => boolean;
46
+ getUnreadCount: (userId: string) => number;
47
+ hasUnreadAfter: (messageId: string, userId: string) => boolean;
48
+ };
49
+ //#endregion
50
+ export { ConversationItem, GroupedMessage, TimelineEventItem, UseGroupedMessagesOptions, UseGroupedMessagesProps, useGroupedMessages };
51
+ //# sourceMappingURL=use-grouped-messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-grouped-messages.d.ts","names":[],"sources":["../../react/src/hooks/private/use-grouped-messages.ts"],"sourcesContent":[],"mappings":";;AAQa,KAHD,cAAA,GAGC;MACL,EAAA,eAAA;UAGW,EAAA,MAAA;YACD,EALL,UAKK;EAAI,KAAA,EAJd,YAIc,EAAA;EAGV,cAAA,EAAA,MAAiB;EAAA,aAAA,EAAA,MAAA;kBAEtB,EANY,IAMZ;iBACK,EANM,IAMN;CAAI;AAGJ,KANA,iBAAA,GAMgB;EAAA,IAAA,EAAA,gBAAA;MAAG,EAJxB,YAIwB;WAAiB,EAHpC,IAGoC;CAAiB;AAErD,KAFA,gBAAA,GAAmB,cAEM,GAFW,iBAEX;AAAA,KAAzB,yBAAA,GAAyB;OAC7B,EAAA,YAAA,EAAA;UACI,CAAA,EAAA,gBAAA,EAAA;iBAEE,CAAA,EAAA,MAAA;EAAU,UAAA,CAAA,EAAV,UAAU;AAGxB,CAAA;AAuMa,KAvMD,uBAAA,GAA0B,yBA6PrC;;;;;;;cAtDY;;;;;GAKV"}