open-chat-studio-widget 0.6.0 → 0.7.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 +27 -25
- package/dist/cjs/{index-CcvroTR_.js → index-CvB341El.js} +3 -3
- package/dist/cjs/{index-CcvroTR_.js.map → index-CvB341El.js.map} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/open-chat-studio-widget.cjs.entry.js +364 -142
- 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/cjs/open-chat-studio-widget.entry.cjs.js.map +1 -1
- package/dist/collection/components/ocs-chat/icons.js +2 -2
- package/dist/collection/components/ocs-chat/icons.js.map +1 -1
- package/dist/collection/components/ocs-chat/ocs-chat.css +29 -34
- package/dist/collection/components/ocs-chat/ocs-chat.js +281 -78
- package/dist/collection/components/ocs-chat/ocs-chat.js.map +1 -1
- package/dist/collection/services/chat-session-service.js +4 -0
- package/dist/collection/services/chat-session-service.js.map +1 -1
- package/dist/collection/services/file-attachment-manager.js +4 -7
- package/dist/collection/services/file-attachment-manager.js.map +1 -1
- package/dist/collection/utils/cookies.js.map +1 -1
- package/dist/collection/utils/markdown.js +43 -17
- package/dist/collection/utils/markdown.js.map +1 -1
- package/dist/collection/utils/translations.js +1 -3
- package/dist/collection/utils/translations.js.map +1 -1
- package/dist/collection/utils/utils.js +2 -2
- package/dist/collection/utils/utils.js.map +1 -1
- package/dist/components/open-chat-studio-widget.js +369 -141
- package/dist/components/open-chat-studio-widget.js.map +1 -1
- package/dist/esm/{index-BKVXO_5E.js → index-C2QZK0Ui.js} +3 -3
- package/dist/esm/{index-BKVXO_5E.js.map → index-C2QZK0Ui.js.map} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/open-chat-studio-widget.entry.js +364 -142
- 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.entry.esm.js.map +1 -1
- package/dist/open-chat-studio-widget/open-chat-studio-widget.esm.js +1 -1
- package/dist/open-chat-studio-widget/{p-BKVXO_5E.js → p-C2QZK0Ui.js} +2 -2
- package/dist/open-chat-studio-widget/{p-BKVXO_5E.js.map → p-C2QZK0Ui.js.map} +1 -1
- package/dist/open-chat-studio-widget/p-e87d4e31.entry.js +4 -0
- package/dist/open-chat-studio-widget/p-e87d4e31.entry.js.map +1 -0
- package/dist/types/components/ocs-chat/ocs-chat.d.ts +29 -1
- package/dist/types/components.d.ts +23 -2
- package/dist/types/services/chat-session-service.d.ts +1 -0
- package/dist/types/utils/markdown.d.ts +8 -0
- package/package.json +7 -2
- package/dist/open-chat-studio-widget/p-a0d04423.entry.js +0 -4
- package/dist/open-chat-studio-widget/p-a0d04423.entry.js.map +0 -1
|
@@ -37,6 +37,18 @@ export declare class OcsChat {
|
|
|
37
37
|
* The shape of the chat button. 'round' makes it circular, 'square' keeps it rectangular.
|
|
38
38
|
*/
|
|
39
39
|
buttonShape: 'round' | 'square';
|
|
40
|
+
/**
|
|
41
|
+
* Whether to show the launcher button. Set to false to hide the button
|
|
42
|
+
* and open the chat window programmatically via the `visible` property.
|
|
43
|
+
*/
|
|
44
|
+
showButton: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* The operating mode of the widget.
|
|
47
|
+
* - 'standard': Default floating window with launcher button.
|
|
48
|
+
* - 'kiosk': Fills parent container, always visible, no header or launcher button.
|
|
49
|
+
* The parent element must establish a containing block (e.g. `position: relative`).
|
|
50
|
+
*/
|
|
51
|
+
mode: 'standard' | 'kiosk';
|
|
40
52
|
/**
|
|
41
53
|
* The text to place in the header.
|
|
42
54
|
*/
|
|
@@ -62,7 +74,7 @@ export declare class OcsChat {
|
|
|
62
74
|
*/
|
|
63
75
|
starterQuestions?: string;
|
|
64
76
|
/**
|
|
65
|
-
|
|
77
|
+
* Used to associate chat sessions with a specific user across multiple visits/sessions
|
|
66
78
|
*/
|
|
67
79
|
userId?: string;
|
|
68
80
|
/**
|
|
@@ -99,11 +111,18 @@ export declare class OcsChat {
|
|
|
99
111
|
* Optional context object to send with each message. This provides page-specific context to the bot.
|
|
100
112
|
*/
|
|
101
113
|
pageContext?: Record<string, any>;
|
|
114
|
+
/**
|
|
115
|
+
* @internal
|
|
116
|
+
* Optional version number of the chatbot to use. Requires authentication.
|
|
117
|
+
* This is for internal use only and is not intended for public-facing widgets.
|
|
118
|
+
*/
|
|
119
|
+
versionNumber?: number;
|
|
102
120
|
error: string;
|
|
103
121
|
messages: ChatMessage[];
|
|
104
122
|
sessionId?: string;
|
|
105
123
|
isLoading: boolean;
|
|
106
124
|
isTyping: boolean;
|
|
125
|
+
typingProgressMessage: string;
|
|
107
126
|
messageInput: string;
|
|
108
127
|
currentPollTaskId: string;
|
|
109
128
|
isDragging: boolean;
|
|
@@ -148,6 +167,7 @@ export declare class OcsChat {
|
|
|
148
167
|
private chatWindowFullscreenWidth;
|
|
149
168
|
private positionInitialized;
|
|
150
169
|
private internalPageContext?;
|
|
170
|
+
private sessionEpoch;
|
|
151
171
|
host: HTMLElement;
|
|
152
172
|
componentWillLoad(): Promise<void>;
|
|
153
173
|
componentDidLoad(): void;
|
|
@@ -186,6 +206,7 @@ export declare class OcsChat {
|
|
|
186
206
|
* @param pageContext - The new value for the field.
|
|
187
207
|
*/
|
|
188
208
|
pageContextHandler(): void;
|
|
209
|
+
chatbotConfigHandler(): Promise<void>;
|
|
189
210
|
/**
|
|
190
211
|
* Watch for changes to the `visible` attribute and update accordingly.
|
|
191
212
|
*
|
|
@@ -199,6 +220,10 @@ export declare class OcsChat {
|
|
|
199
220
|
getPositionClasses(): string;
|
|
200
221
|
private getFullscreenBounds;
|
|
201
222
|
getPositionStyles(): {
|
|
223
|
+
left?: undefined;
|
|
224
|
+
top?: undefined;
|
|
225
|
+
transform?: undefined;
|
|
226
|
+
} | {
|
|
202
227
|
left: string;
|
|
203
228
|
top: string;
|
|
204
229
|
transform: string;
|
|
@@ -245,7 +270,10 @@ export declare class OcsChat {
|
|
|
245
270
|
private saveSessionToStorage;
|
|
246
271
|
private loadSessionFromStorage;
|
|
247
272
|
private getOrGenerateUserId;
|
|
273
|
+
private saveVisibleState;
|
|
274
|
+
private restoreVisibleState;
|
|
248
275
|
private clearSessionStorage;
|
|
276
|
+
private isKioskMode;
|
|
249
277
|
private isLocalStorageAvailable;
|
|
250
278
|
private showConfirmationDialog;
|
|
251
279
|
private hideConfirmationDialog;
|
|
@@ -19,7 +19,7 @@ export namespace Components {
|
|
|
19
19
|
"allowFullScreen": boolean;
|
|
20
20
|
/**
|
|
21
21
|
* The base URL for the API.
|
|
22
|
-
* @default
|
|
22
|
+
* @default 'https://www.openchatstudio.com'
|
|
23
23
|
*/
|
|
24
24
|
"apiBaseUrl"?: string;
|
|
25
25
|
/**
|
|
@@ -51,6 +51,11 @@ export namespace Components {
|
|
|
51
51
|
* The language code for the widget UI (e.g., 'en', 'es', 'fr'). Defaults to en
|
|
52
52
|
*/
|
|
53
53
|
"language"?: string;
|
|
54
|
+
/**
|
|
55
|
+
* The operating mode of the widget. - 'standard': Default floating window with launcher button. - 'kiosk': Fills parent container, always visible, no header or launcher button. The parent element must establish a containing block (e.g. `position: relative`).
|
|
56
|
+
* @default 'standard'
|
|
57
|
+
*/
|
|
58
|
+
"mode": 'standard' | 'kiosk';
|
|
54
59
|
/**
|
|
55
60
|
* The message to display in the new chat confirmation dialog.
|
|
56
61
|
*/
|
|
@@ -74,6 +79,11 @@ export namespace Components {
|
|
|
74
79
|
* @default 'right'
|
|
75
80
|
*/
|
|
76
81
|
"position": 'left' | 'center' | 'right';
|
|
82
|
+
/**
|
|
83
|
+
* Whether to show the launcher button. Set to false to hide the button and open the chat window programmatically via the `visible` property.
|
|
84
|
+
* @default true
|
|
85
|
+
*/
|
|
86
|
+
"showButton": boolean;
|
|
77
87
|
/**
|
|
78
88
|
* Array of starter questions that users can click to send (JSON array of strings)
|
|
79
89
|
*/
|
|
@@ -91,6 +101,7 @@ export namespace Components {
|
|
|
91
101
|
* Display name for the user.
|
|
92
102
|
*/
|
|
93
103
|
"userName"?: string;
|
|
104
|
+
"versionNumber"?: number;
|
|
94
105
|
/**
|
|
95
106
|
* Whether the chat widget is visible on load.
|
|
96
107
|
* @default false
|
|
@@ -127,7 +138,7 @@ declare namespace LocalJSX {
|
|
|
127
138
|
"allowFullScreen"?: boolean;
|
|
128
139
|
/**
|
|
129
140
|
* The base URL for the API.
|
|
130
|
-
* @default
|
|
141
|
+
* @default 'https://www.openchatstudio.com'
|
|
131
142
|
*/
|
|
132
143
|
"apiBaseUrl"?: string;
|
|
133
144
|
/**
|
|
@@ -159,6 +170,11 @@ declare namespace LocalJSX {
|
|
|
159
170
|
* The language code for the widget UI (e.g., 'en', 'es', 'fr'). Defaults to en
|
|
160
171
|
*/
|
|
161
172
|
"language"?: string;
|
|
173
|
+
/**
|
|
174
|
+
* The operating mode of the widget. - 'standard': Default floating window with launcher button. - 'kiosk': Fills parent container, always visible, no header or launcher button. The parent element must establish a containing block (e.g. `position: relative`).
|
|
175
|
+
* @default 'standard'
|
|
176
|
+
*/
|
|
177
|
+
"mode"?: 'standard' | 'kiosk';
|
|
162
178
|
/**
|
|
163
179
|
* The message to display in the new chat confirmation dialog.
|
|
164
180
|
*/
|
|
@@ -182,6 +198,11 @@ declare namespace LocalJSX {
|
|
|
182
198
|
* @default 'right'
|
|
183
199
|
*/
|
|
184
200
|
"position"?: 'left' | 'center' | 'right';
|
|
201
|
+
/**
|
|
202
|
+
* Whether to show the launcher button. Set to false to hide the button and open the chat window programmatically via the `visible` property.
|
|
203
|
+
* @default true
|
|
204
|
+
*/
|
|
205
|
+
"showButton"?: boolean;
|
|
185
206
|
/**
|
|
186
207
|
* Array of starter questions that users can click to send (JSON array of strings)
|
|
187
208
|
*/
|
|
@@ -3,4 +3,12 @@
|
|
|
3
3
|
* This is called after DOMPurify to ensure external links open in new tabs
|
|
4
4
|
*/
|
|
5
5
|
export declare function postProcessMarkdownHTML(html: string): string;
|
|
6
|
+
export declare const SANITIZE_CONFIG: {
|
|
7
|
+
ALLOWED_TAGS: string[];
|
|
8
|
+
ALLOWED_ATTR: string[];
|
|
9
|
+
ALLOWED_URI_REGEXP: RegExp;
|
|
10
|
+
ADD_ATTR: string[];
|
|
11
|
+
FORBID_TAGS: string[];
|
|
12
|
+
FORBID_ATTR: string[];
|
|
13
|
+
};
|
|
6
14
|
export declare function renderMarkdownSync(content: string): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "open-chat-studio-widget",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
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",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
],
|
|
22
22
|
"scripts": {
|
|
23
23
|
"test": "stencil test --spec -- --forceExit",
|
|
24
|
+
"test:security": "node --test src/utils/markdown-security.test.mjs",
|
|
24
25
|
"build": "stencil build --docs",
|
|
25
26
|
"start": "stencil build --dev --watch --serve",
|
|
26
27
|
"generate": "stencil generate",
|
|
@@ -29,7 +30,9 @@
|
|
|
29
30
|
"prepublishOnly": "run-s build use:npmReadme",
|
|
30
31
|
"postpublish": "npm run use:gitReadme",
|
|
31
32
|
"type-check": "tsc --noEmit",
|
|
32
|
-
"lint": "eslint --fix src"
|
|
33
|
+
"lint": "eslint --fix src",
|
|
34
|
+
"format": "prettier --write \"src/**/*.{ts,tsx,css}\"",
|
|
35
|
+
"format:check": "prettier --check \"src/**/*.{ts,tsx,css}\""
|
|
33
36
|
},
|
|
34
37
|
"dependencies": {
|
|
35
38
|
"@stencil/core": "^4.27.0",
|
|
@@ -45,10 +48,12 @@
|
|
|
45
48
|
"@types/jest": "^29.5.14",
|
|
46
49
|
"@types/node": "^22.13.4",
|
|
47
50
|
"autoprefixer": "^10.4.20",
|
|
51
|
+
"happy-dom": "^20.8.4",
|
|
48
52
|
"jest": "^29.7.0",
|
|
49
53
|
"jest-cli": "^29.7.0",
|
|
50
54
|
"npm-run-all": "^4.1.5",
|
|
51
55
|
"postcss-import": "^16.1.0",
|
|
56
|
+
"prettier": "^3.8.3",
|
|
52
57
|
"puppeteer": "^24.2.0",
|
|
53
58
|
"stencil-tailwind-plugin": "^2.0.5",
|
|
54
59
|
"tailwindcss": "^4.1.12",
|