@cometchat/chat-sdk-javascript 4.1.6 → 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;
@@ -2117,6 +2118,17 @@ export class CometChat {
2117
2118
  success: boolean;
2118
2119
  message: string;
2119
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>;
2120
2132
  }
2121
2133
 
2122
2134
  export class CometChatNotifications {
@@ -3001,6 +3013,10 @@ export enum StorageMode {
3001
3013
  LOCAL = "local",
3002
3014
  SESSION = "session"
3003
3015
  }
3016
+ export enum SecureMediaMode {
3017
+ EMBEDDED = 0,
3018
+ HEADER_BASED = 1
3019
+ }
3004
3020
  export const GROUP_MEMBER_SCOPE: {
3005
3021
  ADMIN: string;
3006
3022
  MODERATOR: string;
@@ -4587,7 +4603,7 @@ export class Call extends BaseMessage implements Message {
4587
4603
  ACTION: string;
4588
4604
  CALL: string;
4589
4605
  CUSTOM: string;
4590
- INTERACTIVE: string;
4606
+ INTERACTIVE: string;
4591
4607
  };
4592
4608
  static readonly ACTION_TYPE: {
4593
4609
  TYPE_MEMBER_JOINED: string;
@@ -6479,6 +6495,8 @@ export class AppSettings {
6479
6495
  clientHost: string;
6480
6496
  /** @private */
6481
6497
  storageMode: StorageMode;
6498
+ /** @private */
6499
+ secureMediaMode: SecureMediaMode;
6482
6500
  /**
6483
6501
  * @private
6484
6502
  * @param {AppSettingsBuilder}
@@ -6524,6 +6542,11 @@ export class AppSettings {
6524
6542
  * @returns {StorageMode}
6525
6543
  */
6526
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;
6527
6550
  }
6528
6551
  export class AppSettingsBuilder {
6529
6552
  /** @private */
@@ -6542,6 +6565,8 @@ export class AppSettingsBuilder {
6542
6565
  clientHost: string;
6543
6566
  /** @private */
6544
6567
  storageMode: StorageMode;
6568
+ /** @private */
6569
+ secureMediaMode: SecureMediaMode;
6545
6570
  /**
6546
6571
  * A method to subscribe presence for all users.
6547
6572
  * @returns
@@ -6595,6 +6620,12 @@ export class AppSettingsBuilder {
6595
6620
  * @returns {this}
6596
6621
  */
6597
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;
6598
6629
  /**
6599
6630
  * This method will return an object of the AppSettings class.
6600
6631
  * @returns {AppSettings}
@@ -6623,6 +6654,17 @@ export class CometChatHelper {
6623
6654
  */
6624
6655
  static getConversationFromMessage(message: TextMessage | MediaMessage | CustomMessage | InteractiveMessage | any): Promise<Conversation>;
6625
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;
6626
6668
  }
6627
6669
 
6628
6670
  /**
@@ -8946,3 +8988,4 @@ export class AIAssistantToolResultEvent extends AIAssistantBaseEvent<AssistantTo
8946
8988
  */
8947
8989
  setRole(role: string): void;
8948
8990
  }
8991
+