open-chat-studio-widget 0.4.4 → 0.4.6
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 +500 -79
- 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 +1042 -129
- package/dist/collection/components/ocs-chat/ocs-chat.js +380 -84
- package/dist/collection/components/ocs-chat/ocs-chat.js.map +1 -1
- package/dist/collection/utils/cookies.js +28 -0
- package/dist/collection/utils/cookies.js.map +1 -0
- package/dist/components/open-chat-studio-widget.js +509 -84
- 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 +500 -79
- 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-16df1b20.entry.js +4 -0
- package/dist/open-chat-studio-widget/p-16df1b20.entry.js.map +1 -0
- 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/types/components/ocs-chat/heroicons.d.ts +4 -1
- package/dist/types/components/ocs-chat/ocs-chat.d.ts +52 -9
- package/dist/types/components.d.ts +24 -0
- package/dist/types/utils/cookies.d.ts +4 -0
- package/package.json +3 -2
- 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-19d45fe5.entry.js +0 -3
- package/dist/open-chat-studio-widget/p-19d45fe5.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,27 +125,37 @@ 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;
|
|
124
153
|
private cleanup;
|
|
125
154
|
private getApiBaseUrl;
|
|
155
|
+
private getApiHeaders;
|
|
126
156
|
private startSession;
|
|
157
|
+
private markPendingFilesWithError;
|
|
158
|
+
private uploadFiles;
|
|
127
159
|
private sendMessage;
|
|
128
160
|
private handleStarterQuestionClick;
|
|
129
161
|
private pollTaskResponse;
|
|
@@ -131,13 +163,21 @@ export declare class OcsChat {
|
|
|
131
163
|
private pauseMessagePolling;
|
|
132
164
|
private resumeMessagePolling;
|
|
133
165
|
private pollForMessages;
|
|
134
|
-
private clearError;
|
|
135
166
|
private scrollToBottom;
|
|
136
167
|
private focusInput;
|
|
137
168
|
private handleKeyPress;
|
|
138
169
|
private handleInputChange;
|
|
170
|
+
private handleFileSelect;
|
|
171
|
+
private removeSelectedFile;
|
|
172
|
+
private formatFileSize;
|
|
139
173
|
private formatTime;
|
|
140
|
-
|
|
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>;
|
|
141
181
|
setPosition(position: 'left' | 'center' | 'right'): void;
|
|
142
182
|
getPositionClasses(): string;
|
|
143
183
|
private getFullscreenBounds;
|
|
@@ -173,7 +213,10 @@ export declare class OcsChat {
|
|
|
173
213
|
private getOrGenerateUserId;
|
|
174
214
|
private clearSessionStorage;
|
|
175
215
|
private isLocalStorageAvailable;
|
|
176
|
-
private
|
|
216
|
+
private showConfirmationDialog;
|
|
217
|
+
private hideConfirmationDialog;
|
|
218
|
+
private confirmNewChat;
|
|
219
|
+
private actuallyStartNewChat;
|
|
177
220
|
private toggleFullscreen;
|
|
178
221
|
render(): any;
|
|
179
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
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "open-chat-studio-widget",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "Chat component for Open Chat Studio",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"exports": "./dist/esm/open-chat-studio-widget.js",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@stencil/core": "^4.26.0",
|
|
33
33
|
"dompurify": "^3.0.5",
|
|
34
|
+
"js-cookie": "^3.0.5",
|
|
34
35
|
"marked": "^4.3.0",
|
|
35
36
|
"npmrc": "^1.1.1"
|
|
36
37
|
},
|
|
@@ -42,9 +43,9 @@
|
|
|
42
43
|
"autoprefixer": "^10.4.20",
|
|
43
44
|
"jest": "^29.7.0",
|
|
44
45
|
"jest-cli": "^29.7.0",
|
|
46
|
+
"npm-run-all": "^4.1.5",
|
|
45
47
|
"postcss-import": "^16.1.0",
|
|
46
48
|
"puppeteer": "^24.2.0",
|
|
47
|
-
"npm-run-all": "^4.1.5",
|
|
48
49
|
"tailwindcss": "^3.4.17",
|
|
49
50
|
"typescript": "^5.7.3"
|
|
50
51
|
},
|