@cometchat/chat-sdk-javascript 4.1.1 → 4.1.3

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
@@ -300,7 +300,7 @@ export class CometChat {
300
300
  };
301
301
  SESSION_ID_REQUIRED: {
302
302
  code: string;
303
- name: string;
303
+ /** @internal */ name: string;
304
304
  message: string;
305
305
  details: {};
306
306
  };
@@ -433,6 +433,7 @@ export class CometChat {
433
433
  MENTIONED_UIDS: string;
434
434
  ATTACHMENT_TYPES: string;
435
435
  WITH_PARENT: string;
436
+ HIDE_QUOTED_MESSAGES: string;
436
437
  };
437
438
  };
438
439
  };
@@ -1086,6 +1087,7 @@ export class CometChat {
1086
1087
  static CometChatHelper: typeof CometChatHelper;
1087
1088
  static Attachment: typeof Attachment;
1088
1089
  static MediaDevice: typeof MediaDevice;
1090
+ static StorageMode: typeof StorageMode;
1089
1091
  static MESSAGE_TYPE: {
1090
1092
  TEXT: string;
1091
1093
  MEDIA: string;
@@ -1215,6 +1217,10 @@ export class CometChat {
1215
1217
  * @memberof CometChat
1216
1218
  */
1217
1219
  static getSessionId(): string;
1220
+ /**
1221
+ * Initialize the storage with the current storage mode from AppSettings
1222
+ */
1223
+ static initializeStorage(): Promise<void>;
1218
1224
  /**
1219
1225
  * Storage event when a key is added/updated in localstorage.
1220
1226
  * @internal
@@ -2527,6 +2533,8 @@ export class BaseMessage implements Message {
2527
2533
  protected unreadRepliesCount: number;
2528
2534
  protected mentionedUsers?: User[];
2529
2535
  protected mentionedMe?: boolean;
2536
+ protected quotedMessageId?: number;
2537
+ protected quotedMessage?: BaseMessage;
2530
2538
  constructor(receiverId: string, messageType: string, receiverType: string, category: MessageCategory);
2531
2539
  /**
2532
2540
  * Get unread replies count of the message
@@ -2786,12 +2794,32 @@ export class BaseMessage implements Message {
2786
2794
  * set the array of reactions in message
2787
2795
  * @param {ReactionCount[]} reactions
2788
2796
  */
2789
- setReactions(reactions: any): ReactionCount[];
2797
+ setReactions(reactions: ReactionCount[]): void;
2790
2798
  /**
2791
2799
  * Get the array of reactions in message
2792
2800
  * @returns {ReactionCount[]}
2793
2801
  */
2794
2802
  getReactions(): ReactionCount[];
2803
+ /**
2804
+ * Get quoted message ID of the message.
2805
+ * @returns {number}
2806
+ */
2807
+ getQuotedMessageId(): number;
2808
+ /**
2809
+ * @param {number} value
2810
+ * Set quoted message ID of the message.
2811
+ */
2812
+ setQuotedMessageId(value: number): void;
2813
+ /**
2814
+ * Get quoted message of the message.
2815
+ * @returns {BaseMessage}
2816
+ */
2817
+ getQuotedMessage(): BaseMessage;
2818
+ /**
2819
+ * @param {BaseMessage} value
2820
+ * Set quoted message of the message.
2821
+ */
2822
+ setQuotedMessage(value: BaseMessage): void;
2795
2823
  }
2796
2824
 
2797
2825
  /**
@@ -2924,6 +2952,10 @@ export enum GroupMemberScope {
2924
2952
  Moderator = "moderator",
2925
2953
  Member = "member"
2926
2954
  }
2955
+ export enum StorageMode {
2956
+ LOCAL = "local",
2957
+ SESSION = "session"
2958
+ }
2927
2959
  export const GROUP_MEMBER_SCOPE: {
2928
2960
  ADMIN: string;
2929
2961
  MODERATOR: string;
@@ -3150,6 +3182,7 @@ export const MessageConstatnts: {
3150
3182
  MENTIONED_UIDS: string;
3151
3183
  ATTACHMENT_TYPES: string;
3152
3184
  WITH_PARENT: string;
3185
+ HIDE_QUOTED_MESSAGES: string;
3153
3186
  };
3154
3187
  };
3155
3188
  };
@@ -5016,6 +5049,10 @@ export class GroupsRequestBuilder {
5016
5049
  }
5017
5050
 
5018
5051
  export class GroupMembersRequest {
5052
+ static USER_STATUS: {
5053
+ ONLINE: string;
5054
+ OFFLINE: string;
5055
+ };
5019
5056
  constructor(builder: GroupMembersRequestBuilder);
5020
5057
  /**
5021
5058
  * Get list of next set of group members based on the parameters specified in GroupMembersRequestBuilder class. The Developer need to call this method repeatedly using the same object of GroupMembersRequest class to get paginated list of group members.
@@ -5047,6 +5084,12 @@ export class GroupMembersRequest {
5047
5084
  * @return {String[]}
5048
5085
  */
5049
5086
  getScopes(): String[];
5087
+ /**
5088
+ * Gets the status filter used to fetch members based on their online or offline status.
5089
+ *
5090
+ * @return {string}
5091
+ */
5092
+ getStatus(): string;
5050
5093
  /**
5051
5094
  * @internal
5052
5095
  */
@@ -5057,6 +5100,7 @@ export class GroupMembersRequestBuilder {
5057
5100
  /** @private */ searchKeyword: string;
5058
5101
  /** @private */ guid: string;
5059
5102
  /** @private */ scopes?: Array<String>;
5103
+ /** @private */ status: string;
5060
5104
  constructor(guid: string);
5061
5105
  /**
5062
5106
  * Set the unique identifier of the group.
@@ -5086,6 +5130,12 @@ export class GroupMembersRequestBuilder {
5086
5130
  * @returns
5087
5131
  */
5088
5132
  setScopes(scopes: Array<String>): this;
5133
+ /**
5134
+ * A method to get the members belonging to a specific status.
5135
+ * @param {string} status
5136
+ * @returns
5137
+ */
5138
+ setStatus(status: string): this;
5089
5139
  /**
5090
5140
  * This method will return an object of the GroupMembersRequest class.
5091
5141
  * @returns {GroupMembersRequest}
@@ -5454,6 +5504,18 @@ export class ConversationsRequest {
5454
5504
  * @returns {boolean}
5455
5505
  */
5456
5506
  getUnread(): boolean;
5507
+ /**
5508
+ * Determines whether agentic conversations should be hidden.
5509
+ *
5510
+ * @returns {boolean}
5511
+ */
5512
+ getHideAgentic(): boolean;
5513
+ /**
5514
+ * Determines whether only agentic conversations should be fetched.
5515
+ *
5516
+ * @returns {boolean}
5517
+ */
5518
+ getOnlyAgentic(): boolean;
5457
5519
  }
5458
5520
  export class ConversationsRequestBuilder {
5459
5521
  /** @private */ conversationType: string;
@@ -5467,6 +5529,8 @@ export class ConversationsRequestBuilder {
5467
5529
  /** @private */ WithBlockedInfo: boolean;
5468
5530
  /** @private */ searchKeyword: string;
5469
5531
  /** @private */ unreadOnly: boolean;
5532
+ /** @private */ hideAgentic: boolean;
5533
+ /** @private */ onlyAgentic: boolean;
5470
5534
  /**
5471
5535
  *
5472
5536
  * @param {number} limit
@@ -5555,6 +5619,18 @@ export class ConversationsRequestBuilder {
5555
5619
  * @returns
5556
5620
  */
5557
5621
  setUnread(unread: boolean): this;
5622
+ /**
5623
+ * A method to hide agentic conversations from the list.
5624
+ * @param {boolean} hideAgentic
5625
+ * @returns
5626
+ */
5627
+ setHideAgentic(hideAgentic: boolean): this;
5628
+ /**
5629
+ * A method to fetch only agentic conversations.
5630
+ * @param {boolean} onlyAgentic
5631
+ * @returns
5632
+ */
5633
+ setOnlyAgentic(onlyAgentic: boolean): this;
5558
5634
  /**
5559
5635
  * This method will return an object of the ConversationsRequest class.
5560
5636
  * @returns {ConversationsRequest}
@@ -5737,6 +5813,12 @@ export class MessagesRequest {
5737
5813
  * Gets the flag indicating whether to fetch messages with parent message information.
5738
5814
  */
5739
5815
  isWithParent(): boolean;
5816
+ /**
5817
+ * Gets the flag indicating whether to hide quoted messages when fetching messages.
5818
+ *
5819
+ * @return {boolean}
5820
+ */
5821
+ isHideQuotedMessages(): boolean;
5740
5822
  /**
5741
5823
  * Get list of next messages based on the parameters specified in MessagesRequestBuilder class. The Developer need to call this method repeatedly using the same object of MessagesRequest class to get paginated list of message.
5742
5824
  * @returns {Promise<BaseMessage[] | []>}
@@ -5779,6 +5861,7 @@ export class MessagesRequestBuilder {
5779
5861
  /** @private */ mentionedUIDs?: Array<String>;
5780
5862
  /** @private */ attachmentTypes?: Array<AttachmentType>;
5781
5863
  /** @private */ WithParent?: boolean;
5864
+ /** @private */ HideQuotedMessages?: boolean;
5782
5865
  /**
5783
5866
  * A method to set limit for the number of messages returned in a single iteration. A maximum of 100 messages can fetched in a single iteration.
5784
5867
  * @param {number} limit
@@ -5953,6 +6036,12 @@ export class MessagesRequestBuilder {
5953
6036
  * @returns {this}
5954
6037
  */
5955
6038
  withParent(withParent?: boolean): this;
6039
+ /**
6040
+ * A method to hide quoted messages.
6041
+ * @param {boolean} hideQuotedMessages
6042
+ * @returns
6043
+ */
6044
+ hideQuotedMessages(hideQuotedMessages: boolean): this;
5956
6045
  /**
5957
6046
  * This method will return an object of the MessagesRequest class.
5958
6047
  * @returns {MessagesRequest}
@@ -6225,6 +6314,10 @@ export class BlockedUsersRequestBuilder {
6225
6314
  build(): BlockedUsersRequest;
6226
6315
  }
6227
6316
 
6317
+ /**
6318
+ *
6319
+ * @module AppSettings
6320
+ */
6228
6321
  export class AppSettings {
6229
6322
  static SUBSCRIPTION_TYPE_NONE: string;
6230
6323
  static SUBSCRIPTION_TYPE_ALL_USERS: string;
@@ -6238,6 +6331,9 @@ export class AppSettings {
6238
6331
  static REGION_IN: string;
6239
6332
  /** @private */
6240
6333
  static REGION_PRIVATE: string;
6334
+ /** Storage modes */
6335
+ static STORAGE_MODE_LOCAL: StorageMode;
6336
+ static STORAGE_MODE_SESSION: StorageMode;
6241
6337
  /** @private */
6242
6338
  subscriptionType: string;
6243
6339
  /** @private */
@@ -6252,6 +6348,8 @@ export class AppSettings {
6252
6348
  adminHost: string;
6253
6349
  /** @private */
6254
6350
  clientHost: string;
6351
+ /** @private */
6352
+ storageMode: StorageMode;
6255
6353
  /**
6256
6354
  * @private
6257
6355
  * @param {AppSettingsBuilder}
@@ -6289,9 +6387,14 @@ export class AppSettings {
6289
6387
  getAdminHost(): string;
6290
6388
  /**
6291
6389
  * This method returns the client host to which the SDK should connect.
6292
- * @returns {boolean}
6390
+ * @returns {string}
6293
6391
  */
6294
6392
  getClientHost(): string;
6393
+ /**
6394
+ * This method returns the storage mode (local or session) set using the `setStorageMode()` of the AppSettingsBuilder.
6395
+ * @returns {StorageMode}
6396
+ */
6397
+ getStorageMode(): StorageMode;
6295
6398
  }
6296
6399
  export class AppSettingsBuilder {
6297
6400
  /** @private */
@@ -6308,6 +6411,8 @@ export class AppSettingsBuilder {
6308
6411
  adminHost: string;
6309
6412
  /** @private */
6310
6413
  clientHost: string;
6414
+ /** @private */
6415
+ storageMode: StorageMode;
6311
6416
  /**
6312
6417
  * A method to subscribe presence for all users.
6313
6418
  * @returns
@@ -6354,6 +6459,13 @@ export class AppSettingsBuilder {
6354
6459
  * @returns
6355
6460
  */
6356
6461
  overrideClientHost(clientHost: string): this;
6462
+ /**
6463
+ * @param {StorageMode} storageMode
6464
+ * This method is used to set the storage mode for the SDK. Default is 'local' (localStorage).
6465
+ * Use 'session' for sessionStorage.
6466
+ * @returns {this}
6467
+ */
6468
+ setStorageMode(storageMode: StorageMode): this;
6357
6469
  /**
6358
6470
  * This method will return an object of the AppSettings class.
6359
6471
  * @returns {AppSettings}
@@ -8325,7 +8437,7 @@ export class AIAssistantBaseEvent<T extends AssistantBaseEventData = AssistantBa
8325
8437
  /**
8326
8438
  * The parent message ID (if applicable)
8327
8439
  */
8328
- patentMessageId: string;
8440
+ parentMessageId: string;
8329
8441
  /**
8330
8442
  * Additional data associated with the event
8331
8443
  */
@@ -8335,10 +8447,10 @@ export class AIAssistantBaseEvent<T extends AssistantBaseEventData = AssistantBa
8335
8447
  * @param type - The type of the stream event
8336
8448
  * @param conversationId - The conversation ID
8337
8449
  * @param messageId - The message ID
8338
- * @param patentMessageId - The parent message ID
8450
+ * @param parentMessageId - The parent message ID
8339
8451
  * @param data - Additional data with timestamp
8340
8452
  */
8341
- constructor(type: string, conversationId: string, messageId: string, patentMessageId: string, data: T);
8453
+ constructor(type: string, conversationId: string, messageId: string, parentMessageId: string, data: T);
8342
8454
  /**
8343
8455
  * Get the type of the stream event
8344
8456
  * @returns The type as a string
@@ -8371,14 +8483,26 @@ export class AIAssistantBaseEvent<T extends AssistantBaseEventData = AssistantBa
8371
8483
  setMessageId(messageId: string): void;
8372
8484
  /**
8373
8485
  * Get the parent message ID
8486
+ * @deprecated Use getParentMessageId() instead
8374
8487
  * @returns The parent message ID as a string
8375
8488
  */
8376
8489
  getPatentMessageId(): string;
8490
+ /**
8491
+ * Get the parent message ID
8492
+ * @returns The parent message ID as a string
8493
+ */
8494
+ getParentMessageId(): string;
8377
8495
  /**
8378
8496
  * Set the parent message ID
8379
- * @param patentMessageId - The parent message ID to set
8497
+ * @deprecated Use setParentMessageId() instead
8498
+ * @param parentMessageId - The parent message ID to set
8380
8499
  */
8381
- setPatentMessageId(patentMessageId: string): void;
8500
+ setPatentMessageId(parentMessageId: string): void;
8501
+ /**
8502
+ * Set the parent message ID
8503
+ * @param parentMessageId - The parent message ID to set
8504
+ */
8505
+ setParentMessageId(parentMessageId: string): void;
8382
8506
  /**
8383
8507
  * Get the data object
8384
8508
  * @returns The data object
@@ -8440,7 +8564,7 @@ export interface AssistantRunStartedEventData extends AssistantBaseEventData {
8440
8564
  [key: string]: any;
8441
8565
  }
8442
8566
  export class AIAssistantRunStartedEvent extends AIAssistantBaseEvent<AssistantRunStartedEventData> {
8443
- constructor(conversationId: string, messageId: string, patentMessageId: string, data: AssistantRunStartedEventData);
8567
+ constructor(conversationId: string, messageId: string, parentMessageId: string, data: AssistantRunStartedEventData);
8444
8568
  }
8445
8569
 
8446
8570
  /**
@@ -8451,7 +8575,7 @@ export interface AssistantRunFinishedEventData extends AssistantBaseEventData {
8451
8575
  [key: string]: any;
8452
8576
  }
8453
8577
  export class AIAssistantRunFinishedEvent extends AIAssistantBaseEvent<AssistantRunFinishedEventData> {
8454
- constructor(conversationId: string, messageId: string, patentMessageId: string, data: AssistantRunFinishedEventData);
8578
+ constructor(conversationId: string, messageId: string, parentMessageId: string, data: AssistantRunFinishedEventData);
8455
8579
  }
8456
8580
 
8457
8581
  /**
@@ -8463,7 +8587,7 @@ export interface AssistantMessageStartedEventData extends AssistantBaseEventData
8463
8587
  [key: string]: any;
8464
8588
  }
8465
8589
  export class AIAssistantMessageStartedEvent extends AIAssistantBaseEvent<AssistantMessageStartedEventData> {
8466
- constructor(conversationId: string, messageId: string, patentMessageId: string, data: AssistantMessageStartedEventData);
8590
+ constructor(conversationId: string, messageId: string, parentMessageId: string, data: AssistantMessageStartedEventData);
8467
8591
  /**
8468
8592
  * Returns the role of the event
8469
8593
  * @returns {string | undefined} The role of the event
@@ -8484,7 +8608,7 @@ export interface AssistantMessageEndedEventData extends AssistantBaseEventData {
8484
8608
  [key: string]: any;
8485
8609
  }
8486
8610
  export class AIAssistantMessageEndedEvent extends AIAssistantBaseEvent<AssistantMessageEndedEventData> {
8487
- constructor(conversationId: string, messageId: string, patentMessageId: string, data: AssistantMessageEndedEventData);
8611
+ constructor(conversationId: string, messageId: string, parentMessageId: string, data: AssistantMessageEndedEventData);
8488
8612
  }
8489
8613
 
8490
8614
  /**
@@ -8499,7 +8623,7 @@ export interface AssistantContentEventData extends AssistantBaseEventData {
8499
8623
  * Event class for text message content received from assistant
8500
8624
  */
8501
8625
  export class AIAssistantContentReceivedEvent extends AIAssistantBaseEvent<AssistantContentEventData> {
8502
- constructor(conversationId: string, messageId: string, patentMessageId: string, data: AssistantContentEventData);
8626
+ constructor(conversationId: string, messageId: string, parentMessageId: string, data: AssistantContentEventData);
8503
8627
  /**
8504
8628
  * Gets the delta value for the content received event
8505
8629
  * @returns The delta string
@@ -8527,7 +8651,7 @@ export interface AssistantToolStartedEventData extends AssistantBaseEventData {
8527
8651
  * Event class for tool call started events
8528
8652
  */
8529
8653
  export class AIAssistantToolStartedEvent extends AIAssistantBaseEvent<AssistantToolStartedEventData> {
8530
- constructor(conversationId: string, messageId: string, patentMessageId: string, data: AssistantToolStartedEventData);
8654
+ constructor(conversationId: string, messageId: string, parentMessageId: string, data: AssistantToolStartedEventData);
8531
8655
  /**
8532
8656
  * Gets the tool call ID for the tool started event
8533
8657
  * @returns The tool call ID
@@ -8583,7 +8707,7 @@ export interface AssistantToolArgumentEventData extends AssistantBaseEventData {
8583
8707
  * Event class for tool call argument events
8584
8708
  */
8585
8709
  export class AIAssistantToolArgumentEvent extends AIAssistantBaseEvent<AssistantToolArgumentEventData> {
8586
- constructor(conversationId: string, messageId: string, patentMessageId: string, data: AssistantToolArgumentEventData);
8710
+ constructor(conversationId: string, messageId: string, parentMessageId: string, data: AssistantToolArgumentEventData);
8587
8711
  /**
8588
8712
  * Gets the tool call ID for the tool argument event
8589
8713
  * @returns The tool call ID
@@ -8618,7 +8742,7 @@ export interface AssistantToolEndedEventData extends AssistantBaseEventData {
8618
8742
  * Event class for tool call ended events
8619
8743
  */
8620
8744
  export class AIAssistantToolEndedEvent extends AIAssistantBaseEvent<AssistantToolEndedEventData> {
8621
- constructor(conversationId: string, messageId: string, patentMessageId: string, data: AssistantToolEndedEventData);
8745
+ constructor(conversationId: string, messageId: string, parentMessageId: string, data: AssistantToolEndedEventData);
8622
8746
  /**
8623
8747
  * Gets the tool call ID for the tool ended event
8624
8748
  * @returns The tool call ID
@@ -8650,7 +8774,7 @@ export interface AssistantToolResultEventData extends AssistantBaseEventData {
8650
8774
  * Event class for tool call result events
8651
8775
  */
8652
8776
  export class AIAssistantToolResultEvent extends AIAssistantBaseEvent<AssistantToolResultEventData> {
8653
- constructor(conversationId: string, messageId: string, patentMessageId: string, data: AssistantToolResultEventData);
8777
+ constructor(conversationId: string, messageId: string, parentMessageId: string, data: AssistantToolResultEventData);
8654
8778
  /**
8655
8779
  * Gets the tool call ID for the tool result event
8656
8780
  * @returns The tool call ID
@@ -8682,4 +8806,3 @@ export class AIAssistantToolResultEvent extends AIAssistantBaseEvent<AssistantTo
8682
8806
  */
8683
8807
  setRole(role: string): void;
8684
8808
  }
8685
-