@cometchat/chat-sdk-javascript 4.1.5 → 4.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/CometChat.d.ts CHANGED
@@ -22,6 +22,7 @@ export class CometChat {
22
22
  static AIAssistantToolEndedEvent: typeof AIAssistantToolEndedEvent;
23
23
  static AIAssistantToolArgumentEvent: typeof AIAssistantToolArgumentEvent;
24
24
  static AIAssistantToolResultEvent: typeof AIAssistantToolResultEvent;
25
+ static SecureMediaMode: typeof SecureMediaMode;
25
26
  static AI_ASSISTANT_EVENTS: {
26
27
  RUN_STARTED: string;
27
28
  RUN_FINISHED: string;
@@ -1386,12 +1387,36 @@ export class CometChat {
1386
1387
  */
1387
1388
  static markAsDelivered(...args: any): any;
1388
1389
  /**
1390
+ * Mark entire conversation as read for a user or group.
1391
+ * @param {string} conversationWith - User ID or Group ID
1392
+ * @param {string} conversationType - Conversation type (user or group)
1393
+ * @returns {Promise<string>}
1394
+ * @memberof CometChat
1395
+ */
1396
+ static markConversationAsRead(conversationWith: string, conversationType: string): Promise<string>;
1397
+ /**
1398
+ * Mark entire conversation as delivered for a user or group.
1399
+ * @param {string} conversationWith - User ID or Group ID
1400
+ * @param {string} conversationType - Receiver type (user or group)
1401
+ * @returns {Promise<string>}
1402
+ * @memberof CometChat
1403
+ */
1404
+ static markConversationAsDelivered(conversationWith: string, conversationType: string): Promise<string>;
1405
+ /**
1406
+ * @deprecated Please use markMessageAsUnread() instead.
1389
1407
  * Mark all the messages after the specified message id as unread.
1390
1408
  * @param {TextMessage | MediaMessage | CustomMessage | BaseMessage | any} message
1391
1409
  * @returns {Promise<string>}
1392
1410
  * @memberof CometChat
1393
1411
  **/
1394
1412
  static markAsUnread(message: TextMessage | MediaMessage | CustomMessage | any): Promise<string | CometChatException>;
1413
+ /**
1414
+ * Mark all the messages after the specified message id as unread.
1415
+ * @param {TextMessage | MediaMessage | CustomMessage | BaseMessage | any} message
1416
+ * @returns {Promise<string>}
1417
+ * @memberof CometChat
1418
+ **/
1419
+ static markMessageAsUnread(message: TextMessage | MediaMessage | CustomMessage | any): Promise<Conversation>;
1395
1420
  /**
1396
1421
  * Send a transient message.
1397
1422
  * @param {string} uid
@@ -2093,6 +2118,17 @@ export class CometChat {
2093
2118
  success: boolean;
2094
2119
  message: string;
2095
2120
  }>;
2121
+ /**
2122
+ * Returns the decoded File Access Token (FAT) for the currently logged-in user, or null if unavailable.
2123
+ * @returns {string | null}
2124
+ */
2125
+ static getFat(): string | null;
2126
+ /**
2127
+ * Resolves a presigned URL for the given secure media URL using the FAT header approach. Returns the original URL unchanged if header mode is not enabled or the URL does not require secure access.
2128
+ * @param {string} url - The original media URL to resolve.
2129
+ * @returns {Promise<string>}
2130
+ */
2131
+ static fetchPresignedUrl(url: string): Promise<string>;
2096
2132
  }
2097
2133
 
2098
2134
  export class CometChatNotifications {
@@ -2977,6 +3013,10 @@ export enum StorageMode {
2977
3013
  LOCAL = "local",
2978
3014
  SESSION = "session"
2979
3015
  }
3016
+ export enum SecureMediaMode {
3017
+ EMBEDDED = 0,
3018
+ HEADER_BASED = 1
3019
+ }
2980
3020
  export const GROUP_MEMBER_SCOPE: {
2981
3021
  ADMIN: string;
2982
3022
  MODERATOR: string;
@@ -4563,7 +4603,7 @@ export class Call extends BaseMessage implements Message {
4563
4603
  ACTION: string;
4564
4604
  CALL: string;
4565
4605
  CUSTOM: string;
4566
- INTERACTIVE: string;
4606
+ INTERACTIVE: string;
4567
4607
  };
4568
4608
  static readonly ACTION_TYPE: {
4569
4609
  TYPE_MEMBER_JOINED: string;
@@ -6455,6 +6495,8 @@ export class AppSettings {
6455
6495
  clientHost: string;
6456
6496
  /** @private */
6457
6497
  storageMode: StorageMode;
6498
+ /** @private */
6499
+ secureMediaMode: SecureMediaMode;
6458
6500
  /**
6459
6501
  * @private
6460
6502
  * @param {AppSettingsBuilder}
@@ -6500,6 +6542,11 @@ export class AppSettings {
6500
6542
  * @returns {StorageMode}
6501
6543
  */
6502
6544
  getStorageMode(): StorageMode;
6545
+ /**
6546
+ * Returns the secure media mode (embedded or header-based) set using the `setSecureMediaMode()` of the AppSettingsBuilder.
6547
+ * @returns {SecureMediaMode}
6548
+ */
6549
+ getSecureMediaMode(): SecureMediaMode;
6503
6550
  }
6504
6551
  export class AppSettingsBuilder {
6505
6552
  /** @private */
@@ -6518,6 +6565,8 @@ export class AppSettingsBuilder {
6518
6565
  clientHost: string;
6519
6566
  /** @private */
6520
6567
  storageMode: StorageMode;
6568
+ /** @private */
6569
+ secureMediaMode: SecureMediaMode;
6521
6570
  /**
6522
6571
  * A method to subscribe presence for all users.
6523
6572
  * @returns
@@ -6571,6 +6620,12 @@ export class AppSettingsBuilder {
6571
6620
  * @returns {this}
6572
6621
  */
6573
6622
  setStorageMode(storageMode: StorageMode): this;
6623
+ /**
6624
+ * Sets the secure media mode for the app settings.
6625
+ * @param {SecureMediaMode} secureMediaMode - The secure media mode to use.
6626
+ * @returns {this}
6627
+ */
6628
+ setSecureMediaMode(secureMediaMode: SecureMediaMode): this;
6574
6629
  /**
6575
6630
  * This method will return an object of the AppSettings class.
6576
6631
  * @returns {AppSettings}
@@ -6599,6 +6654,17 @@ export class CometChatHelper {
6599
6654
  */
6600
6655
  static getConversationFromMessage(message: TextMessage | MediaMessage | CustomMessage | InteractiveMessage | any): Promise<Conversation>;
6601
6656
  static updateMessageWithReactionInfo(baseMessage: BaseMessage, messageReaction: Reaction, action: REACTION_ACTION): BaseMessage | CometChatException;
6657
+ /**
6658
+ * Returns true if header-based secure media mode is active, a valid FAT exists, and the secure media host is configured.
6659
+ * @returns {boolean}
6660
+ */
6661
+ static isHeaderModeEnabled(): boolean;
6662
+ /**
6663
+ * Returns true if the given URL points to the configured secure media host and requires authenticated access.
6664
+ * @param {string | null} url - The URL to check.
6665
+ * @returns {boolean}
6666
+ */
6667
+ static requiresSecureAccess(url: string | null): boolean;
6602
6668
  }
6603
6669
 
6604
6670
  /**
@@ -6613,8 +6679,9 @@ export class Conversation {
6613
6679
  protected unreadMessageCount: number;
6614
6680
  protected unreadMentionsCount: number;
6615
6681
  protected lastReadMessageId: string;
6682
+ protected latestMessageId: string;
6616
6683
  protected tags: Array<String>;
6617
- constructor(conversationId: string, conversationType: string, lastMessage: TextMessage | MediaMessage | CustomMessage | any, conversationWith: User | Group, unreadMessageCount: number, tags: Array<String>, unreadMentionsCount: number | any, lastReadMessageId: string | any);
6684
+ constructor(conversationId: string, conversationType: string, lastMessage: TextMessage | MediaMessage | CustomMessage | any, conversationWith: User | Group, unreadMessageCount: number, tags: Array<String>, unreadMentionsCount: number | any, lastReadMessageId: string | any, latestMessageId?: string | any);
6618
6685
  /**
6619
6686
  * Method to set conversation ID of the conversation.
6620
6687
  * @param {string} conversationId
@@ -6640,6 +6707,16 @@ export class Conversation {
6640
6707
  * @param {string}
6641
6708
  */
6642
6709
  setLastReadMessageId(id: string): void;
6710
+ /**
6711
+ * Method to get latestMessageId of the conversation.
6712
+ * @returns {string}
6713
+ */
6714
+ getLatestMessageId(): string;
6715
+ /**
6716
+ * Method to set latestMessageId of the conversation.
6717
+ * @param {string}
6718
+ */
6719
+ setLatestMessageId(id: string): void;
6643
6720
  /**
6644
6721
  * Method to set conversation type of the conversation.
6645
6722
  * @param {string} conversationId
@@ -8911,3 +8988,4 @@ export class AIAssistantToolResultEvent extends AIAssistantBaseEvent<AssistantTo
8911
8988
  */
8912
8989
  setRole(role: string): void;
8913
8990
  }
8991
+