@elqnt/chat 1.0.15 → 1.0.17

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.
@@ -779,7 +779,7 @@ var useWebSocketChatBase = ({
779
779
  await sendRestMessage("send", {
780
780
  orgId: fullEvent.orgId || orgId,
781
781
  chatKey: fullEvent.chatKey || currentChatKeyRef.current,
782
- userId: fullEvent.userId,
782
+ userId: fullEvent.userId || currentUserIdRef.current,
783
783
  message: fullEvent.message
784
784
  });
785
785
  break;
@@ -787,7 +787,7 @@ var useWebSocketChatBase = ({
787
787
  await sendRestMessage("typing", {
788
788
  orgId: fullEvent.orgId || orgId,
789
789
  chatKey: fullEvent.chatKey || currentChatKeyRef.current,
790
- userId: fullEvent.userId,
790
+ userId: fullEvent.userId || currentUserIdRef.current,
791
791
  typing: true
792
792
  });
793
793
  break;
@@ -795,7 +795,7 @@ var useWebSocketChatBase = ({
795
795
  await sendRestMessage("typing", {
796
796
  orgId: fullEvent.orgId || orgId,
797
797
  chatKey: fullEvent.chatKey || currentChatKeyRef.current,
798
- userId: fullEvent.userId,
798
+ userId: fullEvent.userId || currentUserIdRef.current,
799
799
  typing: false
800
800
  });
801
801
  break;
@@ -803,7 +803,7 @@ var useWebSocketChatBase = ({
803
803
  const loadResponse = await sendRestMessage("load", {
804
804
  orgId: fullEvent.orgId || orgId,
805
805
  chatKey: fullEvent.chatKey,
806
- userId: fullEvent.userId
806
+ userId: fullEvent.userId || currentUserIdRef.current
807
807
  });
808
808
  if (loadResponse.success && loadResponse.data?.chat) {
809
809
  currentChatKeyRef.current = loadResponse.data.chat.key;
@@ -824,7 +824,7 @@ var useWebSocketChatBase = ({
824
824
  case "new_chat":
825
825
  const createResponse = await sendRestMessage("create", {
826
826
  orgId: fullEvent.orgId || orgId,
827
- userId: fullEvent.userId,
827
+ userId: fullEvent.userId || currentUserIdRef.current,
828
828
  metadata: fullEvent.data
829
829
  });
830
830
  if (createResponse.success && createResponse.data?.chatKey) {
@@ -851,18 +851,18 @@ var useWebSocketChatBase = ({
851
851
  await sendRestMessage("end", {
852
852
  orgId: fullEvent.orgId || orgId,
853
853
  chatKey: fullEvent.chatKey || currentChatKeyRef.current,
854
- userId: fullEvent.userId,
854
+ userId: fullEvent.userId || currentUserIdRef.current,
855
855
  data: fullEvent.data
856
856
  });
857
857
  break;
858
- case "human_agent_join":
858
+ case "human_agent_joined":
859
859
  await sendRestMessage("agent-join", {
860
860
  orgId: fullEvent.orgId || orgId,
861
861
  chatKey: fullEvent.chatKey || currentChatKeyRef.current,
862
862
  user: fullEvent.data?.user
863
863
  });
864
864
  break;
865
- case "human_agent_leave":
865
+ case "human_agent_left":
866
866
  await sendRestMessage("agent-leave", {
867
867
  orgId: fullEvent.orgId || orgId,
868
868
  chatKey: fullEvent.chatKey || currentChatKeyRef.current,
@@ -880,7 +880,7 @@ var useWebSocketChatBase = ({
880
880
  type: fullEvent.type,
881
881
  orgId: fullEvent.orgId || orgId,
882
882
  chatKey: fullEvent.chatKey || currentChatKeyRef.current,
883
- userId: fullEvent.userId,
883
+ userId: fullEvent.userId || currentUserIdRef.current,
884
884
  data: fullEvent.data
885
885
  });
886
886
  break;
@@ -890,7 +890,7 @@ var useWebSocketChatBase = ({
890
890
  type: fullEvent.type,
891
891
  orgId: fullEvent.orgId || orgId,
892
892
  chatKey: fullEvent.chatKey || currentChatKeyRef.current,
893
- userId: fullEvent.userId,
893
+ userId: fullEvent.userId || currentUserIdRef.current,
894
894
  data: fullEvent.data
895
895
  });
896
896
  break;