export interface XuqmInitOptions { appKey: string debug?: boolean } export interface XuqmConfig { appKey: string apiUrl: string imWsUrl: string fileServiceUrl: string // fetched from remote config debug: boolean } let _config: XuqmConfig | null = null let _userId: string | null = null export interface XuqmUserInfo { userId?: string name?: string email?: string phone?: string } let _userInfo: XuqmUserInfo | null = null export function initConfigFromRemote( options: XuqmInitOptions, remote: { imWsUrl: string; fileServiceUrl: string; apiUrl: string }, ): void { _config = { appKey: options.appKey, apiUrl: remote.apiUrl, imWsUrl: remote.imWsUrl, fileServiceUrl: remote.fileServiceUrl, debug: options.debug ?? false, } } export function getConfig(): XuqmConfig { if (!_config) throw new Error('[XuqmSDK] Not initialized — call XuqmSDK.initialize() first.') return _config } export function setUserId(userId: string | null): void { _userId = userId } export function getUserId(): string | null { return _userId } export function isInitialized(): boolean { return _config !== null } export function setUserInfo(info: XuqmUserInfo | null): void { _userInfo = info // Sync userId for backward compatibility if (info?.userId) { _userId = info.userId } } export function getUserInfo(): XuqmUserInfo | null { return _userInfo }