@thrillee/aegischat 0.1.11 → 0.1.14

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.mts CHANGED
@@ -205,6 +205,7 @@ interface UseChatReturn {
205
205
  deleteFailedMessage: (tempId: string) => void;
206
206
  markAsRead: (channelId: string) => Promise<void>;
207
207
  setup: (options: UseChatOptions) => void;
208
+ updateChannel: (channelId: string, updates: Partial<ChannelListItem>) => void;
208
209
  }
209
210
  declare function useChat(options?: Partial<UseChatOptions>): UseChatReturn;
210
211
 
@@ -300,14 +301,14 @@ declare const chatApi: {
300
301
  /**
301
302
  * Connect to chat session
302
303
  */
303
- connect(params: ChatConnectParams, signal?: AbortSignal): Promise<ApiResponse<ChatSession>>;
304
+ connect(params: ChatConnectParams, signal?: AbortSignal): Promise<ChatSession>;
304
305
  /**
305
306
  * Refresh access token
306
307
  */
307
- refreshToken(refreshToken: string, signal?: AbortSignal): Promise<ApiResponse<{
308
+ refreshToken(refreshToken: string, signal?: AbortSignal): Promise<{
308
309
  access_token: string;
309
310
  expires_in: number;
310
- }>>;
311
+ }>;
311
312
  };
312
313
  declare const channelsApi: {
313
314
  /**
@@ -316,17 +317,17 @@ declare const channelsApi: {
316
317
  list(options?: {
317
318
  type?: string;
318
319
  limit?: number;
319
- }, signal?: AbortSignal): Promise<ApiResponse<{
320
+ }, signal?: AbortSignal): Promise<{
320
321
  channels: ChannelListItem[];
321
- }>>;
322
+ }>;
322
323
  /**
323
324
  * Get channel by ID
324
325
  */
325
- get(channelId: string, signal?: AbortSignal): Promise<ApiResponse<Channel>>;
326
+ get(channelId: string, signal?: AbortSignal): Promise<Channel>;
326
327
  /**
327
328
  * Get or create DM channel
328
329
  */
329
- getOrCreateDM(userId: string, signal?: AbortSignal): Promise<ApiResponse<Channel>>;
330
+ getOrCreateDM(userId: string, signal?: AbortSignal): Promise<Channel>;
330
331
  /**
331
332
  * Create channel
332
333
  */
@@ -335,19 +336,19 @@ declare const channelsApi: {
335
336
  type?: string;
336
337
  description?: string;
337
338
  metadata?: Record<string, unknown>;
338
- }, signal?: AbortSignal): Promise<ApiResponse<Channel>>;
339
+ }, signal?: AbortSignal): Promise<Channel>;
339
340
  /**
340
341
  * Mark channel as read
341
342
  */
342
- markAsRead(channelId: string, signal?: AbortSignal): Promise<ApiResponse<{
343
+ markAsRead(channelId: string, signal?: AbortSignal): Promise<{
343
344
  unread_count: number;
344
- }>>;
345
+ }>;
345
346
  /**
346
347
  * Get channel members
347
348
  */
348
- getMembers(channelId: string, signal?: AbortSignal): Promise<ApiResponse<{
349
+ getMembers(channelId: string, signal?: AbortSignal): Promise<{
349
350
  members: UserSummary[];
350
- }>>;
351
+ }>;
351
352
  /**
352
353
  * Update channel
353
354
  */
@@ -355,7 +356,7 @@ declare const channelsApi: {
355
356
  name?: string;
356
357
  description?: string;
357
358
  metadata?: Record<string, unknown>;
358
- }, signal?: AbortSignal): Promise<ApiResponse<Channel>>;
359
+ }, signal?: AbortSignal): Promise<Channel>;
359
360
  };
360
361
  declare const messagesApi: {
361
362
  /**
@@ -364,7 +365,7 @@ declare const messagesApi: {
364
365
  list(channelId: string, options?: {
365
366
  limit?: number;
366
367
  before?: string;
367
- }, signal?: AbortSignal): Promise<ApiResponse<MessagesResponse>>;
368
+ }, signal?: AbortSignal): Promise<MessagesResponse>;
368
369
  /**
369
370
  * Send a message
370
371
  */
@@ -374,46 +375,46 @@ declare const messagesApi: {
374
375
  parent_id?: string;
375
376
  metadata?: Record<string, unknown>;
376
377
  file_ids?: string[];
377
- }, signal?: AbortSignal): Promise<ApiResponse<Message>>;
378
+ }, signal?: AbortSignal): Promise<Message>;
378
379
  /**
379
380
  * Update a message
380
381
  */
381
382
  update(channelId: string, messageId: string, data: {
382
383
  content?: string;
383
384
  metadata?: Record<string, unknown>;
384
- }, signal?: AbortSignal): Promise<ApiResponse<Message>>;
385
+ }, signal?: AbortSignal): Promise<Message>;
385
386
  /**
386
387
  * Delete a message
387
388
  */
388
- delete(channelId: string, messageId: string, signal?: AbortSignal): Promise<ApiResponse<{
389
+ delete(channelId: string, messageId: string, signal?: AbortSignal): Promise<{
389
390
  success: boolean;
390
- }>>;
391
+ }>;
391
392
  /**
392
393
  * Mark messages as delivered
393
394
  */
394
- markDelivered(channelId: string, signal?: AbortSignal): Promise<ApiResponse<{
395
+ markDelivered(channelId: string, signal?: AbortSignal): Promise<{
395
396
  success: boolean;
396
- }>>;
397
+ }>;
397
398
  /**
398
399
  * Mark messages as read
399
400
  */
400
- markRead(channelId: string, signal?: AbortSignal): Promise<ApiResponse<{
401
+ markRead(channelId: string, signal?: AbortSignal): Promise<{
401
402
  success: boolean;
402
- }>>;
403
+ }>;
403
404
  };
404
405
  declare const reactionsApi: {
405
406
  /**
406
407
  * Add reaction to a message
407
408
  */
408
- add(channelId: string, messageId: string, emoji: string, signal?: AbortSignal): Promise<ApiResponse<{
409
+ add(channelId: string, messageId: string, emoji: string, signal?: AbortSignal): Promise<{
409
410
  reactions: ReactionSummary[];
410
- }>>;
411
+ }>;
411
412
  /**
412
413
  * Remove reaction from a message
413
414
  */
414
- remove(channelId: string, messageId: string, emoji: string, signal?: AbortSignal): Promise<ApiResponse<{
415
+ remove(channelId: string, messageId: string, emoji: string, signal?: AbortSignal): Promise<{
415
416
  reactions: ReactionSummary[];
416
- }>>;
417
+ }>;
417
418
  };
418
419
  declare const filesApi: {
419
420
  /**
@@ -423,32 +424,32 @@ declare const filesApi: {
423
424
  file_name: string;
424
425
  file_type: string;
425
426
  file_size: number;
426
- }, signal?: AbortSignal): Promise<ApiResponse<UploadUrlResponse>>;
427
+ }, signal?: AbortSignal): Promise<UploadUrlResponse>;
427
428
  /**
428
429
  * Confirm file upload
429
430
  */
430
- confirm(fileId: string, signal?: AbortSignal): Promise<ApiResponse<{
431
+ confirm(fileId: string, signal?: AbortSignal): Promise<{
431
432
  file: FileAttachment;
432
- }>>;
433
+ }>;
433
434
  /**
434
435
  * Get download URL
435
436
  */
436
- getDownloadUrl(fileId: string, signal?: AbortSignal): Promise<ApiResponse<{
437
+ getDownloadUrl(fileId: string, signal?: AbortSignal): Promise<{
437
438
  url: string;
438
439
  expires_at: string;
439
- }>>;
440
+ }>;
440
441
  };
441
442
  declare const usersApi: {
442
443
  /**
443
444
  * Search users
444
445
  */
445
- search(query: string, signal?: AbortSignal): Promise<ApiResponse<{
446
+ search(query: string, signal?: AbortSignal): Promise<{
446
447
  users: UserSummary[];
447
- }>>;
448
+ }>;
448
449
  /**
449
450
  * Get user by ID
450
451
  */
451
- get(userId: string, signal?: AbortSignal): Promise<ApiResponse<UserSummary>>;
452
+ get(userId: string, signal?: AbortSignal): Promise<UserSummary>;
452
453
  };
453
454
 
454
455
  export { type AegisConfig, type ApiError, type ApiResponse, type Channel, type ChannelListItem, type ChannelType, type ChannelsResponse, type ChatConnectParams, type ChatSession, type FileAttachment, type Message, type MessageMetadata, type MessageStatus, type MessageSummary, type MessageType, type MessagesResponse, type PaginatedResponse, type PaginationMeta, type PaginationParams, type ReactionEvent, type ReactionSummary, type TypingEvent, type TypingUser, type UploadProgress, type UseAutoReadOptions, type UseAutoReadReturn, type UseChannelsOptions, type UseChannelsReturn, type UseChatOptions, type UseChatReturn, type UseFileUploadOptions, type UseMentionsOptions, type UseMessagesOptions, type UseMessagesReturn, type UseReactionsOptions, type UseTypingIndicatorOptions, type UserStatus, type UserSummary, type WebSocketMessage, type WebSocketStatus, channelsApi, chatApi, configureApiClient, filesApi, messagesApi, reactionsApi, useAutoRead, useChannels, useChat, useFileUpload, useMentions, useMessages, useReactions, useTypingIndicator, usersApi };
package/dist/index.d.ts CHANGED
@@ -205,6 +205,7 @@ interface UseChatReturn {
205
205
  deleteFailedMessage: (tempId: string) => void;
206
206
  markAsRead: (channelId: string) => Promise<void>;
207
207
  setup: (options: UseChatOptions) => void;
208
+ updateChannel: (channelId: string, updates: Partial<ChannelListItem>) => void;
208
209
  }
209
210
  declare function useChat(options?: Partial<UseChatOptions>): UseChatReturn;
210
211
 
@@ -300,14 +301,14 @@ declare const chatApi: {
300
301
  /**
301
302
  * Connect to chat session
302
303
  */
303
- connect(params: ChatConnectParams, signal?: AbortSignal): Promise<ApiResponse<ChatSession>>;
304
+ connect(params: ChatConnectParams, signal?: AbortSignal): Promise<ChatSession>;
304
305
  /**
305
306
  * Refresh access token
306
307
  */
307
- refreshToken(refreshToken: string, signal?: AbortSignal): Promise<ApiResponse<{
308
+ refreshToken(refreshToken: string, signal?: AbortSignal): Promise<{
308
309
  access_token: string;
309
310
  expires_in: number;
310
- }>>;
311
+ }>;
311
312
  };
312
313
  declare const channelsApi: {
313
314
  /**
@@ -316,17 +317,17 @@ declare const channelsApi: {
316
317
  list(options?: {
317
318
  type?: string;
318
319
  limit?: number;
319
- }, signal?: AbortSignal): Promise<ApiResponse<{
320
+ }, signal?: AbortSignal): Promise<{
320
321
  channels: ChannelListItem[];
321
- }>>;
322
+ }>;
322
323
  /**
323
324
  * Get channel by ID
324
325
  */
325
- get(channelId: string, signal?: AbortSignal): Promise<ApiResponse<Channel>>;
326
+ get(channelId: string, signal?: AbortSignal): Promise<Channel>;
326
327
  /**
327
328
  * Get or create DM channel
328
329
  */
329
- getOrCreateDM(userId: string, signal?: AbortSignal): Promise<ApiResponse<Channel>>;
330
+ getOrCreateDM(userId: string, signal?: AbortSignal): Promise<Channel>;
330
331
  /**
331
332
  * Create channel
332
333
  */
@@ -335,19 +336,19 @@ declare const channelsApi: {
335
336
  type?: string;
336
337
  description?: string;
337
338
  metadata?: Record<string, unknown>;
338
- }, signal?: AbortSignal): Promise<ApiResponse<Channel>>;
339
+ }, signal?: AbortSignal): Promise<Channel>;
339
340
  /**
340
341
  * Mark channel as read
341
342
  */
342
- markAsRead(channelId: string, signal?: AbortSignal): Promise<ApiResponse<{
343
+ markAsRead(channelId: string, signal?: AbortSignal): Promise<{
343
344
  unread_count: number;
344
- }>>;
345
+ }>;
345
346
  /**
346
347
  * Get channel members
347
348
  */
348
- getMembers(channelId: string, signal?: AbortSignal): Promise<ApiResponse<{
349
+ getMembers(channelId: string, signal?: AbortSignal): Promise<{
349
350
  members: UserSummary[];
350
- }>>;
351
+ }>;
351
352
  /**
352
353
  * Update channel
353
354
  */
@@ -355,7 +356,7 @@ declare const channelsApi: {
355
356
  name?: string;
356
357
  description?: string;
357
358
  metadata?: Record<string, unknown>;
358
- }, signal?: AbortSignal): Promise<ApiResponse<Channel>>;
359
+ }, signal?: AbortSignal): Promise<Channel>;
359
360
  };
360
361
  declare const messagesApi: {
361
362
  /**
@@ -364,7 +365,7 @@ declare const messagesApi: {
364
365
  list(channelId: string, options?: {
365
366
  limit?: number;
366
367
  before?: string;
367
- }, signal?: AbortSignal): Promise<ApiResponse<MessagesResponse>>;
368
+ }, signal?: AbortSignal): Promise<MessagesResponse>;
368
369
  /**
369
370
  * Send a message
370
371
  */
@@ -374,46 +375,46 @@ declare const messagesApi: {
374
375
  parent_id?: string;
375
376
  metadata?: Record<string, unknown>;
376
377
  file_ids?: string[];
377
- }, signal?: AbortSignal): Promise<ApiResponse<Message>>;
378
+ }, signal?: AbortSignal): Promise<Message>;
378
379
  /**
379
380
  * Update a message
380
381
  */
381
382
  update(channelId: string, messageId: string, data: {
382
383
  content?: string;
383
384
  metadata?: Record<string, unknown>;
384
- }, signal?: AbortSignal): Promise<ApiResponse<Message>>;
385
+ }, signal?: AbortSignal): Promise<Message>;
385
386
  /**
386
387
  * Delete a message
387
388
  */
388
- delete(channelId: string, messageId: string, signal?: AbortSignal): Promise<ApiResponse<{
389
+ delete(channelId: string, messageId: string, signal?: AbortSignal): Promise<{
389
390
  success: boolean;
390
- }>>;
391
+ }>;
391
392
  /**
392
393
  * Mark messages as delivered
393
394
  */
394
- markDelivered(channelId: string, signal?: AbortSignal): Promise<ApiResponse<{
395
+ markDelivered(channelId: string, signal?: AbortSignal): Promise<{
395
396
  success: boolean;
396
- }>>;
397
+ }>;
397
398
  /**
398
399
  * Mark messages as read
399
400
  */
400
- markRead(channelId: string, signal?: AbortSignal): Promise<ApiResponse<{
401
+ markRead(channelId: string, signal?: AbortSignal): Promise<{
401
402
  success: boolean;
402
- }>>;
403
+ }>;
403
404
  };
404
405
  declare const reactionsApi: {
405
406
  /**
406
407
  * Add reaction to a message
407
408
  */
408
- add(channelId: string, messageId: string, emoji: string, signal?: AbortSignal): Promise<ApiResponse<{
409
+ add(channelId: string, messageId: string, emoji: string, signal?: AbortSignal): Promise<{
409
410
  reactions: ReactionSummary[];
410
- }>>;
411
+ }>;
411
412
  /**
412
413
  * Remove reaction from a message
413
414
  */
414
- remove(channelId: string, messageId: string, emoji: string, signal?: AbortSignal): Promise<ApiResponse<{
415
+ remove(channelId: string, messageId: string, emoji: string, signal?: AbortSignal): Promise<{
415
416
  reactions: ReactionSummary[];
416
- }>>;
417
+ }>;
417
418
  };
418
419
  declare const filesApi: {
419
420
  /**
@@ -423,32 +424,32 @@ declare const filesApi: {
423
424
  file_name: string;
424
425
  file_type: string;
425
426
  file_size: number;
426
- }, signal?: AbortSignal): Promise<ApiResponse<UploadUrlResponse>>;
427
+ }, signal?: AbortSignal): Promise<UploadUrlResponse>;
427
428
  /**
428
429
  * Confirm file upload
429
430
  */
430
- confirm(fileId: string, signal?: AbortSignal): Promise<ApiResponse<{
431
+ confirm(fileId: string, signal?: AbortSignal): Promise<{
431
432
  file: FileAttachment;
432
- }>>;
433
+ }>;
433
434
  /**
434
435
  * Get download URL
435
436
  */
436
- getDownloadUrl(fileId: string, signal?: AbortSignal): Promise<ApiResponse<{
437
+ getDownloadUrl(fileId: string, signal?: AbortSignal): Promise<{
437
438
  url: string;
438
439
  expires_at: string;
439
- }>>;
440
+ }>;
440
441
  };
441
442
  declare const usersApi: {
442
443
  /**
443
444
  * Search users
444
445
  */
445
- search(query: string, signal?: AbortSignal): Promise<ApiResponse<{
446
+ search(query: string, signal?: AbortSignal): Promise<{
446
447
  users: UserSummary[];
447
- }>>;
448
+ }>;
448
449
  /**
449
450
  * Get user by ID
450
451
  */
451
- get(userId: string, signal?: AbortSignal): Promise<ApiResponse<UserSummary>>;
452
+ get(userId: string, signal?: AbortSignal): Promise<UserSummary>;
452
453
  };
453
454
 
454
455
  export { type AegisConfig, type ApiError, type ApiResponse, type Channel, type ChannelListItem, type ChannelType, type ChannelsResponse, type ChatConnectParams, type ChatSession, type FileAttachment, type Message, type MessageMetadata, type MessageStatus, type MessageSummary, type MessageType, type MessagesResponse, type PaginatedResponse, type PaginationMeta, type PaginationParams, type ReactionEvent, type ReactionSummary, type TypingEvent, type TypingUser, type UploadProgress, type UseAutoReadOptions, type UseAutoReadReturn, type UseChannelsOptions, type UseChannelsReturn, type UseChatOptions, type UseChatReturn, type UseFileUploadOptions, type UseMentionsOptions, type UseMessagesOptions, type UseMessagesReturn, type UseReactionsOptions, type UseTypingIndicatorOptions, type UserStatus, type UserSummary, type WebSocketMessage, type WebSocketStatus, channelsApi, chatApi, configureApiClient, filesApi, messagesApi, reactionsApi, useAutoRead, useChannels, useChat, useFileUpload, useMentions, useMessages, useReactions, useTypingIndicator, usersApi };
package/dist/index.js CHANGED
@@ -123,7 +123,7 @@ var channelsApi = {
123
123
  * Create channel
124
124
  */
125
125
  async create(data, signal) {
126
- return fetchWithAuth("/api/v1/channels", {
126
+ return fetchWithAuth("/channels", {
127
127
  method: "POST",
128
128
  body: JSON.stringify(data),
129
129
  signal
@@ -133,7 +133,7 @@ var channelsApi = {
133
133
  * Mark channel as read
134
134
  */
135
135
  async markAsRead(channelId, signal) {
136
- return fetchWithAuth(`/api/v1/channels/${channelId}/read`, {
136
+ return fetchWithAuth(`/channels/${channelId}/read`, {
137
137
  method: "POST",
138
138
  signal
139
139
  });
@@ -148,7 +148,7 @@ var channelsApi = {
148
148
  * Update channel
149
149
  */
150
150
  async update(channelId, data, signal) {
151
- return fetchWithAuth(`/api/v1/channels/${channelId}`, {
151
+ return fetchWithAuth(`/channels/${channelId}`, {
152
152
  method: "PATCH",
153
153
  body: JSON.stringify(data),
154
154
  signal
@@ -336,9 +336,6 @@ function useChat(options = {}) {
336
336
  (0, import_react.useEffect)(() => {
337
337
  activeChannelIdRef.current = activeChannelId;
338
338
  }, [activeChannelId]);
339
- (0, import_react.useEffect)(() => {
340
- activeChannelIdRef.current = activeChannelId;
341
- }, [activeChannelId]);
342
339
  const getActiveChannelId = (0, import_react.useCallback)(() => {
343
340
  if (typeof window === "undefined") return null;
344
341
  return sessionStorage.getItem(SESSION_STORAGE_KEY);
@@ -613,7 +610,9 @@ function useChat(options = {}) {
613
610
  if (!currentSession) return;
614
611
  setIsLoadingChannels(true);
615
612
  try {
616
- const response = await fetchFromComms("/channels");
613
+ const response = await fetchFromComms(
614
+ "/channels"
615
+ );
617
616
  setChannels(response.channels || []);
618
617
  } catch (error) {
619
618
  console.error("[AegisChat] Failed to fetch channels:", error);
@@ -654,12 +653,6 @@ function useChat(options = {}) {
654
653
  if (response.oldest_id) {
655
654
  oldestMessageId.current = response.oldest_id;
656
655
  }
657
- await markAsRead(channelId);
658
- setChannels(
659
- (prev) => prev.map(
660
- (ch) => ch.id === channelId ? { ...ch, unread_count: 0 } : ch
661
- )
662
- );
663
656
  } catch (error) {
664
657
  console.error("[AegisChat] Failed to load messages:", error);
665
658
  setMessages([]);
@@ -679,6 +672,14 @@ function useChat(options = {}) {
679
672
  },
680
673
  [fetchFromComms]
681
674
  );
675
+ const updateChannel = (0, import_react.useCallback)(
676
+ (channelId, updates) => {
677
+ setChannels(
678
+ (prev) => prev.map((ch) => ch.id === channelId ? { ...ch, ...updates } : ch)
679
+ );
680
+ },
681
+ []
682
+ );
682
683
  const loadMoreMessages = (0, import_react.useCallback)(async () => {
683
684
  if (!activeChannelId || !hasMoreMessages || isLoadingMessages) return;
684
685
  setIsLoadingMessages(true);
@@ -1099,13 +1100,13 @@ function useChat(options = {}) {
1099
1100
  retryMessage,
1100
1101
  deleteFailedMessage,
1101
1102
  markAsRead,
1103
+ updateChannel,
1102
1104
  setup
1103
1105
  };
1104
1106
  }
1105
1107
 
1106
1108
  // src/hooks/useAutoRead.ts
1107
1109
  var import_react2 = require("react");
1108
- var SESSION_STORAGE_KEY2 = "@aegischat/activeChannel";
1109
1110
  function useAutoRead(options = {}) {
1110
1111
  const [isFocused, setIsFocused] = (0, import_react2.useState)(false);
1111
1112
  (0, import_react2.useEffect)(() => {
@@ -1119,18 +1120,6 @@ function useAutoRead(options = {}) {
1119
1120
  window.removeEventListener("blur", handleBlur);
1120
1121
  };
1121
1122
  }, []);
1122
- (0, import_react2.useEffect)(() => {
1123
- const handleVisibilityChange = () => {
1124
- if (!document.hidden) {
1125
- const activeChannelId = sessionStorage.getItem(SESSION_STORAGE_KEY2);
1126
- if (activeChannelId) {
1127
- markAsRead(activeChannelId);
1128
- }
1129
- }
1130
- };
1131
- document.addEventListener("visibilitychange", handleVisibilityChange);
1132
- return () => document.removeEventListener("visibilitychange", handleVisibilityChange);
1133
- }, []);
1134
1123
  const markAsRead = (0, import_react2.useCallback)(async (channelId) => {
1135
1124
  if (!isFocused) return;
1136
1125
  try {
@@ -1144,7 +1133,7 @@ function useAutoRead(options = {}) {
1144
1133
  if (!isFocused) return;
1145
1134
  try {
1146
1135
  const response = await channelsApi.list({});
1147
- const channels = response.data.channels || [];
1136
+ const channels = response.channels || [];
1148
1137
  await Promise.all(
1149
1138
  channels.filter((ch) => ch.unread_count > 0).map((ch) => channelsApi.markAsRead(ch.id))
1150
1139
  );
@@ -1169,7 +1158,7 @@ function useChannels(options = {}) {
1169
1158
  try {
1170
1159
  const response = await channelsApi.list({ type, limit }, signal);
1171
1160
  if (signal?.aborted) return;
1172
- setChannels(response.data.channels);
1161
+ setChannels(response.channels);
1173
1162
  } catch (err) {
1174
1163
  if (err instanceof Error && err.name === "AbortError") return;
1175
1164
  const error2 = err instanceof Error ? err : new Error("Failed to fetch channels");
@@ -1192,8 +1181,8 @@ function useChannels(options = {}) {
1192
1181
  const controller = new AbortController();
1193
1182
  abortControllerRef.current = controller;
1194
1183
  fetchChannels(controller.signal);
1195
- onChannelCreated?.(response.data);
1196
- return response.data;
1184
+ onChannelCreated?.(response);
1185
+ return response;
1197
1186
  } catch (err) {
1198
1187
  const error2 = err instanceof Error ? err : new Error("Failed to create DM");
1199
1188
  onError?.(error2);