import { Subscription } from 'zen-observable-ts'; import { SupportedEnvironments } from './config/environment.js'; import { ChatChannel } from './core/chatChannel.js'; import { N as NaluriChatLoginOptions, f as AccountUser, g as NaluriLogout, a as Channel, e as SubscriptionCallback, h as CoachProfile } from './channels-CRxlrBox.js'; import { CoachListFilters } from './types/gateway.js'; import './types/messages.js'; import 'apollo-upload-client'; import '@apollo/client/core'; import '@apollo/client/utilities'; import './generated/graphql.js'; import '@graphql-typed-document-node/core'; /** * Naluri Chat Sdk constructor options */ interface NaluriChatOptions { apiKey: string; apiSecret?: string; timeoutMs?: number; environment?: SupportedEnvironments; onRefreshTokenError?: () => Promise; } /** * Naluri Chat Sdk * @constructor * @param {NaluriChatOptions} options */ declare class NaluriChat { /** * Api key of naluri chat */ readonly apiKey: string; /** * Secret key of naluri chat */ readonly apiSecret: string; /** * Environment, default to SIT */ readonly environment: SupportedEnvironments; /** * Function to be called when refresh token fails */ readonly onRefreshTokenError?: () => Promise; /** * @private * Initialized chat instance */ private static chatInstance?; private accountInstance; private chatApiInstance?; private gatewayApiInstance?; private chatChannelInstance?; private senderId?; private subscription?; private lastKeys; /** * @private use getInstance method instead */ private constructor(); /** * [IMPORTANT]: Initialise this first before using any other methods * Initialize a new Naluri Chat instance * @returns {NaluriChat} * @param {string} apikey * @throws {NaluriChatError} */ static initialize({ apiKey, apiSecret, timeoutMs, environment, onRefreshTokenError, }: NaluriChatOptions): void; /** * Gets a new Naluri Chat instance * @returns {NaluriChat} * @throws {NaluriChatError} If didn't intialize chat. */ static getInstance(): NaluriChat; /** * Login user to chat * @param {NaluriChatLoginOptions} options * @returns {PromiseLike} * @throws {NaluriChatError} if failed to login user */ login({ authorizationCode, }: NaluriChatLoginOptions): Promise; /** * Logout user from chat * @returns {PromiseLike} * @throws NaluriChatError if failed to logout user */ logout(): Promise; /** * Gets chat channels * @returns {PromiseLike} * @throws NaluriChatError if chat instance is not initialized */ getAllChannels({ userId }?: { userId?: string; }): Promise; /** * Gets a chat channel instance * @param {{ channelId: string }} channelOptions * @returns {ChatChannel} * @throws NaluriChatError if chat instance is not initialized */ getChannel({ channelId }: { channelId: string; }): ChatChannel; /** * subscribe method to all channel * @param {SubscriptionCallback} params * @returns {Subscription} * @throws NaluriChatError if error */ subscribe(onReceive: SubscriptionCallback): Subscription | undefined; /** * Gets Coach Profile * @returns {PromiseLike} * @throws NaluriChatError if chat instance is not initialized */ getCoachProfile(coachId: string): Promise; /** * Get coaches list details in the group channel. * @returns {PromiseLike} * @throws NaluriChatError if chat instance is not initialized */ getCoachList(filters?: CoachListFilters): Promise; private reset; destroy(): void; } export { type NaluriChatOptions, NaluriChat as default };