@vserifsaglam/chat-react-client 1.0.4 → 1.0.6

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.
@@ -188,6 +188,26 @@ function _finallyRethrows(body, finalizer) {
188
188
  return finalizer(false, result);
189
189
  }
190
190
 
191
+ function _extends() {
192
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
193
+ for (var e = 1; e < arguments.length; e++) {
194
+ var t = arguments[e];
195
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
196
+ }
197
+ return n;
198
+ }, _extends.apply(null, arguments);
199
+ }
200
+ function _objectWithoutPropertiesLoose(r, e) {
201
+ if (null == r) return {};
202
+ var t = {};
203
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
204
+ if (-1 !== e.indexOf(n)) continue;
205
+ t[n] = r[n];
206
+ }
207
+ return t;
208
+ }
209
+
210
+ var _excluded = ["isAppointment"];
191
211
  var ChatApi = /*#__PURE__*/function () {
192
212
  function ChatApi(config) {
193
213
  this.client = axios.create({
@@ -329,7 +349,9 @@ var ChatApi = /*#__PURE__*/function () {
329
349
  'x-disable-limit': true
330
350
  };
331
351
  }
332
- return Promise.resolve(_this1.client.post('/api/messages/send-message', message, config)).then(function (response) {
352
+ var isAppointment = message.isAppointment,
353
+ messageToSend = _objectWithoutPropertiesLoose(message, _excluded);
354
+ return Promise.resolve(_this1.client.post('/api/messages/send-message', messageToSend, config)).then(function (response) {
333
355
  return response.data;
334
356
  });
335
357
  } catch (e) {
@@ -482,16 +504,6 @@ var ChatApi = /*#__PURE__*/function () {
482
504
  return ChatApi;
483
505
  }();
484
506
 
485
- function _extends() {
486
- return _extends = Object.assign ? Object.assign.bind() : function (n) {
487
- for (var e = 1; e < arguments.length; e++) {
488
- var t = arguments[e];
489
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
490
- }
491
- return n;
492
- }, _extends.apply(null, arguments);
493
- }
494
-
495
507
  var ConnectionType;
496
508
  (function (ConnectionType) {
497
509
  ConnectionType["WebSocket"] = "websocket";
@@ -2822,7 +2834,7 @@ function useMessageManagement(selectedConversationId) {
2822
2834
  return Promise.reject(e);
2823
2835
  }
2824
2836
  }, [messagesLoading, hasMore, getMessages, page, selectedConversationId]);
2825
- var handleSendMessage = useCallback(function (content, receiver, isAppointment) {
2837
+ var handleSendMessage = useCallback(function (content, receiver, isAppointment, metadata) {
2826
2838
  try {
2827
2839
  if (!content.trim() || !selectedConversationId || !profile) return Promise.resolve();
2828
2840
  var tempMessageId = "temp-" + Date.now();
@@ -2835,7 +2847,8 @@ function useMessageManagement(selectedConversationId) {
2835
2847
  sender: profile,
2836
2848
  receiver: receiver,
2837
2849
  is_read: false,
2838
- status: 'sending'
2850
+ status: 'sending',
2851
+ metadata: metadata
2839
2852
  };
2840
2853
  setMessages(function (prevMessages) {
2841
2854
  var prevMessageArray = (prevMessages === null || prevMessages === void 0 ? void 0 : prevMessages.messages) || [];
@@ -2848,7 +2861,8 @@ function useMessageManagement(selectedConversationId) {
2848
2861
  receiver_client_id: receiver.id,
2849
2862
  content: content,
2850
2863
  conversation_uid: selectedConversationId,
2851
- isAppointment: isAppointment
2864
+ isAppointment: isAppointment,
2865
+ metadata: metadata
2852
2866
  })).then(function (success) {
2853
2867
  if (!success) {
2854
2868
  setMessages(function (prevMessages) {
@@ -2893,7 +2907,7 @@ function useMessageManagement(selectedConversationId) {
2893
2907
  return Promise.reject(e);
2894
2908
  }
2895
2909
  }, [sendMessage, selectedConversationId, profile === null || profile === void 0 ? void 0 : profile.id, setMessages]);
2896
- var handleSendFileMessage = useCallback(function (content, fileId, receiver, filename, url, isAppointment) {
2910
+ var handleSendFileMessage = useCallback(function (content, fileId, receiver, filename, url, isAppointment, metadata) {
2897
2911
  try {
2898
2912
  if (!selectedConversationId) return Promise.resolve();
2899
2913
  var tempMessageId = "temp-file-" + Date.now();
@@ -2910,7 +2924,8 @@ function useMessageManagement(selectedConversationId) {
2910
2924
  sender: profile,
2911
2925
  receiver: receiver,
2912
2926
  is_read: false,
2913
- status: 'sending'
2927
+ status: 'sending',
2928
+ metadata: metadata
2914
2929
  };
2915
2930
  setMessages(function (prevMessages) {
2916
2931
  var prevMessageArray = (prevMessages === null || prevMessages === void 0 ? void 0 : prevMessages.messages) || [];
@@ -2924,7 +2939,8 @@ function useMessageManagement(selectedConversationId) {
2924
2939
  content: content,
2925
2940
  attachments: [fileId],
2926
2941
  conversation_uid: selectedConversationId,
2927
- isAppointment: isAppointment
2942
+ isAppointment: isAppointment,
2943
+ metadata: metadata
2928
2944
  })).then(function (success) {
2929
2945
  if (success) {
2930
2946
  setMessages(function (prevMessages) {