@antzsoft/chat-core 1.1.5 → 1.1.7
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 +17 -0
- package/dist/{chunk-3QYXS3IW.js → chunk-XSGY3VBK.js} +31 -15
- package/dist/chunk-XSGY3VBK.js.map +1 -0
- package/dist/index.cjs +53 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +25 -27
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +26 -11
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +5 -1
- package/dist/internal.d.ts +5 -1
- package/dist/internal.js +3 -1
- package/dist/{internal-CACK6gGJ.d.cts → storage-Dc0__sXE.d.cts} +12 -1
- package/dist/{internal-CACK6gGJ.d.ts → storage-Dc0__sXE.d.ts} +12 -1
- package/docs/integration-guide.html +174 -5
- package/package.json +1 -1
- package/dist/chunk-3QYXS3IW.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { b as Attachment, C as CompressedFile, e as CompressionAlgorithm, f as CompressionConfig, k as FileSizeLimits,
|
|
1
|
+
import { J as ResolvedCompressionConfig, m as LoginCredentials, c as AuthResponse, H as RegisterData, d as AuthTokens, _ as User, a as AppConfig, U as SendMessagePayload, j as CursorPaginatedResponse, M as Message, P as PaginatedResponse, h as ConversationListParams, g as Conversation, w as Participant, i as ConversationUnreadCount, W as UnreadSummary, $ as UserPreferences, K as ResolvedConfig, x as PersistStorage, D as PresignedUrlRequest, E as PresignedUrlResponse, F as FileResponse, l as FileType, A as AntzChatConfig, Z as UploadableFile, B as BatchUploadResult } from './storage-Dc0__sXE.cjs';
|
|
2
|
+
export { b as Attachment, C as CompressedFile, e as CompressionAlgorithm, f as CompressionConfig, k as FileSizeLimits, L as LastReaction, n as MessageAckEvent, o as MessageContent, p as MessageDeletedEvent, q as MessageDeletedForMeEvent, r as MessageDeliveredEvent, s as MessageReaction, t as MessageReplyReference, u as MessageUpdatedEvent, v as MessagesDeliveredEvent, N as NewMessageEvent, O as OptimisticAttachment, y as PlatformCompressFn, z as PlatformUploadFn, Q as QuietHours, R as ReactionUpdatedEvent, G as ReadReceiptEvent, I as ReplyAttachmentSnapshot, S as ResolvedFileSizeLimits, T as SendMessageAttachment, V as TypingIndicatorEvent, X as UploadConfig, Y as UploadProgress, a0 as UserStatusEvent, a1 as resolveConfig, a2 as storageApi, a3 as uploadBatch } from './storage-Dc0__sXE.cjs';
|
|
3
3
|
import { AxiosInstance } from 'axios';
|
|
4
4
|
import { Socket } from 'socket.io-client';
|
|
5
5
|
import * as zustand_middleware from 'zustand/middleware';
|
|
@@ -505,6 +505,7 @@ declare class AntzChatClient {
|
|
|
505
505
|
errors: Array<{
|
|
506
506
|
filename: string;
|
|
507
507
|
error: string;
|
|
508
|
+
clientIndex?: number;
|
|
508
509
|
}>;
|
|
509
510
|
}>;
|
|
510
511
|
confirmUpload(fileId: string): Promise<FileResponse>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { b as Attachment, C as CompressedFile, e as CompressionAlgorithm, f as CompressionConfig, k as FileSizeLimits,
|
|
1
|
+
import { J as ResolvedCompressionConfig, m as LoginCredentials, c as AuthResponse, H as RegisterData, d as AuthTokens, _ as User, a as AppConfig, U as SendMessagePayload, j as CursorPaginatedResponse, M as Message, P as PaginatedResponse, h as ConversationListParams, g as Conversation, w as Participant, i as ConversationUnreadCount, W as UnreadSummary, $ as UserPreferences, K as ResolvedConfig, x as PersistStorage, D as PresignedUrlRequest, E as PresignedUrlResponse, F as FileResponse, l as FileType, A as AntzChatConfig, Z as UploadableFile, B as BatchUploadResult } from './storage-Dc0__sXE.js';
|
|
2
|
+
export { b as Attachment, C as CompressedFile, e as CompressionAlgorithm, f as CompressionConfig, k as FileSizeLimits, L as LastReaction, n as MessageAckEvent, o as MessageContent, p as MessageDeletedEvent, q as MessageDeletedForMeEvent, r as MessageDeliveredEvent, s as MessageReaction, t as MessageReplyReference, u as MessageUpdatedEvent, v as MessagesDeliveredEvent, N as NewMessageEvent, O as OptimisticAttachment, y as PlatformCompressFn, z as PlatformUploadFn, Q as QuietHours, R as ReactionUpdatedEvent, G as ReadReceiptEvent, I as ReplyAttachmentSnapshot, S as ResolvedFileSizeLimits, T as SendMessageAttachment, V as TypingIndicatorEvent, X as UploadConfig, Y as UploadProgress, a0 as UserStatusEvent, a1 as resolveConfig, a2 as storageApi, a3 as uploadBatch } from './storage-Dc0__sXE.js';
|
|
3
3
|
import { AxiosInstance } from 'axios';
|
|
4
4
|
import { Socket } from 'socket.io-client';
|
|
5
5
|
import * as zustand_middleware from 'zustand/middleware';
|
|
@@ -505,6 +505,7 @@ declare class AntzChatClient {
|
|
|
505
505
|
errors: Array<{
|
|
506
506
|
filename: string;
|
|
507
507
|
error: string;
|
|
508
|
+
clientIndex?: number;
|
|
508
509
|
}>;
|
|
509
510
|
}>;
|
|
510
511
|
confirmUpload(fileId: string): Promise<FileResponse>;
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
setTransitSession,
|
|
14
14
|
storageApi,
|
|
15
15
|
uploadBatch
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-XSGY3VBK.js";
|
|
17
17
|
import {
|
|
18
18
|
useChatStore
|
|
19
19
|
} from "./chunk-TB52RCSF.js";
|
|
@@ -105,7 +105,7 @@ var authApi = {
|
|
|
105
105
|
async uploadAvatar(file, mimeType) {
|
|
106
106
|
const form = new FormData();
|
|
107
107
|
form.append("avatar", file instanceof File ? file : new File([file], "avatar.jpg", { type: mimeType ?? "image/jpeg" }));
|
|
108
|
-
const { data } = await getApiClient().
|
|
108
|
+
const { data } = await getApiClient().post("/users/me/avatar", form, {
|
|
109
109
|
headers: { "Content-Type": "multipart/form-data" }
|
|
110
110
|
});
|
|
111
111
|
return data;
|
|
@@ -154,22 +154,22 @@ var messagesApi = {
|
|
|
154
154
|
return data;
|
|
155
155
|
},
|
|
156
156
|
async update(messageId, text) {
|
|
157
|
-
const { data } = await getApiClient().
|
|
157
|
+
const { data } = await getApiClient().post(`/messages/${messageId}/update`, { text });
|
|
158
158
|
return data;
|
|
159
159
|
},
|
|
160
160
|
async delete(messageId) {
|
|
161
|
-
await getApiClient().
|
|
161
|
+
await getApiClient().post(`/messages/${messageId}/delete`);
|
|
162
162
|
},
|
|
163
163
|
async deleteForMe(messageId) {
|
|
164
|
-
await getApiClient().
|
|
164
|
+
await getApiClient().post(`/messages/${messageId}/delete-for-me`);
|
|
165
165
|
},
|
|
166
166
|
async addReaction(messageId, emoji) {
|
|
167
167
|
const { data } = await getApiClient().post(`/messages/${messageId}/reactions`, { emoji });
|
|
168
168
|
return data;
|
|
169
169
|
},
|
|
170
170
|
async removeReaction(messageId, emoji) {
|
|
171
|
-
const { data } = await getApiClient().
|
|
172
|
-
`/messages/${messageId}/reactions/${encodeURIComponent(emoji)}`
|
|
171
|
+
const { data } = await getApiClient().post(
|
|
172
|
+
`/messages/${messageId}/reactions/${encodeURIComponent(emoji)}/remove`
|
|
173
173
|
);
|
|
174
174
|
return data;
|
|
175
175
|
},
|
|
@@ -177,7 +177,7 @@ var messagesApi = {
|
|
|
177
177
|
await getApiClient().post(`/messages/${messageId}/star`);
|
|
178
178
|
},
|
|
179
179
|
async unstar(messageId) {
|
|
180
|
-
await getApiClient().
|
|
180
|
+
await getApiClient().post(`/messages/${messageId}/unstar`);
|
|
181
181
|
},
|
|
182
182
|
async getStarred(params = {}) {
|
|
183
183
|
const { data } = await getApiClient().get("/messages/starred", { params });
|
|
@@ -201,7 +201,7 @@ var messagesApi = {
|
|
|
201
201
|
return data;
|
|
202
202
|
},
|
|
203
203
|
async unpin(messageId) {
|
|
204
|
-
const { data } = await getApiClient().
|
|
204
|
+
const { data } = await getApiClient().post(`/messages/${messageId}/unpin`);
|
|
205
205
|
return data;
|
|
206
206
|
},
|
|
207
207
|
async getPinned(conversationId) {
|
|
@@ -244,6 +244,7 @@ function normalizeLastMessage(lastMsg) {
|
|
|
244
244
|
text: lastMsg.contentPreview
|
|
245
245
|
},
|
|
246
246
|
reactions: [],
|
|
247
|
+
lastReaction: lastMsg.lastReaction ?? null,
|
|
247
248
|
status: lastMsg.status ?? "sent",
|
|
248
249
|
isEdited: false,
|
|
249
250
|
sentAt: lastMsg.sentAt ?? "",
|
|
@@ -277,11 +278,11 @@ var conversationsApi = {
|
|
|
277
278
|
return normalizeConversation(data);
|
|
278
279
|
},
|
|
279
280
|
async update(conversationId, payload) {
|
|
280
|
-
const { data } = await getApiClient().
|
|
281
|
+
const { data } = await getApiClient().post(`/conversations/${conversationId}/update`, payload);
|
|
281
282
|
return normalizeConversation(data);
|
|
282
283
|
},
|
|
283
284
|
async delete(conversationId) {
|
|
284
|
-
await getApiClient().
|
|
285
|
+
await getApiClient().post(`/conversations/${conversationId}/delete`);
|
|
285
286
|
},
|
|
286
287
|
async addParticipants(conversationId, userIds, role) {
|
|
287
288
|
const { data } = await getApiClient().post(
|
|
@@ -291,13 +292,13 @@ var conversationsApi = {
|
|
|
291
292
|
return normalizeConversation(data);
|
|
292
293
|
},
|
|
293
294
|
async removeParticipant(conversationId, userId) {
|
|
294
|
-
const { data } = await getApiClient().
|
|
295
|
-
`/conversations/${conversationId}/participants/${userId}`
|
|
295
|
+
const { data } = await getApiClient().post(
|
|
296
|
+
`/conversations/${conversationId}/participants/${userId}/remove`
|
|
296
297
|
);
|
|
297
298
|
return normalizeConversation(data);
|
|
298
299
|
},
|
|
299
300
|
async updateParticipantRole(conversationId, userId, role) {
|
|
300
|
-
const { data } = await getApiClient().
|
|
301
|
+
const { data } = await getApiClient().post(
|
|
301
302
|
`/conversations/${conversationId}/participants/${userId}/role`,
|
|
302
303
|
{ role }
|
|
303
304
|
);
|
|
@@ -307,17 +308,17 @@ var conversationsApi = {
|
|
|
307
308
|
await getApiClient().post(`/conversations/${conversationId}/mute`, mutedUntil ? { mutedUntil } : {});
|
|
308
309
|
},
|
|
309
310
|
async unmute(conversationId) {
|
|
310
|
-
await getApiClient().
|
|
311
|
+
await getApiClient().post(`/conversations/${conversationId}/unmute`);
|
|
311
312
|
},
|
|
312
313
|
async pin(conversationId) {
|
|
313
314
|
await getApiClient().post(`/conversations/${conversationId}/pin`);
|
|
314
315
|
},
|
|
315
316
|
async unpin(conversationId) {
|
|
316
|
-
await getApiClient().
|
|
317
|
+
await getApiClient().post(`/conversations/${conversationId}/unpin`);
|
|
317
318
|
},
|
|
318
319
|
async leave(conversationId, andDelete) {
|
|
319
320
|
const url = andDelete ? `/conversations/${conversationId}/leave?delete=true` : `/conversations/${conversationId}/leave`;
|
|
320
|
-
await getApiClient().
|
|
321
|
+
await getApiClient().post(url);
|
|
321
322
|
},
|
|
322
323
|
async getMembers(conversationId, filter) {
|
|
323
324
|
const { data } = await getApiClient().get(
|
|
@@ -352,16 +353,14 @@ var conversationsApi = {
|
|
|
352
353
|
* Server copies storageKey into conversation.iconMeta and deletes the chat_files record.
|
|
353
354
|
*/
|
|
354
355
|
async uploadIcon(conversationId, fileId) {
|
|
355
|
-
const { data } = await getApiClient().
|
|
356
|
+
const { data } = await getApiClient().post(
|
|
356
357
|
`/conversations/${conversationId}/icon`,
|
|
357
358
|
{ fileId }
|
|
358
359
|
);
|
|
359
360
|
return normalizeConversation(data);
|
|
360
361
|
},
|
|
361
362
|
async removeIcon(conversationId) {
|
|
362
|
-
const { data } = await getApiClient().
|
|
363
|
-
`/conversations/${conversationId}/icon`
|
|
364
|
-
);
|
|
363
|
+
const { data } = await getApiClient().post(`/conversations/${conversationId}/icon/remove`);
|
|
365
364
|
return normalizeConversation(data);
|
|
366
365
|
}
|
|
367
366
|
};
|
|
@@ -386,7 +385,7 @@ var devicesApi = {
|
|
|
386
385
|
* Call this on logout so the user stops receiving push notifications on this device.
|
|
387
386
|
*/
|
|
388
387
|
async remove(deviceId) {
|
|
389
|
-
await getApiClient().
|
|
388
|
+
await getApiClient().post(`/users/me/devices/${deviceId}/remove`);
|
|
390
389
|
}
|
|
391
390
|
};
|
|
392
391
|
|
|
@@ -411,7 +410,7 @@ var usersApi = {
|
|
|
411
410
|
* happened — without waiting for the next 2-hour sync cycle.
|
|
412
411
|
*/
|
|
413
412
|
async updateProfile(payload) {
|
|
414
|
-
const { data } = await getApiClient().
|
|
413
|
+
const { data } = await getApiClient().post("/users/me/update", payload);
|
|
415
414
|
return data;
|
|
416
415
|
},
|
|
417
416
|
/**
|
|
@@ -421,7 +420,7 @@ var usersApi = {
|
|
|
421
420
|
* token is first registered, so this never fails with "not found".
|
|
422
421
|
*/
|
|
423
422
|
async updatePreferences(prefs) {
|
|
424
|
-
const { data } = await getApiClient().
|
|
423
|
+
const { data } = await getApiClient().post("/users/me/preferences", prefs);
|
|
425
424
|
return data;
|
|
426
425
|
},
|
|
427
426
|
/**
|
|
@@ -634,8 +633,7 @@ async function _doConnect(config, getToken) {
|
|
|
634
633
|
const algo = await detectTransitAlgo();
|
|
635
634
|
boundDeriveSessionKey = await performHandshake(algo, serverKeys, socketHandshakeAuth);
|
|
636
635
|
} catch (err) {
|
|
637
|
-
|
|
638
|
-
console.warn("[AntzChat] Transit handshake setup failed, connecting without transit encryption:", err.message);
|
|
636
|
+
throw err;
|
|
639
637
|
}
|
|
640
638
|
} else {
|
|
641
639
|
try {
|
|
@@ -856,7 +854,7 @@ var socketEmit = {
|
|
|
856
854
|
fireAndForget("leave_room", { conversationId });
|
|
857
855
|
},
|
|
858
856
|
sendMessage(payload) {
|
|
859
|
-
return queueSendMessage(payload);
|
|
857
|
+
return queueSendMessage({ ...payload, sentAt: Date.now() });
|
|
860
858
|
},
|
|
861
859
|
updateMessage(messageId, text) {
|
|
862
860
|
return withAck("update_message", { messageId, text });
|