{"version":3,"file":"useWSConnectionState.mjs","names":[],"sources":["../../../../../src/components/Chat/hooks/useWSConnectionState.ts"],"sourcesContent":["import type { WSConnectionState } from 'stream-chat';\n\nimport { useChatContext } from '../../../context/ChatContext';\nimport { useStateStore } from '../../../store';\n\nconst identity = (state: WSConnectionState) => state;\n\n/**\n * The client's WebSocket status, as held by `client.wsConnection`.\n *\n * Not the device's network, see {@link useNetworkConnectionState}. `isHealthy` is always a boolean.\n * The store publishes every transition the moment it happens, including `client.closeConnection()`,\n * so a \"connection lost\" banner should hold a drop for\n * `client.wsConnection.config.offlineNotificationDisplayDelayMs`, as `<Chat>` does. The connection\n * ID lives on `client.connectionIdManager`, not here.\n *\n * Must run under `ChatProvider`, e.g. from a child of `<Chat>`.\n */\nexport const useWSConnectionState = (): WSConnectionState | undefined => {\n  const { client } = useChatContext();\n  return useStateStore(client?.wsConnection.state, identity);\n};\n"],"mappings":";;;AAKA,IAAM,YAAY,UAA6B;;;;;;;;;;;;AAa/C,IAAa,6BAA4D;CACvE,MAAM,EAAE,WAAW,eAAe;CAClC,OAAO,cAAc,QAAQ,aAAa,OAAO,QAAQ;AAC3D"}