@elqnt/chat 1.0.14 → 1.0.16

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.mjs CHANGED
@@ -1142,7 +1142,7 @@ var useWebSocketChatBase = ({
1142
1142
  await sendRestMessage("send", {
1143
1143
  orgId: fullEvent.orgId || orgId,
1144
1144
  chatKey: fullEvent.chatKey || currentChatKeyRef.current,
1145
- userId: fullEvent.userId,
1145
+ userId: fullEvent.userId || currentUserIdRef.current,
1146
1146
  message: fullEvent.message
1147
1147
  });
1148
1148
  break;
@@ -1150,7 +1150,7 @@ var useWebSocketChatBase = ({
1150
1150
  await sendRestMessage("typing", {
1151
1151
  orgId: fullEvent.orgId || orgId,
1152
1152
  chatKey: fullEvent.chatKey || currentChatKeyRef.current,
1153
- userId: fullEvent.userId,
1153
+ userId: fullEvent.userId || currentUserIdRef.current,
1154
1154
  typing: true
1155
1155
  });
1156
1156
  break;
@@ -1158,7 +1158,7 @@ var useWebSocketChatBase = ({
1158
1158
  await sendRestMessage("typing", {
1159
1159
  orgId: fullEvent.orgId || orgId,
1160
1160
  chatKey: fullEvent.chatKey || currentChatKeyRef.current,
1161
- userId: fullEvent.userId,
1161
+ userId: fullEvent.userId || currentUserIdRef.current,
1162
1162
  typing: false
1163
1163
  });
1164
1164
  break;
@@ -1166,7 +1166,7 @@ var useWebSocketChatBase = ({
1166
1166
  const loadResponse = await sendRestMessage("load", {
1167
1167
  orgId: fullEvent.orgId || orgId,
1168
1168
  chatKey: fullEvent.chatKey,
1169
- userId: fullEvent.userId
1169
+ userId: fullEvent.userId || currentUserIdRef.current
1170
1170
  });
1171
1171
  if (loadResponse.success && loadResponse.data?.chat) {
1172
1172
  currentChatKeyRef.current = loadResponse.data.chat.key;
@@ -1187,7 +1187,7 @@ var useWebSocketChatBase = ({
1187
1187
  case "new_chat":
1188
1188
  const createResponse = await sendRestMessage("create", {
1189
1189
  orgId: fullEvent.orgId || orgId,
1190
- userId: fullEvent.userId,
1190
+ userId: fullEvent.userId || currentUserIdRef.current,
1191
1191
  metadata: fullEvent.data
1192
1192
  });
1193
1193
  if (createResponse.success && createResponse.data?.chatKey) {
@@ -1214,7 +1214,7 @@ var useWebSocketChatBase = ({
1214
1214
  await sendRestMessage("end", {
1215
1215
  orgId: fullEvent.orgId || orgId,
1216
1216
  chatKey: fullEvent.chatKey || currentChatKeyRef.current,
1217
- userId: fullEvent.userId,
1217
+ userId: fullEvent.userId || currentUserIdRef.current,
1218
1218
  data: fullEvent.data
1219
1219
  });
1220
1220
  break;
@@ -1243,7 +1243,7 @@ var useWebSocketChatBase = ({
1243
1243
  type: fullEvent.type,
1244
1244
  orgId: fullEvent.orgId || orgId,
1245
1245
  chatKey: fullEvent.chatKey || currentChatKeyRef.current,
1246
- userId: fullEvent.userId,
1246
+ userId: fullEvent.userId || currentUserIdRef.current,
1247
1247
  data: fullEvent.data
1248
1248
  });
1249
1249
  break;
@@ -1253,7 +1253,7 @@ var useWebSocketChatBase = ({
1253
1253
  type: fullEvent.type,
1254
1254
  orgId: fullEvent.orgId || orgId,
1255
1255
  chatKey: fullEvent.chatKey || currentChatKeyRef.current,
1256
- userId: fullEvent.userId,
1256
+ userId: fullEvent.userId || currentUserIdRef.current,
1257
1257
  data: fullEvent.data
1258
1258
  });
1259
1259
  break;
@@ -1311,7 +1311,7 @@ var useWebSocketChatBase = ({
1311
1311
  }
1312
1312
  });
1313
1313
  },
1314
- [connectionState, connect, addToQueue, logger, metrics, updateMetrics, sendRestMessage, emit]
1314
+ [connectionState, connect, addToQueue, logger, metrics, updateMetrics, sendRestMessage, emit, orgId]
1315
1315
  );
1316
1316
  const startNewChat = useCallback(
1317
1317
  (userId, data) => {