open-chat-studio-widget 0.4.5 → 0.4.7
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 +118 -94
- package/dist/cjs/{index-bcb28089.js → index-c9203be6.js} +29 -3
- package/dist/cjs/index-c9203be6.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/open-chat-studio-widget.cjs.entry.js +314 -73
- package/dist/cjs/open-chat-studio-widget.cjs.entry.js.map +1 -1
- package/dist/cjs/open-chat-studio-widget.cjs.js +2 -2
- package/dist/collection/components/ocs-chat/heroicons.js +11 -2
- package/dist/collection/components/ocs-chat/heroicons.js.map +1 -1
- package/dist/collection/components/ocs-chat/ocs-chat.css +362 -110
- package/dist/collection/components/ocs-chat/ocs-chat.js +367 -78
- package/dist/collection/components/ocs-chat/ocs-chat.js.map +1 -1
- package/dist/components/open-chat-studio-widget.js +323 -78
- package/dist/components/open-chat-studio-widget.js.map +1 -1
- package/dist/esm/{index-205c77bc.js → index-0349ca51.js} +29 -3
- package/dist/esm/index-0349ca51.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/open-chat-studio-widget.entry.js +314 -73
- package/dist/esm/open-chat-studio-widget.entry.js.map +1 -1
- package/dist/esm/open-chat-studio-widget.js +3 -3
- package/dist/open-chat-studio-widget/open-chat-studio-widget.esm.js +1 -1
- package/dist/open-chat-studio-widget/open-chat-studio-widget.esm.js.map +1 -1
- package/dist/open-chat-studio-widget/{p-78d09c6b.js → p-3dc66a9a.js} +3 -3
- package/dist/open-chat-studio-widget/p-3dc66a9a.js.map +1 -0
- package/dist/open-chat-studio-widget/p-6b9a332c.entry.js +4 -0
- package/dist/open-chat-studio-widget/p-6b9a332c.entry.js.map +1 -0
- package/dist/types/components/ocs-chat/heroicons.d.ts +4 -1
- package/dist/types/components/ocs-chat/ocs-chat.d.ts +51 -9
- package/dist/types/components.d.ts +24 -0
- package/package.json +1 -1
- package/dist/cjs/index-bcb28089.js.map +0 -1
- package/dist/esm/index-205c77bc.js.map +0 -1
- package/dist/open-chat-studio-widget/p-5d6bd56a.entry.js +0 -4
- package/dist/open-chat-studio-widget/p-5d6bd56a.entry.js.map +0 -1
- package/dist/open-chat-studio-widget/p-78d09c6b.js.map +0 -1
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export declare const XMarkIcon: () => any;
|
|
2
2
|
export declare const GripDotsVerticalIcon: () => any;
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const PlusWithCircleIcon: () => any;
|
|
4
4
|
export declare const ArrowsPointingOutIcon: () => any;
|
|
5
5
|
export declare const ArrowsPointingInIcon: () => any;
|
|
6
|
+
export declare const PaperClipIcon: () => any;
|
|
7
|
+
export declare const CheckDocumentIcon: () => any;
|
|
8
|
+
export declare const XIcon: () => any;
|
|
@@ -9,7 +9,17 @@ interface ChatAttachment {
|
|
|
9
9
|
name: string;
|
|
10
10
|
content_type: string;
|
|
11
11
|
size: number;
|
|
12
|
-
|
|
12
|
+
}
|
|
13
|
+
interface UploadedFile {
|
|
14
|
+
id: number;
|
|
15
|
+
name: string;
|
|
16
|
+
size: number;
|
|
17
|
+
content_type: string;
|
|
18
|
+
}
|
|
19
|
+
interface SelectedFile {
|
|
20
|
+
file: File;
|
|
21
|
+
uploaded?: UploadedFile;
|
|
22
|
+
error?: string;
|
|
13
23
|
}
|
|
14
24
|
export declare class OcsChat {
|
|
15
25
|
private static readonly TASK_POLLING_MAX_ATTEMPTS;
|
|
@@ -20,6 +30,9 @@ export declare class OcsChat {
|
|
|
20
30
|
private static readonly MOBILE_BREAKPOINT;
|
|
21
31
|
private static readonly WINDOW_MARGIN;
|
|
22
32
|
private static readonly LOCALSTORAGE_TEST_KEY;
|
|
33
|
+
private static readonly MAX_FILE_SIZE_MB;
|
|
34
|
+
private static readonly MAX_TOTAL_SIZE_MB;
|
|
35
|
+
private static readonly SUPPORTED_FILE_EXTENSIONS;
|
|
23
36
|
/**
|
|
24
37
|
* The ID of the chatbot to connect to.
|
|
25
38
|
*/
|
|
@@ -44,6 +57,10 @@ export declare class OcsChat {
|
|
|
44
57
|
* The text to place in the header.
|
|
45
58
|
*/
|
|
46
59
|
headerText: '';
|
|
60
|
+
/**
|
|
61
|
+
* The message to display in the new chat confirmation dialog.
|
|
62
|
+
*/
|
|
63
|
+
newChatConfirmationMessage?: string;
|
|
47
64
|
/**
|
|
48
65
|
* Whether the chat widget is visible on load.
|
|
49
66
|
*/
|
|
@@ -81,16 +98,21 @@ export declare class OcsChat {
|
|
|
81
98
|
* Allow the user to make the chat window full screen.
|
|
82
99
|
*/
|
|
83
100
|
allowFullScreen: boolean;
|
|
84
|
-
|
|
101
|
+
/**
|
|
102
|
+
* Allow the user to attach files to their messages.
|
|
103
|
+
*/
|
|
104
|
+
allowAttachments: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* The text to display while the assistant is typing/preparing a response.
|
|
107
|
+
*/
|
|
108
|
+
typingIndicatorText?: string;
|
|
85
109
|
error: string;
|
|
86
110
|
messages: ChatMessage[];
|
|
87
111
|
sessionId?: string;
|
|
88
112
|
isLoading: boolean;
|
|
89
113
|
isTyping: boolean;
|
|
90
114
|
messageInput: string;
|
|
91
|
-
|
|
92
|
-
lastPollTime?: Date;
|
|
93
|
-
isTaskPolling: boolean;
|
|
115
|
+
currentPollTaskId: string;
|
|
94
116
|
isDragging: boolean;
|
|
95
117
|
dragOffset: {
|
|
96
118
|
x: number;
|
|
@@ -103,21 +125,28 @@ export declare class OcsChat {
|
|
|
103
125
|
fullscreenPosition: {
|
|
104
126
|
x: number;
|
|
105
127
|
};
|
|
106
|
-
showStarterQuestions: boolean;
|
|
107
128
|
parsedWelcomeMessages: string[];
|
|
108
129
|
parsedStarterQuestions: string[];
|
|
109
130
|
generatedUserId?: string;
|
|
110
131
|
isFullscreen: boolean;
|
|
132
|
+
showNewChatConfirmation: boolean;
|
|
133
|
+
selectedFiles: SelectedFile[];
|
|
134
|
+
isUploadingFiles: boolean;
|
|
135
|
+
private pollingIntervalRef?;
|
|
111
136
|
private messageListRef?;
|
|
112
137
|
private textareaRef?;
|
|
113
138
|
private chatWindowRef?;
|
|
139
|
+
private fileInputRef?;
|
|
114
140
|
private chatWindowHeight;
|
|
115
141
|
private chatWindowWidth;
|
|
116
142
|
private chatWindowFullscreenWidth;
|
|
143
|
+
private positionInitialized;
|
|
117
144
|
host: HTMLElement;
|
|
118
145
|
componentWillLoad(): void;
|
|
119
146
|
componentDidLoad(): void;
|
|
120
147
|
disconnectedCallback(): void;
|
|
148
|
+
private addErrorMessage;
|
|
149
|
+
private handleError;
|
|
121
150
|
private parseJSONProp;
|
|
122
151
|
private parseWelcomeMessages;
|
|
123
152
|
private parseStarterQuestions;
|
|
@@ -125,6 +154,8 @@ export declare class OcsChat {
|
|
|
125
154
|
private getApiBaseUrl;
|
|
126
155
|
private getApiHeaders;
|
|
127
156
|
private startSession;
|
|
157
|
+
private markPendingFilesWithError;
|
|
158
|
+
private uploadFiles;
|
|
128
159
|
private sendMessage;
|
|
129
160
|
private handleStarterQuestionClick;
|
|
130
161
|
private pollTaskResponse;
|
|
@@ -132,13 +163,21 @@ export declare class OcsChat {
|
|
|
132
163
|
private pauseMessagePolling;
|
|
133
164
|
private resumeMessagePolling;
|
|
134
165
|
private pollForMessages;
|
|
135
|
-
private clearError;
|
|
136
166
|
private scrollToBottom;
|
|
137
167
|
private focusInput;
|
|
138
168
|
private handleKeyPress;
|
|
139
169
|
private handleInputChange;
|
|
170
|
+
private handleFileSelect;
|
|
171
|
+
private removeSelectedFile;
|
|
172
|
+
private formatFileSize;
|
|
140
173
|
private formatTime;
|
|
141
|
-
|
|
174
|
+
private toggleWindowVisibility;
|
|
175
|
+
/**
|
|
176
|
+
* Watch for changes to the `visible` attribute and update accordingly.
|
|
177
|
+
*
|
|
178
|
+
* @param visible - The new value for the field.
|
|
179
|
+
*/
|
|
180
|
+
visibilityHandler(visible: boolean): Promise<void>;
|
|
142
181
|
setPosition(position: 'left' | 'center' | 'right'): void;
|
|
143
182
|
getPositionClasses(): string;
|
|
144
183
|
private getFullscreenBounds;
|
|
@@ -174,7 +213,10 @@ export declare class OcsChat {
|
|
|
174
213
|
private getOrGenerateUserId;
|
|
175
214
|
private clearSessionStorage;
|
|
176
215
|
private isLocalStorageAvailable;
|
|
177
|
-
private
|
|
216
|
+
private showConfirmationDialog;
|
|
217
|
+
private hideConfirmationDialog;
|
|
218
|
+
private confirmNewChat;
|
|
219
|
+
private actuallyStartNewChat;
|
|
178
220
|
private toggleFullscreen;
|
|
179
221
|
render(): any;
|
|
180
222
|
}
|
|
@@ -7,6 +7,10 @@
|
|
|
7
7
|
import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
|
|
8
8
|
export namespace Components {
|
|
9
9
|
interface OpenChatStudioWidget {
|
|
10
|
+
/**
|
|
11
|
+
* Allow the user to attach files to their messages.
|
|
12
|
+
*/
|
|
13
|
+
"allowAttachments": boolean;
|
|
10
14
|
/**
|
|
11
15
|
* Allow the user to make the chat window full screen.
|
|
12
16
|
*/
|
|
@@ -35,6 +39,10 @@ export namespace Components {
|
|
|
35
39
|
* URL of the icon to display on the button. If not provided, uses the default OCS logo.
|
|
36
40
|
*/
|
|
37
41
|
"iconUrl"?: string;
|
|
42
|
+
/**
|
|
43
|
+
* The message to display in the new chat confirmation dialog.
|
|
44
|
+
*/
|
|
45
|
+
"newChatConfirmationMessage"?: string;
|
|
38
46
|
/**
|
|
39
47
|
* Whether to persist session data to local storage to allow resuming previous conversations after page reload.
|
|
40
48
|
*/
|
|
@@ -51,6 +59,10 @@ export namespace Components {
|
|
|
51
59
|
* Array of starter questions that users can click to send (JSON array of strings)
|
|
52
60
|
*/
|
|
53
61
|
"starterQuestions"?: string;
|
|
62
|
+
/**
|
|
63
|
+
* The text to display while the assistant is typing/preparing a response.
|
|
64
|
+
*/
|
|
65
|
+
"typingIndicatorText"?: string;
|
|
54
66
|
/**
|
|
55
67
|
* Used to associate chat sessions with a specific user across multiple visits/sessions
|
|
56
68
|
*/
|
|
@@ -82,6 +94,10 @@ declare global {
|
|
|
82
94
|
}
|
|
83
95
|
declare namespace LocalJSX {
|
|
84
96
|
interface OpenChatStudioWidget {
|
|
97
|
+
/**
|
|
98
|
+
* Allow the user to attach files to their messages.
|
|
99
|
+
*/
|
|
100
|
+
"allowAttachments"?: boolean;
|
|
85
101
|
/**
|
|
86
102
|
* Allow the user to make the chat window full screen.
|
|
87
103
|
*/
|
|
@@ -110,6 +126,10 @@ declare namespace LocalJSX {
|
|
|
110
126
|
* URL of the icon to display on the button. If not provided, uses the default OCS logo.
|
|
111
127
|
*/
|
|
112
128
|
"iconUrl"?: string;
|
|
129
|
+
/**
|
|
130
|
+
* The message to display in the new chat confirmation dialog.
|
|
131
|
+
*/
|
|
132
|
+
"newChatConfirmationMessage"?: string;
|
|
113
133
|
/**
|
|
114
134
|
* Whether to persist session data to local storage to allow resuming previous conversations after page reload.
|
|
115
135
|
*/
|
|
@@ -126,6 +146,10 @@ declare namespace LocalJSX {
|
|
|
126
146
|
* Array of starter questions that users can click to send (JSON array of strings)
|
|
127
147
|
*/
|
|
128
148
|
"starterQuestions"?: string;
|
|
149
|
+
/**
|
|
150
|
+
* The text to display while the assistant is typing/preparing a response.
|
|
151
|
+
*/
|
|
152
|
+
"typingIndicatorText"?: string;
|
|
129
153
|
/**
|
|
130
154
|
* Used to associate chat sessions with a specific user across multiple visits/sessions
|
|
131
155
|
*/
|