@antzsoft/chat-core 1.1.9 → 1.2.0

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
@@ -1112,6 +1112,7 @@ function base64ToUint82(b64) {
1112
1112
 
1113
1113
  // src/socket/socket.ts
1114
1114
  var _socket = null;
1115
+ var _socketProxy = null;
1115
1116
  var _connectingPromise = null;
1116
1117
  var _status = "disconnected";
1117
1118
  var _statusListeners = /* @__PURE__ */ new Set();
@@ -1123,11 +1124,11 @@ function setStatus(s) {
1123
1124
  _statusListeners.forEach((l) => l(s));
1124
1125
  }
1125
1126
  function getSocket() {
1126
- if (!_socket) throw new Error("[AntzChat] Socket not initialized. Call connectSocket first.");
1127
- return _socket;
1127
+ if (!_socketProxy) throw new Error("[AntzChat] Socket not initialized. Call connectSocket first.");
1128
+ return _socketProxy;
1128
1129
  }
1129
1130
  function tryGetSocket() {
1130
- return _socket?.connected ? _socket : null;
1131
+ return _socket?.connected ? _socketProxy : null;
1131
1132
  }
1132
1133
  function getSocketStatus() {
1133
1134
  return _status;
@@ -1297,7 +1298,8 @@ async function _doConnect(config, getToken) {
1297
1298
  if (e.lastSeenAt) store.setLastSeen(e.userId, e.lastSeenAt);
1298
1299
  });
1299
1300
  });
1300
- return createSecureSocketProxy(_socket);
1301
+ _socketProxy = createSecureSocketProxy(_socket);
1302
+ return _socketProxy;
1301
1303
  }
1302
1304
  function createSecureSocketProxy(socket) {
1303
1305
  return new Proxy(socket, {
@@ -1322,6 +1324,7 @@ function disconnectSocket() {
1322
1324
  if (_socket) {
1323
1325
  _socket.disconnect();
1324
1326
  _socket = null;
1327
+ _socketProxy = null;
1325
1328
  setStatus("disconnected");
1326
1329
  }
1327
1330
  clearTransitSession();