@antzsoft/chat-core 1.3.5 → 1.3.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.
package/dist/index.cjs CHANGED
@@ -1762,10 +1762,23 @@ function disconnectSocket() {
1762
1762
  }
1763
1763
  function reconnectSocket(token, userId, tenantId) {
1764
1764
  if (!_socket) return;
1765
- if (_config2?.transitEncryption && _getToken) {
1766
- if (!_socket.disconnected) _socket.disconnect();
1767
- void connectSocket(_config2, _getToken);
1768
- return;
1765
+ if (_config2?.transitEncryption) {
1766
+ const existing = getTransitSession();
1767
+ if (existing?.enabled && existing.sessionId) {
1768
+ _socket.auth = {
1769
+ token: `Bearer ${token}`,
1770
+ ...userId && { userId },
1771
+ ...tenantId && { tenantId },
1772
+ transitSessionId: existing.sessionId
1773
+ };
1774
+ _socket.connect();
1775
+ return;
1776
+ }
1777
+ if (_getToken) {
1778
+ if (!_socket.disconnected) _socket.disconnect();
1779
+ void connectSocket(_config2, _getToken);
1780
+ return;
1781
+ }
1769
1782
  }
1770
1783
  _socket.auth = {
1771
1784
  token: `Bearer ${token}`,