open-chat-studio-widget 0.9.0 → 0.9.1
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/cjs/{index-DDod9Zyw.js → index-fFSp-Z_h.js} +3 -3
- package/dist/cjs/{index-DDod9Zyw.js.map → index-fFSp-Z_h.js.map} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/open-chat-studio-widget.cjs.entry.js +11 -9
- package/dist/cjs/open-chat-studio-widget.cjs.entry.js.map +1 -1
- package/dist/cjs/open-chat-studio-widget.cjs.js +1 -1
- package/dist/cjs/open-chat-studio-widget.entry.cjs.js.map +1 -1
- package/dist/collection/components/ocs-chat/ocs-chat.js +1 -1
- package/dist/collection/components/ocs-chat/ocs-chat.js.map +1 -1
- package/dist/collection/services/chat-session-service.js +7 -2
- package/dist/collection/services/chat-session-service.js.map +1 -1
- package/dist/collection/services/file-attachment-manager.js +2 -5
- package/dist/collection/services/file-attachment-manager.js.map +1 -1
- package/dist/components/open-chat-studio-widget.js +10 -8
- package/dist/components/open-chat-studio-widget.js.map +1 -1
- package/dist/esm/{index-iUBQH9om.js → index-ythTKHg-.js} +3 -3
- package/dist/esm/{index-iUBQH9om.js.map → index-ythTKHg-.js.map} +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/open-chat-studio-widget.entry.js +11 -9
- package/dist/esm/open-chat-studio-widget.entry.js.map +1 -1
- package/dist/esm/open-chat-studio-widget.js +2 -2
- 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-9c925476.entry.js → p-2d31a15c.entry.js} +4 -4
- package/dist/open-chat-studio-widget/p-2d31a15c.entry.js.map +1 -0
- package/dist/open-chat-studio-widget/{p-iUBQH9om.js → p-ythTKHg-.js} +2 -2
- package/dist/open-chat-studio-widget/{p-iUBQH9om.js.map → p-ythTKHg-.js.map} +1 -1
- package/dist/types/services/chat-session-service.d.ts +2 -0
- package/dist/types/services/file-attachment-manager.d.ts +2 -1
- package/package.json +1 -1
- package/dist/open-chat-studio-widget/p-9c925476.entry.js.map +0 -1
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-fFSp-Z_h.js');
|
|
4
4
|
|
|
5
5
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
6
6
|
const OcsWidgetAvatar = () => {
|
|
@@ -5236,15 +5236,20 @@ class ChatSessionService {
|
|
|
5236
5236
|
}
|
|
5237
5237
|
throw new Error(message);
|
|
5238
5238
|
}
|
|
5239
|
-
|
|
5239
|
+
/** Headers for multipart requests (no Content-Type — fetch sets the boundary). */
|
|
5240
|
+
getUploadHeaders() {
|
|
5240
5241
|
const headers = this.getCommonHeaders();
|
|
5241
|
-
headers['Content-Type'] = 'application/json';
|
|
5242
5242
|
const csrfToken = this.csrfTokenProvider(this.apiBaseUrl);
|
|
5243
5243
|
if (csrfToken) {
|
|
5244
5244
|
headers['X-CSRFToken'] = csrfToken;
|
|
5245
5245
|
}
|
|
5246
5246
|
return headers;
|
|
5247
5247
|
}
|
|
5248
|
+
getJsonHeaders() {
|
|
5249
|
+
const headers = this.getUploadHeaders();
|
|
5250
|
+
headers['Content-Type'] = 'application/json';
|
|
5251
|
+
return headers;
|
|
5252
|
+
}
|
|
5248
5253
|
getCommonHeaders() {
|
|
5249
5254
|
const headers = {
|
|
5250
5255
|
'x-ocs-widget-version': this.widgetVersion,
|
|
@@ -5304,6 +5309,7 @@ class FileAttachmentManager {
|
|
|
5304
5309
|
});
|
|
5305
5310
|
}
|
|
5306
5311
|
async uploadPendingFiles(existingFiles, context) {
|
|
5312
|
+
var _a;
|
|
5307
5313
|
if (existingFiles.length === 0) {
|
|
5308
5314
|
return { selectedFiles: existingFiles, uploadedIds: [] };
|
|
5309
5315
|
}
|
|
@@ -5321,13 +5327,9 @@ class FileAttachmentManager {
|
|
|
5321
5327
|
formData.append('participant_name', context.participantName);
|
|
5322
5328
|
}
|
|
5323
5329
|
try {
|
|
5324
|
-
const headers = {};
|
|
5325
|
-
if (context.sessionToken) {
|
|
5326
|
-
headers['X-Session-Token'] = context.sessionToken;
|
|
5327
|
-
}
|
|
5328
5330
|
const response = await fetch(`${context.apiBaseUrl}/api/chat/${context.sessionId}/upload/`, {
|
|
5329
5331
|
method: 'POST',
|
|
5330
|
-
headers,
|
|
5332
|
+
headers: (_a = context.headers) !== null && _a !== void 0 ? _a : {},
|
|
5331
5333
|
body: formData,
|
|
5332
5334
|
});
|
|
5333
5335
|
if (!response.ok) {
|
|
@@ -5879,7 +5881,7 @@ const OcsChat = class {
|
|
|
5879
5881
|
sessionId: this.activeSessionId,
|
|
5880
5882
|
participantId: this.getOrGenerateUserId(),
|
|
5881
5883
|
participantName: this.userName,
|
|
5882
|
-
|
|
5884
|
+
headers: this.getChatService().getUploadHeaders(),
|
|
5883
5885
|
});
|
|
5884
5886
|
this.selectedFiles = uploadResult.selectedFiles;
|
|
5885
5887
|
if (uploadResult.tokenRejected) {
|