@v-tilt/browser 1.4.1 → 1.4.2

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.
@@ -4,7 +4,7 @@
4
4
  * Type definitions for the chat widget extension.
5
5
  * Core types are re-exported from globals.ts for consistency.
6
6
  */
7
- export type { ChatMessage, ChatChannel, ChatConfig, ChatTheme, LazyLoadedChatInterface, } from "../../utils/globals";
7
+ export type { ChatMessage, ChatChannel, ChatChannelSummary, ChatConfig, ChatTheme, ChatWidgetView, LazyLoadedChatInterface, } from "../../utils/globals";
8
8
  /**
9
9
  * Sender types for chat messages
10
10
  */
@@ -106,6 +106,8 @@ export interface ChatWidgetState {
106
106
  isConnected: boolean;
107
107
  isLoading: boolean;
108
108
  unreadCount: number;
109
+ currentView: import("../../utils/globals").ChatWidgetView;
110
+ channels: import("../../utils/globals").ChatChannelSummary[];
109
111
  channel: import("../../utils/globals").ChatChannel | null;
110
112
  messages: import("../../utils/globals").ChatMessage[];
111
113
  isTyping: boolean;
@@ -76,6 +76,25 @@ export interface ChatChannel {
76
76
  agent_last_read_at: string | null;
77
77
  created_at: string;
78
78
  }
79
+ /**
80
+ * Lightweight channel summary for channel list view
81
+ * Used to avoid loading full channel data until user selects one
82
+ */
83
+ export interface ChatChannelSummary {
84
+ id: string;
85
+ status: "open" | "closed" | "snoozed";
86
+ ai_mode: boolean;
87
+ last_message_at: string | null;
88
+ last_message_preview: string | null;
89
+ last_message_sender: "user" | "agent" | "ai" | "system" | null;
90
+ unread_count: number;
91
+ user_last_read_at: string | null;
92
+ created_at: string;
93
+ }
94
+ /**
95
+ * Widget view state - determines what UI to show
96
+ */
97
+ export type ChatWidgetView = "list" | "conversation";
79
98
  /**
80
99
  * Chat widget configuration
81
100
  *
@@ -138,11 +157,21 @@ export interface LazyLoadedChatInterface {
138
157
  readonly isLoading: boolean;
139
158
  readonly unreadCount: number;
140
159
  readonly channel: ChatChannel | null;
160
+ readonly channels: ChatChannelSummary[];
161
+ readonly currentView: ChatWidgetView;
141
162
  open(): void;
142
163
  close(): void;
143
164
  toggle(): void;
144
165
  show(): void;
145
166
  hide(): void;
167
+ /** Fetch/refresh the list of user's channels */
168
+ getChannels(): Promise<void>;
169
+ /** Select a channel and load its messages */
170
+ selectChannel(channelId: string): Promise<void>;
171
+ /** Create a new channel and enter it */
172
+ createChannel(): Promise<void>;
173
+ /** Go back to channel list from conversation view */
174
+ goToChannelList(): void;
146
175
  sendMessage(content: string): Promise<void>;
147
176
  markAsRead(): void;
148
177
  onMessage(callback: (message: ChatMessage) => void): () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@v-tilt/browser",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "vTilt browser tracking library",
5
5
  "main": "dist/main.js",
6
6
  "module": "dist/module.js",