import { NgZone } from '@angular/core'; import { Observable } from 'rxjs'; import { Channel, ConnectAPIResponse, OwnUserResponse, StreamChatOptions, UserResponse } from 'stream-chat'; import { AppSettings, Event, StreamChat, TokenOrProvider } from 'stream-chat'; import { NotificationService } from './notification.service'; import * as i0 from "@angular/core"; export type ClientEvent = { eventType: string; event: Event; }; /** * The `ChatClient` service connects the user to the Stream chat. */ export declare class ChatClientService { private ngZone; private notificationService; /** * The [StreamChat client](https://github.com/GetStream/stream-chat-js/blob/master/src/client.ts) instance. In general you shouldn't need to access the client, but it's there if you want to use it. */ chatClient: StreamChat; /** * Emits [`ClientEvent`](https://github.com/GetStream/stream-chat-angular/blob/master/projects/stream-chat-angular/src/lib/chat-client.service.ts) events. The platform documentation covers [the list of client, user presence and notification events](/chat/docs/javascript/event_object/). * :::important * For performance reasons this Observable operates outside of the Angular change detection zone. If you subscribe to it, you need to manually reenter Angular's change detection zone, our [Change detection guide](/chat/docs/sdk/angular/concepts/change-detection/) explains this in detail. * ::: */ events$: Observable; /** * Emits the current [application settings](/chat/docs/javascript/app_setting_overview/). Since getting the application settings is an expensive API call and we don't always need the result, this is not initialized by default, you need to call `getApplicationSettings` to load them. */ appSettings$: Observable; /** * Emits the current connection state of the user (`online` or `offline`) */ connectionState$: Observable<'offline' | 'online'>; /** * Emits the list of pending invites of the user. It emits every pending invitation during initialization and then extends the list when a new invite is received. More information can be found in the [channel invitations](/chat/docs/sdk/angular/code-examples/channel-invites/) guide. */ pendingInvites$: Observable; /** * Emits the current chat user */ user$: Observable; private notificationSubject; private connectionStateSubject; private appSettingsSubject; private pendingInvitesSubject; private userSubject; private subscriptions; private trackPendingChannelInvites; private appSettingsPromise?; constructor(ngZone: NgZone, notificationService: NotificationService); /** * Creates a [`StreamChat`](https://github.com/GetStream/stream-chat-js/blob/668b3e5521339f4e14fc657834531b4c8bf8176b/src/client.ts#L124) instance using the provided `apiKey`, and connects a user with the given meta data and token. More info about [connecting users](/chat/docs/javascript/init_and_users/) can be found in the platform documentation. * @param apiKey * @param userOrId you can emit this for anonymous logins * @param userTokenOrProvider You can provide:
    *
  • a token,
  • *
  • a token provider, a method that returns `Promise`, which can be called when the previous token expires (recommended setup for production applications)
  • *
  • the keyword 'guest' to connect as [guest user](/chat/docs/javascript/authless_users/#guest-users)
  • *
  • the keyword 'anonymous' to connect as [anonymous user](/chat/docs/javascript/authless_users/#anonymous-users)
  • *
* @param clientOptions Setting to provide to the Stream client instance */ init(apiKey: string, userOrId: string | OwnUserResponse | UserResponse | undefined, userTokenOrProvider: TokenOrProvider, clientOptions?: StreamChatOptions & { trackPendingChannelInvites?: boolean; }): ConnectAPIResponse; /** * Disconnects the current user, and closes the WebSocket connection. Useful when disconnecting a chat user, use in combination with [`reset`](/chat/docs/sdk/angular/services/ChannelService/#reset/). */ disconnectUser(): Promise; /** * Loads the current [application settings](/chat/docs/javascript/app_setting_overview/), if the application settings have already been loaded, it does nothing. */ getAppSettings(): Promise; /** * Flag the message with the given ID. If you want to know [more about flags](/chat/docs/javascript/moderation/) check out the platform documentation. * @param messageId */ flagMessage(messageId: string): Promise; /** * Searches for users in the application that have ID or name matching the provided search term * @param searchTerm * @returns The users matching the search */ autocompleteUsers(searchTerm: string): Promise; private updatePendingInvites; private updateUser; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; }