@antzsoft/chat-core 1.1.5 → 1.1.6

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/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { I as ResolvedCompressionConfig, L as LoginCredentials, c as AuthResponse, G as RegisterData, d as AuthTokens, Z as User, a as AppConfig, T as SendMessagePayload, j as CursorPaginatedResponse, M as Message, P as PaginatedResponse, h as ConversationListParams, g as Conversation, v as Participant, i as ConversationUnreadCount, V as UnreadSummary, _ as UserPreferences, J as ResolvedConfig, w as PersistStorage, z as PresignedUrlRequest, D as PresignedUrlResponse, F as FileResponse, l as FileType, A as AntzChatConfig, Y as UploadableFile, B as BatchUploadResult } from './internal-CACK6gGJ.cjs';
2
- export { b as Attachment, C as CompressedFile, e as CompressionAlgorithm, f as CompressionConfig, k as FileSizeLimits, m as MessageAckEvent, n as MessageContent, o as MessageDeletedEvent, p as MessageDeletedForMeEvent, q as MessageDeliveredEvent, r as MessageReaction, s as MessageReplyReference, t as MessageUpdatedEvent, u as MessagesDeliveredEvent, N as NewMessageEvent, O as OptimisticAttachment, x as PlatformCompressFn, y as PlatformUploadFn, Q as QuietHours, R as ReactionUpdatedEvent, E as ReadReceiptEvent, H as ReplyAttachmentSnapshot, K as ResolvedFileSizeLimits, S as SendMessageAttachment, U as TypingIndicatorEvent, W as UploadConfig, X as UploadProgress, $ as UserStatusEvent, a0 as resolveConfig, a1 as storageApi, a2 as uploadBatch } from './internal-CACK6gGJ.cjs';
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 { I as ResolvedCompressionConfig, L as LoginCredentials, c as AuthResponse, G as RegisterData, d as AuthTokens, Z as User, a as AppConfig, T as SendMessagePayload, j as CursorPaginatedResponse, M as Message, P as PaginatedResponse, h as ConversationListParams, g as Conversation, v as Participant, i as ConversationUnreadCount, V as UnreadSummary, _ as UserPreferences, J as ResolvedConfig, w as PersistStorage, z as PresignedUrlRequest, D as PresignedUrlResponse, F as FileResponse, l as FileType, A as AntzChatConfig, Y as UploadableFile, B as BatchUploadResult } from './internal-CACK6gGJ.js';
2
- export { b as Attachment, C as CompressedFile, e as CompressionAlgorithm, f as CompressionConfig, k as FileSizeLimits, m as MessageAckEvent, n as MessageContent, o as MessageDeletedEvent, p as MessageDeletedForMeEvent, q as MessageDeliveredEvent, r as MessageReaction, s as MessageReplyReference, t as MessageUpdatedEvent, u as MessagesDeliveredEvent, N as NewMessageEvent, O as OptimisticAttachment, x as PlatformCompressFn, y as PlatformUploadFn, Q as QuietHours, R as ReactionUpdatedEvent, E as ReadReceiptEvent, H as ReplyAttachmentSnapshot, K as ResolvedFileSizeLimits, S as SendMessageAttachment, U as TypingIndicatorEvent, W as UploadConfig, X as UploadProgress, $ as UserStatusEvent, a0 as resolveConfig, a1 as storageApi, a2 as uploadBatch } from './internal-CACK6gGJ.js';
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-3QYXS3IW.js";
16
+ } from "./chunk-3ISWHKXI.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().put("/users/me/avatar", form, {
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().put(`/messages/${messageId}`, { text });
157
+ const { data } = await getApiClient().post(`/messages/${messageId}/update`, { text });
158
158
  return data;
159
159
  },
160
160
  async delete(messageId) {
161
- await getApiClient().delete(`/messages/${messageId}`);
161
+ await getApiClient().post(`/messages/${messageId}/delete`);
162
162
  },
163
163
  async deleteForMe(messageId) {
164
- await getApiClient().delete(`/messages/${messageId}/for-me`);
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().delete(
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().delete(`/messages/${messageId}/star`);
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().delete(`/messages/${messageId}/pin`);
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().put(`/conversations/${conversationId}`, payload);
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().delete(`/conversations/${conversationId}`);
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().delete(
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().put(
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().delete(`/conversations/${conversationId}/mute`);
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().delete(`/conversations/${conversationId}/pin`);
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().delete(url);
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().put(
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().delete(
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().delete(`/users/me/devices/${deviceId}`);
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().put("/users/me", payload);
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().put("/users/me/preferences", prefs);
423
+ const { data } = await getApiClient().post("/users/me/preferences", prefs);
425
424
  return data;
426
425
  },
427
426
  /**
@@ -856,7 +855,7 @@ var socketEmit = {
856
855
  fireAndForget("leave_room", { conversationId });
857
856
  },
858
857
  sendMessage(payload) {
859
- return queueSendMessage(payload);
858
+ return queueSendMessage({ ...payload, sentAt: Date.now() });
860
859
  },
861
860
  updateMessage(messageId, text) {
862
861
  return withAck("update_message", { messageId, text });