@fusioni/client-sdk 1.1.25 → 1.1.26

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/index.js CHANGED
@@ -40,7 +40,7 @@ const en = {
40
40
  attachedImages: 'Images',
41
41
  attachedVideos: 'Videos',
42
42
  messages: {
43
- loading: 'Working on it...',
43
+ loading: 'Thinking...',
44
44
  error: 'Oops! Something went wrong. Please try again later.',
45
45
  delete: 'Delete message',
46
46
  deleteConfirm: {
@@ -145,7 +145,7 @@ const el = {
145
145
  attachedImages: 'Εικόνες',
146
146
  attachedVideos: 'Βίντεο',
147
147
  messages: {
148
- loading: 'Εργάζομαι...',
148
+ loading: 'Thinking...',
149
149
  error: 'Ουπς! Κάτι πήγε στραβά. Παρακαλώ δοκιμάστε ξανά αργότερα.',
150
150
  delete: 'Διαγραφή μηνύματος',
151
151
  deleteConfirm: {
@@ -4096,7 +4096,7 @@ const {
4096
4096
  mergeConfig
4097
4097
  } = axios;
4098
4098
 
4099
- /** Decode SSE `event.data` (plain text or JSON with a `data` field), matching fusioni-web chat usage. */
4099
+ /** Decode SSE `event.data` (plain text, JSON with `data`, or chat stream `{ conversation_id, message }`). */
4100
4100
  function normalizeSsePayload(raw) {
4101
4101
  const s = raw?.trim() ?? '';
4102
4102
  if (!s) {
@@ -4104,18 +4104,33 @@ function normalizeSsePayload(raw) {
4104
4104
  }
4105
4105
  try {
4106
4106
  const parsed = JSON.parse(s);
4107
- if (parsed !== null && typeof parsed === 'object' && 'data' in parsed) {
4108
- const inner = parsed.data;
4109
- if (inner === undefined || inner === null) {
4110
- return null;
4111
- }
4112
- if (typeof inner === 'string') {
4113
- return inner;
4107
+ if (parsed !== null && typeof parsed === 'object') {
4108
+ if ('data' in parsed) {
4109
+ const inner = parsed.data;
4110
+ if (inner === undefined || inner === null) {
4111
+ return null;
4112
+ }
4113
+ if (typeof inner === 'string') {
4114
+ return inner;
4115
+ }
4116
+ if (typeof inner === 'number' || typeof inner === 'boolean') {
4117
+ return String(inner);
4118
+ }
4119
+ return JSON.stringify(inner);
4114
4120
  }
4115
- if (typeof inner === 'number' || typeof inner === 'boolean') {
4116
- return String(inner);
4121
+ if ('message' in parsed) {
4122
+ const message = parsed.message;
4123
+ if (message === undefined || message === null) {
4124
+ return null;
4125
+ }
4126
+ if (typeof message === 'string') {
4127
+ return message;
4128
+ }
4129
+ if (typeof message === 'number' || typeof message === 'boolean') {
4130
+ return String(message);
4131
+ }
4132
+ return JSON.stringify(message);
4117
4133
  }
4118
- return JSON.stringify(inner);
4119
4134
  }
4120
4135
  }
4121
4136
  catch {