@antzsoft/chat-core 1.1.1 → 1.1.3
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/README.md +91 -19
- package/dist/index.cjs +445 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +58 -31
- package/dist/index.d.ts +58 -31
- package/dist/index.js +444 -30
- package/dist/index.js.map +1 -1
- package/docs/integration-guide.html +354 -14
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -3,7 +3,6 @@ import { Socket } from 'socket.io-client';
|
|
|
3
3
|
import * as zustand_middleware from 'zustand/middleware';
|
|
4
4
|
import * as zustand from 'zustand';
|
|
5
5
|
|
|
6
|
-
type EncryptionMode = 'none' | 'server' | 'e2ee';
|
|
7
6
|
type FileType = 'image' | 'video' | 'audio' | 'document';
|
|
8
7
|
type ConversationType = 'direct' | 'group';
|
|
9
8
|
type MessageStatus = 'sent' | 'delivered' | 'read' | 'failed' | 'deleted';
|
|
@@ -79,17 +78,6 @@ interface Attachment {
|
|
|
79
78
|
isUploading?: boolean;
|
|
80
79
|
uploadProgress?: number;
|
|
81
80
|
}
|
|
82
|
-
interface EncryptedContent {
|
|
83
|
-
ciphertext: string;
|
|
84
|
-
iv: string;
|
|
85
|
-
tag: string;
|
|
86
|
-
algorithm: 'aes-256-gcm';
|
|
87
|
-
}
|
|
88
|
-
interface EncryptionKeyInfo {
|
|
89
|
-
key: string;
|
|
90
|
-
enabled: boolean;
|
|
91
|
-
mode: EncryptionMode;
|
|
92
|
-
}
|
|
93
81
|
interface MessageReaction {
|
|
94
82
|
emoji: string;
|
|
95
83
|
userIds: string[];
|
|
@@ -149,9 +137,6 @@ interface Message {
|
|
|
149
137
|
userId: string;
|
|
150
138
|
deliveredAt: string;
|
|
151
139
|
}>;
|
|
152
|
-
isEncrypted?: boolean;
|
|
153
|
-
encryptionMode?: EncryptionMode;
|
|
154
|
-
encryptedContent?: EncryptedContent;
|
|
155
140
|
}
|
|
156
141
|
interface Participant {
|
|
157
142
|
userId: string;
|
|
@@ -188,9 +173,6 @@ interface Conversation {
|
|
|
188
173
|
isPinned?: boolean;
|
|
189
174
|
isMuted?: boolean;
|
|
190
175
|
mutedUntil?: string;
|
|
191
|
-
encryptionMode?: EncryptionMode;
|
|
192
|
-
isEncryptionEnabled?: boolean;
|
|
193
|
-
encryptionKey?: string;
|
|
194
176
|
}
|
|
195
177
|
interface AppConfig {
|
|
196
178
|
maxPinnedConversations: number;
|
|
@@ -260,6 +242,7 @@ interface PresignedUrlRequest {
|
|
|
260
242
|
size: number;
|
|
261
243
|
conversationId?: string;
|
|
262
244
|
folder?: string;
|
|
245
|
+
metadata?: Record<string, unknown>;
|
|
263
246
|
}
|
|
264
247
|
interface PresignedUrlResponse {
|
|
265
248
|
fileId: string;
|
|
@@ -388,8 +371,6 @@ interface SendMessagePayload {
|
|
|
388
371
|
attachments?: SendMessageAttachment[];
|
|
389
372
|
replyTo?: string;
|
|
390
373
|
tempId: string;
|
|
391
|
-
encryptedContent?: EncryptedContent;
|
|
392
|
-
isEncrypted?: boolean;
|
|
393
374
|
}
|
|
394
375
|
interface QuietHours {
|
|
395
376
|
enabled: boolean;
|
|
@@ -522,8 +503,14 @@ interface AntzChatConfig {
|
|
|
522
503
|
};
|
|
523
504
|
/** Required for multi-tenant backends. Sent as X-Tenant-ID header. */
|
|
524
505
|
tenantId?: string;
|
|
525
|
-
/**
|
|
526
|
-
|
|
506
|
+
/**
|
|
507
|
+
* Enable payload-level transit encryption (ECDH key exchange + AES-256-GCM).
|
|
508
|
+
* Encrypts every HTTP request/response body and every socket event payload.
|
|
509
|
+
* Server must have TRANSIT_ENCRYPTION_ENABLED=true to match.
|
|
510
|
+
* Default: true — set false only for local development/debugging.
|
|
511
|
+
* Safe to toggle anytime — no data migration needed (wire-only, never affects storage).
|
|
512
|
+
*/
|
|
513
|
+
transitEncryption?: boolean;
|
|
527
514
|
upload?: UploadConfig;
|
|
528
515
|
/**
|
|
529
516
|
* Optional compression config. Compression is disabled if platformCompressFn is not provided.
|
|
@@ -580,7 +567,7 @@ interface ResolvedConfig {
|
|
|
580
567
|
url?: string;
|
|
581
568
|
base64?: string;
|
|
582
569
|
};
|
|
583
|
-
|
|
570
|
+
transitEncryption: boolean;
|
|
584
571
|
upload: {
|
|
585
572
|
maxFileSizeMB: ResolvedFileSizeLimits;
|
|
586
573
|
maxFilesPerMessage: number;
|
|
@@ -639,7 +626,6 @@ interface SendData {
|
|
|
639
626
|
attachments?: SendMessagePayload['attachments'];
|
|
640
627
|
replyTo?: string;
|
|
641
628
|
tempId?: string;
|
|
642
|
-
isEncrypted?: boolean;
|
|
643
629
|
}
|
|
644
630
|
declare const messagesApi: {
|
|
645
631
|
list(conversationId: string, params?: ListMessagesParams): Promise<CursorPaginatedResponse<Message>>;
|
|
@@ -695,7 +681,7 @@ declare const conversationsApi: {
|
|
|
695
681
|
unmute(conversationId: string): Promise<void>;
|
|
696
682
|
pin(conversationId: string): Promise<void>;
|
|
697
683
|
unpin(conversationId: string): Promise<void>;
|
|
698
|
-
leave(conversationId: string): Promise<void>;
|
|
684
|
+
leave(conversationId: string, andDelete?: boolean): Promise<void>;
|
|
699
685
|
getMembers(conversationId: string, filter?: "deleted" | "all"): Promise<Participant[]>;
|
|
700
686
|
/**
|
|
701
687
|
* Get unread message count for a single conversation.
|
|
@@ -715,6 +701,7 @@ declare const conversationsApi: {
|
|
|
715
701
|
* Server copies storageKey into conversation.iconMeta and deletes the chat_files record.
|
|
716
702
|
*/
|
|
717
703
|
uploadIcon(conversationId: string, fileId: string): Promise<Conversation>;
|
|
704
|
+
removeIcon(conversationId: string): Promise<Conversation>;
|
|
718
705
|
};
|
|
719
706
|
|
|
720
707
|
declare const storageApi: {
|
|
@@ -805,6 +792,30 @@ declare const devicesApi: {
|
|
|
805
792
|
remove(deviceId: string): Promise<void>;
|
|
806
793
|
};
|
|
807
794
|
|
|
795
|
+
/**
|
|
796
|
+
* Fields for updating the current user's profile.
|
|
797
|
+
*
|
|
798
|
+
* Works in both builtin and non-builtin (external/SSO/WSO2) modes.
|
|
799
|
+
*
|
|
800
|
+
* In non-builtin modes, firstName/lastName/email/displayName/phone are also
|
|
801
|
+
* synced from the upstream user-service (on socket connect if stale, and every
|
|
802
|
+
* 2 hours via cron). Calling updateProfile() is the way to push an immediate
|
|
803
|
+
* update to the chat server without waiting for the next sync cycle — useful
|
|
804
|
+
* when the host app knows a profile change just happened in the identity provider.
|
|
805
|
+
*
|
|
806
|
+
* Uniqueness constraints: email and phone must each be unique within the tenant.
|
|
807
|
+
* A 409 is returned if another user already holds the same email or phone.
|
|
808
|
+
*
|
|
809
|
+
* username and status are intentionally excluded — username is a system
|
|
810
|
+
* identifier and status is lifecycle-managed by user-service.
|
|
811
|
+
*/
|
|
812
|
+
interface UpdateProfilePayload {
|
|
813
|
+
firstName?: string;
|
|
814
|
+
lastName?: string;
|
|
815
|
+
email?: string;
|
|
816
|
+
displayName?: string;
|
|
817
|
+
phone?: string;
|
|
818
|
+
}
|
|
808
819
|
declare const usersApi: {
|
|
809
820
|
list(params?: {
|
|
810
821
|
query?: string;
|
|
@@ -815,6 +826,13 @@ declare const usersApi: {
|
|
|
815
826
|
getLastSeen(userId: string): Promise<{
|
|
816
827
|
lastSeenAt: string | null;
|
|
817
828
|
}>;
|
|
829
|
+
/**
|
|
830
|
+
* Update basic profile fields for the current user.
|
|
831
|
+
* Works in both builtin and non-builtin modes. Use this to push an immediate
|
|
832
|
+
* profile update to the chat server when the host app knows a change just
|
|
833
|
+
* happened — without waiting for the next 2-hour sync cycle.
|
|
834
|
+
*/
|
|
835
|
+
updateProfile(payload: UpdateProfilePayload): Promise<User>;
|
|
818
836
|
/**
|
|
819
837
|
* Update notification preferences for the current user.
|
|
820
838
|
* Partial update — only send fields you want to change.
|
|
@@ -852,10 +870,7 @@ declare function disconnectSocket(): void;
|
|
|
852
870
|
declare function reconnectSocket(token: string, userId?: string, tenantId?: string): void;
|
|
853
871
|
/**
|
|
854
872
|
* Updates the socket auth token from the stored getToken function and reconnects.
|
|
855
|
-
* Called by SocketProvider on connect_error to handle expired-token scenarios
|
|
856
|
-
* 1. Token expired while disconnected → server rejects the reconnect handshake
|
|
857
|
-
* 2. authProvider returns a fresh token → we update socket auth and retry
|
|
858
|
-
*
|
|
873
|
+
* Called by SocketProvider on connect_error to handle expired-token scenarios.
|
|
859
874
|
* Returns true if the token was updated, false if no token source is available.
|
|
860
875
|
*/
|
|
861
876
|
declare function refreshSocketAuth(): boolean;
|
|
@@ -877,6 +892,16 @@ declare const socketEmit: {
|
|
|
877
892
|
getTypingUsers(conversationId: string): Promise<unknown>;
|
|
878
893
|
};
|
|
879
894
|
|
|
895
|
+
type TransitAlgo = 'x25519' | 'p256';
|
|
896
|
+
|
|
897
|
+
interface TransitSession {
|
|
898
|
+
sessionKey: CryptoKey;
|
|
899
|
+
algo: TransitAlgo;
|
|
900
|
+
sessionId: string;
|
|
901
|
+
enabled: boolean;
|
|
902
|
+
}
|
|
903
|
+
declare function setTransitSession(session: TransitSession): void;
|
|
904
|
+
|
|
880
905
|
interface AuthState {
|
|
881
906
|
user: User | null;
|
|
882
907
|
tokens: AuthTokens | null;
|
|
@@ -1082,11 +1107,12 @@ declare class AntzChatClient {
|
|
|
1082
1107
|
unmute(conversationId: string): Promise<void>;
|
|
1083
1108
|
pin(conversationId: string): Promise<void>;
|
|
1084
1109
|
unpin(conversationId: string): Promise<void>;
|
|
1085
|
-
leave(conversationId: string): Promise<void>;
|
|
1110
|
+
leave(conversationId: string, andDelete?: boolean): Promise<void>;
|
|
1086
1111
|
getMembers(conversationId: string, filter?: "deleted" | "all"): Promise<Participant[]>;
|
|
1087
1112
|
getUnreadCount(conversationId: string): Promise<ConversationUnreadCount>;
|
|
1088
1113
|
getUnreadSummary(): Promise<UnreadSummary>;
|
|
1089
1114
|
uploadIcon(conversationId: string, fileId: string): Promise<Conversation>;
|
|
1115
|
+
removeIcon(conversationId: string): Promise<Conversation>;
|
|
1090
1116
|
};
|
|
1091
1117
|
readonly storage: {
|
|
1092
1118
|
requestPresignedUrl(payload: PresignedUrlRequest): Promise<PresignedUrlResponse>;
|
|
@@ -1124,6 +1150,7 @@ declare class AntzChatClient {
|
|
|
1124
1150
|
getLastSeen(userId: string): Promise<{
|
|
1125
1151
|
lastSeenAt: string | null;
|
|
1126
1152
|
}>;
|
|
1153
|
+
updateProfile(payload: UpdateProfilePayload): Promise<User>;
|
|
1127
1154
|
updatePreferences(prefs: UserPreferences): Promise<User>;
|
|
1128
1155
|
getPreferences(): Promise<UserPreferences | null>;
|
|
1129
1156
|
};
|
|
@@ -1135,4 +1162,4 @@ declare class AntzChatClient {
|
|
|
1135
1162
|
uploadIcon(conversationId: string, file: UploadableFile): Promise<Conversation>;
|
|
1136
1163
|
}
|
|
1137
1164
|
|
|
1138
|
-
export { AntzChatClient, type AntzChatConfig, type AppConfig, type Attachment, type AuthResponse, type AuthTokens, type BatchUploadResult, type CompressedFile, type CompressionAlgorithm, type CompressionConfig, type Conversation, type ConversationListParams, type ConversationUnreadCount, type CreateDirectData, type CreateGroupData, type CursorPaginatedResponse, type
|
|
1165
|
+
export { AntzChatClient, type AntzChatConfig, type AppConfig, type Attachment, type AuthResponse, type AuthTokens, type BatchUploadResult, type CompressedFile, type CompressionAlgorithm, type CompressionConfig, type Conversation, type ConversationListParams, type ConversationUnreadCount, type CreateDirectData, type CreateGroupData, type CursorPaginatedResponse, type FileResponse, type FileSizeLimits, type FileType, type LastReadEntry, type ListMessagesParams, type LoginCredentials, type Message, type MessageAckEvent, type MessageContent, type MessageDeletedEvent, type MessageDeletedForMeEvent, type MessageDeliveredEvent, type MessageReaction, type MessageReplyReference, type MessageUpdatedEvent, type MessagesDeliveredEvent, type MobileDeviceToken, type NewMessageEvent, type OptimisticAttachment, type PaginatedResponse, type Participant, type PersistStorage, type PlatformCompressFn, type PlatformUploadFn, type PresignedUrlRequest, type PresignedUrlResponse, type QuietHours, type ReactionUpdatedEvent, type ReadReceiptEvent, type RegisterData, type RegisterDeviceTokenPayload, type ReplyAttachmentSnapshot, type ResolvedCompressionConfig, type ResolvedConfig, type ResolvedFileSizeLimits, type SearchParams, type SendData, type SendMessageAttachment, type SendMessagePayload, type SocketStatus, type StatusListener, type TokenStore, type TypingIndicatorEvent, type UnreadSummary, type UpdateConversationData, type UpdateProfilePayload, type UploadConfig, type UploadProgress, type UploadableFile, type User, type UserPreferences, type UserStatusEvent, type WebPushDeviceToken, appConfigApi, authApi, connectSocket, conversationsApi, createAuthStore, devicesApi, disconnectSocket, getApiClient, getAuthStore, getCompressionStrategy, getSocket, getSocketStatus, initApiClient, initAuthStore, messagesApi, normalizeConversation, onSocketStatus, reconnectSocket, refreshSocketAuth, resetAuthStore, resolveConfig, setApiClientInstance, setTransitSession, socketEmit, storageApi, tryGetSocket, uploadBatch, useChatStore, usersApi };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { Socket } from 'socket.io-client';
|
|
|
3
3
|
import * as zustand_middleware from 'zustand/middleware';
|
|
4
4
|
import * as zustand from 'zustand';
|
|
5
5
|
|
|
6
|
-
type EncryptionMode = 'none' | 'server' | 'e2ee';
|
|
7
6
|
type FileType = 'image' | 'video' | 'audio' | 'document';
|
|
8
7
|
type ConversationType = 'direct' | 'group';
|
|
9
8
|
type MessageStatus = 'sent' | 'delivered' | 'read' | 'failed' | 'deleted';
|
|
@@ -79,17 +78,6 @@ interface Attachment {
|
|
|
79
78
|
isUploading?: boolean;
|
|
80
79
|
uploadProgress?: number;
|
|
81
80
|
}
|
|
82
|
-
interface EncryptedContent {
|
|
83
|
-
ciphertext: string;
|
|
84
|
-
iv: string;
|
|
85
|
-
tag: string;
|
|
86
|
-
algorithm: 'aes-256-gcm';
|
|
87
|
-
}
|
|
88
|
-
interface EncryptionKeyInfo {
|
|
89
|
-
key: string;
|
|
90
|
-
enabled: boolean;
|
|
91
|
-
mode: EncryptionMode;
|
|
92
|
-
}
|
|
93
81
|
interface MessageReaction {
|
|
94
82
|
emoji: string;
|
|
95
83
|
userIds: string[];
|
|
@@ -149,9 +137,6 @@ interface Message {
|
|
|
149
137
|
userId: string;
|
|
150
138
|
deliveredAt: string;
|
|
151
139
|
}>;
|
|
152
|
-
isEncrypted?: boolean;
|
|
153
|
-
encryptionMode?: EncryptionMode;
|
|
154
|
-
encryptedContent?: EncryptedContent;
|
|
155
140
|
}
|
|
156
141
|
interface Participant {
|
|
157
142
|
userId: string;
|
|
@@ -188,9 +173,6 @@ interface Conversation {
|
|
|
188
173
|
isPinned?: boolean;
|
|
189
174
|
isMuted?: boolean;
|
|
190
175
|
mutedUntil?: string;
|
|
191
|
-
encryptionMode?: EncryptionMode;
|
|
192
|
-
isEncryptionEnabled?: boolean;
|
|
193
|
-
encryptionKey?: string;
|
|
194
176
|
}
|
|
195
177
|
interface AppConfig {
|
|
196
178
|
maxPinnedConversations: number;
|
|
@@ -260,6 +242,7 @@ interface PresignedUrlRequest {
|
|
|
260
242
|
size: number;
|
|
261
243
|
conversationId?: string;
|
|
262
244
|
folder?: string;
|
|
245
|
+
metadata?: Record<string, unknown>;
|
|
263
246
|
}
|
|
264
247
|
interface PresignedUrlResponse {
|
|
265
248
|
fileId: string;
|
|
@@ -388,8 +371,6 @@ interface SendMessagePayload {
|
|
|
388
371
|
attachments?: SendMessageAttachment[];
|
|
389
372
|
replyTo?: string;
|
|
390
373
|
tempId: string;
|
|
391
|
-
encryptedContent?: EncryptedContent;
|
|
392
|
-
isEncrypted?: boolean;
|
|
393
374
|
}
|
|
394
375
|
interface QuietHours {
|
|
395
376
|
enabled: boolean;
|
|
@@ -522,8 +503,14 @@ interface AntzChatConfig {
|
|
|
522
503
|
};
|
|
523
504
|
/** Required for multi-tenant backends. Sent as X-Tenant-ID header. */
|
|
524
505
|
tenantId?: string;
|
|
525
|
-
/**
|
|
526
|
-
|
|
506
|
+
/**
|
|
507
|
+
* Enable payload-level transit encryption (ECDH key exchange + AES-256-GCM).
|
|
508
|
+
* Encrypts every HTTP request/response body and every socket event payload.
|
|
509
|
+
* Server must have TRANSIT_ENCRYPTION_ENABLED=true to match.
|
|
510
|
+
* Default: true — set false only for local development/debugging.
|
|
511
|
+
* Safe to toggle anytime — no data migration needed (wire-only, never affects storage).
|
|
512
|
+
*/
|
|
513
|
+
transitEncryption?: boolean;
|
|
527
514
|
upload?: UploadConfig;
|
|
528
515
|
/**
|
|
529
516
|
* Optional compression config. Compression is disabled if platformCompressFn is not provided.
|
|
@@ -580,7 +567,7 @@ interface ResolvedConfig {
|
|
|
580
567
|
url?: string;
|
|
581
568
|
base64?: string;
|
|
582
569
|
};
|
|
583
|
-
|
|
570
|
+
transitEncryption: boolean;
|
|
584
571
|
upload: {
|
|
585
572
|
maxFileSizeMB: ResolvedFileSizeLimits;
|
|
586
573
|
maxFilesPerMessage: number;
|
|
@@ -639,7 +626,6 @@ interface SendData {
|
|
|
639
626
|
attachments?: SendMessagePayload['attachments'];
|
|
640
627
|
replyTo?: string;
|
|
641
628
|
tempId?: string;
|
|
642
|
-
isEncrypted?: boolean;
|
|
643
629
|
}
|
|
644
630
|
declare const messagesApi: {
|
|
645
631
|
list(conversationId: string, params?: ListMessagesParams): Promise<CursorPaginatedResponse<Message>>;
|
|
@@ -695,7 +681,7 @@ declare const conversationsApi: {
|
|
|
695
681
|
unmute(conversationId: string): Promise<void>;
|
|
696
682
|
pin(conversationId: string): Promise<void>;
|
|
697
683
|
unpin(conversationId: string): Promise<void>;
|
|
698
|
-
leave(conversationId: string): Promise<void>;
|
|
684
|
+
leave(conversationId: string, andDelete?: boolean): Promise<void>;
|
|
699
685
|
getMembers(conversationId: string, filter?: "deleted" | "all"): Promise<Participant[]>;
|
|
700
686
|
/**
|
|
701
687
|
* Get unread message count for a single conversation.
|
|
@@ -715,6 +701,7 @@ declare const conversationsApi: {
|
|
|
715
701
|
* Server copies storageKey into conversation.iconMeta and deletes the chat_files record.
|
|
716
702
|
*/
|
|
717
703
|
uploadIcon(conversationId: string, fileId: string): Promise<Conversation>;
|
|
704
|
+
removeIcon(conversationId: string): Promise<Conversation>;
|
|
718
705
|
};
|
|
719
706
|
|
|
720
707
|
declare const storageApi: {
|
|
@@ -805,6 +792,30 @@ declare const devicesApi: {
|
|
|
805
792
|
remove(deviceId: string): Promise<void>;
|
|
806
793
|
};
|
|
807
794
|
|
|
795
|
+
/**
|
|
796
|
+
* Fields for updating the current user's profile.
|
|
797
|
+
*
|
|
798
|
+
* Works in both builtin and non-builtin (external/SSO/WSO2) modes.
|
|
799
|
+
*
|
|
800
|
+
* In non-builtin modes, firstName/lastName/email/displayName/phone are also
|
|
801
|
+
* synced from the upstream user-service (on socket connect if stale, and every
|
|
802
|
+
* 2 hours via cron). Calling updateProfile() is the way to push an immediate
|
|
803
|
+
* update to the chat server without waiting for the next sync cycle — useful
|
|
804
|
+
* when the host app knows a profile change just happened in the identity provider.
|
|
805
|
+
*
|
|
806
|
+
* Uniqueness constraints: email and phone must each be unique within the tenant.
|
|
807
|
+
* A 409 is returned if another user already holds the same email or phone.
|
|
808
|
+
*
|
|
809
|
+
* username and status are intentionally excluded — username is a system
|
|
810
|
+
* identifier and status is lifecycle-managed by user-service.
|
|
811
|
+
*/
|
|
812
|
+
interface UpdateProfilePayload {
|
|
813
|
+
firstName?: string;
|
|
814
|
+
lastName?: string;
|
|
815
|
+
email?: string;
|
|
816
|
+
displayName?: string;
|
|
817
|
+
phone?: string;
|
|
818
|
+
}
|
|
808
819
|
declare const usersApi: {
|
|
809
820
|
list(params?: {
|
|
810
821
|
query?: string;
|
|
@@ -815,6 +826,13 @@ declare const usersApi: {
|
|
|
815
826
|
getLastSeen(userId: string): Promise<{
|
|
816
827
|
lastSeenAt: string | null;
|
|
817
828
|
}>;
|
|
829
|
+
/**
|
|
830
|
+
* Update basic profile fields for the current user.
|
|
831
|
+
* Works in both builtin and non-builtin modes. Use this to push an immediate
|
|
832
|
+
* profile update to the chat server when the host app knows a change just
|
|
833
|
+
* happened — without waiting for the next 2-hour sync cycle.
|
|
834
|
+
*/
|
|
835
|
+
updateProfile(payload: UpdateProfilePayload): Promise<User>;
|
|
818
836
|
/**
|
|
819
837
|
* Update notification preferences for the current user.
|
|
820
838
|
* Partial update — only send fields you want to change.
|
|
@@ -852,10 +870,7 @@ declare function disconnectSocket(): void;
|
|
|
852
870
|
declare function reconnectSocket(token: string, userId?: string, tenantId?: string): void;
|
|
853
871
|
/**
|
|
854
872
|
* Updates the socket auth token from the stored getToken function and reconnects.
|
|
855
|
-
* Called by SocketProvider on connect_error to handle expired-token scenarios
|
|
856
|
-
* 1. Token expired while disconnected → server rejects the reconnect handshake
|
|
857
|
-
* 2. authProvider returns a fresh token → we update socket auth and retry
|
|
858
|
-
*
|
|
873
|
+
* Called by SocketProvider on connect_error to handle expired-token scenarios.
|
|
859
874
|
* Returns true if the token was updated, false if no token source is available.
|
|
860
875
|
*/
|
|
861
876
|
declare function refreshSocketAuth(): boolean;
|
|
@@ -877,6 +892,16 @@ declare const socketEmit: {
|
|
|
877
892
|
getTypingUsers(conversationId: string): Promise<unknown>;
|
|
878
893
|
};
|
|
879
894
|
|
|
895
|
+
type TransitAlgo = 'x25519' | 'p256';
|
|
896
|
+
|
|
897
|
+
interface TransitSession {
|
|
898
|
+
sessionKey: CryptoKey;
|
|
899
|
+
algo: TransitAlgo;
|
|
900
|
+
sessionId: string;
|
|
901
|
+
enabled: boolean;
|
|
902
|
+
}
|
|
903
|
+
declare function setTransitSession(session: TransitSession): void;
|
|
904
|
+
|
|
880
905
|
interface AuthState {
|
|
881
906
|
user: User | null;
|
|
882
907
|
tokens: AuthTokens | null;
|
|
@@ -1082,11 +1107,12 @@ declare class AntzChatClient {
|
|
|
1082
1107
|
unmute(conversationId: string): Promise<void>;
|
|
1083
1108
|
pin(conversationId: string): Promise<void>;
|
|
1084
1109
|
unpin(conversationId: string): Promise<void>;
|
|
1085
|
-
leave(conversationId: string): Promise<void>;
|
|
1110
|
+
leave(conversationId: string, andDelete?: boolean): Promise<void>;
|
|
1086
1111
|
getMembers(conversationId: string, filter?: "deleted" | "all"): Promise<Participant[]>;
|
|
1087
1112
|
getUnreadCount(conversationId: string): Promise<ConversationUnreadCount>;
|
|
1088
1113
|
getUnreadSummary(): Promise<UnreadSummary>;
|
|
1089
1114
|
uploadIcon(conversationId: string, fileId: string): Promise<Conversation>;
|
|
1115
|
+
removeIcon(conversationId: string): Promise<Conversation>;
|
|
1090
1116
|
};
|
|
1091
1117
|
readonly storage: {
|
|
1092
1118
|
requestPresignedUrl(payload: PresignedUrlRequest): Promise<PresignedUrlResponse>;
|
|
@@ -1124,6 +1150,7 @@ declare class AntzChatClient {
|
|
|
1124
1150
|
getLastSeen(userId: string): Promise<{
|
|
1125
1151
|
lastSeenAt: string | null;
|
|
1126
1152
|
}>;
|
|
1153
|
+
updateProfile(payload: UpdateProfilePayload): Promise<User>;
|
|
1127
1154
|
updatePreferences(prefs: UserPreferences): Promise<User>;
|
|
1128
1155
|
getPreferences(): Promise<UserPreferences | null>;
|
|
1129
1156
|
};
|
|
@@ -1135,4 +1162,4 @@ declare class AntzChatClient {
|
|
|
1135
1162
|
uploadIcon(conversationId: string, file: UploadableFile): Promise<Conversation>;
|
|
1136
1163
|
}
|
|
1137
1164
|
|
|
1138
|
-
export { AntzChatClient, type AntzChatConfig, type AppConfig, type Attachment, type AuthResponse, type AuthTokens, type BatchUploadResult, type CompressedFile, type CompressionAlgorithm, type CompressionConfig, type Conversation, type ConversationListParams, type ConversationUnreadCount, type CreateDirectData, type CreateGroupData, type CursorPaginatedResponse, type
|
|
1165
|
+
export { AntzChatClient, type AntzChatConfig, type AppConfig, type Attachment, type AuthResponse, type AuthTokens, type BatchUploadResult, type CompressedFile, type CompressionAlgorithm, type CompressionConfig, type Conversation, type ConversationListParams, type ConversationUnreadCount, type CreateDirectData, type CreateGroupData, type CursorPaginatedResponse, type FileResponse, type FileSizeLimits, type FileType, type LastReadEntry, type ListMessagesParams, type LoginCredentials, type Message, type MessageAckEvent, type MessageContent, type MessageDeletedEvent, type MessageDeletedForMeEvent, type MessageDeliveredEvent, type MessageReaction, type MessageReplyReference, type MessageUpdatedEvent, type MessagesDeliveredEvent, type MobileDeviceToken, type NewMessageEvent, type OptimisticAttachment, type PaginatedResponse, type Participant, type PersistStorage, type PlatformCompressFn, type PlatformUploadFn, type PresignedUrlRequest, type PresignedUrlResponse, type QuietHours, type ReactionUpdatedEvent, type ReadReceiptEvent, type RegisterData, type RegisterDeviceTokenPayload, type ReplyAttachmentSnapshot, type ResolvedCompressionConfig, type ResolvedConfig, type ResolvedFileSizeLimits, type SearchParams, type SendData, type SendMessageAttachment, type SendMessagePayload, type SocketStatus, type StatusListener, type TokenStore, type TypingIndicatorEvent, type UnreadSummary, type UpdateConversationData, type UpdateProfilePayload, type UploadConfig, type UploadProgress, type UploadableFile, type User, type UserPreferences, type UserStatusEvent, type WebPushDeviceToken, appConfigApi, authApi, connectSocket, conversationsApi, createAuthStore, devicesApi, disconnectSocket, getApiClient, getAuthStore, getCompressionStrategy, getSocket, getSocketStatus, initApiClient, initAuthStore, messagesApi, normalizeConversation, onSocketStatus, reconnectSocket, refreshSocketAuth, resetAuthStore, resolveConfig, setApiClientInstance, setTransitSession, socketEmit, storageApi, tryGetSocket, uploadBatch, useChatStore, usersApi };
|