@oyehello/chat 0.2.0 → 0.4.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/README.md +18 -2
- package/dist/index.cjs +722 -226
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +58 -17
- package/dist/index.d.ts +58 -17
- package/dist/index.global.js +726 -230
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +719 -223
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -52,7 +52,19 @@ 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
|
+
}
|
|
56
68
|
interface OpenSessionResponse {
|
|
57
69
|
sessionId: string;
|
|
58
70
|
sessionToken: string;
|
|
@@ -116,6 +128,9 @@ type ChatClientEvent = {
|
|
|
116
128
|
} | {
|
|
117
129
|
type: 'agentTyping';
|
|
118
130
|
active: boolean;
|
|
131
|
+
} | {
|
|
132
|
+
type: 'suggestions';
|
|
133
|
+
items: string[];
|
|
119
134
|
};
|
|
120
135
|
type ChatToolHandler = (args: Record<string, unknown>) => unknown | Promise<unknown>;
|
|
121
136
|
interface ChatClient {
|
|
@@ -127,6 +142,7 @@ interface ChatClient {
|
|
|
127
142
|
on(listener: (e: ChatClientEvent) => void): () => void;
|
|
128
143
|
registerTools(handlers: Record<string, ChatToolHandler>): void;
|
|
129
144
|
getAttachmentUrl(storageRef: string): Promise<string>;
|
|
145
|
+
getWidgetConfig(): Promise<WidgetConfig>;
|
|
130
146
|
}
|
|
131
147
|
declare function createChatClient(options: ChatClientOptions): ChatClient;
|
|
132
148
|
|
|
@@ -145,44 +161,69 @@ declare class OyehelloChatElement extends HTMLElement {
|
|
|
145
161
|
private imagePreviewCache;
|
|
146
162
|
private resolvedUrlCache;
|
|
147
163
|
private mdCache;
|
|
148
|
-
private
|
|
164
|
+
private receivedAt;
|
|
165
|
+
private uiOpen;
|
|
149
166
|
private started;
|
|
150
|
-
private
|
|
167
|
+
private uiMax;
|
|
168
|
+
private emojiOpen;
|
|
169
|
+
private emojiQuery;
|
|
170
|
+
private away;
|
|
151
171
|
private unseen;
|
|
172
|
+
private focused;
|
|
173
|
+
private teaserActive;
|
|
152
174
|
private renderedCount;
|
|
153
|
-
private
|
|
175
|
+
private renderedBotFinal;
|
|
176
|
+
private timers;
|
|
177
|
+
private serverSuggestions;
|
|
178
|
+
private teaserText;
|
|
179
|
+
private teaserShownOnce;
|
|
180
|
+
private idleTimer;
|
|
181
|
+
private idleReset;
|
|
182
|
+
private oc;
|
|
154
183
|
private bodyEl;
|
|
155
184
|
private textareaEl;
|
|
156
|
-
private sendEl;
|
|
157
185
|
private fileEl;
|
|
158
|
-
private pillEl;
|
|
159
|
-
private badgeEl;
|
|
160
|
-
private statusEl;
|
|
161
|
-
private errEl;
|
|
162
186
|
private titleEl;
|
|
187
|
+
private statusEl;
|
|
188
|
+
private emojiListEl;
|
|
189
|
+
private emojiSearchEl;
|
|
163
190
|
connectedCallback(): void;
|
|
191
|
+
private armIdleTeaser;
|
|
192
|
+
private teardownIdle;
|
|
193
|
+
private loadWidgetConfig;
|
|
194
|
+
private applyTeaserText;
|
|
195
|
+
private applyBrandLogo;
|
|
164
196
|
disconnectedCallback(): void;
|
|
165
197
|
registerTools(handlers: Record<string, ChatToolHandler>): void;
|
|
166
|
-
private
|
|
198
|
+
private key;
|
|
199
|
+
private get attrSuggestions();
|
|
200
|
+
private get chipLabels();
|
|
167
201
|
private renderShell;
|
|
168
202
|
private renderError;
|
|
169
|
-
private
|
|
203
|
+
private updateClasses;
|
|
204
|
+
private toggle;
|
|
170
205
|
private openPanel;
|
|
171
206
|
private closePanel;
|
|
207
|
+
private dismissTeaser;
|
|
172
208
|
private onClientEvent;
|
|
173
|
-
private
|
|
209
|
+
private updateHeader;
|
|
174
210
|
private updateStatus;
|
|
175
211
|
private renderMessages;
|
|
176
|
-
private
|
|
212
|
+
private parkLastQuestion;
|
|
213
|
+
private onScroll;
|
|
177
214
|
private scrollToBottom;
|
|
178
|
-
private updatePill;
|
|
179
|
-
private updateBadge;
|
|
180
215
|
private autoGrow;
|
|
181
216
|
private doSend;
|
|
182
|
-
private
|
|
217
|
+
private sendChip;
|
|
218
|
+
private bindChips;
|
|
219
|
+
private toggleEmoji;
|
|
220
|
+
private closeEmoji;
|
|
221
|
+
private renderEmoji;
|
|
222
|
+
private turnHtml;
|
|
223
|
+
private relTime;
|
|
183
224
|
private renderAttachment;
|
|
184
|
-
private renderSource;
|
|
185
225
|
private hydrateAttachmentImages;
|
|
226
|
+
private escapeAttr;
|
|
186
227
|
}
|
|
187
228
|
|
|
188
|
-
export { ChatApiError, type ChatAttachmentDescriptor, type ChatClient, type ChatClientEvent, type ChatClientOptions, type ChatClientState, type ChatEvent, type ChatMessage, type ChatToolHandler, type OpenSessionResponse, OyehelloChatElement, createChatClient };
|
|
229
|
+
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,19 @@ 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
|
+
}
|
|
56
68
|
interface OpenSessionResponse {
|
|
57
69
|
sessionId: string;
|
|
58
70
|
sessionToken: string;
|
|
@@ -116,6 +128,9 @@ type ChatClientEvent = {
|
|
|
116
128
|
} | {
|
|
117
129
|
type: 'agentTyping';
|
|
118
130
|
active: boolean;
|
|
131
|
+
} | {
|
|
132
|
+
type: 'suggestions';
|
|
133
|
+
items: string[];
|
|
119
134
|
};
|
|
120
135
|
type ChatToolHandler = (args: Record<string, unknown>) => unknown | Promise<unknown>;
|
|
121
136
|
interface ChatClient {
|
|
@@ -127,6 +142,7 @@ interface ChatClient {
|
|
|
127
142
|
on(listener: (e: ChatClientEvent) => void): () => void;
|
|
128
143
|
registerTools(handlers: Record<string, ChatToolHandler>): void;
|
|
129
144
|
getAttachmentUrl(storageRef: string): Promise<string>;
|
|
145
|
+
getWidgetConfig(): Promise<WidgetConfig>;
|
|
130
146
|
}
|
|
131
147
|
declare function createChatClient(options: ChatClientOptions): ChatClient;
|
|
132
148
|
|
|
@@ -145,44 +161,69 @@ declare class OyehelloChatElement extends HTMLElement {
|
|
|
145
161
|
private imagePreviewCache;
|
|
146
162
|
private resolvedUrlCache;
|
|
147
163
|
private mdCache;
|
|
148
|
-
private
|
|
164
|
+
private receivedAt;
|
|
165
|
+
private uiOpen;
|
|
149
166
|
private started;
|
|
150
|
-
private
|
|
167
|
+
private uiMax;
|
|
168
|
+
private emojiOpen;
|
|
169
|
+
private emojiQuery;
|
|
170
|
+
private away;
|
|
151
171
|
private unseen;
|
|
172
|
+
private focused;
|
|
173
|
+
private teaserActive;
|
|
152
174
|
private renderedCount;
|
|
153
|
-
private
|
|
175
|
+
private renderedBotFinal;
|
|
176
|
+
private timers;
|
|
177
|
+
private serverSuggestions;
|
|
178
|
+
private teaserText;
|
|
179
|
+
private teaserShownOnce;
|
|
180
|
+
private idleTimer;
|
|
181
|
+
private idleReset;
|
|
182
|
+
private oc;
|
|
154
183
|
private bodyEl;
|
|
155
184
|
private textareaEl;
|
|
156
|
-
private sendEl;
|
|
157
185
|
private fileEl;
|
|
158
|
-
private pillEl;
|
|
159
|
-
private badgeEl;
|
|
160
|
-
private statusEl;
|
|
161
|
-
private errEl;
|
|
162
186
|
private titleEl;
|
|
187
|
+
private statusEl;
|
|
188
|
+
private emojiListEl;
|
|
189
|
+
private emojiSearchEl;
|
|
163
190
|
connectedCallback(): void;
|
|
191
|
+
private armIdleTeaser;
|
|
192
|
+
private teardownIdle;
|
|
193
|
+
private loadWidgetConfig;
|
|
194
|
+
private applyTeaserText;
|
|
195
|
+
private applyBrandLogo;
|
|
164
196
|
disconnectedCallback(): void;
|
|
165
197
|
registerTools(handlers: Record<string, ChatToolHandler>): void;
|
|
166
|
-
private
|
|
198
|
+
private key;
|
|
199
|
+
private get attrSuggestions();
|
|
200
|
+
private get chipLabels();
|
|
167
201
|
private renderShell;
|
|
168
202
|
private renderError;
|
|
169
|
-
private
|
|
203
|
+
private updateClasses;
|
|
204
|
+
private toggle;
|
|
170
205
|
private openPanel;
|
|
171
206
|
private closePanel;
|
|
207
|
+
private dismissTeaser;
|
|
172
208
|
private onClientEvent;
|
|
173
|
-
private
|
|
209
|
+
private updateHeader;
|
|
174
210
|
private updateStatus;
|
|
175
211
|
private renderMessages;
|
|
176
|
-
private
|
|
212
|
+
private parkLastQuestion;
|
|
213
|
+
private onScroll;
|
|
177
214
|
private scrollToBottom;
|
|
178
|
-
private updatePill;
|
|
179
|
-
private updateBadge;
|
|
180
215
|
private autoGrow;
|
|
181
216
|
private doSend;
|
|
182
|
-
private
|
|
217
|
+
private sendChip;
|
|
218
|
+
private bindChips;
|
|
219
|
+
private toggleEmoji;
|
|
220
|
+
private closeEmoji;
|
|
221
|
+
private renderEmoji;
|
|
222
|
+
private turnHtml;
|
|
223
|
+
private relTime;
|
|
183
224
|
private renderAttachment;
|
|
184
|
-
private renderSource;
|
|
185
225
|
private hydrateAttachmentImages;
|
|
226
|
+
private escapeAttr;
|
|
186
227
|
}
|
|
187
228
|
|
|
188
|
-
export { ChatApiError, type ChatAttachmentDescriptor, type ChatClient, type ChatClientEvent, type ChatClientOptions, type ChatClientState, type ChatEvent, type ChatMessage, type ChatToolHandler, type OpenSessionResponse, OyehelloChatElement, createChatClient };
|
|
229
|
+
export { ChatApiError, type ChatAttachmentDescriptor, type ChatClient, type ChatClientEvent, type ChatClientOptions, type ChatClientState, type ChatEvent, type ChatMessage, type ChatToolHandler, type OpenSessionResponse, OyehelloChatElement, type WidgetConfig, createChatClient };
|