@oyehello/chat 0.3.0 → 0.5.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/index.d.cts CHANGED
@@ -52,7 +52,21 @@ type ChatEvent = {
52
52
  } | {
53
53
  type: 'agent_typing';
54
54
  active: boolean;
55
+ } | {
56
+ type: 'suggestions';
57
+ turnId: string;
58
+ items: string[];
55
59
  };
60
+ interface WidgetConfig {
61
+ teaser: string;
62
+ brand: {
63
+ name: string | null;
64
+ logoUrl: string | null;
65
+ accentColor: string | null;
66
+ } | null;
67
+ offline?: boolean;
68
+ offlineMessage?: string;
69
+ }
56
70
  interface OpenSessionResponse {
57
71
  sessionId: string;
58
72
  sessionToken: string;
@@ -61,6 +75,7 @@ interface OpenSessionResponse {
61
75
  id: string;
62
76
  name: string;
63
77
  };
78
+ protocol?: number;
64
79
  }
65
80
  interface ChatClientOptions {
66
81
  apiKey: string;
@@ -116,17 +131,22 @@ type ChatClientEvent = {
116
131
  } | {
117
132
  type: 'agentTyping';
118
133
  active: boolean;
134
+ } | {
135
+ type: 'suggestions';
136
+ items: string[];
119
137
  };
120
138
  type ChatToolHandler = (args: Record<string, unknown>) => unknown | Promise<unknown>;
121
139
  interface ChatClient {
122
140
  start(): Promise<void>;
123
141
  sendMessage(text: string, files?: File[]): Promise<void>;
124
142
  end(): Promise<void>;
143
+ reset(): void;
125
144
  getMessages(): ChatMessage[];
126
145
  getState(): ChatClientState;
127
146
  on(listener: (e: ChatClientEvent) => void): () => void;
128
147
  registerTools(handlers: Record<string, ChatToolHandler>): void;
129
148
  getAttachmentUrl(storageRef: string): Promise<string>;
149
+ getWidgetConfig(): Promise<WidgetConfig>;
130
150
  }
131
151
  declare function createChatClient(options: ChatClientOptions): ChatClient;
132
152
 
@@ -158,20 +178,36 @@ declare class OyehelloChatElement extends HTMLElement {
158
178
  private renderedCount;
159
179
  private renderedBotFinal;
160
180
  private timers;
181
+ private serverSuggestions;
182
+ private streamId;
183
+ private streamEl;
184
+ private audioCtx;
185
+ private teaserText;
186
+ private teaserShownOnce;
187
+ private offline;
188
+ private offlineMessage;
189
+ private configLoaded;
190
+ private idleTimer;
191
+ private idleReset;
161
192
  private oc;
162
193
  private bodyEl;
163
194
  private textareaEl;
164
195
  private fileEl;
165
196
  private titleEl;
166
197
  private statusEl;
167
- private errEl;
168
198
  private emojiListEl;
169
199
  private emojiSearchEl;
170
200
  connectedCallback(): void;
201
+ private armIdleTeaser;
202
+ private teardownIdle;
203
+ private loadWidgetConfig;
204
+ private applyTeaserText;
205
+ private applyBrandLogo;
171
206
  disconnectedCallback(): void;
172
207
  registerTools(handlers: Record<string, ChatToolHandler>): void;
173
208
  private key;
174
- private get suggestions();
209
+ private get attrSuggestions();
210
+ private get chipLabels();
175
211
  private renderShell;
176
212
  private renderError;
177
213
  private updateClasses;
@@ -190,6 +226,9 @@ declare class OyehelloChatElement extends HTMLElement {
190
226
  private doSend;
191
227
  private sendChip;
192
228
  private bindChips;
229
+ private startFresh;
230
+ private maybeChime;
231
+ private playChime;
193
232
  private toggleEmoji;
194
233
  private closeEmoji;
195
234
  private renderEmoji;
@@ -200,4 +239,4 @@ declare class OyehelloChatElement extends HTMLElement {
200
239
  private escapeAttr;
201
240
  }
202
241
 
203
- export { ChatApiError, type ChatAttachmentDescriptor, type ChatClient, type ChatClientEvent, type ChatClientOptions, type ChatClientState, type ChatEvent, type ChatMessage, type ChatToolHandler, type OpenSessionResponse, OyehelloChatElement, createChatClient };
242
+ export { ChatApiError, type ChatAttachmentDescriptor, type ChatClient, type ChatClientEvent, type ChatClientOptions, type ChatClientState, type ChatEvent, type ChatMessage, type ChatToolHandler, type OpenSessionResponse, OyehelloChatElement, type WidgetConfig, createChatClient };
package/dist/index.d.ts CHANGED
@@ -52,7 +52,21 @@ type ChatEvent = {
52
52
  } | {
53
53
  type: 'agent_typing';
54
54
  active: boolean;
55
+ } | {
56
+ type: 'suggestions';
57
+ turnId: string;
58
+ items: string[];
55
59
  };
60
+ interface WidgetConfig {
61
+ teaser: string;
62
+ brand: {
63
+ name: string | null;
64
+ logoUrl: string | null;
65
+ accentColor: string | null;
66
+ } | null;
67
+ offline?: boolean;
68
+ offlineMessage?: string;
69
+ }
56
70
  interface OpenSessionResponse {
57
71
  sessionId: string;
58
72
  sessionToken: string;
@@ -61,6 +75,7 @@ interface OpenSessionResponse {
61
75
  id: string;
62
76
  name: string;
63
77
  };
78
+ protocol?: number;
64
79
  }
65
80
  interface ChatClientOptions {
66
81
  apiKey: string;
@@ -116,17 +131,22 @@ type ChatClientEvent = {
116
131
  } | {
117
132
  type: 'agentTyping';
118
133
  active: boolean;
134
+ } | {
135
+ type: 'suggestions';
136
+ items: string[];
119
137
  };
120
138
  type ChatToolHandler = (args: Record<string, unknown>) => unknown | Promise<unknown>;
121
139
  interface ChatClient {
122
140
  start(): Promise<void>;
123
141
  sendMessage(text: string, files?: File[]): Promise<void>;
124
142
  end(): Promise<void>;
143
+ reset(): void;
125
144
  getMessages(): ChatMessage[];
126
145
  getState(): ChatClientState;
127
146
  on(listener: (e: ChatClientEvent) => void): () => void;
128
147
  registerTools(handlers: Record<string, ChatToolHandler>): void;
129
148
  getAttachmentUrl(storageRef: string): Promise<string>;
149
+ getWidgetConfig(): Promise<WidgetConfig>;
130
150
  }
131
151
  declare function createChatClient(options: ChatClientOptions): ChatClient;
132
152
 
@@ -158,20 +178,36 @@ declare class OyehelloChatElement extends HTMLElement {
158
178
  private renderedCount;
159
179
  private renderedBotFinal;
160
180
  private timers;
181
+ private serverSuggestions;
182
+ private streamId;
183
+ private streamEl;
184
+ private audioCtx;
185
+ private teaserText;
186
+ private teaserShownOnce;
187
+ private offline;
188
+ private offlineMessage;
189
+ private configLoaded;
190
+ private idleTimer;
191
+ private idleReset;
161
192
  private oc;
162
193
  private bodyEl;
163
194
  private textareaEl;
164
195
  private fileEl;
165
196
  private titleEl;
166
197
  private statusEl;
167
- private errEl;
168
198
  private emojiListEl;
169
199
  private emojiSearchEl;
170
200
  connectedCallback(): void;
201
+ private armIdleTeaser;
202
+ private teardownIdle;
203
+ private loadWidgetConfig;
204
+ private applyTeaserText;
205
+ private applyBrandLogo;
171
206
  disconnectedCallback(): void;
172
207
  registerTools(handlers: Record<string, ChatToolHandler>): void;
173
208
  private key;
174
- private get suggestions();
209
+ private get attrSuggestions();
210
+ private get chipLabels();
175
211
  private renderShell;
176
212
  private renderError;
177
213
  private updateClasses;
@@ -190,6 +226,9 @@ declare class OyehelloChatElement extends HTMLElement {
190
226
  private doSend;
191
227
  private sendChip;
192
228
  private bindChips;
229
+ private startFresh;
230
+ private maybeChime;
231
+ private playChime;
193
232
  private toggleEmoji;
194
233
  private closeEmoji;
195
234
  private renderEmoji;
@@ -200,4 +239,4 @@ declare class OyehelloChatElement extends HTMLElement {
200
239
  private escapeAttr;
201
240
  }
202
241
 
203
- export { ChatApiError, type ChatAttachmentDescriptor, type ChatClient, type ChatClientEvent, type ChatClientOptions, type ChatClientState, type ChatEvent, type ChatMessage, type ChatToolHandler, type OpenSessionResponse, OyehelloChatElement, createChatClient };
242
+ export { ChatApiError, type ChatAttachmentDescriptor, type ChatClient, type ChatClientEvent, type ChatClientOptions, type ChatClientState, type ChatEvent, type ChatMessage, type ChatToolHandler, type OpenSessionResponse, OyehelloChatElement, type WidgetConfig, createChatClient };