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.
Files changed (31) hide show
  1. package/dist/cjs/{index-DDod9Zyw.js → index-fFSp-Z_h.js} +3 -3
  2. package/dist/cjs/{index-DDod9Zyw.js.map → index-fFSp-Z_h.js.map} +1 -1
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/open-chat-studio-widget.cjs.entry.js +11 -9
  5. package/dist/cjs/open-chat-studio-widget.cjs.entry.js.map +1 -1
  6. package/dist/cjs/open-chat-studio-widget.cjs.js +1 -1
  7. package/dist/cjs/open-chat-studio-widget.entry.cjs.js.map +1 -1
  8. package/dist/collection/components/ocs-chat/ocs-chat.js +1 -1
  9. package/dist/collection/components/ocs-chat/ocs-chat.js.map +1 -1
  10. package/dist/collection/services/chat-session-service.js +7 -2
  11. package/dist/collection/services/chat-session-service.js.map +1 -1
  12. package/dist/collection/services/file-attachment-manager.js +2 -5
  13. package/dist/collection/services/file-attachment-manager.js.map +1 -1
  14. package/dist/components/open-chat-studio-widget.js +10 -8
  15. package/dist/components/open-chat-studio-widget.js.map +1 -1
  16. package/dist/esm/{index-iUBQH9om.js → index-ythTKHg-.js} +3 -3
  17. package/dist/esm/{index-iUBQH9om.js.map → index-ythTKHg-.js.map} +1 -1
  18. package/dist/esm/loader.js +2 -2
  19. package/dist/esm/open-chat-studio-widget.entry.js +11 -9
  20. package/dist/esm/open-chat-studio-widget.entry.js.map +1 -1
  21. package/dist/esm/open-chat-studio-widget.js +2 -2
  22. package/dist/open-chat-studio-widget/open-chat-studio-widget.entry.esm.js.map +1 -1
  23. package/dist/open-chat-studio-widget/open-chat-studio-widget.esm.js +1 -1
  24. package/dist/open-chat-studio-widget/{p-9c925476.entry.js → p-2d31a15c.entry.js} +4 -4
  25. package/dist/open-chat-studio-widget/p-2d31a15c.entry.js.map +1 -0
  26. package/dist/open-chat-studio-widget/{p-iUBQH9om.js → p-ythTKHg-.js} +2 -2
  27. package/dist/open-chat-studio-widget/{p-iUBQH9om.js.map → p-ythTKHg-.js.map} +1 -1
  28. package/dist/types/services/chat-session-service.d.ts +2 -0
  29. package/dist/types/services/file-attachment-manager.d.ts +2 -1
  30. package/package.json +1 -1
  31. package/dist/open-chat-studio-widget/p-9c925476.entry.js.map +0 -1
@@ -1,5 +1,5 @@
1
- import { b as bootstrapLazy } from './index-iUBQH9om.js';
2
- export { s as setNonce } from './index-iUBQH9om.js';
1
+ import { b as bootstrapLazy } from './index-ythTKHg-.js';
2
+ export { s as setNonce } from './index-ythTKHg-.js';
3
3
  import { g as globalScripts } from './app-globals-DQuL1Twl.js';
4
4
 
5
5
  const defineCustomElements = async (win, options) => {
@@ -1,4 +1,4 @@
1
- import { h, r as registerInstance, E as Env, H as Host, g as getElement } from './index-iUBQH9om.js';
1
+ import { h, r as registerInstance, E as Env, H as Host, g as getElement } from './index-ythTKHg-.js';
2
2
 
3
3
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
4
4
  const OcsWidgetAvatar = () => {
@@ -5234,15 +5234,20 @@ class ChatSessionService {
5234
5234
  }
5235
5235
  throw new Error(message);
5236
5236
  }
5237
- getJsonHeaders() {
5237
+ /** Headers for multipart requests (no Content-Type — fetch sets the boundary). */
5238
+ getUploadHeaders() {
5238
5239
  const headers = this.getCommonHeaders();
5239
- headers['Content-Type'] = 'application/json';
5240
5240
  const csrfToken = this.csrfTokenProvider(this.apiBaseUrl);
5241
5241
  if (csrfToken) {
5242
5242
  headers['X-CSRFToken'] = csrfToken;
5243
5243
  }
5244
5244
  return headers;
5245
5245
  }
5246
+ getJsonHeaders() {
5247
+ const headers = this.getUploadHeaders();
5248
+ headers['Content-Type'] = 'application/json';
5249
+ return headers;
5250
+ }
5246
5251
  getCommonHeaders() {
5247
5252
  const headers = {
5248
5253
  'x-ocs-widget-version': this.widgetVersion,
@@ -5302,6 +5307,7 @@ class FileAttachmentManager {
5302
5307
  });
5303
5308
  }
5304
5309
  async uploadPendingFiles(existingFiles, context) {
5310
+ var _a;
5305
5311
  if (existingFiles.length === 0) {
5306
5312
  return { selectedFiles: existingFiles, uploadedIds: [] };
5307
5313
  }
@@ -5319,13 +5325,9 @@ class FileAttachmentManager {
5319
5325
  formData.append('participant_name', context.participantName);
5320
5326
  }
5321
5327
  try {
5322
- const headers = {};
5323
- if (context.sessionToken) {
5324
- headers['X-Session-Token'] = context.sessionToken;
5325
- }
5326
5328
  const response = await fetch(`${context.apiBaseUrl}/api/chat/${context.sessionId}/upload/`, {
5327
5329
  method: 'POST',
5328
- headers,
5330
+ headers: (_a = context.headers) !== null && _a !== void 0 ? _a : {},
5329
5331
  body: formData,
5330
5332
  });
5331
5333
  if (!response.ok) {
@@ -5877,7 +5879,7 @@ const OcsChat = class {
5877
5879
  sessionId: this.activeSessionId,
5878
5880
  participantId: this.getOrGenerateUserId(),
5879
5881
  participantName: this.userName,
5880
- sessionToken: this.currentSessionToken,
5882
+ headers: this.getChatService().getUploadHeaders(),
5881
5883
  });
5882
5884
  this.selectedFiles = uploadResult.selectedFiles;
5883
5885
  if (uploadResult.tokenRejected) {